@astryxdesign/core 0.7.2-canary.caec7ca → 0.7.2-canary.cbb7fa3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/AspectRatio/AspectRatio.d.ts +6 -8
  2. package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
  3. package/dist/AspectRatio/AspectRatio.js +44 -3
  4. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  5. package/dist/Breadcrumbs/BreadcrumbItem.js +5 -2
  6. package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
  7. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  8. package/dist/CheckboxInput/CheckboxInput.js +3 -1
  9. package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
  10. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  11. package/dist/CommandPalette/CommandPaletteInput.js +37 -5
  12. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  13. package/dist/ContextMenu/ContextMenu.js +5 -2
  14. package/dist/Dialog/Dialog.d.ts.map +1 -1
  15. package/dist/Dialog/Dialog.js +20 -8
  16. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  17. package/dist/DropdownMenu/DropdownMenu.js +46 -3
  18. package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -0
  19. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  20. package/dist/DropdownMenu/DropdownMenuContext.js +21 -0
  21. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  22. package/dist/DropdownMenu/DropdownMenuSubMenu.js +15 -4
  23. package/dist/EmptyState/EmptyState.d.ts.map +1 -1
  24. package/dist/EmptyState/EmptyState.js +4 -10
  25. package/dist/Field/Field.d.ts +1 -1
  26. package/dist/Field/Field.d.ts.map +1 -1
  27. package/dist/Field/Field.js +8 -4
  28. package/dist/Grid/GridSpan.d.ts.map +1 -1
  29. package/dist/Grid/GridSpan.js +1 -0
  30. package/dist/List/List.d.ts +46 -19
  31. package/dist/List/List.d.ts.map +1 -1
  32. package/dist/List/List.js +28 -10
  33. package/dist/List/ListContext.d.ts +8 -3
  34. package/dist/List/ListContext.d.ts.map +1 -1
  35. package/dist/List/ListContext.js +7 -2
  36. package/dist/List/ListItem.d.ts +4 -3
  37. package/dist/List/ListItem.d.ts.map +1 -1
  38. package/dist/List/ListItem.js +19 -8
  39. package/dist/List/index.d.ts +1 -1
  40. package/dist/List/index.d.ts.map +1 -1
  41. package/dist/Markdown/Markdown.d.ts.map +1 -1
  42. package/dist/Markdown/Markdown.js +8 -1
  43. package/dist/MetadataList/MetadataList.d.ts.map +1 -1
  44. package/dist/MetadataList/MetadataList.js +5 -1
  45. package/dist/MetadataList/MetadataListContext.d.ts +1 -1
  46. package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
  47. package/dist/RadioList/RadioList.d.ts +1 -1
  48. package/dist/RadioList/RadioList.d.ts.map +1 -1
  49. package/dist/RadioList/RadioList.js +6 -2
  50. package/dist/ToggleButton/ToggleButton.d.ts +3 -2
  51. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  52. package/dist/ToggleButton/ToggleButton.js +12 -1
  53. package/dist/TreeList/TreeList.d.ts.map +1 -1
  54. package/dist/TreeList/TreeList.js +1 -0
  55. package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
  56. package/dist/TreeList/TreeListBranches.js +2 -2
  57. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  58. package/dist/TreeList/TreeListItem.js +57 -9
  59. package/dist/astryx.css +16 -3
  60. package/dist/hooks/useMenuHover.d.ts.map +1 -1
  61. package/dist/hooks/useMenuHover.js +18 -13
  62. package/dist/utils/plainDate.d.ts.map +1 -1
  63. package/dist/utils/plainDate.js +15 -9
  64. package/package.json +3 -3
  65. package/src/AspectRatio/AspectRatio.test.tsx +44 -43
  66. package/src/AspectRatio/AspectRatio.tsx +38 -18
  67. package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +157 -0
  68. package/src/Avatar/Avatar.doc.mjs +5 -3
  69. package/src/AvatarGroup/AvatarGroup.doc.mjs +3 -2
  70. package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
  71. package/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts +3 -1
  72. package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
  73. package/src/CheckboxInput/CheckboxInput.tsx +3 -1
  74. package/src/CommandPalette/CommandPaletteInput.test.tsx +53 -4
  75. package/src/CommandPalette/CommandPaletteInput.tsx +33 -3
  76. package/src/CommandPalette/__tests__/CommandPaletteInputAudit.a11y.chromium.spec.ts +335 -0
  77. package/src/ContextMenu/ContextMenu.tsx +4 -1
  78. package/src/Dialog/Dialog.test.tsx +46 -0
  79. package/src/Dialog/Dialog.tsx +20 -7
  80. package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -14
  81. package/src/DropdownMenu/DropdownMenu.tsx +45 -2
  82. package/src/DropdownMenu/DropdownMenuContext.tsx +24 -0
  83. package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +185 -0
  84. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +17 -3
  85. package/src/EmptyState/EmptyState.doc.mjs +3 -2
  86. package/src/EmptyState/EmptyState.spec.md +189 -0
  87. package/src/EmptyState/EmptyState.test.tsx +74 -3
  88. package/src/EmptyState/EmptyState.tsx +4 -8
  89. package/src/Field/Field.doc.mjs +14 -8
  90. package/src/Field/Field.spec.md +217 -0
  91. package/src/Field/Field.test.tsx +60 -2
  92. package/src/Field/Field.tsx +17 -8
  93. package/src/Grid/GridSpan.tsx +3 -0
  94. package/src/Item/Item.doc.mjs +1 -1
  95. package/src/Item/Item.tsx +1 -1
  96. package/src/List/List.doc.mjs +14 -1
  97. package/src/List/List.spec.md +129 -77
  98. package/src/List/List.test.tsx +144 -94
  99. package/src/List/List.tsx +74 -18
  100. package/src/List/ListContext.tsx +9 -3
  101. package/src/List/ListItem.tsx +46 -26
  102. package/src/List/index.ts +1 -1
  103. package/src/Markdown/Markdown.tsx +14 -1
  104. package/src/MetadataList/MetadataList.doc.mjs +2 -2
  105. package/src/MetadataList/MetadataList.test.tsx +38 -0
  106. package/src/MetadataList/MetadataList.tsx +8 -1
  107. package/src/MetadataList/MetadataListContext.tsx +1 -1
  108. package/src/RadioList/RadioList.fr10.test.tsx +45 -2
  109. package/src/RadioList/RadioList.tsx +4 -1
  110. package/src/Slider/Slider.spec.md +39 -18
  111. package/src/TabList/TabList.spec.md +57 -44
  112. package/src/TimeInput/TimeInput.fr10.test.tsx +15 -0
  113. package/src/ToggleButton/ToggleButton.test.tsx +95 -0
  114. package/src/ToggleButton/ToggleButton.tsx +12 -1
  115. package/src/TreeList/TreeList.doc.mjs +1 -0
  116. package/src/TreeList/TreeList.test.tsx +327 -6
  117. package/src/TreeList/TreeList.tsx +5 -1
  118. package/src/TreeList/TreeListBranches.tsx +6 -0
  119. package/src/TreeList/TreeListItem.tsx +88 -13
  120. package/src/docPropLiterals.test.ts +36 -10
  121. package/src/hooks/useMenuHover.ts +18 -13
  122. package/src/reset.css +0 -29
  123. package/src/theme/derivedVarRegistry.test.ts +7 -0
  124. package/src/utils/plainDate.test.ts +37 -1
  125. package/src/utils/plainDate.ts +15 -5
@@ -114,7 +114,7 @@ export const docs = {
114
114
  },
115
115
  {
116
116
  name: 'labelIcon',
117
- type: 'IconType',
117
+ type: 'ReactNode | IconType',
118
118
  description: 'Icon to display before the label text. See `astryx docs icons` for valid semantic names.',
119
119
  },
120
120
  {
@@ -129,8 +129,8 @@ export const docs = {
129
129
  },
130
130
  {
131
131
  name: 'statusVariant',
132
- type: "'attached' | 'detached'",
133
- description: 'How the status message renders relative to the input. Attached overlaps the input border; detached floats below.',
132
+ type: "'attached' | 'detached' | 'tooltip'",
133
+ description: 'How status feedback is placed. Attached overlaps an eligible opaque, bordered, fixed-height control; detached renders a message below custom or non-bordered controls; tooltip leaves the visible affordance to the wrapped input and announces its message without a FieldStatus box.',
134
134
  default: "'attached'",
135
135
  },
136
136
  {
@@ -170,17 +170,23 @@ export const docs = {
170
170
  { guidance: true, description: 'Always provide a label for accessibility, even if visually hidden with isLabelHidden.' },
171
171
  { guidance: true, description: 'Use inputID and descriptionID to connect the label and description to the inner control with htmlFor and aria-describedby.' },
172
172
  { guidance: false, description: 'Nest Field around styled inputs such as TextInput, Typeahead, Select, DateInput, or TextArea; those components already render their own Field shell.' },
173
- { guidance: false, description: 'Use the attached status variant on non-bordered controls such as sliders, switches, or checkboxes; use detached so the message does not overlap the control.' },
173
+ { guidance: true, description: 'Use attached status only when the wrapped control is opaque, bordered, and fixed-height; use detached for custom, tall, translucent, or non-bordered controls.' },
174
174
  { guidance: false, description: 'Set both isOptional and isRequired on the same field.' },
175
175
  { guidance: false, description: 'Hide the label without providing an alternative way for the user to understand the field purpose.' },
176
176
  ],
177
177
  anatomy: [
178
+ {name: 'Container', required: true, description: 'Root field box that owns layout, width, and local stacking for the label, control, and status.'},
178
179
  {name: 'Label', required: true, description: 'Text identifying the field. Always rendered for accessibility, optionally hidden visually.'},
179
- {name: 'Description', required: false, description: 'Helper text between the label and input explaining what to enter.'},
180
+ {name: 'Ordinary description', required: false, description: 'Helper text under the label in the ordinary field layout.'},
181
+ {name: 'Horizontal-label description', required: false, description: 'Helper text in the control column when FormLayout owns horizontal labels.'},
180
182
  {name: 'Control slot', required: true, description: 'A custom, native, or third-party control that does not already render a field shell.'},
181
183
  {name: 'Status message', required: false, description: 'Inline validation feedback showing error, warning, or success with a message.'},
184
+ {name: 'Input status icon', required: false, description: 'Shared status affordance used by Field-composed input controls.'},
185
+ {name: 'Input clear button', required: false, description: 'Shared clear action used by Field-composed input controls.'},
186
+ {name: 'Input clear icon', required: false, description: 'Glyph inside the shared input clear action.'},
182
187
  {name: 'Optional/Required indicator', required: false, description: 'Badge next to the label showing whether the field is optional or required.'},
183
- {name: 'Label tooltip', required: false, description: 'Info icon at the end of the label with a tooltip explaining the field.'},
188
+ {name: 'Label tooltip trigger', required: false, description: 'Info icon beside the label that opens explanatory content.'},
189
+ {name: 'Label tooltip surface', required: false, description: 'Layer-hosted explanatory content for the label tooltip.'},
184
190
  ],
185
191
  },
186
192
  examples: [
@@ -279,7 +285,7 @@ export const docsZh = {
279
285
  { guidance: true, description: 'Always provide a label for accessibility, even if visually hidden with isLabelHidden.' },
280
286
  { guidance: true, description: 'Use inputID and descriptionID to connect the label and description to the inner control with htmlFor and aria-describedby.' },
281
287
  { guidance: false, description: 'Nest Field around styled inputs such as TextInput, Typeahead, Select, DateInput, or TextArea; those components already render their own Field shell.' },
282
- { guidance: false, description: 'Use the attached status variant on non-bordered controls such as sliders, switches, or checkboxes; use detached so the message does not overlap the control.' },
288
+ { guidance: true, description: 'Use attached status only when the wrapped control is opaque, bordered, and fixed-height; use detached for custom, tall, translucent, or non-bordered controls.' },
283
289
  { guidance: false, description: 'Set both isOptional and isRequired on the same field.' },
284
290
  { guidance: false, description: 'Hide the label without providing an alternative way for the user to understand the field purpose.' },
285
291
  ],
@@ -297,7 +303,7 @@ export const docsDense = {
297
303
  { guidance: true, description: 'Always provide a label; visually hide it only when context is clear.' },
298
304
  { guidance: true, description: 'Wire inputID/descriptionID to htmlFor and aria-describedby on the inner control.' },
299
305
  { guidance: false, description: 'Nest Field around styled inputs; it double-renders labels and status UI.' },
300
- { guidance: false, description: 'Use attached status on sliders/switches/checkboxes; use detached so messages do not overlap.' },
306
+ { guidance: true, description: 'Use attached status only for opaque, bordered, fixed-height controls; use detached for custom, tall, translucent, or non-bordered controls.' },
301
307
  { guidance: false, description: 'Set both isOptional and isRequired on the same field.' },
302
308
  { guidance: false, description: 'Hide the label without another way to understand field purpose.' },
303
309
  ],
@@ -0,0 +1,217 @@
1
+ ---
2
+ schema_version: 3
3
+ template_version: 7
4
+ kind: component
5
+ id: component:Field
6
+ authority: draft
7
+ archive_reason: null
8
+ superseded_by: null
9
+ approved_by: null
10
+ approved_at: null
11
+ owners: [cixzhang]
12
+ review_triggers: [public-api, behavior, layout, theming, accessibility]
13
+ verified_by:
14
+ [
15
+ packages/core/src/Field/Field.test.tsx,
16
+ packages/core/src/theme/themingTargets.test.ts,
17
+ packages/core/src/docPropLiterals.test.ts,
18
+ packages/core/src/docPropReferences.test.ts,
19
+ ]
20
+ modules: []
21
+ families: [family:input-fields]
22
+ design_specs:
23
+ [design:spatial-hierarchy, design:typography-hierarchy, design:system-states]
24
+ architecture:
25
+ [
26
+ architecture:public-component-api,
27
+ architecture:component-theming-surface,
28
+ architecture:component-test-sufficiency,
29
+ ]
30
+ contributing: []
31
+ system_specs:
32
+ [spec:AST-027/FR1, spec:AST-027/FR2, spec:AST-027/FR3, spec:AST-027/FR11]
33
+ ---
34
+
35
+ # Field component contract
36
+
37
+ ## Contract at a glance
38
+
39
+ | Area | Contract |
40
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41
+ | Public contract | `Field` wraps one caller-owned control with a label, optional description and status, optionality indicators, an explicit width, and root `BaseProps`; it also consumes FormLayout's horizontal-label mode. |
42
+ | Behavior | Single controls use a native label association; groups use a labelled span. Status messages receive stable IDs and use persistent live regions. Horizontal-label mode exposes one protected `data-layout` theme axis. |
43
+ | End-user impact | People can identify a custom control, hear its description and changing status, and keep label/control/status relationships together across ordinary and horizontal form layouts. |
44
+ | Builder impact | Builders provide the control and its ID, wire descriptions/status IDs to that control, choose group semantics when needed, and use a status placement that is safe for the wrapped surface. |
45
+ | Compatibility/readiness | This draft records released behavior. It adds no API or policy. The released default `statusVariant="attached"` for arbitrary children conflicts with the capability boundary in `family:input-fields/FR8` and remains open. |
46
+ | Review checks | Reject a lost label/group association, dropped root props, caller replacement of `data-layout`, duplicate/missing status announcement, escaped local z-index, undocumented public literals, or a claim that all custom controls safely support attached status. |
47
+ | Governing rules | Established public `Field` interface; `family:input-fields` shared ownership and FR8; `architecture:public-component-api/INV5–INV8`; `spec:AST-027/FR1–FR3`; HTML label and ARIA naming/description semantics. |
48
+
49
+ This table is a review projection; the body below is authoritative.
50
+
51
+ ## Intent
52
+
53
+ `Field` supplies shared label, description, status, width, and layout chrome for a native, custom, or third-party control that does not already own an Astryx field shell. The caller continues to own the control's value, interaction model, and control-specific accessibility semantics.
54
+
55
+ ## Compatibility and migration
56
+
57
+ - Released default preserved: yes; `statusVariant` still defaults to `attached` in the current implementation.
58
+ - Compatibility class: observational only; this draft changes no public prop, default, or behavior.
59
+ - Controlled/uncontrolled behavior: caller-owned and unchanged.
60
+ - Migration decision: none; resolving OQ1 requires a separate compatibility decision.
61
+
62
+ ## Ownership boundary
63
+
64
+ **Owns**
65
+
66
+ - The root field box, explicit width, local stacking boundary, and composition order.
67
+ - Label and description placement around the caller-owned control.
68
+ - Single-control versus grouped-label semantics.
69
+ - Status-message placement and persistent live-region announcement.
70
+ - The FormLayout horizontal-label projection.
71
+
72
+ **Does not own / non-goals**
73
+
74
+ - The wrapped control's value, focus model, keyboard behavior, disabled behavior, or event semantics — owned by the caller or wrapped component.
75
+ - Applying `aria-describedby` to the wrapped control — the caller supplies the control and wires the generated or explicit IDs.
76
+ - The visual and semantic contract of `FieldLabel`, `FieldStatus`, `Tooltip`, or caller-owned children — owned by those components.
77
+ - Input-family member APIs and control-box part props — owned by `family:input-fields` and each member.
78
+
79
+ ## Public concepts
80
+
81
+ | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
82
+ | ---------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | ------------------------------ | --------------------- | ------------------------- | ------------------------------------- |
83
+ | label mode | single control; group | Chooses a native `<label htmlFor>` or a `<span>` named through `aria-labelledby`. | All layouts. | single control | `component:Field` | released | Type-constrained |
84
+ | label visibility | visible; visually hidden | Hides label and description visually while preserving them for assistive technology. | All layouts. | visible | `component:Field` | released | Type-constrained |
85
+ | optionality marker | none; optional; required | Shows the localized exception to FormLayout's optionality default. | Label presentation. | none | `component:Field` | released | Both set warns; optional wins visibly |
86
+ | status placement | `attached`; `detached`; `tooltip` | Places a status box behind the control, below it, or leaves visible tooltip affordance to input. | Message required for a rendered box; tooltip still announces messages. | `attached` (see OQ1) | `family:input-fields` | released; conformance gap | Type-constrained |
87
+ | width | absent; number; CSS size string | Sizes the complete ordinary field box. | Ordinary box layout; horizontal-label mode uses `display: contents`. | containing layout | `component:Field` | released | Type-constrained |
88
+ | field layout | ordinary box; `horizontal-labels` from FormLayout | Stacks content or projects label and input group into the parent grid. | Resolved from `FormLayoutContext`. | ordinary box | `component:Field` | released | Context-constrained |
89
+ | description/status IDs | explicit; generated from `inputID`; absent | Names stable description and message elements for caller-owned `aria-describedby` wiring. | Generated only when the corresponding text is present. | generated when text is present | `component:Field` | released | Empty text omits output |
90
+
91
+ ## Behavioral and layout contract
92
+
93
+ Draft requirements identify their basis so observed code is not mistaken for an intentional decision.
94
+
95
+ | ID | Candidate invariant | Basis | Draft review state |
96
+ | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | ----------------------------------- |
97
+ | FR1 | A single-control label renders as `<label htmlFor={inputID}>`; a group label renders as a non-label element with `labelID` for caller-owned `aria-labelledby`. | Established public interface; HTML and ARIA semantics | settled observation |
98
+ | FR2 | Visually hidden labels and descriptions remain in the DOM and out of layout flow. | Established public interface and accessibility behavior | settled observation |
99
+ | FR3 | Description and status IDs use explicit values when supplied and otherwise resolve to `${inputID}-desc` and `${inputID}-status` only when text exists. | Established public interface | settled observation |
100
+ | FR4 | Error status messages announce assertively and warning/success messages politely through persistent live regions; tooltip placement renders no `FieldStatus` box but preserves the announcement. | Existing tests; family ownership | settled observation |
101
+ | FR5 | Ordinary layout orders label, control, then optional status. Horizontal-label mode places the label wrapper before one description/control/status group and reflects `data-layout="horizontal-labels"`; caller props cannot replace that owned theme marker. | Established layout interface; `architecture:public-component-api/INV5` | settled observation |
102
+ | FR6 | `width` applies to the ordinary root field box; it does not style the caller-owned control and has no box to target in horizontal-label mode. | Established public interface; `family:input-fields` shared owner | settled observation |
103
+ | FR7 | Root ref, data/ARIA/DOM inputs, events, `xstyle`, class name, and inline style reach or compose on the root without replacing component-owned semantics. | `architecture:public-component-api/INV5–INV8` | settled observation |
104
+ | FR8 | The Field root isolates every local attached-status paint relationship without assigning the root a page-level z-index. | `spec:AST-027/FR1–FR3`, `FR11` | settled observation |
105
+ | FR9 | Attached status is safe only for an opaque, bordered, fixed-height control with reliable size reflection; custom, tall, wrapped, translucent, or non-bordered controls use detached or component-owned placement. | `family:input-fields/FR8`; current default mismatch | human decision for released default |
106
+
107
+ ### Allowed variation
108
+
109
+ - **AV1 — Caller-owned control.** Any control markup may occupy the slot; Field does not inspect, clone, or change it.
110
+ - **AV2 — Form arrangement.** FormLayout may choose ordinary or horizontal-label arrangement without changing label, description, status, or announcement ownership.
111
+ - **AV3 — Status surface.** Eligible controls may use attached placement; other controls use detached or a member-owned tooltip presentation.
112
+
113
+ ### Representative states
114
+
115
+ | State | Required invariant | Allowed variation |
116
+ | ----------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------- |
117
+ | label only | One associated label precedes the caller-owned control. | Visible or visually hidden. |
118
+ | description | One description element receives the resolved ID. | Caller may use an explicit ID or the generated value. |
119
+ | group | Group label is not a literal `<label>` and is referenceable by ID. | Caller owns the group role and `aria-labelledby`. |
120
+ | status | Message receives resolved ID and is announced once on its urgency channel. | Attached/detached box or tooltip-owned visible affordance. |
121
+ | horizontal labels | Label and input group participate in the parent grid and retain `data-layout`. | Description/status may be absent. |
122
+ | explicit width | Ordinary root receives the requested size and remains shrinkable. | Number or CSS size string. |
123
+
124
+ ### Transformation and precedence order
125
+
126
+ - **ORD1 — Root props.** Caller DOM/data/event props are forwarded first; Field-owned visual-state reflection is applied afterward; StyleX, caller class, and caller inline style compose in the documented order.
127
+ - **ORD2 — IDs.** Explicit description/status ID wins; otherwise text presence derives an ID from `inputID`; absent text produces no ID-bearing element.
128
+ - **ORD3 — Optionality.** FormLayout default optionality suppresses the matching visible marker; if both local booleans are true, Field warns and the optional marker wins visibly.
129
+
130
+ ### Performance and resources
131
+
132
+ - **PR1 — No per-field global resource.** Field owns no listener, observer, timer, or external store. Status announcement delegates to the shared persistent live-region runtime.
133
+
134
+ ## Accessibility contract
135
+
136
+ - **AR1 — Label association.** Single controls receive a native label association; grouped controls use caller-wired `aria-labelledby` and never a misleading literal `<label>`.
137
+ - **AR2 — Description association.** Description text remains separate from the accessible name and exposes a stable ID for caller-owned `aria-describedby`.
138
+ - **AR3 — Status announcement.** Changing status text is announced through the persistent live region, including tooltip placement where no message box renders.
139
+ - **AR4 — Hidden labels.** Visually hidden label and description text remain available to assistive technology.
140
+
141
+ ## Design relationships
142
+
143
+ | Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
144
+ | ----------------------------- | -------------------------------------------------------- | ------------------------------------------------------ | ------------------------- | ------------------ |
145
+ | Label and description | `design:typography-hierarchy/DR4`, `DR6` | prescribed roles; exact tuning remains token-owned | label and supporting text | FR1–FR3 |
146
+ | Label/control/status grouping | `design:spatial-hierarchy` local and group relationships | prescribed relationship; exact gap remains token-owned | one field group | FR5 |
147
+ | Semantic status | `design:system-states/DR2` | delegated to FieldStatus and wrapped input | supporting feedback | FR4, FR9 |
148
+
149
+ ### Theming anatomy
150
+
151
+ <!-- anatomy-theming:v1 -->
152
+
153
+ ```json
154
+ {
155
+ "Container": {"target": "field"},
156
+ "Label": {"target": "field-label"},
157
+ "Ordinary description": {
158
+ "none": {
159
+ "reason": "reachability-gap: The ordinary-layout description paints supporting text outside the field-label target and has no current public target of its own."
160
+ }
161
+ },
162
+ "Horizontal-label description": {
163
+ "delegatesTo": {"owner": "component:Text", "target": "text"}
164
+ },
165
+ "Control slot": {
166
+ "none": {
167
+ "reason": "intentional: The wrapped control is caller-owned or another Astryx component and retains its own theming surface."
168
+ }
169
+ },
170
+ "Status message": {"target": "field-status"},
171
+ "Input status icon": {"target": "input-status-icon"},
172
+ "Input clear button": {"target": "input-clear-button"},
173
+ "Input clear icon": {"target": "input-clear-icon"},
174
+ "Optional/Required indicator": {"inherits": "field-label"},
175
+ "Label tooltip trigger": {
176
+ "delegatesTo": {"owner": "component:Icon", "target": "icon"}
177
+ },
178
+ "Label tooltip surface": {
179
+ "delegatesTo": {"owner": "component:Tooltip", "target": "tooltip"}
180
+ }
181
+ }
182
+ ```
183
+
184
+ The ordinary description remains stable consumer anatomy without a Field-owned target. A visible horizontal-label description delegates to `Text/text`; when `isLabelHidden` is true, the same content delegates to `VisuallyHidden` and exposes no painted target. The label tooltip splits its visible `Icon/icon` trigger from its layer-hosted `Tooltip/tooltip` surface.
185
+
186
+ ## Family and system relationships
187
+
188
+ - `family:input-fields` owns shared status-placement capability and identifies Field as the standalone label, description, status-placement, and explicit-width owner.
189
+ - `architecture:public-component-api` owns root prop, style, event, and ref composition.
190
+ - `architecture:component-theming-surface` owns anatomy qualification and target disposition.
191
+ - `architecture:component-test-sufficiency` owns mutation-sensitive evidence and bounded partitions.
192
+ - `spec:AST-027` owns the isolated local paint relationship between the control and attached status.
193
+
194
+ ## Verification map
195
+
196
+ | Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
197
+ | ------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------- |
198
+ | FR1–FR3, AR1–AR2, AR4 | `Field.test.tsx` DOM/accessibility tests | single control, group, visible/hidden label, explicit/generated IDs | A lost association, wrong element, missing hidden text, or wrong ID fails. | `audit:Field/accessibility` |
199
+ | FR4, AR3 | `Field.test.tsx` announcement tests plus exact-head browser accessibility evidence | first mount, update, repeat, error, warning, attached, detached, tooltip | A missing, duplicate, stale, or wrong-urgency announcement fails. | `audit:Field/accessibility` |
200
+ | FR5–FR7, ORD1 | `Field.test.tsx`, BaseProps lint, theming-target tests, and exact-head visual evidence | ordinary/horizontal layout; class/style/xstyle/data/event/ref; description/status | Dropped caller input, replaceable layout marker, wrong order, or lost target fails. | `audit:Field/api` |
201
+ | FR8 | computed-style tests and exact-head browser rendering | attached, detached, tooltip, no status | Removing isolation or ranking the root outside its parent fails. | `audit:Field/code-health` |
202
+ | FR9 | family contract review and component-owned visual evidence | eligible bordered control; custom/tall/non-bordered control | Attached placement on an ineligible surface remains visible as the current conformance gap. | `audit:Field/behavior` |
203
+ | Theming anatomy | knowledge validation and theming-target tests | Field root, label, description, caller control, status, shared input affordances, indicator, tooltip | Missing, duplicate, or wrongly owned dispositions fail. | `audit:Field/theming` |
204
+ | Documentation projection | docs typecheck and prop literal/reference tests | labelIcon; all status placements; anatomy and usage guidance | Docs omit or misstate a public type/literal/owner and validation fails or review rejects it. | `audit:Field/docs` |
205
+ | RTL applicability | exact-head RTL audit and verified-N/A registry | all checked-in Field stories and source | A directional glyph, physical inline placement, order, scroll/drag, overlay, or directional keyboard behavior makes N/A stale. | `audit:Field/i18n-rtl` |
206
+
207
+ ## Decision log
208
+
209
+ No component-local decision is asserted. This draft records released behavior and leaves the current family-owned status-placement conflict in OQ1.
210
+
211
+ ## Open questions
212
+
213
+ - **OQ1 — How should Field migrate the released `attached` default so arbitrary custom controls cannot receive a placement that `family:input-fields/FR8` says they may not safely support?** (`human-api`)
214
+
215
+ ## Content boundary
216
+
217
+ This draft records verified shipped behavior and the current family-owned conformance gap. It does not approve a new default, migration, theme target, or compatibility promise, and it does not duplicate audit scores or run evidence.
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @file Field.test.tsx
5
- * @input Uses vitest, @testing-library/react, Field component
5
+ * @input Uses Vitest, Testing Library, StyleX, Field, FormLayoutContext
6
6
  * @output Unit tests for Field component behavior
7
7
  * @position Testing; validates Field.tsx implementation
8
8
  *
@@ -10,11 +10,18 @@
10
10
  */
11
11
 
12
12
  import {describe, it, expect, vi, afterEach} from 'vitest';
13
- import {render, screen, waitFor} from '@testing-library/react';
13
+ import {render, screen, waitFor, fireEvent} from '@testing-library/react';
14
+ import * as stylex from '@stylexjs/stylex';
14
15
  import {Field} from './Field';
15
16
  import {FormLayoutContext} from '../FormLayout/FormLayoutContext';
16
17
  import {__resetLiveRegionsForTest} from '../hooks/useAnnounce';
17
18
 
19
+ const testStyles = stylex.create({
20
+ root: {
21
+ minWidth: '123px',
22
+ },
23
+ });
24
+
18
25
  function politeRegion(): HTMLElement | null {
19
26
  return document.querySelector('[data-astryx-live-region="polite"]');
20
27
  }
@@ -572,6 +579,57 @@ describe('Field', () => {
572
579
  </FormLayoutContext>
573
580
  );
574
581
 
582
+ it('composes root props without letting callers replace layout semantics', () => {
583
+ const onClick = vi.fn();
584
+ const expectedXstyleClass = stylex.props(testStyles.root).className;
585
+ if (expectedXstyleClass == null) {
586
+ throw new Error('Expected the test xstyle to produce a class name.');
587
+ }
588
+
589
+ render(
590
+ <Field
591
+ label="Name"
592
+ inputID="name-input"
593
+ data-testid="field"
594
+ data-layout="consumer"
595
+ data-owner="consumer"
596
+ className="consumer-class"
597
+ style={{width: '321px'}}
598
+ xstyle={testStyles.root}
599
+ onClick={onClick}>
600
+ <input id="name-input" />
601
+ </Field>,
602
+ {wrapper: horizontalLabelsWrapper},
603
+ );
604
+
605
+ const field = screen.getByTestId('field');
606
+ expect(field).toHaveClass('astryx-field', 'consumer-class');
607
+ expect(field).toHaveClass(expectedXstyleClass);
608
+ expect(field).toHaveAttribute('data-layout', 'horizontal-labels');
609
+ expect(field).toHaveAttribute('data-owner', 'consumer');
610
+ expect(field).toHaveStyle({width: '321px'});
611
+ fireEvent.click(field);
612
+ expect(onClick).toHaveBeenCalledOnce();
613
+ });
614
+
615
+ it('visually hides the description in horizontal-label mode when the label is hidden', () => {
616
+ render(
617
+ <Field
618
+ label="Search"
619
+ inputID="search-input"
620
+ isLabelHidden
621
+ description="Search for items"
622
+ descriptionID="search-desc">
623
+ <input id="search-input" aria-describedby="search-desc" />
624
+ </Field>,
625
+ {wrapper: horizontalLabelsWrapper},
626
+ );
627
+
628
+ const description = screen.getByText('Search for items');
629
+ expect(description.className).toContain('visuallyHidden');
630
+ expect(description).toHaveAttribute('id', 'search-desc');
631
+ });
632
+
575
633
  it('applies display:contents when in horizontal-labels context', () => {
576
634
  const {container} = render(
577
635
  <Field label="Name" inputID="name-input">
@@ -4,7 +4,7 @@
4
4
 
5
5
  /**
6
6
  * @file Field.tsx
7
- * @input Uses React, HTMLAttributes, ReactNode, FieldLabel, IconType, useFieldStatusAnnouncement
7
+ * @input Uses React, StyleX, BaseProps, FieldLabel/FieldStatus, FormLayoutContext, Text, VisuallyHidden, theme/status utilities
8
8
  * @output Exports Field component, FieldProps
9
9
  * @position Core implementation; consumed by index.ts, tested by Field.test.tsx
10
10
  *
@@ -30,6 +30,7 @@ import {mergeProps} from '../utils';
30
30
  import {useDevWarning} from '../hooks/useDevWarning';
31
31
  import {FormLayoutContext} from '../FormLayout/FormLayoutContext';
32
32
  import {Text} from '../Text';
33
+ import {VisuallyHidden} from '../VisuallyHidden';
33
34
  import {themeProps} from '../utils/themeProps';
34
35
 
35
36
  const styles = stylex.create({
@@ -298,20 +299,28 @@ export function Field({
298
299
  return (
299
300
  <div
300
301
  ref={ref}
302
+ {...props}
301
303
  {...mergeProps(
302
304
  themeProps('field', {layout: 'horizontal-labels'}),
303
305
  stylex.props(styles.horizontalLabels, xstyle),
304
306
  className,
305
307
  style,
306
- )}
307
- {...props}>
308
+ )}>
308
309
  <div {...stylex.props(styles.horizontalLabelAlign)}>{labelNode}</div>
309
310
  <div {...stylex.props(styles.inputStatusWrapper)}>
310
- {description && (
311
- <Text type="supporting" display="block" id={resolvedDescriptionID}>
312
- {description}
313
- </Text>
314
- )}
311
+ {description &&
312
+ (isLabelHidden ? (
313
+ <VisuallyHidden id={resolvedDescriptionID}>
314
+ {description}
315
+ </VisuallyHidden>
316
+ ) : (
317
+ <Text
318
+ type="supporting"
319
+ display="block"
320
+ id={resolvedDescriptionID}>
321
+ {description}
322
+ </Text>
323
+ ))}
315
324
  {children}
316
325
  {statusNode}
317
326
  </div>
@@ -47,6 +47,9 @@ const baseStyles = stylex.create({
47
47
  minWidth: 0, // Prevent overflow in grid
48
48
  // Make span fill grid cell and stretch children
49
49
  display: 'grid',
50
+ // The implicit `auto` column would grow to a child's min-content width;
51
+ // a zero minimum keeps it inside the span.
52
+ gridTemplateColumns: 'minmax(0, 1fr)',
50
53
  height: '100%',
51
54
  },
52
55
  });
@@ -49,7 +49,7 @@ export const docs = {
49
49
  {
50
50
  name: '--_item-inset-inline',
51
51
  description:
52
- 'Inline inset of the row. Item derives its paddingInline from this variable, and List reads it to cancel the inset when edgeCompensation="inline". Set paddingInline on `item` in a theme and both stay in sync.',
52
+ 'Inline inset of the row. Item derives its paddingInline from this variable, and List reads it to place rows for its edge treatments (edge="flush", "outset", and "bleed"). Set paddingInline on `item` in a theme and both stay in sync.',
53
53
  default: 'var(--spacing-2) (var(--spacing-3) for density="spacious")',
54
54
  private: true,
55
55
  },
package/src/Item/Item.tsx CHANGED
@@ -342,7 +342,7 @@ const styles = stylex.create({
342
342
  gap: spacingVars['--spacing-2'],
343
343
  // The inline inset is published as --_item-inset-inline and the padding
344
344
  // derives from it, so consumers that need to compensate for the inset
345
- // (List's edgeCompensation) read the var instead of mirroring the values.
345
+ // (List's edge treatments) read the var instead of mirroring the values.
346
346
  // Themes that set paddingInline on `item` also feed this var via the
347
347
  // derived var registry, keeping padding and compensation in sync.
348
348
  '--_item-inset-inline': spacingVars['--spacing-2'],
@@ -41,11 +41,18 @@ export const docs = {
41
41
  description: 'Show dividers between items.',
42
42
  default: 'false',
43
43
  },
44
+ {
45
+ name: 'edge',
46
+ type: "'padded' | 'flush' | 'outset' | 'bleed'",
47
+ description:
48
+ "Where each row's text, dividers, and hover and selection backgrounds sit, relative to the list's edges and the container around it. 'padded' keeps text inside each row's padding, so it starts a little in from a heading above the list and backgrounds have room around it. 'flush' drops the rows' side padding: text starts on the heading's line, and dividers and backgrounds stop at the row's content, with no room beyond it on either side. It works anywhere and suits static rows. 'outset' puts text on the heading's line and reaches dividers and backgrounds a little past it into the container's padding; it suits interactive rows in a container. 'bleed' puts text on the heading's line and reaches dividers and backgrounds to the container's edges with square corners, like Table rows in a Card. A row's first content is what lines up with the heading: its marker, icon, or avatar when it has one, otherwise its label. 'outset' and 'bleed' reach into the padding of the nearest container that shares its padding: a Card, Section, Dialog, or BottomSheet, or a transparent container such as a Layout region with explicit padding or a padded ScrollableArea. Place the List directly in that container's padding: padding that Stack, Center, or your own styles add in between is not counted. Drawers and the automatic padding of LayoutContent and LayoutPanel aren't supported yet. With no such container, including in a Popover, they look like 'padded'. In a container with less padding than the rows' own, text starts a little after the heading's line. A theme's inline padding on `item` replaces the row padding of every value, including the zero padding of flush.",
49
+ default: "'padded'",
50
+ },
44
51
  {
45
52
  name: 'edgeCompensation',
46
53
  type: "'inline'",
47
54
  description:
48
- "Compensate for item content inset on each inline edge by cancelling the smaller of each item's built-in horizontal inset and the container's published inline padding. The margin reads the same variable the items derive their inline padding from, so it tracks density and theme padding overrides automatically without pulling rows outside zero-padding or full-bleed surfaces. Use under a section heading to bring row text toward the heading text. Content aligns when container padding is at least the item inset; smaller padding leaves some inset uncompensated. Omit to leave item positions unchanged.",
55
+ "Deprecated: use edge=\"outset\", which this sets. Still works; edge wins when both are set. `astryx upgrade` rewrites existing usage.",
49
56
  },
50
57
  {
51
58
  name: 'header',
@@ -89,6 +96,8 @@ export const docs = {
89
96
  bestPractices: [
90
97
  { guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },
91
98
  { guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },
99
+ { guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },
100
+ { guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },
92
101
  { guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },
93
102
  { guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },
94
103
  { guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },
@@ -109,6 +118,8 @@ export const docsZh = {
109
118
  bestPractices: [
110
119
  { guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },
111
120
  { guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },
121
+ { guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },
122
+ { guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },
112
123
  { guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },
113
124
  { guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },
114
125
  { guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },
@@ -132,6 +143,8 @@ export const docsDense = {
132
143
  bestPractices: [
133
144
  { guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },
134
145
  { guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },
146
+ { guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },
147
+ { guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },
135
148
  { guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },
136
149
  { guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },
137
150
  { guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },