@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
@@ -0,0 +1,138 @@
1
+ import { extendTypeAheadQuery as e, isTypeAheadQueryLive as t, typeAheadTarget as n } from "../../collections/typeAhead.js";
2
+ import { optionId as r } from "../../collections/optionId.js";
3
+ import { renderedOptions as i } from "../../collections/renderedOptions.js";
4
+ import { targetIndexForKey as a } from "../../collections/targetIndexForKey.js";
5
+ import { useEffect as o, useEffectEvent as s, useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
6
+ // src/components/Combobox/useComboboxList.ts
7
+ var f = {
8
+ block: "nearest",
9
+ container: "nearest"
10
+ };
11
+ function p({ controlId: p, filter: m, onCommit: h, query: g, selection: _ }) {
12
+ let v = c(), y = `${v}-list`, b = u(null), x = u(null), S = u(!1), C = u(!1), [w, T] = d(!1), [E, D] = d(null), { select: O, selectedContent: k, selectedValue: A, setSelectedContent: j } = _, M = s((e) => {
13
+ let t = m === null || g === "" ? void 0 : e.find((e) => !e.disabled);
14
+ D(t === void 0 ? null : {
15
+ source: "keyboard",
16
+ value: t.value
17
+ });
18
+ }), N = s((e) => {
19
+ E !== null && !e.some((e) => e.value === E.value) && D(null);
20
+ });
21
+ l(() => {
22
+ let e = P();
23
+ b.current?.toggleAttribute("data-empty", e.length === 0), C.current ? (C.current = !1, M(e)) : N(e);
24
+ }), o(() => {
25
+ if (!w) return;
26
+ let e = E !== null && (E.source === "keyboard" || S.current);
27
+ S.current = !1, e && P().find((e) => e.value === E.value)?.element.scrollIntoView(f);
28
+ }, [E, w]);
29
+ function P() {
30
+ return b.current === null ? [] : i(b.current);
31
+ }
32
+ function F(e, t, n) {
33
+ let r = e.at(t);
34
+ D(r === void 0 || t < 0 ? null : {
35
+ source: n,
36
+ value: r.value
37
+ });
38
+ }
39
+ function I(e) {
40
+ let t = e.findIndex((e) => e.value === E?.value);
41
+ return t === -1 ? e.findIndex((e) => e.value === A) : t;
42
+ }
43
+ function L(e, t) {
44
+ let n = P(), r = Math.max(n.findIndex((e) => e.value === A), 0), i = {
45
+ first: 0,
46
+ last: n.length - 1,
47
+ none: -1,
48
+ selected: r
49
+ };
50
+ S.current = !0, T(!0), F(n, i[e], t);
51
+ }
52
+ function R(e, t) {
53
+ e ? z() : L("selected", t);
54
+ }
55
+ function z() {
56
+ T(!1), D(null);
57
+ }
58
+ function B(e) {
59
+ let t = P().find((t) => t.value === e);
60
+ O(e), h?.(t?.textValue ?? ""), z();
61
+ }
62
+ function V() {
63
+ let e = P().find((e) => e.value === E?.value);
64
+ e === void 0 ? z() : e.disabled || B(e.value);
65
+ }
66
+ function H(e) {
67
+ let t = P(), n = t.findIndex((e) => e.value === E?.value), r = n === -1 && e === "ArrowUp" ? t.length - 1 : a({
68
+ count: t.length,
69
+ currentIndex: n,
70
+ key: e,
71
+ orientation: "vertical",
72
+ wraps: !1
73
+ });
74
+ return r === null || r === -1 ? [
75
+ "ArrowDown",
76
+ "ArrowUp",
77
+ "End",
78
+ "Home"
79
+ ].includes(e) : (F(t, r, "keyboard"), !0);
80
+ }
81
+ function U() {
82
+ return t(x.current, Date.now());
83
+ }
84
+ function W(r) {
85
+ let i = Date.now();
86
+ if (Array.from(r).length !== 1 || r === " " && !t(x.current, i)) return !1;
87
+ x.current = e(x.current, r, i);
88
+ let a = P(), o = a.map((e) => e.textValue), s = n(o, I(a), x.current.text);
89
+ return s !== null && F(a, s, "keyboard"), !0;
90
+ }
91
+ function G() {
92
+ return P().length;
93
+ }
94
+ function K() {
95
+ C.current = !0;
96
+ }
97
+ function q(e) {
98
+ b.current = e;
99
+ }
100
+ function J(e) {
101
+ D({
102
+ source: "pointer",
103
+ value: e
104
+ });
105
+ }
106
+ return {
107
+ activeDescendant: w && E !== null ? r(v, E.value) : void 0,
108
+ attachList: q,
109
+ baseId: v,
110
+ close: z,
111
+ commitActive: V,
112
+ context: {
113
+ activateFromPointer: J,
114
+ active: E,
115
+ baseId: v,
116
+ commit: B,
117
+ filter: m,
118
+ query: g,
119
+ selectedValue: A,
120
+ setActive: D,
121
+ setSelectedContent: j
122
+ },
123
+ controlId: p ?? `${v}-control`,
124
+ countShown: G,
125
+ isTypingAhead: U,
126
+ listId: y,
127
+ matchFirst: K,
128
+ moveByKey: H,
129
+ open: w,
130
+ openList: L,
131
+ select: O,
132
+ selectedContent: k,
133
+ selectedValue: A,
134
+ toggleList: R,
135
+ typeAhead: W
136
+ };
137
+ }
138
+ export { p as useComboboxList };
@@ -0,0 +1,35 @@
1
+ import type { ReactNode, RefObject } from "react";
2
+ interface UseComboboxOptionOptions {
3
+ /**
4
+ * The option's label
5
+ */
6
+ children: ReactNode;
7
+ /**
8
+ * The option's leading content
9
+ */
10
+ leading: ReactNode;
11
+ /**
12
+ * The option element
13
+ */
14
+ optionRef: RefObject<HTMLDivElement | null>;
15
+ /**
16
+ * Whether the option is selected
17
+ */
18
+ selected: boolean;
19
+ /**
20
+ * The text the consumer gave the option, if any
21
+ */
22
+ textValue: string | undefined;
23
+ /**
24
+ * The option's value
25
+ */
26
+ value: string;
27
+ }
28
+ /**
29
+ * Keeps an option in step with its combobox: shown or hidden for the filter, showing itself in the field while
30
+ * selected, and no longer active once it unmounts
31
+ *
32
+ * @param options the option's state, content and element
33
+ */
34
+ export declare function useComboboxOption({ children, leading, optionRef, selected, textValue, value, }: UseComboboxOptionOptions): void;
35
+ export {};
@@ -0,0 +1,46 @@
1
+ import { optionTextValue as e } from "../../collections/renderedOptions.js";
2
+ import { isOptionShown as t } from "./isOptionShown.js";
3
+ import { useComboboxContext as n } from "./useComboboxContext.js";
4
+ import { useLayoutEffect as r } from "react";
5
+ import { c as i } from "react/compiler-runtime";
6
+ // src/components/Combobox/useComboboxOption.ts
7
+ function a(a) {
8
+ let o = i(29), { children: s, leading: c, optionRef: l, selected: u, textValue: d, value: f } = a, { filter: p, query: m, setActive: h, setSelectedContent: g } = n("ComboboxOption"), _;
9
+ o[0] !== p || o[1] !== l || o[2] !== m ? (_ = () => {
10
+ let n = l.current;
11
+ n !== null && (n.hidden = !t(p, m, e(n)));
12
+ }, o[0] = p, o[1] = l, o[2] = m, o[3] = _) : _ = o[3];
13
+ let v;
14
+ o[4] !== s || o[5] !== p || o[6] !== l || o[7] !== m || o[8] !== d ? (v = [
15
+ s,
16
+ p,
17
+ l,
18
+ m,
19
+ d
20
+ ], o[4] = s, o[5] = p, o[6] = l, o[7] = m, o[8] = d, o[9] = v) : v = o[9], r(_, v);
21
+ let y;
22
+ o[10] !== s || o[11] !== c || o[12] !== l || o[13] !== u || o[14] !== g || o[15] !== f ? (y = () => {
23
+ let t = l.current;
24
+ u && t !== null && g({
25
+ label: s,
26
+ leading: c,
27
+ text: e(t),
28
+ value: f
29
+ });
30
+ }, o[10] = s, o[11] = c, o[12] = l, o[13] = u, o[14] = g, o[15] = f, o[16] = y) : y = o[16];
31
+ let b;
32
+ o[17] !== s || o[18] !== c || o[19] !== l || o[20] !== u || o[21] !== g || o[22] !== d || o[23] !== f ? (b = [
33
+ s,
34
+ c,
35
+ l,
36
+ u,
37
+ g,
38
+ d,
39
+ f
40
+ ], o[17] = s, o[18] = c, o[19] = l, o[20] = u, o[21] = g, o[22] = d, o[23] = f, o[24] = b) : b = o[24], r(y, b);
41
+ let x, S;
42
+ o[25] !== h || o[26] !== f ? (x = () => () => {
43
+ h((e) => e?.value === f ? null : e);
44
+ }, S = [h, f], o[25] = h, o[26] = f, o[27] = x, o[28] = S) : (x = o[27], S = o[28]), r(x, S);
45
+ }
46
+ export { a as useComboboxOption };
@@ -0,0 +1,45 @@
1
+ import type { Dispatch, SetStateAction } from "react";
2
+ import type { SelectedContent } from "./ComboboxContext";
3
+ interface UseComboboxSelectionOptions {
4
+ /**
5
+ * The value selected at first when uncontrolled
6
+ */
7
+ defaultValue: string | null;
8
+ /**
9
+ * Called with the new selection
10
+ */
11
+ onValueChange: ((value: string | null) => void) | undefined;
12
+ /**
13
+ * The selected value when controlled, or undefined when uncontrolled
14
+ */
15
+ value: string | null | undefined;
16
+ }
17
+ /**
18
+ * A combobox's selection and what its selected option shows
19
+ */
20
+ export interface ComboboxSelection {
21
+ /**
22
+ * Selects a value, or none, reporting it unless it is already selected
23
+ */
24
+ select: (value: string | null) => void;
25
+ /**
26
+ * What the selected option shows in the field, or null when it has not rendered
27
+ */
28
+ selectedContent: SelectedContent | null;
29
+ /**
30
+ * The selected value, or null for none
31
+ */
32
+ selectedValue: string | null;
33
+ /**
34
+ * Sets what the selected option shows, which it hands over as it renders
35
+ */
36
+ setSelectedContent: Dispatch<SetStateAction<SelectedContent | null>>;
37
+ }
38
+ /**
39
+ * Holds a combobox's selection, controlled or uncontrolled, and what the selected option shows in the field
40
+ *
41
+ * @param options the selection props and the change callback
42
+ * @returns the selection and the ways it changes
43
+ */
44
+ export declare function useComboboxSelection({ defaultValue, onValueChange, value, }: UseComboboxSelectionOptions): ComboboxSelection;
45
+ export {};
@@ -0,0 +1,17 @@
1
+ import { useState as e } from "react";
2
+ import { c as t } from "react/compiler-runtime";
3
+ // src/components/Combobox/useComboboxSelection.ts
4
+ function n(n) {
5
+ let r = t(8), { defaultValue: i, onValueChange: a, value: o } = n, [s, c] = e(i), [l, u] = e(null), d = o === void 0 ? s : o, f;
6
+ r[0] !== a || r[1] !== d || r[2] !== o ? (f = function(e) {
7
+ e !== d && (o === void 0 && c(e), a?.(e));
8
+ }, r[0] = a, r[1] = d, r[2] = o, r[3] = f) : f = r[3];
9
+ let p = f, m = l?.value === d ? l : null, h;
10
+ return r[4] !== p || r[5] !== d || r[6] !== m ? (h = {
11
+ select: p,
12
+ selectedContent: m,
13
+ selectedValue: d,
14
+ setSelectedContent: u
15
+ }, r[4] = p, r[5] = d, r[6] = m, r[7] = h) : h = r[7], h;
16
+ }
17
+ export { n as useComboboxSelection };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * What an `Autocomplete`'s live region says
3
+ */
4
+ interface ResultsAnnouncement {
5
+ /**
6
+ * The live region's text
7
+ */
8
+ announcement: string;
9
+ /**
10
+ * Says how many options match once typing pauses while the list stays open, replacing any count still to come
11
+ */
12
+ announceCount: () => void;
13
+ }
14
+ /**
15
+ * Announces how many options match once typing pauses for the type-ahead window
16
+ *
17
+ * @param resultsLabel the words for a number of matches
18
+ * @param countShown counts the options the filter shows
19
+ * @param listOpen whether the list is open; a count still to come is dropped as it closes
20
+ * @returns the live region's text and a way to announce the count
21
+ */
22
+ export declare function useResultsAnnouncement(resultsLabel: (count: number) => string, countShown: () => number, listOpen: boolean): ResultsAnnouncement;
23
+ export {};
@@ -0,0 +1,24 @@
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ import { c as r } from "react/compiler-runtime";
3
+ // src/components/Combobox/useResultsAnnouncement.ts
4
+ var i = 500;
5
+ function a(a, o, s) {
6
+ let c = r(11), [l, u] = n(""), d = t(void 0), f, p;
7
+ c[0] === Symbol.for("react.memo_cache_sentinel") ? (f = () => () => clearTimeout(d.current), p = [], c[0] = f, c[1] = p) : (f = c[0], p = c[1]), e(f, p);
8
+ let m, h;
9
+ c[2] === s ? (m = c[3], h = c[4]) : (m = () => {
10
+ s || clearTimeout(d.current);
11
+ }, h = [s], c[2] = s, c[3] = m, c[4] = h), e(m, h);
12
+ let g;
13
+ c[5] !== o || c[6] !== a ? (g = function() {
14
+ u(""), clearTimeout(d.current), d.current = setTimeout(() => {
15
+ u(a(o()));
16
+ }, i);
17
+ }, c[5] = o, c[6] = a, c[7] = g) : g = c[7];
18
+ let _ = g, v;
19
+ return c[8] !== _ || c[9] !== l ? (v = {
20
+ announceCount: _,
21
+ announcement: l
22
+ }, c[8] = _, c[9] = l, c[10] = v) : v = c[10], v;
23
+ }
24
+ export { a as useResultsAnnouncement };
@@ -0,0 +1,2 @@
1
+ export { useContextMenu } from "./useContextMenu";
2
+ export type { UseContextMenuOptions, UseContextMenuResult } from "./useContextMenu";
@@ -0,0 +1,112 @@
1
+ import type { CSSProperties, FocusEvent, KeyboardEvent, MouseEvent, PointerEvent } from "react";
2
+ import type { RequiredAccessibleName } from "../../accessibility";
3
+ import type { MenuOverlayProps } from "../Menu/Menu";
4
+ /**
5
+ * Options for `useContextMenu`
6
+ */
7
+ export interface UseContextMenuOptions {
8
+ /**
9
+ * Called with the new open state when the menu opens or closes
10
+ */
11
+ onOpenChange?: (open: boolean) => void;
12
+ }
13
+ /**
14
+ * Props `getTargetProps` sets on the region
15
+ */
16
+ interface ContextMenuTargetProps {
17
+ /**
18
+ * Marks the region, so a region inside it handles its own events
19
+ */
20
+ "data-context-menu-region": "";
21
+ /**
22
+ * Opens the menu at the pointer, or at the focused element when no pointer sent the event
23
+ */
24
+ onContextMenu: (event: MouseEvent<HTMLElement>) => void;
25
+ /**
26
+ * Opens the menu at the focused element on Shift+F10 or the ContextMenu key
27
+ */
28
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
29
+ /**
30
+ * Notes the pointer pressing in the region, which the menu holds while the press that opened it lasts, and opens the
31
+ * menu on a touch held in place
32
+ */
33
+ onPointerDown: (event: PointerEvent<HTMLElement>) => void;
34
+ /**
35
+ * Names the region as the menu's anchor, and stops iOS showing its callout on a held link or image
36
+ */
37
+ style: CSSProperties;
38
+ }
39
+ /**
40
+ * Props `getMenuProps` sets on the `Menu`
41
+ */
42
+ interface ContextMenuOverlayProps extends MenuOverlayProps {
43
+ /**
44
+ * Places the menu at the point it opened at rather than beside the region
45
+ */
46
+ "data-context-menu": "";
47
+ /**
48
+ * Closes the menu when focus leaves it
49
+ */
50
+ onBlur: (event: FocusEvent<HTMLElement>) => void;
51
+ /**
52
+ * Keeps the browser's menu from opening over the menu
53
+ */
54
+ onContextMenu: (event: MouseEvent<HTMLElement>) => void;
55
+ /**
56
+ * Closes the menu on Tab, returning focus to where it opened from
57
+ */
58
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
59
+ /**
60
+ * The point's distances from each edge of the region
61
+ */
62
+ style: CSSProperties;
63
+ }
64
+ /**
65
+ * Prop getters for the region a context menu opens in and its `Menu`, whether it is open, what it opened for, and a
66
+ * way to close it
67
+ */
68
+ export interface UseContextMenuResult {
69
+ /**
70
+ * Closes the menu, returning focus to where it opened from as choosing an item does, and reports `false` through
71
+ * `onOpenChange`
72
+ */
73
+ close: () => void;
74
+ /**
75
+ * Returns the props to spread on the `Menu`, merged with the given ones, which must name the menu with `aria-label`
76
+ * or `aria-labelledby`, since no trigger names it
77
+ */
78
+ getMenuProps: <Props extends object>(props: Props & RequiredAccessibleName & Partial<ContextMenuOverlayProps>) => Omit<Props, keyof ContextMenuOverlayProps> & ContextMenuOverlayProps;
79
+ /**
80
+ * Returns the props to spread on the region the menu opens in, merged with any given: where both set a handler, both
81
+ * run, the given one first, and `style` objects merge. Give the region's own `style` here rather than after the
82
+ * spread, which would drop the anchor name the menu is placed by.
83
+ */
84
+ getTargetProps: <Props extends object>(props?: Props & Partial<ContextMenuTargetProps>) => Omit<Props, keyof ContextMenuTargetProps> & ContextMenuTargetProps;
85
+ /**
86
+ * Whether the menu is open
87
+ */
88
+ open: boolean;
89
+ /**
90
+ * The element the menu last opened for, such as the one under the pointer; `null` until it first opens
91
+ */
92
+ target: Element | null;
93
+ }
94
+ /**
95
+ * Connects a `Menu` to a region, such as a list of files or a canvas, so a right-click in the region opens the menu at
96
+ * the pointer, with focus on the menu itself, and the next Down or Up moves to the first or last item. Shift+F10 or the
97
+ * ContextMenu key opens it below the focused element, with focus on its first item, and a touch held for half a second
98
+ * opens it at the touch, as a right-click does. Choosing an item, Escape, Tab or a click outside closes it, and focus
99
+ * goes back to the element in the region that had it when it opened, unless a click outside put it elsewhere. `target`
100
+ * tells which element the menu opened for, so one menu can serve every row.
101
+ *
102
+ * @param options the change callback
103
+ * @returns prop getters for the region and the `Menu`, whether it is open, what it opened for, and `close`
104
+ *
105
+ * @example
106
+ * const contextMenu = useContextMenu();
107
+ *
108
+ * <ul {...contextMenu.getTargetProps()} aria-label="Files">…</ul>
109
+ * <Menu {...contextMenu.getMenuProps({ "aria-label": "File actions" })}>…</Menu>
110
+ */
111
+ export declare function useContextMenu({ onOpenChange }?: UseContextMenuOptions): UseContextMenuResult;
112
+ export {};
@@ -0,0 +1,202 @@
1
+ import { closeWhenFocusLeaves as e } from "../../menus/closeWhenFocusLeaves.js";
2
+ import { focusOnOpening as t } from "../../menus/focusOnOpening.js";
3
+ import { hasModifier as n } from "../../menus/hasModifier.js";
4
+ import { leaveMenuOnTab as r } from "../../menus/leaveMenuOnTab.js";
5
+ import { watchRemovals as i } from "../../menus/watchRemovals.js";
6
+ import { mergeProps as a } from "../../overlays/mergeProps.js";
7
+ import { syncPopover as o } from "../../overlays/syncPopover.js";
8
+ import { usePopover as s } from "../Popover/usePopover.js";
9
+ import { watchLongPress as c } from "./watchLongPress.js";
10
+ import { useEffect as l, useRef as u, useState as d } from "react";
11
+ // src/components/ContextMenu/useContextMenu.ts
12
+ function f({ onOpenChange: f } = {}) {
13
+ let h = s({
14
+ onOpenChange: f,
15
+ placement: "bottom-start"
16
+ }), [S, C] = d(null), w = u("menu"), T = u(null), E = u(!1), D = u(!1), O = u(null), k = u(null), A = u(!1), j = u(null), M = u(!1), { anchorName: N, id: P } = h.getOverlayProps();
17
+ l(() => () => {
18
+ O.current?.(), B();
19
+ }, []), l(() => {
20
+ let e = S?.page.getElementById(P);
21
+ if (S === null || e == null) return;
22
+ let n;
23
+ return e.matches(":popover-open") ? t(e, S.focus) : (w.current = S.focus, n = o(e, !0)), S.pressingPointer !== null && y(e, S.pressingPointer), n;
24
+ }, [P, S]);
25
+ function F(e) {
26
+ if (!I(e) || (B(), p(e)) || (e.preventDefault(), L(e.nativeEvent))) return;
27
+ if (m(e.nativeEvent)) {
28
+ z(e.currentTarget, e.target);
29
+ return;
30
+ }
31
+ let t = e.buttons === 0 ? null : k.current, n = {
32
+ bottom: e.clientY,
33
+ top: e.clientY,
34
+ x: e.clientX
35
+ };
36
+ H(e.currentTarget, e.target, n, "menu", t);
37
+ }
38
+ function I(e) {
39
+ let t = e.target.closest("[data-context-menu-region], [role=\"menu\"]");
40
+ return t === null || t === e.currentTarget;
41
+ }
42
+ function L(e) {
43
+ let t = e.pointerType;
44
+ return t === "touch" && M.current || t === "" && A.current;
45
+ }
46
+ function R(e) {
47
+ !(e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) || !I(e) || e.defaultPrevented || n(e) || g(e.target) || (e.preventDefault(), z(e.currentTarget, e.target), A.current = !0);
48
+ }
49
+ function z(e, t) {
50
+ let n = e.ownerDocument, r = n.defaultView, i = t.getBoundingClientRect(), a = r?.getComputedStyle(n.getElementById(P) ?? t).direction === "rtl", o = r?.innerWidth ?? i.right, s = r?.innerHeight ?? i.bottom;
51
+ H(e, t, {
52
+ bottom: _(i.top, s),
53
+ top: _(i.bottom, s),
54
+ x: _(a ? i.right : i.left, o)
55
+ }, "first", null);
56
+ }
57
+ function B() {
58
+ j.current?.(), j.current = null;
59
+ }
60
+ function V(e) {
61
+ if (k.current = e.pointerId, e.pointerType !== "touch" || j.current !== null || !I(e) || g(e.target)) return;
62
+ let t = e.currentTarget, n = e.target, { clientX: r, clientY: i, pointerId: a } = e;
63
+ M.current = !1, j.current = c({
64
+ clientX: r,
65
+ clientY: i,
66
+ pointerId: a
67
+ }, t.ownerDocument, {
68
+ onEnd: () => {
69
+ j.current = null;
70
+ },
71
+ onLongPress: () => {
72
+ M.current = !0, H(t, n, {
73
+ bottom: i,
74
+ top: i,
75
+ x: r
76
+ }, "menu", a);
77
+ }
78
+ });
79
+ }
80
+ function H(e, t, n, r, i) {
81
+ let a = e.ownerDocument, o = a.getElementById(P), s = a.activeElement, c = e.getBoundingClientRect();
82
+ A.current = !1, D.current = !1, s !== null && e.contains(s) && o?.contains(s) !== !0 ? T.current = s : o?.matches(":popover-open") !== !0 && (T.current = null), C({
83
+ focus: r,
84
+ offsets: {
85
+ bottom: c.bottom - n.bottom,
86
+ left: n.x - c.left,
87
+ right: c.right - n.x,
88
+ top: n.top - c.top
89
+ },
90
+ page: a,
91
+ pressingPointer: i,
92
+ target: t
93
+ });
94
+ }
95
+ function U(e) {
96
+ let t = e.currentTarget;
97
+ e.target === t && e.newState === "closed" && (E.current = t.contains(t.ownerDocument.activeElement) || D.current && x(t.ownerDocument), D.current = !1);
98
+ }
99
+ function W(e) {
100
+ let n = e.currentTarget;
101
+ e.target === n && (O.current?.(), O.current = null, e.newState === "open" ? (O.current = i(n), t(n, w.current)) : (A.current = !1, E.current && (E.current = !1, b(n, T.current))));
102
+ }
103
+ function G(e) {
104
+ e.preventDefault();
105
+ }
106
+ function K(e) {
107
+ r(e, T.current, J);
108
+ }
109
+ function q(t) {
110
+ e(t.currentTarget, t.relatedTarget, () => !1);
111
+ }
112
+ function J() {
113
+ h.open && (D.current = !0), h.close();
114
+ }
115
+ function Y(e) {
116
+ let t = a(e, {
117
+ close: J,
118
+ "data-context-menu": "",
119
+ onBeforeToggle: U,
120
+ onBlur: q,
121
+ onContextMenu: G,
122
+ onKeyDown: K,
123
+ onToggle: W,
124
+ style: v(S?.offsets)
125
+ });
126
+ return h.getOverlayProps(t);
127
+ }
128
+ function X(e) {
129
+ return a(e, {
130
+ "data-context-menu-region": "",
131
+ onContextMenu: F,
132
+ onKeyDown: R,
133
+ onPointerDown: V,
134
+ style: {
135
+ anchorName: N,
136
+ WebkitTouchCallout: "none"
137
+ }
138
+ });
139
+ }
140
+ return {
141
+ close: J,
142
+ getMenuProps: Y,
143
+ getTargetProps: X,
144
+ open: h.open,
145
+ target: S?.target ?? null
146
+ };
147
+ }
148
+ function p(e) {
149
+ return e.defaultPrevented || g(e.target) || e.shiftKey && !m(e.nativeEvent);
150
+ }
151
+ function m(e) {
152
+ return "pointerType" in e && e.pointerType === "";
153
+ }
154
+ var h = /* @__PURE__ */ new Set([
155
+ "button",
156
+ "checkbox",
157
+ "color",
158
+ "file",
159
+ "hidden",
160
+ "image",
161
+ "radio",
162
+ "range",
163
+ "reset",
164
+ "submit"
165
+ ]);
166
+ function g(e) {
167
+ let t = e;
168
+ switch (t?.tagName) {
169
+ case "INPUT": return !h.has(t.type);
170
+ case "SELECT":
171
+ case "TEXTAREA": return !0;
172
+ default: {
173
+ let e = t?.closest("[contenteditable]") ?? null;
174
+ return e !== null && e.getAttribute("contenteditable") !== "false";
175
+ }
176
+ }
177
+ }
178
+ function _(e, t) {
179
+ return Math.min(Math.max(e, 0), t);
180
+ }
181
+ function v(e) {
182
+ return e === void 0 ? {} : {
183
+ "--_sui-context-menu-bottom": `${e.bottom}px`,
184
+ "--_sui-context-menu-left": `${e.left}px`,
185
+ "--_sui-context-menu-right": `${e.right}px`,
186
+ "--_sui-context-menu-top": `${e.top}px`
187
+ };
188
+ }
189
+ function y(e, t) {
190
+ try {
191
+ e.setPointerCapture(t);
192
+ } catch (e) {
193
+ if (e?.name !== "NotFoundError") throw e;
194
+ }
195
+ }
196
+ function b(e, t) {
197
+ (x(e.ownerDocument) || e.contains(e.ownerDocument.activeElement)) && t?.focus();
198
+ }
199
+ function x(e) {
200
+ return e.activeElement === null || e.activeElement === e.body;
201
+ }
202
+ export { f as useContextMenu };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The touch that started a press
3
+ */
4
+ interface Press {
5
+ clientX: number;
6
+ clientY: number;
7
+ pointerId: number;
8
+ }
9
+ /**
10
+ * Callbacks for the end of a long-press
11
+ */
12
+ interface LongPressCallbacks {
13
+ /**
14
+ * Called when the press ends, however it ends
15
+ */
16
+ onEnd: () => void;
17
+ /**
18
+ * Called once the touch has been held long enough
19
+ */
20
+ onLongPress: () => void;
21
+ }
22
+ /**
23
+ * Watches a touch press for being held in place long enough to open a context menu. Moving further than the tolerance,
24
+ * lifting the finger, the browser cancelling the touch, as it does when a scroll starts, and a second finger all stop
25
+ * it opening. Until the press ends, text selection is stopped, which iOS would start on held text, and a press held
26
+ * long enough ends without the mouse events and click browsers send after a touch, which would act on the element
27
+ * under the finger and move focus out of the menu.
28
+ *
29
+ * @param press the `pointerdown` of the touch
30
+ * @param page the document the touch is in
31
+ * @param callbacks what to call once the touch is held long enough, and when the press ends
32
+ * @returns a function that stops watching at once
33
+ */
34
+ export declare function watchLongPress(press: Press, page: Document, { onEnd, onLongPress }: LongPressCallbacks): () => void;
35
+ export {};