@astryxdesign/core 0.7.6-canary.ec128c4 → 0.7.6-canary.f73623d

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 (454) hide show
  1. package/dist/AppShell/AppShell.d.ts.map +1 -1
  2. package/dist/AppShell/AppShell.js +183 -5
  3. package/dist/AppShell/observeMainOverflow.d.ts +9 -0
  4. package/dist/AppShell/observeMainOverflow.d.ts.map +1 -0
  5. package/dist/AppShell/observeMainOverflow.js +125 -0
  6. package/dist/Carousel/Carousel.d.ts +3 -1
  7. package/dist/Carousel/Carousel.d.ts.map +1 -1
  8. package/dist/Carousel/Carousel.js +12 -3
  9. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  10. package/dist/ComplexSelector/ComplexSelector.js +41 -4
  11. package/dist/DateInput/Wheel.d.ts.map +1 -1
  12. package/dist/DateInput/Wheel.js +11 -7
  13. package/dist/DateInput/usePointerDragScroll.d.ts +10 -1
  14. package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
  15. package/dist/DateInput/usePointerDragScroll.js +25 -9
  16. package/dist/DateInput/useScrollSettle.d.ts +3 -1
  17. package/dist/DateInput/useScrollSettle.d.ts.map +1 -1
  18. package/dist/DateInput/useScrollSettle.js +37 -8
  19. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  20. package/dist/DropdownMenu/DropdownMenu.js +28 -19
  21. package/dist/Item/Item.d.ts.map +1 -1
  22. package/dist/Item/Item.js +19 -6
  23. package/dist/Layer/useLayer.d.ts.map +1 -1
  24. package/dist/Layer/useLayer.js +27 -6
  25. package/dist/Link/Link.d.ts.map +1 -1
  26. package/dist/Link/Link.js +8 -3
  27. package/dist/Markdown/plugins/headingLinks.a11y.chromium.spec.js +1 -1
  28. package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
  29. package/dist/NavMenu/NavHeadingMenuItem.js +5 -29
  30. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  31. package/dist/NumberInput/NumberInput.js +23 -2
  32. package/dist/Outline/Outline.d.ts.map +1 -1
  33. package/dist/Outline/Outline.js +27 -0
  34. package/dist/Popover/Popover.d.ts.map +1 -1
  35. package/dist/Popover/Popover.js +32 -12
  36. package/dist/Popover/usePopover.d.ts.map +1 -1
  37. package/dist/Popover/usePopover.js +10 -3
  38. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  39. package/dist/PowerSearch/PowerSearch.js +37 -30
  40. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  41. package/dist/RadioList/RadioListItem.js +11 -3
  42. package/dist/SideNav/SideNavItem.d.ts +2 -2
  43. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  44. package/dist/SideNav/SideNavItem.js +18 -7
  45. package/dist/Skeleton/Skeleton.d.ts.map +1 -1
  46. package/dist/Skeleton/Skeleton.js +1 -1
  47. package/dist/Spinner/Spinner.d.ts.map +1 -1
  48. package/dist/Spinner/Spinner.js +1 -1
  49. package/dist/Stepper/Step.d.ts.map +1 -1
  50. package/dist/Stepper/Step.js +26 -6
  51. package/dist/Switch/Switch.d.ts.map +1 -1
  52. package/dist/Switch/Switch.js +10 -3
  53. package/dist/Table/Table.d.ts.map +1 -1
  54. package/dist/Table/Table.js +36 -10
  55. package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
  56. package/dist/Table/plugins/sortable/useTableSortable.js +46 -58
  57. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  58. package/dist/Toast/ToastViewport.js +19 -3
  59. package/dist/ToggleButton/ToggleButtonGroup.d.ts +7 -1
  60. package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
  61. package/dist/ToggleButton/ToggleButtonGroup.js +16 -2
  62. package/dist/Token/Token.d.ts.map +1 -1
  63. package/dist/Token/Token.js +37 -5
  64. package/dist/Token/TokenLink.d.ts.map +1 -1
  65. package/dist/Token/TokenLink.js +14 -2
  66. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  67. package/dist/Tokenizer/Tokenizer.js +15 -4
  68. package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts +2 -0
  69. package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -0
  70. package/dist/Tokenizer/TokenizerClearAllMessageContext.js +17 -0
  71. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  72. package/dist/TreeList/TreeListItem.js +27 -4
  73. package/dist/Typeahead/BaseTypeahead.d.ts +4 -4
  74. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  75. package/dist/Typeahead/BaseTypeahead.js +43 -7
  76. package/dist/astryx.css +10 -3
  77. package/dist/gestures/GestureArena.d.ts +26 -1
  78. package/dist/gestures/GestureArena.d.ts.map +1 -1
  79. package/dist/gestures/GestureArena.js +71 -9
  80. package/dist/gestures/GestureHost.d.ts +2 -3
  81. package/dist/gestures/GestureHost.d.ts.map +1 -1
  82. package/dist/gestures/GestureHost.js +7 -7
  83. package/dist/gestures/GestureRecognizer.d.ts +3 -1
  84. package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
  85. package/dist/gestures/GestureRecognizer.js +3 -1
  86. package/dist/gestures/PressTracker.d.ts +112 -0
  87. package/dist/gestures/PressTracker.d.ts.map +1 -0
  88. package/dist/gestures/PressTracker.js +267 -0
  89. package/dist/gestures/index.d.ts +37 -0
  90. package/dist/gestures/index.d.ts.map +1 -0
  91. package/dist/gestures/index.js +25 -0
  92. package/dist/gestures/useGestureRecognizer.d.ts +56 -0
  93. package/dist/gestures/useGestureRecognizer.d.ts.map +1 -0
  94. package/dist/gestures/useGestureRecognizer.js +226 -0
  95. package/dist/hooks/scrollKeyboardDelegation.d.ts.map +1 -1
  96. package/dist/hooks/scrollKeyboardDelegation.js +7 -3
  97. package/dist/hooks/useScrollOverflow.d.ts +2 -1
  98. package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
  99. package/dist/hooks/useScrollOverflow.js +56 -10
  100. package/dist/i18n/generated-locales/af-ZA.generated.d.ts.map +1 -1
  101. package/dist/i18n/generated-locales/af-ZA.generated.js +0 -5
  102. package/dist/i18n/generated-locales/ar-SA.generated.d.ts.map +1 -1
  103. package/dist/i18n/generated-locales/ar-SA.generated.js +0 -5
  104. package/dist/i18n/generated-locales/ca-ES.generated.d.ts.map +1 -1
  105. package/dist/i18n/generated-locales/ca-ES.generated.js +0 -5
  106. package/dist/i18n/generated-locales/cs-CZ.generated.d.ts.map +1 -1
  107. package/dist/i18n/generated-locales/cs-CZ.generated.js +0 -5
  108. package/dist/i18n/generated-locales/da-DK.generated.d.ts.map +1 -1
  109. package/dist/i18n/generated-locales/da-DK.generated.js +0 -5
  110. package/dist/i18n/generated-locales/de-DE.generated.d.ts.map +1 -1
  111. package/dist/i18n/generated-locales/de-DE.generated.js +0 -5
  112. package/dist/i18n/generated-locales/el-GR.generated.d.ts.map +1 -1
  113. package/dist/i18n/generated-locales/el-GR.generated.js +0 -5
  114. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  115. package/dist/i18n/generated-locales/en.generated.js +3 -5
  116. package/dist/i18n/generated-locales/es-ES.generated.d.ts.map +1 -1
  117. package/dist/i18n/generated-locales/es-ES.generated.js +0 -5
  118. package/dist/i18n/generated-locales/fi-FI.generated.d.ts.map +1 -1
  119. package/dist/i18n/generated-locales/fi-FI.generated.js +0 -5
  120. package/dist/i18n/generated-locales/fr-FR.generated.d.ts.map +1 -1
  121. package/dist/i18n/generated-locales/fr-FR.generated.js +0 -5
  122. package/dist/i18n/generated-locales/he-IL.generated.d.ts.map +1 -1
  123. package/dist/i18n/generated-locales/he-IL.generated.js +0 -5
  124. package/dist/i18n/generated-locales/hu-HU.generated.d.ts.map +1 -1
  125. package/dist/i18n/generated-locales/hu-HU.generated.js +0 -5
  126. package/dist/i18n/generated-locales/it-IT.generated.d.ts.map +1 -1
  127. package/dist/i18n/generated-locales/it-IT.generated.js +0 -5
  128. package/dist/i18n/generated-locales/ja-JP.generated.d.ts.map +1 -1
  129. package/dist/i18n/generated-locales/ja-JP.generated.js +0 -5
  130. package/dist/i18n/generated-locales/ko-KR.generated.d.ts.map +1 -1
  131. package/dist/i18n/generated-locales/ko-KR.generated.js +0 -5
  132. package/dist/i18n/generated-locales/nl-NL.generated.d.ts.map +1 -1
  133. package/dist/i18n/generated-locales/nl-NL.generated.js +0 -5
  134. package/dist/i18n/generated-locales/no-NO.generated.d.ts.map +1 -1
  135. package/dist/i18n/generated-locales/no-NO.generated.js +0 -5
  136. package/dist/i18n/generated-locales/pl-PL.generated.d.ts.map +1 -1
  137. package/dist/i18n/generated-locales/pl-PL.generated.js +0 -5
  138. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  139. package/dist/i18n/generated-locales/pseudo.generated.js +3 -5
  140. package/dist/i18n/generated-locales/pt-BR.generated.d.ts.map +1 -1
  141. package/dist/i18n/generated-locales/pt-BR.generated.js +0 -5
  142. package/dist/i18n/generated-locales/pt-PT.generated.d.ts.map +1 -1
  143. package/dist/i18n/generated-locales/pt-PT.generated.js +0 -5
  144. package/dist/i18n/generated-locales/ro-RO.generated.d.ts.map +1 -1
  145. package/dist/i18n/generated-locales/ro-RO.generated.js +0 -5
  146. package/dist/i18n/generated-locales/ru-RU.generated.d.ts.map +1 -1
  147. package/dist/i18n/generated-locales/ru-RU.generated.js +0 -5
  148. package/dist/i18n/generated-locales/sr-SP.generated.d.ts.map +1 -1
  149. package/dist/i18n/generated-locales/sr-SP.generated.js +0 -5
  150. package/dist/i18n/generated-locales/sv-SE.generated.d.ts.map +1 -1
  151. package/dist/i18n/generated-locales/sv-SE.generated.js +0 -5
  152. package/dist/i18n/generated-locales/tr-TR.generated.d.ts.map +1 -1
  153. package/dist/i18n/generated-locales/tr-TR.generated.js +0 -5
  154. package/dist/i18n/generated-locales/uk-UA.generated.d.ts.map +1 -1
  155. package/dist/i18n/generated-locales/uk-UA.generated.js +0 -5
  156. package/dist/i18n/generated-locales/vi-VN.generated.d.ts.map +1 -1
  157. package/dist/i18n/generated-locales/vi-VN.generated.js +0 -5
  158. package/dist/i18n/generated-locales/zh-CN.generated.d.ts.map +1 -1
  159. package/dist/i18n/generated-locales/zh-CN.generated.js +0 -5
  160. package/dist/i18n/generated-locales/zh-TW.generated.d.ts.map +1 -1
  161. package/dist/i18n/generated-locales/zh-TW.generated.js +0 -5
  162. package/dist/motion/animator.d.ts +76 -7
  163. package/dist/motion/animator.d.ts.map +1 -1
  164. package/dist/motion/animator.js +589 -99
  165. package/dist/motion/coast.d.ts +4 -1
  166. package/dist/motion/coast.d.ts.map +1 -1
  167. package/dist/motion/coast.js +4 -2
  168. package/dist/motion/reducedMotion.d.ts.map +1 -1
  169. package/dist/motion/reducedMotion.js +6 -2
  170. package/dist/motion/reducedMotionPlan.d.ts +7 -0
  171. package/dist/motion/reducedMotionPlan.d.ts.map +1 -1
  172. package/dist/motion/reducedMotionPlan.js +14 -1
  173. package/dist/motion/resolveMotion.d.ts +42 -0
  174. package/dist/motion/resolveMotion.d.ts.map +1 -0
  175. package/dist/motion/resolveMotion.js +43 -0
  176. package/dist/motion/roleValue.d.ts +2 -1
  177. package/dist/motion/roleValue.d.ts.map +1 -1
  178. package/dist/motion/roleValue.js +2 -1
  179. package/dist/motion/uikit/timing.d.ts +7 -1
  180. package/dist/motion/uikit/timing.d.ts.map +1 -1
  181. package/dist/motion/uikit/timing.js +19 -1
  182. package/dist/theme/defineTheme.d.ts +19 -5
  183. package/dist/theme/defineTheme.d.ts.map +1 -1
  184. package/dist/theme/defineTheme.js +63 -3
  185. package/dist/theme/index.d.ts +1 -0
  186. package/dist/theme/index.d.ts.map +1 -1
  187. package/dist/theme/motionKnobs.d.ts +56 -0
  188. package/dist/theme/motionKnobs.d.ts.map +1 -0
  189. package/dist/theme/motionKnobs.js +48 -0
  190. package/dist/theme/resolveThemeValues.d.ts +11 -4
  191. package/dist/theme/resolveThemeValues.d.ts.map +1 -1
  192. package/dist/theme/resolveThemeValues.js +40 -4
  193. package/dist/theme/themeAdaptations.d.ts +7 -3
  194. package/dist/theme/themeAdaptations.d.ts.map +1 -1
  195. package/dist/theme/themeAdaptations.js +36 -7
  196. package/dist/theme/themeMotion.d.ts +96 -0
  197. package/dist/theme/themeMotion.d.ts.map +1 -0
  198. package/dist/theme/themeMotion.js +177 -0
  199. package/dist/theme/tokenReferences.d.ts +31 -0
  200. package/dist/theme/tokenReferences.d.ts.map +1 -0
  201. package/dist/theme/tokenReferences.js +132 -0
  202. package/dist/theme/tokens.d.ts +1 -0
  203. package/dist/theme/tokens.d.ts.map +1 -1
  204. package/dist/theme/tokens.js +9 -129
  205. package/dist/theme/tokens.stylex.d.ts +12 -0
  206. package/dist/theme/tokens.stylex.d.ts.map +1 -1
  207. package/dist/theme/tokens.stylex.js +12 -0
  208. package/dist/utils/focusOutline.stylex.d.ts +6 -0
  209. package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
  210. package/dist/utils/focusOutline.stylex.js +7 -0
  211. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  212. package/dist/utils/interactionOverlay.stylex.js +17 -8
  213. package/dist/utils/pressFeedback.d.ts.map +1 -1
  214. package/dist/utils/pressFeedback.js +20 -1
  215. package/dist/utils/sharedMutationObserver.d.ts +19 -11
  216. package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
  217. package/dist/utils/sharedMutationObserver.js +66 -26
  218. package/dist/utils/touchPresentation.d.ts +2 -2
  219. package/dist/utils/touchPresentation.d.ts.map +1 -1
  220. package/dist/utils/touchPresentation.js +8 -5
  221. package/dist/utils/touchQueries.d.ts +13 -0
  222. package/dist/utils/touchQueries.d.ts.map +1 -0
  223. package/dist/utils/touchQueries.js +15 -0
  224. package/dist/utils/useFocusAcrossSwap.d.ts +19 -0
  225. package/dist/utils/useFocusAcrossSwap.d.ts.map +1 -0
  226. package/dist/utils/useFocusAcrossSwap.js +41 -0
  227. package/locales/af-ZA.json +0 -21
  228. package/locales/ar-SA.json +0 -21
  229. package/locales/ca-ES.json +0 -21
  230. package/locales/cs-CZ.json +0 -21
  231. package/locales/da-DK.json +0 -21
  232. package/locales/de-DE.json +0 -21
  233. package/locales/el-GR.json +0 -21
  234. package/locales/en.json +12 -20
  235. package/locales/es-ES.json +0 -21
  236. package/locales/fi-FI.json +0 -21
  237. package/locales/fr-FR.json +0 -21
  238. package/locales/he-IL.json +0 -21
  239. package/locales/hu-HU.json +0 -21
  240. package/locales/it-IT.json +0 -21
  241. package/locales/ja-JP.json +0 -21
  242. package/locales/ko-KR.json +0 -21
  243. package/locales/nl-NL.json +0 -21
  244. package/locales/no-NO.json +0 -21
  245. package/locales/pl-PL.json +0 -21
  246. package/locales/pseudo.json +8 -14
  247. package/locales/pt-BR.json +0 -21
  248. package/locales/pt-PT.json +0 -21
  249. package/locales/ro-RO.json +0 -21
  250. package/locales/ru-RU.json +0 -21
  251. package/locales/sr-SP.json +0 -21
  252. package/locales/sv-SE.json +0 -21
  253. package/locales/tr-TR.json +0 -21
  254. package/locales/uk-UA.json +0 -21
  255. package/locales/vi-VN.json +0 -21
  256. package/locales/zh-CN.json +0 -21
  257. package/locales/zh-TW.json +0 -21
  258. package/package.json +4 -4
  259. package/src/AppShell/AppShell.doc.mjs +1 -1
  260. package/src/AppShell/AppShell.spec.md +9 -12
  261. package/src/AppShell/AppShell.test.tsx +164 -2
  262. package/src/AppShell/AppShell.tsx +225 -5
  263. package/src/AppShell/__tests__/AppShellMainKeyboard.a11y.browser.spec.ts +534 -0
  264. package/src/AppShell/observeMainOverflow.test.ts +173 -0
  265. package/src/AppShell/observeMainOverflow.ts +143 -0
  266. package/src/Carousel/Carousel.doc.mjs +1 -1
  267. package/src/Carousel/Carousel.spec.md +9 -9
  268. package/src/Carousel/Carousel.test.tsx +124 -3
  269. package/src/Carousel/Carousel.tsx +10 -2
  270. package/src/Carousel/__tests__/Carousel.a11y.known-failures.ts +1 -16
  271. package/src/Chat/ChatComposer.spec.md +75 -59
  272. package/src/Chat/ChatComposerTokenElement.spec.md +45 -33
  273. package/src/Chat/ChatDictationButton.spec.md +126 -81
  274. package/src/Chat/ChatLayout.spec.md +41 -36
  275. package/src/Chat/ChatLayoutScrollButton.spec.md +87 -103
  276. package/src/Chat/ChatSendButton.spec.md +78 -67
  277. package/src/CodeBlock/__tests__/CodeBlockCopyClearance.a11y.chromium.spec.ts +38 -3
  278. package/src/ComplexSelector/ComplexSelector.test.tsx +111 -0
  279. package/src/ComplexSelector/ComplexSelector.tsx +41 -4
  280. package/src/ContextMenu/ContextMenu.spec.md +84 -56
  281. package/src/ContextMenu/ContextMenuItem.spec.md +132 -0
  282. package/src/DateInput/DateInputTouch.test.tsx +44 -0
  283. package/src/DateInput/Wheel.tsx +9 -6
  284. package/src/DateInput/usePointerDragScroll.ts +34 -10
  285. package/src/DateInput/useScrollSettle.ts +38 -7
  286. package/src/DropdownMenu/DropdownMenu.spec.md +198 -218
  287. package/src/DropdownMenu/DropdownMenu.test.tsx +117 -0
  288. package/src/DropdownMenu/DropdownMenu.tsx +33 -18
  289. package/src/DropdownMenu/DropdownMenuCheckboxItem.spec.md +192 -0
  290. package/src/DropdownMenu/DropdownMenuDivider.spec.md +25 -31
  291. package/src/DropdownMenu/DropdownMenuGroup.spec.md +145 -0
  292. package/src/DropdownMenu/DropdownMenuItem.spec.md +48 -42
  293. package/src/DropdownMenu/DropdownMenuRadioGroup.spec.md +34 -37
  294. package/src/DropdownMenu/DropdownMenuRadioItem.spec.md +54 -53
  295. package/src/DropdownMenu/DropdownMenuSubMenu.spec.md +47 -41
  296. package/src/EmptyState/EmptyState.spec.md +35 -29
  297. package/src/Item/Item.test.tsx +60 -0
  298. package/src/Item/Item.tsx +14 -7
  299. package/src/Layer/useLayer.test.tsx +78 -3
  300. package/src/Layer/useLayer.tsx +27 -6
  301. package/src/Link/Link.spec.md +3 -2
  302. package/src/Link/Link.tsx +11 -0
  303. package/src/Link/__tests__/Link.truncation.a11y.chromium.spec.ts +58 -0
  304. package/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts +1 -1
  305. package/src/NavMenu/NavHeadingMenuItem.tsx +5 -39
  306. package/src/NumberInput/NumberInput.test.tsx +68 -7
  307. package/src/NumberInput/NumberInput.tsx +31 -1
  308. package/src/Outline/Outline.spec.md +165 -69
  309. package/src/Outline/Outline.test.tsx +67 -2
  310. package/src/Outline/Outline.tsx +23 -0
  311. package/src/Outline/modules/parseOutlineFromMarkdown.spec.md +3 -4
  312. package/src/OverflowList/OverflowList.spec.md +102 -55
  313. package/src/Pagination/Pagination.spec.md +158 -84
  314. package/src/Popover/Popover.test.tsx +84 -0
  315. package/src/Popover/Popover.tsx +34 -14
  316. package/src/Popover/__tests__/PopoverSecondDocument.a11y.chromium.spec.ts +70 -8
  317. package/src/Popover/usePopover.tsx +10 -3
  318. package/src/PowerSearch/PowerSearch.test.tsx +24 -0
  319. package/src/PowerSearch/PowerSearch.tsx +42 -31
  320. package/src/RadioList/RadioList.spec.md +1 -1
  321. package/src/RadioList/RadioList.test.tsx +84 -0
  322. package/src/RadioList/RadioListItem.tsx +11 -2
  323. package/src/Resizable/Resizable.spec.md +144 -124
  324. package/src/SideNav/SideNav.test.tsx +124 -4
  325. package/src/SideNav/SideNavItem.spec.md +14 -24
  326. package/src/SideNav/SideNavItem.tsx +27 -10
  327. package/src/Skeleton/Skeleton.tsx +3 -1
  328. package/src/Spinner/Spinner.tsx +3 -1
  329. package/src/Stepper/Step.spec.md +36 -42
  330. package/src/Stepper/Step.tsx +33 -6
  331. package/src/Stepper/Stepper.doc.mjs +1 -1
  332. package/src/Stepper/Stepper.test.tsx +69 -7
  333. package/src/Switch/Switch.spec.md +1 -1
  334. package/src/Switch/Switch.test.tsx +66 -1
  335. package/src/Switch/Switch.tsx +11 -3
  336. package/src/Table/Table.spec.md +1 -1
  337. package/src/Table/Table.test.tsx +32 -0
  338. package/src/Table/Table.tsx +43 -11
  339. package/src/Table/__tests__/Table.a11y.states.ts +1 -5
  340. package/src/Table/plugins/sortable/useTableSortable.test.tsx +73 -144
  341. package/src/Table/plugins/sortable/useTableSortable.tsx +44 -73
  342. package/src/Table/plugins/sortable/useTableSortableState.test.tsx +9 -21
  343. package/src/TimeInput/TimeInput.spec.md +13 -13
  344. package/src/Toast/Toast.spec.md +2 -5
  345. package/src/Toast/ToastViewport.test.tsx +79 -0
  346. package/src/Toast/ToastViewport.tsx +21 -3
  347. package/src/ToggleButton/ToggleButton.test.tsx +27 -0
  348. package/src/ToggleButton/ToggleButtonGroup.tsx +20 -1
  349. package/src/Token/Token.doc.mjs +2 -2
  350. package/src/Token/Token.spec.md +41 -51
  351. package/src/Token/Token.test.tsx +67 -0
  352. package/src/Token/Token.tsx +60 -5
  353. package/src/Token/TokenLink.tsx +21 -7
  354. package/src/Tokenizer/Tokenizer.spec.md +13 -1
  355. package/src/Tokenizer/Tokenizer.test.tsx +27 -0
  356. package/src/Tokenizer/Tokenizer.tsx +24 -10
  357. package/src/Tokenizer/TokenizerBottomSheet.test.tsx +8 -0
  358. package/src/Tokenizer/TokenizerClearAllMessageContext.ts +21 -0
  359. package/src/TreeList/TreeList.test.tsx +26 -0
  360. package/src/TreeList/TreeListItem.tsx +26 -4
  361. package/src/Typeahead/BaseTypeahead.doc.mjs +3 -3
  362. package/src/Typeahead/BaseTypeahead.spec.md +45 -45
  363. package/src/Typeahead/BaseTypeahead.tsx +48 -9
  364. package/src/Typeahead/Typeahead.test.tsx +120 -0
  365. package/src/__tests__/internalModulesNotExperimental.test.ts +88 -0
  366. package/src/__tests__/pressState.ts +8 -4
  367. package/src/gestures/GestureArena.ts +76 -11
  368. package/src/gestures/GestureHost.ts +6 -7
  369. package/src/gestures/GestureRecognizer.ts +3 -1
  370. package/src/gestures/PressTracker.ts +386 -0
  371. package/src/gestures/README.md +420 -0
  372. package/src/gestures/__tests__/GestureHost.test.ts +50 -1
  373. package/src/gestures/__tests__/PressTracker.test.ts +275 -0
  374. package/src/gestures/__tests__/arena.test.ts +35 -0
  375. package/src/gestures/__tests__/harness.ts +31 -2
  376. package/src/gestures/__tests__/pressTrackerFactory.test.ts +59 -0
  377. package/src/gestures/__tests__/useGestureRecognizer.test.tsx +570 -0
  378. package/src/gestures/index.ts +79 -0
  379. package/src/gestures/useGestureRecognizer.ts +305 -0
  380. package/src/hooks/scrollKeyboardDelegation.test.ts +33 -0
  381. package/src/hooks/scrollKeyboardDelegation.ts +9 -3
  382. package/src/hooks/useScrollOverflow.doc.mjs +1 -1
  383. package/src/hooks/useScrollOverflow.test.tsx +102 -1
  384. package/src/hooks/useScrollOverflow.ts +59 -10
  385. package/src/i18n/generated-locales/af-ZA.generated.ts +0 -7
  386. package/src/i18n/generated-locales/ar-SA.generated.ts +0 -6
  387. package/src/i18n/generated-locales/ca-ES.generated.ts +0 -7
  388. package/src/i18n/generated-locales/cs-CZ.generated.ts +0 -6
  389. package/src/i18n/generated-locales/da-DK.generated.ts +0 -6
  390. package/src/i18n/generated-locales/de-DE.generated.ts +0 -6
  391. package/src/i18n/generated-locales/el-GR.generated.ts +0 -7
  392. package/src/i18n/generated-locales/en.generated.ts +3 -6
  393. package/src/i18n/generated-locales/es-ES.generated.ts +0 -7
  394. package/src/i18n/generated-locales/fi-FI.generated.ts +0 -6
  395. package/src/i18n/generated-locales/fr-FR.generated.ts +0 -7
  396. package/src/i18n/generated-locales/he-IL.generated.ts +0 -6
  397. package/src/i18n/generated-locales/hu-HU.generated.ts +0 -6
  398. package/src/i18n/generated-locales/it-IT.generated.ts +0 -7
  399. package/src/i18n/generated-locales/ja-JP.generated.ts +0 -6
  400. package/src/i18n/generated-locales/ko-KR.generated.ts +0 -6
  401. package/src/i18n/generated-locales/nl-NL.generated.ts +0 -6
  402. package/src/i18n/generated-locales/no-NO.generated.ts +0 -6
  403. package/src/i18n/generated-locales/pl-PL.generated.ts +0 -7
  404. package/src/i18n/generated-locales/pseudo.generated.ts +3 -6
  405. package/src/i18n/generated-locales/pt-BR.generated.ts +0 -7
  406. package/src/i18n/generated-locales/pt-PT.generated.ts +0 -7
  407. package/src/i18n/generated-locales/ro-RO.generated.ts +0 -6
  408. package/src/i18n/generated-locales/ru-RU.generated.ts +0 -7
  409. package/src/i18n/generated-locales/sr-SP.generated.ts +0 -6
  410. package/src/i18n/generated-locales/sv-SE.generated.ts +0 -6
  411. package/src/i18n/generated-locales/tr-TR.generated.ts +0 -7
  412. package/src/i18n/generated-locales/uk-UA.generated.ts +0 -7
  413. package/src/i18n/generated-locales/vi-VN.generated.ts +0 -6
  414. package/src/i18n/generated-locales/zh-CN.generated.ts +0 -6
  415. package/src/i18n/generated-locales/zh-TW.generated.ts +0 -6
  416. package/src/motion/MEASUREMENTS.md +2 -1
  417. package/src/motion/README.md +102 -32
  418. package/src/motion/__tests__/animator.interaction.browser.spec.ts +843 -0
  419. package/src/motion/__tests__/motionBundle.ts +14 -0
  420. package/src/motion/animator.test.ts +978 -33
  421. package/src/motion/animator.ts +790 -104
  422. package/src/motion/coast.ts +10 -3
  423. package/src/motion/reducedMotion.ts +12 -2
  424. package/src/motion/reducedMotionPlan.test.ts +26 -0
  425. package/src/motion/reducedMotionPlan.ts +20 -1
  426. package/src/motion/resolveMotion.test.ts +123 -0
  427. package/src/motion/resolveMotion.ts +68 -0
  428. package/src/motion/roleValue.ts +2 -1
  429. package/src/motion/roles.test.ts +21 -4
  430. package/src/motion/uikit/tableImports.test.ts +293 -0
  431. package/src/motion/uikit/timing.ts +15 -1
  432. package/src/motion/uikit/values.test.ts +23 -12
  433. package/src/theme/Theme.doc.mjs +1 -1
  434. package/src/theme/defineTheme.ts +116 -7
  435. package/src/theme/expandMotionScale.test.ts +1 -1
  436. package/src/theme/index.ts +5 -0
  437. package/src/theme/motionKnobs.ts +82 -0
  438. package/src/theme/resolveThemeValues.ts +68 -6
  439. package/src/theme/themeAdaptations.ts +52 -12
  440. package/src/theme/themeMotion.test.ts +620 -0
  441. package/src/theme/themeMotion.ts +221 -0
  442. package/src/theme/tokenReferences.ts +149 -0
  443. package/src/theme/tokens.stylex.ts +10 -0
  444. package/src/theme/tokens.ts +15 -158
  445. package/src/utils/focusOutline.stylex.ts +28 -0
  446. package/src/utils/interactionOverlay.stylex.ts +12 -3
  447. package/src/utils/pressFeedback.test.ts +138 -0
  448. package/src/utils/pressFeedback.ts +34 -11
  449. package/src/utils/pressGesture.test.ts +9 -0
  450. package/src/utils/sharedMutationObserver.test.ts +54 -1
  451. package/src/utils/sharedMutationObserver.ts +87 -29
  452. package/src/utils/touchPresentation.ts +8 -5
  453. package/src/utils/touchQueries.ts +15 -0
  454. package/src/utils/useFocusAcrossSwap.ts +55 -0
@@ -0,0 +1,21 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file TokenizerClearAllMessageContext.ts
7
+ * @input None
8
+ * @output A context carrying the words a composing component announces for
9
+ * the field's Clear all
10
+ * @position Internal to Core: not exported from the Tokenizer barrel. A
11
+ * component that composes Tokenizer and words its own Clear all (PowerSearch:
12
+ * "All filters removed") provides it; Tokenizer otherwise announces its own
13
+ * words (component:Tokenizer AR7).
14
+ */
15
+
16
+ import {createContext} from 'react';
17
+
18
+ export const TokenizerClearAllMessageContext = createContext<string | null>(
19
+ null,
20
+ );
21
+ TokenizerClearAllMessageContext.displayName = 'TokenizerClearAllMessageContext';
@@ -861,6 +861,26 @@ describe('TreeList', () => {
861
861
  });
862
862
  });
863
863
 
864
+ it("keeps focus on an item's inner link when the item becomes disabled (spec:AST-085 FR4)", () => {
865
+ const tree = (isDisabled: boolean) => [
866
+ {
867
+ id: 'docs',
868
+ label: 'Docs',
869
+ isExpanded: true,
870
+ children: [
871
+ {id: 'report', label: 'Report', href: '/report', isDisabled},
872
+ ],
873
+ },
874
+ ];
875
+ const {rerender} = render(<TreeList items={tree(false)} />);
876
+ // A pointer click leaves focus on the inner link.
877
+ screen.getByRole('link', {name: 'Report', hidden: true}).focus();
878
+ rerender(<TreeList items={tree(true)} />);
879
+ const disabled = screen.getByRole('link', {name: 'Report', hidden: true});
880
+ expect(disabled).not.toHaveAttribute('href');
881
+ expect(disabled).toHaveFocus();
882
+ });
883
+
864
884
  it('does not follow a disabled link row', () => {
865
885
  const items = [
866
886
  {
@@ -879,6 +899,12 @@ describe('TreeList', () => {
879
899
  const row = link.closest<HTMLElement>('.astryx-tree-list-item')!;
880
900
  fireEvent.click(row.firstElementChild!);
881
901
  expect(onLinkClick).not.toHaveBeenCalled();
902
+ // No destination, so a screen reader's click or a link menu cannot
903
+ // navigate either (spec:AST-085 FR2).
904
+ expect(link).toHaveAttribute('aria-disabled', 'true');
905
+ for (const attribute of ['href', 'target']) {
906
+ expect(link).not.toHaveAttribute(attribute);
907
+ }
882
908
  });
883
909
 
884
910
  describe('row clicks outside the label (FR7)', () => {
@@ -32,7 +32,8 @@ import {
32
32
  useClickableContainer,
33
33
  } from '../hooks/useClickableContainer';
34
34
  import {Icon} from '../Icon';
35
- import {mergeProps} from '../utils';
35
+ import {mergeProps} from '../utils/mergeProps';
36
+ import {useFocusAcrossSwap} from '../utils/useFocusAcrossSwap';
36
37
  import {useLinkComponent} from '../Link/useLinkComponent';
37
38
  import {TreeListBranches} from './TreeListBranches';
38
39
  import type {TreeListDensity, TreeListVariant} from './TreeListTypes';
@@ -379,6 +380,9 @@ export interface TreeListItemInternalProps {
379
380
  // Component
380
381
  // =============================================================================
381
382
 
383
+ /** A plain anchor, for a disabled item whose link has no destination. */
384
+ const DisabledAnchor = 'a';
385
+
382
386
  export function TreeListItem({
383
387
  id,
384
388
  label,
@@ -414,6 +418,10 @@ export function TreeListItem({
414
418
  const descriptionId = useId();
415
419
  const LinkComponent = useLinkComponent();
416
420
  const linkRef = useRef<HTMLAnchorElement>(null);
421
+ // Disabling the item swaps the router link for a plain anchor, so React
422
+ // replaces it; focus on the inner link (after a pointer click) follows the
423
+ // swap instead of falling to the page (spec:AST-085 FR4).
424
+ const anchorRef = useFocusAcrossSwap<HTMLAnchorElement>(linkRef);
417
425
  const isInteractive = onClick != null || href != null;
418
426
 
419
427
  const handleToggle = useMemo(
@@ -596,12 +604,26 @@ export function TreeListItem({
596
604
  {startContent != null && (
597
605
  <span {...stylex.props(styles.startContent)}>{startContent}</span>
598
606
  )}
599
- {href != null ? (
607
+ {href != null && isDisabled ? (
608
+ // A disabled item's anchor has no destination, so neither the row's
609
+ // forwarded activation nor a screen reader's click can navigate
610
+ // (spec:AST-085 FR2). Like a disabled Link, it keeps the link role and
611
+ // skips the router link component.
612
+ <DisabledAnchor
613
+ ref={anchorRef}
614
+ role="link"
615
+ aria-disabled={true}
616
+ aria-labelledby={labelId}
617
+ aria-describedby={description != null ? descriptionId : undefined}
618
+ tabIndex={-1}
619
+ {...stylex.props(styles.invisibleAnchor)}>
620
+ {labelAndDescription}
621
+ </DisabledAnchor>
622
+ ) : href != null ? (
600
623
  <LinkComponent
601
- ref={linkRef}
624
+ ref={anchorRef}
602
625
  href={href}
603
626
  target={target}
604
- aria-disabled={isDisabled || undefined}
605
627
  aria-labelledby={labelId}
606
628
  aria-describedby={description != null ? descriptionId : undefined}
607
629
  // Roving tabindex lives on the treeitem row; inner action is not a
@@ -175,7 +175,7 @@ export const docs = {
175
175
  name: 'isFocusableDisabled',
176
176
  type: 'boolean',
177
177
  description:
178
- 'Keep a disabled input focusable with aria-disabled and readOnly so a caller-owned disabled reason remains discoverable. It blocks text entry, but when applied after results are already open, Enter can still select the highlighted option.',
178
+ 'Keep a disabled input focusable with aria-disabled and readOnly so a caller-owned disabled reason remains discoverable. It blocks text entry, opening the results and picking a result, also from results that were open before it applied; Escape or Tab still closes them.',
179
179
  default: 'false',
180
180
  },
181
181
  {
@@ -334,7 +334,7 @@ export const docsZh = {
334
334
  name: 'isFocusableDisabled',
335
335
  type: 'boolean',
336
336
  description:
337
- '使用 aria-disabled 和只读状态保持禁用输入框可聚焦,以便访问调用方提供的禁用原因。它会阻止文本输入,但如果结果已打开,按 Enter 仍可选择高亮选项。',
337
+ '使用 aria-disabled 和只读状态保持禁用输入框可聚焦,以便访问调用方提供的禁用原因。它会阻止文本输入、打开结果列表和选择结果,在它生效前已打开的结果中也是如此;Escape 或 Tab 仍可关闭列表。',
338
338
  default: 'false',
339
339
  },
340
340
  {
@@ -467,7 +467,7 @@ export const docsDense = {
467
467
  emptySearchText: 'Content when the query matched nothing. ReactNode.',
468
468
  isDisabled: 'Whether input disabled.',
469
469
  isFocusableDisabled:
470
- 'Keeps disabled input focusable and blocks text entry; an already-open highlight can still be selected with Enter.',
470
+ 'Keeps disabled input focusable; blocks text entry, opening and picking, also from an already-open list (Escape/Tab close it).',
471
471
  hasAutoFocus: 'Auto-focus on mount.',
472
472
  debounceMs: 'Search debounce ms. 0 for sync.',
473
473
  size: 'Dropdown option padding size.',
@@ -77,34 +77,34 @@ Consumer migration instructions belong in consumer docs and release notes.
77
77
 
78
78
  ## Public concepts
79
79
 
80
- | Concept | Closed values or states | Meaning | Availability by state | Default | Owner | Stability | Invalid-value behavior |
81
- | --------------- | ---------------------------------------- | ------------------------------------------------------------ | -------------------------- | -------------------------------- | ---------------------------- | --------- | ---------------------------------------------------------------------------------------- |
82
- | selection | `T` or `null` | Caller-controlled selected result | all states | required | `component:BaseTypeahead` | released | caller retains control |
83
- | search source | `search`, `bootstrap`, optional `cancel` | Supplies query and focus results | enabled input | required | `component:BaseTypeahead` | released | rejected work clears current results |
84
- | focus bootstrap | on or off | Offers bootstrap results before query input | empty focused input | off | `component:BaseTypeahead` | released | off keeps the menu closed |
85
- | query threshold | non-negative number | Minimum visible-character count before search | non-empty query | `1` | `component:BaseTypeahead` | released | below threshold cancels work and closes results |
86
- | debounce | milliseconds | Delays query search | typed query | `150` | `component:BaseTypeahead` | released | non-positive runs immediately |
87
- | result cap | number | Limits fetched results shown | completed search/bootstrap | `10` | `component:BaseTypeahead` | released | source order is preserved |
88
- | result content | default, `renderItem`, or `item.element` | Chooses content inside the stable option row | result present | default TypeaheadItem | caller and component | released | `item.element` takes precedence |
89
- | disabled state | native or focusable-disabled | Blocks query mutation; native disabled blocks all activation | disabled | native disabled | component and caller wrapper | released | an already-open focusable-disabled list can still select with Enter (retained violation) |
90
- | popup width | intrinsic or fixed pixels | Sets result popup width before viewport clamping | popup present | intrinsic, at least anchor width | `component:BaseTypeahead` | released | viewport fit wins |
91
- | size | `sm`, `md`, `lg` | Selects option-row padding | popup options | `md` | `component:BaseTypeahead` | released | TypeScript rejects other values |
80
+ | Concept | Closed values or states | Meaning | Availability by state | Default | Owner | Stability | Invalid-value behavior |
81
+ | --------------- | ---------------------------------------- | ------------------------------------------------------------ | -------------------------- | -------------------------------- | ---------------------------- | --------- | ------------------------------------------------------------------------------- |
82
+ | selection | `T` or `null` | Caller-controlled selected result | all states | required | `component:BaseTypeahead` | released | caller retains control |
83
+ | search source | `search`, `bootstrap`, optional `cancel` | Supplies query and focus results | enabled input | required | `component:BaseTypeahead` | released | rejected work clears current results |
84
+ | focus bootstrap | on or off | Offers bootstrap results before query input | empty focused input | off | `component:BaseTypeahead` | released | off keeps the menu closed |
85
+ | query threshold | non-negative number | Minimum visible-character count before search | non-empty query | `1` | `component:BaseTypeahead` | released | below threshold cancels work and closes results |
86
+ | debounce | milliseconds | Delays query search | typed query | `150` | `component:BaseTypeahead` | released | non-positive runs immediately |
87
+ | result cap | number | Limits fetched results shown | completed search/bootstrap | `10` | `component:BaseTypeahead` | released | source order is preserved |
88
+ | result content | default, `renderItem`, or `item.element` | Chooses content inside the stable option row | result present | default TypeaheadItem | caller and component | released | `item.element` takes precedence |
89
+ | disabled state | native or focusable-disabled | Blocks query mutation; native disabled blocks all activation | disabled | native disabled | component and caller wrapper | released | a list open before focusable-disabled applied picks nothing and can still close |
90
+ | popup width | intrinsic or fixed pixels | Sets result popup width before viewport clamping | popup present | intrinsic, at least anchor width | `component:BaseTypeahead` | released | viewport fit wins |
91
+ | size | `sm`, `md`, `lg` | Selects option-row padding | popup options | `md` | `component:BaseTypeahead` | released | TypeScript rejects other values |
92
92
 
93
93
  ## Behavioral and layout contract
94
94
 
95
95
  Draft requirements identify their observational or current-authority basis.
96
96
 
97
- | ID | Candidate invariant | Basis | Draft review state |
98
- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------- |
99
- | FR1 | The input is controlled by internal query state while `value` is caller-controlled; selecting a result calls `onChange(item)`, clears query/results, closes the popup, and returns focus to the input. | Current source and tests | verified shipped behavior |
100
- | FR2 | Search starts only at the grapheme-count threshold, uses the configured debounce, and never presents an empty result for a query that was not searched. | Public API, current i18n character utility, tests | verified audit remediation |
101
- | FR3 | A newer query, selection, clear, source replacement, or unmount invalidates stale asynchronous work. Escape hides the current popup but does not invalidate pending work, so a late response currently reopens it (retained violation). | Current source, focused retained-red probe, and tests | verified shipped behavior |
102
- | FR4 | The popup is a named listbox whose result rows are options. A completed empty search renders one disabled option so the listbox retains a valid owned child. | APG combobox pattern, axe, tests | verified audit remediation |
103
- | FR5 | Arrow keys wrap the highlight; Home/End move to the first/last option; Enter selects; Escape and Tab hide the current popup; IME-owned key events do not activate combobox commands. Escape dismissal is not durable while source work remains pending (FR3). | Current source and tests | verified shipped behavior; Escape gap retained |
104
- | FR6 | Pending asynchronous source work sets `aria-busy` and renders one named Spinner unless the composed wrapper owns the busy indicator lane. | Current source, input-family FR7, tests | verified shipped behavior |
105
- | FR7 | Supported BaseProps DOM, ARIA, data, class, style, event, and `xstyle` inputs reach the combobox input while component-owned role, state, value, and behavior remain authoritative. | `architecture:public-component-api/INV5–INV7`, tests | verified audit remediation |
106
- | FR8 | The popup remains within the inline viewport at 320 CSS px, including long default results and a requested width larger than the available viewport. | WCAG 1.4.10, real Chromium | verified audit remediation |
107
- | FR9 | Native disabled removes ordinary focus and activation. Focusable-disabled uses `aria-disabled` plus `readOnly` and blocks text/query mutation, but applying it after the popup opens does not currently block Enter selection (retained violation). | Current source, tests, and focused retained-red probe | verified shipped behavior |
97
+ | ID | Candidate invariant | Basis | Draft review state |
98
+ | --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------- |
99
+ | FR1 | The input is controlled by internal query state while `value` is caller-controlled; selecting a result calls `onChange(item)`, clears query/results, closes the popup, and returns focus to the input. | Current source and tests | verified shipped behavior |
100
+ | FR2 | Search starts only at the grapheme-count threshold, uses the configured debounce, and never presents an empty result for a query that was not searched. | Public API, current i18n character utility, tests | verified audit remediation |
101
+ | FR3 | A newer query, selection, clear, source replacement, or unmount invalidates stale asynchronous work. Escape hides the current popup but does not invalidate pending work, so a late response currently reopens it (retained violation). | Current source, focused retained-red probe, and tests | verified shipped behavior |
102
+ | FR4 | The popup is a named listbox whose result rows are options. A completed empty search renders one disabled option so the listbox retains a valid owned child. | APG combobox pattern, axe, tests | verified audit remediation |
103
+ | FR5 | Arrow keys wrap the highlight; Home/End move to the first/last option; Enter selects; Escape and Tab hide the current popup; IME-owned key events do not activate combobox commands. Escape dismissal is not durable while source work remains pending (FR3). | Current source and tests | verified shipped behavior; Escape gap retained |
104
+ | FR6 | Pending asynchronous source work sets `aria-busy` and renders one named Spinner unless the composed wrapper owns the busy indicator lane. | Current source, input-family FR7, tests | verified shipped behavior |
105
+ | FR7 | Supported BaseProps DOM, ARIA, data, class, style, event, and `xstyle` inputs reach the combobox input while component-owned role, state, value, and behavior remain authoritative. | `architecture:public-component-api/INV5–INV7`, tests | verified audit remediation |
106
+ | FR8 | The popup remains within the inline viewport at 320 CSS px, including long default results and a requested width larger than the available viewport. | WCAG 1.4.10, real Chromium | verified audit remediation |
107
+ | FR9 | Native disabled removes ordinary focus and activation. Focusable-disabled uses `aria-disabled` plus `readOnly` and blocks text/query mutation, opening the list, and selection by Enter or a press, including from a list that was open before it applied; that list can still close (`spec:AST-085` FR2). | Current source and tests | verified shipped behavior |
108
108
 
109
109
  ### Allowed variation
110
110
 
@@ -116,17 +116,17 @@ Draft requirements identify their observational or current-authority basis.
116
116
 
117
117
  ### Representative states
118
118
 
119
- | State | Required invariant | Allowed variation |
120
- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
121
- | rest | named combobox is closed and not busy | caller-owned wrapper and label |
122
- | focused bootstrap | popup opens only when enabled and results exist | synchronous or asynchronous source |
123
- | query pending | combobox is busy and duplicate stale work is rejected | direct or wrapper-owned Spinner |
124
- | results | one highlighted option and valid active descendant | grouped/default/custom content |
125
- | completed empty | one disabled empty option; no active descendant | caller-supplied empty text |
126
- | selected result | matching option exposes `aria-selected=true` | generic check presentation |
127
- | disabled | native disabled blocks activation; focusable-disabled blocks query mutation but can still select an already-open highlight with Enter | native or focusable-disabled semantics |
128
- | dismissed pending | Escape hides the popup; a late pending response currently reopens it | source completion timing |
129
- | narrow viewport | popup and result content remain inside two viewport gutters | intrinsic or requested width |
119
+ | State | Required invariant | Allowed variation |
120
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
121
+ | rest | named combobox is closed and not busy | caller-owned wrapper and label |
122
+ | focused bootstrap | popup opens only when enabled and results exist | synchronous or asynchronous source |
123
+ | query pending | combobox is busy and duplicate stale work is rejected | direct or wrapper-owned Spinner |
124
+ | results | one highlighted option and valid active descendant | grouped/default/custom content |
125
+ | completed empty | one disabled empty option; no active descendant | caller-supplied empty text |
126
+ | selected result | matching option exposes `aria-selected=true` | generic check presentation |
127
+ | disabled | native disabled blocks activation; focusable-disabled blocks query mutation, opening and picking, also from an already-open list | native or focusable-disabled semantics |
128
+ | dismissed pending | Escape hides the popup; a late pending response currently reopens it | source completion timing |
129
+ | narrow viewport | popup and result content remain inside two viewport gutters | intrinsic or requested width |
130
130
 
131
131
  ### Transformation and precedence order
132
132
 
@@ -237,17 +237,17 @@ Draft requirements identify their observational or current-authority basis.
237
237
 
238
238
  ## Verification map
239
239
 
240
- | Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
241
- | --------------- | ------------------------------------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------- |
242
- | FR1–FR2 | BaseTypeahead and Typeahead tests | query, overlap, select, clear | current work replaces newer results or selection does not close | `audit:BaseTypeahead/behavior` |
243
- | FR3 | shared stale-response tests plus retained-red probe | newer query, clear, unmount, Escape while pending | late work replaces current results or reopens after explicit dismissal | `audit:BaseTypeahead/a11y` |
244
- | FR4, AR1–AR4 | focused tests, component-scoped axe, live-region tests | results, empty, busy, selected | invalid listbox ownership or state/announcement disappears | `audit:BaseTypeahead/a11y` |
245
- | FR5, AR5 | keyboard, focus-out, IME, and retained-red tests | arrows, Home/End, Enter, Escape, Tab, composition | command selects or dismisses at the wrong time | `audit:BaseTypeahead/a11y` |
246
- | FR6 | busy-lane tests | direct and composed pending source | duplicate/missing Spinner or stale busy state | `audit:BaseTypeahead/a11y` |
247
- | FR7 | focused passthrough tests and strict lint | native-only, alias collisions, DOM/style/events | supported consumer input is dropped or owned semantics are replaced | `audit:BaseTypeahead/api` |
248
- | FR8 | real-Chromium 320px sensor receipt | long result, wide request, LTR/RTL | popup or its content crosses either viewport gutter | `audit:BaseTypeahead/responsive` |
249
- | FR9 | shared disabled tests plus retained-red probe | native disabled, focusable-disabled after open | disabled mode mutates query or accepts an already-open selection | `audit:BaseTypeahead/a11y` |
250
- | Theming anatomy | knowledge and theming-target checks | all mapped parts | target inventory or disposition drifts | `audit:BaseTypeahead/theming` |
240
+ | Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
241
+ | --------------- | ------------------------------------------------------ | --------------------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------- |
242
+ | FR1–FR2 | BaseTypeahead and Typeahead tests | query, overlap, select, clear | current work replaces newer results or selection does not close | `audit:BaseTypeahead/behavior` |
243
+ | FR3 | shared stale-response tests plus retained-red probe | newer query, clear, unmount, Escape while pending | late work replaces current results or reopens after explicit dismissal | `audit:BaseTypeahead/a11y` |
244
+ | FR4, AR1–AR4 | focused tests, component-scoped axe, live-region tests | results, empty, busy, selected | invalid listbox ownership or state/announcement disappears | `audit:BaseTypeahead/a11y` |
245
+ | FR5, AR5 | keyboard, focus-out, IME, and retained-red tests | arrows, Home/End, Enter, Escape, Tab, composition | command selects or dismisses at the wrong time | `audit:BaseTypeahead/a11y` |
246
+ | FR6 | busy-lane tests | direct and composed pending source | duplicate/missing Spinner or stale busy state | `audit:BaseTypeahead/a11y` |
247
+ | FR7 | focused passthrough tests and strict lint | native-only, alias collisions, DOM/style/events | supported consumer input is dropped or owned semantics are replaced | `audit:BaseTypeahead/api` |
248
+ | FR8 | real-Chromium 320px sensor receipt | long result, wide request, LTR/RTL | popup or its content crosses either viewport gutter | `audit:BaseTypeahead/responsive` |
249
+ | FR9 | shared disabled tests | native disabled; focusable-disabled before and after open | disabled mode mutates query, opens the list, or accepts a selection | `audit:BaseTypeahead/a11y` |
250
+ | Theming anatomy | knowledge and theming-target checks | all mapped parts | target inventory or disposition drifts | `audit:BaseTypeahead/theming` |
251
251
 
252
252
  ## Decision log
253
253
 
@@ -153,10 +153,10 @@ export interface BaseTypeaheadProps<T extends SearchableItem> extends Omit<
153
153
  * When disabled with a reason, keeps the input focusable via `aria-disabled`
154
154
  * (instead of the native `disabled` attribute) and `readOnly` so an
155
155
  * associated disabled-reason tooltip stays discoverable by keyboard and
156
- * assistive technology. Query and text mutation are blocked, but an
157
- * already-open highlighted option can still be selected with Enter after a
158
- * transition into this state. Consumers (Typeahead) own the tooltip and
159
- * wrapper.
156
+ * assistive technology. Query and text mutation, opening the list, and a
157
+ * pick by Enter or a press are blocked, also from a list that was open
158
+ * before this state applied; Escape or Tab still closes it. Consumers
159
+ * (Typeahead) own the tooltip and wrapper.
160
160
  * @default false
161
161
  */
162
162
  isFocusableDisabled?: boolean;
@@ -687,11 +687,25 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
687
687
  // Show the layer, deferring past the active click if a pointer is down.
688
688
  // Without this, popover="auto" light-dismiss immediately closes the
689
689
  // dropdown when it opens between pointerdown and pointerup/click.
690
+ // Read at show time, so a search or bootstrap that settles after the field
691
+ // became disabled does not open the list (spec:AST-085 FR2).
692
+ const isDisabledRef = useRef(isDisabled);
693
+ useIsomorphicLayoutEffect(() => {
694
+ isDisabledRef.current = isDisabled;
695
+ }, [isDisabled]);
690
696
  const showLayer = useCallback(() => {
697
+ if (isDisabledRef.current) {
698
+ return;
699
+ }
691
700
  if (pointerActiveRef.current) {
692
701
  document.addEventListener(
693
702
  'click',
694
- () => requestAnimationFrame(() => popover.show()),
703
+ () =>
704
+ requestAnimationFrame(() => {
705
+ if (!isDisabledRef.current) {
706
+ popover.show();
707
+ }
708
+ }),
695
709
  {once: true},
696
710
  );
697
711
  } else {
@@ -915,6 +929,11 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
915
929
  // Handle item selection
916
930
  const handleSelect = useCallback(
917
931
  (item: T) => {
932
+ // A disabled field changes nothing, also from a list that was open
933
+ // before it became disabled (spec:AST-085 FR2).
934
+ if (isDisabled) {
935
+ return;
936
+ }
918
937
  // Bump generation to invalidate any in-flight async searches
919
938
  searchGenRef.current++;
920
939
  if (searchTimeoutRef.current) {
@@ -933,7 +952,7 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
933
952
  popover.hide();
934
953
  inputRef.current?.focus();
935
954
  },
936
- [onChange, popover, searchSource, setLoading],
955
+ [isDisabled, onChange, popover, searchSource, setLoading],
937
956
  );
938
957
 
939
958
  // Shared by handleFocus and handleClick: bootstrap entries if none are
@@ -984,7 +1003,7 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
984
1003
  // dropdown never reopens until the user clicks away and back (#6845). See
985
1004
  // wasAlreadyFocusedRef above for how the two cases are told apart.
986
1005
  const handleClick = useCallback(() => {
987
- if (!wasAlreadyFocusedRef.current || popover.isOpen) {
1006
+ if (isDisabled || !wasAlreadyFocusedRef.current || popover.isOpen) {
988
1007
  return;
989
1008
  }
990
1009
  if (
@@ -997,6 +1016,7 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
997
1016
  }
998
1017
  openIfEligible();
999
1018
  }, [
1019
+ isDisabled,
1000
1020
  popover.isOpen,
1001
1021
  hasEntriesOnFocus,
1002
1022
  query.length,
@@ -1050,6 +1070,24 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
1050
1070
  return;
1051
1071
  }
1052
1072
 
1073
+ // A focusable-disabled field opens no list and picks nothing; it only
1074
+ // lets a list that was open before it became disabled close
1075
+ // (spec:AST-085 FR2).
1076
+ if (isDisabled) {
1077
+ // Enter on a list that is still open picks nothing, and must not
1078
+ // submit an enclosing form either, as it would not while enabled.
1079
+ if (popover.isOpen && e.key === 'Enter') {
1080
+ e.preventDefault();
1081
+ }
1082
+ if (popover.isOpen && (e.key === 'Escape' || e.key === 'Tab')) {
1083
+ if (e.key === 'Escape') {
1084
+ e.preventDefault();
1085
+ }
1086
+ popover.hide();
1087
+ }
1088
+ return;
1089
+ }
1090
+
1053
1091
  if (!popover.isOpen) {
1054
1092
  if (e.key === 'ArrowDown' && (hasEntriesOnFocus || query.length > 0)) {
1055
1093
  e.preventDefault();
@@ -1123,6 +1161,7 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
1123
1161
  }
1124
1162
  },
1125
1163
  [
1164
+ isDisabled,
1126
1165
  popover,
1127
1166
  results,
1128
1167
  highlightedIndex,
@@ -1218,8 +1257,8 @@ export const BaseTypeahead = function BaseTypeahead<T extends SearchableItem>({
1218
1257
  placeholder={placeholder}
1219
1258
  // When a disabled-reason tooltip is shown the input keeps focusability
1220
1259
  // via aria-disabled + readOnly instead of the native disabled
1221
- // attribute. Query and text mutation are blocked, but an already-open
1222
- // highlighted option can still be selected with Enter after transition.
1260
+ // attribute. Query and text mutation, opening and picking are blocked
1261
+ // by the handlers above (spec:AST-085 FR2).
1223
1262
  disabled={isDisabled && !isFocusableDisabled}
1224
1263
  readOnly={isFocusableDisabled || undefined}
1225
1264
  autoFocus={hasAutoFocus}
@@ -2228,6 +2228,126 @@ describe('Typeahead disabledMessage', () => {
2228
2228
  expect(onChange).not.toHaveBeenCalled();
2229
2229
  });
2230
2230
 
2231
+ it('opens no list and picks nothing while focusable-disabled (spec:AST-085 FR2)', async () => {
2232
+ const user = userEvent.setup();
2233
+ const onChange = vi.fn();
2234
+ render(
2235
+ <Typeahead
2236
+ label="Assignee"
2237
+ searchSource={fruitSource}
2238
+ value={null}
2239
+ onChange={onChange}
2240
+ hasEntriesOnFocus
2241
+ isDisabled
2242
+ disabledMessage="You need the Editor role"
2243
+ />,
2244
+ );
2245
+ const input = screen.getByRole('combobox');
2246
+ await user.click(input);
2247
+ await user.click(input);
2248
+ await user.keyboard('{ArrowDown}{Enter}');
2249
+ expect(input).toHaveAttribute('aria-expanded', 'false');
2250
+ expect(screen.queryByRole('option', {hidden: true})).toBeNull();
2251
+ expect(onChange).not.toHaveBeenCalled();
2252
+ });
2253
+
2254
+ it('does not reopen on a click into the still-focused input once disabled', async () => {
2255
+ const user = userEvent.setup();
2256
+ const field = (isDisabled: boolean) => (
2257
+ <Typeahead
2258
+ label="Assignee"
2259
+ searchSource={fruitSource}
2260
+ value={null}
2261
+ onChange={() => {}}
2262
+ hasEntriesOnFocus
2263
+ isDisabled={isDisabled}
2264
+ disabledMessage={isDisabled ? 'You need the Editor role' : undefined}
2265
+ />
2266
+ );
2267
+ const {rerender} = render(field(false));
2268
+ const input = screen.getByRole('combobox');
2269
+ await user.click(input);
2270
+ await waitFor(() => expect(input).toHaveAttribute('aria-expanded', 'true'));
2271
+ // A pick closes the list and leaves focus in the input.
2272
+ await user.click(screen.getAllByRole('option', {hidden: true})[0]);
2273
+ await waitFor(() =>
2274
+ expect(input).toHaveAttribute('aria-expanded', 'false'),
2275
+ );
2276
+ rerender(field(true));
2277
+ const disabled = screen.getByRole('combobox');
2278
+ await user.click(disabled);
2279
+ await user.click(disabled);
2280
+ expect(disabled).toHaveAttribute('aria-expanded', 'false');
2281
+ });
2282
+
2283
+ it('picks nothing from a list opened before the field became disabled, and lets it close', async () => {
2284
+ const user = userEvent.setup();
2285
+ const onChange = vi.fn();
2286
+ const onSubmit = vi.fn((event: React.FormEvent) => event.preventDefault());
2287
+ const field = (isDisabled: boolean) => (
2288
+ <form onSubmit={onSubmit}>
2289
+ <Typeahead
2290
+ label="Assignee"
2291
+ searchSource={fruitSource}
2292
+ value={null}
2293
+ onChange={onChange}
2294
+ hasEntriesOnFocus
2295
+ isDisabled={isDisabled}
2296
+ disabledMessage="You need the Editor role"
2297
+ />
2298
+ </form>
2299
+ );
2300
+ const {rerender} = render(field(false));
2301
+ const input = screen.getByRole('combobox');
2302
+ await user.click(input);
2303
+ await waitFor(() => expect(input).toHaveAttribute('aria-expanded', 'true'));
2304
+ await user.keyboard('{ArrowDown}');
2305
+
2306
+ rerender(field(true));
2307
+ // The open list stays in the DOM (hidden from the accessibility tree).
2308
+ await user.keyboard('{Enter}');
2309
+ fireEvent.click(screen.getAllByRole('option', {hidden: true})[0]);
2310
+ expect(onChange).not.toHaveBeenCalled();
2311
+ // Enter on the still-open list does not submit the form.
2312
+ expect(onSubmit).not.toHaveBeenCalled();
2313
+ await user.keyboard('{Escape}');
2314
+ expect(input).toHaveAttribute('aria-expanded', 'false');
2315
+ });
2316
+
2317
+ it('does not open a list for a search that settles after the field became disabled', async () => {
2318
+ let resolveSearch: (items: SearchableItem[]) => void = () => {};
2319
+ const pendingSource: SearchSource = {
2320
+ search: async () =>
2321
+ new Promise(resolve => {
2322
+ resolveSearch = resolve;
2323
+ }),
2324
+ bootstrap: () => [],
2325
+ };
2326
+ const user = userEvent.setup();
2327
+ const field = (isDisabled: boolean) => (
2328
+ <Typeahead
2329
+ label="Assignee"
2330
+ searchSource={pendingSource}
2331
+ value={null}
2332
+ onChange={() => {}}
2333
+ debounceMs={0}
2334
+ isDisabled={isDisabled}
2335
+ disabledMessage={isDisabled ? 'You need the Editor role' : undefined}
2336
+ />
2337
+ );
2338
+ const {rerender} = render(field(false));
2339
+ const input = screen.getByRole('combobox');
2340
+ await user.type(input, 'ap');
2341
+ rerender(field(true));
2342
+ await act(async () => {
2343
+ resolveSearch(fruits);
2344
+ });
2345
+ expect(screen.getByRole('combobox')).toHaveAttribute(
2346
+ 'aria-expanded',
2347
+ 'false',
2348
+ );
2349
+ });
2350
+
2231
2351
  it('remains natively disabled when disabled without a reason', () => {
2232
2352
  render(
2233
2353
  <Typeahead
@@ -0,0 +1,88 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file internalModulesNotExperimental.test.ts
5
+ * @input vitest, the source of core's internal motion, gesture and keyboard
6
+ * modules, and of the package-private utility module (touchPresentation)
7
+ * @output Fails when one of them declares `@experimental`: those modules are
8
+ * internal and never exported (spec:AST-017 FR21, DEC-27), and the tag
9
+ * belongs only to a deliberately experimental public API
10
+ * @position Testing; a repository guard over src/motion, src/gestures,
11
+ * src/keyboard and src/utils/touchPresentation.ts. The rest of src/utils
12
+ * backs the public `@astryxdesign/core/utils` entry, where an experimental
13
+ * API may carry the tag
14
+ */
15
+
16
+ import fs from 'node:fs';
17
+ import path from 'node:path';
18
+ import {describe, expect, it} from 'vitest';
19
+
20
+ const SRC = path.resolve(__dirname, '..');
21
+ const INTERNAL_DIRS = ['motion', 'gestures', 'keyboard'];
22
+ /** Package-private files in a directory that also backs a public entry. */
23
+ const INTERNAL_FILES = ['utils/touchPresentation.ts'];
24
+
25
+ /** Every source file under `dir`, tests and declarations left out. */
26
+ function sourcesUnder(dir: string): string[] {
27
+ const files: string[] = [];
28
+ for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
29
+ const full = path.join(dir, entry.name);
30
+ if (entry.isDirectory()) {
31
+ if (entry.name !== '__tests__') {
32
+ files.push(...sourcesUnder(full));
33
+ }
34
+ } else if (
35
+ /\.(ts|tsx|mjs|js)$/.test(entry.name) &&
36
+ !/\.(test|spec)\.[cm]?[jt]sx?$/.test(entry.name) &&
37
+ !entry.name.endsWith('.d.ts')
38
+ ) {
39
+ files.push(full);
40
+ }
41
+ }
42
+ return files;
43
+ }
44
+
45
+ /** The internal files the guard reads, relative to src. */
46
+ function checkedFiles(): string[] {
47
+ const files: string[] = [];
48
+ for (const dir of INTERNAL_DIRS) {
49
+ const root = path.join(SRC, dir);
50
+ if (fs.existsSync(root)) {
51
+ files.push(...sourcesUnder(root));
52
+ }
53
+ }
54
+ files.push(...INTERNAL_FILES.map(file => path.join(SRC, file)));
55
+ return files.map(file => path.relative(SRC, file));
56
+ }
57
+
58
+ describe('internal modules', () => {
59
+ it('declare no @experimental: only an experimental public API carries it', () => {
60
+ const offenders: string[] = [];
61
+ for (const file of checkedFiles()) {
62
+ fs.readFileSync(path.join(SRC, file), 'utf8')
63
+ .split('\n')
64
+ .forEach((line, index) => {
65
+ if (/@experimental\b/.test(line)) {
66
+ offenders.push(`${file}:${index + 1}`);
67
+ }
68
+ });
69
+ }
70
+ expect(offenders).toEqual([]);
71
+ });
72
+
73
+ it('checks the directories and files it names', () => {
74
+ expect(fs.existsSync(path.join(SRC, 'motion'))).toBe(true);
75
+ expect(fs.existsSync(path.join(SRC, 'gestures'))).toBe(true);
76
+ expect(sourcesUnder(path.join(SRC, 'motion')).length).toBeGreaterThan(5);
77
+ for (const file of INTERNAL_FILES) {
78
+ expect(fs.existsSync(path.join(SRC, file)), file).toBe(true);
79
+ }
80
+ });
81
+
82
+ it('leaves the public utils entry alone: of src/utils, only its package-private files are checked', () => {
83
+ const utils = checkedFiles().filter(file =>
84
+ file.startsWith('utils' + path.sep),
85
+ );
86
+ expect(utils).toEqual([path.join('utils', 'touchPresentation.ts')]);
87
+ });
88
+ });