@astryxdesign/core 0.1.7 → 0.1.8-canary.0c4d8d7

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 (428) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +30 -19
  3. package/dist/AppShell/AppShell.d.ts.map +1 -1
  4. package/dist/AppShell/AppShell.js +6 -2
  5. package/dist/AppShell/AppShellMobileContext.d.ts +8 -0
  6. package/dist/AppShell/AppShellMobileContext.d.ts.map +1 -1
  7. package/dist/Avatar/Avatar.d.ts +10 -5
  8. package/dist/Avatar/Avatar.d.ts.map +1 -1
  9. package/dist/Avatar/Avatar.js +12 -8
  10. package/dist/Avatar/AvatarSizeContext.d.ts +1 -1
  11. package/dist/Avatar/AvatarSizeContext.js +1 -1
  12. package/dist/Avatar/AvatarStatusDot.d.ts +2 -2
  13. package/dist/Avatar/AvatarStatusDot.js +2 -2
  14. package/dist/AvatarGroup/AvatarGroup.d.ts +2 -2
  15. package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
  16. package/dist/AvatarGroup/AvatarGroup.js +2 -2
  17. package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
  18. package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
  19. package/dist/AvatarGroup/AvatarGroupOverflow.js +16 -14
  20. package/dist/Banner/Banner.d.ts +9 -1
  21. package/dist/Banner/Banner.d.ts.map +1 -1
  22. package/dist/Banner/Banner.js +31 -2
  23. package/dist/Button/Button.d.ts +8 -2
  24. package/dist/Button/Button.d.ts.map +1 -1
  25. package/dist/Button/Button.js +31 -2
  26. package/dist/ButtonGroup/ButtonGroup.d.ts +9 -1
  27. package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  28. package/dist/ButtonGroup/ButtonGroup.js +30 -1
  29. package/dist/Card/Card.d.ts +8 -2
  30. package/dist/Card/Card.d.ts.map +1 -1
  31. package/dist/Card/Card.js +28 -2
  32. package/dist/Carousel/Carousel.d.ts +6 -2
  33. package/dist/Carousel/Carousel.d.ts.map +1 -1
  34. package/dist/Carousel/Carousel.js +55 -5
  35. package/dist/Chat/ChatComposer.d.ts +8 -0
  36. package/dist/Chat/ChatComposer.d.ts.map +1 -1
  37. package/dist/Chat/ChatComposer.js +31 -6
  38. package/dist/Chat/ChatComposerDrawer.d.ts +2 -0
  39. package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
  40. package/dist/Chat/ChatComposerDrawer.js +11 -1
  41. package/dist/Chat/ChatComposerInput.d.ts +20 -3
  42. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  43. package/dist/Chat/ChatComposerInput.js +19 -3
  44. package/dist/Chat/ChatLayout.d.ts.map +1 -1
  45. package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
  46. package/dist/Chat/ChatMessage.d.ts +1 -1
  47. package/dist/Chat/ChatMessage.d.ts.map +1 -1
  48. package/dist/Chat/ChatMessage.js +1 -1
  49. package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
  50. package/dist/Chat/ChatSendButton.d.ts.map +1 -1
  51. package/dist/Chat/ChatToolCalls.d.ts +5 -1
  52. package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
  53. package/dist/Chat/ChatToolCalls.js +12 -3
  54. package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
  55. package/dist/Citation/Citation.d.ts.map +1 -1
  56. package/dist/Citation/Citation.js +10 -4
  57. package/dist/ClickableCard/ClickableCard.d.ts +9 -2
  58. package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
  59. package/dist/ClickableCard/ClickableCard.js +3 -0
  60. package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
  61. package/dist/CodeBlock/CodeBlock.js +8 -1
  62. package/dist/Collapsible/Collapsible.d.ts +11 -1
  63. package/dist/Collapsible/Collapsible.d.ts.map +1 -1
  64. package/dist/Collapsible/Collapsible.js +36 -4
  65. package/dist/CommandPalette/CommandPaletteInput.d.ts +7 -1
  66. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  67. package/dist/CommandPalette/CommandPaletteInput.js +6 -1
  68. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  69. package/dist/ContextMenu/ContextMenu.js +4 -3
  70. package/dist/ContextMenu/index.d.ts +3 -0
  71. package/dist/ContextMenu/index.d.ts.map +1 -1
  72. package/dist/ContextMenu/index.js +7 -1
  73. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  74. package/dist/DateTimeInput/DateTimeInput.js +10 -1
  75. package/dist/Dialog/Dialog.d.ts.map +1 -1
  76. package/dist/Dialog/Dialog.js +2 -1
  77. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  78. package/dist/DropdownMenu/DropdownMenu.js +8 -4
  79. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +88 -0
  80. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -0
  81. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +169 -0
  82. package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -1
  83. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  84. package/dist/DropdownMenu/DropdownMenuContext.js +18 -0
  85. package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +68 -0
  86. package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -0
  87. package/dist/DropdownMenu/DropdownMenuRadioGroup.js +69 -0
  88. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +69 -0
  89. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -0
  90. package/dist/DropdownMenu/DropdownMenuRadioItem.js +178 -0
  91. package/dist/DropdownMenu/index.d.ts +5 -1
  92. package/dist/DropdownMenu/index.d.ts.map +1 -1
  93. package/dist/DropdownMenu/index.js +10 -1
  94. package/dist/DropdownMenu/menuItemRoles.d.ts +13 -0
  95. package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -0
  96. package/dist/DropdownMenu/menuItemRoles.js +15 -0
  97. package/dist/FieldStatus/FieldStatus.d.ts +8 -0
  98. package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
  99. package/dist/FieldStatus/FieldStatus.js +22 -4
  100. package/dist/FileInput/FileInput.d.ts.map +1 -1
  101. package/dist/FileInput/FileInput.js +10 -2
  102. package/dist/HoverCard/HoverCard.d.ts +9 -1
  103. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  104. package/dist/HoverCard/HoverCard.js +2 -0
  105. package/dist/HoverCard/useHoverCard.d.ts +8 -0
  106. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  107. package/dist/HoverCard/useHoverCard.js +7 -2
  108. package/dist/Icon/Icon.d.ts +43 -13
  109. package/dist/Icon/Icon.d.ts.map +1 -1
  110. package/dist/Icon/Icon.js +62 -27
  111. package/dist/Layer/useLayer.d.ts +6 -0
  112. package/dist/Layer/useLayer.d.ts.map +1 -1
  113. package/dist/Layer/useLayer.js +2 -0
  114. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  115. package/dist/MobileNav/MobileNav.js +6 -1
  116. package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
  117. package/dist/MobileNav/MobileNavToggle.js +4 -0
  118. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  119. package/dist/MultiSelector/MultiSelector.js +39 -12
  120. package/dist/MultiSelector/hooks.d.ts.map +1 -1
  121. package/dist/MultiSelector/hooks.js +16 -0
  122. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  123. package/dist/Outline/Outline.d.ts +68 -3
  124. package/dist/Outline/Outline.d.ts.map +1 -1
  125. package/dist/Outline/Outline.js +128 -26
  126. package/dist/Outline/useScrollSpy.d.ts +27 -7
  127. package/dist/Outline/useScrollSpy.d.ts.map +1 -1
  128. package/dist/Outline/useScrollSpy.js +202 -70
  129. package/dist/OverflowList/OverflowList.d.ts +20 -3
  130. package/dist/OverflowList/OverflowList.d.ts.map +1 -1
  131. package/dist/OverflowList/OverflowList.js +29 -4
  132. package/dist/PowerSearch/PowerSearchEditPopover.js +1 -1
  133. package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
  134. package/dist/SelectableCard/SelectableCard.d.ts +9 -2
  135. package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
  136. package/dist/SelectableCard/SelectableCard.js +14 -11
  137. package/dist/Selector/Selector.d.ts.map +1 -1
  138. package/dist/Selector/Selector.js +4 -2
  139. package/dist/Selector/hooks.d.ts.map +1 -1
  140. package/dist/Selector/hooks.js +16 -0
  141. package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
  142. package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
  143. package/dist/SideNav/SideNavHeading.js +21 -8
  144. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  145. package/dist/Slider/Slider.d.ts.map +1 -1
  146. package/dist/Slider/Slider.js +15 -1
  147. package/dist/TabList/Tab.d.ts.map +1 -1
  148. package/dist/TabList/Tab.js +2 -2
  149. package/dist/TabList/TabList.d.ts.map +1 -1
  150. package/dist/TabList/TabList.js +2 -0
  151. package/dist/TabList/TabMenu.d.ts.map +1 -1
  152. package/dist/TabList/TabMenu.js +1 -1
  153. package/dist/Table/Table.d.ts +1 -1
  154. package/dist/Table/Table.js +1 -1
  155. package/dist/Table/index.d.ts +4 -0
  156. package/dist/Table/index.d.ts.map +1 -1
  157. package/dist/Table/index.js +2 -0
  158. package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
  159. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  160. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +24 -2
  161. package/dist/Table/plugins/rowStatus/index.d.ts +3 -0
  162. package/dist/Table/plugins/rowStatus/index.d.ts.map +1 -0
  163. package/dist/Table/plugins/rowStatus/index.js +3 -0
  164. package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts +60 -0
  165. package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -0
  166. package/dist/Table/plugins/rowStatus/useTableRowStatus.js +145 -0
  167. package/dist/Table/plugins/selection/useTableSelection.d.ts +12 -0
  168. package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
  169. package/dist/Table/plugins/selection/useTableSelection.js +4 -1
  170. package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
  171. package/dist/Table/plugins/sortable/useTableSortable.js +18 -7
  172. package/dist/Table/plugins/tree/index.d.ts +5 -0
  173. package/dist/Table/plugins/tree/index.d.ts.map +1 -0
  174. package/dist/Table/plugins/tree/index.js +4 -0
  175. package/dist/Table/plugins/tree/useTableTreeData.d.ts +38 -0
  176. package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -0
  177. package/dist/Table/plugins/tree/useTableTreeData.js +358 -0
  178. package/dist/Table/plugins/tree/useTableTreeState.d.ts +51 -0
  179. package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +1 -0
  180. package/dist/Table/plugins/tree/useTableTreeState.js +175 -0
  181. package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
  182. package/dist/Table/useBaseTablePlugins.js +6 -3
  183. package/dist/Thumbnail/Thumbnail.d.ts +8 -1
  184. package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
  185. package/dist/Thumbnail/Thumbnail.js +46 -8
  186. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  187. package/dist/TimeInput/TimeInput.js +15 -4
  188. package/dist/Tokenizer/Tokenizer.d.ts +1 -1
  189. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  190. package/dist/Tokenizer/Tokenizer.js +16 -4
  191. package/dist/Toolbar/Toolbar.d.ts.map +1 -1
  192. package/dist/Toolbar/Toolbar.js +8 -1
  193. package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
  194. package/dist/TopNav/TopNavHeading.js +18 -8
  195. package/dist/TopNav/TopNavMegaMenu.js +10 -4
  196. package/dist/TopNav/TopNavMenu.d.ts +2 -1
  197. package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
  198. package/dist/TopNav/TopNavMenu.js +68 -6
  199. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  200. package/dist/TreeList/TreeListItem.js +5 -14
  201. package/dist/astryx.css +51 -16
  202. package/dist/astryx.umd.js +56 -56
  203. package/dist/astryx.umd.js.map +4 -4
  204. package/dist/authoring/doc.d.ts.map +1 -1
  205. package/dist/hooks/computeOverflow.d.ts +47 -0
  206. package/dist/hooks/computeOverflow.d.ts.map +1 -0
  207. package/dist/hooks/computeOverflow.js +213 -0
  208. package/dist/hooks/useOverflow.d.ts +19 -0
  209. package/dist/hooks/useOverflow.d.ts.map +1 -1
  210. package/dist/hooks/useOverflow.js +37 -25
  211. package/dist/theme/Theme.js +1 -1
  212. package/dist/theme/defineTheme.d.ts +1 -1
  213. package/dist/theme/defineTheme.js +1 -1
  214. package/dist/theme/generateThemeRules.d.ts.map +1 -1
  215. package/dist/theme/generateThemeRules.js +51 -0
  216. package/dist/theme/hct.d.ts +0 -1
  217. package/dist/theme/hct.d.ts.map +1 -1
  218. package/dist/theme/hct.js +0 -3
  219. package/dist/utils/types.d.ts +13 -0
  220. package/dist/utils/types.d.ts.map +1 -1
  221. package/docs.mjs +32 -461
  222. package/locales/en.json +212 -172
  223. package/locales/fr-FR.json +10 -0
  224. package/locales/pseudo.json +30 -0
  225. package/package.json +3 -1
  226. package/scripts/postinstall.mjs +93 -0
  227. package/src/AppShell/AppShell.tsx +6 -0
  228. package/src/AppShell/AppShellMobileContext.tsx +8 -0
  229. package/src/AppShell/useAppShellMobile.doc.mjs +8 -0
  230. package/src/Avatar/Avatar.doc.mjs +6 -6
  231. package/src/Avatar/Avatar.tsx +16 -11
  232. package/src/Avatar/AvatarSizeContext.ts +1 -1
  233. package/src/Avatar/AvatarStatusDot.tsx +2 -2
  234. package/src/AvatarGroup/AvatarGroup.doc.mjs +1 -1
  235. package/src/AvatarGroup/AvatarGroup.test.tsx +17 -3
  236. package/src/AvatarGroup/AvatarGroup.tsx +3 -3
  237. package/src/AvatarGroup/AvatarGroupOverflow.doc.mjs +4 -4
  238. package/src/AvatarGroup/AvatarGroupOverflow.tsx +21 -5
  239. package/src/Banner/Banner.doc.mjs +9 -0
  240. package/src/Banner/Banner.test.tsx +30 -0
  241. package/src/Banner/Banner.tsx +47 -3
  242. package/src/Button/Button.doc.mjs +9 -0
  243. package/src/Button/Button.test.tsx +49 -0
  244. package/src/Button/Button.tsx +25 -1
  245. package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -0
  246. package/src/ButtonGroup/ButtonGroup.test.tsx +37 -0
  247. package/src/ButtonGroup/ButtonGroup.tsx +32 -0
  248. package/src/Card/Card.doc.mjs +9 -0
  249. package/src/Card/Card.test.tsx +21 -3
  250. package/src/Card/Card.tsx +35 -2
  251. package/src/Carousel/Carousel.doc.mjs +1 -0
  252. package/src/Carousel/Carousel.test.tsx +149 -1
  253. package/src/Carousel/Carousel.tsx +62 -5
  254. package/src/Chat/Chat.doc.mjs +1 -1
  255. package/src/Chat/ChatComposer.doc.mjs +9 -0
  256. package/src/Chat/ChatComposer.test.tsx +35 -0
  257. package/src/Chat/ChatComposer.tsx +58 -9
  258. package/src/Chat/ChatComposerDrawer.test.tsx +61 -0
  259. package/src/Chat/ChatComposerDrawer.tsx +11 -1
  260. package/src/Chat/ChatComposerInput.doc.mjs +7 -0
  261. package/src/Chat/ChatComposerInput.test.tsx +87 -0
  262. package/src/Chat/ChatComposerInput.tsx +35 -3
  263. package/src/Chat/ChatLayout.tsx +3 -1
  264. package/src/Chat/ChatLayoutScrollButton.tsx +3 -1
  265. package/src/Chat/ChatMessage.tsx +4 -2
  266. package/src/Chat/ChatMessageMetadata.tsx +1 -2
  267. package/src/Chat/ChatSendButton.tsx +5 -1
  268. package/src/Chat/ChatToolCalls.test.tsx +64 -0
  269. package/src/Chat/ChatToolCalls.tsx +13 -1
  270. package/src/Chat/useTriggerMenu.tsx +3 -1
  271. package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
  272. package/src/CheckboxInput/CheckboxInput.test.tsx +32 -1
  273. package/src/CheckboxList/CheckboxList.test.tsx +9 -1
  274. package/src/Citation/Citation.test.tsx +51 -0
  275. package/src/Citation/Citation.tsx +8 -2
  276. package/src/ClickableCard/ClickableCard.doc.mjs +2 -0
  277. package/src/ClickableCard/ClickableCard.test.tsx +34 -0
  278. package/src/ClickableCard/ClickableCard.tsx +11 -1
  279. package/src/CodeBlock/CodeBlock.test.tsx +56 -0
  280. package/src/CodeBlock/CodeBlock.tsx +9 -1
  281. package/src/Collapsible/Collapsible.doc.mjs +7 -0
  282. package/src/Collapsible/Collapsible.test.tsx +80 -0
  283. package/src/Collapsible/Collapsible.tsx +58 -5
  284. package/src/CommandPalette/CommandPaletteInput.doc.mjs +26 -9
  285. package/src/CommandPalette/CommandPaletteInput.test.tsx +34 -0
  286. package/src/CommandPalette/CommandPaletteInput.tsx +11 -0
  287. package/src/ContextMenu/ContextMenu.test.tsx +75 -1
  288. package/src/ContextMenu/ContextMenu.tsx +10 -5
  289. package/src/ContextMenu/index.ts +15 -0
  290. package/src/DateTimeInput/DateTimeInput.test.tsx +35 -0
  291. package/src/DateTimeInput/DateTimeInput.tsx +14 -2
  292. package/src/Dialog/Dialog.tsx +12 -2
  293. package/src/DropdownMenu/DropdownMenu.doc.mjs +23 -0
  294. package/src/DropdownMenu/DropdownMenu.tsx +11 -6
  295. package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +95 -0
  296. package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +236 -0
  297. package/src/DropdownMenu/DropdownMenuContext.tsx +29 -1
  298. package/src/DropdownMenu/DropdownMenuItem.doc.mjs +7 -1
  299. package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +80 -0
  300. package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +118 -0
  301. package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +80 -0
  302. package/src/DropdownMenu/DropdownMenuRadioItem.tsx +232 -0
  303. package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +163 -0
  304. package/src/DropdownMenu/index.ts +23 -3
  305. package/src/DropdownMenu/menuItemRoles.ts +22 -0
  306. package/src/Field/Field.doc.mjs +1 -1
  307. package/src/Field/Field.test.tsx +57 -12
  308. package/src/Field/FieldLabel.doc.mjs +1 -1
  309. package/src/FieldStatus/FieldStatus.doc.mjs +17 -5
  310. package/src/FieldStatus/FieldStatus.test.tsx +78 -40
  311. package/src/FieldStatus/FieldStatus.tsx +22 -4
  312. package/src/FileInput/FileInput.test.tsx +52 -3
  313. package/src/FileInput/FileInput.tsx +13 -2
  314. package/src/HoverCard/HoverCard.doc.mjs +13 -0
  315. package/src/HoverCard/HoverCard.test.tsx +21 -2
  316. package/src/HoverCard/HoverCard.tsx +11 -0
  317. package/src/HoverCard/useHoverCard.doc.mjs +2 -0
  318. package/src/HoverCard/useHoverCard.tsx +24 -2
  319. package/src/Icon/Icon.doc.mjs +12 -0
  320. package/src/Icon/Icon.test.tsx +142 -0
  321. package/src/Icon/Icon.tsx +98 -30
  322. package/src/IconButton/IconButton.doc.mjs +8 -0
  323. package/src/IconButton/IconButton.test.tsx +15 -18
  324. package/src/Item/Item.doc.mjs +1 -1
  325. package/src/Layer/useLayer.tsx +8 -0
  326. package/src/MobileNav/MobileNav.tsx +12 -1
  327. package/src/MobileNav/MobileNavToggle.test.tsx +116 -0
  328. package/src/MobileNav/MobileNavToggle.tsx +9 -1
  329. package/src/MultiSelector/MultiSelector.doc.mjs +4 -2
  330. package/src/MultiSelector/MultiSelector.test.tsx +162 -1
  331. package/src/MultiSelector/MultiSelector.tsx +55 -12
  332. package/src/MultiSelector/hooks.ts +17 -0
  333. package/src/NumberInput/NumberInput.doc.mjs +2 -2
  334. package/src/NumberInput/NumberInput.test.tsx +11 -7
  335. package/src/NumberInput/NumberInput.tsx +1 -2
  336. package/src/Outline/Outline.doc.mjs +123 -3
  337. package/src/Outline/Outline.test.tsx +735 -0
  338. package/src/Outline/Outline.tsx +183 -33
  339. package/src/Outline/useScrollSpy.ts +248 -72
  340. package/src/OverflowList/OverflowList.doc.mjs +39 -6
  341. package/src/OverflowList/OverflowList.test.tsx +111 -0
  342. package/src/OverflowList/OverflowList.tsx +48 -8
  343. package/src/PowerSearch/PowerSearchEditPopover.test.tsx +67 -0
  344. package/src/PowerSearch/PowerSearchEditPopover.tsx +1 -1
  345. package/src/PowerSearch/usePowerSearchSource.ts +1 -2
  346. package/src/SelectableCard/SelectableCard.doc.mjs +2 -0
  347. package/src/SelectableCard/SelectableCard.test.tsx +46 -4
  348. package/src/SelectableCard/SelectableCard.tsx +27 -14
  349. package/src/Selector/Selector.test.tsx +69 -0
  350. package/src/Selector/Selector.tsx +5 -1
  351. package/src/Selector/SelectorOption.doc.mjs +1 -1
  352. package/src/Selector/hooks.ts +17 -0
  353. package/src/SideNav/SideNav.test.tsx +119 -3
  354. package/src/SideNav/SideNavCollapseButton.tsx +6 -1
  355. package/src/SideNav/SideNavHeading.tsx +24 -8
  356. package/src/SideNav/SideNavItem.doc.mjs +2 -2
  357. package/src/SideNav/SideNavItem.tsx +5 -1
  358. package/src/Slider/Slider.test.tsx +62 -2
  359. package/src/Slider/Slider.tsx +15 -1
  360. package/src/Switch/Switch.doc.mjs +1 -1
  361. package/src/Switch/Switch.test.tsx +32 -1
  362. package/src/TabList/Tab.tsx +5 -1
  363. package/src/TabList/TabList.doc.mjs +3 -3
  364. package/src/TabList/TabList.test.tsx +66 -0
  365. package/src/TabList/TabList.tsx +8 -0
  366. package/src/TabList/TabMenu.tsx +4 -1
  367. package/src/Table/Table.doc.mjs +2 -0
  368. package/src/Table/Table.tsx +1 -1
  369. package/src/Table/index.ts +12 -0
  370. package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +6 -2
  371. package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +90 -1
  372. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +37 -5
  373. package/src/Table/plugins/rowStatus/index.ts +7 -0
  374. package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +138 -0
  375. package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +189 -0
  376. package/src/Table/plugins/selection/useTableSelection.test.tsx +16 -0
  377. package/src/Table/plugins/selection/useTableSelection.tsx +18 -1
  378. package/src/Table/plugins/sortable/useTableSortable.test.tsx +95 -9
  379. package/src/Table/plugins/sortable/useTableSortable.tsx +23 -7
  380. package/src/Table/plugins/tree/index.ts +12 -0
  381. package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +163 -0
  382. package/src/Table/plugins/tree/useTableTreeData.test.tsx +594 -0
  383. package/src/Table/plugins/tree/useTableTreeData.tsx +495 -0
  384. package/src/Table/plugins/tree/useTableTreeState.test.tsx +636 -0
  385. package/src/Table/plugins/tree/useTableTreeState.tsx +253 -0
  386. package/src/Table/useBaseTablePlugins.ts +6 -2
  387. package/src/Table/useTableRowStatus.doc.mjs +30 -0
  388. package/src/Table/useTableSelection.doc.mjs +65 -14
  389. package/src/Table/useTableTreeData.doc.mjs +75 -0
  390. package/src/Table/useTableTreeState.doc.mjs +98 -0
  391. package/src/TextArea/TextArea.doc.mjs +1 -1
  392. package/src/TextArea/TextArea.test.tsx +9 -1
  393. package/src/TextInput/TextInput.doc.mjs +1 -1
  394. package/src/Thumbnail/Thumbnail.doc.mjs +9 -0
  395. package/src/Thumbnail/Thumbnail.test.tsx +38 -8
  396. package/src/Thumbnail/Thumbnail.tsx +28 -1
  397. package/src/TimeInput/TimeInput.test.tsx +76 -1
  398. package/src/TimeInput/TimeInput.tsx +19 -6
  399. package/src/Tokenizer/Tokenizer.doc.mjs +1 -1
  400. package/src/Tokenizer/Tokenizer.test.tsx +137 -2
  401. package/src/Tokenizer/Tokenizer.tsx +16 -4
  402. package/src/Toolbar/Toolbar.tsx +10 -3
  403. package/src/TopNav/TopNav.test.tsx +80 -1
  404. package/src/TopNav/TopNavHeading.tsx +24 -8
  405. package/src/TopNav/TopNavMegaMenu.test.tsx +149 -1
  406. package/src/TopNav/TopNavMegaMenu.tsx +10 -4
  407. package/src/TopNav/TopNavMenu.test.tsx +118 -4
  408. package/src/TopNav/TopNavMenu.tsx +83 -5
  409. package/src/TreeList/TreeList.test.tsx +32 -1
  410. package/src/TreeList/TreeListItem.tsx +19 -10
  411. package/src/authoring/doc.ts +1 -3
  412. package/src/docs-script.test.mjs +18 -13
  413. package/src/hooks/computeOverflow.test.ts +422 -0
  414. package/src/hooks/computeOverflow.ts +290 -0
  415. package/src/hooks/useOverflow.test.ts +96 -4
  416. package/src/hooks/useOverflow.ts +77 -33
  417. package/src/postinstall.test.mjs +71 -0
  418. package/src/theme/Theme.doc.mjs +4 -4
  419. package/src/theme/Theme.tsx +1 -1
  420. package/src/theme/defineTheme.ts +1 -1
  421. package/src/theme/generateThemeRules.test.ts +65 -0
  422. package/src/theme/generateThemeRules.ts +56 -0
  423. package/src/theme/hct.ts +0 -4
  424. package/src/utils/types.ts +14 -0
  425. package/dist/TreeList/treeListItem.markers.stylex.d.ts +0 -16
  426. package/dist/TreeList/treeListItem.markers.stylex.d.ts.map +0 -1
  427. package/dist/TreeList/treeListItem.markers.stylex.js +0 -22
  428. package/src/TreeList/treeListItem.markers.stylex.ts +0 -20
@@ -368,11 +368,20 @@ export function DateTimeInput({
368
368
  if (e.key === 'Escape' && popover.isOpen) {
369
369
  e.preventDefault();
370
370
  popover.hide();
371
+ } else if ((e.key === 'ArrowDown' || e.altKey && e.key === 'ArrowDown') && !popover.isOpen) {
372
+ // APG combobox: ArrowDown (and Alt+ArrowDown) opens the calendar
373
+ // popover from the keyboard, keeping focus in the input (forms-13).
374
+ e.preventDefault();
375
+ if (!isEffectivelyDisabled) {
376
+ popover.show({
377
+ skipAutoFocus: true
378
+ });
379
+ }
371
380
  } else if (e.key === 'Enter') {
372
381
  e.preventDefault();
373
382
  commitDatePendingInput();
374
383
  }
375
- }, [popover, commitDatePendingInput]);
384
+ }, [popover, commitDatePendingInput, isEffectivelyDisabled]);
376
385
 
377
386
  // --- Time handlers ---
378
387
  const handleTimeInputChange = useCallback(e => {
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAA6B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAoB5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAwBhD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,IAAI,CAAC;IACf,UAAU,EAAE,IAAI,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAyHD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAE3C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAA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
107
107
  open: {
108
108
  k1xSpc: "x78zum5",
109
109
  kSiTet: "x1hc1fzr",
110
- kKVMdj: "x1ewfqum",
110
+ kKVMdj: "x1ewfqum x1aquc0h",
111
111
  $$css: true
112
112
  },
113
113
  backdrop: {
@@ -376,6 +376,7 @@ export function Dialog({
376
376
  ...mergeProps(themeProps('dialog', {
377
377
  variant
378
378
  }), stylex.props(styles.inlineWrapper, !isFullscreen && dynamicStyles.sizing(width, maxHeight), isFullscreen && styles.fullscreen, xstyle), className, style),
379
+ "data-testid": props['data-testid'],
379
380
  children: innerContent
380
381
  });
381
382
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAEnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAUtC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAQtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAyC5C,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,kBAAkB,GAC5B,oBAAoB,G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AE,kBAAkB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GAAG,yBAAyB,CAAC;AA+BpD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,gBAAgB,EAC5B,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAiB,EACjB,SAAmB,EACnB,SAAS,EACT,KAAK,EACL,MAAM,EACN,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,iBAAiB,qBA4QnB;yBAzRe,YAAY"}
@@ -27,6 +27,7 @@ import { usePopover } from "../Popover/usePopover.js";
27
27
  import { Button } from "../Button/index.js";
28
28
  import { Icon } from "../Icon/index.js";
29
29
  import { renderDropdownItems } from "./renderDropdownItems.js";
30
+ import { MENU_ITEM_ROLES, MENU_ITEM_SELECTOR } from "./menuItemRoles.js";
30
31
  import { DropdownMenuContext } from "./DropdownMenuContext.js";
31
32
  import { useListFocus } from "../hooks/useListFocus.js";
32
33
  import { useTypeahead } from "../hooks/useTypeahead.js";
@@ -186,21 +187,24 @@ export function DropdownMenu({
186
187
  popover.hide();
187
188
  }, [popover]);
188
189
 
189
- // Single keyboard navigation path for both modes
190
+ // Single keyboard navigation path for both modes.
191
+ // The selector matches plain items plus selectable items
192
+ // (menuitemradio/menuitemcheckbox) so lab checkbox/radio rows are reachable
193
+ // and roved to alongside plain items — not just role="menuitem".
190
194
  const {
191
195
  listRef,
192
196
  handleKeyDown: listNavKeyDown,
193
197
  focusFirst,
194
198
  focusItem
195
199
  } = useListFocus({
196
- itemSelector: '[role="menuitem"]:not([aria-disabled="true"])',
200
+ itemSelector: MENU_ITEM_SELECTOR,
197
201
  wrap: false,
198
202
  onEscape: closeMenu
199
203
  });
200
204
 
201
205
  // First-character typeahead over the (enabled) menu items — jump to the next
202
206
  // item whose label starts with the typed text (menus-11).
203
- const getMenuItems = useCallback(() => listRef.current ? Array.from(listRef.current.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) : [], [listRef]);
207
+ const getMenuItems = useCallback(() => listRef.current ? Array.from(listRef.current.querySelectorAll(MENU_ITEM_SELECTOR)) : [], [listRef]);
204
208
  const typeahead = useTypeahead({
205
209
  getItemLabels: () => getMenuItems().map(el => el.textContent),
206
210
  onMatch: focusItem,
@@ -224,7 +228,7 @@ export function DropdownMenu({
224
228
  if (e.key === 'Enter' || e.key === ' ') {
225
229
  e.preventDefault();
226
230
  const focused = document.activeElement;
227
- if (focused?.getAttribute('role') === 'menuitem') {
231
+ if (focused && MENU_ITEM_ROLES.has(focused.getAttribute('role') ?? '')) {
228
232
  focused.click();
229
233
  }
230
234
  return;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @file DropdownMenuCheckboxItem.tsx
3
+ * @input React, stylex, Item + Icon + DropdownMenu context + tokens from core
4
+ * @output DropdownMenuCheckboxItem — a standalone checkable menu item.
5
+ * @position Sub-component; used inside DropdownMenu.
6
+ *
7
+ * A menu item that toggles an independent boolean (role="menuitemcheckbox").
8
+ * Unlike CheckboxInput, there is no nested native <input>: the row itself owns
9
+ * the role and aria-checked, per the WAI-ARIA menuitemcheckbox pattern.
10
+ * Keyboard navigation (arrows/typeahead) and Enter/Space activation come from
11
+ * the parent DropdownMenu's useListFocus + activation path, which matches
12
+ * menuitemcheckbox alongside plain menuitem rows.
13
+ *
14
+ * The square checkbox visual is decorative (aria-hidden) — the row owns the
15
+ * checked state. Its size is derived from the menu's item size (a `sm` menu
16
+ * gets the compact control; `md`/`lg` get the standard one) and it swaps to the
17
+ * inline-end of the row on coarse-pointer (touch) devices via CSS `order`, so
18
+ * it lands where selection toggles are conventionally placed on mobile. The
19
+ * checkmark uses the `check` icon from the active theme's icon registry.
20
+ */
21
+ import { type ReactNode } from 'react';
22
+ import { type IconType } from '../Icon';
23
+ import type { BaseProps } from '../BaseProps';
24
+ export interface DropdownMenuCheckboxItemProps extends Omit<BaseProps, 'onChange' | 'role' | 'aria-checked' | 'tabIndex'> {
25
+ /**
26
+ * Primary label text identifying the item.
27
+ */
28
+ label: ReactNode;
29
+ /**
30
+ * Secondary description text displayed below the label.
31
+ */
32
+ description?: ReactNode;
33
+ /**
34
+ * Icon to display before the label. Accepts a semantic icon name (see
35
+ * `npx astryx docs icons`) or a rendered node.
36
+ */
37
+ icon?: ReactNode | IconType;
38
+ /**
39
+ * Whether the item is checked. Controlled — pair with `onChange`.
40
+ */
41
+ value: boolean;
42
+ /**
43
+ * Callback fired with the next checked state when the item is toggled.
44
+ */
45
+ onChange?: (checked: boolean) => void;
46
+ /**
47
+ * Whether the item is disabled. Disabled items stay focusable (via
48
+ * `aria-disabled`) so they remain discoverable by keyboard and assistive
49
+ * technology, but activation is blocked.
50
+ * @default false
51
+ */
52
+ isDisabled?: boolean;
53
+ /**
54
+ * Whether toggling the item closes the menu. Checkbox items default to
55
+ * staying open so several can be toggled in a single session, unlike radio
56
+ * items which default to closing on selection.
57
+ * @default false
58
+ */
59
+ hasCloseOnSelect?: boolean;
60
+ /**
61
+ * Content to render after the label and description, such as a keyboard
62
+ * shortcut hint or badge.
63
+ */
64
+ endContent?: ReactNode;
65
+ }
66
+ /**
67
+ * A checkable dropdown menu item (role="menuitemcheckbox").
68
+ *
69
+ * Must be used inside a DropdownMenu. Toggles an independent boolean; for a
70
+ * one-of-N choice use DropdownMenuRadioGroup + DropdownMenuRadioItem instead.
71
+ *
72
+ * @example
73
+ * ```
74
+ * import {DropdownMenuCheckboxItem} from '@astryxdesign/core/DropdownMenu';
75
+ * <DropdownMenu button={{label: 'View'}}>
76
+ * <DropdownMenuCheckboxItem
77
+ * label="Show archived"
78
+ * value={showArchived}
79
+ * onChange={setShowArchived}
80
+ * />
81
+ * </DropdownMenu>
82
+ * ```
83
+ */
84
+ export declare function DropdownMenuCheckboxItem({ label, description, icon, value, onChange, isDisabled, hasCloseOnSelect, endContent, xstyle, className, style, ...rest }: DropdownMenuCheckboxItemProps): import("react").JSX.Element;
85
+ export declare namespace DropdownMenuCheckboxItem {
86
+ var displayName: string;
87
+ }
88
+ //# sourceMappingURL=DropdownMenuCheckboxItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuCheckboxItem.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuCheckboxItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAElD,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAY5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6D5C,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CACzD,SAAS,EACT,UAAU,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAClD;IACC;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,UAAkB,EAClB,gBAAwB,EACxB,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,6BAA6B,+BAwD/B;yBArEe,wBAAwB"}
@@ -0,0 +1,169 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file DropdownMenuCheckboxItem.tsx
7
+ * @input React, stylex, Item + Icon + DropdownMenu context + tokens from core
8
+ * @output DropdownMenuCheckboxItem — a standalone checkable menu item.
9
+ * @position Sub-component; used inside DropdownMenu.
10
+ *
11
+ * A menu item that toggles an independent boolean (role="menuitemcheckbox").
12
+ * Unlike CheckboxInput, there is no nested native <input>: the row itself owns
13
+ * the role and aria-checked, per the WAI-ARIA menuitemcheckbox pattern.
14
+ * Keyboard navigation (arrows/typeahead) and Enter/Space activation come from
15
+ * the parent DropdownMenu's useListFocus + activation path, which matches
16
+ * menuitemcheckbox alongside plain menuitem rows.
17
+ *
18
+ * The square checkbox visual is decorative (aria-hidden) — the row owns the
19
+ * checked state. Its size is derived from the menu's item size (a `sm` menu
20
+ * gets the compact control; `md`/`lg` get the standard one) and it swaps to the
21
+ * inline-end of the row on coarse-pointer (touch) devices via CSS `order`, so
22
+ * it lands where selection toggles are conventionally placed on mobile. The
23
+ * checkmark uses the `check` icon from the active theme's icon registry.
24
+ */
25
+ import { useCallback } from 'react';
26
+ import * as stylex from '@stylexjs/stylex';
27
+ import { Icon, renderIconSlot } from "../Icon/index.js";
28
+ import { Item } from "../Item/index.js";
29
+ import { useDropdownMenuContext } from "./DropdownMenuContext.js";
30
+ import "../theme/tokens.stylex.js";
31
+ import { colorVars, spacingVars, radiusVars, durationVars, easeVars, borderVars } from "../theme/tokens.stylex.js";
32
+ import { mergeProps, themeProps } from "../utils/index.js";
33
+ import { jsx as _jsx } from "react/jsx-runtime";
34
+ const styles = {
35
+ root: {
36
+ kzqmXN: "xh8yej3",
37
+ kaIpWk: "x1ws5lxm",
38
+ kMwMTN: "x1tgivj0",
39
+ kWkggS: "xjbqb8w x1c52tdz x1uwx2nv",
40
+ kkrTdU: "x1ypdohk",
41
+ kI3sdo: "x1a2a7pz",
42
+ $$css: true
43
+ },
44
+ disabled: {
45
+ kSiTet: "xbyyjgo",
46
+ kkrTdU: "x1h6gzvc",
47
+ $$css: true
48
+ },
49
+ box: {
50
+ k1xSpc: "x78zum5",
51
+ kGNEyG: "x6s0dn4",
52
+ kjj79g: "xl56j7k",
53
+ kmuXW: "x2lah0s",
54
+ kB7OPa: "x9f619",
55
+ kMzoRj: "x1litavf",
56
+ ksu8eU: "x1y0btm7",
57
+ kaIpWk: "xx3sua9",
58
+ kMwMTN: "x17wrial",
59
+ k1ekBW: "xts7igz",
60
+ kIyJzY: "xuedmi6 x12w9bfk",
61
+ kAMwcw: "xlr8y92",
62
+ kayTVb: "x1g77sc7 xozvky",
63
+ keTefX: "x1lziwak x1jymrmb",
64
+ $$css: true
65
+ },
66
+ unchecked: {
67
+ kVAM5u: "xvy26l8",
68
+ kWkggS: "x10xzikg",
69
+ $$css: true
70
+ },
71
+ checked: {
72
+ kVAM5u: "xad5do",
73
+ kWkggS: "x1ewilqj",
74
+ $$css: true
75
+ }
76
+ };
77
+ const boxSizeStyles = {
78
+ sm: {
79
+ kzqmXN: "x1xp8n7a",
80
+ kZKoxP: "xmix8c7",
81
+ $$css: true
82
+ },
83
+ md: {
84
+ kzqmXN: "x17z2i9w",
85
+ kZKoxP: "x17rw0jw",
86
+ $$css: true
87
+ }
88
+ };
89
+ /**
90
+ * A checkable dropdown menu item (role="menuitemcheckbox").
91
+ *
92
+ * Must be used inside a DropdownMenu. Toggles an independent boolean; for a
93
+ * one-of-N choice use DropdownMenuRadioGroup + DropdownMenuRadioItem instead.
94
+ *
95
+ * @example
96
+ * ```
97
+ * import {DropdownMenuCheckboxItem} from '@astryxdesign/core/DropdownMenu';
98
+ * <DropdownMenu button={{label: 'View'}}>
99
+ * <DropdownMenuCheckboxItem
100
+ * label="Show archived"
101
+ * value={showArchived}
102
+ * onChange={setShowArchived}
103
+ * />
104
+ * </DropdownMenu>
105
+ * ```
106
+ */
107
+ export function DropdownMenuCheckboxItem({
108
+ label,
109
+ description,
110
+ icon,
111
+ value,
112
+ onChange,
113
+ isDisabled = false,
114
+ hasCloseOnSelect = false,
115
+ endContent,
116
+ xstyle,
117
+ className,
118
+ style,
119
+ ...rest
120
+ }) {
121
+ const ctx = useDropdownMenuContext();
122
+ const menuSize = ctx?.menuSize ?? 'md';
123
+ const controlSize = menuSize === 'sm' ? 'sm' : 'md';
124
+ const handleClick = useCallback(() => {
125
+ if (isDisabled) {
126
+ return;
127
+ }
128
+ onChange?.(!value);
129
+ if (hasCloseOnSelect) {
130
+ ctx?.closeMenu();
131
+ }
132
+ }, [isDisabled, onChange, value, hasCloseOnSelect, ctx]);
133
+ return /*#__PURE__*/_jsx(Item, {
134
+ ...rest,
135
+ role: "menuitemcheckbox",
136
+ "aria-checked": value,
137
+ tabIndex: isDisabled ? undefined : -1,
138
+ marker: /*#__PURE__*/_jsx("span", {
139
+ "aria-hidden": "true",
140
+ ...mergeProps(themeProps('dropdown-menu-checkbox', {
141
+ size: controlSize,
142
+ checked: value ? 'checked' : null,
143
+ disabled: isDisabled ? 'disabled' : null
144
+ }), stylex.props(styles.box, boxSizeStyles[controlSize], value ? styles.checked : styles.unchecked)),
145
+ children: value && /*#__PURE__*/_jsx(Icon, {
146
+ icon: "check",
147
+ size: "sm",
148
+ color: "inherit"
149
+ })
150
+ }),
151
+ startContent: icon ? renderIconSlot(icon, {
152
+ size: 'sm',
153
+ color: 'secondary'
154
+ }) : undefined,
155
+ label: label,
156
+ description: description,
157
+ endContent: endContent,
158
+ onClick: handleClick,
159
+ isDisabled: isDisabled,
160
+ xstyle: [styles.root, isDisabled && styles.disabled, xstyle],
161
+ ...mergeProps(themeProps('dropdown-menu-item', {
162
+ size: menuSize
163
+ }), {
164
+ className,
165
+ style
166
+ })
167
+ });
168
+ }
169
+ DropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';
@@ -1,8 +1,10 @@
1
+ /** Menu size, derived from the trigger button size. */
2
+ export type DropdownMenuSize = 'sm' | 'md' | 'lg';
1
3
  export interface DropdownMenuContextValue {
2
4
  /** Close the menu and return focus to trigger */
3
5
  closeMenu: () => void;
4
6
  /** Menu size derived from button size */
5
- menuSize: 'sm' | 'md' | 'lg';
7
+ menuSize: DropdownMenuSize;
6
8
  }
7
9
  export declare const DropdownMenuContext: import("react").Context<DropdownMenuContextValue | null>;
8
10
  /**
@@ -10,4 +12,18 @@ export declare const DropdownMenuContext: import("react").Context<DropdownMenuCo
10
12
  * Returns null outside of a DropdownMenu.
11
13
  */
12
14
  export declare function useDropdownMenuContext(): DropdownMenuContextValue | null;
15
+ export interface DropdownMenuRadioGroupContextValue {
16
+ /** The currently selected value in the group. */
17
+ value: string | undefined;
18
+ /** Select a value. Called by a DropdownMenuRadioItem on activation. */
19
+ onChange: (value: string) => void;
20
+ /** Whether selecting an item should close the menu. @default true */
21
+ hasCloseOnSelect: boolean;
22
+ }
23
+ export declare const DropdownMenuRadioGroupContext: import("react").Context<DropdownMenuRadioGroupContextValue | null>;
24
+ /**
25
+ * Read the enclosing radio group's selection state.
26
+ * Returns null when used outside a DropdownMenuRadioGroup.
27
+ */
28
+ export declare function useDropdownMenuRadioGroupContext(): DropdownMenuRadioGroupContextValue | null;
13
29
  //# sourceMappingURL=DropdownMenuContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuContext.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuContext.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,yCAAyC;IACzC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB,0DACsB,CAAC;AAGvD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,wBAAwB,GAAG,IAAI,CAExE"}
1
+ {"version":3,"file":"DropdownMenuContext.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuContext.tsx"],"names":[],"mappings":"AAgBA,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,yCAAyC;IACzC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,0DACsB,CAAC;AAGvD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,wBAAwB,GAAG,IAAI,CAExE;AAMD,MAAM,WAAW,kCAAkC;IACjD,iDAAiD;IACjD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,qEAAqE;IACrE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,6BAA6B,oEACsB,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,gCAAgC,IAAI,kCAAkC,GAAG,IAAI,CAE5F"}
@@ -12,6 +12,9 @@
12
12
  * items don't need to register themselves.
13
13
  */
14
14
  import { createContext, use } from 'react';
15
+
16
+ /** Menu size, derived from the trigger button size. */
17
+
15
18
  export const DropdownMenuContext = /*#__PURE__*/createContext(null);
16
19
  DropdownMenuContext.displayName = 'DropdownMenuContext';
17
20
 
@@ -21,4 +24,19 @@ DropdownMenuContext.displayName = 'DropdownMenuContext';
21
24
  */
22
25
  export function useDropdownMenuContext() {
23
26
  return use(DropdownMenuContext);
27
+ }
28
+
29
+ // =============================================================================
30
+ // Radio group coordination
31
+ // =============================================================================
32
+
33
+ export const DropdownMenuRadioGroupContext = /*#__PURE__*/createContext(null);
34
+ DropdownMenuRadioGroupContext.displayName = 'DropdownMenuRadioGroupContext';
35
+
36
+ /**
37
+ * Read the enclosing radio group's selection state.
38
+ * Returns null when used outside a DropdownMenuRadioGroup.
39
+ */
40
+ export function useDropdownMenuRadioGroupContext() {
41
+ return use(DropdownMenuRadioGroupContext);
24
42
  }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @file DropdownMenuRadioGroup.tsx
3
+ * @output DropdownMenuRadioGroup — a single-select group of menu items.
4
+ * @position Sub-component; wraps DropdownMenuRadioItem inside a DropdownMenu.
5
+ *
6
+ * Owns single-selection state (value/onChange) for its child
7
+ * DropdownMenuRadioItems and exposes it via context. Renders role="group" with
8
+ * an accessible name so the radios are announced as a set. Keyboard navigation
9
+ * comes from the parent DropdownMenu's useListFocus, which matches
10
+ * menuitemradio rows.
11
+ */
12
+ import { type ReactNode } from 'react';
13
+ import type { BaseProps } from '../BaseProps';
14
+ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'> {
15
+ /**
16
+ * The currently selected value in the group. Pass `undefined` when nothing
17
+ * is selected yet.
18
+ */
19
+ value: string | undefined;
20
+ /**
21
+ * Callback fired when the selected value changes.
22
+ */
23
+ onChange: (value: string) => void;
24
+ /**
25
+ * Accessible label for the group. Required (together with `aria-labelledby`,
26
+ * one of the two) so screen readers announce the radios as a named set,
27
+ * e.g. "Sort by".
28
+ */
29
+ 'aria-label'?: string;
30
+ /**
31
+ * The id of an element that labels the group, as an alternative to
32
+ * `aria-label`.
33
+ */
34
+ 'aria-labelledby'?: string;
35
+ /**
36
+ * Whether selecting a value closes the menu. Radio items default to closing
37
+ * on selection (a single-choice commit), unlike checkbox items which stay
38
+ * open.
39
+ * @default true
40
+ */
41
+ hasCloseOnSelect?: boolean;
42
+ /**
43
+ * The `DropdownMenuRadioItem`s that make up the group.
44
+ */
45
+ children: ReactNode;
46
+ }
47
+ /**
48
+ * A single-select group of radio menu items (role="group" of menuitemradio).
49
+ *
50
+ * @example
51
+ * ```
52
+ * import {
53
+ * DropdownMenuRadioGroup,
54
+ * DropdownMenuRadioItem,
55
+ * } from '@astryxdesign/core/DropdownMenu';
56
+ * <DropdownMenu button={{label: 'Sort'}}>
57
+ * <DropdownMenuRadioGroup value={sort} onChange={setSort} aria-label="Sort by">
58
+ * <DropdownMenuRadioItem value="newest" label="Newest" />
59
+ * <DropdownMenuRadioItem value="oldest" label="Oldest" />
60
+ * </DropdownMenuRadioGroup>
61
+ * </DropdownMenu>
62
+ * ```
63
+ */
64
+ export declare function DropdownMenuRadioGroup({ value, onChange, hasCloseOnSelect, children, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
65
+ export declare namespace DropdownMenuRadioGroup {
66
+ var displayName: string;
67
+ }
68
+ //# sourceMappingURL=DropdownMenuRadioGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiB5C,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,SAAS,EACT,UAAU,CACX;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,gBAAuB,EACvB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,+BAgB7B;yBAxBe,sBAAsB"}
@@ -0,0 +1,69 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file DropdownMenuRadioGroup.tsx
7
+ * @output DropdownMenuRadioGroup — a single-select group of menu items.
8
+ * @position Sub-component; wraps DropdownMenuRadioItem inside a DropdownMenu.
9
+ *
10
+ * Owns single-selection state (value/onChange) for its child
11
+ * DropdownMenuRadioItems and exposes it via context. Renders role="group" with
12
+ * an accessible name so the radios are announced as a set. Keyboard navigation
13
+ * comes from the parent DropdownMenu's useListFocus, which matches
14
+ * menuitemradio rows.
15
+ */
16
+ import { useMemo } from 'react';
17
+ import * as stylex from '@stylexjs/stylex';
18
+ import "../theme/tokens.stylex.js";
19
+ import { spacingVars } from "../theme/tokens.stylex.js";
20
+ import { mergeProps } from "../utils/index.js";
21
+ import { DropdownMenuRadioGroupContext } from "./DropdownMenuContext.js";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ /**
24
+ * A single-select group of radio menu items (role="group" of menuitemradio).
25
+ *
26
+ * @example
27
+ * ```
28
+ * import {
29
+ * DropdownMenuRadioGroup,
30
+ * DropdownMenuRadioItem,
31
+ * } from '@astryxdesign/core/DropdownMenu';
32
+ * <DropdownMenu button={{label: 'Sort'}}>
33
+ * <DropdownMenuRadioGroup value={sort} onChange={setSort} aria-label="Sort by">
34
+ * <DropdownMenuRadioItem value="newest" label="Newest" />
35
+ * <DropdownMenuRadioItem value="oldest" label="Oldest" />
36
+ * </DropdownMenuRadioGroup>
37
+ * </DropdownMenu>
38
+ * ```
39
+ */
40
+ export function DropdownMenuRadioGroup({
41
+ value,
42
+ onChange,
43
+ hasCloseOnSelect = true,
44
+ children,
45
+ className,
46
+ style,
47
+ ...rest
48
+ }) {
49
+ const contextValue = useMemo(() => ({
50
+ value,
51
+ onChange,
52
+ hasCloseOnSelect
53
+ }), [value, onChange, hasCloseOnSelect]);
54
+ return /*#__PURE__*/_jsx("div", {
55
+ ...rest,
56
+ role: "group",
57
+ ...mergeProps({
58
+ className: "x78zum5 xdt5ytf x1lsbc85"
59
+ }, {
60
+ className,
61
+ style
62
+ }),
63
+ children: /*#__PURE__*/_jsx(DropdownMenuRadioGroupContext, {
64
+ value: contextValue,
65
+ children: children
66
+ })
67
+ });
68
+ }
69
+ DropdownMenuRadioGroup.displayName = 'DropdownMenuRadioGroup';
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @file DropdownMenuRadioItem.tsx
3
+ * @input React, stylex, Item + Icon + DropdownMenu context + tokens from core
4
+ * @output DropdownMenuRadioItem — a single option in a radio group.
5
+ * @position Sub-component; must be used inside a DropdownMenuRadioGroup.
6
+ *
7
+ * A menu item representing one option in a single-select group
8
+ * (role="menuitemradio"). The row owns the role and aria-checked; there is no
9
+ * nested native <input> (per the WAI-ARIA menuitemradio pattern). Selection
10
+ * state + onChange come from DropdownMenuRadioGroupContext. Keyboard nav +
11
+ * Enter/Space activation come from the parent DropdownMenu.
12
+ *
13
+ * The round radio visual (circle + center dot) is decorative (aria-hidden) —
14
+ * the row owns the checked state. Its size is derived from the menu's item size
15
+ * and it swaps to the inline-end of the row on coarse-pointer (touch) devices
16
+ * via CSS `order`. The dot is a shaped element, not an icon (a filled circle
17
+ * has no registry glyph).
18
+ */
19
+ import { type ReactNode } from 'react';
20
+ import { type IconType } from '../Icon';
21
+ import type { BaseProps } from '../BaseProps';
22
+ export interface DropdownMenuRadioItemProps extends Omit<BaseProps, 'role' | 'aria-checked' | 'tabIndex'> {
23
+ /**
24
+ * The value this item represents within its group. The group's `value`
25
+ * matches against this to determine the checked state.
26
+ */
27
+ value: string;
28
+ /**
29
+ * Primary label text identifying the option.
30
+ */
31
+ label: ReactNode;
32
+ /**
33
+ * Secondary description text displayed below the label.
34
+ */
35
+ description?: ReactNode;
36
+ /**
37
+ * Icon to display before the label. Accepts a semantic icon name (see
38
+ * `npx astryx docs icons`) or a rendered node.
39
+ */
40
+ icon?: ReactNode | IconType;
41
+ /**
42
+ * Whether this individual radio item is disabled. Disabled items stay
43
+ * focusable (via `aria-disabled`) so they remain discoverable by keyboard
44
+ * and assistive technology, but selection is blocked.
45
+ * @default false
46
+ */
47
+ isDisabled?: boolean;
48
+ /**
49
+ * Content to render after the label and description, such as a badge or
50
+ * metadata.
51
+ */
52
+ endContent?: ReactNode;
53
+ }
54
+ /**
55
+ * A single option in a DropdownMenuRadioGroup (role="menuitemradio").
56
+ *
57
+ * @example
58
+ * ```
59
+ * <DropdownMenuRadioGroup value={sort} onChange={setSort} aria-label="Sort by">
60
+ * <DropdownMenuRadioItem value="newest" label="Newest" />
61
+ * <DropdownMenuRadioItem value="oldest" label="Oldest" icon="clock" />
62
+ * </DropdownMenuRadioGroup>
63
+ * ```
64
+ */
65
+ export declare function DropdownMenuRadioItem({ value, label, description, icon, isDisabled, endContent, xstyle, className, style, ...rest }: DropdownMenuRadioItemProps): import("react").JSX.Element;
66
+ export declare namespace DropdownMenuRadioItem {
67
+ var displayName: string;
68
+ }
69
+ //# sourceMappingURL=DropdownMenuRadioItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuRadioItem.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAElD,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAWtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsE5C,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CACtD,SAAS,EACT,MAAM,GAAG,cAAc,GAAG,UAAU,CACrC;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,KAAK,EACL,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,0BAA0B,+BAiE5B;yBA5Ee,qBAAqB"}