@astryxdesign/core 0.7.11 → 0.7.12-canary.ccb4a6d

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 (533) hide show
  1. package/dist/AppShell/AppShellMobileContext.d.ts.map +1 -1
  2. package/dist/AppShell/AppShellMobileContext.js +4 -3
  3. package/dist/AppShell/useAppShellMainId.d.ts.map +1 -1
  4. package/dist/AppShell/useAppShellMainId.js +3 -2
  5. package/dist/Avatar/AvatarSizeContext.d.ts.map +1 -1
  6. package/dist/Avatar/AvatarSizeContext.js +2 -2
  7. package/dist/Avatar/AvatarStatusLabelContext.d.ts +2 -2
  8. package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -1
  9. package/dist/Avatar/AvatarStatusLabelContext.js +3 -3
  10. package/dist/AvatarGroup/AvatarGroupContext.d.ts.map +1 -1
  11. package/dist/AvatarGroup/AvatarGroupContext.js +2 -2
  12. package/dist/BottomSheet/BottomSheetHostContext.d.ts.map +1 -1
  13. package/dist/BottomSheet/BottomSheetHostContext.js +3 -2
  14. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  15. package/dist/BottomSheet/BottomSheetPanel.js +48 -4
  16. package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
  17. package/dist/BottomSheet/BottomSheetSwitcherContext.js +2 -2
  18. package/dist/BottomSheet/bottomSheetEscape.d.ts.map +1 -1
  19. package/dist/BottomSheet/bottomSheetEscape.js +2 -2
  20. package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
  21. package/dist/BottomSheet/bottomSheetStack.js +2 -13
  22. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  23. package/dist/BottomSheet/useSheetGestures.js +25 -42
  24. package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  25. package/dist/Breadcrumbs/Breadcrumbs.js +2 -2
  26. package/dist/Button/Button.d.ts.map +1 -1
  27. package/dist/Button/Button.js +12 -21
  28. package/dist/Button/buttonHitArea.d.ts.map +1 -1
  29. package/dist/Button/buttonHitArea.js +3 -3
  30. package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  31. package/dist/ButtonGroup/ButtonGroup.js +13 -7
  32. package/dist/ButtonGroup/ButtonGroupContext.d.ts.map +1 -1
  33. package/dist/ButtonGroup/ButtonGroupContext.js +2 -2
  34. package/dist/Carousel/Carousel.d.ts.map +1 -1
  35. package/dist/Carousel/Carousel.js +24 -15
  36. package/dist/Chat/ChatContext.d.ts.map +1 -1
  37. package/dist/Chat/ChatContext.js +6 -5
  38. package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
  39. package/dist/Chat/useChatStreamScroll.js +7 -22
  40. package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -1
  41. package/dist/CheckboxInput/CheckboxRowPressContext.js +1 -1
  42. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  43. package/dist/CheckboxList/CheckboxListContext.js +1 -1
  44. package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
  45. package/dist/Collapsible/CollapsibleGroupContext.js +3 -3
  46. package/dist/CommandPalette/CommandPaletteContext.d.ts.map +1 -1
  47. package/dist/CommandPalette/CommandPaletteContext.js +4 -3
  48. package/dist/CommandPalette/busyStartSettle.d.ts.map +1 -1
  49. package/dist/CommandPalette/busyStartSettle.js +2 -2
  50. package/dist/DateInput/TouchDateField.d.ts.map +1 -1
  51. package/dist/DateInput/TouchDateField.js +41 -4
  52. package/dist/Dialog/DialogContext.d.ts.map +1 -1
  53. package/dist/Dialog/DialogContext.js +3 -2
  54. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  55. package/dist/DropdownMenu/DropdownMenuContext.js +6 -5
  56. package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
  57. package/dist/DropdownMenu/lazyMenuBottomSheet.js +4 -15
  58. package/dist/DropdownMenu/menuRegionStops.d.ts.map +1 -1
  59. package/dist/DropdownMenu/menuRegionStops.js +2 -37
  60. package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
  61. package/dist/FormLayout/FormLayoutContext.js +2 -2
  62. package/dist/Heading/Heading.d.ts.map +1 -1
  63. package/dist/Heading/Heading.js +19 -16
  64. package/dist/HoverCard/HoverCard.d.ts +1 -2
  65. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  66. package/dist/HoverCard/useHoverCard.d.ts +1 -2
  67. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  68. package/dist/HoverCard/useHoverCard.js +5 -1
  69. package/dist/Icon/IconDefaultSizeContext.d.ts.map +1 -1
  70. package/dist/Icon/IconDefaultSizeContext.js +2 -2
  71. package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
  72. package/dist/InputGroup/InputGroupContext.js +2 -2
  73. package/dist/InputGroup/InputGroupInternalContext.d.ts.map +1 -1
  74. package/dist/InputGroup/InputGroupInternalContext.js +2 -2
  75. package/dist/InteractiveRoleContext/InteractiveRoleContext.d.ts.map +1 -1
  76. package/dist/InteractiveRoleContext/InteractiveRoleContext.js +5 -3
  77. package/dist/Item/ItemDescriptionContext.d.ts.map +1 -1
  78. package/dist/Item/ItemDescriptionContext.js +3 -3
  79. package/dist/Item/ItemListRowContext.d.ts.map +1 -1
  80. package/dist/Item/ItemListRowContext.js +3 -3
  81. package/dist/Item/ItemMarkerColumnsContext.d.ts +1 -1
  82. package/dist/Item/ItemMarkerColumnsContext.d.ts.map +1 -1
  83. package/dist/Item/ItemMarkerColumnsContext.js +2 -2
  84. package/dist/Layer/LayerContext.d.ts.map +1 -1
  85. package/dist/Layer/LayerContext.js +3 -2
  86. package/dist/Layer/LayerDepthContext.d.ts.map +1 -1
  87. package/dist/Layer/LayerDepthContext.js +3 -2
  88. package/dist/Layer/LayerTouch.d.ts +3 -2
  89. package/dist/Layer/LayerTouch.d.ts.map +1 -1
  90. package/dist/Layer/LayerTouch.js +3 -2
  91. package/dist/Layer/anchorName.d.ts.map +1 -1
  92. package/dist/Layer/anchorName.js +5 -1
  93. package/dist/Layer/inputHold.d.ts.map +1 -1
  94. package/dist/Layer/inputHold.js +115 -13
  95. package/dist/Layer/layerScopedContext.d.ts +5 -2
  96. package/dist/Layer/layerScopedContext.d.ts.map +1 -1
  97. package/dist/Layer/layerScopedContext.js +27 -10
  98. package/dist/Layer/layerSlideRules.d.ts +28 -26
  99. package/dist/Layer/layerSlideRules.d.ts.map +1 -1
  100. package/dist/Layer/layerSlideRules.js +41 -40
  101. package/dist/Layer/outsidePress.d.ts +21 -3
  102. package/dist/Layer/outsidePress.d.ts.map +1 -1
  103. package/dist/Layer/outsidePress.js +119 -29
  104. package/dist/Layer/settledBox.d.ts +9 -8
  105. package/dist/Layer/settledBox.d.ts.map +1 -1
  106. package/dist/Layer/settledBox.js +169 -49
  107. package/dist/Layer/toastHost.d.ts.map +1 -1
  108. package/dist/Layer/toastHost.js +3 -2
  109. package/dist/Layer/useLayer.d.ts.map +1 -1
  110. package/dist/Layer/useLayer.js +172 -60
  111. package/dist/Layer/useLayerKeyboardClearance.d.ts +14 -2
  112. package/dist/Layer/useLayerKeyboardClearance.d.ts.map +1 -1
  113. package/dist/Layer/useLayerKeyboardClearance.js +83 -12
  114. package/dist/Layer/useTouchTrigger.d.ts +21 -1
  115. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  116. package/dist/Layer/useTouchTrigger.js +61 -37
  117. package/dist/Layout/Layout.d.ts +1 -1
  118. package/dist/Layout/Layout.d.ts.map +1 -1
  119. package/dist/Layout/Layout.js +10 -6
  120. package/dist/Layout/LayoutAreaContext.d.ts.map +1 -1
  121. package/dist/Layout/LayoutAreaContext.js +3 -3
  122. package/dist/Layout/LayoutContent.d.ts +6 -6
  123. package/dist/Layout/LayoutContent.js +9 -9
  124. package/dist/Layout/LayoutDividerContext.d.ts.map +1 -1
  125. package/dist/Layout/LayoutDividerContext.js +2 -2
  126. package/dist/Layout/LayoutSlotsContext.d.ts.map +1 -1
  127. package/dist/Layout/LayoutSlotsContext.js +2 -2
  128. package/dist/Link/LinkContext.d.ts +16 -0
  129. package/dist/Link/LinkContext.d.ts.map +1 -1
  130. package/dist/Link/LinkContext.js +3 -3
  131. package/dist/List/List.d.ts +12 -1
  132. package/dist/List/List.d.ts.map +1 -1
  133. package/dist/List/List.js +29 -10
  134. package/dist/List/ListContext.d.ts +18 -3
  135. package/dist/List/ListContext.d.ts.map +1 -1
  136. package/dist/List/ListContext.js +9 -6
  137. package/dist/List/ListItem.d.ts +13 -4
  138. package/dist/List/ListItem.d.ts.map +1 -1
  139. package/dist/List/ListItem.js +37 -10
  140. package/dist/List/listLayoutUpdates.d.ts +34 -0
  141. package/dist/List/listLayoutUpdates.d.ts.map +1 -0
  142. package/dist/List/listLayoutUpdates.js +539 -0
  143. package/dist/Markdown/Markdown.d.ts.map +1 -1
  144. package/dist/Markdown/Markdown.js +57 -10
  145. package/dist/Markdown/blockDirection.d.ts +26 -0
  146. package/dist/Markdown/blockDirection.d.ts.map +1 -0
  147. package/dist/Markdown/blockDirection.js +68 -0
  148. package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts +3 -1
  149. package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts.map +1 -1
  150. package/dist/Markdown/plugins/HeadingLinksRenderer.js +3 -1
  151. package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
  152. package/dist/MetadataList/MetadataListContext.js +2 -2
  153. package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
  154. package/dist/NavMenu/NavMenuContext.js +5 -4
  155. package/dist/Popover/Popover.d.ts.map +1 -1
  156. package/dist/Popover/Popover.js +9 -9
  157. package/dist/Popover/usePopover.d.ts.map +1 -1
  158. package/dist/Popover/usePopover.js +11 -8
  159. package/dist/RadioList/RadioList.d.ts.map +1 -1
  160. package/dist/RadioList/RadioList.js +2 -2
  161. package/dist/RadioList/RadioListReasonContext.d.ts.map +1 -1
  162. package/dist/RadioList/RadioListReasonContext.js +1 -1
  163. package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  164. package/dist/SegmentedControl/SegmentedControlContext.js +2 -2
  165. package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -1
  166. package/dist/SelectableCard/selectableCardInput.js +2 -2
  167. package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -1
  168. package/dist/Selector/SelectorRowLayoutContext.js +2 -2
  169. package/dist/SideNav/SideNavCollapseButton.d.ts +4 -3
  170. package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
  171. package/dist/SideNav/SideNavCollapseContext.d.ts.map +1 -1
  172. package/dist/SideNav/SideNavCollapseContext.js +4 -3
  173. package/dist/SideNav/SideNavFocusTargetsContext.d.ts.map +1 -1
  174. package/dist/SideNav/SideNavFocusTargetsContext.js +2 -2
  175. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  176. package/dist/SideNav/SideNavItem.js +3 -2
  177. package/dist/SideNav/SideNavRenderContext.d.ts.map +1 -1
  178. package/dist/SideNav/SideNavRenderContext.js +4 -3
  179. package/dist/SideNav/railMotion.d.ts +40 -0
  180. package/dist/SideNav/railMotion.d.ts.map +1 -1
  181. package/dist/SideNav/railMotion.js +2 -2
  182. package/dist/SizeContext/SizeContext.d.ts.map +1 -1
  183. package/dist/SizeContext/SizeContext.js +2 -2
  184. package/dist/SnapPaging/SnapPaging.d.ts.map +1 -1
  185. package/dist/SnapPaging/SnapPaging.js +162 -36
  186. package/dist/SnapPaging/snapPagingValue.d.ts +29 -3
  187. package/dist/SnapPaging/snapPagingValue.d.ts.map +1 -1
  188. package/dist/SnapPaging/snapPagingValue.js +38 -6
  189. package/dist/Spinner/SpinnerOwnerContext.d.ts.map +1 -1
  190. package/dist/Spinner/SpinnerOwnerContext.js +2 -2
  191. package/dist/Stepper/StepperContext.d.ts.map +1 -1
  192. package/dist/Stepper/StepperContext.js +3 -3
  193. package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
  194. package/dist/Switch/useSwitchTouch.js +8 -3
  195. package/dist/TabList/TabListContext.d.ts.map +1 -1
  196. package/dist/TabList/TabListContext.js +2 -2
  197. package/dist/Table/BaseTable.d.ts +3 -2
  198. package/dist/Table/BaseTable.d.ts.map +1 -1
  199. package/dist/Table/BaseTable.js +73 -16
  200. package/dist/Table/Table.d.ts.map +1 -1
  201. package/dist/Table/Table.js +3 -2
  202. package/dist/Table/TableContext.d.ts.map +1 -1
  203. package/dist/Table/TableContext.js +2 -2
  204. package/dist/Table/index.d.ts +1 -1
  205. package/dist/Table/index.d.ts.map +1 -1
  206. package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
  207. package/dist/Table/plugins/filtering/useTableFiltering.js +4 -3
  208. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  209. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +5 -3
  210. package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +16 -18
  211. package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
  212. package/dist/Table/plugins/rowIndex/useTableRowIndex.js +48 -39
  213. package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
  214. package/dist/Table/plugins/selection/useTableSelection.js +4 -2
  215. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
  216. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +1 -0
  217. package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
  218. package/dist/Table/plugins/tree/useTableTreeData.js +3 -2
  219. package/dist/Table/tableRowContextUsage.d.ts +21 -0
  220. package/dist/Table/tableRowContextUsage.d.ts.map +1 -0
  221. package/dist/Table/tableRowContextUsage.js +88 -0
  222. package/dist/Table/types.d.ts +58 -5
  223. package/dist/Table/types.d.ts.map +1 -1
  224. package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
  225. package/dist/Table/useBaseTablePlugins.js +5 -2
  226. package/dist/Text/Text.d.ts.map +1 -1
  227. package/dist/Text/Text.js +18 -14
  228. package/dist/Text/TruncationTooltip.d.ts +45 -0
  229. package/dist/Text/TruncationTooltip.d.ts.map +1 -0
  230. package/dist/Text/TruncationTooltip.js +123 -0
  231. package/dist/Text/textClampContext.d.ts.map +1 -1
  232. package/dist/Text/textClampContext.js +1 -1
  233. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  234. package/dist/TimeInput/TimeInput.js +4 -0
  235. package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
  236. package/dist/ToggleButton/ToggleButtonGroup.js +2 -2
  237. package/dist/Token/TokenNamingContext.d.ts.map +1 -1
  238. package/dist/Token/TokenNamingContext.js +2 -2
  239. package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -1
  240. package/dist/Tokenizer/TokenizerClearAllMessageContext.js +2 -2
  241. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +12 -0
  242. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -1
  243. package/dist/Tokenizer/TokenizerItemRemovableContext.js +2 -2
  244. package/dist/Toolbar/Toolbar.d.ts.map +1 -1
  245. package/dist/Toolbar/Toolbar.js +12 -6
  246. package/dist/Tooltip/tooltipPresentInterest.d.ts +29 -0
  247. package/dist/Tooltip/tooltipPresentInterest.d.ts.map +1 -0
  248. package/dist/Tooltip/tooltipPresentInterest.js +29 -0
  249. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  250. package/dist/Tooltip/useTooltip.js +30 -4
  251. package/dist/TopNav/TopNavContext.d.ts.map +1 -1
  252. package/dist/TopNav/TopNavContext.js +2 -2
  253. package/dist/TopNav/TopNavMobileContentContext.d.ts +1 -1
  254. package/dist/TopNav/TopNavMobileContentContext.d.ts.map +1 -1
  255. package/dist/TopNav/TopNavMobileContentContext.js +4 -3
  256. package/dist/TopNav/TopNavRenderContext.d.ts.map +1 -1
  257. package/dist/TopNav/TopNavRenderContext.js +4 -3
  258. package/dist/Typeahead/busyIndicatorLane.d.ts.map +1 -1
  259. package/dist/Typeahead/busyIndicatorLane.js +3 -2
  260. package/dist/Typeahead/committedChoicesKey.d.ts.map +1 -1
  261. package/dist/Typeahead/committedChoicesKey.js +3 -2
  262. package/dist/Typeahead/trailingKeyDown.d.ts.map +1 -1
  263. package/dist/Typeahead/trailingKeyDown.js +3 -2
  264. package/dist/astryx.css +18 -8
  265. package/dist/gestures/GestureArena.d.ts +2 -0
  266. package/dist/gestures/GestureArena.d.ts.map +1 -1
  267. package/dist/gestures/GestureArena.js +8 -1
  268. package/dist/gestures/GestureRecognizer.d.ts +6 -0
  269. package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
  270. package/dist/gestures/GestureRecognizer.js +9 -0
  271. package/dist/gestures/PressTracker.d.ts.map +1 -1
  272. package/dist/gestures/PressTracker.js +9 -4
  273. package/dist/hooks/focusableSelector.d.ts +13 -1
  274. package/dist/hooks/focusableSelector.d.ts.map +1 -1
  275. package/dist/hooks/focusableSelector.js +22 -2
  276. package/dist/hooks/longPressDetector.d.ts.map +1 -1
  277. package/dist/hooks/longPressDetector.js +1 -25
  278. package/dist/hooks/pressGroupContext.d.ts.map +1 -1
  279. package/dist/hooks/pressGroupContext.js +1 -1
  280. package/dist/hooks/useActionGroupTracking.d.ts +18 -1
  281. package/dist/hooks/useActionGroupTracking.d.ts.map +1 -1
  282. package/dist/hooks/useActionGroupTracking.js +13 -2
  283. package/dist/hooks/useAnnounce.d.ts.map +1 -1
  284. package/dist/hooks/useAnnounce.js +3 -2
  285. package/dist/hooks/useFocusTrap.d.ts +11 -0
  286. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  287. package/dist/hooks/useFocusTrap.js +47 -2
  288. package/dist/hooks/useListFocus.d.ts +7 -0
  289. package/dist/hooks/useListFocus.d.ts.map +1 -1
  290. package/dist/hooks/useListFocus.js +20 -3
  291. package/dist/hooks/usePager.d.ts.map +1 -1
  292. package/dist/hooks/usePager.js +26 -3
  293. package/dist/hooks/useScrollOverflow.d.ts +22 -0
  294. package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
  295. package/dist/hooks/useScrollOverflow.js +67 -11
  296. package/dist/i18n/InternationalizationContext.d.ts +19 -0
  297. package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
  298. package/dist/i18n/InternationalizationContext.js +3 -3
  299. package/dist/i18n/englishFallback.d.ts.map +1 -1
  300. package/dist/i18n/englishFallback.js +5 -1
  301. package/dist/i18n/firstStrongDirection.d.ts +7 -0
  302. package/dist/i18n/firstStrongDirection.d.ts.map +1 -0
  303. package/dist/i18n/firstStrongDirection.js +65 -0
  304. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  305. package/dist/i18n/generated-locales/en.generated.js +1 -0
  306. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  307. package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
  308. package/dist/internal/scroll-anchoring.d.ts +16 -0
  309. package/dist/internal/scroll-anchoring.d.ts.map +1 -0
  310. package/dist/internal/scroll-anchoring.js +16 -0
  311. package/dist/internal/touch.d.ts +2 -0
  312. package/dist/internal/touch.d.ts.map +1 -1
  313. package/dist/internal/touch.js +4 -1
  314. package/dist/motion/animatedLayout.d.ts +8 -0
  315. package/dist/motion/animatedLayout.d.ts.map +1 -1
  316. package/dist/motion/animatedLayout.js +51 -3
  317. package/dist/motion/animator.d.ts +19 -2
  318. package/dist/motion/animator.d.ts.map +1 -1
  319. package/dist/motion/animator.js +72 -7
  320. package/dist/privateAttributes/itemKey.stylex.d.ts +5 -0
  321. package/dist/privateAttributes/itemKey.stylex.d.ts.map +1 -0
  322. package/dist/privateAttributes/itemKey.stylex.js +25 -0
  323. package/dist/privateAttributes/leaving.stylex.d.ts +5 -0
  324. package/dist/privateAttributes/leaving.stylex.d.ts.map +1 -0
  325. package/dist/privateAttributes/leaving.stylex.js +23 -0
  326. package/dist/privateAttributes/press.stylex.d.ts.map +1 -1
  327. package/dist/privateAttributes/press.stylex.js +13 -3
  328. package/dist/privateAttributes/scrollAnchoring.stylex.d.ts +7 -0
  329. package/dist/privateAttributes/scrollAnchoring.stylex.d.ts.map +1 -0
  330. package/dist/privateAttributes/scrollAnchoring.stylex.js +50 -0
  331. package/dist/privateAttributes/travelling.stylex.d.ts +27 -0
  332. package/dist/privateAttributes/travelling.stylex.d.ts.map +1 -0
  333. package/dist/privateAttributes/travelling.stylex.js +51 -0
  334. package/dist/theme/Theme.d.ts.map +1 -1
  335. package/dist/theme/Theme.js +95 -49
  336. package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
  337. package/dist/theme/syntax/SyntaxTheme.js +3 -2
  338. package/dist/theme/useTheme.d.ts.map +1 -1
  339. package/dist/theme/useTheme.js +3 -2
  340. package/dist/utils/calendarSystem.d.ts.map +1 -1
  341. package/dist/utils/calendarSystem.js +4 -1
  342. package/dist/utils/flatTree.d.ts +13 -0
  343. package/dist/utils/flatTree.d.ts.map +1 -1
  344. package/dist/utils/flatTree.js +28 -4
  345. package/dist/utils/inputAge.d.ts +22 -0
  346. package/dist/utils/inputAge.d.ts.map +1 -0
  347. package/dist/utils/inputAge.js +54 -0
  348. package/dist/utils/inputStream.d.ts +8 -0
  349. package/dist/utils/inputStream.d.ts.map +1 -1
  350. package/dist/utils/inputStream.js +53 -3
  351. package/dist/utils/moduleLoader.d.ts +23 -0
  352. package/dist/utils/moduleLoader.d.ts.map +1 -0
  353. package/dist/utils/moduleLoader.js +31 -0
  354. package/dist/utils/pressFeedback.d.ts.map +1 -1
  355. package/dist/utils/pressFeedback.js +13 -8
  356. package/dist/utils/selectionLock.d.ts.map +1 -1
  357. package/dist/utils/selectionLock.js +7 -14
  358. package/dist/utils/sharedContext.d.ts +18 -0
  359. package/dist/utils/sharedContext.d.ts.map +1 -0
  360. package/dist/utils/sharedContext.js +33 -0
  361. package/dist/utils/sharedRealm.d.ts +24 -0
  362. package/dist/utils/sharedRealm.d.ts.map +1 -0
  363. package/dist/utils/sharedRealm.js +38 -0
  364. package/locales/en.json +4 -0
  365. package/locales/pseudo.json +3 -0
  366. package/package.json +10 -5
  367. package/src/AppShell/AppShellMobileContext.tsx +8 -3
  368. package/src/AppShell/useAppShellMainId.ts +7 -2
  369. package/src/Avatar/AvatarSizeContext.ts +6 -2
  370. package/src/Avatar/AvatarStatusLabelContext.ts +8 -3
  371. package/src/AvatarGroup/AvatarGroupContext.ts +7 -4
  372. package/src/BottomSheet/BottomSheetHostContext.ts +7 -3
  373. package/src/BottomSheet/BottomSheetPanel.tsx +56 -7
  374. package/src/BottomSheet/BottomSheetSwitcherContext.ts +7 -2
  375. package/src/BottomSheet/bottomSheetEscape.ts +6 -2
  376. package/src/BottomSheet/bottomSheetStack.ts +6 -14
  377. package/src/BottomSheet/useSheetGestures.ts +28 -48
  378. package/src/Breadcrumbs/Breadcrumbs.tsx +6 -5
  379. package/src/Button/Button.doc.mjs +3 -3
  380. package/src/Button/Button.tsx +10 -22
  381. package/src/Button/buttonHitArea.ts +7 -4
  382. package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -3
  383. package/src/ButtonGroup/ButtonGroup.tsx +27 -16
  384. package/src/ButtonGroup/ButtonGroupContext.ts +7 -4
  385. package/src/Carousel/Carousel.tsx +33 -15
  386. package/src/Chat/ChatContext.tsx +23 -7
  387. package/src/Chat/useChatStreamScroll.ts +7 -26
  388. package/src/CheckboxInput/CheckboxRowPressContext.ts +5 -1
  389. package/src/CheckboxList/CheckboxListContext.tsx +5 -1
  390. package/src/Collapsible/CollapsibleGroupContext.tsx +11 -3
  391. package/src/CommandPalette/CommandPaletteContext.ts +8 -3
  392. package/src/CommandPalette/busyStartSettle.ts +6 -2
  393. package/src/DateInput/TouchDateField.tsx +62 -4
  394. package/src/Dialog/DialogContext.ts +7 -2
  395. package/src/DropdownMenu/DropdownMenuContext.tsx +18 -5
  396. package/src/DropdownMenu/lazyMenuBottomSheet.ts +6 -18
  397. package/src/DropdownMenu/menuRegionStops.ts +1 -49
  398. package/src/FormLayout/FormLayoutContext.ts +3 -3
  399. package/src/Heading/Heading.tsx +34 -18
  400. package/src/HoverCard/HoverCard.doc.mjs +3 -3
  401. package/src/HoverCard/HoverCard.tsx +1 -2
  402. package/src/HoverCard/useHoverCard.tsx +6 -2
  403. package/src/Icon/IconDefaultSizeContext.ts +6 -2
  404. package/src/IconButton/IconButton.doc.mjs +2 -2
  405. package/src/InputGroup/InputGroupContext.ts +7 -4
  406. package/src/InputGroup/InputGroupInternalContext.ts +6 -2
  407. package/src/InteractiveRoleContext/InteractiveRoleContext.ts +8 -3
  408. package/src/Item/ItemDescriptionContext.tsx +7 -3
  409. package/src/Item/ItemListRowContext.tsx +7 -3
  410. package/src/Item/ItemMarkerColumnsContext.tsx +7 -2
  411. package/src/Layer/LayerContext.ts +7 -2
  412. package/src/Layer/LayerDepthContext.tsx +3 -2
  413. package/src/Layer/LayerTouch.ts +6 -2
  414. package/src/Layer/anchorName.ts +8 -4
  415. package/src/Layer/inputHold.ts +138 -21
  416. package/src/Layer/layerScopedContext.tsx +34 -7
  417. package/src/Layer/layerSlideRules.ts +43 -40
  418. package/src/Layer/outsidePress.ts +144 -28
  419. package/src/Layer/settledBox.ts +216 -54
  420. package/src/Layer/toastHost.tsx +6 -2
  421. package/src/Layer/useLayer.tsx +200 -69
  422. package/src/Layer/useLayerKeyboardClearance.ts +90 -12
  423. package/src/Layer/useTouchTrigger.ts +89 -40
  424. package/src/Layout/Layout.doc.mjs +17 -0
  425. package/src/Layout/Layout.tsx +13 -9
  426. package/src/Layout/LayoutAreaContext.ts +8 -9
  427. package/src/Layout/LayoutContent.doc.mjs +11 -0
  428. package/src/Layout/LayoutContent.tsx +9 -9
  429. package/src/Layout/LayoutDividerContext.ts +6 -2
  430. package/src/Layout/LayoutSlotsContext.ts +6 -3
  431. package/src/Link/LinkContext.ts +7 -3
  432. package/src/List/List.doc.mjs +5 -0
  433. package/src/List/List.tsx +53 -5
  434. package/src/List/ListContext.tsx +28 -6
  435. package/src/List/ListItem.doc.mjs +11 -0
  436. package/src/List/ListItem.tsx +51 -14
  437. package/src/List/listLayoutUpdates.ts +603 -0
  438. package/src/Markdown/Markdown.tsx +93 -5
  439. package/src/Markdown/blockDirection.ts +100 -0
  440. package/src/Markdown/plugins/HeadingLinksRenderer.tsx +4 -0
  441. package/src/MetadataList/MetadataListContext.tsx +6 -2
  442. package/src/NavMenu/NavMenuContext.tsx +14 -5
  443. package/src/Popover/Popover.tsx +23 -16
  444. package/src/Popover/usePopover.tsx +21 -7
  445. package/src/RadioList/RadioList.tsx +7 -4
  446. package/src/RadioList/RadioListReasonContext.ts +1 -1
  447. package/src/Section/Section.doc.mjs +22 -0
  448. package/src/SegmentedControl/SegmentedControlContext.ts +6 -2
  449. package/src/SelectableCard/selectableCardInput.ts +6 -2
  450. package/src/Selector/SelectorRowLayoutContext.ts +6 -2
  451. package/src/SideNav/SideNavCollapseButton.doc.mjs +5 -5
  452. package/src/SideNav/SideNavCollapseButton.tsx +4 -3
  453. package/src/SideNav/SideNavCollapseContext.ts +12 -7
  454. package/src/SideNav/SideNavFocusTargetsContext.ts +6 -2
  455. package/src/SideNav/SideNavItem.tsx +6 -2
  456. package/src/SideNav/SideNavRenderContext.ts +9 -8
  457. package/src/SideNav/railMotion.ts +6 -2
  458. package/src/SizeContext/SizeContext.ts +6 -2
  459. package/src/SnapPaging/SnapPaging.ts +164 -39
  460. package/src/SnapPaging/snapPagingValue.ts +59 -12
  461. package/src/Spinner/SpinnerOwnerContext.ts +6 -2
  462. package/src/Stepper/StepperContext.ts +12 -3
  463. package/src/Switch/useSwitchTouch.ts +7 -5
  464. package/src/TabList/TabListContext.ts +7 -2
  465. package/src/Table/BaseTable.tsx +143 -19
  466. package/src/Table/Table.tsx +4 -3
  467. package/src/Table/TableContext.ts +6 -2
  468. package/src/Table/index.ts +2 -0
  469. package/src/Table/plugins/filtering/useTableFiltering.tsx +11 -3
  470. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +10 -3
  471. package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +38 -29
  472. package/src/Table/plugins/selection/useTableSelection.tsx +7 -2
  473. package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +1 -0
  474. package/src/Table/plugins/tree/useTableTreeData.tsx +6 -2
  475. package/src/Table/tableRowContextUsage.ts +105 -0
  476. package/src/Table/types.ts +60 -2
  477. package/src/Table/useBaseTablePlugins.ts +5 -2
  478. package/src/Table/useTableRowIndex.doc.mjs +6 -7
  479. package/src/Text/Text.tsx +34 -18
  480. package/src/Text/TruncationTooltip.tsx +179 -0
  481. package/src/Text/textClampContext.ts +5 -1
  482. package/src/TimeInput/TimeInput.tsx +4 -0
  483. package/src/ToggleButton/ToggleButtonGroup.tsx +6 -2
  484. package/src/Token/TokenNamingContext.ts +6 -2
  485. package/src/Tokenizer/TokenizerClearAllMessageContext.ts +4 -4
  486. package/src/Tokenizer/TokenizerItemRemovableContext.ts +3 -3
  487. package/src/Toolbar/Toolbar.tsx +16 -9
  488. package/src/Tooltip/tooltipPresentInterest.ts +43 -0
  489. package/src/Tooltip/useTooltip.tsx +33 -0
  490. package/src/TopNav/TopNavContext.ts +6 -2
  491. package/src/TopNav/TopNavMobileContentContext.ts +8 -3
  492. package/src/TopNav/TopNavRenderContext.ts +8 -4
  493. package/src/Typeahead/busyIndicatorLane.tsx +7 -2
  494. package/src/Typeahead/committedChoicesKey.tsx +4 -3
  495. package/src/Typeahead/trailingKeyDown.tsx +7 -2
  496. package/src/gestures/GestureArena.ts +8 -1
  497. package/src/gestures/GestureRecognizer.ts +9 -0
  498. package/src/gestures/PressTracker.ts +13 -4
  499. package/src/hooks/focusableSelector.ts +29 -1
  500. package/src/hooks/longPressDetector.ts +1 -35
  501. package/src/hooks/pressGroupContext.ts +5 -1
  502. package/src/hooks/useActionGroupTracking.ts +29 -2
  503. package/src/hooks/useAnnounce.ts +8 -4
  504. package/src/hooks/useFocusTrap.ts +62 -2
  505. package/src/hooks/useListFocus.ts +34 -7
  506. package/src/hooks/usePager.ts +30 -3
  507. package/src/hooks/useScrollOverflow.ts +65 -7
  508. package/src/i18n/InternationalizationContext.ts +12 -8
  509. package/src/i18n/englishFallback.ts +7 -1
  510. package/src/i18n/firstStrongDirection.ts +69 -0
  511. package/src/i18n/generated-locales/en.generated.ts +1 -0
  512. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  513. package/src/internal/scroll-anchoring.ts +16 -0
  514. package/src/internal/touch.ts +4 -0
  515. package/src/motion/animatedLayout.ts +44 -3
  516. package/src/motion/animator.ts +97 -9
  517. package/src/privateAttributes/itemKey.stylex.ts +25 -0
  518. package/src/privateAttributes/leaving.stylex.ts +23 -0
  519. package/src/privateAttributes/press.stylex.ts +19 -7
  520. package/src/privateAttributes/scrollAnchoring.stylex.ts +50 -0
  521. package/src/privateAttributes/travelling.stylex.ts +88 -0
  522. package/src/theme/Theme.tsx +124 -60
  523. package/src/theme/syntax/SyntaxTheme.tsx +7 -2
  524. package/src/theme/useTheme.ts +7 -8
  525. package/src/utils/calendarSystem.ts +7 -1
  526. package/src/utils/flatTree.ts +31 -4
  527. package/src/utils/inputAge.ts +66 -0
  528. package/src/utils/inputStream.ts +52 -3
  529. package/src/utils/moduleLoader.ts +47 -0
  530. package/src/utils/pressFeedback.ts +16 -7
  531. package/src/utils/selectionLock.ts +8 -18
  532. package/src/utils/sharedContext.ts +42 -0
  533. package/src/utils/sharedRealm.ts +42 -0
@@ -64,6 +64,7 @@ import {
64
64
  type UIEvent as ReactUIEvent,
65
65
  } from 'react';
66
66
 
67
+ import {VelocityTracker} from '../gestures/VelocityTracker';
67
68
  import {resolveSnapPoint} from '../motion/resolveSnapPoint';
68
69
  import {rubberBand} from '../motion/rubberBand';
69
70
  import {scroll} from '../motion/uikit/scroll';
@@ -93,10 +94,6 @@ interface SheetDetents {
93
94
  const DECELERATION_RATE = 0.998;
94
95
  const PROJECTION_FACTOR = DECELERATION_RATE / (1 - DECELERATION_RATE); // ms
95
96
  const PROJECTION_MIN_TRAVEL = 48; // px traveled during the gesture
96
- // The release speed is the finger's speed over its last stretch, not between
97
- // its last two samples: one slow sample before the lift must not cancel a
98
- // throw, and a finger that paused before lifting has no speed at all.
99
- const VELOCITY_WINDOW_MS = 100;
100
97
  // On a slow drag below the shortest detent, dismiss once dragged past it by
101
98
  // more than this fraction of that detent's height; otherwise snap back to it.
102
99
  const DISMISS_OVERSHOOT_RATIO = 0.4;
@@ -762,12 +759,9 @@ export function useSheetGestures({
762
759
  pointerType: string;
763
760
  pointerId: number;
764
761
  startCoord: number;
765
- lastCoord: number;
766
- lastTime: number;
767
- // The finger's recent positions, oldest first, kept to VELOCITY_WINDOW_MS
768
- // (and never fewer than two) for the release speed.
769
- samples: {t: number; y: number}[];
770
- velocity: number;
762
+ // The finger's positions on the timestamps their events carry, for the
763
+ // release velocity (Core's one velocity tracker).
764
+ tracker: VelocityTracker;
771
765
  height: number;
772
766
  /** The surface kept below the screen when the drag began. */
773
767
  reserve: number;
@@ -1295,15 +1289,14 @@ export function useSheetGestures({
1295
1289
  const start = startCoord ?? event.clientY;
1296
1290
  const naturalEndGap = naturalEndGapFor(bodyNodeRef.current);
1297
1291
  const baseLayoutOffset = settledLayoutOffsetRef.current;
1292
+ const tracker = new VelocityTracker();
1293
+ tracker.add(0, event.clientY, event.timeStamp);
1298
1294
  dragStateRef.current = {
1299
1295
  syntheticTouch,
1300
1296
  pointerType: event.pointerType,
1301
1297
  pointerId: event.pointerId,
1302
1298
  startCoord: start,
1303
- lastCoord: event.clientY,
1304
- lastTime: event.timeStamp,
1305
- samples: [{t: event.timeStamp, y: event.clientY}],
1306
- velocity: 0,
1299
+ tracker,
1307
1300
  height: sheetHeight,
1308
1301
  reserve: offscreenBlockEndInsetRef.current,
1309
1302
  baseOffset: settledOffset,
@@ -1380,26 +1373,9 @@ export function useSheetGestures({
1380
1373
  return;
1381
1374
  }
1382
1375
  const delta = event.clientY - state.startCoord;
1383
- const dt = event.timeStamp - state.lastTime;
1384
- if (dt > 0) {
1385
- state.lastCoord = event.clientY;
1386
- state.lastTime = event.timeStamp;
1387
- state.samples.push({t: event.timeStamp, y: event.clientY});
1388
- // Drop what fell out of the window while a partner remains: a throw
1389
- // that begins after a rest reads its own speed, not the average since
1390
- // touch-down.
1391
- while (
1392
- state.samples.length > 2 &&
1393
- event.timeStamp - state.samples[0].t > VELOCITY_WINDOW_MS
1394
- ) {
1395
- state.samples.shift();
1396
- }
1397
- const first = state.samples[0];
1398
- // A lone partner older than the window says only where the finger
1399
- // rested; the move it precedes is read as if it took the window.
1400
- const span = Math.min(event.timeStamp - first.t, VELOCITY_WINDOW_MS);
1401
- state.velocity = span > 0 ? (event.clientY - first.y) / span : 0;
1402
- }
1376
+ // One sample per event, on the event's own timestamp: when the finger
1377
+ // was there, however late a busy main thread handles the event.
1378
+ state.tracker.add(0, event.clientY, event.timeStamp);
1403
1379
  const {offsets, peekOffset} = resolveDetents(state.height);
1404
1380
 
1405
1381
  const raw = state.baseOffset + delta;
@@ -1497,11 +1473,13 @@ export function useSheetGestures({
1497
1473
  const delta = event.clientY - state.startCoord;
1498
1474
  const offset = Math.max(0, state.baseOffset + delta);
1499
1475
  const dir = delta === 0 ? 0 : delta > 0 ? 1 : -1;
1500
- // A finger that rested before lifting released nothing in motion.
1501
- const velocity =
1502
- event.timeStamp - state.lastTime < VELOCITY_WINDOW_MS
1503
- ? state.velocity
1504
- : 0;
1476
+ // The release velocity, px/ms. A lift at a new position is the last
1477
+ // sample. A finger that held still for longer than the stillness
1478
+ // interval before the lift releases nothing in motion.
1479
+ if (state.tracker.lastSample?.y !== event.clientY) {
1480
+ state.tracker.add(0, event.clientY, event.timeStamp);
1481
+ }
1482
+ const velocity = state.tracker.velocity(event.timeStamp).y / 1000;
1505
1483
  dragStateRef.current = null;
1506
1484
  if (!state.syntheticTouch) {
1507
1485
  target.releasePointerCapture?.(event.pointerId);
@@ -1659,13 +1637,15 @@ export function useSheetGestures({
1659
1637
  });
1660
1638
 
1661
1639
  const bodyRef = useCallback((node: HTMLElement | null) => {
1662
- const asPointer = (touch: Touch, target: HTMLElement) =>
1640
+ const asPointer = (touch: Touch, target: HTMLElement, event: TouchEvent) =>
1663
1641
  ({
1664
1642
  syntheticTouch: true,
1665
1643
  pointerId: touch.identifier,
1666
1644
  pointerType: touchPointerType(touch),
1667
1645
  clientY: touch.clientY,
1668
- timeStamp: Date.now(),
1646
+ // The touch event's own time: when the finger was there, however
1647
+ // late this handler runs.
1648
+ timeStamp: event.timeStamp,
1669
1649
  currentTarget: target,
1670
1650
  setPointerCapture: () => {},
1671
1651
  releasePointerCapture: () => {},
@@ -1744,11 +1724,11 @@ export function useSheetGestures({
1744
1724
  // Deliberately NOT preventDefault()ed: the scroller is clamped at
1745
1725
  // its end, so there is no scrolling left to cancel, and claiming the
1746
1726
  // gesture would strand the content for as long as the finger is down.
1747
- pointerMoveRef.current(asPointer(t, scroller));
1727
+ pointerMoveRef.current(asPointer(t, scroller, event));
1748
1728
  return;
1749
1729
  }
1750
1730
  event.preventDefault();
1751
- pointerMoveRef.current(asPointer(t, scroller));
1731
+ pointerMoveRef.current(asPointer(t, scroller, event));
1752
1732
  return;
1753
1733
  }
1754
1734
  if (!armed) {
@@ -1774,11 +1754,11 @@ export function useSheetGestures({
1774
1754
  releaseContentHold(armed);
1775
1755
  touchDragRef.current = null;
1776
1756
  beginDragRef.current(
1777
- asPointer(t, scroller),
1757
+ asPointer(t, scroller, event),
1778
1758
  measureHeightRef.current(),
1779
1759
  armed.startY,
1780
1760
  );
1781
- pointerMoveRef.current(asPointer(t, scroller));
1761
+ pointerMoveRef.current(asPointer(t, scroller, event));
1782
1762
  return;
1783
1763
  }
1784
1764
  if ((armed.top && delta < 0) || (armed.bottom && delta > 0)) {
@@ -1802,11 +1782,11 @@ export function useSheetGestures({
1802
1782
  } else if (armed.contentEndY - t.clientY >= CONTENT_END_HANDOFF_SLOP) {
1803
1783
  armed.promotedAtContentEnd = true;
1804
1784
  beginDragRef.current(
1805
- asPointer(t, scroller),
1785
+ asPointer(t, scroller, event),
1806
1786
  measureHeightRef.current(),
1807
1787
  armed.contentEndY,
1808
1788
  );
1809
- pointerMoveRef.current(asPointer(t, scroller));
1789
+ pointerMoveRef.current(asPointer(t, scroller, event));
1810
1790
  }
1811
1791
  } else {
1812
1792
  armed.contentEndY = null;
@@ -1826,7 +1806,7 @@ export function useSheetGestures({
1826
1806
  );
1827
1807
  const target = event.currentTarget as HTMLElement;
1828
1808
  if (t) {
1829
- endDragRef.current(asPointer(t, target));
1809
+ endDragRef.current(asPointer(t, target, event));
1830
1810
  } else if (event.touches.length === 0) {
1831
1811
  // Some interrupted multi-touch sequences omit the active touch from
1832
1812
  // changedTouches. If no fingers remain, the drag cannot finish later.
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import {useMemo, type ReactNode} from 'react';
20
- import {createLayerScopedContext as createContext} from '../Layer/layerScopedContext';
20
+ import {createLayerScopedContext} from '../Layer/layerScopedContext';
21
21
  import * as stylex from '@stylexjs/stylex';
22
22
  import {spacingVars} from '../theme/tokens.stylex';
23
23
  import {mergeProps} from '../utils';
@@ -55,10 +55,11 @@ export interface BreadcrumbContextValue {
55
55
  separator: ReactNode;
56
56
  }
57
57
 
58
- export const BreadcrumbContext = createContext<BreadcrumbContextValue>({
59
- variant: 'default',
60
- separator: '/',
61
- });
58
+ export const BreadcrumbContext =
59
+ createLayerScopedContext<BreadcrumbContextValue>('BreadcrumbContext', 1, {
60
+ variant: 'default',
61
+ separator: '/',
62
+ });
62
63
  BreadcrumbContext.displayName = 'BreadcrumbContext';
63
64
 
64
65
  // =============================================================================
@@ -151,7 +151,7 @@ export const docs = {
151
151
  {
152
152
  name: 'isDisabled',
153
153
  type: 'boolean',
154
- description: 'Disables the button. When a tooltip is present, uses aria-disabled instead of native disabled so the button stays focusable.',
154
+ description: 'Disables the button. Uses aria-disabled instead of native disabled so the button stays focusable.',
155
155
  default: 'false',
156
156
  },
157
157
  {
@@ -351,7 +351,7 @@ export const docsZh = {
351
351
  {
352
352
  name: 'isDisabled',
353
353
  type: 'boolean',
354
- description: '禁用按钮。存在工具提示时,使用 aria-disabled 代替原生 disabled 以保持可聚焦。',
354
+ description: '禁用按钮。使用 aria-disabled 代替原生 disabled 以保持可聚焦。',
355
355
  default: 'false',
356
356
  },
357
357
  {name: 'icon', type: 'ReactNode', description: '图标元素。未显式指定尺寸的 Astryx Icon 在 sm/md 按钮中默认为 sm,在 lg 按钮中默认为 md。仅提供 icon 而不提供 children 时,按钮渲染为正方形的纯图标按钮。'},
@@ -430,6 +430,6 @@ export const docsDense = {
430
430
  tooltip: 'tooltip on hover',
431
431
  onClick: 'standard click handler; fires before clickAction',
432
432
  clickAction: 'async click handler; shows loading while promise pending',
433
- isDisabled: 'disables button; uses aria-disabled when tooltip present',
433
+ isDisabled: 'disables button; uses aria-disabled instead of native disabled',
434
434
  },
435
435
  };
@@ -769,12 +769,6 @@ export function Button({
769
769
  // (credit @AKnassa, #4879), which is exactly the bug this PR fixes.
770
770
  const renderAsLink = href != null && !isTrueDisabled;
771
771
 
772
- // Use aria-disabled (button stays focusable) when busy-only, or when a
773
- // tooltip is present so keyboard users can still reach it. A genuinely
774
- // isDisabled/group-disabled button (not busy) keeps native disabled.
775
- const useAriaDisabled =
776
- buttonDisabled && (isBusyOnlyDisabled || tooltip != null);
777
-
778
772
  // Attach tooltip behavior via the hook rather than wrapping the button in a
779
773
  // <Tooltip> element. The hook adds hover/focus triggers to the button itself,
780
774
  // so no extra DOM node is inserted — the button stays a direct child of its
@@ -790,15 +784,9 @@ export function Button({
790
784
  // a re-click while pending starts a fresh action that interrupts the prior.
791
785
  if (buttonDisabled || (actionInFlightRef.current && !isInterruptible)) {
792
786
  e.preventDefault();
793
- // A native `disabled` element never dispatches a click at all, so it
794
- // never reaches a wrapping element's own handler either. An
795
- // aria-disabled button (busy-only, or with a tooltip) is still a real,
796
- // interactive element the DOM keeps dispatching clicks on —
797
- // preventDefault alone only cancels the button's OWN default action
798
- // (form submit, link navigation), not propagation. Without this, an
799
- // unavailable Button inside a clickable row/card/backdrop still
800
- // triggers that ancestor's action, which the previously native-disabled
801
- // control never did.
787
+ // An aria-disabled button still receives clicks. preventDefault cancels
788
+ // only its own default action, such as a form submit. Stop propagation
789
+ // so a clickable ancestor does not act.
802
790
  e.stopPropagation();
803
791
  return;
804
792
  }
@@ -815,9 +803,9 @@ export function Button({
815
803
  }
816
804
  };
817
805
 
818
- // When aria-disabled, suppress activation keys (Enter/Space) but allow
819
- // other keys (Escape, arrows) to reach consumer handlers.
820
- const handleKeyDown = useAriaDisabled
806
+ // A disabled button cancels Enter and Space, its activation keys. Other
807
+ // keys, such as Escape and the arrows, still reach the caller's handler.
808
+ const handleKeyDown = buttonDisabled
821
809
  ? (e: React.KeyboardEvent<HTMLButtonElement>) => {
822
810
  if (e.key === 'Enter' || e.key === ' ') {
823
811
  e.preventDefault();
@@ -846,7 +834,7 @@ export function Button({
846
834
  isGroupTracked && styles.trackedOverlay,
847
835
  buttonDisabled && styles.inactive,
848
836
  isTrueDisabled && styles.disabled,
849
- useAriaDisabled && styles.ariaDisabled,
837
+ buttonDisabled && styles.ariaDisabled,
850
838
  renderAsLink && styles.link,
851
839
  !buttonGroup &&
852
840
  (isGroupTracked ? styles.pressableTracked : styles.pressable),
@@ -1004,7 +992,7 @@ export function Button({
1004
992
  // A caller's own busy or disabled state is kept, so a component that
1005
993
  // hands these props to a Button (a caller-rendered trigger) is heard.
1006
994
  aria-busy={isLoadingState || props['aria-busy'] || undefined}
1007
- aria-disabled={useAriaDisabled || props['aria-disabled'] || undefined}
995
+ aria-disabled={buttonDisabled || props['aria-disabled'] || undefined}
1008
996
  onClick={handleClick}
1009
997
  {...(handleKeyDown ? {onKeyDown: handleKeyDown} : null)}>
1010
998
  {buttonContent}
@@ -1015,7 +1003,6 @@ export function Button({
1015
1003
  <button
1016
1004
  ref={mergedButtonRef}
1017
1005
  type={type}
1018
- disabled={useAriaDisabled ? undefined : buttonDisabled}
1019
1006
  {...(inputGroup != null && buttonGroup == null
1020
1007
  ? inputGroupItemProps
1021
1008
  : undefined)}
@@ -1023,13 +1010,14 @@ export function Button({
1023
1010
  {...pressFeedback}
1024
1011
  {...groupItemProps}
1025
1012
  {...props}
1013
+ {...(isTrueDisabled ? {name: undefined} : null)}
1026
1014
  {...ariaLabelProp}
1027
1015
  {...describedByProp}
1028
1016
  {...edgeCompAttr}
1029
1017
  // A caller's own busy or disabled state is kept, so a component that
1030
1018
  // hands these props to a Button (a caller-rendered trigger) is heard.
1031
1019
  aria-busy={isLoadingState || props['aria-busy'] || undefined}
1032
- aria-disabled={useAriaDisabled || props['aria-disabled'] || undefined}
1020
+ aria-disabled={buttonDisabled || props['aria-disabled'] || undefined}
1033
1021
  onClick={handleClick}
1034
1022
  {...(handleKeyDown ? {onKeyDown: handleKeyDown} : null)}>
1035
1023
  {buttonContent}
@@ -4,14 +4,14 @@
4
4
 
5
5
  /**
6
6
  * @file buttonHitArea.ts
7
- * @input Uses React createContext and the touch hit-area options type
7
+ * @input Uses createSharedContext and the touch hit-area options type
8
8
  * @output Exports ButtonHitAreaContext, the touch hit-area options a Button
9
9
  * passes to useTouchHitArea, and BUTTON_HIT_AREA, their default
10
10
  * @position Internal to Core. A Core part that renders a Button and needs a
11
11
  * different band, such as InputClearButton, provides its own options.
12
12
  */
13
13
 
14
- import {createContext} from 'react';
14
+ import {createSharedContext} from '../utils/sharedContext';
15
15
  import type {TouchHitAreaOptions} from '../utils/touchHitArea';
16
16
 
17
17
  // The band is on the content wrapper, so a band tap lands on a descendant.
@@ -21,6 +21,9 @@ export const BUTTON_HIT_AREA: TouchHitAreaOptions = {
21
21
  ownsDescendantTouches: false,
22
22
  };
23
23
 
24
- export const ButtonHitAreaContext =
25
- createContext<TouchHitAreaOptions>(BUTTON_HIT_AREA);
24
+ export const ButtonHitAreaContext = createSharedContext<TouchHitAreaOptions>(
25
+ 'ButtonHitAreaContext',
26
+ 1,
27
+ BUTTON_HIT_AREA,
28
+ );
26
29
  ButtonHitAreaContext.displayName = 'ButtonHitAreaContext';
@@ -95,7 +95,7 @@ export const docs = {
95
95
  {guidance: false, description: "Don't nest ButtonGroups. If you need multiple groups, place them side by side with a gap."},
96
96
  {guidance: true, description: 'Name the group for what its buttons act on. The label is the group\'s accessible name and a screen reader reads it before each member.'},
97
97
  {guidance: true, description: 'Keep the group a single Tab stop. Arrow keys move between members along the orientation, and Home/End jump to the ends. This is the WAI-ARIA APG roving tabindex technique: https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex'},
98
- {guidance: false, description: "Don't disable the group to show that an action is in flight. A disabled member drops focus, so a keyboard user loses their place; leave the group enabled and show progress on the button that started the work."},
98
+ {guidance: false, description: "Don't disable the group to show that an action is in flight. Leave the group enabled and show progress on the button that started the work."},
99
99
  ],
100
100
  anatomy: [
101
101
  {name: 'Button', required: true, description: 'One or more Button or IconButton children that form the connected group.'},
@@ -136,7 +136,7 @@ export const docsZh = {
136
136
  {guidance: false, description: '不要嵌套 ButtonGroup。如需多个组,请并排放置并留有间隔。'},
137
137
  {guidance: true, description: '按钮组的标签应说明这些按钮作用于什么。该标签是按钮组的无障碍名称,屏幕阅读器会在每个成员之前朗读它。'},
138
138
  {guidance: true, description: '按钮组是单个 Tab 停靠点。方向键沿排列方向在成员间移动焦点,Home/End 跳到首尾,禁用成员会被跳过——即 WAI-ARIA APG 的 roving tabindex 技术。'},
139
- {guidance: false, description: '不要用禁用整个按钮组来表示操作进行中。禁用的成员会失去焦点,键盘用户会丢失位置;请保持按钮组可用,并在发起操作的按钮上显示进度。'},
139
+ {guidance: false, description: '不要用禁用整个按钮组来表示操作进行中。请保持按钮组可用,并在发起操作的按钮上显示进度。'},
140
140
  ],
141
141
  anatomy: [
142
142
  {name: '按钮', required: true, description: '一个或多个 Button 或 IconButton 子元素,形成连接的组。'},
@@ -161,7 +161,7 @@ export const docsDense = {
161
161
  {guidance: true, description: 'Label the group for what its buttons act on; it is the accessible name.'},
162
162
  {guidance: true, description: 'Single Tab stop; arrows move between members, Home/End to ends (APG roving tabindex).'},
163
163
  {guidance: true, description: 'Under the touch presentation a press tracks like a menu: slide across, the lifted button runs, a lift outside runs nothing. A mouse press acts as a native button\'s. Finger targets grow toward 44 px, up to half the gap to a neighbour; a menu trigger keeps its own opening.'},
164
- {guidance: false, description: "Don't disable the group for an in-flight action; a disabled member drops focus."},
164
+ {guidance: false, description: "Don't disable the group for an in-flight action; show progress on the active button instead."},
165
165
  ],
166
166
  },
167
167
  components: [
@@ -28,7 +28,7 @@ import type {ButtonSize} from '../Button';
28
28
  import {radiusVars, shadowVars} from '../theme/tokens.stylex';
29
29
  import type {Elevation} from '../utils/types';
30
30
  import {SizeProvider, useSize} from '../SizeContext/SizeContext';
31
- import {useListFocus} from '../hooks/useListFocus';
31
+ import {oneTabStopAmong, useInternalListFocus} from '../hooks/useListFocus';
32
32
  import {PressGroupContext} from '../hooks/pressGroupContext';
33
33
  import {
34
34
  GROUP_PRESS_POINTERS,
@@ -137,6 +137,16 @@ const elevationStyles = stylex.create({
137
137
  // Component
138
138
  // =============================================================================
139
139
 
140
+ // Roving rewrites `tabindex` on every item, so the selector cannot key off
141
+ // a value: `[tabindex="0"]` would drop each member the moment it is stamped
142
+ // -1. `a[href]` catches a Button rendered with `href`.
143
+ const MEMBER_SELECTOR = 'button, a[href], [tabindex]';
144
+
145
+ const keepDisabledGroupStop = oneTabStopAmong(
146
+ MEMBER_SELECTOR,
147
+ '[role="group"], [popover]',
148
+ );
149
+
140
150
  /**
141
151
  * Groups buttons with connected styling — shared borders, proper border-radius
142
152
  * handling (only on outer edges), and horizontal or vertical orientation.
@@ -189,21 +199,22 @@ export function ButtonGroup({
189
199
  }: ButtonGroupProps): ReactNode {
190
200
  const size = useSize(sizeProp, 'md');
191
201
 
192
- const {listRef, handleKeyDown, handleFocus} = useListFocus<HTMLDivElement>({
193
- // Roving rewrites `tabindex` on every item, so the selector cannot key off
194
- // a value: `[tabindex="0"]` would drop each member the moment it is
195
- // stamped -1. `a[href]` catches a Button rendered with `href`.
196
- itemSelector: 'button, a[href], [tabindex]',
197
- // A member's layer renders inline inside the group (useLayer does not
198
- // portal it), so a key pressed in an open DropdownMenu bubbles here. The
199
- // boundary is the group's own root or any layer, whichever is nearer to
200
- // the target. Naming the group's own root is what keeps a group rendered
201
- // inside a Popover or Toast working: bailing on any [popover] ancestor
202
- // instead would swallow every arrow key it owns.
203
- boundarySelector: '[role="group"], [popover]',
204
- orientation,
205
- hasRovingTabIndex: true,
206
- });
202
+ const {listRef, handleKeyDown, handleFocus} =
203
+ useInternalListFocus<HTMLDivElement>({
204
+ itemSelector: MEMBER_SELECTOR,
205
+ // A member's layer renders inline inside the group (useLayer does not
206
+ // portal it), so a key pressed in an open DropdownMenu bubbles here. The
207
+ // boundary is the group's own root or any layer, whichever is nearer to
208
+ // the target. Naming the group's own root is what keeps a group rendered
209
+ // inside a Popover or Toast working: bailing on any [popover] ancestor
210
+ // instead would swallow every arrow key it owns.
211
+ boundarySelector: '[role="group"], [popover]',
212
+ orientation,
213
+ hasRovingTabIndex: true,
214
+ // A group of disabled buttons keeps its one Tab stop, so a keyboard user
215
+ // still reaches it. Its members are focusable while disabled.
216
+ tabStopOrder: keepDisabledGroupStop,
217
+ });
207
218
 
208
219
  const contextValue = useMemo(
209
220
  () => ({orientation, isDisabled}),
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import {use} from 'react';
13
- import {createLayerScopedContext as createContext} from '../Layer/layerScopedContext';
13
+ import {createLayerScopedContext} from '../Layer/layerScopedContext';
14
14
 
15
15
  export type ButtonGroupOrientation = 'horizontal' | 'vertical';
16
16
 
@@ -19,9 +19,12 @@ export interface ButtonGroupContextValue {
19
19
  isDisabled: boolean;
20
20
  }
21
21
 
22
- export const ButtonGroupContext = createContext<ButtonGroupContextValue | null>(
23
- null,
24
- );
22
+ export const ButtonGroupContext =
23
+ createLayerScopedContext<ButtonGroupContextValue | null>(
24
+ 'ButtonGroupContext',
25
+ 1,
26
+ null,
27
+ );
25
28
  ButtonGroupContext.displayName = 'ButtonGroupContext';
26
29
 
27
30
  /**
@@ -53,7 +53,7 @@ import {Button} from '../Button';
53
53
  import {Icon} from '../Icon';
54
54
  import {useLayer} from '../Layer';
55
55
  import {useAttachment} from '../hooks/useAttachment';
56
- import {useScrollOverflow} from '../hooks/useScrollOverflow';
56
+ import {useShownScrollOverflow} from '../hooks/useScrollOverflow';
57
57
  import {isRtlElement} from '../hooks/isRtlElement';
58
58
  import type {BaseProps} from '../BaseProps';
59
59
  import {mergeProps, rtlStyles} from '../utils';
@@ -65,6 +65,7 @@ import {
65
65
  attachSnapPaging,
66
66
  isSnapPaging,
67
67
  moveHeldSnapPaging,
68
+ moveSnapPaging,
68
69
  nearestStop,
69
70
  type SnapPaging,
70
71
  snapStops,
@@ -408,8 +409,8 @@ export function Carousel({
408
409
  // transition it is allowed to act on.
409
410
  const focusedNavRef = useRef<'start' | 'end' | null>(null);
410
411
  const prevCanScrollRef = useRef<{start: boolean; end: boolean} | null>(null);
411
- const {scrollRef, overflowStart, overflowEnd, hasOverflow} =
412
- useScrollOverflow();
412
+ const {scrollRef, followShown, overflowStart, overflowEnd, hasOverflow} =
413
+ useShownScrollOverflow();
413
414
 
414
415
  // Children.toArray drops null/undefined/boolean children and assigns
415
416
  // stable keys, so slide numbering ("Slide N of M") matches what actually
@@ -447,12 +448,13 @@ export function Carousel({
447
448
  setAttachedPaging(snapPaging);
448
449
  }
449
450
  // Attaches snap paging to the scroll area, and follows a replaced one.
451
+ // While the paging holds the row, the edges follow the row as shown.
450
452
  useAttachment(
451
453
  scrollElRef,
452
454
  scroller =>
453
455
  attachedPaging == null
454
456
  ? () => {}
455
- : attachSnapPaging(attachedPaging, scroller),
457
+ : attachSnapPaging(attachedPaging, scroller, followShown),
456
458
  attachedPaging,
457
459
  );
458
460
  // React's wheel listener is passive, so it can't stop the browser's own
@@ -506,9 +508,10 @@ export function Carousel({
506
508
  if (!el) {
507
509
  return;
508
510
  }
509
- // While a flick's drag or settle holds the row, the paging moves it.
511
+ // Under snap paging the paging moves the row, held or at rest. A touch
512
+ // then catches the move, and the release rests on a page.
510
513
  if (
511
- moveHeldSnapPaging(el, (at, end) =>
514
+ moveSnapPaging(el, (at, end) =>
512
515
  pagingStep(el, at, end, direction, hasLoop && hasOverflow),
513
516
  )
514
517
  ) {
@@ -589,8 +592,15 @@ export function Carousel({
589
592
  const delta = isRtlElement(el)
590
593
  ? itemRect.right - containerRect.right
591
594
  : itemRect.left - containerRect.left;
595
+ // Under snap paging the row goes to the item's stop, inside the scroll
596
+ // padding, so the hand-back's snap does not pull it back.
592
597
  if (
593
- moveHeldSnapPaging(el, at => at + (isRtlElement(el) ? -delta : delta))
598
+ moveSnapPaging(el, (at, end) =>
599
+ nearestStop(
600
+ snapStops(el, at, end),
601
+ at + (isRtlElement(el) ? -delta : delta),
602
+ ),
603
+ )
594
604
  ) {
595
605
  return;
596
606
  }
@@ -771,6 +781,9 @@ export function Carousel({
771
781
  layer.render(
772
782
  <>
773
783
  <div
784
+ // A hidden button is never a Tab stop or in the a11y tree. Its
785
+ // disabled state alone would keep it focusable.
786
+ inert={!canScrollStart || undefined}
774
787
  {...stylex.props(
775
788
  styles.buttonPill,
776
789
  styles.buttonPillStart,
@@ -790,18 +803,18 @@ export function Carousel({
790
803
  size="sm"
791
804
  isIconOnly
792
805
  // Disabled when there's nothing to scroll toward. Keeps the
793
- // button mounted (stable layout) but removes it from the tab
794
- // order and a11y tree while it's visually hidden, so keyboard
795
- // users don't land on an invisible control. The Effect above
796
- // hands focus to the scroll area when the state behind this
797
- // one flips it disabled.
806
+ // button mounted (stable layout). The Effect above hands focus
807
+ // to the scroll area when the state behind this one flips it
808
+ // disabled.
798
809
  isDisabled={!canScrollStart}
799
810
  onFocus={() => {
800
811
  focusedNavRef.current = 'start';
801
812
  }}
802
813
  onBlur={event => {
803
814
  // A disabled button was blurred by the commit, not the person.
804
- if (!event.currentTarget.disabled) {
815
+ if (
816
+ event.currentTarget.getAttribute('aria-disabled') !== 'true'
817
+ ) {
805
818
  focusedNavRef.current = null;
806
819
  }
807
820
  }}
@@ -810,6 +823,9 @@ export function Carousel({
810
823
  />
811
824
  </div>
812
825
  <div
826
+ // A hidden button is never a Tab stop or in the a11y tree. Its
827
+ // disabled state alone would keep it focusable.
828
+ inert={!canScrollEnd || undefined}
813
829
  {...stylex.props(
814
830
  styles.buttonPill,
815
831
  styles.buttonPillEnd,
@@ -829,14 +845,16 @@ export function Carousel({
829
845
  size="sm"
830
846
  isIconOnly
831
847
  // See "Scroll left" — disabled while visually hidden so the
832
- // button stays mounted but out of the tab order / a11y tree.
848
+ // button stays mounted.
833
849
  isDisabled={!canScrollEnd}
834
850
  onFocus={() => {
835
851
  focusedNavRef.current = 'end';
836
852
  }}
837
853
  onBlur={event => {
838
854
  // A disabled button was blurred by the commit, not the person.
839
- if (!event.currentTarget.disabled) {
855
+ if (
856
+ event.currentTarget.getAttribute('aria-disabled') !== 'true'
857
+ ) {
840
858
  focusedNavRef.current = null;
841
859
  }
842
860
  }}
@@ -12,8 +12,9 @@
12
12
  * ChatComposerInput, ChatSendButton, and custom inputs.
13
13
  */
14
14
 
15
- import {createContext, use, type RefObject} from 'react';
15
+ import {use, type RefObject} from 'react';
16
16
  import {createLayerScopedContext} from '../Layer/layerScopedContext';
17
+ import {createSharedContext} from '../utils/sharedContext';
17
18
 
18
19
  export type ChatMessageSender = 'user' | 'assistant' | 'system';
19
20
  export type ChatDensity = 'compact' | 'balanced' | 'spacious';
@@ -24,7 +25,11 @@ export interface ChatMessageContextValue {
24
25
  }
25
26
 
26
27
  export const ChatMessageContext =
27
- createLayerScopedContext<ChatMessageContextValue | null>(null);
28
+ createLayerScopedContext<ChatMessageContextValue | null>(
29
+ 'ChatMessageContext',
30
+ 1,
31
+ null,
32
+ );
28
33
  ChatMessageContext.displayName = 'ChatMessageContext';
29
34
 
30
35
  export function useChatMessageContext(): ChatMessageContextValue | null {
@@ -36,7 +41,11 @@ export interface ChatListContextValue {
36
41
  }
37
42
 
38
43
  export const ChatListContext =
39
- createLayerScopedContext<ChatListContextValue | null>(null);
44
+ createLayerScopedContext<ChatListContextValue | null>(
45
+ 'ChatListContext',
46
+ 1,
47
+ null,
48
+ );
40
49
  ChatListContext.displayName = 'ChatListContext';
41
50
 
42
51
  export function useChatListContext(): ChatListContextValue | null {
@@ -83,7 +92,11 @@ export interface ChatComposerContextValue {
83
92
  }
84
93
 
85
94
  export const ChatComposerContext =
86
- createContext<ChatComposerContextValue | null>(null);
95
+ createSharedContext<ChatComposerContextValue | null>(
96
+ 'ChatComposerContext',
97
+ 1,
98
+ null,
99
+ );
87
100
  ChatComposerContext.displayName = 'ChatComposerContext';
88
101
 
89
102
  export function useChatComposerContext(): ChatComposerContextValue | null {
@@ -101,9 +114,12 @@ export interface ChatLayoutContextValue {
101
114
  contentRef: (el: HTMLElement | null) => void;
102
115
  }
103
116
 
104
- export const ChatLayoutContext = createContext<ChatLayoutContextValue | null>(
105
- null,
106
- );
117
+ export const ChatLayoutContext =
118
+ createSharedContext<ChatLayoutContextValue | null>(
119
+ 'ChatLayoutContext',
120
+ 1,
121
+ null,
122
+ );
107
123
  ChatLayoutContext.displayName = 'ChatLayoutContext';
108
124
 
109
125
  export function useChatLayoutContext(): ChatLayoutContextValue | null {