@astryxdesign/core 0.0.15 → 0.1.0-canary.08d4cf4

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 (384) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +8 -10
  3. package/dist/AlertDialog/AlertDialog.js +2 -2
  4. package/dist/AppShell/AppShell.js +5 -5
  5. package/dist/AspectRatio/AspectRatio.js +2 -2
  6. package/dist/Avatar/Avatar.js +2 -2
  7. package/dist/Avatar/AvatarStatusDot.js +2 -2
  8. package/dist/AvatarGroup/AvatarGroup.js +2 -2
  9. package/dist/AvatarGroup/AvatarGroupOverflow.js +3 -3
  10. package/dist/Badge/Badge.js +2 -2
  11. package/dist/Banner/Banner.d.ts +2 -2
  12. package/dist/Banner/Banner.js +6 -6
  13. package/dist/Blockquote/Blockquote.js +2 -2
  14. package/dist/Breadcrumbs/BreadcrumbItem.js +3 -3
  15. package/dist/Breadcrumbs/Breadcrumbs.js +2 -2
  16. package/dist/Button/Button.js +2 -2
  17. package/dist/ButtonGroup/ButtonGroup.js +2 -2
  18. package/dist/Calendar/Calendar.js +3 -3
  19. package/dist/Card/Card.js +2 -2
  20. package/dist/Carousel/Carousel.js +2 -2
  21. package/dist/Center/Center.js +2 -2
  22. package/dist/Chat/ChatComposer.js +2 -2
  23. package/dist/Chat/ChatComposerDrawer.js +2 -2
  24. package/dist/Chat/ChatComposerInput.js +2 -2
  25. package/dist/Chat/ChatLayout.js +2 -2
  26. package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
  27. package/dist/Chat/ChatLayoutScrollButton.js +5 -1
  28. package/dist/Chat/ChatMessage.js +2 -2
  29. package/dist/Chat/ChatMessageBubble.js +2 -2
  30. package/dist/Chat/ChatMessageList.js +2 -2
  31. package/dist/Chat/ChatMessageMetadata.js +2 -2
  32. package/dist/Chat/ChatSendButton.js +2 -2
  33. package/dist/Chat/ChatSystemMessage.js +3 -3
  34. package/dist/Chat/ChatTokenizedText.js +3 -3
  35. package/dist/Chat/ChatToolCalls.js +3 -3
  36. package/dist/Chat/useTriggerMenu.js +2 -2
  37. package/dist/CheckboxInput/CheckboxInput.js +3 -3
  38. package/dist/CheckboxList/CheckboxList.js +2 -2
  39. package/dist/Citation/Citation.js +3 -3
  40. package/dist/ClickableCard/ClickableCard.js +2 -2
  41. package/dist/Code/Code.js +2 -2
  42. package/dist/CodeBlock/CodeBlock.js +2 -2
  43. package/dist/Collapsible/Collapsible.js +2 -2
  44. package/dist/CommandPalette/CommandPaletteFooter.js +2 -2
  45. package/dist/CommandPalette/CommandPaletteGroup.js +2 -2
  46. package/dist/CommandPalette/CommandPaletteInput.js +2 -2
  47. package/dist/CommandPalette/CommandPaletteItem.js +2 -2
  48. package/dist/CommandPalette/CommandPaletteList.js +2 -2
  49. package/dist/ContextMenu/ContextMenu.js +4 -4
  50. package/dist/DateInput/DateInput.js +2 -2
  51. package/dist/DateRangeInput/DateRangeInput.js +2 -2
  52. package/dist/DateTimeInput/DateTimeInput.js +2 -2
  53. package/dist/Dialog/Dialog.js +3 -3
  54. package/dist/Divider/Divider.js +2 -2
  55. package/dist/DropdownMenu/DropdownMenu.js +4 -4
  56. package/dist/DropdownMenu/DropdownMenuItem.js +2 -2
  57. package/dist/DropdownMenu/{renderXDSDropdownItems.d.ts → renderDropdownItems.d.ts} +3 -3
  58. package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -0
  59. package/dist/DropdownMenu/{renderXDSDropdownItems.js → renderDropdownItems.js} +2 -2
  60. package/dist/EmptyState/EmptyState.js +2 -2
  61. package/dist/Field/Field.js +3 -3
  62. package/dist/Field/FieldLabel.js +2 -2
  63. package/dist/FieldStatus/FieldStatus.js +2 -2
  64. package/dist/FileInput/FileInput.js +2 -2
  65. package/dist/FormLayout/FormLayout.js +2 -2
  66. package/dist/Grid/Grid.js +3 -3
  67. package/dist/Grid/GridSpan.js +2 -2
  68. package/dist/Heading/Heading.js +2 -2
  69. package/dist/HoverCard/useHoverCard.js +2 -2
  70. package/dist/Icon/Icon.js +3 -3
  71. package/dist/InputGroup/InputGroup.js +2 -2
  72. package/dist/InputGroup/InputGroupText.js +2 -2
  73. package/dist/Item/Item.js +2 -2
  74. package/dist/Kbd/Kbd.js +2 -2
  75. package/dist/Layer/useLayer.d.ts +2 -2
  76. package/dist/Layout/Layout.js +2 -2
  77. package/dist/Layout/LayoutContent.js +2 -2
  78. package/dist/Layout/LayoutFooter.js +2 -2
  79. package/dist/Layout/LayoutHeader.js +2 -2
  80. package/dist/Layout/LayoutPanel.js +2 -2
  81. package/dist/Lightbox/Lightbox.js +2 -2
  82. package/dist/Link/Link.js +3 -3
  83. package/dist/List/List.js +2 -2
  84. package/dist/List/ListItem.js +2 -2
  85. package/dist/Markdown/Markdown.js +3 -3
  86. package/dist/MetadataList/MetadataList.js +2 -2
  87. package/dist/MetadataList/MetadataListItem.js +3 -3
  88. package/dist/MobileNav/MobileNav.js +2 -2
  89. package/dist/MultiSelector/MultiSelector.js +2 -2
  90. package/dist/NavIcon/NavIcon.js +2 -2
  91. package/dist/NavMenu/NavHeadingMenu.js +2 -2
  92. package/dist/NavMenu/NavHeadingMenuItem.js +2 -2
  93. package/dist/NumberInput/NumberInput.js +2 -2
  94. package/dist/Outline/Outline.d.ts +3 -2
  95. package/dist/Outline/Outline.d.ts.map +1 -1
  96. package/dist/Outline/Outline.js +27 -8
  97. package/dist/Outline/useScrollSpy.d.ts +14 -1
  98. package/dist/Outline/useScrollSpy.d.ts.map +1 -1
  99. package/dist/Outline/useScrollSpy.js +161 -50
  100. package/dist/OverflowList/OverflowList.js +2 -2
  101. package/dist/Overlay/Overlay.js +2 -2
  102. package/dist/Overlay/OverlayScrim.js +2 -2
  103. package/dist/Pagination/Pagination.js +3 -3
  104. package/dist/Popover/Popover.js +4 -4
  105. package/dist/PowerSearch/PowerSearch.js +2 -2
  106. package/dist/ProgressBar/ProgressBar.js +5 -5
  107. package/dist/RadioList/RadioList.js +2 -2
  108. package/dist/RadioList/RadioListItem.js +4 -4
  109. package/dist/Resizable/ResizeHandle.js +4 -4
  110. package/dist/Resizable/useResizable.d.ts.map +1 -1
  111. package/dist/Resizable/useResizable.js +1 -5
  112. package/dist/Section/Section.js +2 -2
  113. package/dist/SegmentedControl/SegmentedControl.js +2 -2
  114. package/dist/SegmentedControl/SegmentedControlItem.js +2 -2
  115. package/dist/SelectableCard/SelectableCard.js +2 -2
  116. package/dist/Selector/Selector.d.ts.map +1 -1
  117. package/dist/Selector/Selector.js +3 -3
  118. package/dist/Selector/SelectorOption.js +2 -2
  119. package/dist/SideNav/SideNav.js +3 -3
  120. package/dist/SideNav/SideNavHeading.js +9 -9
  121. package/dist/SideNav/SideNavItem.js +3 -3
  122. package/dist/SideNav/SideNavSection.js +2 -2
  123. package/dist/Skeleton/Skeleton.js +2 -2
  124. package/dist/Slider/Slider.js +4 -4
  125. package/dist/Spinner/Spinner.js +3 -3
  126. package/dist/Stack/Stack.js +2 -2
  127. package/dist/Stack/StackItem.js +2 -2
  128. package/dist/StatusDot/StatusDot.js +2 -2
  129. package/dist/Switch/Switch.js +4 -4
  130. package/dist/TabList/Tab.js +3 -3
  131. package/dist/TabList/TabList.js +2 -2
  132. package/dist/TabList/TabMenu.js +5 -5
  133. package/dist/Table/BaseTable.js +2 -2
  134. package/dist/Table/Table.js +3 -3
  135. package/dist/Table/TableBody.js +2 -2
  136. package/dist/Table/TableCell.js +3 -3
  137. package/dist/Table/TableFooter.js +2 -2
  138. package/dist/Table/TableHeader.js +2 -2
  139. package/dist/Table/TableHeaderCell.js +3 -3
  140. package/dist/Table/TableRow.js +3 -3
  141. package/dist/Text/Text.js +2 -2
  142. package/dist/TextArea/TextArea.js +2 -2
  143. package/dist/TextInput/TextInput.js +2 -2
  144. package/dist/Thumbnail/Thumbnail.js +2 -2
  145. package/dist/TimeInput/TimeInput.js +2 -2
  146. package/dist/Timestamp/Timestamp.js +2 -2
  147. package/dist/Toast/Toast.js +2 -2
  148. package/dist/ToggleButton/ToggleButton.d.ts +10 -3
  149. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  150. package/dist/ToggleButton/ToggleButton.js +66 -20
  151. package/dist/ToggleButton/ToggleButtonGroup.js +2 -2
  152. package/dist/Token/Token.js +4 -4
  153. package/dist/Tokenizer/Tokenizer.js +3 -3
  154. package/dist/Toolbar/Toolbar.js +2 -2
  155. package/dist/Tooltip/useTooltip.js +2 -2
  156. package/dist/TopNav/TopNav.js +3 -3
  157. package/dist/TopNav/TopNavHeading.js +7 -7
  158. package/dist/TopNav/TopNavItem.js +3 -3
  159. package/dist/TopNav/TopNavMegaMenu.js +3 -3
  160. package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +2 -2
  161. package/dist/TopNav/TopNavMegaMenuItem.js +3 -3
  162. package/dist/TopNav/TopNavMenu.js +2 -2
  163. package/dist/TreeList/TreeList.js +2 -2
  164. package/dist/TreeList/TreeListItem.js +2 -2
  165. package/dist/Typeahead/BaseTypeahead.js +2 -2
  166. package/dist/Typeahead/Typeahead.js +2 -2
  167. package/dist/Typeahead/TypeaheadItem.js +2 -2
  168. package/dist/docs-types.d.ts +3 -3
  169. package/dist/docs-types.d.ts.map +1 -1
  170. package/dist/naming.d.ts +1 -1
  171. package/dist/naming.js +1 -1
  172. package/dist/theme/Theme.js +1 -1
  173. package/dist/theme/defineTheme.d.ts +3 -3
  174. package/dist/theme/defineTheme.d.ts.map +1 -1
  175. package/dist/theme/defineTheme.js +1 -1
  176. package/dist/theme/index.d.ts +2 -2
  177. package/dist/theme/index.d.ts.map +1 -1
  178. package/dist/theme/index.js +2 -2
  179. package/dist/theme/syntax/defineSyntaxTheme.js +1 -1
  180. package/dist/theme/tokens.d.ts +1 -1
  181. package/dist/theme/tokens.js +4 -4
  182. package/dist/theme/useTheme.d.ts +2 -2
  183. package/dist/utils/dateParser.d.ts.map +1 -1
  184. package/dist/utils/dateParser.js +15 -2
  185. package/dist/utils/mergeProps.d.ts +3 -3
  186. package/dist/utils/mergeProps.js +4 -4
  187. package/dist/utils/parseStyleKey.d.ts +2 -2
  188. package/dist/utils/parseStyleKey.js +2 -2
  189. package/dist/utils/{xdsThemeProps.d.ts → themeProps.d.ts} +4 -4
  190. package/dist/utils/themeProps.d.ts.map +1 -0
  191. package/dist/utils/{xdsThemeProps.js → themeProps.js} +5 -5
  192. package/package.json +2 -2
  193. package/src/AlertDialog/AlertDialog.tsx +2 -2
  194. package/src/AppShell/AppShell.tsx +5 -5
  195. package/src/AspectRatio/AspectRatio.tsx +2 -2
  196. package/src/Avatar/Avatar.tsx +2 -2
  197. package/src/Avatar/AvatarStatusDot.tsx +2 -2
  198. package/src/AvatarGroup/AvatarGroup.tsx +2 -2
  199. package/src/AvatarGroup/AvatarGroupOverflow.tsx +3 -3
  200. package/src/Badge/Badge.tsx +2 -2
  201. package/src/Banner/Banner.tsx +6 -6
  202. package/src/Blockquote/Blockquote.tsx +2 -2
  203. package/src/Breadcrumbs/BreadcrumbItem.tsx +3 -3
  204. package/src/Breadcrumbs/Breadcrumbs.tsx +2 -2
  205. package/src/Button/Button.tsx +2 -2
  206. package/src/ButtonGroup/ButtonGroup.tsx +2 -2
  207. package/src/Calendar/Calendar.tsx +3 -3
  208. package/src/Card/Card.tsx +2 -2
  209. package/src/Carousel/Carousel.tsx +2 -2
  210. package/src/Center/Center.tsx +2 -2
  211. package/src/Chat/ChatComposer.tsx +2 -2
  212. package/src/Chat/ChatComposerDrawer.tsx +2 -2
  213. package/src/Chat/ChatComposerInput.tsx +2 -2
  214. package/src/Chat/ChatLayout.tsx +2 -2
  215. package/src/Chat/ChatLayoutScrollButton.tsx +7 -1
  216. package/src/Chat/ChatMessage.tsx +2 -2
  217. package/src/Chat/ChatMessageBubble.tsx +2 -2
  218. package/src/Chat/ChatMessageList.tsx +2 -2
  219. package/src/Chat/ChatMessageMetadata.tsx +2 -2
  220. package/src/Chat/ChatSendButton.tsx +2 -2
  221. package/src/Chat/ChatSystemMessage.tsx +3 -3
  222. package/src/Chat/ChatTokenizedText.tsx +3 -3
  223. package/src/Chat/ChatToolCalls.tsx +3 -3
  224. package/src/Chat/useTriggerMenu.tsx +2 -2
  225. package/src/CheckboxInput/CheckboxInput.tsx +3 -3
  226. package/src/CheckboxList/CheckboxList.tsx +2 -2
  227. package/src/Citation/Citation.tsx +3 -3
  228. package/src/ClickableCard/ClickableCard.tsx +2 -2
  229. package/src/Code/Code.tsx +2 -2
  230. package/src/CodeBlock/CodeBlock.tsx +2 -2
  231. package/src/Collapsible/Collapsible.tsx +2 -2
  232. package/src/Collapsible/useCollapsible.doc.mjs +2 -2
  233. package/src/CommandPalette/CommandPaletteFooter.tsx +2 -2
  234. package/src/CommandPalette/CommandPaletteGroup.tsx +2 -2
  235. package/src/CommandPalette/CommandPaletteInput.tsx +2 -2
  236. package/src/CommandPalette/CommandPaletteItem.tsx +2 -2
  237. package/src/CommandPalette/CommandPaletteList.tsx +2 -2
  238. package/src/ContextMenu/ContextMenu.tsx +4 -4
  239. package/src/DateInput/DateInput.test.tsx +68 -20
  240. package/src/DateInput/DateInput.tsx +2 -2
  241. package/src/DateRangeInput/DateRangeInput.tsx +2 -2
  242. package/src/DateTimeInput/DateTimeInput.tsx +2 -2
  243. package/src/Dialog/Dialog.tsx +3 -3
  244. package/src/Divider/Divider.doc.mjs +1 -1
  245. package/src/Divider/Divider.tsx +2 -2
  246. package/src/DropdownMenu/DropdownMenu.tsx +4 -4
  247. package/src/DropdownMenu/DropdownMenuItem.tsx +2 -2
  248. package/src/DropdownMenu/{renderXDSDropdownItems.tsx → renderDropdownItems.tsx} +2 -2
  249. package/src/EmptyState/EmptyState.tsx +2 -2
  250. package/src/Field/Field.tsx +3 -3
  251. package/src/Field/FieldLabel.tsx +2 -2
  252. package/src/FieldStatus/FieldStatus.tsx +2 -2
  253. package/src/FileInput/FileInput.tsx +2 -2
  254. package/src/FormLayout/FormLayout.doc.mjs +3 -3
  255. package/src/FormLayout/FormLayout.tsx +2 -2
  256. package/src/Grid/Grid.tsx +3 -3
  257. package/src/Grid/GridSpan.tsx +2 -2
  258. package/src/Heading/Heading.tsx +2 -2
  259. package/src/HoverCard/useHoverCard.tsx +2 -2
  260. package/src/Icon/Icon.doc.mjs +4 -4
  261. package/src/Icon/Icon.tsx +3 -3
  262. package/src/InputGroup/InputGroup.tsx +2 -2
  263. package/src/InputGroup/InputGroupText.tsx +2 -2
  264. package/src/Item/Item.doc.mjs +2 -2
  265. package/src/Item/Item.tsx +2 -2
  266. package/src/Kbd/Kbd.tsx +2 -2
  267. package/src/Layer/useLayer.tsx +2 -2
  268. package/src/Layout/Layout.tsx +2 -2
  269. package/src/Layout/LayoutContent.tsx +2 -2
  270. package/src/Layout/LayoutFooter.tsx +2 -2
  271. package/src/Layout/LayoutHeader.tsx +2 -2
  272. package/src/Layout/LayoutPanel.tsx +2 -2
  273. package/src/Lightbox/Lightbox.tsx +2 -2
  274. package/src/Link/Link.doc.mjs +3 -3
  275. package/src/Link/Link.tsx +3 -3
  276. package/src/Link/LinkProvider.doc.mjs +3 -3
  277. package/src/List/List.tsx +2 -2
  278. package/src/List/ListItem.tsx +2 -2
  279. package/src/Markdown/Markdown.doc.mjs +4 -4
  280. package/src/Markdown/Markdown.tsx +3 -3
  281. package/src/MetadataList/MetadataList.tsx +2 -2
  282. package/src/MetadataList/MetadataListItem.tsx +3 -3
  283. package/src/MobileNav/MobileNav.tsx +2 -2
  284. package/src/MoreMenu/MoreMenu.doc.mjs +0 -13
  285. package/src/MultiSelector/MultiSelector.tsx +2 -2
  286. package/src/NavIcon/NavIcon.tsx +2 -2
  287. package/src/NavMenu/NavHeadingMenu.tsx +2 -2
  288. package/src/NavMenu/NavHeadingMenuItem.tsx +2 -2
  289. package/src/NumberInput/NumberInput.tsx +2 -2
  290. package/src/Outline/Outline.doc.mjs +1 -1
  291. package/src/Outline/Outline.test.tsx +76 -38
  292. package/src/Outline/Outline.tsx +27 -8
  293. package/src/Outline/useScrollSpy.ts +196 -63
  294. package/src/OverflowList/OverflowList.tsx +2 -2
  295. package/src/Overlay/Overlay.tsx +2 -2
  296. package/src/Overlay/OverlayScrim.tsx +2 -2
  297. package/src/Pagination/Pagination.tsx +3 -3
  298. package/src/Popover/Popover.tsx +4 -4
  299. package/src/PowerSearch/PowerSearch.tsx +2 -2
  300. package/src/ProgressBar/ProgressBar.tsx +5 -5
  301. package/src/RadioList/RadioList.tsx +2 -2
  302. package/src/RadioList/RadioListItem.tsx +4 -4
  303. package/src/Resizable/Resizable.doc.mjs +2 -2
  304. package/src/Resizable/ResizeHandle.tsx +4 -4
  305. package/src/Resizable/useResizable.ts +1 -7
  306. package/src/Section/Section.tsx +2 -2
  307. package/src/SegmentedControl/SegmentedControl.tsx +2 -2
  308. package/src/SegmentedControl/SegmentedControlItem.tsx +2 -2
  309. package/src/SelectableCard/SelectableCard.tsx +2 -2
  310. package/src/Selector/Selector.tsx +7 -8
  311. package/src/Selector/SelectorOption.tsx +2 -2
  312. package/src/SideNav/SideNav.tsx +3 -3
  313. package/src/SideNav/SideNavHeading.tsx +9 -9
  314. package/src/SideNav/SideNavItem.tsx +3 -3
  315. package/src/SideNav/SideNavSection.tsx +2 -2
  316. package/src/Skeleton/Skeleton.tsx +2 -2
  317. package/src/Slider/Slider.tsx +4 -4
  318. package/src/Spinner/Spinner.tsx +3 -3
  319. package/src/Stack/Stack.tsx +2 -2
  320. package/src/Stack/StackItem.tsx +2 -2
  321. package/src/StatusDot/StatusDot.tsx +2 -2
  322. package/src/Switch/Switch.tsx +4 -4
  323. package/src/TabList/Tab.tsx +3 -3
  324. package/src/TabList/TabList.tsx +2 -2
  325. package/src/TabList/TabMenu.tsx +5 -5
  326. package/src/Table/BaseTable.tsx +2 -2
  327. package/src/Table/Table.doc.mjs +3 -3
  328. package/src/Table/Table.tsx +3 -3
  329. package/src/Table/TableBody.tsx +2 -2
  330. package/src/Table/TableCell.tsx +3 -3
  331. package/src/Table/TableFooter.tsx +2 -2
  332. package/src/Table/TableHeader.tsx +2 -2
  333. package/src/Table/TableHeaderCell.tsx +3 -3
  334. package/src/Table/TableRow.tsx +3 -3
  335. package/src/Text/Text.tsx +2 -2
  336. package/src/TextArea/TextArea.tsx +2 -2
  337. package/src/TextInput/TextInput.tsx +2 -2
  338. package/src/Thumbnail/Thumbnail.tsx +2 -2
  339. package/src/TimeInput/TimeInput.tsx +2 -2
  340. package/src/Timestamp/Timestamp.tsx +2 -2
  341. package/src/Toast/Toast.tsx +2 -2
  342. package/src/ToggleButton/ToggleButton.doc.mjs +2 -2
  343. package/src/ToggleButton/ToggleButton.test.tsx +148 -6
  344. package/src/ToggleButton/ToggleButton.tsx +85 -22
  345. package/src/ToggleButton/ToggleButtonGroup.tsx +2 -2
  346. package/src/Token/Token.tsx +4 -4
  347. package/src/Tokenizer/Tokenizer.tsx +3 -3
  348. package/src/Toolbar/Toolbar.doc.mjs +8 -7
  349. package/src/Toolbar/Toolbar.tsx +2 -2
  350. package/src/Tooltip/useTooltip.tsx +2 -2
  351. package/src/TopNav/TopNav.tsx +3 -3
  352. package/src/TopNav/TopNavHeading.tsx +7 -7
  353. package/src/TopNav/TopNavItem.tsx +3 -3
  354. package/src/TopNav/TopNavMegaMenu.tsx +3 -3
  355. package/src/TopNav/TopNavMegaMenuFeaturedCard.tsx +2 -2
  356. package/src/TopNav/TopNavMegaMenuItem.tsx +3 -3
  357. package/src/TopNav/TopNavMenu.tsx +2 -2
  358. package/src/TreeList/TreeList.tsx +2 -2
  359. package/src/TreeList/TreeListItem.tsx +2 -2
  360. package/src/Typeahead/BaseTypeahead.tsx +2 -2
  361. package/src/Typeahead/Typeahead.tsx +2 -2
  362. package/src/Typeahead/TypeaheadItem.tsx +2 -2
  363. package/src/docs-types.ts +3 -3
  364. package/src/hooks/useEntryAnimation.doc.mjs +3 -3
  365. package/src/hooks/useMediaQuery.doc.mjs +2 -2
  366. package/src/hooks/useStreamingText.doc.mjs +3 -3
  367. package/src/naming.ts +1 -1
  368. package/src/reset.css +1 -1
  369. package/src/tailwind-theme.css +1 -1
  370. package/src/theme/Theme.doc.mjs +2 -2
  371. package/src/theme/Theme.tsx +1 -1
  372. package/src/theme/defineTheme.ts +3 -3
  373. package/src/theme/index.ts +2 -2
  374. package/src/theme/syntax/defineSyntaxTheme.ts +1 -1
  375. package/src/theme/tokens.ts +4 -4
  376. package/src/theme/useTheme.ts +2 -2
  377. package/src/utils/dateParser.test.ts +26 -0
  378. package/src/utils/dateParser.ts +16 -2
  379. package/src/utils/mergeProps.ts +4 -4
  380. package/src/utils/parseStyleKey.ts +2 -2
  381. package/src/utils/{xdsThemeProps.test.ts → themeProps.test.ts} +12 -12
  382. package/src/utils/{xdsThemeProps.ts → themeProps.ts} +5 -5
  383. package/dist/DropdownMenu/renderXDSDropdownItems.d.ts.map +0 -1
  384. package/dist/utils/xdsThemeProps.d.ts.map +0 -1
@@ -21,7 +21,7 @@ import "../theme/tokens.stylex.js";
21
21
  import { spacingVars, colorVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
22
22
  import { MetadataListContext } from "./MetadataListContext.js";
23
23
  import { mergeProps } from "../utils/index.js";
24
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
24
+ import { themeProps } from "../utils/themeProps.js";
25
25
 
26
26
  // =============================================================================
27
27
  // Types
@@ -164,7 +164,7 @@ export function MetadataList({
164
164
  children: /*#__PURE__*/_jsxs("div", {
165
165
  ref: ref,
166
166
  "data-testid": testId,
167
- ...mergeProps(xdsThemeProps('metadata-list', {
167
+ ...mergeProps(themeProps('metadata-list', {
168
168
  columns: String(columns),
169
169
  orientation
170
170
  }), stylex.props(styles.root, xstyle), className, style),
@@ -21,7 +21,7 @@ import "../theme/tokens.stylex.js";
21
21
  import { colorVars, spacingVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
22
22
  import { MetadataListContext } from "./MetadataListContext.js";
23
23
  import { mergeProps } from "../utils/index.js";
24
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
24
+ import { themeProps } from "../utils/themeProps.js";
25
25
 
26
26
  // =============================================================================
27
27
  // Types
@@ -99,7 +99,7 @@ export function MetadataListItem({
99
99
  return /*#__PURE__*/_jsxs("div", {
100
100
  ref: ref,
101
101
  "data-testid": testId,
102
- ...mergeProps(xdsThemeProps('metadata-list-item'), stylex.props(styles.stackedWrapper, xstyle), className, style),
102
+ ...mergeProps(themeProps('metadata-list-item'), stylex.props(styles.stackedWrapper, xstyle), className, style),
103
103
  children: [/*#__PURE__*/_jsx("dt", {
104
104
  ...{
105
105
  className: "xv1l7n4 xjm74w1 xw6l6zx x1e4wzip x78zum5 x6s0dn4 x1txdalj x1ghz6dp x1717udv"
@@ -119,7 +119,7 @@ export function MetadataListItem({
119
119
  children: [/*#__PURE__*/_jsx("dt", {
120
120
  ref: ref,
121
121
  "data-testid": testId ? `${testId}-label` : undefined,
122
- ...mergeProps(xdsThemeProps('metadata-list-item'), stylex.props(styles.label, xstyle), className, style),
122
+ ...mergeProps(themeProps('metadata-list-item'), stylex.props(styles.label, xstyle), className, style),
123
123
  children: labelContent
124
124
  }), /*#__PURE__*/_jsx("dd", {
125
125
  "data-testid": testId ? `${testId}-value` : undefined,
@@ -34,7 +34,7 @@ import { Icon } from "../Icon/index.js";
34
34
  import { Heading } from "../Heading/Heading.js";
35
35
  import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
36
36
  import { mergeProps, mergeRefs } from "../utils/index.js";
37
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
37
+ import { themeProps } from "../utils/themeProps.js";
38
38
 
39
39
  // =============================================================================
40
40
  // Styles
@@ -259,7 +259,7 @@ export function MobileNav({
259
259
  "aria-label": label ?? (typeof header === 'string' ? header : 'Navigation'),
260
260
  onClick: handleDialogClick,
261
261
  onCancel: handleCancel,
262
- ...mergeProps(xdsThemeProps('mobile-nav', {
262
+ ...mergeProps(themeProps('mobile-nav', {
263
263
  side: resolvedSide
264
264
  }), stylex.props(styles.dialog, isOpen && styles.open, styles.backdrop, isOpen && styles.backdropOpen, xstyle)),
265
265
  children: /*#__PURE__*/_jsxs("div", {
@@ -28,7 +28,7 @@ import { isOptionData, isDivider, isSection, normalizeOption, getSelectableOptio
28
28
  import { useMultiCombobox } from "./hooks.js";
29
29
  import { mergeProps } from "../utils/index.js";
30
30
  import { useSize } from "../SizeContext/SizeContext.js";
31
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
31
+ import { themeProps } from "../utils/themeProps.js";
32
32
 
33
33
  // Sentinel value for the select-all item in keyboard navigation
34
34
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -636,7 +636,7 @@ export function MultiSelector({
636
636
  },
637
637
  onClick: onTriggerClick,
638
638
  "data-testid": testId,
639
- ...mergeProps(xdsThemeProps('multi-selector', {
639
+ ...mergeProps(themeProps('multi-selector', {
640
640
  size,
641
641
  status: status?.type ?? null
642
642
  }), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], isDisabled && inputWrapperStyles.disabled, optimisticValue.length === 0 && styles.triggerPlaceholder, status && inputStatusBorderStyles[status.type], status && inputStatusHoverShadowStyles[status.type], xstyle), className, style),
@@ -18,7 +18,7 @@ import * as stylex from '@stylexjs/stylex';
18
18
  import "../theme/tokens.stylex.js";
19
19
  import { colorVars, sizeVars } from "../theme/tokens.stylex.js";
20
20
  import { mergeProps } from "../utils/index.js";
21
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
21
+ import { themeProps } from "../utils/themeProps.js";
22
22
 
23
23
  /**
24
24
  * NavIcon styles
@@ -67,7 +67,7 @@ export function NavIcon({
67
67
  }) {
68
68
  return /*#__PURE__*/_jsx("span", {
69
69
  ref: ref,
70
- ...mergeProps(xdsThemeProps('navicon'), stylex.props(styles.base, xstyle), className, style),
70
+ ...mergeProps(themeProps('navicon'), stylex.props(styles.base, xstyle), className, style),
71
71
  ...props,
72
72
  children: icon
73
73
  });
@@ -17,7 +17,7 @@ import "../theme/tokens.stylex.js";
17
17
  import { spacingVars } from "../theme/tokens.stylex.js";
18
18
  import { mergeProps, mergeRefs } from "../utils/index.js";
19
19
  import { useListFocus } from "../hooks/useListFocus.js";
20
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
20
+ import { themeProps } from "../utils/themeProps.js";
21
21
  import { NavHeadingMenuContext, useNavHeadingCloseContext } from "./NavMenuContext.js";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
23
  const styles = {
@@ -98,7 +98,7 @@ export function NavHeadingMenu({
98
98
  role: "menu",
99
99
  onKeyDown: handleKeyDown,
100
100
  "data-testid": testId,
101
- ...mergeProps(xdsThemeProps('nav-heading-menu', {
101
+ ...mergeProps(themeProps('nav-heading-menu', {
102
102
  size
103
103
  }), stylex.props(styles.root, sizeStyles[size], xstyle), className, inlineStyle),
104
104
  children: children
@@ -20,7 +20,7 @@ import { colorVars, spacingVars, typographyVars, typeScaleVars, radiusVars } fro
20
20
  import { mergeProps } from "../utils/index.js";
21
21
  import { useNavHeadingMenuContext } from "./NavMenuContext.js";
22
22
  import { useLinkComponent } from "../Link/useLinkComponent.js";
23
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
23
+ import { themeProps } from "../utils/themeProps.js";
24
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  const styles = {
26
26
  root: {
@@ -110,7 +110,7 @@ export function NavHeadingMenuItem({
110
110
  href: href,
111
111
  onClick: handleClick,
112
112
  "data-testid": testId,
113
- ...mergeProps(xdsThemeProps('nav-heading-menu-item', {
113
+ ...mergeProps(themeProps('nav-heading-menu-item', {
114
114
  size
115
115
  }), stylex.props(styles.root, sizeStyles[size], isDisabled && styles.disabled, xstyle), className, style),
116
116
  children: [icon && renderIconSlot(icon, {
@@ -49,7 +49,7 @@ import { groupStyles } from "../InputGroup/groupStyles.js";
49
49
  // Re-export shared types for convenience
50
50
 
51
51
  import { mergeProps, mergeRefs } from "../utils/index.js";
52
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
52
+ import { themeProps } from "../utils/themeProps.js";
53
53
 
54
54
  /**
55
55
  * Without `hasClear`, onChange only receives valid numbers.
@@ -258,7 +258,7 @@ export function NumberInput({
258
258
  ref: containerRef,
259
259
  onClick: handleWrapperClick,
260
260
  onMouseUp: handleWrapperMouseUp,
261
- ...mergeProps(xdsThemeProps('number-input', {
261
+ ...mergeProps(themeProps('number-input', {
262
262
  size,
263
263
  status: status?.type ?? null
264
264
  }), stylex.props(inputWrapperStyles.base, styles.wrapper, sizeStyles[size], isDisabled && inputWrapperStyles.disabled, status && inputStatusBorderStyles[status.type], status && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type], inputGroup && groupStyles.inGroup, xstyle), className, style),
@@ -29,8 +29,9 @@ export interface OutlineProps extends BaseProps<HTMLElement> {
29
29
  * indentation based on each heading level. Features a sliding indicator
30
30
  * track that animates to the active item.
31
31
  *
32
- * When `activeId` is omitted, it observes heading elements by id and marks
33
- * the topmost visible heading active.
32
+ * When `activeId` is omitted, it tracks scroll position and marks the last
33
+ * heading whose top has passed its activation line (its scroll-margin-top)
34
+ * active — defaulting to the first item at the top and the last at the bottom.
34
35
  *
35
36
  * @example
36
37
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/Outline/Outline.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAGzC,YAAY,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC1D,6CAA6C;IAC7C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE7B,+CAA+C;IAC/C,KAAK,EAAE,WAAW,EAAE,CAAC;IAErB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAEhC,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgJD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,KAA2B,EAC3B,OAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,YAAY,+BAuFd;yBAnGe,OAAO"}
1
+ {"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/Outline/Outline.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAGzC,YAAY,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC1D,6CAA6C;IAC7C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE7B,+CAA+C;IAC/C,KAAK,EAAE,WAAW,EAAE,CAAC;IAErB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAEhC,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgJD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,KAA2B,EAC3B,OAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,YAAY,+BAyGd;yBArHe,OAAO"}
@@ -26,7 +26,7 @@ import { colorVars, durationVars, easeVars, radiusVars, spacingVars, typeScaleVa
26
26
  import { useLinkComponent } from "../Link/useLinkComponent.js";
27
27
  import { mergeProps, mergeRefs } from "../utils/index.js";
28
28
  import { useScrollSpy } from "./useScrollSpy.js";
29
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
29
+ import { themeProps } from "../utils/themeProps.js";
30
30
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
31
  // =============================================================================
32
32
  // Styles
@@ -133,8 +133,9 @@ function getIndentStyle(level) {
133
133
  * indentation based on each heading level. Features a sliding indicator
134
134
  * track that animates to the active item.
135
135
  *
136
- * When `activeId` is omitted, it observes heading elements by id and marks
137
- * the topmost visible heading active.
136
+ * When `activeId` is omitted, it tracks scroll position and marks the last
137
+ * heading whose top has passed its activation line (its scroll-margin-top)
138
+ * active — defaulting to the first item at the top and the last at the bottom.
138
139
  *
139
140
  * @example
140
141
  * ```
@@ -162,7 +163,12 @@ export function Outline({
162
163
  }) {
163
164
  const rootRef = useRef(null);
164
165
  const LinkComponent = useLinkComponent();
165
- const [resolvedActiveId, setActiveId] = useScrollSpy({
166
+ const isControlled = activeId !== undefined;
167
+ const {
168
+ activeId: resolvedActiveId,
169
+ setActiveId,
170
+ lockActiveId
171
+ } = useScrollSpy({
166
172
  activeId,
167
173
  items,
168
174
  onActiveIdChange,
@@ -170,12 +176,25 @@ export function Outline({
170
176
  });
171
177
  const handleClick = id => event => {
172
178
  const target = document.getElementById(id);
173
- setActiveId(id);
179
+
180
+ // Let the browser handle modified clicks (open in new tab, etc.) and
181
+ // missing targets without touching the active state.
174
182
  if (target == null || event.defaultPrevented || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) {
175
183
  return;
176
184
  }
177
185
  event.preventDefault();
178
186
  window.history.pushState(null, '', `#${id}`);
187
+
188
+ // Move the indicator to the clicked item in a single step. Controlled
189
+ // consumers own the active state (notify only); uncontrolled mode pins
190
+ // the active id and suppresses scroll-spy until the next manual scroll,
191
+ // so the click is honored — even for short/last sections — and the
192
+ // indicator doesn't chase the smooth scroll through other sections.
193
+ if (isControlled) {
194
+ setActiveId(id);
195
+ } else {
196
+ lockActiveId(id);
197
+ }
179
198
  target.scrollIntoView({
180
199
  behavior: 'smooth',
181
200
  block: 'start'
@@ -186,7 +205,7 @@ export function Outline({
186
205
  ref: mergeRefs(rootRef, ref),
187
206
  "aria-label": label,
188
207
  "data-testid": testId,
189
- ...mergeProps(xdsThemeProps('outline', {
208
+ ...mergeProps(themeProps('outline', {
190
209
  density
191
210
  }), stylex.props(styles.root, xstyle), className, style),
192
211
  children: [/*#__PURE__*/_jsx("ul", {
@@ -205,7 +224,7 @@ export function Outline({
205
224
  href: `#${item.id}`,
206
225
  "aria-current": isActive ? 'true' : undefined,
207
226
  onClick: handleClick(item.id),
208
- ...mergeProps(xdsThemeProps('outline-item', {
227
+ ...mergeProps(themeProps('outline-item', {
209
228
  active: isActive ? 'active' : null,
210
229
  level: item.level
211
230
  }), stylex.props(styles.link, densityStyles[density], getIndentStyle(item.level), isActive && styles.activeLink, isActive && styles.activeAnchor)),
@@ -229,7 +248,7 @@ export function Outline({
229
248
  }
230
249
  })
231
250
  }), /*#__PURE__*/_jsx("span", {
232
- ...mergeProps(xdsThemeProps('outline-indicator'), {
251
+ ...mergeProps(themeProps('outline-indicator'), {
233
252
  className: "x10l6tqk x1o0tod xfo62xy xowkcby xjspbzw x47corl x1vjfegm x1tsffl5 x1ltwjim x1qjb5ga x1xuz8iz xkvfbh3 xlr8y92"
234
253
  }),
235
254
  "aria-hidden": "true"
@@ -5,6 +5,19 @@ interface UseScrollSpyOptions {
5
5
  onActiveIdChange?: (id: string) => void;
6
6
  rootRef: React.RefObject<HTMLElement | null>;
7
7
  }
8
- export declare function useScrollSpy({ activeId, items, onActiveIdChange, rootRef, }: UseScrollSpyOptions): [string | undefined, (id: string) => void];
8
+ interface UseScrollSpyResult {
9
+ activeId: string | undefined;
10
+ /** Set the active id (notifies onActiveIdChange). For controlled consumers. */
11
+ setActiveId: (id: string) => void;
12
+ /**
13
+ * Handle a click on the outline item with id `id`. Delays moving the
14
+ * indicator: scroll-spy is suppressed during the programmatic smooth scroll
15
+ * so the indicator doesn't chase it, then the indicator moves once to the
16
+ * clicked item when the scroll settles. If the user scrolls manually mid-way,
17
+ * scroll-position tracking resumes immediately instead.
18
+ */
19
+ lockActiveId: (id: string) => void;
20
+ }
21
+ export declare function useScrollSpy({ activeId, items, onActiveIdChange, rootRef, }: UseScrollSpyOptions): UseScrollSpyResult;
9
22
  export {};
10
23
  //# sourceMappingURL=useScrollSpy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollSpy.d.ts","sourceRoot":"","sources":["../../src/Outline/useScrollSpy.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAwBzC,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC9C;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,OAAO,GACR,EAAE,mBAAmB,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,CA2FlE"}
1
+ {"version":3,"file":"useScrollSpy.d.ts","sourceRoot":"","sources":["../../src/Outline/useScrollSpy.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAuFzC,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC9C;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,+EAA+E;IAC/E,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,OAAO,GACR,EAAE,mBAAmB,GAAG,kBAAkB,CA2I1C"}
@@ -4,13 +4,23 @@
4
4
 
5
5
  /**
6
6
  * @file useScrollSpy.ts
7
- * @input Uses React, IntersectionObserver, OutlineItem type
7
+ * @input Uses React, scroll position of heading elements, OutlineItem type
8
8
  * @output Exports internal useScrollSpy hook
9
9
  * @position Internal behavior hook; consumed by Outline.tsx
10
10
  *
11
+ * Drives the active outline item from scroll position. On each scroll
12
+ * (rAF-throttled) it reads live heading positions and marks the last heading
13
+ * whose top has passed its activation line (its own scroll-margin-top, i.e.
14
+ * where it lands when navigated to). This is stable — it never compares stale
15
+ * cached positions — so the indicator moves monotonically instead of jumping.
16
+ * Defaults to the first item at the top and the last item at the bottom so
17
+ * short final sections still activate.
18
+ *
11
19
  * SYNC: When modified, update /packages/core/src/Outline/Outline.tsx
12
20
  */
13
- import { useEffect, useRef, useState } from 'react';
21
+ import { useCallback, useEffect, useRef, useState } from 'react';
22
+ /** Keys that scroll the viewport — used to detect a manual scroll intent. */
23
+ const SCROLL_KEYS = new Set(['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' ', 'Spacebar']);
14
24
  function getScrollableAncestor(element) {
15
25
  let current = element?.parentElement ?? null;
16
26
  while (current != null) {
@@ -24,6 +34,41 @@ function getScrollableAncestor(element) {
24
34
  }
25
35
  return null;
26
36
  }
37
+
38
+ /**
39
+ * Resolve the active heading id from current scroll position.
40
+ *
41
+ * A heading is "passed" once its top reaches its activation line — the scroll
42
+ * root's top plus the heading's own scroll-margin-top. The active heading is
43
+ * the last passed one (headings are in document order). When none have passed
44
+ * (scrolled above the first), the first item is active; at the bottom, the
45
+ * last item is active.
46
+ */
47
+ function resolveActiveId(items, scrollRoot) {
48
+ if (items.length === 0) {
49
+ return undefined;
50
+ }
51
+ const rootTop = scrollRoot != null ? scrollRoot.getBoundingClientRect().top : 0;
52
+ const atBottom = scrollRoot != null ? scrollRoot.scrollTop + scrollRoot.clientHeight >= scrollRoot.scrollHeight - 2 : window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 2;
53
+ if (atBottom) {
54
+ return items[items.length - 1].id;
55
+ }
56
+ let activeId = items[0].id;
57
+ for (const item of items) {
58
+ const element = document.getElementById(item.id);
59
+ if (element == null) {
60
+ continue;
61
+ }
62
+ const top = element.getBoundingClientRect().top;
63
+ const marginTop = Number.parseFloat(window.getComputedStyle(element).scrollMarginTop) || 0;
64
+ if (top <= rootTop + marginTop + 1) {
65
+ activeId = item.id;
66
+ } else {
67
+ break;
68
+ }
69
+ }
70
+ return activeId;
71
+ }
27
72
  export function useScrollSpy({
28
73
  activeId,
29
74
  items,
@@ -32,72 +77,138 @@ export function useScrollSpy({
32
77
  }) {
33
78
  const isControlled = activeId !== undefined;
34
79
  const [uncontrolledActiveId, setUncontrolledActiveId] = useState(items[0]?.id);
35
- const visibleHeadingIdsRef = useRef(new Set());
36
- const headingTopRef = useRef(new Map());
37
80
  const activeIdRef = useRef(activeId);
81
+ // While true, scroll-spy ignores scroll updates because a click is driving a
82
+ // programmatic scroll. Released when that scroll settles or the user scrolls.
83
+ const suppressRef = useRef(false);
84
+ const releaseSuppressionRef = useRef(null);
85
+ // Latest scroll-position resolver, so the click handler can resume tracking
86
+ // when the user scrolls during a programmatic scroll.
87
+ const syncRef = useRef(null);
88
+ // Keep latest items/callback in refs so the scroll listener effect doesn't
89
+ // re-subscribe on every render (items is a fresh array each render).
90
+ const itemsRef = useRef(items);
91
+ itemsRef.current = items;
92
+ const onActiveIdChangeRef = useRef(onActiveIdChange);
93
+ onActiveIdChangeRef.current = onActiveIdChange;
38
94
  const itemIds = items.map(item => item.id).join('\n');
39
95
  activeIdRef.current = isControlled ? activeId : uncontrolledActiveId;
40
96
  useEffect(() => {
41
- if (isControlled || typeof IntersectionObserver === 'undefined') {
42
- return;
43
- }
44
- const headingElements = items.map(item => document.getElementById(item.id)).filter(element => element != null);
45
- if (headingElements.length === 0) {
97
+ if (isControlled || typeof window === 'undefined') {
46
98
  return;
47
99
  }
48
- const visibleHeadingIds = visibleHeadingIdsRef.current;
49
- const headingTop = headingTopRef.current;
50
- const setNextActiveId = nextActiveId => {
51
- if (activeIdRef.current === nextActiveId) {
100
+ const scrollRoot = getScrollableAncestor(rootRef.current);
101
+ const scrollTarget = scrollRoot ?? window;
102
+ let frame = 0;
103
+ const update = () => {
104
+ frame = 0;
105
+ if (suppressRef.current) {
52
106
  return;
53
107
  }
54
- activeIdRef.current = nextActiveId;
55
- setUncontrolledActiveId(nextActiveId);
56
- onActiveIdChange?.(nextActiveId);
57
- };
58
- const chooseActiveHeading = () => {
59
- let nextActiveId;
60
- let nextTop = Number.POSITIVE_INFINITY;
61
- for (const id of visibleHeadingIds) {
62
- const top = headingTop.get(id) ?? Number.POSITIVE_INFINITY;
63
- if (top < nextTop) {
64
- nextTop = top;
65
- nextActiveId = id;
66
- }
67
- }
68
- if (nextActiveId != null) {
69
- setNextActiveId(nextActiveId);
108
+ const nextActiveId = resolveActiveId(itemsRef.current, scrollRoot);
109
+ if (nextActiveId != null && nextActiveId !== activeIdRef.current) {
110
+ activeIdRef.current = nextActiveId;
111
+ setUncontrolledActiveId(nextActiveId);
112
+ onActiveIdChangeRef.current?.(nextActiveId);
70
113
  }
71
114
  };
72
- const observer = new IntersectionObserver(entries => {
73
- for (const entry of entries) {
74
- const id = entry.target.id;
75
- headingTop.set(id, entry.boundingClientRect.top);
76
- if (entry.isIntersecting) {
77
- visibleHeadingIds.add(id);
78
- } else {
79
- visibleHeadingIds.delete(id);
80
- }
115
+ const onScroll = () => {
116
+ if (frame === 0) {
117
+ frame = requestAnimationFrame(update);
81
118
  }
82
- chooseActiveHeading();
83
- }, {
84
- root: getScrollableAncestor(rootRef.current),
85
- threshold: 0
119
+ };
120
+ syncRef.current = update;
121
+ update();
122
+ scrollTarget.addEventListener('scroll', onScroll, {
123
+ passive: true
124
+ });
125
+ window.addEventListener('resize', onScroll, {
126
+ passive: true
86
127
  });
87
- for (const headingElement of headingElements) {
88
- observer.observe(headingElement);
89
- }
90
128
  return () => {
91
- observer.disconnect();
92
- visibleHeadingIds.clear();
93
- headingTop.clear();
129
+ syncRef.current = null;
130
+ scrollTarget.removeEventListener('scroll', onScroll);
131
+ window.removeEventListener('resize', onScroll);
132
+ if (frame !== 0) {
133
+ cancelAnimationFrame(frame);
134
+ }
135
+ };
136
+ }, [isControlled, itemIds, rootRef]);
137
+
138
+ // Tear down any pending suppression listeners when the Outline unmounts.
139
+ useEffect(() => {
140
+ return () => {
141
+ releaseSuppressionRef.current?.();
94
142
  };
95
- }, [isControlled, itemIds, items, onActiveIdChange, rootRef]);
143
+ }, []);
96
144
  const setActiveId = nextActiveId => {
97
145
  if (!isControlled) {
98
146
  setUncontrolledActiveId(nextActiveId);
99
147
  }
100
148
  onActiveIdChange?.(nextActiveId);
101
149
  };
102
- return [isControlled ? activeId : uncontrolledActiveId, setActiveId];
150
+ const lockActiveId = useCallback(clickedId => {
151
+ if (typeof window === 'undefined') {
152
+ setUncontrolledActiveId(clickedId);
153
+ activeIdRef.current = clickedId;
154
+ onActiveIdChangeRef.current?.(clickedId);
155
+ return;
156
+ }
157
+
158
+ // Freeze the indicator during the programmatic smooth scroll instead of
159
+ // moving it immediately — it lands on the clicked item once the scroll
160
+ // settles, so it doesn't chase the scroll through intervening sections.
161
+ suppressRef.current = true;
162
+ // Replace any in-flight handlers from a previous click.
163
+ releaseSuppressionRef.current?.();
164
+ let settleTimer = 0;
165
+ const cleanup = () => {
166
+ window.removeEventListener('scrollend', onSettle);
167
+ window.removeEventListener('wheel', onManual);
168
+ window.removeEventListener('touchmove', onManual);
169
+ window.removeEventListener('keydown', onKeyDown);
170
+ if (settleTimer !== 0) {
171
+ clearTimeout(settleTimer);
172
+ settleTimer = 0;
173
+ }
174
+ releaseSuppressionRef.current = null;
175
+ };
176
+ // Programmatic scroll finished: move the indicator to the clicked item.
177
+ const onSettle = () => {
178
+ cleanup();
179
+ suppressRef.current = false;
180
+ setUncontrolledActiveId(clickedId);
181
+ activeIdRef.current = clickedId;
182
+ onActiveIdChangeRef.current?.(clickedId);
183
+ };
184
+ // User scrolled mid-flight: hand control back to scroll-position tracking.
185
+ const onManual = () => {
186
+ cleanup();
187
+ suppressRef.current = false;
188
+ syncRef.current?.();
189
+ };
190
+ const onKeyDown = event => {
191
+ if (SCROLL_KEYS.has(event.key)) {
192
+ onManual();
193
+ }
194
+ };
195
+ window.addEventListener('scrollend', onSettle, {
196
+ once: true
197
+ });
198
+ window.addEventListener('wheel', onManual, {
199
+ passive: true
200
+ });
201
+ window.addEventListener('touchmove', onManual, {
202
+ passive: true
203
+ });
204
+ window.addEventListener('keydown', onKeyDown);
205
+ // Fallback when scrollend is unsupported or no scroll is needed.
206
+ settleTimer = window.setTimeout(onSettle, 1200);
207
+ releaseSuppressionRef.current = cleanup;
208
+ }, []);
209
+ return {
210
+ activeId: isControlled ? activeId : uncontrolledActiveId,
211
+ setActiveId,
212
+ lockActiveId
213
+ };
103
214
  }
@@ -22,7 +22,7 @@ import { mergeProps, mergeRefs } from "../utils/index.js";
22
22
  import { useOverflow } from "../hooks/useOverflow.js";
23
23
  import "../theme/tokens.stylex.js";
24
24
  import { spacingVars } from "../theme/tokens.stylex.js";
25
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
25
+ import { themeProps } from "../utils/themeProps.js";
26
26
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
27
27
  const styles = {
28
28
  container: {
@@ -192,7 +192,7 @@ export function OverflowList({
192
192
  })]
193
193
  }), /*#__PURE__*/_jsxs("div", {
194
194
  ref: mergeRefs(ref, containerRef),
195
- ...mergeProps(xdsThemeProps('overflow-list'), stylex.props(styles.container, gapStyles[gap], observeParent && hasOverflow && styles.fillParent, xstyle), className, style),
195
+ ...mergeProps(themeProps('overflow-list'), stylex.props(styles.container, gapStyles[gap], observeParent && hasOverflow && styles.fillParent, xstyle), className, style),
196
196
  ...props,
197
197
  children: [collapseFrom === 'start' && hasOverflow && overflowRenderer?.(overflowItems), visibleItems.map(({
198
198
  child
@@ -19,7 +19,7 @@ import { mergeProps, mergeRefs } from "../utils/index.js";
19
19
  import { useOverlay } from "./useOverlay.js";
20
20
  import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
21
21
  import { overlayScope, overlayContainerStyles } from "./overlay.markers.stylex.js";
22
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
22
+ import { themeProps } from "../utils/themeProps.js";
23
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
24
  /**
25
25
  * Overlay — renders content on top of media with a scrim background
@@ -81,7 +81,7 @@ export function Overlay({
81
81
  }, []);
82
82
  return /*#__PURE__*/_jsxs("div", {
83
83
  ref: mergeRefs(ref, overlay.containerRef),
84
- ...mergeProps(xdsThemeProps('overlay'), stylex.props(overlayScope, overlayContainerStyles.root, xstyle), className, style),
84
+ ...mergeProps(themeProps('overlay'), stylex.props(overlayScope, overlayContainerStyles.root, xstyle), className, style),
85
85
  onClick: overlay.containerProps.onClick,
86
86
  onMouseUp: overlay.containerProps.onMouseUp,
87
87
  children: [children, overlay.element]
@@ -18,7 +18,7 @@ import { MediaTheme } from "../theme/MediaTheme.js";
18
18
  import { mergeProps } from "../utils/index.js";
19
19
  import "./overlay.markers.stylex.js";
20
20
  import { overlayScope } from "./overlay.markers.stylex.js";
21
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
21
+ import { themeProps } from "../utils/themeProps.js";
22
22
 
23
23
  // =============================================================================
24
24
  // Types (re-exported from index.ts for consumers)
@@ -220,7 +220,7 @@ export function OverlayScrim({
220
220
  }) : children;
221
221
  const visibility = isControlled ? getControlledVisibility(isOpen, position) : getShowOnVisibility(showOn, position);
222
222
  return /*#__PURE__*/_jsx("div", {
223
- ...mergeProps(xdsThemeProps('overlay-scrim', {
223
+ ...mergeProps(themeProps('overlay-scrim', {
224
224
  position
225
225
  }), stylex.props(styles.base, positionMap[position], alignMap[align], scrim === 'dark' && styles.scrimDark, scrim === 'light' && styles.scrimLight, visibility.base, visibility.bottom, visibility.top)),
226
226
  inert: isControlled && !isOpen ? true : undefined,
@@ -27,7 +27,7 @@ import { Icon } from "../Icon/index.js";
27
27
  import { Selector } from "../Selector/index.js";
28
28
  import { Text } from "../Text/index.js";
29
29
  import { mergeProps } from "../utils/index.js";
30
- import { xdsThemeProps } from "../utils/xdsThemeProps.js";
30
+ import { themeProps } from "../utils/themeProps.js";
31
31
 
32
32
  // =============================================================================
33
33
  // Types
@@ -319,7 +319,7 @@ export function Pagination({
319
319
  "aria-current": i + 1 === page ? 'page' : undefined,
320
320
  onClick: () => handlePageChange(i + 1),
321
321
  disabled: isDisabled,
322
- ...mergeProps(xdsThemeProps('pagination-dot', {
322
+ ...mergeProps(themeProps('pagination-dot', {
323
323
  active: i + 1 === page ? 'active' : null,
324
324
  size
325
325
  }), {
@@ -360,7 +360,7 @@ export function Pagination({
360
360
  ref: ref,
361
361
  "aria-label": label,
362
362
  "data-testid": testId,
363
- ...mergeProps(xdsThemeProps('pagination', {
363
+ ...mergeProps(themeProps('pagination', {
364
364
  variant,
365
365
  size
366
366
  }), stylex.props(styles.root, xstyle), className, style),