@basic-ui/core 0.0.36 → 0.0.39

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 (348) hide show
  1. package/build/cjs/index.js +84 -83
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/Accordion/Accordion.d.ts +1 -1
  4. package/build/esm/Accordion/Accordion.js +23 -17
  5. package/build/esm/Accordion/Accordion.js.map +1 -1
  6. package/build/esm/Accordion/AccordionBody.d.ts +1 -1
  7. package/build/esm/Accordion/AccordionBody.js +24 -15
  8. package/build/esm/Accordion/AccordionBody.js.map +1 -1
  9. package/build/esm/Accordion/AccordionHeader.d.ts +1 -1
  10. package/build/esm/Accordion/AccordionHeader.js +46 -31
  11. package/build/esm/Accordion/AccordionHeader.js.map +1 -1
  12. package/build/esm/Accordion/AccordionItem.d.ts +1 -1
  13. package/build/esm/Accordion/AccordionItem.js +18 -18
  14. package/build/esm/Accordion/AccordionItem.js.map +1 -1
  15. package/build/esm/Accordion/context.d.ts +1 -1
  16. package/build/esm/Accordion/context.js +12 -10
  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 +0 -0
  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 +0 -0
  24. package/build/esm/CheckBox/CheckBox.d.ts +1 -1
  25. package/build/esm/CheckBox/CheckBox.js +20 -12
  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 +0 -0
  30. package/build/esm/ComboBox/Combobox.d.ts +1 -1
  31. package/build/esm/ComboBox/Combobox.js +55 -48
  32. package/build/esm/ComboBox/Combobox.js.map +1 -1
  33. package/build/esm/ComboBox/ComboboxButton.d.ts +1 -1
  34. package/build/esm/ComboBox/ComboboxButton.js +20 -20
  35. package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
  36. package/build/esm/ComboBox/ComboboxInput.d.ts +1 -1
  37. package/build/esm/ComboBox/ComboboxInput.js +53 -50
  38. package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
  39. package/build/esm/ComboBox/ComboboxLabel.d.ts +1 -1
  40. package/build/esm/ComboBox/ComboboxLabel.js +12 -12
  41. package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
  42. package/build/esm/ComboBox/ComboboxList.d.ts +1 -1
  43. package/build/esm/ComboBox/ComboboxList.js +16 -17
  44. package/build/esm/ComboBox/ComboboxList.js.map +1 -1
  45. package/build/esm/ComboBox/ComboboxOption.d.ts +1 -1
  46. package/build/esm/ComboBox/ComboboxOption.js +32 -34
  47. package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
  48. package/build/esm/ComboBox/ComboboxPopover.d.ts +1 -1
  49. package/build/esm/ComboBox/ComboboxPopover.js +16 -17
  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 +0 -0
  54. package/build/esm/ComboBox/context.d.ts +3 -3
  55. package/build/esm/ComboBox/context.js +6 -5
  56. package/build/esm/ComboBox/context.js.map +1 -1
  57. package/build/esm/ComboBox/hooks.d.ts +1 -1
  58. package/build/esm/ComboBox/hooks.js +82 -115
  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 +0 -0
  63. package/build/esm/ComboBox/makeHash.d.ts +0 -0
  64. package/build/esm/ComboBox/makeHash.js +3 -3
  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 +0 -0
  69. package/build/esm/FocusLock/FocusLock.d.ts +1 -1
  70. package/build/esm/FocusLock/FocusLock.js +18 -16
  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 +0 -0
  75. package/build/esm/FocusLock/tabUtils.d.ts +1 -0
  76. package/build/esm/FocusLock/tabUtils.js +14 -2
  77. package/build/esm/FocusLock/tabUtils.js.map +1 -1
  78. package/build/esm/FocusLock/useFocusLock.d.ts +0 -0
  79. package/build/esm/FocusLock/useFocusLock.js +14 -22
  80. package/build/esm/FocusLock/useFocusLock.js.map +1 -1
  81. package/build/esm/List/List.d.ts +1 -1
  82. package/build/esm/List/List.js +6 -6
  83. package/build/esm/List/List.js.map +1 -1
  84. package/build/esm/List/ListItem.d.ts +1 -1
  85. package/build/esm/List/ListItem.js +6 -6
  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 +3 -3
  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 +0 -0
  93. package/build/esm/Menu/Menu.d.ts +1 -1
  94. package/build/esm/Menu/Menu.js +31 -23
  95. package/build/esm/Menu/Menu.js.map +1 -1
  96. package/build/esm/Menu/MenuButton.d.ts +1 -1
  97. package/build/esm/Menu/MenuButton.js +29 -25
  98. package/build/esm/Menu/MenuButton.js.map +1 -1
  99. package/build/esm/Menu/MenuItem.d.ts +1 -1
  100. package/build/esm/Menu/MenuItem.js +26 -27
  101. package/build/esm/Menu/MenuItem.js.map +1 -1
  102. package/build/esm/Menu/MenuList.d.ts +1 -1
  103. package/build/esm/Menu/MenuList.js +62 -45
  104. package/build/esm/Menu/MenuList.js.map +1 -1
  105. package/build/esm/Menu/MenuPopover.d.ts +2 -2
  106. package/build/esm/Menu/MenuPopover.js +9 -10
  107. package/build/esm/Menu/MenuPopover.js.map +1 -1
  108. package/build/esm/Menu/context.d.ts +1 -1
  109. package/build/esm/Menu/context.js +11 -8
  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 +0 -0
  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 +0 -0
  117. package/build/esm/Modal/Modal.d.ts +2 -2
  118. package/build/esm/Modal/Modal.js +14 -12
  119. package/build/esm/Modal/Modal.js.map +1 -1
  120. package/build/esm/Modal/ModalBackdrop.d.ts +1 -1
  121. package/build/esm/Modal/ModalBackdrop.js +21 -19
  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 +0 -0
  126. package/build/esm/Popper/Popper.d.ts +2 -2
  127. package/build/esm/Popper/Popper.js +51 -36
  128. package/build/esm/Popper/Popper.js.map +1 -1
  129. package/build/esm/Popper/PopperArrow.d.ts +1 -1
  130. package/build/esm/Popper/PopperArrow.js +9 -9
  131. package/build/esm/Popper/PopperArrow.js.map +1 -1
  132. package/build/esm/Popper/context.d.ts +1 -1
  133. package/build/esm/Popper/context.js +5 -3
  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 +0 -0
  138. package/build/esm/Portal/Portal.d.ts +1 -1
  139. package/build/esm/Portal/Portal.js +6 -5
  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 +0 -0
  144. package/build/esm/RadioButton/RadioButton.d.ts +2 -2
  145. package/build/esm/RadioButton/RadioButton.js +13 -13
  146. package/build/esm/RadioButton/RadioButton.js.map +1 -1
  147. package/build/esm/RadioButton/RadioGroup.d.ts +2 -2
  148. package/build/esm/RadioButton/RadioGroup.js +25 -18
  149. package/build/esm/RadioButton/RadioGroup.js.map +1 -1
  150. package/build/esm/RadioButton/context.d.ts +0 -0
  151. package/build/esm/RadioButton/context.js +6 -5
  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 +0 -0
  156. package/build/esm/SkipNav/SkipNav.d.ts +1 -1
  157. package/build/esm/SkipNav/SkipNav.js +6 -6
  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 +0 -0
  162. package/build/esm/Spinner/Spinner.d.ts +1 -1
  163. package/build/esm/Spinner/Spinner.js +42 -31
  164. package/build/esm/Spinner/Spinner.js.map +1 -1
  165. package/build/esm/Spinner/SpinnerButton.d.ts +1 -1
  166. package/build/esm/Spinner/SpinnerButton.js +12 -12
  167. package/build/esm/Spinner/SpinnerButton.js.map +1 -1
  168. package/build/esm/Spinner/context.d.ts +0 -0
  169. package/build/esm/Spinner/context.js +6 -5
  170. package/build/esm/Spinner/context.js.map +1 -1
  171. package/build/esm/Spinner/index.d.ts +0 -0
  172. package/build/esm/Spinner/index.js +0 -0
  173. package/build/esm/Spinner/index.js.map +0 -0
  174. package/build/esm/Tabs/Tab.d.ts +1 -1
  175. package/build/esm/Tabs/Tab.js +30 -29
  176. package/build/esm/Tabs/Tab.js.map +1 -1
  177. package/build/esm/Tabs/TabList.d.ts +1 -1
  178. package/build/esm/Tabs/TabList.js +27 -23
  179. package/build/esm/Tabs/TabList.js.map +1 -1
  180. package/build/esm/Tabs/TabPanel.d.ts +1 -1
  181. package/build/esm/Tabs/TabPanel.js +13 -12
  182. package/build/esm/Tabs/TabPanel.js.map +1 -1
  183. package/build/esm/Tabs/TabPanels.d.ts +1 -1
  184. package/build/esm/Tabs/TabPanels.js +14 -12
  185. package/build/esm/Tabs/TabPanels.js.map +1 -1
  186. package/build/esm/Tabs/Tabs.d.ts +1 -1
  187. package/build/esm/Tabs/Tabs.js +28 -14
  188. package/build/esm/Tabs/Tabs.js.map +1 -1
  189. package/build/esm/Tabs/context.d.ts +1 -1
  190. package/build/esm/Tabs/context.js +12 -10
  191. package/build/esm/Tabs/context.js.map +1 -1
  192. package/build/esm/Tabs/index.d.ts +0 -0
  193. package/build/esm/Tabs/index.js +0 -0
  194. package/build/esm/Tabs/index.js.map +0 -0
  195. package/build/esm/Tabs/scopeQuery.d.ts +0 -0
  196. package/build/esm/Tabs/scopeQuery.js +0 -0
  197. package/build/esm/Tabs/scopeQuery.js.map +0 -0
  198. package/build/esm/Tooltip/Tooltip.d.ts +2 -1
  199. package/build/esm/Tooltip/Tooltip.js +17 -15
  200. package/build/esm/Tooltip/Tooltip.js.map +1 -1
  201. package/build/esm/Tooltip/index.d.ts +0 -0
  202. package/build/esm/Tooltip/index.js +0 -0
  203. package/build/esm/Tooltip/index.js.map +0 -0
  204. package/build/esm/Tooltip/stateMachine.d.ts +0 -0
  205. package/build/esm/Tooltip/stateMachine.js +56 -80
  206. package/build/esm/Tooltip/stateMachine.js.map +1 -1
  207. package/build/esm/Tooltip/useTooltip.d.ts +1 -1
  208. package/build/esm/Tooltip/useTooltip.js +32 -31
  209. package/build/esm/Tooltip/useTooltip.js.map +1 -1
  210. package/build/esm/hooks/index.d.ts +0 -1
  211. package/build/esm/hooks/index.js +0 -1
  212. package/build/esm/hooks/index.js.map +1 -1
  213. package/build/esm/hooks/useAutoFocus.d.ts +0 -0
  214. package/build/esm/hooks/useAutoFocus.js +6 -2
  215. package/build/esm/hooks/useAutoFocus.js.map +1 -1
  216. package/build/esm/hooks/useChildrenCounter.d.ts +1 -1
  217. package/build/esm/hooks/useChildrenCounter.js +6 -4
  218. package/build/esm/hooks/useChildrenCounter.js.map +1 -1
  219. package/build/esm/hooks/useControlledState.d.ts +1 -1
  220. package/build/esm/hooks/useControlledState.js +7 -2
  221. package/build/esm/hooks/useControlledState.js.map +1 -1
  222. package/build/esm/hooks/useFocusReturn.d.ts +2 -1
  223. package/build/esm/hooks/useFocusReturn.js +25 -14
  224. package/build/esm/hooks/useFocusReturn.js.map +1 -1
  225. package/build/esm/hooks/useFocusState.d.ts +0 -0
  226. package/build/esm/hooks/useFocusState.js +13 -9
  227. package/build/esm/hooks/useFocusState.js.map +1 -1
  228. package/build/esm/hooks/useGestureHandlers.d.ts +0 -0
  229. package/build/esm/hooks/useGestureHandlers.js +59 -63
  230. package/build/esm/hooks/useGestureHandlers.js.map +1 -1
  231. package/build/esm/hooks/useMeasure.d.ts +0 -0
  232. package/build/esm/hooks/useMeasure.js +13 -7
  233. package/build/esm/hooks/useMeasure.js.map +1 -1
  234. package/build/esm/hooks/useOnClickOutside.d.ts +0 -0
  235. package/build/esm/hooks/useOnClickOutside.js +5 -4
  236. package/build/esm/hooks/useOnClickOutside.js.map +1 -1
  237. package/build/esm/hooks/useOnKeyDown.d.ts +0 -0
  238. package/build/esm/hooks/useOnKeyDown.js +4 -3
  239. package/build/esm/hooks/useOnKeyDown.js.map +1 -1
  240. package/build/esm/hooks/useReducerMachine.d.ts +1 -1
  241. package/build/esm/hooks/useReducerMachine.js +13 -10
  242. package/build/esm/hooks/useReducerMachine.js.map +1 -1
  243. package/build/esm/hooks/useRemoveBodyScroll.d.ts +0 -0
  244. package/build/esm/hooks/useRemoveBodyScroll.js +14 -21
  245. package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
  246. package/build/esm/hooks/useScope.d.ts +1 -1
  247. package/build/esm/hooks/useScope.js +10 -12
  248. package/build/esm/hooks/useScope.js.map +1 -1
  249. package/build/esm/hooks/useThrottle.d.ts +0 -0
  250. package/build/esm/hooks/useThrottle.js +10 -5
  251. package/build/esm/hooks/useThrottle.js.map +1 -1
  252. package/build/esm/index.d.ts +0 -0
  253. package/build/esm/index.js +0 -0
  254. package/build/esm/index.js.map +0 -0
  255. package/build/esm/utils/assignRef.d.ts +1 -1
  256. package/build/esm/utils/assignRef.js +7 -3
  257. package/build/esm/utils/assignRef.js.map +1 -1
  258. package/build/esm/utils/clamp.d.ts +0 -0
  259. package/build/esm/utils/clamp.js +0 -0
  260. package/build/esm/utils/clamp.js.map +0 -0
  261. package/build/esm/utils/createSubscription.d.ts +0 -0
  262. package/build/esm/utils/createSubscription.js +7 -5
  263. package/build/esm/utils/createSubscription.js.map +1 -1
  264. package/build/esm/utils/getCircularIndex.d.ts +0 -0
  265. package/build/esm/utils/getCircularIndex.js +0 -0
  266. package/build/esm/utils/getCircularIndex.js.map +0 -0
  267. package/build/esm/utils/index.d.ts +0 -0
  268. package/build/esm/utils/index.js +0 -0
  269. package/build/esm/utils/index.js.map +0 -0
  270. package/build/esm/utils/rubberBandClamp.d.ts +0 -0
  271. package/build/esm/utils/rubberBandClamp.js +5 -2
  272. package/build/esm/utils/rubberBandClamp.js.map +1 -1
  273. package/build/esm/utils/wrapEvent.d.ts +0 -0
  274. package/build/esm/utils/wrapEvent.js +7 -3
  275. package/build/esm/utils/wrapEvent.js.map +1 -1
  276. package/build/tsconfig.tsbuildinfo +1 -7151
  277. package/package.json +13 -13
  278. package/src/Accordion/Accordion.story.tsx +6 -4
  279. package/src/Accordion/Accordion.tsx +4 -2
  280. package/src/Accordion/AccordionBody.tsx +4 -4
  281. package/src/Accordion/AccordionHeader.tsx +7 -8
  282. package/src/Accordion/AccordionItem.tsx +5 -4
  283. package/src/Accordion/context.ts +2 -1
  284. package/src/CheckBox/CheckBox.tsx +2 -1
  285. package/src/ComboBox/ComboBox.story.tsx +11 -9
  286. package/src/ComboBox/Combobox.tsx +9 -11
  287. package/src/ComboBox/ComboboxButton.tsx +4 -9
  288. package/src/ComboBox/ComboboxInput.tsx +2 -1
  289. package/src/ComboBox/ComboboxLabel.tsx +2 -1
  290. package/src/ComboBox/ComboboxList.tsx +2 -1
  291. package/src/ComboBox/ComboboxOption.tsx +1 -1
  292. package/src/ComboBox/ComboboxPopover.tsx +2 -1
  293. package/src/ComboBox/context.ts +4 -3
  294. package/src/ComboBox/hooks.tsx +6 -9
  295. package/src/FocusLock/FocusLock.tsx +2 -1
  296. package/src/FocusLock/tabUtils.ts +12 -0
  297. package/src/FocusLock/useFocusLock.ts +5 -11
  298. package/src/List/List.story.tsx +5 -4
  299. package/src/List/List.tsx +1 -1
  300. package/src/List/ListItem.tsx +1 -1
  301. package/src/Menu/Menu.story.tsx +15 -13
  302. package/src/Menu/Menu.tsx +5 -4
  303. package/src/Menu/MenuButton.tsx +7 -11
  304. package/src/Menu/MenuItem.tsx +6 -7
  305. package/src/Menu/MenuList.tsx +4 -8
  306. package/src/Menu/MenuPopover.tsx +4 -2
  307. package/src/Menu/context.ts +2 -1
  308. package/src/Modal/Modal.story.tsx +35 -19
  309. package/src/Modal/Modal.tsx +6 -4
  310. package/src/Modal/ModalBackdrop.tsx +2 -1
  311. package/src/Modal/NavDrawer.story.tsx +8 -7
  312. package/src/Popper/Popper.story.tsx +15 -19
  313. package/src/Popper/Popper.tsx +12 -7
  314. package/src/Popper/PopperArrow.tsx +2 -1
  315. package/src/Popper/context.ts +2 -1
  316. package/src/Portal/Portal.tsx +1 -1
  317. package/src/RadioButton/RadioButton.story.tsx +13 -9
  318. package/src/RadioButton/RadioButton.tsx +4 -2
  319. package/src/RadioButton/RadioGroup.tsx +6 -4
  320. package/src/SkipNav/SkipNav.tsx +1 -1
  321. package/src/Spinner/Spinner.story.tsx +6 -5
  322. package/src/Spinner/Spinner.tsx +2 -1
  323. package/src/Spinner/SpinnerButton.tsx +2 -1
  324. package/src/Tabs/Tab.story.tsx +10 -8
  325. package/src/Tabs/Tab.tsx +4 -4
  326. package/src/Tabs/TabList.tsx +11 -3
  327. package/src/Tabs/TabPanel.tsx +2 -1
  328. package/src/Tabs/TabPanels.tsx +1 -1
  329. package/src/Tabs/Tabs.tsx +2 -1
  330. package/src/Tabs/context.ts +2 -1
  331. package/src/Tooltip/Tooltip.story.tsx +8 -6
  332. package/src/Tooltip/Tooltip.tsx +3 -7
  333. package/src/Tooltip/stateMachine.ts +1 -1
  334. package/src/Tooltip/useTooltip.ts +4 -3
  335. package/src/hooks/index.ts +0 -1
  336. package/src/hooks/useAutoFocus.ts +9 -1
  337. package/src/hooks/useChildrenCounter.ts +2 -1
  338. package/src/hooks/useControlledState.ts +3 -1
  339. package/src/hooks/useFocusReturn.ts +33 -13
  340. package/src/hooks/useFocusState.ts +1 -0
  341. package/src/hooks/useReducerMachine.ts +2 -1
  342. package/src/hooks/useRemoveBodyScroll.ts +10 -18
  343. package/src/hooks/useScope.ts +2 -1
  344. package/src/utils/assignRef.ts +1 -1
  345. package/build/esm/hooks/useId.d.ts +0 -3
  346. package/build/esm/hooks/useId.js +0 -16
  347. package/build/esm/hooks/useId.js.map +0 -1
  348. package/src/hooks/useId.ts +0 -18
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/Combobox.tsx"],"names":["forwardRef","useRef","useMemo","stateChart","comboboxReducer","isVisible","INIT","ComboBoxProvider","useReducerMachine","useId","getScope","Combobox","ref","onSelect","openOnFocus","selectOnBlur","children","as","Comp","innerAs","rest","optionsRef","listScope","current","inputRef","popoverRef","buttonRef","autocompletePropRef","persistSelectionRef","clearOnEscapeRef","listboxIdRef","labelIdRef","defaultData","state","initial","text","item","navigationItem","lastActionType","data","transition","context"],"mappings":";;AAAA,SAASA,UAAT,EAAqBC,MAArB,EAA6BC,OAA7B,QAA4C,OAA5C;AAEA,SACEC,UADF,EAEEC,eAFF,EAGEC,SAHF,EAIEC,IAJF,QAMO,SANP;AAOA,SAASC,gBAAT,QAAuD,WAAvD;AACA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AUGW;AAVH;AADF,IADF;AAgBD,CAxH+B,CAA3B","sourcesContent":["import { forwardRef, useRef, useMemo } from 'react';\nimport type * as React from 'react';\nimport {\n stateChart,\n comboboxReducer,\n isVisible,\n INIT,\n ActionTypes,\n} from './hooks';\nimport { ComboBoxProvider, ComboBoxContextProps } from './context';\nimport { useReducerMachine } from '../hooks/useReducerMachine';\nimport { useId, Scope, getScope } from '../hooks';\n\nexport type SelectEventHandler = (\n text: string,\n itemId: string,\n obj: any\n) => void;\n\nexport type ComboboxProps = Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onSelect'\n> & {\n onSelect?: SelectEventHandler;\n openOnFocus?: boolean;\n selectOnBlur?: boolean;\n children?: React.ReactNode;\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n};\n\nexport const Combobox = forwardRef<HTMLDivElement, ComboboxProps>(\n function Combobox(\n {\n // Called whenever the user selects an item from the list\n onSelect,\n\n // opens the list when the input receives focused (but only if there are\n // items in the list)\n openOnFocus = false,\n\n // if set to true, it will select an item after blurring\n selectOnBlur = false,\n\n children,\n as: Comp = 'div',\n innerAs,\n ...rest\n }: ComboboxProps,\n ref\n ) {\n // We store the values of all the ComboboxOptions on this ref. This makes it\n // possible to perform the keyboard navigation from the input on the list. We\n // manipulate this array through context so that we don't have to enforce a\n // parent/child relationship between ComboboxList and ComboboxOption.\n const optionsRef = useRef<{\n [itemId: string]: {\n value: string | unknown;\n text: string;\n };\n }>({});\n\n const listScope: Scope<HTMLElement> = useRef(getScope({ current: null }));\n\n // Need this to focus it\n const inputRef = useRef<HTMLInputElement>(null);\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n // When <ComboboxInput autocomplete={false} /> we don't want cycle back to\n // the user's value while navigating (because it's always the user's value),\n // but we need to know this in useKeyDown which is far away from the prop\n // here, so we do something sneaky and write it to this ref on context so we\n // can use it anywhere else 😛. Another new trick for me and I'm excited\n // about this one too!\n const autocompletePropRef = useRef<boolean>(false);\n\n const persistSelectionRef = useRef<boolean>(false);\n\n const clearOnEscapeRef = useRef<boolean>(false);\n\n const listboxIdRef = useRef<string | undefined>();\n\n const labelIdRef = useRef<string | undefined>();\n\n const defaultData = {\n // initial state\n state: stateChart.initial,\n // the value the user has typed, we derived this also when the developer is\n // controlling the value of ComboboxInput\n text: '',\n // the index the user has typed, we derived this also when the developer is\n // controlling the value of ComboboxInput\n item: '',\n // the hash of the currently navigated item\n navigationItem: '',\n // the last submitted action\n lastActionType: INIT as ActionTypes,\n };\n\n const [state, data, transition] = useReducerMachine(\n stateChart,\n comboboxReducer,\n defaultData\n );\n\n listboxIdRef.current = useId();\n\n labelIdRef.current = useId();\n\n const context = useMemo(\n (): ComboBoxContextProps => ({\n data,\n inputRef,\n popoverRef,\n buttonRef,\n onSelect,\n optionsRef,\n listScope,\n state,\n transition,\n listboxIdRef,\n labelIdRef,\n autocompletePropRef,\n persistSelectionRef,\n clearOnEscapeRef,\n isVisible: isVisible(state),\n openOnFocus,\n selectOnBlur,\n }),\n [data, onSelect, listScope, state, transition, openOnFocus, selectOnBlur]\n );\n\n return (\n <ComboBoxProvider value={context}>\n <Comp\n {...rest}\n as={innerAs}\n data-reach-combobox=\"\"\n ref={ref}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-owns={listboxIdRef.current}\n aria-expanded={context.isVisible}\n >\n {children}\n </Comp>\n </ComboBoxProvider>\n );\n }\n);\n"],"file":"Combobox.js"}
1
+ {"version":3,"sources":["../../../src/ComboBox/Combobox.tsx"],"names":["forwardRef","useRef","useMemo","useId","React","stateChart","comboboxReducer","isVisible","INIT","ComboBoxProvider","useReducerMachine","getScope","Combobox","ref","onSelect","openOnFocus","selectOnBlur","children","as","Comp","innerAs","rest","optionsRef","listScope","current","inputRef","popoverRef","buttonRef","autocompletePropRef","persistSelectionRef","clearOnEscapeRef","listboxIdRef","labelIdRef","defaultData","state","initial","text","item","navigationItem","lastActionType","data","transition","context"],"mappings":";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nB,MAAAA,WAAW,EAAXA,WAhB2B;AAiB3BC,MAAAA,YAAY,EAAZA;AAjB2B,KAA7B;AAAA,GADqB,EAoBrB,CAACwB,IAAD,EAAO1B,QAAP,EAAiBS,SAAjB,EAA4BW,KAA5B,EAAmCO,UAAnC,EAA+C1B,WAA/C,EAA4DC,YAA5D,CApBqB,CAAvB;AAuBA,sBACE,KAAC,gBAAD;AAAkB,IAAA,KAAK,EAAE0B,OAAzB;AAAA,2BACE,KAAC,IAAD,eACMrB,IADN;AAEE,MAAA,EAAE,EAAED,OAFN;AAGE,6BAAoB,EAHtB;AAIE,MAAA,GAAG,EAAEP,GAJP;AAKE,MAAA,IAAI,EAAC,UALP;AAME,uBAAc,SANhB;AAOE,mBAAWkB,YAAY,CAACP,OAP1B;AAQE,uBAAekB,OAAO,CAACnC,SARzB;AAAA,gBAUGU;AAVH;AADF,IADF;AAgBD,CAxH+B,CAA3B","sourcesContent":["import { forwardRef, useRef, useMemo, useId } from 'react';\nimport * as React from 'react';\n\nimport type { ActionTypes } from './hooks';\nimport { stateChart, comboboxReducer, isVisible, INIT } from './hooks';\nimport type { ComboBoxContextProps } from './context';\nimport { ComboBoxProvider } from './context';\nimport { useReducerMachine } from '../hooks/useReducerMachine';\nimport type { Scope } from '../hooks';\nimport { getScope } from '../hooks';\n\nexport type SelectEventHandler = (\n text: string,\n itemId: string,\n obj: any\n) => void;\n\nexport type ComboboxProps = Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onSelect'\n> & {\n onSelect?: SelectEventHandler;\n openOnFocus?: boolean;\n selectOnBlur?: boolean;\n children?: React.ReactNode;\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n};\n\nexport const Combobox = forwardRef<HTMLDivElement, ComboboxProps>(\n function Combobox(\n {\n // Called whenever the user selects an item from the list\n onSelect,\n\n // opens the list when the input receives focused (but only if there are\n // items in the list)\n openOnFocus = false,\n\n // if set to true, it will select an item after blurring\n selectOnBlur = false,\n\n children,\n as: Comp = 'div',\n innerAs,\n ...rest\n }: ComboboxProps,\n ref\n ) {\n // We store the values of all the ComboboxOptions on this ref. This makes it\n // possible to perform the keyboard navigation from the input on the list. We\n // manipulate this array through context so that we don't have to enforce a\n // parent/child relationship between ComboboxList and ComboboxOption.\n const optionsRef = useRef<{\n [itemId: string]: {\n value: string | unknown;\n text: string;\n };\n }>({});\n\n const listScope: Scope<HTMLElement> = useRef(getScope({ current: null }));\n\n // Need this to focus it\n const inputRef = useRef<HTMLInputElement>(null);\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n // When <ComboboxInput autocomplete={false} /> we don't want cycle back to\n // the user's value while navigating (because it's always the user's value),\n // but we need to know this in useKeyDown which is far away from the prop\n // here, so we do something sneaky and write it to this ref on context so we\n // can use it anywhere else 😛. Another new trick for me and I'm excited\n // about this one too!\n const autocompletePropRef = useRef<boolean>(false);\n\n const persistSelectionRef = useRef<boolean>(false);\n\n const clearOnEscapeRef = useRef<boolean>(false);\n\n const listboxIdRef = useRef<string | undefined>();\n\n const labelIdRef = useRef<string | undefined>();\n\n const defaultData = {\n // initial state\n state: stateChart.initial,\n // the value the user has typed, we derived this also when the developer is\n // controlling the value of ComboboxInput\n text: '',\n // the index the user has typed, we derived this also when the developer is\n // controlling the value of ComboboxInput\n item: '',\n // the hash of the currently navigated item\n navigationItem: '',\n // the last submitted action\n lastActionType: INIT as ActionTypes,\n };\n\n const [state, data, transition] = useReducerMachine(\n stateChart,\n comboboxReducer,\n defaultData\n );\n\n listboxIdRef.current = useId();\n\n labelIdRef.current = useId();\n\n const context = useMemo(\n (): ComboBoxContextProps => ({\n data,\n inputRef,\n popoverRef,\n buttonRef,\n onSelect,\n optionsRef,\n listScope,\n state,\n transition,\n listboxIdRef,\n labelIdRef,\n autocompletePropRef,\n persistSelectionRef,\n clearOnEscapeRef,\n isVisible: isVisible(state),\n openOnFocus,\n selectOnBlur,\n }),\n [data, onSelect, listScope, state, transition, openOnFocus, selectOnBlur]\n );\n\n return (\n <ComboBoxProvider value={context}>\n <Comp\n {...rest}\n as={innerAs}\n data-reach-combobox=\"\"\n ref={ref}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-owns={listboxIdRef.current}\n aria-expanded={context.isVisible}\n >\n {children}\n </Comp>\n </ComboBoxProvider>\n );\n }\n);\n"],"file":"Combobox.js"}
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  export interface ComboboxButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
3
  as?: React.ElementType<any>;
4
4
  innerAs?: React.ElementType<any>;
@@ -1,32 +1,32 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef } from 'react';
4
+ import * as React from 'react';
4
5
  import { useComboBoxContext } from './context';
5
6
  import { useKeyDown, IDLE, OPEN_WITH_BUTTON, CLOSE_WITH_BUTTON } from './hooks';
6
7
  import { wrapEvent } from '../utils/wrapEvent';
7
8
  import { assignMultipleRefs } from '../utils/assignRef';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
- export const ComboboxButton = /*#__PURE__*/forwardRef(function ComboboxButton(_ref, ref) {
10
- let {
11
- as: Comp = 'button',
12
- innerAs,
13
- onClick,
14
- onKeyDown
15
- } = _ref,
16
- props = _objectWithoutPropertiesLoose(_ref, ["as", "innerAs", "onClick", "onKeyDown"]);
10
+ export var ComboboxButton = /*#__PURE__*/forwardRef(function ComboboxButton(_ref, ref) {
11
+ var _ref$as = _ref.as,
12
+ Comp = _ref$as === void 0 ? 'button' : _ref$as,
13
+ innerAs = _ref.innerAs,
14
+ onClick = _ref.onClick,
15
+ onKeyDown = _ref.onKeyDown,
16
+ props = _objectWithoutProperties(_ref, ["as", "innerAs", "onClick", "onKeyDown"]);
17
17
 
18
- const {
19
- transition,
20
- data,
21
- state,
22
- buttonRef,
23
- listboxIdRef,
24
- isVisible
25
- } = useComboBoxContext();
26
- const handleKeyDown = useKeyDown();
18
+ var _useComboBoxContext = useComboBoxContext(),
19
+ transition = _useComboBoxContext.transition,
20
+ data = _useComboBoxContext.data,
21
+ state = _useComboBoxContext.state,
22
+ buttonRef = _useComboBoxContext.buttonRef,
23
+ listboxIdRef = _useComboBoxContext.listboxIdRef,
24
+ isVisible = _useComboBoxContext.isVisible;
27
25
 
28
- const handleClick = () => {
29
- const payload = {
26
+ var handleKeyDown = useKeyDown();
27
+
28
+ var handleClick = function handleClick() {
29
+ var payload = {
30
30
  item: data.navigationItem
31
31
  };
32
32
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxButton.tsx"],"names":["forwardRef","useComboBoxContext","useKeyDown","IDLE","OPEN_WITH_BUTTON","CLOSE_WITH_BUTTON","wrapEvent","assignMultipleRefs","ComboboxButton","ref","as","Comp","innerAs","onClick","onKeyDown","props","transition","data","state","buttonRef","listboxIdRef","isVisible","handleKeyDown","handleClick","payload","item","navigationItem","current"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,UAAT,EAAqBC,IAArB,EAA2BC,gBAA3B,EAA6CC,iBAA7C,QAAsE,SAAtE;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,kBAAT,QAAmC,oBAAnC;;AAWA,OAAO,MAAMC,cAAc,gBAAGR,UAAU,CAGtC,SAASQ,cAAT,OAEAC,GAFA,EAGA;AAAA,MAFA;AAAEC,IAAAA,EAAE,EAAEC,IAAI,GAAG,QAAb;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA,OAAhC;AAAyCC,IAAAA;AAAzC,GAEA;AAAA,MAFuDC,KAEvD;;AACA,QAAM;AACJC,IAAAA,UADI;AAEJC,IAAAA,IAFI;AAGJC,IAAAA,KAHI;AAIJC,IAAAA,SAJI;AAKJC,IAAAA,YALI;AAMJC,IAAAA;AANI,MAOFpB,kBAAkB,EAPtB;AASA,QAAMqB,aAAa,GAAGpB,UAAU,EAAhC;;AAEA,QAAMqB,WAAW,GAAG,MAAM;AACxB,UAAMC,OAAO,GAAG;AACdC,MAAAA,IAAI,EAAER,IAAI,CAACS;AADG,KAAhB;;AAIA,QAAIR,KAAK,KAAKf,IAAd,EAAoB;AAClBa,MAAAA,UAAU,CAACZ,gBAAD,EAAmBoB,OAAnB,CAAV;AACD,KAFD,MAEO;AACLR,MAAAA,UAAU,CAACX,iBAAD,EAAoBmB,OAApB,CAAV;AACD;AACF,GAVD;;AAYA,sBACE,KAAC,IAAD;AACE,IAAA,EAAE,EAAEZ,OADN;AAEE,kCAA2B,EAF7B;AAGE,qBAAeQ,YAAY,CAACO,OAH9B;AAIE,qBAAc,SAJhB;AAKE,qBAAeN,SALjB;AAME,IAAA,GAAG,EAAEd,kBAAkB,CAACE,GAAD,EAAMU,SAAN,CANzB;AAOE,IAAA,OAAO,EAAEb,SAAS,CAACO,OAAD,EAAUU,WAAV,CAPpB;AAQE,IAAA,SAAS,EAAEjB,SAAS,CAACQ,SAAD,EAAYQ,aAAZ;AARtB,KASMP,KATN,EADF;AAaD,CA3CuC,CAAjC","sourcesContent":["import { forwardRef } from 'react';\nimport type * as React from 'react';\nimport { useComboBoxContext } from './context';\nimport { useKeyDown, IDLE, OPEN_WITH_BUTTON, CLOSE_WITH_BUTTON } from './hooks';\nimport { wrapEvent } from '../utils/wrapEvent';\nimport { assignMultipleRefs } from '../utils/assignRef';\n\nexport interface ComboboxButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;\n children?: React.ReactNode;\n}\n\nexport const ComboboxButton = forwardRef<\n HTMLButtonElement,\n ComboboxButtonProps\n>(function ComboboxButton(\n { as: Comp = 'button', innerAs, onClick, onKeyDown, ...props },\n ref\n) {\n const {\n transition,\n data,\n state,\n buttonRef,\n listboxIdRef,\n isVisible,\n } = useComboBoxContext();\n\n const handleKeyDown = useKeyDown();\n\n const handleClick = () => {\n const payload = {\n item: data.navigationItem,\n };\n\n if (state === IDLE) {\n transition(OPEN_WITH_BUTTON, payload);\n } else {\n transition(CLOSE_WITH_BUTTON, payload);\n }\n };\n\n return (\n <Comp\n as={innerAs}\n data-reach-combobox-button=\"\"\n aria-controls={listboxIdRef.current}\n aria-haspopup=\"listbox\"\n aria-expanded={isVisible}\n ref={assignMultipleRefs(ref, buttonRef)}\n onClick={wrapEvent(onClick, handleClick)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n {...props}\n />\n );\n});\n"],"file":"ComboboxButton.js"}
1
+ {"version":3,"sources":["../../../src/ComboBox/ComboboxButton.tsx"],"names":["forwardRef","React","useComboBoxContext","useKeyDown","IDLE","OPEN_WITH_BUTTON","CLOSE_WITH_BUTTON","wrapEvent","assignMultipleRefs","ComboboxButton","ref","as","Comp","innerAs","onClick","onKeyDown","props","transition","data","state","buttonRef","listboxIdRef","isVisible","handleKeyDown","handleClick","payload","item","navigationItem","current"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,UAAT,EAAqBC,IAArB,EAA2BC,gBAA3B,EAA6CC,iBAA7C,QAAsE,SAAtE;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,kBAAT,QAAmC,oBAAnC;;AAWA,OAAO,IAAMC,cAAc,gBAAGT,UAAU,CAGtC,SAASS,cAAT,OAEAC,GAFA,EAGA;AAAA,qBAFEC,EAEF;AAAA,MAFMC,IAEN,wBAFa,QAEb;AAAA,MAFuBC,OAEvB,QAFuBA,OAEvB;AAAA,MAFgCC,OAEhC,QAFgCA,OAEhC;AAAA,MAFyCC,SAEzC,QAFyCA,SAEzC;AAAA,MAFuDC,KAEvD;;AAAA,4BAEEd,kBAAkB,EAFpB;AAAA,MACQe,UADR,uBACQA,UADR;AAAA,MACoBC,IADpB,uBACoBA,IADpB;AAAA,MAC0BC,KAD1B,uBAC0BA,KAD1B;AAAA,MACiCC,SADjC,uBACiCA,SADjC;AAAA,MAC4CC,YAD5C,uBAC4CA,YAD5C;AAAA,MAC0DC,SAD1D,uBAC0DA,SAD1D;;AAIA,MAAMC,aAAa,GAAGpB,UAAU,EAAhC;;AAEA,MAAMqB,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxB,QAAMC,OAAO,GAAG;AACdC,MAAAA,IAAI,EAAER,IAAI,CAACS;AADG,KAAhB;;AAIA,QAAIR,KAAK,KAAKf,IAAd,EAAoB;AAClBa,MAAAA,UAAU,CAACZ,gBAAD,EAAmBoB,OAAnB,CAAV;AACD,KAFD,MAEO;AACLR,MAAAA,UAAU,CAACX,iBAAD,EAAoBmB,OAApB,CAAV;AACD;AACF,GAVD;;AAYA,sBACE,KAAC,IAAD;AACE,IAAA,EAAE,EAAEZ,OADN;AAEE,kCAA2B,EAF7B;AAGE,qBAAeQ,YAAY,CAACO,OAH9B;AAIE,qBAAc,SAJhB;AAKE,qBAAeN,SALjB;AAME,IAAA,GAAG,EAAEd,kBAAkB,CAACE,GAAD,EAAMU,SAAN,CANzB;AAOE,IAAA,OAAO,EAAEb,SAAS,CAACO,OAAD,EAAUU,WAAV,CAPpB;AAQE,IAAA,SAAS,EAAEjB,SAAS,CAACQ,SAAD,EAAYQ,aAAZ;AARtB,KASMP,KATN,EADF;AAaD,CArCuC,CAAjC","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nimport { useComboBoxContext } from './context';\nimport { useKeyDown, IDLE, OPEN_WITH_BUTTON, CLOSE_WITH_BUTTON } from './hooks';\nimport { wrapEvent } from '../utils/wrapEvent';\nimport { assignMultipleRefs } from '../utils/assignRef';\n\nexport interface ComboboxButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;\n children?: React.ReactNode;\n}\n\nexport const ComboboxButton = forwardRef<\n HTMLButtonElement,\n ComboboxButtonProps\n>(function ComboboxButton(\n { as: Comp = 'button', innerAs, onClick, onKeyDown, ...props },\n ref\n) {\n const { transition, data, state, buttonRef, listboxIdRef, isVisible } =\n useComboBoxContext();\n\n const handleKeyDown = useKeyDown();\n\n const handleClick = () => {\n const payload = {\n item: data.navigationItem,\n };\n\n if (state === IDLE) {\n transition(OPEN_WITH_BUTTON, payload);\n } else {\n transition(CLOSE_WITH_BUTTON, payload);\n }\n };\n\n return (\n <Comp\n as={innerAs}\n data-reach-combobox-button=\"\"\n aria-controls={listboxIdRef.current}\n aria-haspopup=\"listbox\"\n aria-expanded={isVisible}\n ref={assignMultipleRefs(ref, buttonRef)}\n onClick={wrapEvent(onClick, handleClick)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n {...props}\n />\n );\n});\n"],"file":"ComboboxButton.js"}
@@ -1,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  export interface ComboboxInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
3
  clearOnEscape?: boolean;
4
4
  selectOnClick?: boolean;
@@ -1,54 +1,55 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef, useEffect, useRef } from 'react';
4
+ import * as React from 'react';
4
5
  import { useBlur, CLEAR, CHANGE, useKeyDown, SELECT_WITH_CLICK, FOCUS, NAVIGATING, INIT, useFocusManagement } from './hooks';
5
6
  import { assignMultipleRefs, wrapEvent } from '../utils';
6
7
  import { useComboBoxContext } from './context';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
- export const ComboboxInput = /*#__PURE__*/forwardRef(function ComboboxInput(_ref, forwardedRef) {
9
- let {
10
- as: Comp = 'input',
11
- innerAs,
12
- selectOnClick = false,
13
- autocomplete = true,
14
- clearOnEscape = false,
15
- // wrapped events
16
- onClick,
17
- onChange,
18
- onKeyDown,
19
- onBlur,
20
- onFocus,
21
- id: preferredId,
22
- defaultValue = '',
23
- // might be controlled
24
- value: controlledValue
25
- } = _ref,
26
- props = _objectWithoutPropertiesLoose(_ref, ["as", "innerAs", "selectOnClick", "autocomplete", "clearOnEscape", "onClick", "onChange", "onKeyDown", "onBlur", "onFocus", "id", "defaultValue", "value"]);
9
+ export var ComboboxInput = /*#__PURE__*/forwardRef(function ComboboxInput(_ref, forwardedRef) {
10
+ var _ref$as = _ref.as,
11
+ Comp = _ref$as === void 0 ? 'input' : _ref$as,
12
+ innerAs = _ref.innerAs,
13
+ _ref$selectOnClick = _ref.selectOnClick,
14
+ selectOnClick = _ref$selectOnClick === void 0 ? false : _ref$selectOnClick,
15
+ _ref$autocomplete = _ref.autocomplete,
16
+ autocomplete = _ref$autocomplete === void 0 ? true : _ref$autocomplete,
17
+ _ref$clearOnEscape = _ref.clearOnEscape,
18
+ clearOnEscape = _ref$clearOnEscape === void 0 ? false : _ref$clearOnEscape,
19
+ onClick = _ref.onClick,
20
+ onChange = _ref.onChange,
21
+ onKeyDown = _ref.onKeyDown,
22
+ onBlur = _ref.onBlur,
23
+ onFocus = _ref.onFocus,
24
+ preferredId = _ref.id,
25
+ _ref$defaultValue = _ref.defaultValue,
26
+ defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
27
+ controlledValue = _ref.value,
28
+ props = _objectWithoutProperties(_ref, ["as", "innerAs", "selectOnClick", "autocomplete", "clearOnEscape", "onClick", "onChange", "onKeyDown", "onBlur", "onFocus", "id", "defaultValue", "value"]);
29
+
30
+ var _useComboBoxContext = useComboBoxContext(),
31
+ _useComboBoxContext$d = _useComboBoxContext.data,
32
+ navigationItem = _useComboBoxContext$d.navigationItem,
33
+ text = _useComboBoxContext$d.text,
34
+ lastActionType = _useComboBoxContext$d.lastActionType,
35
+ inputRef = _useComboBoxContext.inputRef,
36
+ state = _useComboBoxContext.state,
37
+ transition = _useComboBoxContext.transition,
38
+ listboxIdRef = _useComboBoxContext.listboxIdRef,
39
+ autocompletePropRef = _useComboBoxContext.autocompletePropRef,
40
+ clearOnEscapeRef = _useComboBoxContext.clearOnEscapeRef,
41
+ openOnFocus = _useComboBoxContext.openOnFocus,
42
+ optionsRef = _useComboBoxContext.optionsRef,
43
+ labelIdRef = _useComboBoxContext.labelIdRef; // Keep focus on the input component
27
44
 
28
- const {
29
- data: {
30
- navigationItem,
31
- text,
32
- lastActionType
33
- },
34
- inputRef,
35
- state,
36
- transition,
37
- listboxIdRef,
38
- autocompletePropRef,
39
- clearOnEscapeRef,
40
- openOnFocus,
41
- optionsRef,
42
- labelIdRef
43
- } = useComboBoxContext(); // Keep focus on the input component
44
45
 
45
46
  useFocusManagement(lastActionType, inputRef); // Keep using the defaultValue until the user started interacting
46
47
 
47
- const hasStartedInteracting = useRef(false); // Because we close the List on blur, we need to track if the blur is
48
+ var hasStartedInteracting = useRef(false); // Because we close the List on blur, we need to track if the blur is
48
49
  // caused by clicking inside the list, and if so, don't close the List.
49
50
 
50
- const selectOnClickRef = useRef(false);
51
- const handleBlur = useBlur(); // Update ref props
51
+ var selectOnClickRef = useRef(false);
52
+ var handleBlur = useBlur(); // Update ref props
52
53
 
53
54
  autocompletePropRef.current = autocomplete;
54
55
  clearOnEscapeRef.current = clearOnEscape;
@@ -56,23 +57,23 @@ export const ComboboxInput = /*#__PURE__*/forwardRef(function ComboboxInput(_ref
56
57
  // types, instead the developer controls it with the normal input onChange
57
58
  // prop
58
59
 
59
- const handleChange = e => {
60
+ var handleChange = function handleChange(e) {
60
61
  // After the user started typing, lets forget the defaultValue
61
62
  hasStartedInteracting.current = true;
62
- const text = e.target.value;
63
+ var text = e.target.value;
63
64
 
64
65
  if (text.trim() === '') {
65
66
  transition(CLEAR);
66
67
  } else {
67
68
  transition(CHANGE, {
68
- text
69
+ text: text
69
70
  });
70
71
  }
71
72
  };
72
73
 
73
- const handleKeyDown = useKeyDown();
74
+ var handleKeyDown = useKeyDown();
74
75
 
75
- const handleFocus = () => {
76
+ var handleFocus = function handleFocus() {
76
77
  if (selectOnClick) {
77
78
  selectOnClickRef.current = true;
78
79
  } // If we select an option with click, useFocusManagement will focus the
@@ -87,22 +88,24 @@ export const ComboboxInput = /*#__PURE__*/forwardRef(function ComboboxInput(_ref
87
88
  }
88
89
  };
89
90
 
90
- const handleClick = () => {
91
+ var handleClick = function handleClick() {
91
92
  if (selectOnClickRef.current) {
92
93
  selectOnClickRef.current = false;
93
94
  inputRef.current && inputRef.current.select();
94
95
  }
95
96
  };
96
97
 
97
- const navigationText = navigationItem !== '' ? optionsRef.current[navigationItem].text : undefined;
98
- const fallbackValue = hasStartedInteracting.current ? '' : defaultValue;
99
- const inputStrings = // When idle, we don't have a navigationText on ArrowUp/Down
98
+ var navigationText = navigationItem !== '' ? optionsRef.current[navigationItem].text : undefined;
99
+ var fallbackValue = hasStartedInteracting.current ? '' : defaultValue;
100
+ var inputStrings = // When idle, we don't have a navigationText on ArrowUp/Down
100
101
  autocomplete && state === NAVIGATING ? [navigationText, controlledValue, text, fallbackValue] : [controlledValue, text, fallbackValue];
101
- const inputValue = inputStrings.find(str => str !== undefined); // If they are controlling the value we still need to do our transitions, so
102
+ var inputValue = inputStrings.find(function (str) {
103
+ return str !== undefined;
104
+ }); // If they are controlling the value we still need to do our transitions, so
102
105
  // we have this derived state to emulate onChange of the input as we receive
103
106
  // new `value`s ...[*]
104
107
 
105
- useEffect(() => {
108
+ useEffect(function () {
106
109
  transition(INIT, {
107
110
  text: inputValue,
108
111
  item: ''
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxInput.tsx"],"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","id","preferredId","defaultValue","value","controlledValue","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;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,MAAMC,aAAa,gBAAGf,UAAU,CACrC,SAASe,aAAT,OAuBEC,YAvBF,EAwBE;AAAA,MAvBA;AACEC,IAAAA,EAAE,EAAEC,IAAI,GAAG,OADb;AAEEC,IAAAA,OAFF;AAGEC,IAAAA,aAAa,GAAG,KAHlB;AAIEC,IAAAA,YAAY,GAAG,IAJjB;AAKEC,IAAAA,aAAa,GAAG,KALlB;AAOE;AACAC,IAAAA,OARF;AASEC,IAAAA,QATF;AAUEC,IAAAA,SAVF;AAWEC,IAAAA,MAXF;AAYEC,IAAAA,OAZF;AAcEC,IAAAA,EAAE,EAAEC,WAdN;AAgBEC,IAAAA,YAAY,GAAG,EAhBjB;AAkBE;AACAC,IAAAA,KAAK,EAAEC;AAnB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T;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 type * as React from 'react';\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,"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,kBA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AS,CAAC,YAAM;AACdwC,IAAAA,UAAU,CAAC9B,IAAD,EAAO;AAAE0B,MAAAA,IAAI,EAAE4B,UAAR;AAAoBP,MAAAA,IAAI,EAAE;AAA1B,KAAP,CAAV,CADc,CAEd;AACD,GAHQ,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,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  export interface ComboboxLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
3
3
  as?: React.ElementType<any>;
4
4
  innerAs?: React.ElementType<any>;
@@ -1,20 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef } from 'react';
4
+ import * as React from 'react';
4
5
  import { useComboBoxContext } from './context';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
- export const ComboboxLabel = /*#__PURE__*/forwardRef(function ComboboxButton(_ref, ref) {
7
- let {
8
- as: Comp = 'label',
9
- innerAs,
10
- id: preferredId
11
- } = _ref,
12
- props = _objectWithoutPropertiesLoose(_ref, ["as", "innerAs", "id"]);
7
+ export var ComboboxLabel = /*#__PURE__*/forwardRef(function ComboboxButton(_ref, ref) {
8
+ var _ref$as = _ref.as,
9
+ Comp = _ref$as === void 0 ? 'label' : _ref$as,
10
+ innerAs = _ref.innerAs,
11
+ preferredId = _ref.id,
12
+ props = _objectWithoutProperties(_ref, ["as", "innerAs", "id"]);
13
+
14
+ var _useComboBoxContext = useComboBoxContext(),
15
+ listboxIdRef = _useComboBoxContext.listboxIdRef,
16
+ labelIdRef = _useComboBoxContext.labelIdRef;
13
17
 
14
- const {
15
- listboxIdRef,
16
- labelIdRef
17
- } = useComboBoxContext();
18
18
  labelIdRef.current = preferredId || labelIdRef.current;
19
19
  return /*#__PURE__*/_jsx(Comp, _extends({
20
20
  as: innerAs,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxLabel.tsx"],"names":["forwardRef","useComboBoxContext","ComboboxLabel","ComboboxButton","ref","as","Comp","innerAs","id","preferredId","props","listboxIdRef","labelIdRef","current"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AAEA,SAASC,kBAAT,QAAmC,WAAnC;;AASA,OAAO,MAAMC,aAAa,gBAAGF,UAAU,CACrC,SAASG,cAAT,OAEEC,GAFF,EAGE;AAAA,MAFA;AAAEC,IAAAA,EAAE,EAAEC,IAAI,GAAG,OAAb;AAAsBC,IAAAA,OAAtB;AAA+BC,IAAAA,EAAE,EAAEC;AAAnC,GAEA;AAAA,MAFmDC,KAEnD;;AACA,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+BX,kBAAkB,EAAvD;AAEAW,EAAAA,UAAU,CAACC,OAAX,GAAqBJ,WAAW,IAAIG,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 type * as React from 'react';\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,"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,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  export interface ComboboxListProps extends React.HTMLAttributes<HTMLUListElement> {
3
3
  as?: React.ElementType<any>;
4
4
  innerAs?: React.ElementType<any>;
@@ -1,27 +1,26 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef, useRef, useEffect } from 'react';
4
+ import * as React from 'react';
4
5
  import { useComboBoxContext } from './context';
5
6
  import { getScope } from '../hooks';
6
7
  import { assignMultipleRefs } from '../utils';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
- export const ComboboxList = /*#__PURE__*/forwardRef(function ComboboxList(_ref, ref) {
9
- let {
10
- // when true, and the list opens again, the option with a matching value will be
11
- // automatically highleted.
12
- persistSelection = false,
13
- as: Comp = 'ul',
14
- innerAs
15
- } = _ref,
16
- props = _objectWithoutPropertiesLoose(_ref, ["persistSelection", "as", "innerAs"]);
9
+ export var ComboboxList = /*#__PURE__*/forwardRef(function ComboboxList(_ref, ref) {
10
+ var _ref$persistSelection = _ref.persistSelection,
11
+ persistSelection = _ref$persistSelection === void 0 ? false : _ref$persistSelection,
12
+ _ref$as = _ref.as,
13
+ Comp = _ref$as === void 0 ? 'ul' : _ref$as,
14
+ innerAs = _ref.innerAs,
15
+ props = _objectWithoutProperties(_ref, ["persistSelection", "as", "innerAs"]);
17
16
 
18
- const {
19
- persistSelectionRef,
20
- labelIdRef,
21
- listScope
22
- } = useComboBoxContext();
23
- const listRef = useRef();
24
- useEffect(() => {
17
+ var _useComboBoxContext = useComboBoxContext(),
18
+ persistSelectionRef = _useComboBoxContext.persistSelectionRef,
19
+ labelIdRef = _useComboBoxContext.labelIdRef,
20
+ listScope = _useComboBoxContext.listScope;
21
+
22
+ var listRef = useRef();
23
+ useEffect(function () {
25
24
  listScope.current = getScope(listRef);
26
25
  }, [listScope]);
27
26
  persistSelectionRef.current = persistSelection;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ComboBox/ComboboxList.tsx"],"names":["forwardRef","useRef","useEffect","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;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AAUA,OAAO,MAAMC,YAAY,gBAAGN,UAAU,CACpC,SAASM,YAAT,OASEC,GATF,EAUE;AAAA,MATA;AACE;AACA;AACAC,IAAAA,gBAAgB,GAAG,KAHrB;AAIEC,IAAAA,EAAE,EAAEC,IAAI,GAAG,IAJb;AAKEC,IAAAA;AALF,GASA;AAAA,MAHKC,KAGL;;AACA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA,UAAvB;AAAmCC,IAAAA;AAAnC,MAAiDZ,kBAAkB,EAAzE;AAEA,QAAMa,OAAO,GAAGf,MAAM,EAAtB;AACAC,EAAAA,SAAS,CAAC,MAAM;AACda,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 type * as React from 'react';\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,"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,4 +1,4 @@
1
- import type * as React from 'react';
1
+ import * as React from 'react';
2
2
  export interface ComboboxOptionProps extends React.LiHTMLAttributes<HTMLLIElement> {
3
3
  as?: React.ElementType<any>;
4
4
  innerAs?: React.ElementType<any>;
@@ -1,37 +1,35 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
 
4
4
  /* eslint-disable @typescript-eslint/no-use-before-define */
5
5
  import { forwardRef, useEffect, useRef } from 'react';
6
+ import * as React from 'react';
6
7
  import { SELECT_WITH_CLICK, CLEAR_SELECTION } from './hooks';
7
8
  import { wrapEvent } from '../utils/wrapEvent';
8
9
  import { useComboBoxContext } from './context';
9
10
  import { makeHash } from './makeHash';
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
- export const ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_ref, ref) {
12
- let {
13
- children,
14
- id: idProp,
15
- value: valueProp,
16
- text: textProp,
17
- onClick,
18
- as: Comp = 'li',
19
- innerAs
20
- } = _ref,
21
- props = _objectWithoutPropertiesLoose(_ref, ["children", "id", "value", "text", "onClick", "as", "innerAs"]);
12
+ export var ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_ref, ref) {
13
+ var children = _ref.children,
14
+ idProp = _ref.id,
15
+ valueProp = _ref.value,
16
+ textProp = _ref.text,
17
+ onClick = _ref.onClick,
18
+ _ref$as = _ref.as,
19
+ Comp = _ref$as === void 0 ? 'li' : _ref$as,
20
+ innerAs = _ref.innerAs,
21
+ props = _objectWithoutProperties(_ref, ["children", "id", "value", "text", "onClick", "as", "innerAs"]);
22
22
 
23
- const {
24
- onSelect,
25
- data: {
26
- navigationItem
27
- },
28
- transition,
29
- optionsRef
30
- } = useComboBoxContext();
31
- const transitionCleanupRef = useRef(transition);
32
- const isActiveRef = useRef(false);
33
- const value = valueProp;
34
- let text = textProp ? textProp : '';
23
+ var _useComboBoxContext = useComboBoxContext(),
24
+ onSelect = _useComboBoxContext.onSelect,
25
+ navigationItem = _useComboBoxContext.data.navigationItem,
26
+ transition = _useComboBoxContext.transition,
27
+ optionsRef = _useComboBoxContext.optionsRef;
28
+
29
+ var transitionCleanupRef = useRef(transition);
30
+ var isActiveRef = useRef(false);
31
+ var value = valueProp;
32
+ var text = textProp ? textProp : '';
35
33
 
36
34
  if (text.length === 0) {
37
35
  if (typeof valueProp === 'string' && valueProp.length > 0) {
@@ -41,14 +39,14 @@ export const ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_r
41
39
  }
42
40
  }
43
41
 
44
- const id = String(makeHash(idProp));
45
- useEffect(() => {
46
- const opts = optionsRef.current;
42
+ var id = String(makeHash(idProp));
43
+ useEffect(function () {
44
+ var opts = optionsRef.current;
47
45
  opts[id] = {
48
- value,
49
- text
46
+ value: value,
47
+ text: text
50
48
  };
51
- return () => {
49
+ return function () {
52
50
  delete opts[id];
53
51
  };
54
52
  }, [optionsRef, id, text, value]); // Keep updating this ref with the current
@@ -57,8 +55,8 @@ export const ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_r
57
55
 
58
56
  transitionCleanupRef.current = transition;
59
57
  isActiveRef.current = navigationItem === id;
60
- useEffect(() => {
61
- return () => {
58
+ useEffect(function () {
59
+ return function () {
62
60
  if (isActiveRef.current === true) {
63
61
  // clean up selections if this option is getting
64
62
  // unmounted and it was the currently selected item
@@ -67,10 +65,10 @@ export const ComboboxOption = /*#__PURE__*/forwardRef(function ComboboxOption(_r
67
65
  };
68
66
  }, []);
69
67
 
70
- const handleClick = () => {
68
+ var handleClick = function handleClick() {
71
69
  onSelect && onSelect(text, id, value);
72
70
  transition(SELECT_WITH_CLICK, {
73
- text,
71
+ text: text,
74
72
  item: id
75
73
  });
76
74
  };