Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/form-control-border-role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'@astryxdesign/build': patch
'@astryxdesign/cli': patch
'@astryxdesign/core': patch
'@astryxdesign/richtext': patch
'@astryxdesign/theme-butter': patch
'@astryxdesign/theme-chocolate': patch
'@astryxdesign/theme-gothic': patch
'@astryxdesign/theme-matcha': patch
'@astryxdesign/theme-neutral': patch
'@astryxdesign/theme-stone': patch
'@astryxdesign/theme-y2k': patch
---

[feat] Text fields and checkbox and radio boxes now have an edge people can find. A new theme role, `--color-border-control`, is the edge of a field shell and of a checkbox or radio box, at 3:1 or more against the surface and the page body (WCAG 2.2 non-text contrast). Before, these edges used `--color-border-emphasized`, which reached only 1.4–2.2:1 in Core's default theme, and the field surface differs from the page by only about 1.1:1, so the edge was the only cue.

What changes on screen:

- Core's default control edge is `#878D95` (light) and `#666A70` (dark), instead of `#CCD3DB` and `#494D53`.
- Every field built on the shared field shell uses it: TextInput, TextArea, NumberInput, DateInput, DateRangeInput, DateTimeInput, TimeInput, FileInput, Selector, MultiSelector, ComplexSelector, Typeahead, Tokenizer, PanelSearchInput, PowerSearch, and InputGroupText inside an InputGroup. A field's hover ring is mixed from the same edge.
- Unchecked CheckboxInput, CheckboxList, RadioList, and DropdownMenu checkbox and radio boxes use it. Checked and disabled boxes are unchanged.
- Every first-party theme sets its own value at 3:1 or more against its own surface and page body, and generated themes (`defineTheme({color})`) derive one.
- Cards, dividers, and every other use of `--color-border-emphasized` keep their lighter edge.

Custom themes: a theme that doesn't set `--color-border-control` gets Core's default. A custom theme that set only `--color-border-emphasized` for its field edges now gets Core's default control edge; set `--color-border-control` to a value that suits your palette and reaches 3:1 against your surface and page body.

@cixzhang
6 changes: 5 additions & 1 deletion apps/docsite/src/app/playground/themeEditor/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ export const COLOR_CATEGORIES = {
'--color-warning',
'--color-warning-muted',
],
Divider: ['--color-border', '--color-border-emphasized'],
Divider: [
'--color-border',
'--color-border-emphasized',
'--color-border-control',
],
Effects: ['--color-skeleton', '--color-shadow', '--color-tint-hover'],
} as const;

Expand Down
40 changes: 20 additions & 20 deletions docs/specs/components/Indicator/Indicator.spec.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/specs/components/InputGroup/InputGroupText.spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ No new public concept. Content is caller text or an icon.

## Behavioral and layout contract

| ID | Invariant | Basis |
| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| FR1 | InputGroupText renders one non-interactive element with no role, holding `children`; plain text with no right-to-left letter sits in an inner `span` with `dir="ltr"` (`design:bidirectionality` DR2). `ref`, `className`, `style`, `xstyle`, and other DOM props reach the outer element. | Current source and tests |
| FR2 | The cell centers its content vertically with small inline padding, uses body text in the secondary text color on the muted background, never wraps, and never shrinks. | Current source |
| FR3 | The cell draws an emphasized one-border-width border. Every cell after the first overlaps its leading neighbour by one border width. Only the first child's leading corners and the last child's trailing corners are rounded with the element radius. | Current source |
| FR4 | The cell carries `astryx-input-group-text`. | `architecture:component-theming-surface`; current source |
| ID | Invariant | Basis |
| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| FR1 | InputGroupText renders one non-interactive element with no role, holding `children`; plain text with no right-to-left letter sits in an inner `span` with `dir="ltr"` (`design:bidirectionality` DR2). `ref`, `className`, `style`, `xstyle`, and other DOM props reach the outer element. | Current source and tests |
| FR2 | The cell centers its content vertically with small inline padding, uses body text in the secondary text color on the muted background, never wraps, and never shrinks. | Current source |
| FR3 | The cell draws a one-border-width border in the control edge colour (`--color-border-control`). Every cell after the first overlaps its leading neighbour by one border width. Only the first child's leading corners and the last child's trailing corners are rounded with the element radius. | Current source |
| FR4 | The cell carries `astryx-input-group-text`. | `architecture:component-theming-surface`; current source |

### Allowed variation

Expand Down
1 change: 1 addition & 0 deletions packages/cli/api/theme/palette/generate/mapping.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export const NEUTRAL_STOPS = ownTable({
'--color-icon-secondary',
'--color-icon-disabled',
'--color-border-emphasized',
'--color-border-control',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss: this file is generated from packages/core/src/palette/mapping.ts (see its header), and Core's NEUTRAL_STOPS and OFFICIAL_NEUTRAL_STOPS have no --color-border-control row. So scripts/generate-cli-palette-engine.test.mjs ("is byte-identical to what Core's source generates") fails, and officialStops('--color-border-control') returns []: the theme editor's mapPalette then picks shade 0, #000000, for the control edge in light and dark, and its stop listing prints "light shade undefined, dark shade undefined". Add the role to Core's mapping.ts with stops (Neutral uses 55 and 50) and run pnpm generate:cli-palette-engine, or drop this line.

'--color-skeleton',
'--color-on-dark',
'--color-on-light',
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/assets/docs/tree/tokens-color.doc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ export const docs = {
"#CCD3DB",
"#494D53"
],
[
"--color-border-control",
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
"#878D95",
"#666A70"
],
[
"--color-skeleton",
"#CCD3DB",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/assets/docs/tree/tokens.doc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// AUTO-GENERATED — do not edit manually.
// Run: node scripts/generate-token-docs.mjs
// Total: 286 tokens across 15 categories.
// Total: 287 tokens across 15 categories.

/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
export const docs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// prettier-ignore
export const butterPaletteRefs = {
neutral: {
light: {0: '#000000', 15: '#1d1c11', 30: '#4a4732', 40: '#725538', 45: '#605f52', 55: '#79786a', 70: '#adac9e', 75: '#c7c4b2', 80: '#d6d3b8', 85: '#e5e3d4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
dark: {0: '#000000', 5: '#131107', 10: '#261a13', 15: '#2e2117', 20: '#3a2a1f', 30: '#4a4732', 35: '#49473b', 40: '#725538', 45: '#605f52', 60: '#939184', 70: '#adac9e', 80: '#d6d3b8', 85: '#f0edd4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
light: {0: '#000000', 15: '#1d1c11', 30: '#4a4732', 40: '#725538', 45: '#605f52', 55: '#79786a', 60: '#89877a', 70: '#adac9e', 75: '#c7c4b2', 80: '#d6d3b8', 85: '#e5e3d4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
dark: {0: '#000000', 5: '#131107', 10: '#261a13', 15: '#2e2117', 20: '#3a2a1f', 30: '#4a4732', 35: '#49473b', 40: '#725538', 45: '#605f52', 55: '#79786a', 60: '#939184', 70: '#adac9e', 80: '#d6d3b8', 85: '#f0edd4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
},
accent: {
light: {35: '#194ce8', 40: '#225bff', 55: '#4d82ff'},
Expand Down
19 changes: 10 additions & 9 deletions packages/cli/assets/templates/themes/butter/butterTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export const butterTheme = defineTheme({
// Border — softer taupe card outline (emphasized) in light mode.
'--color-border': [neutral.light[85], withAlpha(neutral.dark[90], '1a')],
'--color-border-emphasized': [neutral.light[75], neutral.dark[60]],
'--color-border-control': [neutral.light[60], neutral.dark[55]],

// Effects
'--color-skeleton': [neutral.light[85], neutral.dark[35]],
Expand Down Expand Up @@ -814,47 +815,47 @@ export const butterTheme = defineTheme({
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
'text-area': {
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
'number-input': {
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
'date-input': {
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
'time-input': {
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
selector: {
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
'variant:secondary': SECONDARY_SELECTOR,
Expand All @@ -863,7 +864,7 @@ export const butterTheme = defineTheme({
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
'variant:secondary': SECONDARY_SELECTOR,
Expand All @@ -873,15 +874,15 @@ export const butterTheme = defineTheme({
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
tokenizer: {
base: {
paddingBlock: 'var(--spacing-2)',
paddingInline: 'var(--spacing-3)',
borderColor: 'var(--color-border)',
borderColor: 'var(--color-border-control)',
},
...INPUT_STATUS_VARS,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const chocolateTheme = defineTheme({
// Border
'--color-border': ['#C4AC95', '#EDE4D41A'],
'--color-border-emphasized': ['#B88859', '#6b5540'],
'--color-border-control': ['#A67A50', '#7C6855'],

// Effects
'--color-skeleton': ['#C4AC95', '#6b5540'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// prettier-ignore
export const gothicPaletteRefs = {
neutral: {
dark: {0: '#000000', 10: '#101314', 15: '#191d20', 20: '#24292d', 35: '#3e454b', 40: '#495056', 50: '#5e676e', 65: '#7e8791', 75: '#96a0ab', 80: '#a7b1bb', 95: '#e8f1f6', 100: '#ffffff'},
dark: {0: '#000000', 10: '#101314', 15: '#191d20', 20: '#24292d', 35: '#3e454b', 40: '#495056', 50: '#5e676e', 55: '#687279', 65: '#7e8791', 75: '#96a0ab', 80: '#a7b1bb', 95: '#e8f1f6', 100: '#ffffff'},
},
purple: {
dark: {20: '#481b58', 30: '#5a2370', 60: '#947da6', 75: '#b29bc4', 80: '#c39adb'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export const gothicTheme = defineTheme({

'--color-border': withAlpha(neutral.dark[95], '1a'),
'--color-border-emphasized': neutral.dark[40],
'--color-border-control': neutral.dark[55],

'--color-skeleton': neutral.dark[40],
'--color-shadow': withAlpha(neutral.dark[0], '4d'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// prettier-ignore
export const matchaPaletteRefs = {
neutral: {
light: {0: '#000000', 20: '#3e481d', 25: '#4c5924', 30: '#5a6b2a', 40: '#707e46', 70: '#b7c29e', 75: '#c0cba9', 85: '#dce3ce', 95: '#f0f0e0', 100: '#ffffff'},
dark: {0: '#000000', 5: '#12140e', 10: '#1a1c14', 15: '#1e2016', 20: '#3e481d', 30: '#5a6440', 40: '#707e46', 45: '#7a894f', 60: '#94a468', 65: '#92af6a', 70: '#a8bf6a', 75: '#c0cba9', 80: '#cdd8b9', 100: '#ffffff'},
light: {0: '#000000', 20: '#3e481d', 25: '#4c5924', 30: '#5a6b2a', 40: '#707e46', 45: '#7c8a54', 70: '#b7c29e', 75: '#c0cba9', 85: '#dce3ce', 95: '#f0f0e0', 100: '#ffffff'},
dark: {0: '#000000', 5: '#12140e', 10: '#1a1c14', 15: '#1e2016', 20: '#3e481d', 30: '#5a6440', 35: '#657144', 40: '#707e46', 45: '#7a894f', 60: '#94a468', 65: '#92af6a', 70: '#a8bf6a', 75: '#c0cba9', 80: '#cdd8b9', 100: '#ffffff'},
},
teal: {
light: {35: '#245546', 50: '#2e6b5a'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const matchaTheme = defineTheme({
// Softer sage borders (default + emphasized/card) in light mode.
'--color-border': [neutral.light[85], withAlpha(neutral.dark[75], '1a')],
'--color-border-emphasized': [neutral.light[70], neutral.dark[30]],
'--color-border-control': [neutral.light[45], neutral.dark[35]],

// Effects
'--color-skeleton': [neutral.light[75], neutral.dark[30]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const neutralPaletteRefs = {
dark: {25: '#2b422b', 80: '#aad4a9', 85: '#bce0bb'},
},
neutral: {
light: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 30: '#474747', 35: '#525252', 45: '#6a6a6a', 60: '#919191', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 20: '#303030', 30: '#474747', 35: '#525252', 65: '#9e9e9e', 75: '#b9b9b9', 80: '#c6c6c6', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
light: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 30: '#474747', 35: '#525252', 45: '#6a6a6a', 55: '#848484', 60: '#919191', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 20: '#303030', 30: '#474747', 35: '#525252', 50: '#777777', 65: '#9e9e9e', 75: '#b9b9b9', 80: '#c6c6c6', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
},
orange: {
light: {25: '#622700', 30: '#733100', 75: '#ff9e55', 85: '#ffc7a1'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const neutralTheme = defineTheme({
withAlpha(neutral.dark[100], '1A'),
],
'--color-border-emphasized': [neutral.light[85], neutral.dark[35]],
'--color-border-control': [neutral.light[55], neutral.dark[50]],

// Effects
'--color-skeleton': [neutral.light[85], neutral.dark[35]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const stonePaletteRefs = {
},
neutral: {
light: {0: '#000000', 15: '#25252a', 30: '#46464e', 35: '#525259', 40: '#5f5f64', 55: '#848489', 85: '#d4d3dd', 90: '#e2e2e8', 95: '#f0f0f7', 100: '#ffffff'},
dark: {0: '#000000', 5: '#101018', 10: '#1b1b21', 15: '#25252a', 20: '#302f36', 25: '#3a3a42', 35: '#525159', 40: '#5e5e64', 65: '#9d9ea5', 70: '#ababb3', 80: '#c6c6cf', 90: '#e2e2e8', 95: '#f0f0f9', 100: '#ffffff'},
dark: {0: '#000000', 5: '#101018', 10: '#1b1b21', 15: '#25252a', 20: '#302f36', 25: '#3a3a42', 35: '#525159', 40: '#5e5e64', 50: '#77777c', 65: '#9d9ea5', 70: '#ababb3', 80: '#c6c6cf', 90: '#e2e2e8', 95: '#f0f0f9', 100: '#ffffff'},
},
orange: {
dark: {25: '#4e3522', 35: '#684c34', 70: '#c9a382', 90: '#ffdcbb'},
Expand Down
1 change: 1 addition & 0 deletions packages/cli/assets/templates/themes/stone/stoneTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export const stoneTheme = defineTheme({
// Border
'--color-border': [neutral.light[90], withAlpha(neutral.dark[95], '1a')],
'--color-border-emphasized': [neutral.light[55], neutral.dark[40]],
'--color-border-control': [neutral.light[55], neutral.dark[50]],

// Effects
'--color-skeleton': [neutral.light[85], neutral.dark[40]],
Expand Down
1 change: 1 addition & 0 deletions packages/cli/assets/templates/themes/y2k/y2kTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ export const y2kTheme = defineTheme({
// Bold borders preserve the heavy-outline Y2K look.
'--color-border': [neutral.light[20], withAlpha(neutral.dark[95], '1A')],
'--color-border-emphasized': [neutral.light[20], neutral.dark[45]],
'--color-border-control': [neutral.light[20], neutral.dark[45]],

// Effects
'--color-skeleton': [neutral.light[75], neutral.dark[25]],
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/assets/theme.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ export const myTheme = defineTheme({
* contrast 'standard' | 'high' — 'high' widens the text/surface tone
* gap, for dense data UI or bright and clinical screens
*
* Whatever seed you pass, generated text holds >= 4.5:1 against its surface
* and --color-border-emphasized >= 3:1. Two limits on that guarantee:
* Whatever seed you pass, generated text holds >= 4.5:1 against its surface,
* --color-border-emphasized >= 3:1 against its surface, and
* --color-border-control (the edge of a field or a checkbox or radio box)
* >= 3:1 against its surface and page body. Two limits on that guarantee:
*
* - It covers what this config generates. Write one side of a pair by hand
* in `tokens` below — an accent without its --color-on-accent, a surface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"usage",
"best-practices"
],
"skeleton": "904d7bbe31a404b5fc50f7e514f621cd49e51bb32f27e720cd40bd70b85157c2",
"skeleton": "52faf244c7e20708a32a8b1d458ecb2b1aa7243be32effe7faefcf2f03ee619f",
"mentions": []
},
"elevation": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/DateRangeInput/DateRangeInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('DateRangeInput', () => {
stylex.create({
ring: {
borderColor: {
default: colorVars['--color-border-emphasized'],
default: colorVars['--color-border-control'],
':focus-within': colorVars['--color-accent'],
},
boxShadow: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/DateTimeInput/DateTimeInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ describe('DateTimeInput', () => {
stylex.create({
ring: {
borderColor: {
default: colorVars['--color-border-emphasized'],
default: colorVars['--color-border-control'],
':focus-within': colorVars['--color-accent'],
},
boxShadow: {
Expand Down
Loading