@astryxdesign/core 0.7.1 → 0.7.2-canary.151434a

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 (251) 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/Button/Button.d.ts.map +1 -1
  5. package/dist/Button/Button.js +38 -14
  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/CheckboxList/CheckboxListItem.d.ts +9 -1
  10. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  11. package/dist/CheckboxList/CheckboxListItem.js +4 -2
  12. package/dist/Dialog/Dialog.d.ts.map +1 -1
  13. package/dist/Dialog/Dialog.js +20 -8
  14. package/dist/Drawer/Drawer.d.ts +191 -0
  15. package/dist/Drawer/Drawer.d.ts.map +1 -0
  16. package/dist/Drawer/Drawer.js +382 -0
  17. package/dist/Drawer/DrawerHeader.d.ts +85 -0
  18. package/dist/Drawer/DrawerHeader.d.ts.map +1 -0
  19. package/dist/Drawer/DrawerHeader.js +134 -0
  20. package/dist/Drawer/index.d.ts +11 -0
  21. package/dist/Drawer/index.d.ts.map +1 -0
  22. package/dist/Drawer/index.js +11 -0
  23. package/dist/Drawer/useDrawerDialogPresence.d.ts +42 -0
  24. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -0
  25. package/dist/Drawer/useDrawerDialogPresence.js +236 -0
  26. package/dist/DropdownMenu/DropdownMenu.js +1 -1
  27. package/dist/DropdownMenu/DropdownMenuDivider.d.ts +5 -3
  28. package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -1
  29. package/dist/DropdownMenu/DropdownMenuDivider.js +7 -3
  30. package/dist/DropdownMenu/DropdownMenuSubMenu.js +4 -4
  31. package/dist/EmptyState/EmptyState.d.ts.map +1 -1
  32. package/dist/EmptyState/EmptyState.js +4 -10
  33. package/dist/Field/Field.d.ts +1 -1
  34. package/dist/Field/Field.d.ts.map +1 -1
  35. package/dist/Field/Field.js +8 -4
  36. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  37. package/dist/HoverCard/useHoverCard.js +10 -2
  38. package/dist/Item/Item.d.ts +6 -2
  39. package/dist/Item/Item.d.ts.map +1 -1
  40. package/dist/Item/Item.js +19 -4
  41. package/dist/Layer/layerViewportInset.stylex.d.ts +6 -2
  42. package/dist/Layer/layerViewportInset.stylex.d.ts.map +1 -1
  43. package/dist/Layer/layerViewportInset.stylex.js +6 -2
  44. package/dist/Layer/useLayer.d.ts.map +1 -1
  45. package/dist/Layer/useLayer.js +13 -7
  46. package/dist/Layer/useLayerDismissal.d.ts +1 -1
  47. package/dist/Layer/useLayerDismissal.js +1 -1
  48. package/dist/Layout/container.stylex.d.ts +5 -5
  49. package/dist/Layout/container.stylex.js +4 -4
  50. package/dist/List/List.d.ts +46 -19
  51. package/dist/List/List.d.ts.map +1 -1
  52. package/dist/List/List.js +28 -10
  53. package/dist/List/ListContext.d.ts +8 -3
  54. package/dist/List/ListContext.d.ts.map +1 -1
  55. package/dist/List/ListContext.js +7 -2
  56. package/dist/List/ListItem.d.ts +13 -5
  57. package/dist/List/ListItem.d.ts.map +1 -1
  58. package/dist/List/ListItem.js +21 -8
  59. package/dist/List/index.d.ts +1 -1
  60. package/dist/List/index.d.ts.map +1 -1
  61. package/dist/Markdown/Markdown.d.ts.map +1 -1
  62. package/dist/Markdown/Markdown.js +8 -1
  63. package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
  64. package/dist/Markdown/plugins/frontmatter.js +7 -3
  65. package/dist/MetadataList/MetadataList.d.ts.map +1 -1
  66. package/dist/MetadataList/MetadataList.js +5 -1
  67. package/dist/MetadataList/MetadataListContext.d.ts +1 -1
  68. package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
  69. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  70. package/dist/MultiSelector/MultiSelector.js +22 -8
  71. package/dist/MultiSelector/OptionActions.a11y.chromium.spec.js +100 -2
  72. package/dist/MultiSelector/hooks.d.ts.map +1 -1
  73. package/dist/MultiSelector/hooks.js +3 -1
  74. package/dist/Pagination/Pagination.d.ts +8 -5
  75. package/dist/Pagination/Pagination.d.ts.map +1 -1
  76. package/dist/Pagination/Pagination.js +21 -8
  77. package/dist/Popover/Popover.js +2 -2
  78. package/dist/PowerSearch/PowerSearch.js +1 -1
  79. package/dist/RadioList/RadioListItem.d.ts +9 -1
  80. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  81. package/dist/RadioList/RadioListItem.js +2 -0
  82. package/dist/Selector/hooks.d.ts.map +1 -1
  83. package/dist/Selector/hooks.js +6 -2
  84. package/dist/Switch/Switch.d.ts +1 -1
  85. package/dist/Switch/Switch.d.ts.map +1 -1
  86. package/dist/Switch/Switch.js +13 -1
  87. package/dist/TabList/TabMenu.d.ts +2 -2
  88. package/dist/TabList/TabMenu.d.ts.map +1 -1
  89. package/dist/TabList/TabMenu.js +6 -3
  90. package/dist/Text/useTruncation.d.ts +7 -5
  91. package/dist/Text/useTruncation.d.ts.map +1 -1
  92. package/dist/Text/useTruncation.js +16 -5
  93. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  94. package/dist/Tooltip/useTooltip.js +11 -0
  95. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  96. package/dist/Typeahead/BaseTypeahead.js +26 -0
  97. package/dist/astryx.css +35 -12
  98. package/dist/hooks/useEntryAnimation.d.ts +2 -1
  99. package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
  100. package/dist/hooks/useEntryAnimation.js +14 -12
  101. package/dist/hooks/useIsHydrating.d.ts +6 -0
  102. package/dist/hooks/useIsHydrating.d.ts.map +1 -0
  103. package/dist/hooks/useIsHydrating.js +30 -0
  104. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  105. package/dist/i18n/generated-locales/en.generated.js +112 -1
  106. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  107. package/dist/i18n/generated-locales/pseudo.generated.js +112 -1
  108. package/dist/index.d.ts +1 -0
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +1 -0
  111. package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
  112. package/dist/theme/derivedVarRegistry.js +0 -3
  113. package/dist/utils/focusOutline.stylex.d.ts +4 -0
  114. package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
  115. package/dist/utils/focusOutline.stylex.js +4 -0
  116. package/dist/utils/plainDate.d.ts.map +1 -1
  117. package/dist/utils/plainDate.js +15 -9
  118. package/dist/utils/sharedMutationObserver.d.ts +21 -0
  119. package/dist/utils/sharedMutationObserver.d.ts.map +1 -0
  120. package/dist/utils/sharedMutationObserver.js +69 -0
  121. package/locales/en.json +444 -0
  122. package/locales/pseudo.json +333 -0
  123. package/package.json +9 -4
  124. package/src/AspectRatio/AspectRatio.test.tsx +44 -43
  125. package/src/AspectRatio/AspectRatio.tsx +38 -18
  126. package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +157 -0
  127. package/src/Button/Button.doc.mjs +2 -2
  128. package/src/Button/Button.test.tsx +155 -9
  129. package/src/Button/Button.tsx +39 -16
  130. package/src/Button/__tests__/Button.a11y.known-failures.ts +1 -62
  131. package/src/Button/__tests__/Button.a11y.states.ts +0 -10
  132. package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
  133. package/src/CheckboxInput/CheckboxInput.tsx +3 -1
  134. package/src/CheckboxList/CheckboxList.test.tsx +22 -0
  135. package/src/CheckboxList/CheckboxListItem.doc.mjs +16 -0
  136. package/src/CheckboxList/CheckboxListItem.tsx +10 -0
  137. package/src/Dialog/Dialog.test.tsx +46 -0
  138. package/src/Dialog/Dialog.tsx +20 -7
  139. package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -14
  140. package/src/Drawer/Drawer.doc.mjs +472 -0
  141. package/src/Drawer/Drawer.spec.md +357 -0
  142. package/src/Drawer/Drawer.test.tsx +1300 -0
  143. package/src/Drawer/Drawer.tsx +613 -0
  144. package/src/Drawer/DrawerDirection.test.tsx +127 -0
  145. package/src/Drawer/DrawerHeader.doc.mjs +293 -0
  146. package/src/Drawer/DrawerHeader.test.tsx +102 -0
  147. package/src/Drawer/DrawerHeader.tsx +235 -0
  148. package/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts +401 -0
  149. package/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts +297 -0
  150. package/src/Drawer/index.ts +13 -0
  151. package/src/Drawer/useDrawerDialogPresence.ts +284 -0
  152. package/src/DropdownMenu/DropdownMenu.test.tsx +21 -12
  153. package/src/DropdownMenu/DropdownMenu.tsx +2 -2
  154. package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +2 -2
  155. package/src/DropdownMenu/DropdownMenuDivider.tsx +9 -5
  156. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +2 -2
  157. package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +145 -0
  158. package/src/DropdownMenu/__tests__/Menu.a11y.known-failures.ts +26 -0
  159. package/src/DropdownMenu/__tests__/Menu.a11y.renders.tsx +65 -0
  160. package/src/DropdownMenu/__tests__/Menu.a11y.states.ts +138 -0
  161. package/src/DropdownMenu/__tests__/Menu.a11y.test.tsx +136 -0
  162. package/src/EmptyState/EmptyState.doc.mjs +3 -2
  163. package/src/EmptyState/EmptyState.spec.md +189 -0
  164. package/src/EmptyState/EmptyState.test.tsx +74 -3
  165. package/src/EmptyState/EmptyState.tsx +4 -8
  166. package/src/Field/Field.doc.mjs +14 -8
  167. package/src/Field/Field.spec.md +217 -0
  168. package/src/Field/Field.test.tsx +60 -2
  169. package/src/Field/Field.tsx +17 -8
  170. package/src/HoverCard/HoverCard.test.tsx +58 -0
  171. package/src/HoverCard/useHoverCard.tsx +10 -2
  172. package/src/IconButton/IconButton.doc.mjs +2 -2
  173. package/src/IconButton/IconButton.test.tsx +3 -1
  174. package/src/Item/Item.doc.mjs +12 -8
  175. package/src/Item/Item.spec.md +226 -0
  176. package/src/Item/Item.test.tsx +61 -0
  177. package/src/Item/Item.tsx +40 -4
  178. package/src/Layer/layerViewportInset.source-build.test.mjs +90 -0
  179. package/src/Layer/layerViewportInset.stylex.ts +6 -2
  180. package/src/Layer/layerViewportInset.test.ts +1 -0
  181. package/src/Layer/useLayer.tsx +24 -13
  182. package/src/Layer/useLayerDismissal.ts +1 -1
  183. package/src/Layout/container.stylex.ts +6 -6
  184. package/src/List/List.doc.mjs +14 -1
  185. package/src/List/List.spec.md +129 -77
  186. package/src/List/List.test.tsx +163 -94
  187. package/src/List/List.tsx +74 -18
  188. package/src/List/ListContext.tsx +9 -3
  189. package/src/List/ListItem.doc.mjs +24 -5
  190. package/src/List/ListItem.tsx +56 -27
  191. package/src/List/index.ts +1 -1
  192. package/src/Markdown/Markdown.tsx +14 -1
  193. package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
  194. package/src/Markdown/plugins/frontmatter.ts +7 -3
  195. package/src/MetadataList/MetadataList.doc.mjs +2 -2
  196. package/src/MetadataList/MetadataList.test.tsx +38 -0
  197. package/src/MetadataList/MetadataList.tsx +8 -1
  198. package/src/MetadataList/MetadataListContext.tsx +1 -1
  199. package/src/MultiSelector/MultiSelector.test.tsx +159 -0
  200. package/src/MultiSelector/MultiSelector.tsx +40 -7
  201. package/src/MultiSelector/OptionActions.a11y.chromium.spec.ts +112 -2
  202. package/src/MultiSelector/hooks.ts +3 -1
  203. package/src/MultiSelector/useMultiCombobox.doc.mjs +267 -0
  204. package/src/Pagination/Pagination.doc.mjs +7 -7
  205. package/src/Pagination/Pagination.spec.md +9 -9
  206. package/src/Pagination/Pagination.test.tsx +242 -0
  207. package/src/Pagination/Pagination.tsx +27 -11
  208. package/src/Popover/Popover.test.tsx +2 -2
  209. package/src/Popover/Popover.tsx +4 -4
  210. package/src/PowerSearch/PowerSearch.test.tsx +85 -0
  211. package/src/PowerSearch/PowerSearch.tsx +2 -2
  212. package/src/RadioList/RadioList.test.tsx +22 -0
  213. package/src/RadioList/RadioListItem.doc.mjs +16 -0
  214. package/src/RadioList/RadioListItem.tsx +10 -1
  215. package/src/Selector/hooks.ts +6 -2
  216. package/src/Selector/useCombobox.doc.mjs +237 -0
  217. package/src/Switch/Switch.test.tsx +49 -0
  218. package/src/Switch/Switch.tsx +11 -0
  219. package/src/TabList/TabList.spec.md +57 -44
  220. package/src/TabList/TabList.test.tsx +67 -0
  221. package/src/TabList/TabMenu.doc.mjs +4 -3
  222. package/src/TabList/TabMenu.tsx +7 -4
  223. package/src/Text/useTruncation.test.tsx +69 -0
  224. package/src/Text/useTruncation.ts +16 -5
  225. package/src/Tokenizer/Tokenizer.test.tsx +54 -1
  226. package/src/Tooltip/Tooltip.test.tsx +31 -0
  227. package/src/Tooltip/useTooltip.test.tsx +13 -0
  228. package/src/Tooltip/useTooltip.tsx +11 -0
  229. package/src/TreeList/TreeList.spec.md +29 -17
  230. package/src/Typeahead/BaseTypeahead.tsx +26 -0
  231. package/src/Typeahead/Typeahead.test.tsx +260 -2
  232. package/src/hooks/useEntryAnimation.doc.mjs +4 -4
  233. package/src/hooks/useEntryAnimation.ssr.test.tsx +143 -0
  234. package/src/hooks/useEntryAnimation.ts +15 -16
  235. package/src/hooks/useIsHydrating.test.tsx +70 -0
  236. package/src/hooks/useIsHydrating.ts +31 -0
  237. package/src/i18n/InternationalizationProvider.doc.mjs +8 -0
  238. package/src/i18n/InternationalizationProvider.spec.md +252 -0
  239. package/src/i18n/__tests__/InternationalizationProvider.test.tsx +128 -0
  240. package/src/i18n/generated-locales/en.generated.ts +121 -0
  241. package/src/i18n/generated-locales/pseudo.generated.ts +121 -0
  242. package/src/i18n/useTranslator.test.tsx +37 -0
  243. package/src/index.ts +1 -0
  244. package/src/reset.css +0 -29
  245. package/src/theme/derivedVarRegistry.test.ts +3 -3
  246. package/src/theme/derivedVarRegistry.ts +0 -3
  247. package/src/utils/focusOutline.stylex.ts +4 -0
  248. package/src/utils/plainDate.test.ts +37 -1
  249. package/src/utils/plainDate.ts +15 -5
  250. package/src/utils/sharedMutationObserver.test.ts +53 -0
  251. package/src/utils/sharedMutationObserver.ts +78 -0
@@ -0,0 +1,237 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').HookDoc} */
4
+ export const docs = {
5
+ name: 'useCombobox',
6
+ displayName: 'useCombobox',
7
+ group: 'Selector',
8
+ keywords: [
9
+ 'combobox',
10
+ 'listbox',
11
+ 'select',
12
+ 'dropdown',
13
+ 'highlight',
14
+ 'active option',
15
+ 'aria-activedescendant',
16
+ 'keyboard',
17
+ 'arrow keys',
18
+ 'headless',
19
+ 'apg',
20
+ 'accessibility',
21
+ 'a11y',
22
+ ],
23
+ params: [
24
+ {
25
+ name: 'options',
26
+ type: 'UseComboboxOptions',
27
+ description: 'Configuration object.',
28
+ required: true,
29
+ },
30
+ {
31
+ name: 'options.selectableItems',
32
+ type: 'SelectorOptionData[]',
33
+ description:
34
+ 'The options in the same order as they render. Options with `disabled` cannot be picked and are skipped while moving through the open list; ArrowDown or ArrowUp that opens the list still lands on the first or last option.',
35
+ required: true,
36
+ },
37
+ {
38
+ name: 'options.isOpen',
39
+ type: 'boolean',
40
+ description: 'Whether the list is shown. The caller owns this state.',
41
+ required: true,
42
+ },
43
+ {
44
+ name: 'options.onOpen',
45
+ type: '() => unknown',
46
+ description:
47
+ 'Called to show the list. Return `false` to refuse; the hook then leaves the highlight alone.',
48
+ required: true,
49
+ },
50
+ {
51
+ name: 'options.onClose',
52
+ type: '() => void',
53
+ description:
54
+ 'Called when the hook hides the list; the hook resets the highlight first. When the caller closes the list itself (an outside press, say), it should also call `setHighlightedIndex(-1)`.',
55
+ required: true,
56
+ },
57
+ {
58
+ name: 'options.listboxId',
59
+ type: 'string',
60
+ description:
61
+ "The listbox element's id. Option ids are derived from it through `getItemId`.",
62
+ required: true,
63
+ },
64
+ {
65
+ name: 'options.value',
66
+ type: 'string',
67
+ description:
68
+ 'The selected value. Without search, opening by a press, Enter or Space highlights it, or the first option when nothing is selected; ArrowDown and ArrowUp open on the first and last option.',
69
+ },
70
+ {
71
+ name: 'options.onSelect',
72
+ type: '(value: string) => void',
73
+ description:
74
+ 'Called with the picked value. Picking also closes the list.',
75
+ },
76
+ {
77
+ name: 'options.onClear',
78
+ type: '() => void',
79
+ description:
80
+ 'Clears the value. When provided, Delete or Backspace on the closed control clears it, so clearing is not pointer-only. Ignored while the list is open or with `hasSearch`.',
81
+ },
82
+ {
83
+ name: 'options.hasSearch',
84
+ type: 'boolean',
85
+ description:
86
+ 'Whether the list has its own search field. Space then types instead of picking, opening by a press or Enter does not pre-highlight (ArrowDown and ArrowUp still open on the first and last option), and printable keys on the closed control go to `onSearchSeed`.',
87
+ default: 'false',
88
+ },
89
+ {
90
+ name: 'options.onSearchSeed',
91
+ type: '(char: string) => void',
92
+ description:
93
+ 'With `hasSearch`, receives each printable character except Space typed while the control has focus, opening the list first when it is closed, so type-to-find needs no separate open step.',
94
+ },
95
+ {
96
+ name: 'options.isDisabled',
97
+ type: 'boolean',
98
+ description: 'Whether the control ignores clicks and keys.',
99
+ default: 'false',
100
+ },
101
+ ],
102
+ returns: [
103
+ {
104
+ name: 'highlightedIndex',
105
+ type: 'number',
106
+ description:
107
+ 'Index of the active option, or -1 when none is active. With `hasSearch`, opening by a press or Enter does not set one, so it stays -1 after the hook itself closes the list; ArrowDown and ArrowUp still open on the first or last option. Render it as the active option and name it in `aria-activedescendant` only while it points at a rendered option.',
108
+ },
109
+ {
110
+ name: 'setHighlightedIndex',
111
+ type: '(index: number) => void',
112
+ description:
113
+ 'Sets the active option, for example from a filter that changes the options.',
114
+ },
115
+ {
116
+ name: 'getItemId',
117
+ type: '(index: number) => string',
118
+ description:
119
+ "The id to render on the option at `index`. Set the control's `aria-activedescendant` to `isOpen && highlightedIndex >= 0 && highlightedIndex < selectableItems.length ? getItemId(highlightedIndex) : undefined`, so it never names an option that does not exist, including in an empty list.",
120
+ },
121
+ {
122
+ name: 'onTriggerClick',
123
+ type: '() => void',
124
+ description: 'Toggles the list from a press on the control.',
125
+ },
126
+ {
127
+ name: 'onKeyDown',
128
+ type: '(e: React.KeyboardEvent) => void',
129
+ description:
130
+ 'Key handler for the control that keeps focus. ArrowDown and ArrowUp open the list or move the active option; Enter (and Space without search) picks it or opens the list; Escape and Tab close it; Home, End, PageUp and PageDown jump to the first or last option. An editable control that keeps Home and End for the caret does not pass them to this handler, as CommandPalette does.',
131
+ },
132
+ {
133
+ name: 'onItemSelect',
134
+ type: '(item: SelectorOptionData) => void',
135
+ description: 'Picks an option from a press on it, then closes the list.',
136
+ },
137
+ {
138
+ name: 'onItemMouseEnter',
139
+ type: '(item: SelectorOptionData, index: number) => void',
140
+ description:
141
+ 'Makes the hovered option active without scrolling the list or moving focus.',
142
+ },
143
+ ],
144
+ usage: {
145
+ description:
146
+ 'Tracks the active option of a single-select combobox and handles its keys, while DOM focus stays on the control. It powers Selector and CommandPalette; use it to build a combobox those components do not cover. It renders nothing and sets no attributes: the caller renders the control, the listbox and the options, and wires `role`, `aria-expanded`, `aria-controls` and `aria-activedescendant` from what it returns.',
147
+ bestPractices: [
148
+ {
149
+ guidance: true,
150
+ description:
151
+ "Render each option with `id={getItemId(index)}` and set the control's `aria-activedescendant` only while `isOpen` and `highlightedIndex` points at a rendered option, as CommandPalette does.",
152
+ },
153
+ {
154
+ guidance: true,
155
+ description:
156
+ "For type-to-select without a search field, run useTypeahead's handler first and fall through to this `onKeyDown` when it returns false, as Selector does.",
157
+ },
158
+ {
159
+ guidance: true,
160
+ description:
161
+ 'Announce the number of results through useAnnounce when the options change for a new query.',
162
+ },
163
+ {
164
+ guidance: false,
165
+ description:
166
+ 'Move DOM focus onto the options; the active option is announced through `aria-activedescendant` while focus stays on the control.',
167
+ },
168
+ ],
169
+ },
170
+ relatedComponents: ['Selector', 'CommandPalette'],
171
+ relatedHooks: ['useMultiCombobox', 'useTypeahead', 'useAnnounce'],
172
+ importPath: '@astryxdesign/core/Selector',
173
+ category: 'focus',
174
+ };
175
+
176
+ /** @type {import('@astryxdesign/cli/authoring').HookTranslationDoc} */
177
+ export const docsDense = {
178
+ description:
179
+ 'Single-select combobox state + keys; focus stays on control. Powers Selector / CommandPalette. Renders nothing, sets no attrs: caller renders control / listbox / options and wires role, aria-expanded, aria-controls, aria-activedescendant.',
180
+ paramDescriptions: {
181
+ options: 'config.',
182
+ 'options.selectableItems':
183
+ 'options in render order; disabled ones not pickable, skipped while moving in open list (ArrowDown/Up opening still lands first / last).',
184
+ 'options.isOpen': 'list shown; caller owns state.',
185
+ 'options.onOpen':
186
+ 'show list; return false to refuse (highlight untouched).',
187
+ 'options.onClose':
188
+ 'hook hides list; resets highlight first. caller closing itself (outside press): also setHighlightedIndex(-1).',
189
+ 'options.listboxId': 'listbox id; option ids derive from it (getItemId).',
190
+ 'options.value':
191
+ 'selected value; w/o search, press / Enter / Space opening highlights it (else first); ArrowDown/Up open on first / last.',
192
+ 'options.onSelect': 'called w/ picked value; picking closes.',
193
+ 'options.onClear':
194
+ 'clears value; Delete / Backspace on closed control. ignored when open or hasSearch.',
195
+ 'options.hasSearch':
196
+ 'list has own search field: Space types, press / Enter opening does not pre-highlight (ArrowDown/Up still first / last), printable keys on closed control -> onSearchSeed.',
197
+ 'options.onSearchSeed':
198
+ 'w/ hasSearch, each printable char except Space typed while control focused (opens first if closed).',
199
+ 'options.isDisabled': 'ignore clicks + keys.',
200
+ },
201
+ returnDescriptions: {
202
+ highlightedIndex:
203
+ 'active option index, -1 = none. hasSearch: press / Enter opening sets none (stays -1 after hook closes); ArrowDown/Up still first / last. name in aria-activedescendant only when it points at a rendered option.',
204
+ setHighlightedIndex: 'set active option (e.g. after filtering).',
205
+ getItemId:
206
+ 'id for option at index; aria-activedescendant = isOpen && highlightedIndex >= 0 && highlightedIndex < selectableItems.length ? getItemId(highlightedIndex) : undefined (empty list safe).',
207
+ onTriggerClick: 'toggle list from a press on control.',
208
+ onKeyDown:
209
+ 'control keydown: ArrowDown/Up open or move; Enter (Space w/o search) picks or opens; Escape / Tab close; Home / End / PageUp / PageDown jump. editable control keeping Home / End for caret: do not pass them.',
210
+ onItemSelect: 'pick from a press, then close.',
211
+ onItemMouseEnter: 'hover makes option active; no scroll, no focus move.',
212
+ },
213
+ usage: {
214
+ description:
215
+ 'Headless single-select combobox: active option + keys, focus stays on control. Caller renders + wires ARIA.',
216
+ bestPractices: [
217
+ {
218
+ guidance: true,
219
+ description:
220
+ 'Option id = getItemId(index); aria-activedescendant only while open and highlightedIndex points at a rendered option.',
221
+ },
222
+ {
223
+ guidance: true,
224
+ description:
225
+ 'Type-to-select w/o search: run useTypeahead first, fall through when it returns false.',
226
+ },
227
+ {
228
+ guidance: true,
229
+ description: 'Announce result count via useAnnounce on new query.',
230
+ },
231
+ {
232
+ guidance: false,
233
+ description: 'Move DOM focus onto options; use aria-activedescendant.',
234
+ },
235
+ ],
236
+ },
237
+ };
@@ -834,6 +834,55 @@ describe('Switch', () => {
834
834
  expect(root).toHaveAttribute('id', 'switch-1');
835
835
  expect(root).toHaveAttribute('aria-label', 'Toggle notifications');
836
836
  });
837
+
838
+ it('composes a caller aria-describedby onto the switch control', () => {
839
+ const {container} = render(
840
+ <>
841
+ <p id="external-hint">Applies to every repository</p>
842
+ <Switch
843
+ label="Notifications"
844
+ description="Sends a daily digest"
845
+ value={false}
846
+ onChange={() => {}}
847
+ data-testid="my-switch"
848
+ aria-describedby="external-hint"
849
+ />
850
+ </>,
851
+ );
852
+ const control = screen.getByRole('switch');
853
+ const description = screen.getByText('Sends a daily digest');
854
+ expect(control.getAttribute('aria-describedby')?.split(' ')).toEqual([
855
+ 'external-hint',
856
+ description.id,
857
+ ]);
858
+ expect(control).toHaveAccessibleDescription(
859
+ 'Applies to every repository Sends a daily digest',
860
+ );
861
+ // The id reference lives on the control only, not on the field wrapper.
862
+ const root = container.querySelector('[data-testid="my-switch"]');
863
+ expect(root).not.toHaveAttribute('aria-describedby');
864
+ });
865
+
866
+ it('names the switch control from a caller aria-labelledby', () => {
867
+ const {container} = render(
868
+ <>
869
+ <span id="row-title">Release notes</span>
870
+ <Switch
871
+ label="Pin Release notes"
872
+ isLabelHidden
873
+ value={false}
874
+ onChange={() => {}}
875
+ data-testid="my-switch"
876
+ aria-labelledby="row-title"
877
+ />
878
+ </>,
879
+ );
880
+ const control = screen.getByRole('switch', {name: 'Release notes'});
881
+ expect(control).toHaveAttribute('aria-labelledby', 'row-title');
882
+ // The id reference lives on the control only, not on the field wrapper.
883
+ const root = container.querySelector('[data-testid="my-switch"]');
884
+ expect(root).not.toHaveAttribute('aria-labelledby');
885
+ });
837
886
  });
838
887
 
839
888
  describe('pressed state', () => {
@@ -566,6 +566,8 @@ export function Switch({
566
566
  className,
567
567
  style,
568
568
  ref,
569
+ 'aria-describedby': ariaDescribedByProp,
570
+ 'aria-labelledby': ariaLabelledByProp,
569
571
  ...rest
570
572
  }: SwitchProps) {
571
573
  const t = useTranslator();
@@ -610,7 +612,12 @@ export function Switch({
610
612
  // Only include descriptionID when the element actually renders.
611
613
  // FieldLabel renders the description (with descriptionID) even when the
612
614
  // label is visually hidden — it's sr-only, so keep it linked.
615
+ // A consumer's own `aria-describedby` describes the control, so it comes
616
+ // first here rather than landing on the field wrapper via `...rest`.
613
617
  const describedByParts: string[] = [];
618
+ if (ariaDescribedByProp) {
619
+ describedByParts.push(ariaDescribedByProp);
620
+ }
614
621
  if (description) {
615
622
  describedByParts.push(descriptionID);
616
623
  }
@@ -658,6 +665,10 @@ export function Switch({
658
665
  }}
659
666
  onFocus={onFocus}
660
667
  onBlur={onBlur}
668
+ // A caller's `aria-labelledby` names the control (a visible title
669
+ // elsewhere in the row, for example), so it reaches the input rather
670
+ // than the field wrapper via `...rest`.
671
+ aria-labelledby={ariaLabelledByProp}
661
672
  aria-describedby={ariaDescribedBy}
662
673
  aria-invalid={status?.type === 'error' ? true : undefined}
663
674
  aria-busy={isBusy || undefined}
@@ -31,10 +31,10 @@ system_specs: [spec:AST-002/DEC-1, spec:AST-002/DEC-2, spec:AST-017/DEC-1]
31
31
 
32
32
  | Area | Contract |
33
33
  | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
- | Public contract | Canonicalize the existing alignment mode as `edgeCompensation?: 'inline'`; deprecate `isFullBleed` and remove it in the next minor release. |
34
+ | Public contract | Canonicalize the existing mode as `edge?: 'padded' \| 'bleed'` (default `'padded'`) from the shared `edge` vocabulary; deprecate `isFullBleed` as an alias of `edge="bleed"` and remove it in the next minor release. |
35
35
  | Behavior | Move first and last visible tab content toward the host content line, reaching it when the host inset is at least the edge-tab padding, while preserving tab interaction padding, focus-ring room, overflow controls, selection-indicator geometry, and the optional divider rail. |
36
36
  | End-user impact | Edge tabs lose unnecessary extra inset where host geometry permits and remain fully interactive without clipped focus, selection, overflow, or divider treatment. |
37
- | Builder impact | Existing `isFullBleed` callsites keep working during the deprecation window and migrate mechanically to `edgeCompensation="inline"`. |
37
+ | Builder impact | Existing `isFullBleed` callsites keep working during the deprecation window and migrate mechanically to `edge="bleed"`. |
38
38
  | Compatibility/readiness | Current behavior is shipped; the canonical alias is additive, while removing the released legacy prop is a separately implemented breaking change in the next minor release. |
39
39
  | Review checks | Reject a behavior change disguised as a rename, directional values without overflow/indicator proof, or early removal of the legacy prop. |
40
40
  | Governing rules | `architecture:container-padding/INV9–INV11`; `spec:AST-002/DEC-1–DEC-2`; `spec:AST-017/DEC-1`. |
@@ -43,12 +43,13 @@ This table is a review projection; the body below is authoritative.
43
43
 
44
44
  ## Intent
45
45
 
46
- TabList's current opt-in is edge compensation: it consumes the full inherited
47
- host inset, moves visible edge-tab content toward the surrounding content line,
46
+ TabList's current opt-in is the shared `bleed` edge treatment: it consumes the
47
+ full inherited host inset, moves visible edge-tab content toward the surrounding content line,
48
48
  and retains Tab-owned interaction padding plus TabList-owned divider, overflow,
49
49
  and indicator geometry. Content reaches the host line only when that inset is at
50
50
  least the edge tab's own padding. The public `isFullBleed` name is misleading
51
- because the strip restores uncovered content inset after the outer box expands.
51
+ because the strip keeps a content line: it restores uncovered content inset
52
+ after the outer box expands, which `architecture:container-padding` names `bleed`.
52
53
 
53
54
  ## Compatibility and migration
54
55
 
@@ -61,21 +62,21 @@ because the strip restores uncovered content inset after the outer box expands.
61
62
 
62
63
  During the compatibility window:
63
64
 
64
- - `edgeCompensation="inline"` is the canonical spelling;
65
- - omitted `edgeCompensation` plus `isFullBleed={true}` selects the same mode;
65
+ - `edge="bleed"` is the canonical spelling, and omitted `edge` means `padded`;
66
+ - omitted `edge` plus `isFullBleed={true}` selects `bleed`;
66
67
  - `isFullBleed` is deprecated and maintained examples use the canonical prop;
67
- - if both props are supplied, explicit `edgeCompensation` is canonical and the
68
- legacy boolean cannot disable it.
68
+ - if both props are supplied, explicit `edge` is canonical and the legacy
69
+ boolean cannot override it.
69
70
 
70
71
  The removal release MUST include a `[breaking]` Changeset for
71
72
  `@astryxdesign/core`, consumer release notes, and an `astryx upgrade` codemod that rewrites
72
- `isFullBleed` to `edgeCompensation="inline"`.
73
+ `isFullBleed` to `edge="bleed"`.
73
74
 
74
75
  ## Ownership boundary
75
76
 
76
77
  **Owns**
77
78
 
78
- - The TabList-wide edge-compensation mode and its compatibility alias.
79
+ - The TabList-wide `bleed` edge treatment and its compatibility alias.
79
80
  - The relationship between the outer TabList box, inner strip padding, edge tabs,
80
81
  focus-ring room, overflow controls, and selection indicator.
81
82
  - Which logical edges are supported by the public mode.
@@ -84,33 +85,34 @@ The removal release MUST include a `[breaking]` Changeset for
84
85
 
85
86
  - Host padding publication, nesting, or overlay resets — owned by
86
87
  `architecture:container-padding`.
87
- - Button or List edge-compensation projections.
88
- - New `start` or `end` values without separate proof and owner approval.
88
+ - Button or List edge projections.
89
+ - The `flush` or `outset` values, or per-edge application, without separate
90
+ proof and owner approval.
89
91
  - A change to navigation/tab semantics, selection state, keyboard behavior, or
90
92
  overflow ownership.
91
93
 
92
94
  ## Public concepts
93
95
 
94
- | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
95
- | ----------------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | --------------- | ------------------- | ------------------------------- | ------------------------------------------------------ |
96
- | Edge compensation | omitted, `inline` | Consume both inherited inline host insets and move edge-tab content toward the host lines while retaining local interaction and strip-owned geometry | Navigation and tabs patterns across current layout/overflow states | omitted | `component:TabList` | accepted; canonical API pending | Other values are rejected by the public type |
97
- | Legacy alias | omitted, `false`, `true` | Compatibility spelling for omitted or inline edge compensation | Until the next minor release | omitted/`false` | `component:TabList` | deprecated | `true` maps to `inline`; explicit canonical input wins |
96
+ | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
97
+ | -------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------ | ------------------- | ------------------------------- | -------------------------------------------- |
98
+ | Edge treatment | omitted, `padded`, `bleed` | `bleed`: consume both inherited inline host insets and move edge-tab content toward the host lines while retaining local interaction and strip-owned geometry; `padded`: current default geometry | Navigation and tabs patterns across current layout/overflow states | omitted (`padded`) | `component:TabList` | accepted; canonical API pending | Other values are rejected by the public type |
99
+ | Legacy alias | omitted, `false`, `true` | Compatibility spelling for `padded` or `bleed` | Until the next minor release | omitted/`false` | `component:TabList` | deprecated | `true` maps to `bleed`; explicit `edge` wins |
98
100
 
99
101
  ## Behavioral and layout contract
100
102
 
101
- | ID | Invariant | Basis | Status |
102
- | --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------- |
103
- | FR1 | The current opt-in MUST remain edge compensation: the outer TabList box consumes the full inherited inline host inset and any `hasDivider` rail spans that expanded width; the inner strip restores `max(host inset - edge-tab padding, 0)` at each logical edge. Visible edge-tab content reaches the host line only when the host inset is at least the tab padding; otherwise it moves toward that line without crossing the host boundary. | Current source and `component:TabList/DEC-1` | Shipped behavior |
104
- | FR2 | Compensation MUST preserve Tab interaction padding, focus-ring room, overflow detection and controls, scroll access, selection-indicator geometry, and the optional divider rail's expanded inline span. | Current source plus owner direction | Shipped behavior; expanded evidence required with rename |
105
- | FR3 | `edgeCompensation?: 'inline'` MUST become the canonical API without changing FR1–FR2 geometry or the omitted default. | `architecture:container-padding/INV10`; `component:TabList/DEC-1` | Accepted contract; implementation pending |
106
- | FR4 | During the deprecation window, omitted `edgeCompensation` plus `isFullBleed={true}` MUST produce the canonical `inline` behavior. Explicit `edgeCompensation` MUST remain authoritative when both props are supplied. | Compatibility decision | Accepted contract; implementation pending |
107
- | FR5 | `isFullBleed` MUST be removed in the next minor release only after maintained docs/examples use `edgeCompensation`, both paths have compatibility evidence, and the removal includes a `[breaking]` Changeset plus an `astryx upgrade` codemod for mechanical consumer migration. | `component:TabList/DEC-1`; `spec:AST-017/DEC-1` | Accepted contract; implementation pending |
108
- | FR6 | `start` and `end` MUST remain rejected until per-edge overflow, clipping, scroll-control, focus-ring, indicator, direction, and theme-padding evidence receives owner approval. | Shared logical vocabulary and TabList boundary | Accepted boundary |
103
+ | ID | Invariant | Basis | Status |
104
+ | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------- |
105
+ | FR1 | The current opt-in MUST remain the `bleed` treatment: the outer TabList box consumes the full inherited inline host inset and any `hasDivider` rail spans that expanded width; the inner strip restores `max(host inset - edge-tab padding, 0)` at each logical edge. Visible edge-tab content reaches the host line only when the host inset is at least the tab padding; otherwise it moves toward that line without crossing the host boundary. | Current source and `component:TabList/DEC-1` | Shipped behavior |
106
+ | FR2 | Compensation MUST preserve Tab interaction padding, focus-ring room, overflow detection and controls, scroll access, selection-indicator geometry, and the optional divider rail's expanded inline span. | Current source plus owner direction | Shipped behavior; expanded evidence required with rename |
107
+ | FR3 | `edge?: 'padded' \| 'bleed'` MUST become the canonical API, with `bleed` selecting FR1–FR2 geometry and `padded` the omitted default, without changing either. | `architecture:container-padding/INV10`; `component:TabList/DEC-1` | Accepted contract; implementation pending |
108
+ | FR4 | During the deprecation window, omitted `edge` plus `isFullBleed={true}` MUST produce the canonical `bleed` behavior. Explicit `edge` MUST remain authoritative when both props are supplied. | Compatibility decision | Accepted contract; implementation pending |
109
+ | FR5 | `isFullBleed` MUST be removed in the next minor release only after maintained docs/examples use `edge`, both paths have compatibility evidence, and the removal includes a `[breaking]` Changeset plus an `astryx upgrade` codemod for mechanical consumer migration. | `component:TabList/DEC-1`; `spec:AST-017/DEC-1` | Accepted contract; implementation pending |
110
+ | FR6 | `flush`, `outset`, and per-edge application MUST remain rejected until overflow, clipping, scroll-control, focus-ring, indicator, direction, and theme-padding evidence receives owner approval. | Shared edge vocabulary and TabList boundary | Accepted boundary |
109
111
 
110
112
  ### Allowed variation
111
113
 
112
114
  - Layout, size, role, selected value, labels, tab content, and overflow mode may
113
- vary while the same edge-compensation meaning is preserved.
115
+ vary while the same `bleed` meaning is preserved.
114
116
  - The implementation may retain the current outer-box/inner-strip technique or
115
117
  replace it with equivalent geometry that satisfies FR1–FR2.
116
118
  - A host may be painted or bounded only where TabList's component-specific
@@ -118,20 +120,20 @@ The removal release MUST include a `[breaking]` Changeset for
118
120
 
119
121
  ### Representative states
120
122
 
121
- | State | Required invariant | Allowed variation |
122
- | --------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
123
- | Default/omitted | Current TabList box, strip, and tab geometry are unchanged. | Any current layout, role, or overflow mode. |
124
- | Canonical inline mode | Outer box consumes each host inset; edge content reaches the host line only when that inset is at least the tab padding. | Host inset smaller than, equal to, or larger than edge-tab padding; asymmetric insets; LTR/RTL. |
125
- | Divider | `hasDivider` rail spans the expanded outer inline width. | Fitting or overflowing strips. |
126
- | Legacy alias | `isFullBleed={true}` matches canonical inline geometry during the compatibility window. | The canonical prop may also be present. |
127
- | Overflowing strip | Scroll access, edge fades, controls, and selected-tab reveal remain correct. | Start/end overflow independently. |
128
- | Focused edge tab | The focus ring remains visible and local to the tab. | Keyboard or pointer focus. |
123
+ | State | Required invariant | Allowed variation |
124
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
125
+ | Default/omitted | Current TabList box, strip, and tab geometry are unchanged. | Any current layout, role, or overflow mode. |
126
+ | Canonical `bleed` | Outer box consumes each host inset; edge content reaches the host line only when that inset is at least the tab padding. | Host inset smaller than, equal to, or larger than edge-tab padding; asymmetric insets; LTR/RTL. |
127
+ | Divider | `hasDivider` rail spans the expanded outer inline width. | Fitting or overflowing strips. |
128
+ | Legacy alias | `isFullBleed={true}` matches canonical `bleed` geometry during the compatibility window. | The canonical prop may also be present. |
129
+ | Overflowing strip | Scroll access, edge fades, controls, and selected-tab reveal remain correct. | Start/end overflow independently. |
130
+ | Focused edge tab | The focus ring remains visible and local to the tab. | Keyboard or pointer focus. |
129
131
 
130
132
  ### Transformation and precedence order
131
133
 
132
- - **ORD1 — Public input.** Resolve explicit `edgeCompensation`; otherwise map
133
- `isFullBleed={true}` to `inline` during the compatibility window; otherwise use
134
- no compensation.
134
+ - **ORD1 — Public input.** Resolve explicit `edge`; otherwise map
135
+ `isFullBleed={true}` to `bleed` during the compatibility window; otherwise use
136
+ `padded`.
135
137
  - **ORD2 — Host geometry.** Read the matching inherited logical host insets, with
136
138
  missing values falling back to zero.
137
139
  - **ORD3 — Component geometry.** Resolve edge-tab padding and focus/indicator
@@ -145,10 +147,10 @@ The removal release MUST include a `[breaking]` Changeset for
145
147
 
146
148
  ## Accessibility contract
147
149
 
148
- - **AR1 — Interaction remains stable.** Edge compensation MUST NOT change the
150
+ - **AR1 — Interaction remains stable.** The `bleed` treatment MUST NOT change the
149
151
  tab/nav pattern, accessible names, selected state, keyboard movement, tab stop,
150
152
  focus target, or controlled value behavior.
151
- - **AR2 — Overflow remains reachable.** Compensated edge geometry MUST NOT clip or
153
+ - **AR2 — Overflow remains reachable.** `bleed` geometry MUST NOT clip or
152
154
  hide a focus ring, selected indicator, visible tab content, or an overflow
153
155
  control required to reach offscreen tabs.
154
156
 
@@ -162,8 +164,8 @@ The removal release MUST include a `[breaking]` Changeset for
162
164
 
163
165
  ## Family and system relationships
164
166
 
165
- - `architecture:container-padding` owns host publication, the shared
166
- `edgeCompensation` vocabulary, logical-edge semantics, and overlay reset.
167
+ - `architecture:container-padding` owns host publication, the shared `edge`
168
+ vocabulary, logical-edge semantics, and overlay reset.
167
169
  - `architecture:public-component-api` and `spec:AST-002` own public API
168
170
  admission; `spec:AST-017/DEC-1` owns the breaking classification and migration
169
171
  evidence required when the released alias is removed.
@@ -189,9 +191,20 @@ TabList's current mode consumes the full inherited inline host inset, keeps an
189
191
  optional divider across that expanded width, and restores only the portion of
190
192
  content inset not already supplied by edge-tab padding. The user-facing intent is
191
193
  therefore edge compensation, not a promise that tab content itself reaches an
192
- outer edge. `edgeCompensation="inline"` becomes the canonical spelling;
193
- `isFullBleed` remains a compatibility alias until its `[breaking]` next-minor
194
- removal, with the required codemod and release evidence.
194
+ outer edge. DEC-2 sets the canonical spelling; `isFullBleed` remains a
195
+ compatibility alias until its `[breaking]` next-minor removal, with the required
196
+ codemod and release evidence.
197
+
198
+ ### DEC-2 — TabList spells its mode with the shared edge vocabulary
199
+
200
+ **Reference:** `component:TabList/DEC-2`
201
+
202
+ **Decider:** cixzhang, 2026-10-16
203
+
204
+ `architecture:container-padding` names TabList's geometry `bleed`: paint reaches
205
+ the host's padding edge and content stays on the host content line, or at the
206
+ edge tab's own padding when the host inset is smaller. `edge="bleed"` is the
207
+ canonical spelling, so TabList and List share one prop name and one value set.
195
208
 
196
209
  ## Open questions
197
210
 
@@ -783,6 +783,73 @@ describe('TabMenu', () => {
783
783
  });
784
784
  });
785
785
 
786
+ describe('TabMenu host attributes', () => {
787
+ const menuOptions = [
788
+ {value: 'analytics', label: 'Analytics'},
789
+ {value: 'reports', label: 'Reports'},
790
+ ];
791
+
792
+ it('forwards host attributes to the trigger, not the popup', () => {
793
+ render(
794
+ <TabList value="home" onChange={() => {}}>
795
+ <Tab value="home" label="Home" />
796
+ <TabMenu
797
+ label="More"
798
+ options={menuOptions}
799
+ id="more-tabs"
800
+ aria-label="More views"
801
+ data-view="overflow"
802
+ />
803
+ </TabList>,
804
+ );
805
+
806
+ const trigger = screen.getByRole('button', {name: 'More views'});
807
+ expect(trigger).toHaveAttribute('id', 'more-tabs');
808
+ expect(trigger).toHaveAttribute('data-view', 'overflow');
809
+ const menu = screen.getByRole('menu', {name: 'More', hidden: true});
810
+ expect(trigger).toHaveAttribute('aria-controls', menu.id);
811
+ });
812
+
813
+ it('runs drag-and-drop handlers on the trigger', () => {
814
+ const onDragOver = vi.fn();
815
+ const onDrop = vi.fn();
816
+ render(
817
+ <TabList value="home" onChange={() => {}}>
818
+ <Tab value="home" label="Home" />
819
+ <TabMenu
820
+ label="More"
821
+ options={menuOptions}
822
+ onDragOver={onDragOver}
823
+ onDrop={onDrop}
824
+ />
825
+ </TabList>,
826
+ );
827
+ const trigger = screen.getByRole('button', {name: 'More'});
828
+ fireEvent.dragOver(trigger);
829
+ fireEvent.drop(trigger);
830
+ expect(onDragOver).toHaveBeenCalledTimes(1);
831
+ expect(onDrop).toHaveBeenCalledTimes(1);
832
+ expect(trigger).toHaveAttribute('aria-expanded', 'false');
833
+ });
834
+
835
+ it('onClick preserves the toggle', async () => {
836
+ const user = userEvent.setup();
837
+ const onClick = vi.fn((event: React.MouseEvent<HTMLButtonElement>) => {
838
+ event.preventDefault();
839
+ });
840
+ render(
841
+ <TabList value="home" onChange={() => {}}>
842
+ <Tab value="home" label="Home" />
843
+ <TabMenu label="More" options={menuOptions} onClick={onClick} />
844
+ </TabList>,
845
+ );
846
+ const trigger = screen.getByRole('button', {name: 'More'});
847
+ await user.click(trigger);
848
+ expect(onClick).toHaveBeenCalledTimes(1);
849
+ expect(trigger).toHaveAttribute('aria-expanded', 'true');
850
+ });
851
+ });
852
+
786
853
  describe('TabMenu keyboard navigation (roving tabindex)', () => {
787
854
  const menuOptions = [
788
855
  {value: 'analytics', label: 'Analytics'},
@@ -7,7 +7,7 @@ export const docs = {
7
7
  subComponentOf: 'TabList',
8
8
  displayName: 'Tab Menu',
9
9
  isHiddenFromOverview: true,
10
- description: "Overflow menu trigger that opens a dropdown of additional tab options, showing the selected option's label as the trigger text.",
10
+ description: "Overflow menu trigger that opens a dropdown of additional tab options, showing the selected option's label as the trigger text. Host attributes and DOM event handlers (id, aria-*, data-*, drag and drop) reach the trigger button, not the popup or its options. The button keeps its role, tab stop, and menu disclosure attributes.",
11
11
  // TabMenu requires TabList context; wrap it so the preview doesn't throw.
12
12
  // The wrapper value matches none of the options, so the trigger shows its
13
13
  // own label (the idle overflow state).
@@ -42,7 +42,7 @@ export const docsZh = {
42
42
  name: 'TabMenu',
43
43
  isHiddenFromOverview: true,
44
44
  displayName: 'Tab Menu',
45
- description: '溢出菜单触发器,打开包含额外标签选项的下拉菜单,将选中选项的标签显示为触发器文本。',
45
+ description: '溢出菜单触发器,打开包含额外标签选项的下拉菜单,将选中选项的标签显示为触发器文本。宿主属性和 DOM 事件处理器(id、aria-*、data-*、拖放)传递给触发按钮,而不是弹出菜单或选项。按钮保留自己的角色、Tab 停靠点及菜单展开属性。',
46
46
  props: [
47
47
  {
48
48
  name: 'label',
@@ -63,7 +63,8 @@ export const docsDense = {
63
63
  name: 'TabMenu',
64
64
  isHiddenFromOverview: true,
65
65
  displayName: 'Tab Menu',
66
- description: "Overflow menu trigger; dropdown of extra tab options, shows selected option's label as trigger text.",
66
+ description:
67
+ "Overflow menu trigger; shows selected option's label. Host attributes/DOM handlers reach the trigger button, not the popup/options; role, tab stop and disclosure attributes stay owned.",
67
68
  propDescriptions: {
68
69
  label: 'Trigger text (when no option selected) + dropdown heading.',
69
70
  options: 'Menu options array rendered in dropdown.',