@krelborn/stylesui 0.0.0-stage → 0.9.0

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 (526) hide show
  1. package/LICENSE +74 -0
  2. package/README.md +129 -2
  3. package/dist/accessibility/RequiredAccessibleName.d.ts +26 -0
  4. package/dist/accessibility/idSegment.d.ts +7 -0
  5. package/dist/accessibility/idSegment.js +5 -0
  6. package/dist/accessibility/index.d.ts +2 -0
  7. package/dist/collections/index.d.ts +7 -0
  8. package/dist/collections/optionId.d.ts +8 -0
  9. package/dist/collections/optionId.js +6 -0
  10. package/dist/collections/renderedOptions.d.ts +37 -0
  11. package/dist/collections/renderedOptions.js +17 -0
  12. package/dist/collections/targetIndexForKey.d.ts +45 -0
  13. package/dist/collections/targetIndexForKey.js +16 -0
  14. package/dist/collections/typeAhead.d.ts +43 -0
  15. package/dist/collections/typeAhead.js +18 -0
  16. package/dist/components/Accordion/Accordion.css +1 -0
  17. package/dist/components/Accordion/Accordion.d.ts +90 -0
  18. package/dist/components/Accordion/Accordion.js +47 -0
  19. package/dist/components/Accordion/Accordion.module.js +19 -0
  20. package/dist/components/Accordion/AccordionContext.d.ts +40 -0
  21. package/dist/components/Accordion/AccordionContext.js +4 -0
  22. package/dist/components/Accordion/AccordionItem.d.ts +51 -0
  23. package/dist/components/Accordion/AccordionItem.js +69 -0
  24. package/dist/components/Accordion/AccordionToggleContent.d.ts +30 -0
  25. package/dist/components/Accordion/AccordionToggleContent.js +44 -0
  26. package/dist/components/Accordion/accordionIds.d.ts +24 -0
  27. package/dist/components/Accordion/accordionIds.js +12 -0
  28. package/dist/components/Accordion/index.d.ts +4 -0
  29. package/dist/components/Accordion/useAccordionContext.d.ts +9 -0
  30. package/dist/components/Accordion/useAccordionContext.js +10 -0
  31. package/dist/components/Accordion/useFindablePanel.d.ts +25 -0
  32. package/dist/components/Accordion/useFindablePanel.js +36 -0
  33. package/dist/components/Accordion/useFragmentTargetReveal.d.ts +27 -0
  34. package/dist/components/Accordion/useFragmentTargetReveal.js +36 -0
  35. package/dist/components/Accordion/useHasOpened.d.ts +7 -0
  36. package/dist/components/Accordion/useHasOpened.js +7 -0
  37. package/dist/components/Alert/Alert.css +1 -0
  38. package/dist/components/Alert/Alert.d.ts +47 -0
  39. package/dist/components/Alert/Alert.js +27 -0
  40. package/dist/components/Alert/Alert.module.js +8 -0
  41. package/dist/components/Alert/AlertIcon.d.ts +14 -0
  42. package/dist/components/Alert/AlertIcon.js +42 -0
  43. package/dist/components/Alert/index.d.ts +2 -0
  44. package/dist/components/Avatar/Avatar.css +1 -0
  45. package/dist/components/Avatar/Avatar.d.ts +33 -0
  46. package/dist/components/Avatar/Avatar.js +26 -0
  47. package/dist/components/Avatar/Avatar.module.js +6 -0
  48. package/dist/components/Avatar/index.d.ts +2 -0
  49. package/dist/components/Avatar/initialsOf.d.ts +9 -0
  50. package/dist/components/Avatar/initialsOf.js +9 -0
  51. package/dist/components/AvatarGroup/AvatarGroup.css +1 -0
  52. package/dist/components/AvatarGroup/AvatarGroup.d.ts +30 -0
  53. package/dist/components/AvatarGroup/AvatarGroup.js +33 -0
  54. package/dist/components/AvatarGroup/AvatarGroup.module.js +6 -0
  55. package/dist/components/AvatarGroup/index.d.ts +2 -0
  56. package/dist/components/Badge/Badge.css +1 -0
  57. package/dist/components/Badge/Badge.d.ts +36 -0
  58. package/dist/components/Badge/Badge.js +15 -0
  59. package/dist/components/Badge/Badge.module.js +3 -0
  60. package/dist/components/Badge/index.d.ts +2 -0
  61. package/dist/components/Box/Box.css +1 -0
  62. package/dist/components/Box/Box.d.ts +31 -0
  63. package/dist/components/Box/Box.js +17 -0
  64. package/dist/components/Box/Box.module.js +3 -0
  65. package/dist/components/Box/index.d.ts +2 -0
  66. package/dist/components/Button/Button.css +1 -0
  67. package/dist/components/Button/Button.d.ts +42 -0
  68. package/dist/components/Button/Button.js +24 -0
  69. package/dist/components/Button/Button.module.js +6 -0
  70. package/dist/components/Button/index.d.ts +2 -0
  71. package/dist/components/Card/Card.css +1 -0
  72. package/dist/components/Card/Card.d.ts +24 -0
  73. package/dist/components/Card/Card.js +14 -0
  74. package/dist/components/Card/Card.module.js +3 -0
  75. package/dist/components/Card/index.d.ts +2 -0
  76. package/dist/components/Center/Center.css +1 -0
  77. package/dist/components/Center/Center.d.ts +34 -0
  78. package/dist/components/Center/Center.js +19 -0
  79. package/dist/components/Center/Center.module.js +3 -0
  80. package/dist/components/Center/index.d.ts +2 -0
  81. package/dist/components/Checkbox/Checkbox.d.ts +23 -0
  82. package/dist/components/Checkbox/Checkbox.js +12 -0
  83. package/dist/components/Checkbox/index.d.ts +2 -0
  84. package/dist/components/ChoiceControl/ChoiceControl.css +1 -0
  85. package/dist/components/ChoiceControl/ChoiceControl.d.ts +21 -0
  86. package/dist/components/ChoiceControl/ChoiceControl.js +39 -0
  87. package/dist/components/ChoiceControl/ChoiceControl.module.js +8 -0
  88. package/dist/components/ChoiceControl/index.d.ts +1 -0
  89. package/dist/components/Cluster/Cluster.d.ts +29 -0
  90. package/dist/components/Cluster/Cluster.js +13 -0
  91. package/dist/components/Cluster/index.d.ts +2 -0
  92. package/dist/components/Code/Code.css +1 -0
  93. package/dist/components/Code/Code.d.ts +13 -0
  94. package/dist/components/Code/Code.js +19 -0
  95. package/dist/components/Code/Code.module.js +3 -0
  96. package/dist/components/Code/index.d.ts +2 -0
  97. package/dist/components/Combobox/Autocomplete.d.ts +83 -0
  98. package/dist/components/Combobox/Autocomplete.js +102 -0
  99. package/dist/components/Combobox/Combobox.css +1 -0
  100. package/dist/components/Combobox/Combobox.d.ts +59 -0
  101. package/dist/components/Combobox/Combobox.js +82 -0
  102. package/dist/components/Combobox/Combobox.module.js +17 -0
  103. package/dist/components/Combobox/ComboboxContext.d.ts +88 -0
  104. package/dist/components/Combobox/ComboboxContext.js +4 -0
  105. package/dist/components/Combobox/ComboboxFieldValue.d.ts +17 -0
  106. package/dist/components/Combobox/ComboboxFieldValue.js +33 -0
  107. package/dist/components/Combobox/ComboboxOption.d.ts +51 -0
  108. package/dist/components/Combobox/ComboboxOption.js +74 -0
  109. package/dist/components/Combobox/ComboboxOptionContent.d.ts +32 -0
  110. package/dist/components/Combobox/ComboboxOptionContent.js +51 -0
  111. package/dist/components/Combobox/ComboboxPopup.d.ts +50 -0
  112. package/dist/components/Combobox/ComboboxPopup.js +59 -0
  113. package/dist/components/Combobox/autocompleteKeys.d.ts +31 -0
  114. package/dist/components/Combobox/autocompleteKeys.js +25 -0
  115. package/dist/components/Combobox/comboboxKeys.d.ts +10 -0
  116. package/dist/components/Combobox/comboboxKeys.js +22 -0
  117. package/dist/components/Combobox/containsText.d.ts +9 -0
  118. package/dist/components/Combobox/containsText.js +8 -0
  119. package/dist/components/Combobox/index.d.ts +6 -0
  120. package/dist/components/Combobox/isAltArrow.d.ts +9 -0
  121. package/dist/components/Combobox/isAltArrow.js +5 -0
  122. package/dist/components/Combobox/isOptionShown.d.ts +10 -0
  123. package/dist/components/Combobox/isOptionShown.js +5 -0
  124. package/dist/components/Combobox/useAutocompleteText.d.ts +56 -0
  125. package/dist/components/Combobox/useAutocompleteText.js +27 -0
  126. package/dist/components/Combobox/useComboboxContext.d.ts +9 -0
  127. package/dist/components/Combobox/useComboboxContext.js +10 -0
  128. package/dist/components/Combobox/useComboboxList.d.ts +129 -0
  129. package/dist/components/Combobox/useComboboxList.js +138 -0
  130. package/dist/components/Combobox/useComboboxOption.d.ts +35 -0
  131. package/dist/components/Combobox/useComboboxOption.js +46 -0
  132. package/dist/components/Combobox/useComboboxSelection.d.ts +45 -0
  133. package/dist/components/Combobox/useComboboxSelection.js +17 -0
  134. package/dist/components/Combobox/useResultsAnnouncement.d.ts +23 -0
  135. package/dist/components/Combobox/useResultsAnnouncement.js +24 -0
  136. package/dist/components/ContextMenu/index.d.ts +2 -0
  137. package/dist/components/ContextMenu/useContextMenu.d.ts +112 -0
  138. package/dist/components/ContextMenu/useContextMenu.js +202 -0
  139. package/dist/components/ContextMenu/watchLongPress.d.ts +35 -0
  140. package/dist/components/ContextMenu/watchLongPress.js +38 -0
  141. package/dist/components/Counter/Counter.css +1 -0
  142. package/dist/components/Counter/Counter.d.ts +39 -0
  143. package/dist/components/Counter/Counter.js +18 -0
  144. package/dist/components/Counter/Counter.module.js +3 -0
  145. package/dist/components/Counter/index.d.ts +2 -0
  146. package/dist/components/Cover/Cover.css +1 -0
  147. package/dist/components/Cover/Cover.d.ts +40 -0
  148. package/dist/components/Cover/Cover.js +29 -0
  149. package/dist/components/Cover/Cover.module.js +6 -0
  150. package/dist/components/Cover/index.d.ts +2 -0
  151. package/dist/components/Divider/Divider.css +1 -0
  152. package/dist/components/Divider/Divider.d.ts +25 -0
  153. package/dist/components/Divider/Divider.js +15 -0
  154. package/dist/components/Divider/Divider.module.js +3 -0
  155. package/dist/components/Divider/index.d.ts +2 -0
  156. package/dist/components/Field/Field.css +1 -0
  157. package/dist/components/Field/Field.d.ts +49 -0
  158. package/dist/components/Field/Field.js +49 -0
  159. package/dist/components/Field/Field.module.js +8 -0
  160. package/dist/components/Field/index.d.ts +2 -0
  161. package/dist/components/Fieldset/Fieldset.css +1 -0
  162. package/dist/components/Fieldset/Fieldset.d.ts +35 -0
  163. package/dist/components/Fieldset/Fieldset.js +64 -0
  164. package/dist/components/Fieldset/Fieldset.module.js +8 -0
  165. package/dist/components/Fieldset/index.d.ts +2 -0
  166. package/dist/components/Frame/Frame.css +1 -0
  167. package/dist/components/Frame/Frame.d.ts +23 -0
  168. package/dist/components/Frame/Frame.js +16 -0
  169. package/dist/components/Frame/Frame.module.js +3 -0
  170. package/dist/components/Frame/index.d.ts +2 -0
  171. package/dist/components/Grid/Grid.css +1 -0
  172. package/dist/components/Grid/Grid.d.ts +25 -0
  173. package/dist/components/Grid/Grid.js +22 -0
  174. package/dist/components/Grid/Grid.module.js +3 -0
  175. package/dist/components/Grid/index.d.ts +2 -0
  176. package/dist/components/Heading/Heading.css +1 -0
  177. package/dist/components/Heading/Heading.d.ts +39 -0
  178. package/dist/components/Heading/Heading.js +23 -0
  179. package/dist/components/Heading/Heading.module.js +3 -0
  180. package/dist/components/Heading/index.d.ts +2 -0
  181. package/dist/components/HorizontalFlow/HorizontalFlow.css +1 -0
  182. package/dist/components/HorizontalFlow/HorizontalFlow.d.ts +30 -0
  183. package/dist/components/HorizontalFlow/HorizontalFlow.js +30 -0
  184. package/dist/components/HorizontalFlow/HorizontalFlow.module.js +3 -0
  185. package/dist/components/HorizontalFlow/index.d.ts +2 -0
  186. package/dist/components/Icon/AddIcon.d.ts +11 -0
  187. package/dist/components/Icon/AddIcon.js +21 -0
  188. package/dist/components/Icon/CheckIcon.d.ts +11 -0
  189. package/dist/components/Icon/CheckIcon.js +18 -0
  190. package/dist/components/Icon/ChevronDownIcon.d.ts +11 -0
  191. package/dist/components/Icon/ChevronDownIcon.js +18 -0
  192. package/dist/components/Icon/ChevronRightIcon.d.ts +11 -0
  193. package/dist/components/Icon/ChevronRightIcon.js +19 -0
  194. package/dist/components/Icon/CloseIcon.d.ts +12 -0
  195. package/dist/components/Icon/CloseIcon.js +21 -0
  196. package/dist/components/Icon/ColorModeIcon.d.ts +12 -0
  197. package/dist/components/Icon/ColorModeIcon.js +36 -0
  198. package/dist/components/Icon/DeleteIcon.d.ts +11 -0
  199. package/dist/components/Icon/DeleteIcon.js +36 -0
  200. package/dist/components/Icon/Icon.css +1 -0
  201. package/dist/components/Icon/Icon.d.ts +40 -0
  202. package/dist/components/Icon/Icon.js +27 -0
  203. package/dist/components/Icon/Icon.module.js +6 -0
  204. package/dist/components/Icon/InfoIcon.d.ts +11 -0
  205. package/dist/components/Icon/InfoIcon.js +30 -0
  206. package/dist/components/Icon/MenuIcon.d.ts +12 -0
  207. package/dist/components/Icon/MenuIcon.js +28 -0
  208. package/dist/components/Icon/MoreHorizontalIcon.d.ts +11 -0
  209. package/dist/components/Icon/MoreHorizontalIcon.js +34 -0
  210. package/dist/components/Icon/MoreVerticalIcon.d.ts +11 -0
  211. package/dist/components/Icon/MoreVerticalIcon.js +34 -0
  212. package/dist/components/Icon/PaletteIcon.d.ts +12 -0
  213. package/dist/components/Icon/PaletteIcon.js +48 -0
  214. package/dist/components/Icon/RefreshIcon.d.ts +13 -0
  215. package/dist/components/Icon/RefreshIcon.js +32 -0
  216. package/dist/components/Icon/RemoveIcon.d.ts +11 -0
  217. package/dist/components/Icon/RemoveIcon.js +18 -0
  218. package/dist/components/Icon/SendIcon.d.ts +11 -0
  219. package/dist/components/Icon/SendIcon.js +22 -0
  220. package/dist/components/Icon/index.d.ts +16 -0
  221. package/dist/components/IconButton/IconButton.css +1 -0
  222. package/dist/components/IconButton/IconButton.d.ts +45 -0
  223. package/dist/components/IconButton/IconButton.js +40 -0
  224. package/dist/components/IconButton/IconButton.module.js +7 -0
  225. package/dist/components/IconButton/index.d.ts +2 -0
  226. package/dist/components/Kbd/Kbd.css +1 -0
  227. package/dist/components/Kbd/Kbd.d.ts +13 -0
  228. package/dist/components/Kbd/Kbd.js +19 -0
  229. package/dist/components/Kbd/Kbd.module.js +3 -0
  230. package/dist/components/Kbd/index.d.ts +2 -0
  231. package/dist/components/Link/Link.css +1 -0
  232. package/dist/components/Link/Link.d.ts +52 -0
  233. package/dist/components/Link/Link.js +26 -0
  234. package/dist/components/Link/Link.module.js +3 -0
  235. package/dist/components/Link/index.d.ts +2 -0
  236. package/dist/components/Listbox/Listbox.css +1 -0
  237. package/dist/components/Listbox/Listbox.d.ts +46 -0
  238. package/dist/components/Listbox/Listbox.js +55 -0
  239. package/dist/components/Listbox/Listbox.module.js +6 -0
  240. package/dist/components/Listbox/ListboxContext.d.ts +38 -0
  241. package/dist/components/Listbox/ListboxContext.js +4 -0
  242. package/dist/components/Listbox/ListboxOption.d.ts +31 -0
  243. package/dist/components/Listbox/ListboxOption.js +42 -0
  244. package/dist/components/Listbox/index.d.ts +4 -0
  245. package/dist/components/Listbox/useListbox.d.ts +54 -0
  246. package/dist/components/Listbox/useListbox.js +103 -0
  247. package/dist/components/Listbox/useListboxContext.d.ts +9 -0
  248. package/dist/components/Listbox/useListboxContext.js +10 -0
  249. package/dist/components/Menu/Menu.d.ts +70 -0
  250. package/dist/components/Menu/Menu.js +76 -0
  251. package/dist/components/Menu/MenuContext.d.ts +29 -0
  252. package/dist/components/Menu/MenuContext.js +4 -0
  253. package/dist/components/Menu/MenuGroup.d.ts +22 -0
  254. package/dist/components/Menu/MenuGroup.js +32 -0
  255. package/dist/components/Menu/MenuItem.d.ts +77 -0
  256. package/dist/components/Menu/MenuItem.js +54 -0
  257. package/dist/components/Menu/MenuItemCheckbox.d.ts +61 -0
  258. package/dist/components/Menu/MenuItemCheckbox.js +37 -0
  259. package/dist/components/Menu/MenuItemRadio.d.ts +47 -0
  260. package/dist/components/Menu/MenuItemRadio.js +39 -0
  261. package/dist/components/Menu/MenuRadioGroup.d.ts +34 -0
  262. package/dist/components/Menu/MenuRadioGroup.js +27 -0
  263. package/dist/components/Menu/MenuRadioGroupContext.d.ts +17 -0
  264. package/dist/components/Menu/MenuRadioGroupContext.js +4 -0
  265. package/dist/components/Menu/MenuSeparator.d.ts +16 -0
  266. package/dist/components/Menu/MenuSeparator.js +20 -0
  267. package/dist/components/Menu/Submenu.d.ts +36 -0
  268. package/dist/components/Menu/Submenu.js +122 -0
  269. package/dist/components/Menu/index.d.ts +18 -0
  270. package/dist/components/Menu/useMenu.d.ts +18 -0
  271. package/dist/components/Menu/useMenu.js +20 -0
  272. package/dist/components/Menu/useMenuButton.d.ts +124 -0
  273. package/dist/components/Menu/useMenuButton.js +92 -0
  274. package/dist/components/Menu/useMenuContext.d.ts +9 -0
  275. package/dist/components/Menu/useMenuContext.js +10 -0
  276. package/dist/components/Menu/useMenuItemContent.d.ts +55 -0
  277. package/dist/components/Menu/useMenuItemContent.js +66 -0
  278. package/dist/components/Menu/useMenuPointer.d.ts +27 -0
  279. package/dist/components/Menu/useMenuPointer.js +56 -0
  280. package/dist/components/Menu/useMenuRadioGroupContext.d.ts +9 -0
  281. package/dist/components/Menu/useMenuRadioGroupContext.js +10 -0
  282. package/dist/components/MenuSurface/MenuSurface.css +1 -0
  283. package/dist/components/MenuSurface/MenuSurface.module.js +16 -0
  284. package/dist/components/Menubar/Menubar.css +1 -0
  285. package/dist/components/Menubar/Menubar.d.ts +23 -0
  286. package/dist/components/Menubar/Menubar.js +67 -0
  287. package/dist/components/Menubar/Menubar.module.js +7 -0
  288. package/dist/components/Menubar/MenubarContext.d.ts +29 -0
  289. package/dist/components/Menubar/MenubarContext.js +4 -0
  290. package/dist/components/Menubar/MenubarMenu.d.ts +26 -0
  291. package/dist/components/Menubar/MenubarMenu.js +88 -0
  292. package/dist/components/Menubar/findOpenMenubarItem.d.ts +7 -0
  293. package/dist/components/Menubar/findOpenMenubarItem.js +6 -0
  294. package/dist/components/Menubar/index.d.ts +4 -0
  295. package/dist/components/Menubar/menubarItems.d.ts +7 -0
  296. package/dist/components/Menubar/menubarItems.js +5 -0
  297. package/dist/components/Menubar/useMenubarContext.d.ts +9 -0
  298. package/dist/components/Menubar/useMenubarContext.js +10 -0
  299. package/dist/components/NavBar/NavBar.css +1 -0
  300. package/dist/components/NavBar/NavBar.d.ts +53 -0
  301. package/dist/components/NavBar/NavBar.js +97 -0
  302. package/dist/components/NavBar/NavBar.module.js +22 -0
  303. package/dist/components/NavBar/NavBarContext.d.ts +21 -0
  304. package/dist/components/NavBar/NavBarContext.js +4 -0
  305. package/dist/components/NavBar/NavBarItem.d.ts +32 -0
  306. package/dist/components/NavBar/NavBarItem.js +18 -0
  307. package/dist/components/NavBar/NavBarMenu.d.ts +32 -0
  308. package/dist/components/NavBar/NavBarMenu.js +84 -0
  309. package/dist/components/NavBar/NavBarMenuGroup.d.ts +25 -0
  310. package/dist/components/NavBar/NavBarMenuGroup.js +40 -0
  311. package/dist/components/NavBar/NavBarMenuItem.d.ts +36 -0
  312. package/dist/components/NavBar/NavBarMenuItem.js +49 -0
  313. package/dist/components/NavBar/index.d.ts +10 -0
  314. package/dist/components/NavBar/isNavBarCollapsed.d.ts +8 -0
  315. package/dist/components/NavBar/isNavBarCollapsed.js +5 -0
  316. package/dist/components/NavBar/leavesPageInPlace.d.ts +12 -0
  317. package/dist/components/NavBar/leavesPageInPlace.js +29 -0
  318. package/dist/components/NavBar/renderNavBarLink.d.ts +12 -0
  319. package/dist/components/NavBar/renderNavBarLink.js +16 -0
  320. package/dist/components/NavBar/useLayoutSwitch.d.ts +26 -0
  321. package/dist/components/NavBar/useLayoutSwitch.js +25 -0
  322. package/dist/components/NavBar/useNavBarContext.d.ts +9 -0
  323. package/dist/components/NavBar/useNavBarContext.js +10 -0
  324. package/dist/components/NavList/NavList.css +1 -0
  325. package/dist/components/NavList/NavList.d.ts +20 -0
  326. package/dist/components/NavList/NavList.js +27 -0
  327. package/dist/components/NavList/NavList.module.js +11 -0
  328. package/dist/components/NavList/NavListGroup.d.ts +25 -0
  329. package/dist/components/NavList/NavListGroup.js +39 -0
  330. package/dist/components/NavList/NavListItem.d.ts +49 -0
  331. package/dist/components/NavList/NavListItem.js +56 -0
  332. package/dist/components/NavList/index.d.ts +6 -0
  333. package/dist/components/Overlay/Overlay.css +1 -0
  334. package/dist/components/Overlay/Overlay.d.ts +33 -0
  335. package/dist/components/Overlay/Overlay.js +35 -0
  336. package/dist/components/Overlay/Overlay.module.js +3 -0
  337. package/dist/components/Overlay/index.d.ts +1 -0
  338. package/dist/components/PageLayout/PageLayout.css +1 -0
  339. package/dist/components/PageLayout/PageLayout.d.ts +26 -0
  340. package/dist/components/PageLayout/PageLayout.js +17 -0
  341. package/dist/components/PageLayout/PageLayout.module.js +3 -0
  342. package/dist/components/PageLayout/index.d.ts +2 -0
  343. package/dist/components/Popover/Popover.css +1 -0
  344. package/dist/components/Popover/Popover.d.ts +52 -0
  345. package/dist/components/Popover/Popover.js +20 -0
  346. package/dist/components/Popover/Popover.module.js +3 -0
  347. package/dist/components/Popover/index.d.ts +4 -0
  348. package/dist/components/Popover/usePopover.d.ts +96 -0
  349. package/dist/components/Popover/usePopover.js +71 -0
  350. package/dist/components/Prose/Prose.css +1 -0
  351. package/dist/components/Prose/Prose.d.ts +50 -0
  352. package/dist/components/Prose/Prose.js +15 -0
  353. package/dist/components/Prose/Prose.module.js +3 -0
  354. package/dist/components/Prose/index.d.ts +2 -0
  355. package/dist/components/Radio/Radio.d.ts +29 -0
  356. package/dist/components/Radio/Radio.js +23 -0
  357. package/dist/components/Radio/index.d.ts +2 -0
  358. package/dist/components/RadioGroup/RadioGroup.css +1 -0
  359. package/dist/components/RadioGroup/RadioGroup.d.ts +58 -0
  360. package/dist/components/RadioGroup/RadioGroup.js +36 -0
  361. package/dist/components/RadioGroup/RadioGroup.module.js +3 -0
  362. package/dist/components/RadioGroup/index.d.ts +2 -0
  363. package/dist/components/RequiredIndicator/RequiredIndicator.css +1 -0
  364. package/dist/components/RequiredIndicator/RequiredIndicator.d.ts +6 -0
  365. package/dist/components/RequiredIndicator/RequiredIndicator.js +15 -0
  366. package/dist/components/RequiredIndicator/RequiredIndicator.module.js +3 -0
  367. package/dist/components/RequiredIndicator/index.d.ts +1 -0
  368. package/dist/components/Row/Row.d.ts +29 -0
  369. package/dist/components/Row/Row.js +13 -0
  370. package/dist/components/Row/index.d.ts +2 -0
  371. package/dist/components/SegmentedControl/Segment.d.ts +24 -0
  372. package/dist/components/SegmentedControl/Segment.js +41 -0
  373. package/dist/components/SegmentedControl/SegmentedControl.css +1 -0
  374. package/dist/components/SegmentedControl/SegmentedControl.d.ts +25 -0
  375. package/dist/components/SegmentedControl/SegmentedControl.js +19 -0
  376. package/dist/components/SegmentedControl/SegmentedControl.module.js +9 -0
  377. package/dist/components/SegmentedControl/index.d.ts +4 -0
  378. package/dist/components/Select/Select.d.ts +27 -0
  379. package/dist/components/Select/Select.js +11 -0
  380. package/dist/components/Select/index.d.ts +2 -0
  381. package/dist/components/Sidebar/Sidebar.css +1 -0
  382. package/dist/components/Sidebar/Sidebar.d.ts +42 -0
  383. package/dist/components/Sidebar/Sidebar.js +23 -0
  384. package/dist/components/Sidebar/Sidebar.module.js +3 -0
  385. package/dist/components/Sidebar/index.d.ts +2 -0
  386. package/dist/components/SkipLink/SkipLink.css +1 -0
  387. package/dist/components/SkipLink/SkipLink.d.ts +20 -0
  388. package/dist/components/SkipLink/SkipLink.js +20 -0
  389. package/dist/components/SkipLink/SkipLink.module.js +3 -0
  390. package/dist/components/SkipLink/index.d.ts +2 -0
  391. package/dist/components/Spinner/Spinner.css +1 -0
  392. package/dist/components/Spinner/Spinner.d.ts +13 -0
  393. package/dist/components/Spinner/Spinner.js +32 -0
  394. package/dist/components/Spinner/Spinner.module.js +7 -0
  395. package/dist/components/Spinner/index.d.ts +1 -0
  396. package/dist/components/Stack/Stack.css +1 -0
  397. package/dist/components/Stack/Stack.d.ts +25 -0
  398. package/dist/components/Stack/Stack.js +20 -0
  399. package/dist/components/Stack/Stack.module.js +3 -0
  400. package/dist/components/Stack/index.d.ts +2 -0
  401. package/dist/components/StatusDot/StatusDot.css +1 -0
  402. package/dist/components/StatusDot/StatusDot.d.ts +57 -0
  403. package/dist/components/StatusDot/StatusDot.js +20 -0
  404. package/dist/components/StatusDot/StatusDot.module.js +3 -0
  405. package/dist/components/StatusDot/index.d.ts +2 -0
  406. package/dist/components/Switch/Switch.d.ts +24 -0
  407. package/dist/components/Switch/Switch.js +12 -0
  408. package/dist/components/Switch/index.d.ts +2 -0
  409. package/dist/components/Switcher/Switcher.css +1 -0
  410. package/dist/components/Switcher/Switcher.d.ts +27 -0
  411. package/dist/components/Switcher/Switcher.js +22 -0
  412. package/dist/components/Switcher/Switcher.module.js +3 -0
  413. package/dist/components/Switcher/index.d.ts +2 -0
  414. package/dist/components/Tabs/Tab.d.ts +26 -0
  415. package/dist/components/Tabs/Tab.js +60 -0
  416. package/dist/components/Tabs/TabList.d.ts +16 -0
  417. package/dist/components/Tabs/TabList.js +22 -0
  418. package/dist/components/Tabs/TabPanel.d.ts +24 -0
  419. package/dist/components/Tabs/TabPanel.js +21 -0
  420. package/dist/components/Tabs/Tabs.css +1 -0
  421. package/dist/components/Tabs/Tabs.d.ts +81 -0
  422. package/dist/components/Tabs/Tabs.js +30 -0
  423. package/dist/components/Tabs/Tabs.module.js +8 -0
  424. package/dist/components/Tabs/TabsContext.d.ts +39 -0
  425. package/dist/components/Tabs/TabsContext.js +4 -0
  426. package/dist/components/Tabs/index.d.ts +8 -0
  427. package/dist/components/Tabs/tabIds.d.ts +16 -0
  428. package/dist/components/Tabs/tabIds.js +9 -0
  429. package/dist/components/Tabs/useTabsContext.d.ts +9 -0
  430. package/dist/components/Tabs/useTabsContext.js +10 -0
  431. package/dist/components/Text/Text.css +1 -0
  432. package/dist/components/Text/Text.d.ts +40 -0
  433. package/dist/components/Text/Text.js +16 -0
  434. package/dist/components/Text/Text.module.js +3 -0
  435. package/dist/components/Text/index.d.ts +2 -0
  436. package/dist/components/TextControl/TextControl.css +1 -0
  437. package/dist/components/TextControl/TextControl.d.ts +22 -0
  438. package/dist/components/TextControl/TextControl.js +27 -0
  439. package/dist/components/TextControl/TextControl.module.js +3 -0
  440. package/dist/components/TextControl/index.d.ts +1 -0
  441. package/dist/components/TextInput/TextInput.d.ts +31 -0
  442. package/dist/components/TextInput/TextInput.js +12 -0
  443. package/dist/components/TextInput/index.d.ts +2 -0
  444. package/dist/components/Textarea/Textarea.d.ts +24 -0
  445. package/dist/components/Textarea/Textarea.js +11 -0
  446. package/dist/components/Textarea/index.d.ts +2 -0
  447. package/dist/components/Theme/Theme.d.ts +46 -0
  448. package/dist/components/Theme/Theme.js +17 -0
  449. package/dist/components/Theme/index.d.ts +2 -0
  450. package/dist/components/Tooltip/Tooltip.css +1 -0
  451. package/dist/components/Tooltip/Tooltip.d.ts +49 -0
  452. package/dist/components/Tooltip/Tooltip.js +21 -0
  453. package/dist/components/Tooltip/Tooltip.module.js +3 -0
  454. package/dist/components/Tooltip/index.d.ts +4 -0
  455. package/dist/components/Tooltip/tooltipCoordinator.d.ts +14 -0
  456. package/dist/components/Tooltip/tooltipCoordinator.js +16 -0
  457. package/dist/components/Tooltip/useTooltip.d.ts +119 -0
  458. package/dist/components/Tooltip/useTooltip.js +73 -0
  459. package/dist/components/VisuallyHidden/VisuallyHidden.css +1 -0
  460. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +14 -0
  461. package/dist/components/VisuallyHidden/VisuallyHidden.js +19 -0
  462. package/dist/components/VisuallyHidden/VisuallyHidden.module.js +3 -0
  463. package/dist/components/VisuallyHidden/index.d.ts +2 -0
  464. package/dist/errors/MissingContextError.d.ts +11 -0
  465. package/dist/errors/MissingContextError.js +8 -0
  466. package/dist/errors/PopoverRefusedError.d.ts +12 -0
  467. package/dist/errors/PopoverRefusedError.js +8 -0
  468. package/dist/errors/index.d.ts +2 -0
  469. package/dist/forms/ControlSize.d.ts +4 -0
  470. package/dist/forms/FieldContext.d.ts +34 -0
  471. package/dist/forms/FieldContext.js +4 -0
  472. package/dist/forms/RadioGroupContext.d.ts +34 -0
  473. package/dist/forms/RadioGroupContext.js +4 -0
  474. package/dist/forms/hasContent.d.ts +10 -0
  475. package/dist/forms/hasContent.js +6 -0
  476. package/dist/forms/index.d.ts +8 -0
  477. package/dist/forms/useFieldControl.d.ts +36 -0
  478. package/dist/forms/useFieldControl.js +28 -0
  479. package/dist/forms/useRadioGroupItem.d.ts +50 -0
  480. package/dist/forms/useRadioGroupItem.js +26 -0
  481. package/dist/index.d.ts +107 -0
  482. package/dist/index.js +92 -0
  483. package/dist/layout/Space.d.ts +4 -0
  484. package/dist/layout/alignment.d.ts +8 -0
  485. package/dist/layout/index.d.ts +5 -0
  486. package/dist/layout/listRole.d.ts +11 -0
  487. package/dist/layout/listRole.js +5 -0
  488. package/dist/layout/spaceValue.d.ts +8 -0
  489. package/dist/layout/spaceValue.js +5 -0
  490. package/dist/layout/withCustomProperties.d.ts +9 -0
  491. package/dist/layout/withCustomProperties.js +8 -0
  492. package/dist/links/LinkOrButtonProps.d.ts +17 -0
  493. package/dist/links/index.d.ts +1 -0
  494. package/dist/menus/closeWhenFocusLeaves.d.ts +9 -0
  495. package/dist/menus/closeWhenFocusLeaves.js +11 -0
  496. package/dist/menus/focusItem.d.ts +6 -0
  497. package/dist/menus/focusItem.js +9 -0
  498. package/dist/menus/focusOnOpening.d.ts +11 -0
  499. package/dist/menus/focusOnOpening.js +11 -0
  500. package/dist/menus/hasModifier.d.ts +7 -0
  501. package/dist/menus/hasModifier.js +5 -0
  502. package/dist/menus/index.d.ts +11 -0
  503. package/dist/menus/itemText.d.ts +8 -0
  504. package/dist/menus/itemText.js +6 -0
  505. package/dist/menus/leaveMenuOnTab.d.ts +9 -0
  506. package/dist/menus/leaveMenuOnTab.js +6 -0
  507. package/dist/menus/pointerIntent.d.ts +36 -0
  508. package/dist/menus/pointerIntent.js +68 -0
  509. package/dist/menus/renderedItems.d.ts +8 -0
  510. package/dist/menus/renderedItems.js +4 -0
  511. package/dist/menus/watchRemovals.d.ts +8 -0
  512. package/dist/menus/watchRemovals.js +23 -0
  513. package/dist/overlays/OverlayDelay.d.ts +13 -0
  514. package/dist/overlays/OverlayPlacement.d.ts +6 -0
  515. package/dist/overlays/anchorNameFor.d.ts +7 -0
  516. package/dist/overlays/anchorNameFor.js +5 -0
  517. package/dist/overlays/index.d.ts +6 -0
  518. package/dist/overlays/mergeProps.d.ts +13 -0
  519. package/dist/overlays/mergeProps.js +29 -0
  520. package/dist/overlays/syncPopover.d.ts +11 -0
  521. package/dist/overlays/syncPopover.js +24 -0
  522. package/dist/overlays/useOverlay.d.ts +71 -0
  523. package/dist/overlays/useOverlay.js +49 -0
  524. package/dist/styles.css +1 -0
  525. package/fonts/playful.css +3 -0
  526. package/package.json +103 -3
package/LICENSE ADDED
@@ -0,0 +1,74 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matt Styles
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ Third-party notices
26
+
27
+ The icon artwork in src/components/Icon/ is copied from Lucide (https://lucide.dev),
28
+ published as the lucide-static package. Lucide's licence follows, unchanged. It
29
+ also covers the icons Lucide took from Feather, such as x, under Feather's MIT
30
+ licence.
31
+
32
+ ISC License
33
+
34
+ Copyright (c) 2026 Lucide Icons and Contributors
35
+
36
+ Permission to use, copy, modify, and/or distribute this software for any
37
+ purpose with or without fee is hereby granted, provided that the above
38
+ copyright notice and this permission notice appear in all copies.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
41
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
42
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
43
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
44
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
45
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
46
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
47
+
48
+ ---
49
+
50
+ The following Lucide icons are derived from the Feather project:
51
+
52
+ airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
53
+
54
+ The MIT License (MIT) (for the icons listed above)
55
+
56
+ Copyright (c) 2013-present Cole Bemis
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining a copy
59
+ of this software and associated documentation files (the "Software"), to deal
60
+ in the Software without restriction, including without limitation the rights
61
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62
+ copies of the Software, and to permit persons to whom the Software is
63
+ furnished to do so, subject to the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be included in all
66
+ copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
74
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,130 @@
1
- # Temporary Holding Version
1
+ # StylesUI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A React component library styled with CSS modules and CSS custom properties.
4
+
5
+ > [!WARNING]
6
+ > StylesUI is in beta and, for now, a personal project. It works, but expect rough edges, and expect components, props and tokens to change between releases until 1.0.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ pnpm add @krelborn/stylesui
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```tsx
17
+ import { Button, Card, Checkbox, Field, Heading, Stack, TextInput } from "@krelborn/stylesui";
18
+
19
+ export function SignIn({ error, saving }: { error?: string; saving: boolean }) {
20
+ return (
21
+ <Card padding="lg">
22
+ <Stack as="form" gap={4}>
23
+ <Heading level={1}>Sign in</Heading>
24
+ <Field description="We'll never share it." error={error} label="Email" required>
25
+ <TextInput autoComplete="email" type="email" />
26
+ </Field>
27
+ <Field label="Password" required>
28
+ <TextInput autoComplete="current-password" type="password" />
29
+ </Field>
30
+ <Checkbox>Remember me</Checkbox>
31
+ <Button busy={saving} type="submit">
32
+ Sign in
33
+ </Button>
34
+ </Stack>
35
+ </Card>
36
+ );
37
+ }
38
+ ```
39
+
40
+ Components accept every prop of the element they render, including `ref`. Layout components such as `Stack` render the element given in `as`. `Field` labels the control inside it and links its description and error to it, and marks it required, invalid or disabled. A `busy` `Button` shows a spinner and ignores clicks while keeping focus.
41
+
42
+ ### CSS and themes
43
+
44
+ Import the global stylesheet once at your app root. It provides the reset, colour ramps, design tokens, themes and palettes:
45
+
46
+ ```tsx
47
+ import "@krelborn/stylesui/styles.css";
48
+ ```
49
+
50
+ Each component's compiled JS imports its own CSS file, so only styles for components you use end up in your bundle. Your bundler must handle CSS imports from `node_modules` (Vite, Next.js and webpack do by default).
51
+
52
+ The `default` theme and its `bright` palette apply to the whole page, and colour mode follows the OS. Use `Theme` to switch the theme, palette or mode for any subtree; they nest:
53
+
54
+ ```tsx
55
+ import { Button, Card, Heading, Theme } from "@krelborn/stylesui";
56
+
57
+ <Theme mode="dark" theme="playful">
58
+ <Card>
59
+ <Heading level={2}>Hello</Heading>
60
+ <Button>Get started</Button>
61
+ </Card>
62
+ </Theme>;
63
+ ```
64
+
65
+ A theme sets shape (radius, borders, shadows, spacing, motion and fonts) and a palette sets colour. Each theme brings a companion palette, `bright` for `default` and `pop` for `playful`, and `palette` swaps it for any of the five: `bright` (a white page), `mist` (a cool grey page with white cards), `paper` (a warm off-white page), `dusk` (the dimmest light mode and a softer dark mode) and `pop`. For example, `<Theme palette="mist">` keeps default's shapes on a less bright page. Set `palette` beside `theme`, because a palette on an outer element doesn't reach through an inner `Theme` that sets a theme.
66
+
67
+ `Theme` sets `data-sui-theme`, `data-sui-palette` and `data-sui-mode` attributes; `styles.css` paints the background, text colour and font of any element carrying them, so you can also put them on any element yourself, e.g. `<html data-sui-theme="playful" data-sui-mode="dark">`, and it behaves the same way. To customise, override `--sui-*` custom properties. Semantic tokens such as `--sui-color-primary` can be overridden on any element, since components read them directly. Form controls, popovers and code chips read their own layer tokens (`--sui-color-field`, `--sui-color-overlay` and `--sui-color-sunken`), so `--sui-color-background` recolours only the page and `--sui-color-surface` only panels such as `Card`. Base tokens others are built from — `--sui-space-unit`, ramp steps like `--sui-blue-600`, the palette's `--sui-color-ink`, `--sui-color-shadow-soft` and `--sui-color-shadow-hard`, and the theme's `--sui-control-outline`, `--sui-shadow-hardness` and `--sui-shadow-sm-offset` — only take effect when overridden on `:root` or an element with `data-sui-theme` or `data-sui-palette`, since that's where the derived tokens (`--sui-space-*`, `--sui-color-control-border`, `--sui-color-shadow`, `--sui-shadow-sm`, the semantic colours) resolve their `var()`s.
68
+
69
+ The `playful` theme uses Fredoka for headings and Nunito for body text. They're self-hosted and kept out of `styles.css`, so import them alongside it if you use playful; without them it falls back to the system's rounded font:
70
+
71
+ ```tsx
72
+ import "@krelborn/stylesui/styles.css";
73
+ import "@krelborn/stylesui/fonts/playful.css";
74
+ ```
75
+
76
+ Fredoka and Nunito are licensed under the SIL Open Font License 1.1 and come from the [Fontsource](https://fontsource.org) packages `@fontsource-variable/fredoka` and `@fontsource-variable/nunito`.
77
+
78
+ Playful's buttons lift on hover and press down when clicked. When the OS asks for reduced motion, only their colours transition.
79
+
80
+ Themes and palettes use CSS `light-dark()`, which needs Chrome 123, Safari 17.5 or Firefox 120.
81
+
82
+ `Tooltip`, `Popover`, the menus (`useMenu`, `useContextMenu` and `Menubar`), `Combobox` and `Autocomplete` use the Popover API and CSS anchor positioning, which need Chrome/Edge 129, Firefox 147 or Safari 26. `NavBar` anchors its wide layout's panels too, and collapses with a container style query, which needs Firefox 151; Firefox 147 to 150 show its wide layout at every width. With Vite, the CSS target below leaves their anchor positioning styles unchanged.
83
+
84
+ ### Bundler CSS target
85
+
86
+ Set your bundler's CSS target to at least Chrome/Edge 123, Firefox 120, Safari 17.5, or colour modes stop nesting: a lower target makes lightningcss rewrite `light-dark()` into fallback variables resolved once at `:root`. With Vite:
87
+
88
+ ```ts
89
+ export default defineConfig({
90
+ build: { cssTarget: ["chrome123", "edge123", "firefox120", "safari17.5"] },
91
+ });
92
+ ```
93
+
94
+ Other lightningcss-based tools need the equivalent `targets`.
95
+
96
+ ## Requirements
97
+
98
+ - React 19.2 or later
99
+
100
+ ## Development
101
+
102
+ | Script | Description |
103
+ | ---------------------- | ------------------------------------------------------ |
104
+ | `pnpm storybook` | Run Storybook and its component docs on port 6006 |
105
+ | `pnpm build-storybook` | Build a static Storybook to `storybook-static/` |
106
+ | `pnpm build` | Build the library to `dist/` (ESM + type declarations) |
107
+ | `pnpm test` | Run tests once (`pnpm test:watch` to watch) |
108
+ | `pnpm typecheck` | Type-check the project |
109
+ | `pnpm lint` | Lint with oxlint |
110
+ | `pnpm format` | Format with oxfmt (`pnpm format:check` to check only) |
111
+
112
+ A Husky pre-commit hook runs lint-staged, which lints (`oxlint --fix`) and formats (`oxfmt`) staged files and blocks the commit on lint errors.
113
+
114
+ ### Adding a component
115
+
116
+ Create `src/components/<Name>/` with `<Name>.tsx`, `<Name>.module.css`, `<Name>.test.tsx`, `<Name>.stories.tsx` and an `index.ts`, then export it from `src/index.ts`. Build on `Box` where possible. JSDoc on the component, its props and each story becomes the component's Docs page in Storybook.
117
+
118
+ Form components share code in `src/forms/`: the `ControlSize` type, the `FieldContext` and `RadioGroupContext` contexts (each in its own module), the `useFieldControl` hook that merges a `Field`'s state into a control's props, the `useRadioGroupItem` hook that gives `Radio` and `Segment` their `RadioGroup`'s name and selection, and `hasContent`. Only `ControlSize` is exported from the package. `TextControl` (behind `TextInput`, `Textarea`, `Select`, `Combobox` and `Autocomplete`), `ChoiceControl` (behind `Checkbox`, `Switch` and `Radio`) and `RequiredIndicator` are internal components: they are not exported from `src/index.ts` and have no stories or tests of their own, since the public components built on them cover them. `TextControl` and `ChoiceControl` own the one CSS module their wrappers share, so those wrappers have none.
119
+
120
+ Tree-shaking relies on the build preserving one output module per source module and on `"sideEffects": ["**/*.css"]` in `package.json`. Avoid top-level side effects in component modules.
121
+
122
+ ## Feedback
123
+
124
+ Bug reports, questions and ideas are very welcome: please [open an issue](https://github.com/Krelborn/StylesUI/issues).
125
+
126
+ I'm not accepting pull requests. StylesUI is a personal project I maintain in my spare time, and for now I want to keep its design in one place. If you have a fix in mind, describe it in an issue and I'll take it from there.
127
+
128
+ ## Licence
129
+
130
+ MIT. The icons are [Lucide](https://lucide.dev)'s, under the ISC licence, and some of those are Feather's, under the MIT licence. `LICENSE` holds all three.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Requires an accessible name for a landmark or widget, given as `aria-label` or `aria-labelledby`
3
+ *
4
+ * Compose it into a props type as
5
+ * `OwnProps & RequiredAccessibleName & Omit<BoxProps<E>, "aria-label" | "aria-labelledby" | …>`. `Omit` over a props
6
+ * type that already contains it makes the name optional, because `Omit` flattens the union into one object type.
7
+ */
8
+ export type RequiredAccessibleName = {
9
+ /**
10
+ * The name, when no visible text names the element
11
+ */
12
+ "aria-label": string;
13
+ /**
14
+ * Ids of the visible elements that name the element
15
+ */
16
+ "aria-labelledby"?: string;
17
+ } | {
18
+ /**
19
+ * The name, when no visible text names the element
20
+ */
21
+ "aria-label"?: string;
22
+ /**
23
+ * Ids of the visible elements that name the element
24
+ */
25
+ "aria-labelledby": string;
26
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Turns any string into text that can sit inside an element id
3
+ *
4
+ * @param value the string, which may hold any characters, unpaired surrogates included
5
+ * @returns letters, digits, hyphens and underscores, different for every different value
6
+ */
7
+ export declare function idSegment(value: string): string;
@@ -0,0 +1,5 @@
1
+ // src/accessibility/idSegment.ts
2
+ function e(e) {
3
+ return e.replace(/[^A-Za-z0-9-]/g, (e) => `_${e.charCodeAt(0).toString(16).padStart(4, "0")}`);
4
+ }
5
+ export { e as idSegment };
@@ -0,0 +1,2 @@
1
+ export { idSegment } from "./idSegment";
2
+ export type { RequiredAccessibleName } from "./RequiredAccessibleName";
@@ -0,0 +1,7 @@
1
+ export { optionId } from "./optionId";
2
+ export { optionTextValue, renderedOptions } from "./renderedOptions";
3
+ export type { RenderedOption } from "./renderedOptions";
4
+ export { targetIndexForKey } from "./targetIndexForKey";
5
+ export type { WritingDirection } from "./targetIndexForKey";
6
+ export { extendTypeAheadQuery, isTypeAheadQueryLive, typeAheadTarget } from "./typeAhead";
7
+ export type { TypeAheadQuery } from "./typeAhead";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Builds the id of the option for a value
3
+ *
4
+ * @param baseId the `Listbox`'s generated id
5
+ * @param value the option's value
6
+ * @returns an id unique to the value within its `Listbox`, whatever characters the value holds
7
+ */
8
+ export declare function optionId(baseId: string, value: string): string;
@@ -0,0 +1,6 @@
1
+ import { idSegment as e } from "../accessibility/idSegment.js";
2
+ // src/collections/optionId.ts
3
+ function t(t, n) {
4
+ return `${t}-option-${e(n)}`;
5
+ }
6
+ export { t as optionId };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * An option as a listbox renders it
3
+ */
4
+ export interface RenderedOption {
5
+ /**
6
+ * Whether the option can be reached but not selected
7
+ */
8
+ disabled: boolean;
9
+ /**
10
+ * The option element
11
+ */
12
+ element: HTMLElement;
13
+ /**
14
+ * The text type-ahead matches: the option's `textValue`, else the text of the elements its `aria-labelledby` names,
15
+ * else its own text
16
+ */
17
+ textValue: string;
18
+ /**
19
+ * The option's value
20
+ */
21
+ value: string;
22
+ }
23
+ /**
24
+ * Reads the options a listbox renders
25
+ *
26
+ * @param listbox the listbox element
27
+ * @returns each option that is not hidden or inert, in document order, with its value, its type-ahead text and
28
+ * whether it is disabled
29
+ */
30
+ export declare function renderedOptions(listbox: HTMLElement): RenderedOption[];
31
+ /**
32
+ * Reads the text an option is matched by, whether or not it is hidden
33
+ *
34
+ * @param option the option element
35
+ * @returns its `data-text-value`, else the text of the elements its `aria-labelledby` names, else its own text
36
+ */
37
+ export declare function optionTextValue(option: HTMLElement): string;
@@ -0,0 +1,17 @@
1
+ // src/collections/renderedOptions.ts
2
+ function e(e) {
3
+ return Array.from(e.querySelectorAll("[role=\"option\"]")).filter((e) => e.closest("[hidden], [inert]") === null).map((e) => ({
4
+ disabled: e.getAttribute("aria-disabled") === "true",
5
+ element: e,
6
+ textValue: t(e),
7
+ value: e.dataset.value ?? ""
8
+ }));
9
+ }
10
+ function t(e) {
11
+ return e.dataset.textValue ?? n(e) ?? e.textContent ?? "";
12
+ }
13
+ function n(e) {
14
+ let t = e.getRootNode(), n = t instanceof ShadowRoot ? t : e.ownerDocument, r = (e.getAttribute("aria-labelledby") ?? "").split(/\s+/).map((e) => n.getElementById(e)).filter((e) => e !== null);
15
+ return r.length === 0 ? void 0 : r.map((e) => e.textContent).join(" ");
16
+ }
17
+ export { t as optionTextValue, e as renderedOptions };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Direction a collection's items run in
3
+ */
4
+ export type CollectionOrientation = "horizontal" | "vertical";
5
+ /**
6
+ * Writing direction around a collection, which decides whether Left or Right moves forward in a horizontal one
7
+ */
8
+ export type WritingDirection = "ltr" | "rtl";
9
+ interface TargetIndexOptions {
10
+ /**
11
+ * How many items the collection has
12
+ */
13
+ count: number;
14
+ /**
15
+ * Index of the focused item, or -1 when none is
16
+ */
17
+ currentIndex: number;
18
+ /**
19
+ * Writing direction around the collection. It only matters for a horizontal collection. Defaults to `ltr`.
20
+ */
21
+ direction?: WritingDirection;
22
+ /**
23
+ * The pressed key, as `KeyboardEvent.key` gives it
24
+ */
25
+ key: string;
26
+ /**
27
+ * Direction the items run in
28
+ */
29
+ orientation: CollectionOrientation;
30
+ /**
31
+ * Whether moving past either end goes round to the other end
32
+ */
33
+ wraps: boolean;
34
+ }
35
+ /**
36
+ * Finds the item an arrow key, Home or End moves focus to in a collection such as a tab list or a listbox
37
+ *
38
+ * @param options the key, the focused item, the size, orientation and wrapping of the collection, and its writing
39
+ * direction if it is horizontal and may run right to left
40
+ * @returns the index to move to, which is the current index at an end that does not wrap; null for a key the
41
+ * collection does not handle, or when it is empty. With nothing focused, forward goes to the first item and back goes
42
+ * to the last when wrapping, or to the first when not.
43
+ */
44
+ export declare function targetIndexForKey({ count, currentIndex, direction, key, orientation, wraps, }: TargetIndexOptions): number | null;
45
+ export {};
@@ -0,0 +1,16 @@
1
+ // src/collections/targetIndexForKey.ts
2
+ function e({ count: e, currentIndex: n, direction: r = "ltr", key: i, orientation: a, wraps: o }) {
3
+ let s = e - 1;
4
+ if (e === 0) return null;
5
+ if (i === "Home") return 0;
6
+ if (i === "End") return s;
7
+ let c = t(i, a, r);
8
+ if (c === 0) return null;
9
+ if (n < 0) return c > 0 || !o ? 0 : s;
10
+ let l = n + c;
11
+ return l < 0 ? o ? s : 0 : l > s ? o ? 0 : s : l;
12
+ }
13
+ function t(e, t, n) {
14
+ return e === (t === "vertical" ? "ArrowDown" : n === "rtl" ? "ArrowLeft" : "ArrowRight") ? 1 : e === (t === "vertical" ? "ArrowUp" : n === "rtl" ? "ArrowRight" : "ArrowLeft") ? -1 : 0;
15
+ }
16
+ export { e as targetIndexForKey };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The text typed so far for type-ahead, and when its last character was typed
3
+ */
4
+ export interface TypeAheadQuery {
5
+ /**
6
+ * The characters typed so far
7
+ */
8
+ text: string;
9
+ /**
10
+ * When the last character was typed, in milliseconds
11
+ */
12
+ time: number;
13
+ }
14
+ /**
15
+ * Adds a typed character to a type-ahead query
16
+ *
17
+ * @param query the query so far, or null when there is none
18
+ * @param character the character typed
19
+ * @param time when it was typed, in milliseconds
20
+ * @returns the query with the character added, or a new query of that character when the last one came more than
21
+ * 500ms before
22
+ */
23
+ export declare function extendTypeAheadQuery(query: TypeAheadQuery | null, character: string, time: number): TypeAheadQuery;
24
+ /**
25
+ * Says whether a type-ahead query is still being typed
26
+ *
27
+ * @param query the query so far, or null when there is none
28
+ * @param time the time now, in milliseconds
29
+ * @returns true when the query's last character came within 500ms, so a character typed now joins it
30
+ */
31
+ export declare function isTypeAheadQueryLive(query: TypeAheadQuery | null, time: number): boolean;
32
+ /**
33
+ * Finds the item type-ahead moves to
34
+ *
35
+ * @param labels each item's text, in order
36
+ * @param currentIndex the active item, or -1 for none
37
+ * @param text the typed text
38
+ * @returns the index of the first label from the current item on that starts with the text, ignoring case and a
39
+ * label's leading whitespace, and wrapping round. A single character starts after the current item, so typing it
40
+ * again moves on; longer text starts at the current item, so it keeps matching while it can. Null when no label
41
+ * matches.
42
+ */
43
+ export declare function typeAheadTarget(labels: readonly string[], currentIndex: number, text: string): number | null;
@@ -0,0 +1,18 @@
1
+ function e(e, n, r) {
2
+ return {
3
+ text: e !== null && t(e, r) ? e.text + n : n,
4
+ time: r
5
+ };
6
+ }
7
+ function t(e, t) {
8
+ return e !== null && t - e.time <= 500;
9
+ }
10
+ function n(e, t, n) {
11
+ let r = n.toLocaleLowerCase(), i = Array.from(n).length === 1 ? t + 1 : Math.max(t, 0);
12
+ for (let t = 0; t < e.length; t += 1) {
13
+ let n = (i + t) % e.length;
14
+ if (e[n].trim().toLocaleLowerCase().startsWith(r)) return n;
15
+ }
16
+ return null;
17
+ }
18
+ export { e as extendTypeAheadQuery, t as isTypeAheadQueryLive, n as typeAheadTarget };
@@ -0,0 +1 @@
1
+ .sui-accordion-LVhhv{--sui-accordion-padding-y:var(--sui-space-2,.5rem);--sui-accordion-padding-x:var(--sui-space-2,.5rem);--sui-accordion-inset:var(--sui-space-1,.25rem);--sui-accordion-gap:var(--sui-space-2,.5rem);--sui-accordion-font-size:var(--sui-font-size-md,1rem);--sui-accordion-description-font-size:var(--sui-font-size-sm,.875rem);--sui-accordion-divider:var(--sui-color-border,#d1d5db);--sui-accordion-indicator-color:var(--sui-color-text-muted,#4b5563);--sui-accordion-radius:var(--sui-radius-md,4px);--_sui-accordion-indicator-space:calc(var(--sui-accordion-font-size) + var(--sui-accordion-gap));--_sui-accordion-actions-end:0px;color:var(--sui-color-text,#111827)}.sui-accordion-LVhhv:not([data-variant=flush]){--sui-accordion-padding-x:var(--sui-space-4,1rem);--sui-accordion-inset:0px;--sui-accordion-radius:0px;--_sui-accordion-indicator-space:0px;--_sui-accordion-actions-end:var(--sui-accordion-padding-x)}.sui-accordion-LVhhv:not([data-variant=flush])[data-size=sm]{--sui-accordion-padding-x:var(--sui-space-3,.75rem)}.sui-accordion-LVhhv:not([data-variant=flush])[data-size=lg]{--sui-accordion-padding-x:var(--sui-space-6,1.5rem)}.sui-accordion-LVhhv[data-variant=joined]{border:var(--sui-border-width,1px) solid var(--sui-accordion-divider);border-radius:var(--sui-radius-lg,8px);overflow:clip}.sui-accordion-LVhhv[data-size=sm]{--sui-accordion-padding-y:var(--sui-space-1,.25rem);--sui-accordion-font-size:var(--sui-font-size-sm,.875rem);--sui-accordion-description-font-size:var(--sui-font-size-xs,.75rem)}.sui-accordion-LVhhv[data-size=lg]{--sui-accordion-padding-y:var(--sui-space-3,.75rem);--sui-accordion-font-size:var(--sui-font-size-lg,1.125rem);--sui-accordion-description-font-size:var(--sui-font-size-md,1rem)}.sui-accordion-LVhhv[data-variant=separated]{gap:var(--sui-space-3,.75rem);flex-direction:column;display:flex}.sui-accordion-LVhhv[data-variant=separated]>.sui-item-7ryVk{--sui-accordion-radius:calc(var(--sui-radius-lg,8px) - var(--sui-border-width,1px));border:var(--sui-border-width,1px) solid var(--sui-color-border,#d1d5db);border-radius:var(--sui-radius-lg,8px);background-color:var(--sui-color-surface,#f3f4f6);box-shadow:var(--sui-shadow-sm,0 1px 3px #0000001f);transition:box-shadow var(--sui-motion-spring,.12s ease-out), translate var(--sui-motion-spring,.12s ease-out)}@media (hover:hover){.sui-accordion-LVhhv[data-variant=separated]>.sui-item-7ryVk:has(>.sui-header-WaTdJ .sui-toggle-cSQLb:hover:not([aria-disabled=true])){box-shadow:var(--sui-shadow-sm,0 1px 3px #0000001f), 0 calc(var(--sui-control-depth,0px) / 2) 0 var(--sui-color-shadow,transparent);translate:0 calc(var(--sui-control-depth,0px) / -2)}}.sui-accordion-LVhhv:is([data-variant=flush],[data-variant=joined])>.sui-item-7ryVk+.sui-item-7ryVk{border-block-start:var(--sui-border-width,1px) solid var(--sui-accordion-divider)}.sui-header-WaTdJ{align-items:center;gap:var(--sui-accordion-inset);padding:var(--sui-accordion-inset);display:flex}.sui-heading-6PDIo{min-inline-size:0;font:inherit;flex:1;margin:0}.sui-toggle-cSQLb{align-items:center;gap:var(--sui-accordion-gap);inline-size:100%;padding:var(--sui-accordion-padding-y) var(--sui-accordion-padding-x);border-radius:var(--sui-accordion-radius);color:inherit;font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-accordion-font-size);font-weight:var(--sui-font-weight-control,500);line-height:var(--sui-line-height-tight,1.25);text-align:start;cursor:pointer;background-color:#0000;border:0;transition:background-color .12s;display:flex}@media (hover:hover){.sui-toggle-cSQLb:hover:not([aria-disabled=true]){background-color:color-mix(in srgb, currentColor 8%, transparent)}}.sui-toggle-cSQLb:active:not([aria-disabled=true]){background-color:color-mix(in srgb, currentColor 16%, transparent)}.sui-toggle-cSQLb:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:calc(-1 * var(--sui-focus-ring-width,2px))}.sui-toggle-cSQLb[aria-disabled=true]{color:color-mix(in srgb, var(--sui-color-text,#111827) 50%, transparent);cursor:not-allowed}.sui-toggle-cSQLb:not([data-variant=flush]){font-family:var(--sui-font-heading,system-ui, sans-serif)}.sui-indicator-5mEls{color:var(--sui-accordion-indicator-color);transition:background-color .12s ease, color .12s ease, rotate var(--sui-motion-spring,.12s ease-out)}.sui-toggle-cSQLb:not([data-variant=flush]) .sui-indicator-5mEls{order:1}.sui-toggle-cSQLb:not([data-variant=flush])[aria-expanded=true] .sui-chevron-i-HVZ{rotate:180deg}.sui-toggle-cSQLb[data-variant=separated] .sui-indicator-5mEls{box-sizing:content-box;padding:calc(.375em - var(--sui-border-width,1px));border:var(--sui-border-width,1px) solid var(--sui-color-control-border,transparent);border-radius:var(--sui-radius-full,9999px);background-color:var(--sui-color-secondary,#e5e7eb);color:var(--sui-color-on-secondary,#111827)}.sui-toggle-cSQLb[data-variant=separated][aria-expanded=true] .sui-indicator-5mEls{background-color:var(--sui-color-primary,#2563eb);color:var(--sui-color-on-primary,#fff)}.sui-toggle-cSQLb[aria-disabled=true] :is(.sui-indicator-5mEls,.sui-description-kokuI,.sui-trailing--LXlM){color:inherit}.sui-toggle-cSQLb[data-variant=separated][aria-disabled=true] .sui-indicator-5mEls{background-color:color-mix(in srgb, var(--sui-color-secondary,#e5e7eb) 50%, transparent)}.sui-toggle-cSQLb[data-variant=flush][aria-expanded=false] .sui-chevron-i-HVZ{rotate:-90deg}.sui-toggle-cSQLb[data-variant=flush][aria-expanded=false] .sui-chevron-i-HVZ:dir(rtl){rotate:90deg}.sui-plusMinus-j8bGi path:nth-child(2){transform-box:fill-box;transform-origin:50%;transition:rotate var(--sui-motion-spring,.12s ease-out)}.sui-toggle-cSQLb[aria-expanded=true] .sui-plusMinus-j8bGi path:nth-child(2){rotate:90deg}.sui-label-Ss7uW{flex:1;min-inline-size:0;display:grid}.sui-title--w5py{overflow-wrap:anywhere}.sui-description-kokuI,.sui-trailing--LXlM{color:var(--sui-color-text-muted,#4b5563);font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-accordion-description-font-size);font-weight:var(--sui-font-weight-regular,400)}.sui-trailing--LXlM{flex:none}.sui-actions-1vJf9{align-items:center;gap:var(--sui-accordion-inset);flex:none;padding-inline-end:var(--_sui-accordion-actions-end);display:flex}.sui-content-PEM9t{padding-block:0 var(--sui-space-3,.75rem);padding-inline:calc(var(--sui-accordion-inset) + var(--sui-accordion-padding-x) + var(--_sui-accordion-indicator-space)) calc(var(--sui-accordion-inset) + var(--sui-accordion-padding-x))}.sui-panel-Wx50w{interpolate-size:allow-keywords;transition:block-size .2s ease-out, content-visibility .2s ease-out allow-discrete;overflow:clip}.sui-panel-Wx50w[hidden]{block-size:0}@media (prefers-reduced-motion:reduce){.sui-indicator-5mEls{transition:background-color .12s,color .12s}.sui-plusMinus-j8bGi path:nth-child(2),.sui-panel-Wx50w,.sui-accordion-LVhhv[data-variant=separated]>.sui-item-7ryVk{transition:none}}@media (forced-colors:active){.sui-toggle-cSQLb[aria-disabled=true]{color:graytext}.sui-toggle-cSQLb[data-variant=separated] .sui-indicator-5mEls,.sui-toggle-cSQLb[data-variant=separated][aria-expanded=true] .sui-indicator-5mEls{color:buttontext;background-color:buttonface;border-color:buttontext}}@media print{.sui-panel-Wx50w[hidden=until-found]{content-visibility:visible;block-size:auto;transition:none}.sui-indicator-5mEls{display:none}}
@@ -0,0 +1,90 @@
1
+ import type { JSX, ReactNode } from "react";
2
+ import type { ControlSize } from "../../forms";
3
+ import type { BoxProps } from "../Box";
4
+ import type { HeadingLevel } from "../Heading";
5
+ /**
6
+ * Shape of the indicator that shows whether an item is open: a `chevron` that turns, or a `plusMinus` that turns from
7
+ * a plus into a minus
8
+ */
9
+ export type AccordionIndicator = "chevron" | "plusMinus";
10
+ /**
11
+ * Accordion looks: `flush` rows split by dividers, for inspectors and sidebars; `joined` items in one bordered box;
12
+ * `separated` items each drawn as a card
13
+ */
14
+ export type AccordionVariant = "flush" | "joined" | "separated";
15
+ interface AccordionOwnProps {
16
+ /**
17
+ * The `AccordionItem`s
18
+ */
19
+ children?: ReactNode;
20
+ /**
21
+ * Whether opening an item closes the others, so at most one is open once the user opens one. Items that `value` or
22
+ * `defaultValue` opens are shown as given. Defaults to `false`.
23
+ */
24
+ exclusive?: boolean;
25
+ /**
26
+ * Level of every item's heading, which the page outline decides
27
+ */
28
+ headingLevel: HeadingLevel;
29
+ /**
30
+ * Shape of the indicator that shows whether an item is open. Defaults to `chevron`.
31
+ */
32
+ indicator?: AccordionIndicator;
33
+ /**
34
+ * Called with the values of the open items when the user opens or closes one
35
+ */
36
+ onValueChange?: (value: string[]) => void;
37
+ /**
38
+ * Whether each open panel is a landmark region named by its title. Defaults to `true` for `joined` and `separated` and
39
+ * `false` for `flush`, whose many open sections would crowd the page's landmarks.
40
+ */
41
+ regions?: boolean;
42
+ /**
43
+ * Header size, matching the `Button` sizes. Defaults to `md`.
44
+ */
45
+ size?: ControlSize;
46
+ /**
47
+ * Look of the accordion. Defaults to `flush`.
48
+ */
49
+ variant?: AccordionVariant;
50
+ }
51
+ type AccordionOpenItems = {
52
+ /**
53
+ * Values of the items open at first. It leaves `Accordion` uncontrolled. Defaults to none.
54
+ */
55
+ defaultValue?: string[];
56
+ /**
57
+ * Not accepted with `defaultValue`
58
+ */
59
+ value?: never;
60
+ } | {
61
+ /**
62
+ * Not accepted with `value`
63
+ */
64
+ defaultValue?: never;
65
+ /**
66
+ * Values of the open items, which makes `Accordion` controlled: update it from `onValueChange`
67
+ */
68
+ value: string[];
69
+ };
70
+ /**
71
+ * Props for `Accordion`: its own props, `value` or `defaultValue`, and every other `div` prop
72
+ */
73
+ export type AccordionProps = AccordionOwnProps & AccordionOpenItems & Omit<BoxProps<"div">, "as" | "defaultValue" | keyof AccordionOwnProps>;
74
+ /**
75
+ * Sections of content that each open and close under a heading, following the WAI-ARIA accordion pattern. Give it an
76
+ * `AccordionItem` for each section. Any number of items can be open, or one with `exclusive`.
77
+ *
78
+ * @example
79
+ * <Accordion defaultValue={["layout"]} headingLevel={3} size="sm">
80
+ * <AccordionItem title="Layout" value="layout">…</AccordionItem>
81
+ * <AccordionItem title="Fill" value="fill">…</AccordionItem>
82
+ * </Accordion>
83
+ *
84
+ * @example
85
+ * <Accordion exclusive={true} headingLevel={2} indicator="plusMinus" size="lg" variant="separated">
86
+ * <AccordionItem title="Can I return a kit?" value="returns">…</AccordionItem>
87
+ * </Accordion>
88
+ */
89
+ export declare function Accordion({ className, defaultValue, exclusive, headingLevel, indicator, onKeyDown, onValueChange, regions, size, value, variant, ...rest }: AccordionProps): JSX.Element;
90
+ export {};
@@ -0,0 +1,47 @@
1
+ import { targetIndexForKey as e } from "../../collections/targetIndexForKey.js";
2
+ import { Box as t } from "../Box/Box.js";
3
+ import n from "./Accordion.module.js";
4
+ import { AccordionContext as r } from "./AccordionContext.js";
5
+ import { clsx as i } from "clsx";
6
+ import { useId as a, useState as o } from "react";
7
+ import { jsx as s } from "react/jsx-runtime";
8
+ // src/components/Accordion/Accordion.tsx
9
+ function c({ className: c, defaultValue: l = [], exclusive: u = !1, headingLevel: d, indicator: f = "chevron", onKeyDown: p, onValueChange: m, regions: h, size: g = "md", value: _, variant: v = "flush", ...y }) {
10
+ let b = a(), [x, S] = o(l), C = _ ?? x;
11
+ function w(e) {
12
+ let t;
13
+ t = C.includes(e) ? C.filter((t) => t !== e) : u ? [e] : [...C, e], _ === void 0 && S(t), m?.(t);
14
+ }
15
+ function T(t) {
16
+ if (p?.(t), t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
17
+ let r = t.currentTarget, i = Array.from(r.querySelectorAll(`.${n.toggle}`)).filter((e) => e.closest(`.${n.accordion}`) === r && e.closest("[hidden], [inert]") === null), a = i.findIndex((e) => e === t.target);
18
+ if (a === -1) return;
19
+ let o = e({
20
+ count: i.length,
21
+ currentIndex: a,
22
+ key: t.key,
23
+ orientation: "vertical",
24
+ wraps: !1
25
+ });
26
+ o !== null && (t.preventDefault(), i[o].focus());
27
+ }
28
+ return /* @__PURE__ */ s(r.Provider, {
29
+ value: {
30
+ baseId: b,
31
+ headingLevel: d,
32
+ indicator: f,
33
+ openValues: C,
34
+ regions: h ?? v !== "flush",
35
+ toggle: w,
36
+ variant: v
37
+ },
38
+ children: /* @__PURE__ */ s(t, {
39
+ ...y,
40
+ className: i(n.accordion, c),
41
+ onKeyDown: T,
42
+ "data-size": g,
43
+ "data-variant": v
44
+ })
45
+ });
46
+ }
47
+ export { c as Accordion };
@@ -0,0 +1,19 @@
1
+ import './Accordion.css';// src/components/Accordion/Accordion.module.css
2
+ var e = "sui-accordion-LVhhv", t = "sui-item-7ryVk", n = "sui-header-WaTdJ", r = "sui-toggle-cSQLb", i = "sui-heading-6PDIo", a = "sui-indicator-5mEls", o = "sui-chevron-i-HVZ", s = "sui-description-kokuI", c = "sui-trailing--LXlM", l = "sui-plusMinus-j8bGi", u = "sui-label-Ss7uW", d = "sui-title--w5py", f = "sui-actions-1vJf9", p = "sui-content-PEM9t", m = "sui-panel-Wx50w", h = {
3
+ accordion: e,
4
+ item: t,
5
+ header: n,
6
+ toggle: r,
7
+ heading: i,
8
+ indicator: a,
9
+ chevron: o,
10
+ description: s,
11
+ trailing: c,
12
+ plusMinus: l,
13
+ label: u,
14
+ title: d,
15
+ actions: f,
16
+ content: p,
17
+ panel: m
18
+ };
19
+ export { e as accordion, f as actions, o as chevron, p as content, h as default, s as description, n as header, i as heading, a as indicator, t as item, u as label, m as panel, l as plusMinus, d as title, r as toggle, c as trailing };