@basic-ui/core 0.0.39 → 0.0.42

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 (383) hide show
  1. package/build/cjs/index.js +1312 -464
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/Accordion/Accordion.d.ts +7 -7
  4. package/build/esm/Accordion/Accordion.js +4 -4
  5. package/build/esm/Accordion/Accordion.js.map +1 -1
  6. package/build/esm/Accordion/AccordionBody.d.ts +5 -5
  7. package/build/esm/Accordion/AccordionBody.js +4 -4
  8. package/build/esm/Accordion/AccordionBody.js.map +1 -1
  9. package/build/esm/Accordion/AccordionHeader.d.ts +6 -6
  10. package/build/esm/Accordion/AccordionHeader.js +4 -4
  11. package/build/esm/Accordion/AccordionHeader.js.map +1 -1
  12. package/build/esm/Accordion/AccordionItem.d.ts +7 -7
  13. package/build/esm/Accordion/AccordionItem.js +2 -2
  14. package/build/esm/Accordion/AccordionItem.js.map +1 -1
  15. package/build/esm/Accordion/context.d.ts +3 -3
  16. package/build/esm/Accordion/context.js +0 -0
  17. package/build/esm/Accordion/context.js.map +1 -1
  18. package/build/esm/Accordion/index.d.ts +0 -0
  19. package/build/esm/Accordion/index.js +0 -0
  20. package/build/esm/Accordion/index.js.map +1 -1
  21. package/build/esm/Accordion/scopeQuery.d.ts +0 -0
  22. package/build/esm/Accordion/scopeQuery.js +0 -0
  23. package/build/esm/Accordion/scopeQuery.js.map +1 -1
  24. package/build/esm/CheckBox/CheckBox.d.ts +6 -6
  25. package/build/esm/CheckBox/CheckBox.js +2 -2
  26. package/build/esm/CheckBox/CheckBox.js.map +1 -1
  27. package/build/esm/CheckBox/index.d.ts +0 -0
  28. package/build/esm/CheckBox/index.js +0 -0
  29. package/build/esm/CheckBox/index.js.map +1 -1
  30. package/build/esm/ComboBox/Combobox.d.ts +10 -10
  31. package/build/esm/ComboBox/Combobox.js +3 -3
  32. package/build/esm/ComboBox/Combobox.js.map +1 -1
  33. package/build/esm/ComboBox/ComboboxButton.d.ts +8 -8
  34. package/build/esm/ComboBox/ComboboxButton.js +4 -4
  35. package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
  36. package/build/esm/ComboBox/ComboboxInput.d.ts +10 -10
  37. package/build/esm/ComboBox/ComboboxInput.js +3 -3
  38. package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
  39. package/build/esm/ComboBox/ComboboxLabel.d.ts +5 -5
  40. package/build/esm/ComboBox/ComboboxLabel.js +2 -2
  41. package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
  42. package/build/esm/ComboBox/ComboboxList.d.ts +6 -6
  43. package/build/esm/ComboBox/ComboboxList.js +3 -3
  44. package/build/esm/ComboBox/ComboboxList.js.map +1 -1
  45. package/build/esm/ComboBox/ComboboxOption.d.ts +7 -7
  46. package/build/esm/ComboBox/ComboboxOption.js +4 -4
  47. package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
  48. package/build/esm/ComboBox/ComboboxPopover.d.ts +8 -8
  49. package/build/esm/ComboBox/ComboboxPopover.js +5 -5
  50. package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
  51. package/build/esm/ComboBox/cities.d.ts +0 -0
  52. package/build/esm/ComboBox/cities.js +0 -0
  53. package/build/esm/ComboBox/cities.js.map +1 -1
  54. package/build/esm/ComboBox/context.d.ts +10 -10
  55. package/build/esm/ComboBox/context.js +0 -0
  56. package/build/esm/ComboBox/context.js.map +1 -1
  57. package/build/esm/ComboBox/hooks.d.ts +3 -3
  58. package/build/esm/ComboBox/hooks.js +11 -11
  59. package/build/esm/ComboBox/hooks.js.map +1 -1
  60. package/build/esm/ComboBox/index.d.ts +0 -0
  61. package/build/esm/ComboBox/index.js +0 -0
  62. package/build/esm/ComboBox/index.js.map +1 -1
  63. package/build/esm/ComboBox/makeHash.d.ts +0 -0
  64. package/build/esm/ComboBox/makeHash.js +0 -0
  65. package/build/esm/ComboBox/makeHash.js.map +1 -1
  66. package/build/esm/ComboBox/scopeQuery.d.ts +0 -0
  67. package/build/esm/ComboBox/scopeQuery.js +0 -0
  68. package/build/esm/ComboBox/scopeQuery.js.map +1 -1
  69. package/build/esm/FocusLock/FocusLock.d.ts +7 -7
  70. package/build/esm/FocusLock/FocusLock.js +2 -2
  71. package/build/esm/FocusLock/FocusLock.js.map +1 -1
  72. package/build/esm/FocusLock/index.d.ts +0 -0
  73. package/build/esm/FocusLock/index.js +0 -0
  74. package/build/esm/FocusLock/index.js.map +1 -1
  75. package/build/esm/FocusLock/tabUtils.d.ts +0 -0
  76. package/build/esm/FocusLock/tabUtils.js +0 -0
  77. package/build/esm/FocusLock/tabUtils.js.map +1 -1
  78. package/build/esm/FocusLock/useFocusLock.d.ts +4 -4
  79. package/build/esm/FocusLock/useFocusLock.js +0 -0
  80. package/build/esm/FocusLock/useFocusLock.js.map +1 -1
  81. package/build/esm/List/List.d.ts +6 -6
  82. package/build/esm/List/List.js +2 -2
  83. package/build/esm/List/List.js.map +1 -1
  84. package/build/esm/List/ListItem.d.ts +6 -6
  85. package/build/esm/List/ListItem.js +2 -2
  86. package/build/esm/List/ListItem.js.map +1 -1
  87. package/build/esm/List/context.d.ts +0 -0
  88. package/build/esm/List/context.js +0 -0
  89. package/build/esm/List/context.js.map +1 -1
  90. package/build/esm/List/index.d.ts +0 -0
  91. package/build/esm/List/index.js +0 -0
  92. package/build/esm/List/index.js.map +1 -1
  93. package/build/esm/Menu/Menu.d.ts +6 -6
  94. package/build/esm/Menu/Menu.js +2 -2
  95. package/build/esm/Menu/Menu.js.map +1 -1
  96. package/build/esm/Menu/MenuButton.d.ts +10 -10
  97. package/build/esm/Menu/MenuButton.js +3 -3
  98. package/build/esm/Menu/MenuButton.js.map +1 -1
  99. package/build/esm/Menu/MenuItem.d.ts +6 -6
  100. package/build/esm/Menu/MenuItem.js +4 -4
  101. package/build/esm/Menu/MenuItem.js.map +1 -1
  102. package/build/esm/Menu/MenuList.d.ts +5 -5
  103. package/build/esm/Menu/MenuList.js +6 -6
  104. package/build/esm/Menu/MenuList.js.map +1 -1
  105. package/build/esm/Menu/MenuPopover.d.ts +5 -5
  106. package/build/esm/Menu/MenuPopover.js +2 -2
  107. package/build/esm/Menu/MenuPopover.js.map +1 -1
  108. package/build/esm/Menu/context.d.ts +2 -2
  109. package/build/esm/Menu/context.js +0 -0
  110. package/build/esm/Menu/context.js.map +1 -1
  111. package/build/esm/Menu/index.d.ts +0 -0
  112. package/build/esm/Menu/index.js +0 -0
  113. package/build/esm/Menu/index.js.map +1 -1
  114. package/build/esm/Menu/scope.d.ts +0 -0
  115. package/build/esm/Menu/scope.js +0 -0
  116. package/build/esm/Menu/scope.js.map +1 -1
  117. package/build/esm/Modal/Modal.d.ts +6 -7
  118. package/build/esm/Modal/Modal.js +5 -5
  119. package/build/esm/Modal/Modal.js.map +1 -1
  120. package/build/esm/Modal/ModalBackdrop.d.ts +6 -6
  121. package/build/esm/Modal/ModalBackdrop.js +6 -6
  122. package/build/esm/Modal/ModalBackdrop.js.map +1 -1
  123. package/build/esm/Modal/index.d.ts +0 -0
  124. package/build/esm/Modal/index.js +0 -0
  125. package/build/esm/Modal/index.js.map +1 -1
  126. package/build/esm/Popper/Popper.d.ts +7 -7
  127. package/build/esm/Popper/Popper.js +6 -6
  128. package/build/esm/Popper/Popper.js.map +1 -1
  129. package/build/esm/Popper/PopperArrow.d.ts +5 -5
  130. package/build/esm/Popper/PopperArrow.js +5 -6
  131. package/build/esm/Popper/PopperArrow.js.map +1 -1
  132. package/build/esm/Popper/context.d.ts +0 -0
  133. package/build/esm/Popper/context.js +0 -0
  134. package/build/esm/Popper/context.js.map +1 -1
  135. package/build/esm/Popper/index.d.ts +0 -0
  136. package/build/esm/Popper/index.js +0 -0
  137. package/build/esm/Popper/index.js.map +1 -1
  138. package/build/esm/Portal/Portal.d.ts +0 -0
  139. package/build/esm/Portal/Portal.js +0 -0
  140. package/build/esm/Portal/Portal.js.map +1 -1
  141. package/build/esm/Portal/index.d.ts +0 -0
  142. package/build/esm/Portal/index.js +0 -0
  143. package/build/esm/Portal/index.js.map +1 -1
  144. package/build/esm/RadioButton/RadioButton.d.ts +6 -6
  145. package/build/esm/RadioButton/RadioButton.js +5 -3
  146. package/build/esm/RadioButton/RadioButton.js.map +1 -1
  147. package/build/esm/RadioButton/RadioGroup.d.ts +7 -7
  148. package/build/esm/RadioButton/RadioGroup.js +2 -2
  149. package/build/esm/RadioButton/RadioGroup.js.map +1 -1
  150. package/build/esm/RadioButton/context.d.ts +2 -2
  151. package/build/esm/RadioButton/context.js +0 -0
  152. package/build/esm/RadioButton/context.js.map +1 -1
  153. package/build/esm/RadioButton/index.d.ts +0 -0
  154. package/build/esm/RadioButton/index.js +0 -0
  155. package/build/esm/RadioButton/index.js.map +1 -1
  156. package/build/esm/SkipNav/SkipNav.d.ts +6 -6
  157. package/build/esm/SkipNav/SkipNav.js +2 -2
  158. package/build/esm/SkipNav/SkipNav.js.map +1 -1
  159. package/build/esm/SkipNav/index.d.ts +0 -0
  160. package/build/esm/SkipNav/index.js +0 -0
  161. package/build/esm/SkipNav/index.js.map +1 -1
  162. package/build/esm/Slider/Slider.d.ts +218 -0
  163. package/build/esm/Slider/Slider.js +842 -0
  164. package/build/esm/Slider/Slider.js.map +1 -0
  165. package/build/esm/Slider/index.d.ts +1 -0
  166. package/build/esm/Slider/index.js +2 -0
  167. package/build/esm/Slider/index.js.map +1 -0
  168. package/build/esm/Spinner/Spinner.d.ts +7 -7
  169. package/build/esm/Spinner/Spinner.js +2 -2
  170. package/build/esm/Spinner/Spinner.js.map +1 -1
  171. package/build/esm/Spinner/SpinnerButton.d.ts +6 -6
  172. package/build/esm/Spinner/SpinnerButton.js +3 -3
  173. package/build/esm/Spinner/SpinnerButton.js.map +1 -1
  174. package/build/esm/Spinner/context.d.ts +2 -2
  175. package/build/esm/Spinner/context.js +0 -0
  176. package/build/esm/Spinner/context.js.map +1 -1
  177. package/build/esm/Spinner/index.d.ts +0 -0
  178. package/build/esm/Spinner/index.js +0 -0
  179. package/build/esm/Spinner/index.js.map +1 -1
  180. package/build/esm/Tabs/Tab.d.ts +6 -6
  181. package/build/esm/Tabs/Tab.js +3 -3
  182. package/build/esm/Tabs/Tab.js.map +1 -1
  183. package/build/esm/Tabs/TabList.d.ts +6 -6
  184. package/build/esm/Tabs/TabList.js +4 -4
  185. package/build/esm/Tabs/TabList.js.map +1 -1
  186. package/build/esm/Tabs/TabPanel.d.ts +6 -6
  187. package/build/esm/Tabs/TabPanel.js +4 -4
  188. package/build/esm/Tabs/TabPanel.js.map +1 -1
  189. package/build/esm/Tabs/TabPanels.d.ts +5 -5
  190. package/build/esm/Tabs/TabPanels.js +4 -4
  191. package/build/esm/Tabs/TabPanels.js.map +1 -1
  192. package/build/esm/Tabs/Tabs.d.ts +6 -6
  193. package/build/esm/Tabs/Tabs.js +2 -2
  194. package/build/esm/Tabs/Tabs.js.map +1 -1
  195. package/build/esm/Tabs/context.d.ts +2 -2
  196. package/build/esm/Tabs/context.js +0 -0
  197. package/build/esm/Tabs/context.js.map +1 -1
  198. package/build/esm/Tabs/index.d.ts +0 -0
  199. package/build/esm/Tabs/index.js +0 -0
  200. package/build/esm/Tabs/index.js.map +1 -1
  201. package/build/esm/Tabs/scopeQuery.d.ts +0 -0
  202. package/build/esm/Tabs/scopeQuery.js +0 -0
  203. package/build/esm/Tabs/scopeQuery.js.map +1 -1
  204. package/build/esm/Tooltip/Tooltip.d.ts +7 -8
  205. package/build/esm/Tooltip/Tooltip.js +5 -3
  206. package/build/esm/Tooltip/Tooltip.js.map +1 -1
  207. package/build/esm/Tooltip/index.d.ts +0 -0
  208. package/build/esm/Tooltip/index.js +0 -0
  209. package/build/esm/Tooltip/index.js.map +1 -1
  210. package/build/esm/Tooltip/stateMachine.d.ts +0 -0
  211. package/build/esm/Tooltip/stateMachine.js +9 -9
  212. package/build/esm/Tooltip/stateMachine.js.map +1 -1
  213. package/build/esm/Tooltip/useTooltip.d.ts +7 -7
  214. package/build/esm/Tooltip/useTooltip.js +7 -6
  215. package/build/esm/Tooltip/useTooltip.js.map +1 -1
  216. package/build/esm/hooks/index.d.ts +0 -0
  217. package/build/esm/hooks/index.js +0 -0
  218. package/build/esm/hooks/index.js.map +1 -1
  219. package/build/esm/hooks/useAutoFocus.d.ts +2 -2
  220. package/build/esm/hooks/useAutoFocus.js +0 -0
  221. package/build/esm/hooks/useAutoFocus.js.map +1 -1
  222. package/build/esm/hooks/useChildrenCounter.d.ts +0 -0
  223. package/build/esm/hooks/useChildrenCounter.js +0 -0
  224. package/build/esm/hooks/useChildrenCounter.js.map +1 -1
  225. package/build/esm/hooks/useControlledState.d.ts +2 -6
  226. package/build/esm/hooks/useControlledState.js +8 -7
  227. package/build/esm/hooks/useControlledState.js.map +1 -1
  228. package/build/esm/hooks/useFocusReturn.d.ts +0 -0
  229. package/build/esm/hooks/useFocusReturn.js +2 -2
  230. package/build/esm/hooks/useFocusReturn.js.map +1 -1
  231. package/build/esm/hooks/useFocusState.d.ts +5 -5
  232. package/build/esm/hooks/useFocusState.js +1 -1
  233. package/build/esm/hooks/useFocusState.js.map +1 -1
  234. package/build/esm/hooks/useGestureHandlers.d.ts +5 -5
  235. package/build/esm/hooks/useGestureHandlers.js +23 -15
  236. package/build/esm/hooks/useGestureHandlers.js.map +1 -1
  237. package/build/esm/hooks/useMeasure.d.ts +2 -2
  238. package/build/esm/hooks/useMeasure.js +0 -1
  239. package/build/esm/hooks/useMeasure.js.map +1 -1
  240. package/build/esm/hooks/useOnClickOutside.d.ts +2 -2
  241. package/build/esm/hooks/useOnClickOutside.js +0 -0
  242. package/build/esm/hooks/useOnClickOutside.js.map +1 -1
  243. package/build/esm/hooks/useOnKeyDown.d.ts +1 -1
  244. package/build/esm/hooks/useOnKeyDown.js +5 -5
  245. package/build/esm/hooks/useOnKeyDown.js.map +1 -1
  246. package/build/esm/hooks/useReducerMachine.d.ts +0 -0
  247. package/build/esm/hooks/useReducerMachine.js +2 -1
  248. package/build/esm/hooks/useReducerMachine.js.map +1 -1
  249. package/build/esm/hooks/useRemoveBodyScroll.d.ts +2 -1
  250. package/build/esm/hooks/useRemoveBodyScroll.js +12 -8
  251. package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
  252. package/build/esm/hooks/useScope.d.ts +0 -0
  253. package/build/esm/hooks/useScope.js +0 -0
  254. package/build/esm/hooks/useScope.js.map +1 -1
  255. package/build/esm/hooks/useThrottle.d.ts +0 -0
  256. package/build/esm/hooks/useThrottle.js +0 -0
  257. package/build/esm/hooks/useThrottle.js.map +1 -1
  258. package/build/esm/index.d.ts +1 -0
  259. package/build/esm/index.js +1 -0
  260. package/build/esm/index.js.map +1 -1
  261. package/build/esm/utils/assign-ref.d.ts +3 -0
  262. package/build/esm/utils/{assignRef.js → assign-ref.js} +1 -1
  263. package/build/esm/utils/assign-ref.js.map +1 -0
  264. package/build/esm/utils/can-use-dom.d.ts +1 -0
  265. package/build/esm/utils/can-use-dom.js +4 -0
  266. package/build/esm/utils/can-use-dom.js.map +1 -0
  267. package/build/esm/utils/clamp.d.ts +0 -0
  268. package/build/esm/utils/clamp.js +0 -0
  269. package/build/esm/utils/clamp.js.map +1 -1
  270. package/build/esm/utils/context.d.ts +7 -0
  271. package/build/esm/utils/context.js +41 -0
  272. package/build/esm/utils/context.js.map +1 -0
  273. package/build/esm/utils/{createSubscription.d.ts → create-subscription.d.ts} +0 -0
  274. package/build/esm/utils/{createSubscription.js → create-subscription.js} +1 -1
  275. package/build/esm/utils/create-subscription.js.map +1 -0
  276. package/build/esm/utils/{getCircularIndex.d.ts → get-circular-index.d.ts} +0 -0
  277. package/build/esm/utils/{getCircularIndex.js → get-circular-index.js} +1 -1
  278. package/build/esm/utils/get-circular-index.js.map +1 -0
  279. package/build/esm/utils/index.d.ts +10 -4
  280. package/build/esm/utils/index.js +10 -4
  281. package/build/esm/utils/index.js.map +1 -1
  282. package/build/esm/utils/is-right-click.d.ts +6 -0
  283. package/build/esm/utils/is-right-click.js +9 -0
  284. package/build/esm/utils/is-right-click.js.map +1 -0
  285. package/build/esm/utils/owner-document.d.ts +7 -0
  286. package/build/esm/utils/owner-document.js +12 -0
  287. package/build/esm/utils/owner-document.js.map +1 -0
  288. package/build/esm/utils/polymorphic.d.ts +32 -0
  289. package/build/esm/utils/polymorphic.js +2 -0
  290. package/build/esm/utils/polymorphic.js.map +1 -0
  291. package/build/esm/utils/{rubberBandClamp.d.ts → rubber-band-clamp.d.ts} +0 -0
  292. package/build/esm/utils/{rubberBandClamp.js → rubber-band-clamp.js} +1 -1
  293. package/build/esm/utils/rubber-band-clamp.js.map +1 -0
  294. package/build/esm/utils/use-stable-callback.d.ts +16 -0
  295. package/build/esm/utils/use-stable-callback.js +43 -0
  296. package/build/esm/utils/use-stable-callback.js.map +1 -0
  297. package/build/esm/utils/wrap-event.d.ts +3 -0
  298. package/build/esm/utils/{wrapEvent.js → wrap-event.js} +1 -1
  299. package/build/esm/utils/wrap-event.js.map +1 -0
  300. package/build/tsconfig-build.tsbuildinfo +1 -0
  301. package/package.json +4 -5
  302. package/src/Accordion/Accordion.tsx +12 -6
  303. package/src/Accordion/AccordionBody.tsx +4 -5
  304. package/src/Accordion/AccordionHeader.tsx +30 -27
  305. package/src/Accordion/AccordionItem.tsx +12 -6
  306. package/src/Accordion/context.ts +3 -2
  307. package/src/CheckBox/CheckBox.tsx +5 -6
  308. package/src/ComboBox/ComboBox.story.tsx +3 -3
  309. package/src/ComboBox/Combobox.tsx +5 -8
  310. package/src/ComboBox/ComboboxButton.tsx +15 -9
  311. package/src/ComboBox/ComboboxInput.tsx +18 -10
  312. package/src/ComboBox/ComboboxLabel.tsx +4 -4
  313. package/src/ComboBox/ComboboxList.tsx +5 -6
  314. package/src/ComboBox/ComboboxOption.tsx +12 -8
  315. package/src/ComboBox/ComboboxPopover.tsx +15 -10
  316. package/src/ComboBox/context.ts +10 -9
  317. package/src/ComboBox/hooks.tsx +4 -3
  318. package/src/FocusLock/FocusLock.tsx +13 -7
  319. package/src/FocusLock/useFocusLock.ts +4 -3
  320. package/src/List/List.tsx +5 -5
  321. package/src/List/ListItem.tsx +5 -5
  322. package/src/Menu/Menu.story.tsx +2 -2
  323. package/src/Menu/Menu.tsx +13 -7
  324. package/src/Menu/MenuButton.tsx +13 -10
  325. package/src/Menu/MenuItem.tsx +15 -11
  326. package/src/Menu/MenuList.tsx +6 -6
  327. package/src/Menu/MenuPopover.tsx +4 -4
  328. package/src/Menu/context.ts +9 -4
  329. package/src/Modal/Modal.tsx +11 -7
  330. package/src/Modal/ModalBackdrop.tsx +16 -11
  331. package/src/Popper/Popper.tsx +7 -7
  332. package/src/Popper/PopperArrow.tsx +6 -8
  333. package/src/RadioButton/RadioButton.tsx +11 -6
  334. package/src/RadioButton/RadioGroup.tsx +11 -9
  335. package/src/RadioButton/context.ts +2 -4
  336. package/src/SkipNav/SkipNav.tsx +5 -5
  337. package/src/Slider/Slider.story.tsx +45 -0
  338. package/src/Slider/Slider.tsx +1106 -0
  339. package/src/Slider/index.ts +1 -0
  340. package/src/Slider/styles.css +131 -0
  341. package/src/Spinner/Spinner.tsx +13 -9
  342. package/src/Spinner/SpinnerButton.tsx +11 -6
  343. package/src/Spinner/context.ts +2 -3
  344. package/src/Tabs/Tab.tsx +13 -8
  345. package/src/Tabs/TabList.tsx +5 -5
  346. package/src/Tabs/TabPanel.tsx +5 -5
  347. package/src/Tabs/TabPanels.tsx +4 -4
  348. package/src/Tabs/Tabs.tsx +5 -7
  349. package/src/Tabs/context.ts +2 -3
  350. package/src/Tooltip/Tooltip.story.tsx +3 -3
  351. package/src/Tooltip/Tooltip.tsx +13 -7
  352. package/src/Tooltip/stateMachine.ts +9 -13
  353. package/src/Tooltip/useTooltip.ts +19 -12
  354. package/src/hooks/useAutoFocus.ts +2 -1
  355. package/src/hooks/useControlledState.ts +14 -14
  356. package/src/hooks/useFocusState.ts +4 -3
  357. package/src/hooks/useGestureHandlers.ts +33 -19
  358. package/src/hooks/useMeasure.ts +2 -2
  359. package/src/hooks/useOnClickOutside.ts +2 -2
  360. package/src/hooks/useOnKeyDown.ts +4 -3
  361. package/src/hooks/useRemoveBodyScroll.ts +18 -8
  362. package/src/index.ts +1 -0
  363. package/src/utils/{assignRef.ts → assign-ref.ts} +4 -4
  364. package/src/utils/can-use-dom.ts +7 -0
  365. package/src/utils/context.tsx +48 -0
  366. package/src/utils/{createSubscription.ts → create-subscription.ts} +0 -0
  367. package/src/utils/{getCircularIndex.ts → get-circular-index.ts} +0 -0
  368. package/src/utils/index.ts +10 -4
  369. package/src/utils/is-right-click.ts +14 -0
  370. package/src/utils/owner-document.ts +13 -0
  371. package/src/utils/polymorphic.ts +72 -0
  372. package/src/utils/{rubberBandClamp.ts → rubber-band-clamp.ts} +0 -0
  373. package/src/utils/use-stable-callback.ts +58 -0
  374. package/src/utils/wrap-event.ts +22 -0
  375. package/build/esm/utils/assignRef.d.ts +0 -3
  376. package/build/esm/utils/assignRef.js.map +0 -1
  377. package/build/esm/utils/createSubscription.js.map +0 -1
  378. package/build/esm/utils/getCircularIndex.js.map +0 -1
  379. package/build/esm/utils/rubberBandClamp.js.map +0 -1
  380. package/build/esm/utils/wrapEvent.d.ts +0 -3
  381. package/build/esm/utils/wrapEvent.js.map +0 -1
  382. package/build/tsconfig.tsbuildinfo +0 -1
  383. package/src/utils/wrapEvent.ts +0 -20
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxInput.tsx"],"names":["forwardRef","useEffect","useRef","React","useBlur","CLEAR","CHANGE","useKeyDown","SELECT_WITH_CLICK","FOCUS","NAVIGATING","INIT","useFocusManagement","assignMultipleRefs","wrapEvent","useComboBoxContext","ComboboxInput","forwardedRef","as","Comp","innerAs","selectOnClick","autocomplete","clearOnEscape","onClick","onChange","onKeyDown","onBlur","onFocus","preferredId","id","defaultValue","controlledValue","value","props","data","navigationItem","text","lastActionType","inputRef","state","transition","listboxIdRef","autocompletePropRef","clearOnEscapeRef","openOnFocus","optionsRef","labelIdRef","hasStartedInteracting","selectOnClickRef","handleBlur","current","handleChange","e","target","trim","handleKeyDown","handleFocus","item","handleClick","select","navigationText","undefined","fallbackValue","inputStrings","inputValue","find","str"],"mappings":";;AAAA,SAASA,UAAT,EAAqBC,SAArB,EAAgCC,MAAhC,QAA8C,OAA9C;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SACEC,OADF,EAEEC,KAFF,EAGEC,MAHF,EAIEC,UAJF,EAKEC,iBALF,EAMEC,KANF,EAOEC,UAPF,EAQEC,IARF,EASEC,kBATF,QAUO,SAVP;AAWA,SAASC,kBAAT,EAA6BC,SAA7B,QAA8C,UAA9C;AACA,SAASC,kBAAT,QAAmC,WAAnC;;AAwBA,OAAO,IAAMC,aAAa,gBAAGhB,UAAU,CACrC,SAASgB,aAAT,OAuBEC,YAvBF,EAwBE;AAAA,qBAtBEC,EAsBF;AAAA,MAtBMC,IAsBN,wBAtBa,OAsBb;AAAA,MArBEC,OAqBF,QArBEA,OAqBF;AAAA,gCApBEC,aAoBF;AAAA,MApBEA,aAoBF,mCApBkB,KAoBlB;AAAA,+BAnBEC,YAmBF;AAAA,MAnBEA,YAmBF,kCAnBiB,IAmBjB;AAAA,gCAlBEC,aAkBF;AAAA,MAlBEA,aAkBF,mCAlBkB,KAkBlB;AAAA,MAfEC,OAeF,QAfEA,OAeF;AAAA,MAdEC,QAcF,QAdEA,QAcF;AAAA,MAbEC,SAaF,QAbEA,SAaF;AAAA,MAZEC,MAYF,QAZEA,MAYF;AAAA,MAXEC,OAWF,QAXEA,OAWF;AAAA,MATMC,WASN,QATEC,EASF;AAAA,+BAPEC,YAOF;AAAA,MAPEA,YAOF,kCAPiB,EAOjB;AAAA,MAJSC,eAIT,QAJEC,KAIF;AAAA,MAHKC,KAGL;;AAAA,4BAYInB,kBAAkB,EAZtB;AAAA,kDAEEoB,IAFF;AAAA,MAEUC,cAFV,yBAEUA,cAFV;AAAA,MAE0BC,IAF1B,yBAE0BA,IAF1B;AAAA,MAEgCC,cAFhC,yBAEgCA,cAFhC;AAAA,MAGEC,QA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,EAGN,EAHM,CAAT;AAKA,sBACE,KAAC,IAAD,eACMxB,KADN;AAEE,IAAA,EAAE,EAAEd,OAFN;AAGE,iCAA0B,EAH5B;AAIE,IAAA,GAAG,EAAEP,kBAAkB,CAAC0B,QAAD,EAAWtB,YAAX,CAJzB;AAKE,IAAA,KAAK,EAAEgD,UALT;AAME,IAAA,OAAO,EAAEnD,SAAS,CAACU,OAAD,EAAUmC,WAAV,CANpB;AAOE,IAAA,MAAM,EAAE7C,SAAS,CAACa,MAAD,EAASuB,UAAT,CAPnB;AAQE,IAAA,OAAO,EAAEpC,SAAS,CAACc,OAAD,EAAU6B,WAAV,CARpB;AASE,IAAA,QAAQ,EAAE3C,SAAS,CAACW,QAAD,EAAW2B,YAAX,CATrB;AAUE,IAAA,SAAS,EAAEtC,SAAS,CAACY,SAAD,EAAY8B,aAAZ,CAVtB;AAWE,uBAAiBT,UAAU,CAACI,OAX9B;AAYE,IAAA,EAAE,EAAET,YAAY,CAACS,OAZnB;AAaE,yBAAkB,MAbpB;AAcE,6BACEf,cAAc,KAAK,EAAnB,GAAwBA,cAAxB,GAAyC0B,SAf7C;AAiBE,IAAA,YAAY,EAAC;AAjBf,KADF;AAqBD,CA1IoC,CAAhC","sourcesContent":["import { forwardRef, useEffect, useRef } from 'react';\nimport * as React from 'react';\n\nimport {\n useBlur,\n CLEAR,\n CHANGE,\n useKeyDown,\n SELECT_WITH_CLICK,\n FOCUS,\n NAVIGATING,\n INIT,\n useFocusManagement,\n} from './hooks';\nimport { assignMultipleRefs, wrapEvent } from '../utils';\nimport { useComboBoxContext } from './context';\n\nexport interface ComboboxInputProps\n extends React.InputHTMLAttributes<HTMLInputElement> {\n // clear on ESC\n clearOnEscape?: boolean;\n // highlights all the text in the box on click when true\n selectOnClick?: boolean;\n // updates the value in the input when navigating w/ the keyboard\n autocomplete?: boolean;\n // initial value for uncontrolled mode\n defaultValue?: string;\n // value for controlled mode\n value?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n id?: string;\n}\n\nexport const ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(\n function ComboboxInput(\n {\n as: Comp = 'input',\n innerAs,\n selectOnClick = false,\n autocomplete = true,\n clearOnEscape = false,\n\n // wrapped events\n onClick,\n onChange,\n onKeyDown,\n onBlur,\n onFocus,\n\n id: preferredId,\n\n defaultValue = '',\n\n // might be controlled\n value: controlledValue,\n ...props\n },\n forwardedRef\n ) {\n const {\n data: { navigationItem, text, lastActionType },\n inputRef,\n state,\n transition,\n listboxIdRef,\n autocompletePropRef,\n clearOnEscapeRef,\n openOnFocus,\n optionsRef,\n labelIdRef,\n } = useComboBoxContext();\n\n // Keep focus on the input component\n useFocusManagement(lastActionType, inputRef);\n\n // Keep using the defaultValue until the user started interacting\n const hasStartedInteracting = useRef(false);\n\n // Because we close the List on blur, we need to track if the blur is\n // caused by clicking inside the list, and if so, don't close the List.\n const selectOnClickRef = useRef(false);\n\n const handleBlur = useBlur();\n\n // Update ref props\n autocompletePropRef.current = autocomplete;\n clearOnEscapeRef.current = clearOnEscape;\n listboxIdRef.current = preferredId || listboxIdRef.current;\n\n // [*]... and when controlled, we don't trigger handleValueChange as the user\n // types, instead the developer controls it with the normal input onChange\n // prop\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // After the user started typing, lets forget the defaultValue\n hasStartedInteracting.current = true;\n\n const text = e.target.value;\n if (text.trim() === '') {\n transition(CLEAR);\n } else {\n transition(CHANGE, { text });\n }\n };\n\n const handleKeyDown = useKeyDown();\n\n const handleFocus = () => {\n if (selectOnClick) {\n selectOnClickRef.current = true;\n }\n // If we select an option with click, useFocusManagement will focus the\n // input, in those cases we don't want to cause the menu to open back up,\n // so we guard behind these states\n if (openOnFocus && lastActionType !== SELECT_WITH_CLICK) {\n transition(FOCUS, {\n item: navigationItem,\n });\n }\n };\n\n const handleClick = () => {\n if (selectOnClickRef.current) {\n selectOnClickRef.current = false;\n inputRef.current && inputRef.current.select();\n }\n };\n\n const navigationText =\n navigationItem !== ''\n ? optionsRef.current[navigationItem].text\n : undefined;\n\n const fallbackValue = hasStartedInteracting.current ? '' : defaultValue;\n\n const inputStrings =\n // When idle, we don't have a navigationText on ArrowUp/Down\n autocomplete && state === NAVIGATING\n ? [navigationText, controlledValue, text, fallbackValue]\n : [controlledValue, text, fallbackValue];\n\n const inputValue = inputStrings.find((str) => str !== undefined);\n\n // If they are controlling the value we still need to do our transitions, so\n // we have this derived state to emulate onChange of the input as we receive\n // new `value`s ...[*]\n useEffect(() => {\n transition(INIT, { text: inputValue, item: '' });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Comp\n {...props}\n as={innerAs}\n data-reach-combobox-input=\"\"\n ref={assignMultipleRefs(inputRef, forwardedRef)}\n value={inputValue}\n onClick={wrapEvent(onClick, handleClick)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n onFocus={wrapEvent(onFocus, handleFocus)}\n onChange={wrapEvent(onChange, handleChange)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n aria-labelledby={labelIdRef.current}\n id={listboxIdRef.current}\n aria-autocomplete=\"both\"\n aria-activedescendant={\n navigationItem !== '' ? navigationItem : undefined\n }\n autoComplete=\"off\"\n />\n );\n }\n);\n"],"file":"ComboboxInput.js"}
1
+ {"version":3,"file":"ComboboxInput.js","names":["forwardRef","useEffect","useRef","useBlur","CLEAR","CHANGE","useKeyDown","SELECT_WITH_CLICK","FOCUS","NAVIGATING","INIT","useFocusManagement","assignMultipleRefs","wrapEvent","useComboBoxContext","ComboboxInput","forwardedRef","as","Comp","innerAs","selectOnClick","autocomplete","clearOnEscape","onClick","onChange","onKeyDown","onBlur","onFocus","preferredId","id","defaultValue","controlledValue","value","props","data","navigationItem","text","lastActionType","inputRef","state","transition","listboxIdRef","autocompletePropRef","clearOnEscapeRef","openOnFocus","optionsRef","labelIdRef","hasStartedInteracting","selectOnClickRef","handleBlur","current","handleChange","e","target","trim","handleKeyDown","handleFocus","item","handleClick","select","navigationText","undefined","fallbackValue","inputStrings","inputValue","find","str"],"sources":["../../../src/ComboBox/ComboboxInput.tsx"],"sourcesContent":["import type {\n ChangeEvent,\n ChangeEventHandler,\n ElementType,\n FocusEventHandler,\n InputHTMLAttributes,\n KeyboardEventHandler,\n MouseEventHandler,\n} from 'react';\nimport { forwardRef, useEffect, useRef } from 'react';\n\nimport {\n useBlur,\n CLEAR,\n CHANGE,\n useKeyDown,\n SELECT_WITH_CLICK,\n FOCUS,\n NAVIGATING,\n INIT,\n useFocusManagement,\n} from './hooks';\nimport { assignMultipleRefs, wrapEvent } from '../utils';\nimport { useComboBoxContext } from './context';\n\nexport interface ComboboxInputProps\n extends InputHTMLAttributes<HTMLInputElement> {\n // clear on ESC\n clearOnEscape?: boolean;\n // highlights all the text in the box on click when true\n selectOnClick?: boolean;\n // updates the value in the input when navigating w/ the keyboard\n autocomplete?: boolean;\n // initial value for uncontrolled mode\n defaultValue?: string;\n // value for controlled mode\n value?: string;\n onClick?: MouseEventHandler<HTMLInputElement>;\n onChange?: ChangeEventHandler<HTMLInputElement>;\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n onBlur?: FocusEventHandler<HTMLInputElement>;\n onFocus?: FocusEventHandler<HTMLInputElement>;\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n id?: string;\n}\n\nexport const ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(\n function ComboboxInput(\n {\n as: Comp = 'input',\n innerAs,\n selectOnClick = false,\n autocomplete = true,\n clearOnEscape = false,\n\n // wrapped events\n onClick,\n onChange,\n onKeyDown,\n onBlur,\n onFocus,\n\n id: preferredId,\n\n defaultValue = '',\n\n // might be controlled\n value: controlledValue,\n ...props\n },\n forwardedRef\n ) {\n const {\n data: { navigationItem, text, lastActionType },\n inputRef,\n state,\n transition,\n listboxIdRef,\n autocompletePropRef,\n clearOnEscapeRef,\n openOnFocus,\n optionsRef,\n labelIdRef,\n } = useComboBoxContext();\n\n // Keep focus on the input component\n useFocusManagement(lastActionType, inputRef);\n\n // Keep using the defaultValue until the user started interacting\n const hasStartedInteracting = useRef(false);\n\n // Because we close the List on blur, we need to track if the blur is\n // caused by clicking inside the list, and if so, don't close the List.\n const selectOnClickRef = useRef(false);\n\n const handleBlur = useBlur();\n\n // Update ref props\n autocompletePropRef.current = autocomplete;\n clearOnEscapeRef.current = clearOnEscape;\n listboxIdRef.current = preferredId || listboxIdRef.current;\n\n // [*]... and when controlled, we don't trigger handleValueChange as the user\n // types, instead the developer controls it with the normal input onChange\n // prop\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n // After the user started typing, lets forget the defaultValue\n hasStartedInteracting.current = true;\n\n const text = e.target.value;\n if (text.trim() === '') {\n transition(CLEAR);\n } else {\n transition(CHANGE, { text });\n }\n };\n\n const handleKeyDown = useKeyDown();\n\n const handleFocus = () => {\n if (selectOnClick) {\n selectOnClickRef.current = true;\n }\n // If we select an option with click, useFocusManagement will focus the\n // input, in those cases we don't want to cause the menu to open back up,\n // so we guard behind these states\n if (openOnFocus && lastActionType !== SELECT_WITH_CLICK) {\n transition(FOCUS, {\n item: navigationItem,\n });\n }\n };\n\n const handleClick = () => {\n if (selectOnClickRef.current) {\n selectOnClickRef.current = false;\n inputRef.current && inputRef.current.select();\n }\n };\n\n const navigationText =\n navigationItem !== ''\n ? optionsRef.current[navigationItem].text\n : undefined;\n\n const fallbackValue = hasStartedInteracting.current ? '' : defaultValue;\n\n const inputStrings =\n // When idle, we don't have a navigationText on ArrowUp/Down\n autocomplete && state === NAVIGATING\n ? [navigationText, controlledValue, text, fallbackValue]\n : [controlledValue, text, fallbackValue];\n\n const inputValue = inputStrings.find((str) => str !== undefined);\n\n // If they are controlling the value we still need to do our transitions, so\n // we have this derived state to emulate onChange of the input as we receive\n // new `value`s ...[*]\n useEffect(() => {\n transition(INIT, { text: inputValue, item: '' });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Comp\n {...props}\n as={innerAs}\n data-reach-combobox-input=\"\"\n ref={assignMultipleRefs(inputRef, forwardedRef)}\n value={inputValue}\n onClick={wrapEvent(onClick, handleClick)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n onFocus={wrapEvent(onFocus, handleFocus)}\n onChange={wrapEvent(onChange, handleChange)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n aria-labelledby={labelIdRef.current}\n id={listboxIdRef.current}\n aria-autocomplete=\"both\"\n aria-activedescendant={\n navigationItem !== '' ? navigationItem : undefined\n }\n autoComplete=\"off\"\n />\n );\n }\n);\n"],"mappings":";;;AASA,SAASA,UAAT,EAAqBC,SAArB,EAAgCC,MAAhC,QAA8C,OAA9C;AAEA,SACEC,OADF,EAEEC,KAFF,EAGEC,MAHF,EAIEC,UAJF,EAKEC,iBALF,EAMEC,KANF,EAOEC,UAPF,EAQEC,IARF,EASEC,kBATF,QAUO,SAVP;AAWA,SAASC,kBAAT,EAA6BC,SAA7B,QAA8C,UAA9C;AACA,SAASC,kBAAT,QAAmC,WAAnC;;AAwBA,OAAO,IAAMC,aAAa,gBAAGf,UAAU,CACrC,SAASe,aAAT,OAuBEC,YAvBF,EAwBE;EAAA,mBAtBEC,EAsBF;EAAA,IAtBMC,IAsBN,wBAtBa,OAsBb;EAAA,IArBEC,OAqBF,QArBEA,OAqBF;EAAA,8BApBEC,aAoBF;EAAA,IApBEA,aAoBF,mCApBkB,KAoBlB;EAAA,6BAnBEC,YAmBF;EAAA,IAnBEA,YAmBF,kCAnBiB,IAmBjB;EAAA,8BAlBEC,aAkBF;EAAA,IAlBEA,aAkBF,mCAlBkB,KAkBlB;EAAA,IAfEC,OAeF,QAfEA,OAeF;EAAA,IAdEC,QAcF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MA,IAAME,UAAU,GAAGD,YAAY,CAACE,IAAb,CAAkB,UAACC,GAAD;IAAA,OAASA,GAAG,KAAKL,SAAjB;EAAA,CAAlB,CAAnB,CAlFA,CAoFA;EACA;EACA;;EACA5D,SAAS,CAAC,YAAM;IACduC,UAAU,CAAC9B,IAAD,EAAO;MAAE0B,IAAI,EAAE4B,UAAR;MAAoBP,IAAI,EAAE;IAA1B,CAAP,CAAV,CADc,CAEd;EACD,CAHQ,EAGN,EAHM,CAAT;EAKA,oBACE,KAAC,IAAD,wBACMxB,KADN;IAEE,EAAE,EAAEd,OAFN;IAGE,6BAA0B,EAH5B;IAIE,GAAG,EAAEP,kBAAkB,CAAC0B,QAAD,EAAWtB,YAAX,CAJzB;IAKE,KAAK,EAAEgD,UALT;IAME,OAAO,EAAEnD,SAAS,CAACU,OAAD,EAAUmC,WAAV,CANpB;IAOE,MAAM,EAAE7C,SAAS,CAACa,MAAD,EAASuB,UAAT,CAPnB;IAQE,OAAO,EAAEpC,SAAS,CAACc,OAAD,EAAU6B,WAAV,CARpB;IASE,QAAQ,EAAE3C,SAAS,CAACW,QAAD,EAAW2B,YAAX,CATrB;IAUE,SAAS,EAAEtC,SAAS,CAACY,SAAD,EAAY8B,aAAZ,CAVtB;IAWE,mBAAiBT,UAAU,CAACI,OAX9B;IAYE,EAAE,EAAET,YAAY,CAACS,OAZnB;IAaE,qBAAkB,MAbpB;IAcE,yBACEf,cAAc,KAAK,EAAnB,GAAwBA,cAAxB,GAAyC0B,SAf7C;IAiBE,YAAY,EAAC;EAjBf,GADF;AAqBD,CA1IoC,CAAhC"}
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
- export interface ComboboxLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
1
+ import type { ElementType, LabelHTMLAttributes } from 'react';
2
+ export interface ComboboxLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
5
  id?: string;
6
6
  }
7
- export declare const ComboboxLabel: React.ForwardRefExoticComponent<ComboboxLabelProps & React.RefAttributes<HTMLLabelElement>>;
7
+ export declare const ComboboxLabel: import("react").ForwardRefExoticComponent<ComboboxLabelProps & import("react").RefAttributes<HTMLLabelElement>>;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["as", "innerAs", "id"];
3
4
  import { forwardRef } from 'react';
4
- import * as React from 'react';
5
5
  import { useComboBoxContext } from './context';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  export var ComboboxLabel = /*#__PURE__*/forwardRef(function ComboboxButton(_ref, ref) {
@@ -9,7 +9,7 @@ export var ComboboxLabel = /*#__PURE__*/forwardRef(function ComboboxButton(_ref,
9
9
  Comp = _ref$as === void 0 ? 'label' : _ref$as,
10
10
  innerAs = _ref.innerAs,
11
11
  preferredId = _ref.id,
12
- props = _objectWithoutProperties(_ref, ["as", "innerAs", "id"]);
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
13
 
14
14
  var _useComboBoxContext = useComboBoxContext(),
15
15
  listboxIdRef = _useComboBoxContext.listboxIdRef,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxLabel.tsx"],"names":["forwardRef","React","useComboBoxContext","ComboboxLabel","ComboboxButton","ref","as","Comp","innerAs","preferredId","id","props","listboxIdRef","labelIdRef","current"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,kBAAT,QAAmC,WAAnC;;AASA,OAAO,IAAMC,aAAa,gBAAGH,UAAU,CACrC,SAASI,cAAT,OAEEC,GAFF,EAGE;AAAA,qBAFEC,EAEF;AAAA,MAFMC,IAEN,wBAFa,OAEb;AAAA,MAFsBC,OAEtB,QAFsBA,OAEtB;AAAA,MAFmCC,WAEnC,QAF+BC,EAE/B;AAAA,MAFmDC,KAEnD;;AAAA,4BACqCT,kBAAkB,EADvD;AAAA,MACQU,YADR,uBACQA,YADR;AAAA,MACsBC,UADtB,uBACsBA,UADtB;;AAGAA,EAAAA,UAAU,CAACC,OAAX,GAAqBL,WAAW,IAAII,UAAU,CAACC,OAA/C;AAEA,sBACE,KAAC,IAAD;AACE,IAAA,EAAE,EAAEN,OADN;AAEE,iCAA0B,EAF5B;AAGE,IAAA,OAAO,EAAEI,YAAY,CAACE,OAHxB;AAIE,IAAA,EAAE,EAAED,UAAU,CAACC,OAJjB;AAKE,IAAA,GAAG,EAAET;AALP,KAMMM,KANN,EADF;AAUD,CAnBoC,CAAhC","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nimport { useComboBoxContext } from './context';\n\nexport interface ComboboxLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n id?: string;\n}\n\nexport const ComboboxLabel = forwardRef<HTMLLabelElement, ComboboxLabelProps>(\n function ComboboxButton(\n { as: Comp = 'label', innerAs, id: preferredId, ...props },\n ref\n ) {\n const { listboxIdRef, labelIdRef } = useComboBoxContext();\n\n labelIdRef.current = preferredId || labelIdRef.current;\n\n return (\n <Comp\n as={innerAs}\n data-reach-combobox-label=\"\"\n htmlFor={listboxIdRef.current}\n id={labelIdRef.current}\n ref={ref}\n {...props}\n />\n );\n }\n);\n"],"file":"ComboboxLabel.js"}
1
+ {"version":3,"file":"ComboboxLabel.js","names":["forwardRef","useComboBoxContext","ComboboxLabel","ComboboxButton","ref","as","Comp","innerAs","preferredId","id","props","listboxIdRef","labelIdRef","current"],"sources":["../../../src/ComboBox/ComboboxLabel.tsx"],"sourcesContent":["import type { ElementType, LabelHTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\n\nimport { useComboBoxContext } from './context';\n\nexport interface ComboboxLabelProps\n extends LabelHTMLAttributes<HTMLLabelElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n id?: string;\n}\n\nexport const ComboboxLabel = forwardRef<HTMLLabelElement, ComboboxLabelProps>(\n function ComboboxButton(\n { as: Comp = 'label', innerAs, id: preferredId, ...props },\n ref\n ) {\n const { listboxIdRef, labelIdRef } = useComboBoxContext();\n\n labelIdRef.current = preferredId || labelIdRef.current;\n\n return (\n <Comp\n as={innerAs}\n data-reach-combobox-label=\"\"\n htmlFor={listboxIdRef.current}\n id={labelIdRef.current}\n ref={ref}\n {...props}\n />\n );\n }\n);\n"],"mappings":";;;AACA,SAASA,UAAT,QAA2B,OAA3B;AAEA,SAASC,kBAAT,QAAmC,WAAnC;;AASA,OAAO,IAAMC,aAAa,gBAAGF,UAAU,CACrC,SAASG,cAAT,OAEEC,GAFF,EAGE;EAAA,mBAFEC,EAEF;EAAA,IAFMC,IAEN,wBAFa,OAEb;EAAA,IAFsBC,OAEtB,QAFsBA,OAEtB;EAAA,IAFmCC,WAEnC,QAF+BC,EAE/B;EAAA,IAFmDC,KAEnD;;EACA,0BAAqCT,kBAAkB,EAAvD;EAAA,IAAQU,YAAR,uBAAQA,YAAR;EAAA,IAAsBC,UAAtB,uBAAsBA,UAAtB;;EAEAA,UAAU,CAACC,OAAX,GAAqBL,WAAW,IAAII,UAAU,CAACC,OAA/C;EAEA,oBACE,KAAC,IAAD;IACE,EAAE,EAAEN,OADN;IAEE,6BAA0B,EAF5B;IAGE,OAAO,EAAEI,YAAY,CAACE,OAHxB;IAIE,EAAE,EAAED,UAAU,CAACC,OAJjB;IAKE,GAAG,EAAET;EALP,GAMMM,KANN,EADF;AAUD,CAnBoC,CAAhC"}
@@ -1,8 +1,8 @@
1
- import * as React from 'react';
2
- export interface ComboboxListProps extends React.HTMLAttributes<HTMLUListElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
1
+ import type { HTMLAttributes, ElementType, ReactNode } from 'react';
2
+ export interface ComboboxListProps extends HTMLAttributes<HTMLUListElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
5
  persistSelection?: boolean;
6
- children?: React.ReactNode;
6
+ children?: ReactNode;
7
7
  }
8
- export declare const ComboboxList: React.ForwardRefExoticComponent<ComboboxListProps & React.RefAttributes<HTMLUListElement>>;
8
+ export declare const ComboboxList: import("react").ForwardRefExoticComponent<ComboboxListProps & import("react").RefAttributes<HTMLUListElement>>;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["persistSelection", "as", "innerAs"];
3
4
  import { forwardRef, useRef, useEffect } from 'react';
4
- import * as React from 'react';
5
5
  import { useComboBoxContext } from './context';
6
6
  import { getScope } from '../hooks';
7
7
  import { assignMultipleRefs } from '../utils';
@@ -12,7 +12,7 @@ export var ComboboxList = /*#__PURE__*/forwardRef(function ComboboxList(_ref, re
12
12
  _ref$as = _ref.as,
13
13
  Comp = _ref$as === void 0 ? 'ul' : _ref$as,
14
14
  innerAs = _ref.innerAs,
15
- props = _objectWithoutProperties(_ref, ["persistSelection", "as", "innerAs"]);
15
+ props = _objectWithoutProperties(_ref, _excluded);
16
16
 
17
17
  var _useComboBoxContext = useComboBoxContext(),
18
18
  persistSelectionRef = _useComboBoxContext.persistSelectionRef,
@@ -24,7 +24,7 @@ export var ComboboxList = /*#__PURE__*/forwardRef(function ComboboxList(_ref, re
24
24
  listScope.current = getScope(listRef);
25
25
  }, [listScope]);
26
26
  persistSelectionRef.current = persistSelection;
27
- return /*#__PURE__*/_jsx(Comp, _extends({}, props, {
27
+ return /*#__PURE__*/_jsx(Comp, _extends(_extends({}, props), {}, {
28
28
  as: innerAs,
29
29
  ref: assignMultipleRefs(ref, listRef),
30
30
  "data-reach-combobox-list": "",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxList.tsx"],"names":["forwardRef","useRef","useEffect","React","useComboBoxContext","getScope","assignMultipleRefs","ComboboxList","ref","persistSelection","as","Comp","innerAs","props","persistSelectionRef","labelIdRef","listScope","listRef","current"],"mappings":";;AAAA,SAASA,UAAT,EAAqBC,MAArB,EAA6BC,SAA7B,QAA8C,OAA9C;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AAUA,OAAO,IAAMC,YAAY,gBAAGP,UAAU,CACpC,SAASO,YAAT,OASEC,GATF,EAUE;AAAA,mCANEC,gBAMF;AAAA,MANEA,gBAMF,sCANqB,KAMrB;AAAA,qBALEC,EAKF;AAAA,MALMC,IAKN,wBALa,IAKb;AAAA,MAJEC,OAIF,QAJEA,OAIF;AAAA,MAHKC,KAGL;;AAAA,4BACuDT,kBAAkB,EADzE;AAAA,MACQU,mBADR,uBACQA,mBADR;AAAA,MAC6BC,UAD7B,uBAC6BA,UAD7B;AAAA,MACyCC,SADzC,uBACyCA,SADzC;;AAGA,MAAMC,OAAO,GAAGhB,MAAM,EAAtB;AACAC,EAAAA,SAAS,CAAC,YAAM;AACdc,IAAAA,SAAS,CAACE,OAAV,GAAoBb,QAAQ,CAACY,OAAD,CAA5B;AACD,GAFQ,EAEN,CAACD,SAAD,CAFM,CAAT;AAIAF,EAAAA,mBAAmB,CAACI,OAApB,GAA8BT,gBAA9B;AAEA,sBACE,KAAC,IAAD,eACMI,KADN;AAEE,IAAA,EAAE,EAAED,OAFN;AAGE,IAAA,GAAG,EAAEN,kBAAkB,CAACE,GAAD,EAAMS,OAAN,CAHzB;AAIE,gCAAyB,EAJ3B;AAKE,IAAA,IAAI,EAAC,SALP;AAME,uBAAiBF,UAAU,CAACG;AAN9B,KADF;AAUD,CA/BmC,CAA/B","sourcesContent":["import { forwardRef, useRef, useEffect } from 'react';\nimport * as React from 'react';\n\nimport { useComboBoxContext } from './context';\nimport { getScope } from '../hooks';\nimport { assignMultipleRefs } from '../utils';\n\nexport interface ComboboxListProps\n extends React.HTMLAttributes<HTMLUListElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n persistSelection?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ComboboxList = forwardRef<HTMLUListElement, ComboboxListProps>(\n function ComboboxList(\n {\n // when true, and the list opens again, the option with a matching value will be\n // automatically highleted.\n persistSelection = false,\n as: Comp = 'ul',\n innerAs,\n ...props\n },\n ref\n ) {\n const { persistSelectionRef, labelIdRef, listScope } = useComboBoxContext();\n\n const listRef = useRef<HTMLUListElement>();\n useEffect(() => {\n listScope.current = getScope(listRef);\n }, [listScope]);\n\n persistSelectionRef.current = persistSelection;\n\n return (\n <Comp\n {...props}\n as={innerAs}\n ref={assignMultipleRefs(ref, listRef)}\n data-reach-combobox-list=\"\"\n role=\"listbox\"\n aria-labelledby={labelIdRef.current}\n />\n );\n }\n);\n"],"file":"ComboboxList.js"}
1
+ {"version":3,"file":"ComboboxList.js","names":["forwardRef","useRef","useEffect","useComboBoxContext","getScope","assignMultipleRefs","ComboboxList","ref","persistSelection","as","Comp","innerAs","props","persistSelectionRef","labelIdRef","listScope","listRef","current"],"sources":["../../../src/ComboBox/ComboboxList.tsx"],"sourcesContent":["import type { HTMLAttributes, ElementType, ReactNode } from 'react';\nimport { forwardRef, useRef, useEffect } from 'react';\n\nimport { useComboBoxContext } from './context';\nimport { getScope } from '../hooks';\nimport { assignMultipleRefs } from '../utils';\n\nexport interface ComboboxListProps extends HTMLAttributes<HTMLUListElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n persistSelection?: boolean;\n children?: ReactNode;\n}\n\nexport const ComboboxList = forwardRef<HTMLUListElement, ComboboxListProps>(\n function ComboboxList(\n {\n // when true, and the list opens again, the option with a matching value will be\n // automatically highleted.\n persistSelection = false,\n as: Comp = 'ul',\n innerAs,\n ...props\n },\n ref\n ) {\n const { persistSelectionRef, labelIdRef, listScope } = useComboBoxContext();\n\n const listRef = useRef<HTMLUListElement>();\n useEffect(() => {\n listScope.current = getScope(listRef);\n }, [listScope]);\n\n persistSelectionRef.current = persistSelection;\n\n return (\n <Comp\n {...props}\n as={innerAs}\n ref={assignMultipleRefs(ref, listRef)}\n data-reach-combobox-list=\"\"\n role=\"listbox\"\n aria-labelledby={labelIdRef.current}\n />\n );\n }\n);\n"],"mappings":";;;AACA,SAASA,UAAT,EAAqBC,MAArB,EAA6BC,SAA7B,QAA8C,OAA9C;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AASA,OAAO,IAAMC,YAAY,gBAAGN,UAAU,CACpC,SAASM,YAAT,OASEC,GATF,EAUE;EAAA,iCANEC,gBAMF;EAAA,IANEA,gBAMF,sCANqB,KAMrB;EAAA,mBALEC,EAKF;EAAA,IALMC,IAKN,wBALa,IAKb;EAAA,IAJEC,OAIF,QAJEA,OAIF;EAAA,IAHKC,KAGL;;EACA,0BAAuDT,kBAAkB,EAAzE;EAAA,IAAQU,mBAAR,uBAAQA,mBAAR;EAAA,IAA6BC,UAA7B,uBAA6BA,UAA7B;EAAA,IAAyCC,SAAzC,uBAAyCA,SAAzC;;EAEA,IAAMC,OAAO,GAAGf,MAAM,EAAtB;EACAC,SAAS,CAAC,YAAM;IACda,SAAS,CAACE,OAAV,GAAoBb,QAAQ,CAACY,OAAD,CAA5B;EACD,CAFQ,EAEN,CAACD,SAAD,CAFM,CAAT;EAIAF,mBAAmB,CAACI,OAApB,GAA8BT,gBAA9B;EAEA,oBACE,KAAC,IAAD,wBACMI,KADN;IAEE,EAAE,EAAED,OAFN;IAGE,GAAG,EAAEN,kBAAkB,CAACE,GAAD,EAAMS,OAAN,CAHzB;IAIE,4BAAyB,EAJ3B;IAKE,IAAI,EAAC,SALP;IAME,mBAAiBF,UAAU,CAACG;EAN9B,GADF;AAUD,CA/BmC,CAA/B"}
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
- export interface ComboboxOptionProps extends React.LiHTMLAttributes<HTMLLIElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
1
+ import type { ElementType, LiHTMLAttributes, MouseEventHandler, ReactNode } from 'react';
2
+ export interface ComboboxOptionProps extends LiHTMLAttributes<HTMLLIElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
5
  id: string;
6
6
  value: any;
7
7
  text?: string;
8
- onClick?: React.MouseEventHandler<HTMLLIElement>;
9
- children?: React.ReactNode;
8
+ onClick?: MouseEventHandler<HTMLLIElement>;
9
+ children?: ReactNode;
10
10
  }
11
- export declare const ComboboxOption: React.ForwardRefExoticComponent<ComboboxOptionProps & React.RefAttributes<HTMLLIElement>>;
11
+ export declare const ComboboxOption: import("react").ForwardRefExoticComponent<ComboboxOptionProps & import("react").RefAttributes<HTMLLIElement>>;
@@ -1,11 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "id", "value", "text", "onClick", "as", "innerAs"];
3
4
 
4
5
  /* eslint-disable @typescript-eslint/no-use-before-define */
5
6
  import { forwardRef, useEffect, useRef } from 'react';
6
- import * as React from 'react';
7
7
  import { SELECT_WITH_CLICK, CLEAR_SELECTION } from './hooks';
8
- import { wrapEvent } from '../utils/wrapEvent';
8
+ import { wrapEvent } from '../utils/wrap-event';
9
9
  import { useComboBoxContext } from './context';
10
10
  import { makeHash } from './makeHash';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -18,7 +18,7 @@ export var ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_ref
18
18
  _ref$as = _ref.as,
19
19
  Comp = _ref$as === void 0 ? 'li' : _ref$as,
20
20
  innerAs = _ref.innerAs,
21
- props = _objectWithoutProperties(_ref, ["children", "id", "value", "text", "onClick", "as", "innerAs"]);
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
22
 
23
23
  var _useComboBoxContext = useComboBoxContext(),
24
24
  onSelect = _useComboBoxContext.onSelect,
@@ -73,7 +73,7 @@ export var ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_ref
73
73
  });
74
74
  };
75
75
 
76
- return /*#__PURE__*/_jsx(Comp, _extends({}, props, {
76
+ return /*#__PURE__*/_jsx(Comp, _extends(_extends({}, props), {}, {
77
77
  as: innerAs,
78
78
  "data-reach-combobox-option": "",
79
79
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxOption.tsx"],"names":["forwardRef","useEffect","useRef","React","SELECT_WITH_CLICK","CLEAR_SELECTION","wrapEvent","useComboBoxContext","makeHash","ComboboxOption","ref","children","idProp","id","valueProp","value","textProp","text","onClick","as","Comp","innerAs","props","onSelect","navigationItem","data","transition","optionsRef","transitionCleanupRef","isActiveRef","length","Error","String","opts","current","handleClick","item","undefined"],"mappings":";;;AAAA;AACA,SAASA,UAAT,EAAqBC,SAArB,EAAgCC,MAAhC,QAA8C,OAA9C;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,iBAAT,EAA4BC,eAA5B,QAAmD,SAAnD;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,QAAT,QAAyB,YAAzB;;AAaA,OAAO,IAAMC,cAAc,gBAAGT,UAAU,CACtC,SAASS,cAAT,OAWEC,GAXF,EAYE;AAAA,MAVEC,QAUF,QAVEA,QAUF;AAAA,MATMC,MASN,QATEC,EASF;AAAA,MARSC,SAQT,QAREC,KAQF;AAAA,MAPQC,QAOR,QAPEC,IAOF;AAAA,MANEC,OAMF,QANEA,OAMF;AAAA,qBALEC,EAKF;AAAA,MALMC,IAKN,wBALa,IAKb;AAAA,MAJEC,OAIF,QAJEA,OAIF;AAAA,MAHKC,KAGL;;AAAA,4BAMIf,kBAAkB,EANtB;AAAA,MAEEgB,QAFF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,EAAkC;AAChC;AACA;AACAN,QAAAA,oBAAoB,CAACM,OAArB,CAA6B7B,eAA7B;AACD;AACF,KAND;AAOD,GARQ,EAQN,EARM,CAAT;;AAUA,MAAM8B,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxBZ,IAAAA,QAAQ,IAAIA,QAAQ,CAACN,IAAD,EAAOJ,EAAP,EAAWE,KAAX,CAApB;AACAW,IAAAA,UAAU,CAACtB,iBAAD,EAAoB;AAAEa,MAAAA,IAAI,EAAJA,IAAF;AAAQmB,MAAAA,IAAI,EAAEvB;AAAd,KAApB,CAAV;AACD,GAHD;;AAKA,sBACE,KAAC,IAAD,eACMS,KADN;AAEE,IAAA,EAAE,EAAED,OAFN;AAGE,kCAA2B,EAH7B;AAIE,IAAA,GAAG,EAAEX,GAJP;AAKE,IAAA,EAAE,EAAEG,EALN;AAME,IAAA,IAAI,EAAC,QANP;AAOE,qBAAegB,WAAW,CAACK,OAP7B;AAQE,wBAAkBL,WAAW,CAACK,OAAZ,GAAsB,EAAtB,GAA2BG,SAR/C,CASE;AACA;AACA;AAXF;AAYE,IAAA,QAAQ,EAAC,IAZX;AAaE,IAAA,OAAO,EAAE/B,SAAS,CAACY,OAAD,EAAUiB,WAAV,CAbpB;AAAA,cAeGxB,QAAQ,IAAIM;AAff,KADF;AAmBD,CArFqC,CAAjC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { forwardRef, useEffect, useRef } from 'react';\nimport * as React from 'react';\n\nimport { SELECT_WITH_CLICK, CLEAR_SELECTION } from './hooks';\nimport { wrapEvent } from '../utils/wrapEvent';\nimport { useComboBoxContext } from './context';\nimport { makeHash } from './makeHash';\n\nexport interface ComboboxOptionProps\n extends React.LiHTMLAttributes<HTMLLIElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n id: string;\n value: any;\n text?: string;\n onClick?: React.MouseEventHandler<HTMLLIElement>;\n children?: React.ReactNode;\n}\n\nexport const ComboboxOption = forwardRef<HTMLLIElement, ComboboxOptionProps>(\n function ComboboxOption(\n {\n children,\n id: idProp,\n value: valueProp,\n text: textProp,\n onClick,\n as: Comp = 'li',\n innerAs,\n ...props\n },\n ref\n ) {\n const {\n onSelect,\n data: { navigationItem },\n transition,\n optionsRef,\n } = useComboBoxContext();\n const transitionCleanupRef = useRef(transition);\n const isActiveRef = useRef(false);\n\n const value: any = valueProp;\n let text: string = textProp ? textProp : '';\n\n if (text.length === 0) {\n if (typeof valueProp === 'string' && valueProp.length > 0) {\n text = valueProp;\n } else {\n throw new Error('Missing text for <ComboboxOption />');\n }\n }\n\n const id = String(makeHash(idProp));\n\n useEffect(() => {\n const opts = optionsRef.current;\n opts[id] = { value, text };\n\n return () => {\n delete opts[id];\n };\n }, [optionsRef, id, text, value]);\n\n // Keep updating this ref with the current\n // function pointer for transition, so it can\n // be used by the unmount effect below.\n transitionCleanupRef.current = transition;\n isActiveRef.current = navigationItem === id;\n\n useEffect(() => {\n return () => {\n if (isActiveRef.current === true) {\n // clean up selections if this option is getting\n // unmounted and it was the currently selected item\n transitionCleanupRef.current(CLEAR_SELECTION);\n }\n };\n }, []);\n\n const handleClick = () => {\n onSelect && onSelect(text, id, value);\n transition(SELECT_WITH_CLICK, { text, item: id });\n };\n\n return (\n <Comp\n {...props}\n as={innerAs}\n data-reach-combobox-option=\"\"\n ref={ref}\n id={id}\n role=\"option\"\n aria-selected={isActiveRef.current}\n data-highlighted={isActiveRef.current ? '' : undefined}\n // without this the menu will close from `onBlur`, but with it the\n // element can be `document.activeElement` and then our focus checks in\n // onBlur will work as intended\n tabIndex=\"-1\"\n onClick={wrapEvent(onClick, handleClick)}\n >\n {children || text}\n </Comp>\n );\n }\n);\n"],"file":"ComboboxOption.js"}
1
+ {"version":3,"file":"ComboboxOption.js","names":["forwardRef","useEffect","useRef","SELECT_WITH_CLICK","CLEAR_SELECTION","wrapEvent","useComboBoxContext","makeHash","ComboboxOption","ref","children","idProp","id","valueProp","value","textProp","text","onClick","as","Comp","innerAs","props","onSelect","navigationItem","data","transition","optionsRef","transitionCleanupRef","isActiveRef","length","Error","String","opts","current","handleClick","item","undefined"],"sources":["../../../src/ComboBox/ComboboxOption.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport type {\n ElementType,\n LiHTMLAttributes,\n MouseEventHandler,\n ReactNode,\n} from 'react';\nimport { forwardRef, useEffect, useRef } from 'react';\n\nimport { SELECT_WITH_CLICK, CLEAR_SELECTION } from './hooks';\nimport { wrapEvent } from '../utils/wrap-event';\nimport { useComboBoxContext } from './context';\nimport { makeHash } from './makeHash';\n\nexport interface ComboboxOptionProps extends LiHTMLAttributes<HTMLLIElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n id: string;\n value: any;\n text?: string;\n onClick?: MouseEventHandler<HTMLLIElement>;\n children?: ReactNode;\n}\n\nexport const ComboboxOption = forwardRef<HTMLLIElement, ComboboxOptionProps>(\n function ComboboxOption(\n {\n children,\n id: idProp,\n value: valueProp,\n text: textProp,\n onClick,\n as: Comp = 'li',\n innerAs,\n ...props\n },\n ref\n ) {\n const {\n onSelect,\n data: { navigationItem },\n transition,\n optionsRef,\n } = useComboBoxContext();\n const transitionCleanupRef = useRef(transition);\n const isActiveRef = useRef(false);\n\n const value: any = valueProp;\n let text: string = textProp ? textProp : '';\n\n if (text.length === 0) {\n if (typeof valueProp === 'string' && valueProp.length > 0) {\n text = valueProp;\n } else {\n throw new Error('Missing text for <ComboboxOption />');\n }\n }\n\n const id = String(makeHash(idProp));\n\n useEffect(() => {\n const opts = optionsRef.current;\n opts[id] = { value, text };\n\n return () => {\n delete opts[id];\n };\n }, [optionsRef, id, text, value]);\n\n // Keep updating this ref with the current\n // function pointer for transition, so it can\n // be used by the unmount effect below.\n transitionCleanupRef.current = transition;\n isActiveRef.current = navigationItem === id;\n\n useEffect(() => {\n return () => {\n if (isActiveRef.current === true) {\n // clean up selections if this option is getting\n // unmounted and it was the currently selected item\n transitionCleanupRef.current(CLEAR_SELECTION);\n }\n };\n }, []);\n\n const handleClick = () => {\n onSelect && onSelect(text, id, value);\n transition(SELECT_WITH_CLICK, { text, item: id });\n };\n\n return (\n <Comp\n {...props}\n as={innerAs}\n data-reach-combobox-option=\"\"\n ref={ref}\n id={id}\n role=\"option\"\n aria-selected={isActiveRef.current}\n data-highlighted={isActiveRef.current ? '' : undefined}\n // without this the menu will close from `onBlur`, but with it the\n // element can be `document.activeElement` and then our focus checks in\n // onBlur will work as intended\n tabIndex=\"-1\"\n onClick={wrapEvent(onClick, handleClick)}\n >\n {children || text}\n </Comp>\n );\n }\n);\n"],"mappings":";;;;AAAA;AAOA,SAASA,UAAT,EAAqBC,SAArB,EAAgCC,MAAhC,QAA8C,OAA9C;AAEA,SAASC,iBAAT,EAA4BC,eAA5B,QAAmD,SAAnD;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,QAAT,QAAyB,YAAzB;;AAYA,OAAO,IAAMC,cAAc,gBAAGR,UAAU,CACtC,SAASQ,cAAT,OAWEC,GAXF,EAYE;EAAA,IAVEC,QAUF,QAVEA,QAUF;EAAA,IATMC,MASN,QATEC,EASF;EAAA,IARSC,SAQT,QAREC,KAQF;EAAA,IAPQC,QAOR,QAPEC,IAOF;EAAA,IANEC,OAMF,QANEA,OAMF;EAAA,mBALEC,EAKF;EAAA,IALMC,IAKN,wBALa,IAKb;EAAA,IAJEC,OAIF,QAJEA,OAIF;EAAA,IAHKC,KAGL;;EACA,0BAKIf,kBAAkB,EALtB;EAAA,IACEgB,QADF,uBACEA,QADF;EAAA,IAEUC,cAFV,uBAEEC,IAFF,CAEUD,cAFV;EAAA,IAGEE,UAHF,uBAGEA,UAHF;EAAA,IAIEC,UAJF,uBAIEA,UAJF;;EAMA,IAAMC,oBAAoB,GAAGzB,MAAM,CAACuB,UAAD,CAAnC;EACA,IAAMG,WAAW,GAAG1B,MAAM,CAAC,KAAD,CAA1B;EAEA,IAAMY,KAAU,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d,CAApB,CAAV;EACD,CAHD;;EAKA,oBACE,KAAC,IAAD,wBACMS,KADN;IAEE,EAAE,EAAED,OAFN;IAGE,8BAA2B,EAH7B;IAIE,GAAG,EAAEX,GAJP;IAKE,EAAE,EAAEG,EALN;IAME,IAAI,EAAC,QANP;IAOE,iBAAegB,WAAW,CAACK,OAP7B;IAQE,oBAAkBL,WAAW,CAACK,OAAZ,GAAsB,EAAtB,GAA2BG,SAR/C,CASE;IACA;IACA;IAXF;IAYE,QAAQ,EAAC,IAZX;IAaE,OAAO,EAAE/B,SAAS,CAACY,OAAD,EAAUiB,WAAV,CAbpB;IAAA,UAeGxB,QAAQ,IAAIM;EAff,GADF;AAmBD,CArFqC,CAAjC"}
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
2
- export interface ComboboxPopoverProps extends React.HTMLAttributes<HTMLDivElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
5
- onBlur?: React.FocusEventHandler<HTMLDivElement>;
6
- onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
7
- children?: React.ReactNode;
1
+ import type { ElementType, FocusEventHandler, HTMLAttributes, KeyboardEventHandler, ReactNode } from 'react';
2
+ export interface ComboboxPopoverProps extends HTMLAttributes<HTMLDivElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
+ onBlur?: FocusEventHandler<HTMLDivElement>;
6
+ onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
7
+ children?: ReactNode;
8
8
  }
9
- export declare const ComboboxPopover: React.ForwardRefExoticComponent<ComboboxPopoverProps & React.RefAttributes<HTMLDivElement>>;
9
+ export declare const ComboboxPopover: import("react").ForwardRefExoticComponent<ComboboxPopoverProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,10 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["onKeyDown", "onBlur", "as", "innerAs"];
3
4
  import { forwardRef } from 'react';
4
- import * as React from 'react';
5
5
  import { useKeyDown, useBlur } from './hooks';
6
- import { wrapEvent } from '../utils/wrapEvent';
7
- import { assignMultipleRefs } from '../utils/assignRef';
6
+ import { wrapEvent } from '../utils/wrap-event';
7
+ import { assignMultipleRefs } from '../utils/assign-ref';
8
8
  import { useComboBoxContext } from './context';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  export var ComboboxPopover = /*#__PURE__*/forwardRef(function ComboboxPopover(_ref, forwardedRef) {
@@ -13,7 +13,7 @@ export var ComboboxPopover = /*#__PURE__*/forwardRef(function ComboboxPopover(_r
13
13
  _ref$as = _ref.as,
14
14
  Comp = _ref$as === void 0 ? 'div' : _ref$as,
15
15
  innerAs = _ref.innerAs,
16
- props = _objectWithoutProperties(_ref, ["onKeyDown", "onBlur", "as", "innerAs"]);
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
17
 
18
18
  var _useComboBoxContext = useComboBoxContext(),
19
19
  popoverRef = _useComboBoxContext.popoverRef,
@@ -29,7 +29,7 @@ export var ComboboxPopover = /*#__PURE__*/forwardRef(function ComboboxPopover(_r
29
29
  // whatever).
30
30
 
31
31
  var hidden = !isVisible;
32
- return /*#__PURE__*/_jsx(Comp, _extends({}, props, {
32
+ return /*#__PURE__*/_jsx(Comp, _extends(_extends({}, props), {}, {
33
33
  as: innerAs,
34
34
  "data-reach-combobox-popover": "",
35
35
  ref: assignMultipleRefs(popoverRef, forwardedRef),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxPopover.tsx"],"names":["forwardRef","React","useKeyDown","useBlur","wrapEvent","assignMultipleRefs","useComboBoxContext","ComboboxPopover","forwardedRef","onKeyDown","onBlur","as","Comp","innerAs","props","popoverRef","isVisible","handleKeyDown","handleBlur","hidden"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,SAApC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,kBAAT,QAAmC,WAAnC;;AAWA,OAAO,IAAMC,eAAe,gBAAGP,UAAU,CACvC,SAASO,eAAT,OAUEC,YAVF,EAWE;AAAA,MAREC,SAQF,QAREA,SAQF;AAAA,MAPEC,MAOF,QAPEA,MAOF;AAAA,qBALEC,EAKF;AAAA,MALMC,IAKN,wBALa,KAKb;AAAA,MAJEC,OAIF,QAJEA,OAIF;AAAA,MAHKC,KAGL;;AAAA,4BACkCR,kBAAkB,EADpD;AAAA,MACQS,UADR,uBACQA,UADR;AAAA,MACoBC,SADpB,uBACoBA,SADpB;;AAEA,MAAMC,aAAa,GAAGf,UAAU,EAAhC;AACA,MAAMgB,UAAU,GAAGf,OAAO,EAA1B,CAHA,CAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMgB,MAAM,GAAG,CAACH,SAAhB;AAEA,sBACE,KAAC,IAAD,eACMF,KADN;AAEE,IAAA,EAAE,EAAED,OAFN;AAGE,mCAA4B,EAH9B;AAIE,IAAA,GAAG,EAAER,kBAAkB,CAACU,UAAD,EAAaP,YAAb,CAJzB;AAKE,IAAA,SAAS,EAAEJ,SAAS,CAACK,SAAD,EAAYQ,aAAZ,CALtB;AAME,IAAA,MAAM,EAAEb,SAAS,CAACM,MAAD,EAASQ,UAAT,CANnB;AAOE,IAAA,MAAM,EAAEC,MAPV,CAQE;AACA;AATF;AAUE,IAAA,QAAQ,EAAC;AAVX,KADF;AAcD,CAxCsC,CAAlC","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nimport { useKeyDown, useBlur } from './hooks';\nimport { wrapEvent } from '../utils/wrapEvent';\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport { useComboBoxContext } from './context';\n\nexport interface ComboboxPopoverProps\n extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n onBlur?: React.FocusEventHandler<HTMLDivElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;\n children?: React.ReactNode;\n}\n\nexport const ComboboxPopover = forwardRef<HTMLDivElement, ComboboxPopoverProps>(\n function ComboboxPopover(\n {\n // wrapped events\n onKeyDown,\n onBlur,\n\n as: Comp = 'div',\n innerAs,\n ...props\n },\n forwardedRef\n ) {\n const { popoverRef, isVisible } = useComboBoxContext();\n const handleKeyDown = useKeyDown();\n const handleBlur = useBlur();\n\n // Instead of conditionally rendering the popover we use the `hidden` prop\n // because we don't want to unmount on close (from escape or onSelect). If\n // we unmounted, then we'd lose the optionsRef and the user wouldn't be able\n // to use the arrow keys to pop the list back open. However, the developer\n // can conditionally render the ComboboxPopover if they do want to cause\n // mount/unmount based on the app's own data (like results.length or\n // whatever).\n const hidden = !isVisible;\n\n return (\n <Comp\n {...props}\n as={innerAs}\n data-reach-combobox-popover=\"\"\n ref={assignMultipleRefs(popoverRef, forwardedRef)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n hidden={hidden}\n // Allow the user to click empty space inside the popover without causing\n // to close from useBlur\n tabIndex=\"-1\"\n />\n );\n }\n);\n"],"file":"ComboboxPopover.js"}
1
+ {"version":3,"file":"ComboboxPopover.js","names":["forwardRef","useKeyDown","useBlur","wrapEvent","assignMultipleRefs","useComboBoxContext","ComboboxPopover","forwardedRef","onKeyDown","onBlur","as","Comp","innerAs","props","popoverRef","isVisible","handleKeyDown","handleBlur","hidden"],"sources":["../../../src/ComboBox/ComboboxPopover.tsx"],"sourcesContent":["import type {\n ElementType,\n FocusEventHandler,\n HTMLAttributes,\n KeyboardEventHandler,\n ReactNode,\n} from 'react';\nimport { forwardRef } from 'react';\n\nimport { useKeyDown, useBlur } from './hooks';\nimport { wrapEvent } from '../utils/wrap-event';\nimport { assignMultipleRefs } from '../utils/assign-ref';\nimport { useComboBoxContext } from './context';\n\nexport interface ComboboxPopoverProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n onBlur?: FocusEventHandler<HTMLDivElement>;\n onKeyDown?: KeyboardEventHandler<HTMLDivElement>;\n children?: ReactNode;\n}\n\nexport const ComboboxPopover = forwardRef<HTMLDivElement, ComboboxPopoverProps>(\n function ComboboxPopover(\n {\n // wrapped events\n onKeyDown,\n onBlur,\n\n as: Comp = 'div',\n innerAs,\n ...props\n },\n forwardedRef\n ) {\n const { popoverRef, isVisible } = useComboBoxContext();\n const handleKeyDown = useKeyDown();\n const handleBlur = useBlur();\n\n // Instead of conditionally rendering the popover we use the `hidden` prop\n // because we don't want to unmount on close (from escape or onSelect). If\n // we unmounted, then we'd lose the optionsRef and the user wouldn't be able\n // to use the arrow keys to pop the list back open. However, the developer\n // can conditionally render the ComboboxPopover if they do want to cause\n // mount/unmount based on the app's own data (like results.length or\n // whatever).\n const hidden = !isVisible;\n\n return (\n <Comp\n {...props}\n as={innerAs}\n data-reach-combobox-popover=\"\"\n ref={assignMultipleRefs(popoverRef, forwardedRef)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n hidden={hidden}\n // Allow the user to click empty space inside the popover without causing\n // to close from useBlur\n tabIndex=\"-1\"\n />\n );\n }\n);\n"],"mappings":";;;AAOA,SAASA,UAAT,QAA2B,OAA3B;AAEA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,SAApC;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,kBAAT,QAAmC,qBAAnC;AACA,SAASC,kBAAT,QAAmC,WAAnC;;AAUA,OAAO,IAAMC,eAAe,gBAAGN,UAAU,CACvC,SAASM,eAAT,OAUEC,YAVF,EAWE;EAAA,IAREC,SAQF,QAREA,SAQF;EAAA,IAPEC,MAOF,QAPEA,MAOF;EAAA,mBALEC,EAKF;EAAA,IALMC,IAKN,wBALa,KAKb;EAAA,IAJEC,OAIF,QAJEA,OAIF;EAAA,IAHKC,KAGL;;EACA,0BAAkCR,kBAAkB,EAApD;EAAA,IAAQS,UAAR,uBAAQA,UAAR;EAAA,IAAoBC,SAApB,uBAAoBA,SAApB;;EACA,IAAMC,aAAa,GAAGf,UAAU,EAAhC;EACA,IAAMgB,UAAU,GAAGf,OAAO,EAA1B,CAHA,CAKA;EACA;EACA;EACA;EACA;EACA;EACA;;EACA,IAAMgB,MAAM,GAAG,CAACH,SAAhB;EAEA,oBACE,KAAC,IAAD,wBACMF,KADN;IAEE,EAAE,EAAED,OAFN;IAGE,+BAA4B,EAH9B;IAIE,GAAG,EAAER,kBAAkB,CAACU,UAAD,EAAaP,YAAb,CAJzB;IAKE,SAAS,EAAEJ,SAAS,CAACK,SAAD,EAAYQ,aAAZ,CALtB;IAME,MAAM,EAAEb,SAAS,CAACM,MAAD,EAASQ,UAAT,CANnB;IAOE,MAAM,EAAEC,MAPV,CAQE;IACA;IATF;IAUE,QAAQ,EAAC;EAVX,GADF;AAcD,CAxCsC,CAAlC"}
File without changes
File without changes