@krelborn/stylesui 0.8.1 → 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 (323) hide show
  1. package/README.md +2 -2
  2. package/dist/accessibility/idSegment.js +1 -2
  3. package/dist/collections/index.d.ts +3 -0
  4. package/dist/collections/optionId.js +6 -0
  5. package/dist/{components/Listbox → collections}/renderedOptions.d.ts +7 -0
  6. package/dist/{components/Listbox → collections}/renderedOptions.js +6 -4
  7. package/dist/collections/targetIndexForKey.js +1 -2
  8. package/dist/collections/typeAhead.js +0 -1
  9. package/dist/components/Accordion/Accordion.css +1 -0
  10. package/dist/components/Accordion/Accordion.d.ts +90 -0
  11. package/dist/components/Accordion/Accordion.js +47 -0
  12. package/dist/components/Accordion/Accordion.module.js +19 -0
  13. package/dist/components/Accordion/AccordionContext.d.ts +40 -0
  14. package/dist/components/Accordion/AccordionContext.js +4 -0
  15. package/dist/components/Accordion/AccordionItem.d.ts +51 -0
  16. package/dist/components/Accordion/AccordionItem.js +69 -0
  17. package/dist/components/Accordion/AccordionToggleContent.d.ts +30 -0
  18. package/dist/components/Accordion/AccordionToggleContent.js +44 -0
  19. package/dist/components/Accordion/accordionIds.d.ts +24 -0
  20. package/dist/components/Accordion/accordionIds.js +12 -0
  21. package/dist/components/Accordion/index.d.ts +4 -0
  22. package/dist/components/Accordion/useAccordionContext.d.ts +9 -0
  23. package/dist/components/Accordion/useAccordionContext.js +10 -0
  24. package/dist/components/Accordion/useFindablePanel.d.ts +25 -0
  25. package/dist/components/Accordion/useFindablePanel.js +36 -0
  26. package/dist/components/Accordion/useFragmentTargetReveal.d.ts +27 -0
  27. package/dist/components/Accordion/useFragmentTargetReveal.js +36 -0
  28. package/dist/components/Accordion/useHasOpened.d.ts +7 -0
  29. package/dist/components/Accordion/useHasOpened.js +7 -0
  30. package/dist/components/Alert/Alert.js +1 -2
  31. package/dist/components/Alert/Alert.module.js +1 -2
  32. package/dist/components/Alert/AlertIcon.js +1 -2
  33. package/dist/components/Avatar/Avatar.js +1 -2
  34. package/dist/components/Avatar/Avatar.module.js +1 -2
  35. package/dist/components/Avatar/initialsOf.js +1 -2
  36. package/dist/components/AvatarGroup/AvatarGroup.js +1 -2
  37. package/dist/components/AvatarGroup/AvatarGroup.module.js +1 -2
  38. package/dist/components/Badge/Badge.js +1 -2
  39. package/dist/components/Badge/Badge.module.js +1 -2
  40. package/dist/components/Box/Box.js +1 -2
  41. package/dist/components/Box/Box.module.js +1 -2
  42. package/dist/components/Button/Button.js +2 -7
  43. package/dist/components/Button/Button.module.js +1 -2
  44. package/dist/components/Card/Card.js +1 -2
  45. package/dist/components/Card/Card.module.js +1 -2
  46. package/dist/components/Center/Center.js +6 -7
  47. package/dist/components/Center/Center.module.js +1 -2
  48. package/dist/components/Checkbox/Checkbox.js +1 -2
  49. package/dist/components/ChoiceControl/ChoiceControl.js +1 -2
  50. package/dist/components/ChoiceControl/ChoiceControl.module.js +1 -2
  51. package/dist/components/Cluster/Cluster.js +1 -2
  52. package/dist/components/Code/Code.js +1 -2
  53. package/dist/components/Code/Code.module.js +1 -2
  54. package/dist/components/Combobox/Autocomplete.d.ts +83 -0
  55. package/dist/components/Combobox/Autocomplete.js +102 -0
  56. package/dist/components/Combobox/Combobox.css +1 -0
  57. package/dist/components/Combobox/Combobox.d.ts +59 -0
  58. package/dist/components/Combobox/Combobox.js +82 -0
  59. package/dist/components/Combobox/Combobox.module.js +17 -0
  60. package/dist/components/Combobox/ComboboxContext.d.ts +88 -0
  61. package/dist/components/Combobox/ComboboxContext.js +4 -0
  62. package/dist/components/Combobox/ComboboxFieldValue.d.ts +17 -0
  63. package/dist/components/Combobox/ComboboxFieldValue.js +33 -0
  64. package/dist/components/Combobox/ComboboxOption.d.ts +51 -0
  65. package/dist/components/Combobox/ComboboxOption.js +74 -0
  66. package/dist/components/Combobox/ComboboxOptionContent.d.ts +32 -0
  67. package/dist/components/Combobox/ComboboxOptionContent.js +51 -0
  68. package/dist/components/Combobox/ComboboxPopup.d.ts +50 -0
  69. package/dist/components/Combobox/ComboboxPopup.js +59 -0
  70. package/dist/components/Combobox/autocompleteKeys.d.ts +31 -0
  71. package/dist/components/Combobox/autocompleteKeys.js +25 -0
  72. package/dist/components/Combobox/comboboxKeys.d.ts +10 -0
  73. package/dist/components/Combobox/comboboxKeys.js +22 -0
  74. package/dist/components/Combobox/containsText.d.ts +9 -0
  75. package/dist/components/Combobox/containsText.js +8 -0
  76. package/dist/components/Combobox/index.d.ts +6 -0
  77. package/dist/components/Combobox/isAltArrow.d.ts +9 -0
  78. package/dist/components/Combobox/isAltArrow.js +5 -0
  79. package/dist/components/Combobox/isOptionShown.d.ts +10 -0
  80. package/dist/components/Combobox/isOptionShown.js +5 -0
  81. package/dist/components/Combobox/useAutocompleteText.d.ts +56 -0
  82. package/dist/components/Combobox/useAutocompleteText.js +27 -0
  83. package/dist/components/Combobox/useComboboxContext.d.ts +9 -0
  84. package/dist/components/Combobox/useComboboxContext.js +10 -0
  85. package/dist/components/Combobox/useComboboxList.d.ts +129 -0
  86. package/dist/components/Combobox/useComboboxList.js +138 -0
  87. package/dist/components/Combobox/useComboboxOption.d.ts +35 -0
  88. package/dist/components/Combobox/useComboboxOption.js +46 -0
  89. package/dist/components/Combobox/useComboboxSelection.d.ts +45 -0
  90. package/dist/components/Combobox/useComboboxSelection.js +17 -0
  91. package/dist/components/Combobox/useResultsAnnouncement.d.ts +23 -0
  92. package/dist/components/Combobox/useResultsAnnouncement.js +24 -0
  93. package/dist/components/ContextMenu/index.d.ts +2 -0
  94. package/dist/components/ContextMenu/useContextMenu.d.ts +112 -0
  95. package/dist/components/ContextMenu/useContextMenu.js +202 -0
  96. package/dist/components/ContextMenu/watchLongPress.d.ts +35 -0
  97. package/dist/components/ContextMenu/watchLongPress.js +38 -0
  98. package/dist/components/Counter/Counter.js +5 -6
  99. package/dist/components/Counter/Counter.module.js +1 -2
  100. package/dist/components/Cover/Cover.js +8 -9
  101. package/dist/components/Cover/Cover.module.js +1 -2
  102. package/dist/components/Divider/Divider.js +1 -2
  103. package/dist/components/Divider/Divider.module.js +1 -2
  104. package/dist/components/Field/Field.js +11 -10
  105. package/dist/components/Field/Field.module.js +1 -2
  106. package/dist/components/Fieldset/Fieldset.js +1 -2
  107. package/dist/components/Fieldset/Fieldset.module.js +1 -2
  108. package/dist/components/Frame/Frame.js +5 -6
  109. package/dist/components/Frame/Frame.module.js +1 -2
  110. package/dist/components/Grid/Grid.js +9 -10
  111. package/dist/components/Grid/Grid.module.js +1 -2
  112. package/dist/components/Heading/Heading.js +1 -2
  113. package/dist/components/Heading/Heading.module.js +1 -2
  114. package/dist/components/HorizontalFlow/HorizontalFlow.js +6 -7
  115. package/dist/components/HorizontalFlow/HorizontalFlow.module.js +1 -2
  116. package/dist/components/Icon/AddIcon.js +1 -2
  117. package/dist/components/Icon/CheckIcon.d.ts +11 -0
  118. package/dist/components/Icon/CheckIcon.js +18 -0
  119. package/dist/components/Icon/ChevronDownIcon.js +1 -2
  120. package/dist/components/Icon/ChevronRightIcon.d.ts +11 -0
  121. package/dist/components/Icon/ChevronRightIcon.js +19 -0
  122. package/dist/components/Icon/CloseIcon.js +1 -2
  123. package/dist/components/Icon/ColorModeIcon.js +1 -2
  124. package/dist/components/Icon/DeleteIcon.js +1 -2
  125. package/dist/components/Icon/Icon.js +1 -2
  126. package/dist/components/Icon/Icon.module.js +1 -2
  127. package/dist/components/Icon/InfoIcon.js +1 -2
  128. package/dist/components/Icon/MenuIcon.d.ts +12 -0
  129. package/dist/components/Icon/MenuIcon.js +28 -0
  130. package/dist/components/Icon/MoreHorizontalIcon.js +1 -2
  131. package/dist/components/Icon/MoreVerticalIcon.js +1 -2
  132. package/dist/components/Icon/PaletteIcon.js +1 -2
  133. package/dist/components/Icon/RefreshIcon.js +1 -2
  134. package/dist/components/Icon/RemoveIcon.js +1 -2
  135. package/dist/components/Icon/SendIcon.js +1 -2
  136. package/dist/components/Icon/index.d.ts +3 -0
  137. package/dist/components/IconButton/IconButton.js +1 -2
  138. package/dist/components/IconButton/IconButton.module.js +1 -2
  139. package/dist/components/Kbd/Kbd.js +1 -2
  140. package/dist/components/Kbd/Kbd.module.js +1 -2
  141. package/dist/components/Link/Link.js +1 -2
  142. package/dist/components/Link/Link.module.js +1 -2
  143. package/dist/components/Listbox/Listbox.js +9 -10
  144. package/dist/components/Listbox/Listbox.module.js +1 -2
  145. package/dist/components/Listbox/ListboxContext.js +1 -2
  146. package/dist/components/Listbox/ListboxOption.js +7 -8
  147. package/dist/components/Listbox/useListbox.js +22 -23
  148. package/dist/components/Listbox/useListboxContext.js +1 -2
  149. package/dist/components/Menu/Menu.d.ts +70 -0
  150. package/dist/components/Menu/Menu.js +76 -0
  151. package/dist/components/Menu/MenuContext.d.ts +29 -0
  152. package/dist/components/Menu/MenuContext.js +4 -0
  153. package/dist/components/Menu/MenuGroup.d.ts +22 -0
  154. package/dist/components/Menu/MenuGroup.js +32 -0
  155. package/dist/components/Menu/MenuItem.d.ts +77 -0
  156. package/dist/components/Menu/MenuItem.js +54 -0
  157. package/dist/components/Menu/MenuItemCheckbox.d.ts +61 -0
  158. package/dist/components/Menu/MenuItemCheckbox.js +37 -0
  159. package/dist/components/Menu/MenuItemRadio.d.ts +47 -0
  160. package/dist/components/Menu/MenuItemRadio.js +39 -0
  161. package/dist/components/Menu/MenuRadioGroup.d.ts +34 -0
  162. package/dist/components/Menu/MenuRadioGroup.js +27 -0
  163. package/dist/components/Menu/MenuRadioGroupContext.d.ts +17 -0
  164. package/dist/components/Menu/MenuRadioGroupContext.js +4 -0
  165. package/dist/components/Menu/MenuSeparator.d.ts +16 -0
  166. package/dist/components/Menu/MenuSeparator.js +20 -0
  167. package/dist/components/Menu/Submenu.d.ts +36 -0
  168. package/dist/components/Menu/Submenu.js +122 -0
  169. package/dist/components/Menu/index.d.ts +18 -0
  170. package/dist/components/Menu/useMenu.d.ts +18 -0
  171. package/dist/components/Menu/useMenu.js +20 -0
  172. package/dist/components/Menu/useMenuButton.d.ts +124 -0
  173. package/dist/components/Menu/useMenuButton.js +92 -0
  174. package/dist/components/Menu/useMenuContext.d.ts +9 -0
  175. package/dist/components/Menu/useMenuContext.js +10 -0
  176. package/dist/components/Menu/useMenuItemContent.d.ts +55 -0
  177. package/dist/components/Menu/useMenuItemContent.js +66 -0
  178. package/dist/components/Menu/useMenuPointer.d.ts +27 -0
  179. package/dist/components/Menu/useMenuPointer.js +56 -0
  180. package/dist/components/Menu/useMenuRadioGroupContext.d.ts +9 -0
  181. package/dist/components/Menu/useMenuRadioGroupContext.js +10 -0
  182. package/dist/components/MenuSurface/MenuSurface.css +1 -0
  183. package/dist/components/MenuSurface/MenuSurface.module.js +16 -0
  184. package/dist/components/Menubar/Menubar.css +1 -0
  185. package/dist/components/Menubar/Menubar.d.ts +23 -0
  186. package/dist/components/Menubar/Menubar.js +67 -0
  187. package/dist/components/Menubar/Menubar.module.js +7 -0
  188. package/dist/components/Menubar/MenubarContext.d.ts +29 -0
  189. package/dist/components/Menubar/MenubarContext.js +4 -0
  190. package/dist/components/Menubar/MenubarMenu.d.ts +26 -0
  191. package/dist/components/Menubar/MenubarMenu.js +88 -0
  192. package/dist/components/Menubar/findOpenMenubarItem.d.ts +7 -0
  193. package/dist/components/Menubar/findOpenMenubarItem.js +6 -0
  194. package/dist/components/Menubar/index.d.ts +4 -0
  195. package/dist/components/Menubar/menubarItems.d.ts +7 -0
  196. package/dist/components/Menubar/menubarItems.js +5 -0
  197. package/dist/components/Menubar/useMenubarContext.d.ts +9 -0
  198. package/dist/components/Menubar/useMenubarContext.js +10 -0
  199. package/dist/components/NavBar/NavBar.css +1 -0
  200. package/dist/components/NavBar/NavBar.d.ts +53 -0
  201. package/dist/components/NavBar/NavBar.js +97 -0
  202. package/dist/components/NavBar/NavBar.module.js +22 -0
  203. package/dist/components/NavBar/NavBarContext.d.ts +21 -0
  204. package/dist/components/NavBar/NavBarContext.js +4 -0
  205. package/dist/components/NavBar/NavBarItem.d.ts +32 -0
  206. package/dist/components/NavBar/NavBarItem.js +18 -0
  207. package/dist/components/NavBar/NavBarMenu.d.ts +32 -0
  208. package/dist/components/NavBar/NavBarMenu.js +84 -0
  209. package/dist/components/NavBar/NavBarMenuGroup.d.ts +25 -0
  210. package/dist/components/NavBar/NavBarMenuGroup.js +40 -0
  211. package/dist/components/NavBar/NavBarMenuItem.d.ts +36 -0
  212. package/dist/components/NavBar/NavBarMenuItem.js +49 -0
  213. package/dist/components/NavBar/index.d.ts +10 -0
  214. package/dist/components/NavBar/isNavBarCollapsed.d.ts +8 -0
  215. package/dist/components/NavBar/isNavBarCollapsed.js +5 -0
  216. package/dist/components/NavBar/leavesPageInPlace.d.ts +12 -0
  217. package/dist/components/NavBar/leavesPageInPlace.js +29 -0
  218. package/dist/components/NavBar/renderNavBarLink.d.ts +12 -0
  219. package/dist/components/NavBar/renderNavBarLink.js +16 -0
  220. package/dist/components/NavBar/useLayoutSwitch.d.ts +26 -0
  221. package/dist/components/NavBar/useLayoutSwitch.js +25 -0
  222. package/dist/components/NavBar/useNavBarContext.d.ts +9 -0
  223. package/dist/components/NavBar/useNavBarContext.js +10 -0
  224. package/dist/components/NavList/NavList.js +1 -2
  225. package/dist/components/NavList/NavList.module.js +1 -2
  226. package/dist/components/NavList/NavListGroup.js +1 -2
  227. package/dist/components/NavList/NavListItem.d.ts +4 -8
  228. package/dist/components/NavList/NavListItem.js +1 -2
  229. package/dist/components/Overlay/Overlay.js +6 -7
  230. package/dist/components/Overlay/Overlay.module.js +1 -2
  231. package/dist/components/PageLayout/PageLayout.js +6 -7
  232. package/dist/components/PageLayout/PageLayout.module.js +1 -2
  233. package/dist/components/Popover/Popover.js +1 -2
  234. package/dist/components/Popover/Popover.module.js +1 -2
  235. package/dist/components/Popover/usePopover.js +44 -39
  236. package/dist/components/Prose/Prose.js +1 -2
  237. package/dist/components/Prose/Prose.module.js +1 -2
  238. package/dist/components/Radio/Radio.js +1 -2
  239. package/dist/components/RadioGroup/RadioGroup.js +5 -6
  240. package/dist/components/RadioGroup/RadioGroup.module.js +1 -2
  241. package/dist/components/RequiredIndicator/RequiredIndicator.js +1 -2
  242. package/dist/components/RequiredIndicator/RequiredIndicator.module.js +1 -2
  243. package/dist/components/Row/Row.js +1 -2
  244. package/dist/components/SegmentedControl/Segment.js +1 -2
  245. package/dist/components/SegmentedControl/SegmentedControl.js +1 -2
  246. package/dist/components/SegmentedControl/SegmentedControl.module.js +1 -2
  247. package/dist/components/Select/Select.js +1 -2
  248. package/dist/components/Sidebar/Sidebar.js +7 -8
  249. package/dist/components/Sidebar/Sidebar.module.js +1 -2
  250. package/dist/components/SkipLink/SkipLink.js +1 -2
  251. package/dist/components/SkipLink/SkipLink.module.js +1 -2
  252. package/dist/components/Spinner/Spinner.js +1 -2
  253. package/dist/components/Spinner/Spinner.module.js +1 -2
  254. package/dist/components/Stack/Stack.js +8 -9
  255. package/dist/components/Stack/Stack.module.js +1 -2
  256. package/dist/components/StatusDot/StatusDot.js +1 -2
  257. package/dist/components/StatusDot/StatusDot.module.js +1 -2
  258. package/dist/components/Switch/Switch.js +1 -2
  259. package/dist/components/Switcher/Switcher.js +9 -10
  260. package/dist/components/Switcher/Switcher.module.js +1 -2
  261. package/dist/components/Tabs/Tab.js +12 -13
  262. package/dist/components/Tabs/TabList.js +1 -2
  263. package/dist/components/Tabs/TabPanel.js +1 -2
  264. package/dist/components/Tabs/Tabs.js +1 -2
  265. package/dist/components/Tabs/Tabs.module.js +1 -2
  266. package/dist/components/Tabs/TabsContext.js +1 -2
  267. package/dist/components/Tabs/tabIds.js +1 -2
  268. package/dist/components/Tabs/useTabsContext.js +1 -2
  269. package/dist/components/Text/Text.js +1 -2
  270. package/dist/components/Text/Text.module.js +1 -2
  271. package/dist/components/TextControl/TextControl.d.ts +3 -3
  272. package/dist/components/TextControl/TextControl.js +14 -10
  273. package/dist/components/TextControl/TextControl.module.js +1 -2
  274. package/dist/components/TextInput/TextInput.js +1 -2
  275. package/dist/components/Textarea/Textarea.js +1 -2
  276. package/dist/components/Theme/Theme.js +1 -2
  277. package/dist/components/Tooltip/Tooltip.js +1 -2
  278. package/dist/components/Tooltip/Tooltip.module.js +1 -2
  279. package/dist/components/Tooltip/tooltipCoordinator.js +1 -2
  280. package/dist/components/Tooltip/useTooltip.js +1 -2
  281. package/dist/components/VisuallyHidden/VisuallyHidden.js +1 -2
  282. package/dist/components/VisuallyHidden/VisuallyHidden.module.js +1 -2
  283. package/dist/errors/MissingContextError.js +1 -2
  284. package/dist/errors/PopoverRefusedError.js +1 -2
  285. package/dist/forms/FieldContext.d.ts +5 -0
  286. package/dist/forms/FieldContext.js +1 -2
  287. package/dist/forms/RadioGroupContext.js +1 -2
  288. package/dist/forms/hasContent.js +1 -2
  289. package/dist/forms/useFieldControl.js +1 -2
  290. package/dist/forms/useRadioGroupItem.js +1 -2
  291. package/dist/index.d.ts +13 -1
  292. package/dist/index.js +90 -65
  293. package/dist/layout/listRole.js +1 -2
  294. package/dist/layout/spaceValue.js +1 -2
  295. package/dist/layout/withCustomProperties.js +1 -2
  296. package/dist/links/LinkOrButtonProps.d.ts +17 -0
  297. package/dist/links/index.d.ts +1 -0
  298. package/dist/menus/closeWhenFocusLeaves.d.ts +9 -0
  299. package/dist/menus/closeWhenFocusLeaves.js +11 -0
  300. package/dist/menus/focusItem.d.ts +6 -0
  301. package/dist/menus/focusItem.js +9 -0
  302. package/dist/menus/focusOnOpening.d.ts +11 -0
  303. package/dist/menus/focusOnOpening.js +11 -0
  304. package/dist/menus/hasModifier.d.ts +7 -0
  305. package/dist/menus/hasModifier.js +5 -0
  306. package/dist/menus/index.d.ts +11 -0
  307. package/dist/menus/itemText.d.ts +8 -0
  308. package/dist/menus/itemText.js +6 -0
  309. package/dist/menus/leaveMenuOnTab.d.ts +9 -0
  310. package/dist/menus/leaveMenuOnTab.js +6 -0
  311. package/dist/menus/pointerIntent.d.ts +36 -0
  312. package/dist/menus/pointerIntent.js +68 -0
  313. package/dist/menus/renderedItems.d.ts +8 -0
  314. package/dist/menus/renderedItems.js +4 -0
  315. package/dist/menus/watchRemovals.d.ts +8 -0
  316. package/dist/menus/watchRemovals.js +23 -0
  317. package/dist/overlays/anchorNameFor.js +1 -2
  318. package/dist/overlays/mergeProps.js +1 -2
  319. package/dist/overlays/syncPopover.js +1 -2
  320. package/dist/overlays/useOverlay.js +2 -9
  321. package/package.json +10 -10
  322. package/dist/components/Listbox/optionId.js +0 -7
  323. /package/dist/{components/Listbox → collections}/optionId.d.ts +0 -0
@@ -0,0 +1,25 @@
1
+ import { hasModifier as e } from "../../menus/hasModifier.js";
2
+ import { isAltArrow as t } from "./isAltArrow.js";
3
+ // src/components/Combobox/autocompleteKeys.ts
4
+ function n(n, i, a) {
5
+ if (n.nativeEvent.isComposing || n.keyCode === 229) return !1;
6
+ if (t(n, "ArrowDown")) return i.open || i.openList("none", "keyboard"), !0;
7
+ if (t(n, "ArrowUp")) {
8
+ let e = i.open;
9
+ return i.commitActive(), e;
10
+ }
11
+ return !e(n) && r(n.key, i, a);
12
+ }
13
+ function r(e, t, n) {
14
+ return e === "ArrowDown" || e === "ArrowUp" ? i(e, t) : e === "Enter" ? a(t, n) : e === "Escape" ? o(t, n) : (e === "Tab" && t.close(), !1);
15
+ }
16
+ function i(e, t) {
17
+ return t.open ? t.moveByKey(e) : (t.openList(e === "ArrowDown" ? "first" : "last", "keyboard"), !0);
18
+ }
19
+ function a(e, t) {
20
+ return e.activeDescendant === void 0 ? t.editing && t.shown !== "" : (e.commitActive(), !0);
21
+ }
22
+ function o(e, t) {
23
+ return e.open ? (e.close(), !0) : t.shown === "" && e.selectedValue === null ? !1 : (e.select(null), t.commit(""), !0);
24
+ }
25
+ export { n as handleAutocompleteKey };
@@ -0,0 +1,10 @@
1
+ import type { KeyboardEvent } from "react";
2
+ import type { ComboboxList } from "./useComboboxList";
3
+ /**
4
+ * Acts on a key pressed on a `Combobox`'s field
5
+ *
6
+ * @param event the key event
7
+ * @param list the combobox's list
8
+ * @returns whether the key was handled, so its default should be prevented
9
+ */
10
+ export declare function handleComboboxKey(event: KeyboardEvent<HTMLElement>, list: ComboboxList): boolean;
@@ -0,0 +1,22 @@
1
+ import { hasModifier as e } from "../../menus/hasModifier.js";
2
+ import { isAltArrow as t } from "./isAltArrow.js";
3
+ // src/components/Combobox/comboboxKeys.ts
4
+ var n = {
5
+ " ": "selected",
6
+ ArrowDown: "selected",
7
+ ArrowUp: "selected",
8
+ End: "last",
9
+ Enter: "selected",
10
+ Home: "first"
11
+ };
12
+ function r(e, t) {
13
+ return t.open ? a(e, t) : i(e, t);
14
+ }
15
+ function i(r, i) {
16
+ let a = n[r.key];
17
+ return t(r, "ArrowDown") ? (i.openList("none", "keyboard"), !0) : e(r) ? !1 : a === void 0 ? Array.from(r.key).length === 1 && (i.openList("selected", "keyboard"), i.typeAhead(r.key), !0) : (i.openList(a, "keyboard"), !0);
18
+ }
19
+ function a(n, r) {
20
+ return n.key === "Tab" || n.key === "Escape" ? (r.close(), n.key === "Escape") : t(n, "ArrowUp") ? (r.commitActive(), !0) : e(n) ? !1 : n.key === "Enter" || n.key === " " && !r.isTypingAhead() ? (r.commitActive(), !0) : r.moveByKey(n.key) || r.typeAhead(n.key);
21
+ }
22
+ export { r as handleComboboxKey };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tests whether an option's text contains the typed text, ignoring case, accents and the typed text's surrounding
3
+ * spaces: an `Autocomplete`'s default filter
4
+ *
5
+ * @param textValue the option's text
6
+ * @param inputValue the typed text
7
+ * @returns true when the option shows
8
+ */
9
+ export declare function containsText(textValue: string, inputValue: string): boolean;
@@ -0,0 +1,8 @@
1
+ // src/components/Combobox/containsText.ts
2
+ function e(e, n) {
3
+ return t(e).includes(t(n.trim()));
4
+ }
5
+ function t(e) {
6
+ return e.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLocaleLowerCase();
7
+ }
8
+ export { e as containsText };
@@ -0,0 +1,6 @@
1
+ export { Autocomplete } from "./Autocomplete";
2
+ export type { AutocompleteProps } from "./Autocomplete";
3
+ export { Combobox } from "./Combobox";
4
+ export type { ComboboxProps } from "./Combobox";
5
+ export { ComboboxOption } from "./ComboboxOption";
6
+ export type { ComboboxOptionProps } from "./ComboboxOption";
@@ -0,0 +1,9 @@
1
+ import type { KeyboardEvent } from "react";
2
+ /**
3
+ * Whether a key is an arrow pressed with Alt alone, which opens or commits a combobox's list
4
+ *
5
+ * @param event the key event
6
+ * @param key the arrow
7
+ * @returns true for that arrow with Alt and neither Ctrl nor Meta
8
+ */
9
+ export declare function isAltArrow(event: KeyboardEvent<HTMLElement>, key: "ArrowDown" | "ArrowUp"): boolean;
@@ -0,0 +1,5 @@
1
+ // src/components/Combobox/isAltArrow.ts
2
+ function e(e, t) {
3
+ return e.key === t && e.altKey && !e.ctrlKey && !e.metaKey;
4
+ }
5
+ export { e as isAltArrow };
@@ -0,0 +1,10 @@
1
+ import type { ComboboxFilter } from "./ComboboxContext";
2
+ /**
3
+ * Whether an option shows for the typed text
4
+ *
5
+ * @param filter the combobox's filter, or null to show every option
6
+ * @param query the typed text
7
+ * @param text the option's text
8
+ * @returns true when there is no filter or no text, or the filter accepts the option
9
+ */
10
+ export declare function isOptionShown(filter: ComboboxFilter | null, query: string, text: string): boolean;
@@ -0,0 +1,5 @@
1
+ // src/components/Combobox/isOptionShown.ts
2
+ function e(e, t, n) {
3
+ return e === null || t === "" || e(n, t);
4
+ }
5
+ export { e as isOptionShown };
@@ -0,0 +1,56 @@
1
+ interface UseAutocompleteTextOptions {
2
+ /**
3
+ * The text the input starts with when uncontrolled
4
+ */
5
+ defaultInputValue: string | undefined;
6
+ /**
7
+ * The input's text when controlled
8
+ */
9
+ inputValue: string | undefined;
10
+ /**
11
+ * Called with each new text
12
+ */
13
+ onInputValueChange: ((inputValue: string) => void) | undefined;
14
+ /**
15
+ * The selected option's text, or undefined for none or one that has not rendered
16
+ */
17
+ selectedText: string | undefined;
18
+ }
19
+ /**
20
+ * An `Autocomplete`'s text and the ways it changes
21
+ */
22
+ interface AutocompleteText {
23
+ /**
24
+ * Puts an option's text in the input as the user commits it
25
+ */
26
+ commit: (text: string) => void;
27
+ /**
28
+ * Takes the text the user typed
29
+ */
30
+ edit: (text: string) => void;
31
+ /**
32
+ * Whether the input holds text other than the selection's: typed since the last choice, or, when controlled, any
33
+ * text the parent gives that is not the selected option's
34
+ */
35
+ editing: boolean;
36
+ /**
37
+ * The text the options are filtered by: the input's while editing, or empty while it shows the selection
38
+ */
39
+ query: string;
40
+ /**
41
+ * Shows the selection's text again, after editing that chose nothing
42
+ */
43
+ restore: () => void;
44
+ /**
45
+ * The text the input shows
46
+ */
47
+ shown: string;
48
+ }
49
+ /**
50
+ * Holds what the user is typing in an `Autocomplete`, apart from the selection's text, which the input shows otherwise
51
+ *
52
+ * @param options the controlled or starting text, the change callback and the selection's text
53
+ * @returns the text and the ways it changes
54
+ */
55
+ export declare function useAutocompleteText({ defaultInputValue, inputValue, onInputValueChange, selectedText, }: UseAutocompleteTextOptions): AutocompleteText;
56
+ export {};
@@ -0,0 +1,27 @@
1
+ import { useState as e } from "react";
2
+ import { c as t } from "react/compiler-runtime";
3
+ // src/components/Combobox/useAutocompleteText.ts
4
+ function n(n) {
5
+ let r = t(15), { defaultInputValue: i, inputValue: a, onInputValueChange: o, selectedText: s } = n, [c, l] = e(i ?? null), u = a ?? c ?? s ?? "", d = a === void 0 ? c !== null : a !== (s ?? ""), f;
6
+ r[0] === o ? f = r[1] : (f = function(e) {
7
+ l(e), o?.(e);
8
+ }, r[0] = o, r[1] = f);
9
+ let p = f, m;
10
+ r[2] === o ? m = r[3] : (m = function(e) {
11
+ l(null), o?.(e);
12
+ }, r[2] = o, r[3] = m);
13
+ let h = m, g;
14
+ r[4] !== h || r[5] !== d || r[6] !== s ? (g = function() {
15
+ d && h(s ?? "");
16
+ }, r[4] = h, r[5] = d, r[6] = s, r[7] = g) : g = r[7];
17
+ let _ = g, v = d ? u : "", y;
18
+ return r[8] !== h || r[9] !== p || r[10] !== d || r[11] !== _ || r[12] !== u || r[13] !== v ? (y = {
19
+ commit: h,
20
+ edit: p,
21
+ editing: d,
22
+ query: v,
23
+ restore: _,
24
+ shown: u
25
+ }, r[8] = h, r[9] = p, r[10] = d, r[11] = _, r[12] = u, r[13] = v, r[14] = y) : y = r[14], y;
26
+ }
27
+ export { n as useAutocompleteText };
@@ -0,0 +1,9 @@
1
+ import type { ComboboxContextValue } from "./ComboboxContext";
2
+ /**
3
+ * Reads the state of the surrounding `Combobox` or `Autocomplete`
4
+ *
5
+ * @param part the name of the part reading it, for the error message
6
+ * @returns the surrounding combobox's state
7
+ * @throws MissingContextError when the part is not inside a `Combobox` or `Autocomplete`
8
+ */
9
+ export declare function useComboboxContext(part: string): ComboboxContextValue;
@@ -0,0 +1,10 @@
1
+ import { MissingContextError as e } from "../../errors/MissingContextError.js";
2
+ import { ComboboxContext as t } from "./ComboboxContext.js";
3
+ import { useContext as n } from "react";
4
+ // src/components/Combobox/useComboboxContext.ts
5
+ function r(r) {
6
+ let i = n(t);
7
+ if (i === null) throw new e(r, "Combobox or Autocomplete");
8
+ return i;
9
+ }
10
+ export { r as useComboboxContext };
@@ -0,0 +1,129 @@
1
+ import type { ActiveSource, ComboboxContextValue, ComboboxFilter, SelectedContent } from "./ComboboxContext";
2
+ import type { ComboboxSelection } from "./useComboboxSelection";
3
+ /**
4
+ * Which option is active as the list opens: the selected one (else the first), the first, the last, or none
5
+ */
6
+ export type OpeningActive = "first" | "last" | "none" | "selected";
7
+ interface UseComboboxListOptions {
8
+ /**
9
+ * The control's own id, or a surrounding field's; without one, the list generates it
10
+ */
11
+ controlId: string | undefined;
12
+ /**
13
+ * Whether an option shows for the typed text, or null to show every option
14
+ */
15
+ filter: ComboboxFilter | null;
16
+ /**
17
+ * Called with an option's text when the user commits it
18
+ */
19
+ onCommit?: (text: string) => void;
20
+ /**
21
+ * The text the options are filtered by; empty shows every option
22
+ */
23
+ query: string;
24
+ /**
25
+ * The combobox's selection, from `useComboboxSelection`
26
+ */
27
+ selection: ComboboxSelection;
28
+ }
29
+ /**
30
+ * A combobox's list: its open state, active option and selection, and the actions its control's keys and pointer take
31
+ */
32
+ export interface ComboboxList {
33
+ /**
34
+ * The id of the active option while the list is open, for the control's `aria-activedescendant`
35
+ */
36
+ activeDescendant: string | undefined;
37
+ /**
38
+ * The generated id the list's ids start with
39
+ */
40
+ baseId: string;
41
+ /**
42
+ * Closes the list without committing
43
+ */
44
+ close: () => void;
45
+ /**
46
+ * Commits the active option and closes the list, unless the option is disabled; with no active option, closes it
47
+ */
48
+ commitActive: () => void;
49
+ /**
50
+ * The state the list's options read
51
+ */
52
+ context: ComboboxContextValue;
53
+ /**
54
+ * The control's id
55
+ */
56
+ controlId: string;
57
+ /**
58
+ * Counts the options the filter shows
59
+ */
60
+ countShown: () => number;
61
+ /**
62
+ * Whether Space would join a type-ahead query now rather than act
63
+ */
64
+ isTypingAhead: () => boolean;
65
+ /**
66
+ * The list's id, for the control's `aria-controls`
67
+ */
68
+ listId: string;
69
+ /**
70
+ * Takes the `listbox` element, as its `ref`
71
+ */
72
+ attachList: (listbox: HTMLDivElement | null) => void;
73
+ /**
74
+ * Makes the first option the filter shows, and that is not disabled, active once the next render has filtered the
75
+ * options by the query it brings, which a parent controlling the text may have changed; with no filter or no query,
76
+ * makes none active
77
+ */
78
+ matchFirst: () => void;
79
+ /**
80
+ * Moves the active option for an arrow key, Home or End, without wrapping
81
+ *
82
+ * @returns whether the key was one of those
83
+ */
84
+ moveByKey: (key: string) => boolean;
85
+ /**
86
+ * Whether the list is open
87
+ */
88
+ open: boolean;
89
+ /**
90
+ * Opens the list
91
+ *
92
+ * @param opening which option becomes active
93
+ * @param source what opened it, which decides whether the active option shows the focus ring
94
+ */
95
+ openList: (opening: OpeningActive, source: ActiveSource) => void;
96
+ /**
97
+ * Selects a value, or none, reporting it unless it is already selected
98
+ */
99
+ select: (value: string | null) => void;
100
+ /**
101
+ * What the selected option shows in the field, or null when it is not rendered
102
+ */
103
+ selectedContent: SelectedContent | null;
104
+ /**
105
+ * The selected value, or null for none
106
+ */
107
+ selectedValue: string | null;
108
+ /**
109
+ * Closes the list if it was open, or opens it on the selected option
110
+ *
111
+ * @param wasOpen whether the list was open when the user asked to toggle it
112
+ * @param source what toggled it, which decides whether the active option shows the focus ring
113
+ */
114
+ toggleList: (wasOpen: boolean, source: ActiveSource) => void;
115
+ /**
116
+ * Moves the active option by type-ahead for a printable character, from the active option or else the selected one
117
+ *
118
+ * @returns whether the key was a character type-ahead took
119
+ */
120
+ typeAhead: (key: string) => boolean;
121
+ }
122
+ /**
123
+ * Holds the state of a combobox's list, which `Combobox` and `Autocomplete` share
124
+ *
125
+ * @param options the control's id, the selection, the filter and its query, and the commit callback
126
+ * @returns the list's state and actions
127
+ */
128
+ export declare function useComboboxList({ controlId, filter, onCommit, query, selection, }: UseComboboxListOptions): ComboboxList;
129
+ export {};
@@ -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 {};