@basic-ui/core 0.0.54 → 0.0.57

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 (410) hide show
  1. package/README.md +3 -3
  2. package/build/cjs/index.js +364 -591
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/esm/Accordion/Accordion.d.ts +9 -9
  5. package/build/esm/Accordion/Accordion.js +20 -29
  6. package/build/esm/Accordion/Accordion.js.map +1 -1
  7. package/build/esm/Accordion/AccordionBody.d.ts +6 -6
  8. package/build/esm/Accordion/AccordionBody.js +18 -32
  9. package/build/esm/Accordion/AccordionBody.js.map +1 -1
  10. package/build/esm/Accordion/AccordionHeader.d.ts +7 -7
  11. package/build/esm/Accordion/AccordionHeader.js +37 -74
  12. package/build/esm/Accordion/AccordionHeader.js.map +1 -1
  13. package/build/esm/Accordion/AccordionItem.d.ts +9 -9
  14. package/build/esm/Accordion/AccordionItem.js +19 -22
  15. package/build/esm/Accordion/AccordionItem.js.map +1 -1
  16. package/build/esm/Accordion/context.d.ts +19 -19
  17. package/build/esm/Accordion/context.js +16 -13
  18. package/build/esm/Accordion/context.js.map +1 -1
  19. package/build/esm/Accordion/index.d.ts +4 -4
  20. package/build/esm/Accordion/index.js.map +1 -1
  21. package/build/esm/Accordion/scopeQuery.d.ts +2 -2
  22. package/build/esm/Accordion/scopeQuery.js.map +1 -1
  23. package/build/esm/CheckBox/CheckBox.d.ts +7 -7
  24. package/build/esm/CheckBox/CheckBox.js +15 -25
  25. package/build/esm/CheckBox/CheckBox.js.map +1 -1
  26. package/build/esm/CheckBox/index.d.ts +1 -1
  27. package/build/esm/CheckBox/index.js.map +1 -1
  28. package/build/esm/ComboBox/Combobox.d.ts +18 -18
  29. package/build/esm/ComboBox/Combobox.js +52 -59
  30. package/build/esm/ComboBox/Combobox.js.map +1 -1
  31. package/build/esm/ComboBox/ComboboxButton.d.ts +9 -9
  32. package/build/esm/ComboBox/ComboboxButton.js +23 -28
  33. package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
  34. package/build/esm/ComboBox/ComboboxInput.d.ts +17 -17
  35. package/build/esm/ComboBox/ComboboxInput.js +67 -70
  36. package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
  37. package/build/esm/ComboBox/ComboboxLabel.d.ts +7 -7
  38. package/build/esm/ComboBox/ComboboxLabel.js +15 -17
  39. package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
  40. package/build/esm/ComboBox/ComboboxList.d.ts +8 -8
  41. package/build/esm/ComboBox/ComboboxList.js +19 -20
  42. package/build/esm/ComboBox/ComboboxList.js.map +1 -1
  43. package/build/esm/ComboBox/ComboboxOption.d.ts +11 -11
  44. package/build/esm/ComboBox/ComboboxOption.js +41 -45
  45. package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
  46. package/build/esm/ComboBox/ComboboxPopover.d.ts +9 -9
  47. package/build/esm/ComboBox/ComboboxPopover.js +22 -21
  48. package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
  49. package/build/esm/ComboBox/cities.d.ts +5 -5
  50. package/build/esm/ComboBox/cities.js.map +1 -1
  51. package/build/esm/ComboBox/context.d.ts +30 -30
  52. package/build/esm/ComboBox/context.js +5 -6
  53. package/build/esm/ComboBox/context.js.map +1 -1
  54. package/build/esm/ComboBox/hooks.d.ts +37 -37
  55. package/build/esm/ComboBox/hooks.js +175 -148
  56. package/build/esm/ComboBox/hooks.js.map +1 -1
  57. package/build/esm/ComboBox/index.d.ts +8 -8
  58. package/build/esm/ComboBox/index.js.map +1 -1
  59. package/build/esm/ComboBox/makeHash.d.ts +1 -1
  60. package/build/esm/ComboBox/makeHash.js +3 -6
  61. package/build/esm/ComboBox/makeHash.js.map +1 -1
  62. package/build/esm/ComboBox/scopeQuery.d.ts +1 -1
  63. package/build/esm/ComboBox/scopeQuery.js.map +1 -1
  64. package/build/esm/FocusLock/FocusLock.d.ts +9 -9
  65. package/build/esm/FocusLock/FocusLock.js +26 -32
  66. package/build/esm/FocusLock/FocusLock.js.map +1 -1
  67. package/build/esm/FocusLock/index.d.ts +1 -1
  68. package/build/esm/FocusLock/index.js.map +1 -1
  69. package/build/esm/FocusLock/tabUtils.d.ts +3 -3
  70. package/build/esm/FocusLock/tabUtils.js +5 -7
  71. package/build/esm/FocusLock/tabUtils.js.map +1 -1
  72. package/build/esm/FocusLock/useFocusLock.d.ts +7 -7
  73. package/build/esm/FocusLock/useFocusLock.js +14 -19
  74. package/build/esm/FocusLock/useFocusLock.js.map +1 -1
  75. package/build/esm/List/List.d.ts +7 -7
  76. package/build/esm/List/List.js +9 -11
  77. package/build/esm/List/List.js.map +1 -1
  78. package/build/esm/List/ListItem.d.ts +7 -7
  79. package/build/esm/List/ListItem.js +9 -11
  80. package/build/esm/List/ListItem.js.map +1 -1
  81. package/build/esm/List/context.d.ts +4 -4
  82. package/build/esm/List/context.js +6 -6
  83. package/build/esm/List/context.js.map +1 -1
  84. package/build/esm/List/index.d.ts +2 -2
  85. package/build/esm/List/index.js.map +1 -1
  86. package/build/esm/Menu/ContextMenuTrigger.d.ts +11 -11
  87. package/build/esm/Menu/ContextMenuTrigger.js +32 -37
  88. package/build/esm/Menu/ContextMenuTrigger.js.map +1 -1
  89. package/build/esm/Menu/Menu.d.ts +10 -10
  90. package/build/esm/Menu/Menu.js +33 -49
  91. package/build/esm/Menu/Menu.js.map +1 -1
  92. package/build/esm/Menu/MenuButton.d.ts +11 -11
  93. package/build/esm/Menu/MenuButton.js +28 -44
  94. package/build/esm/Menu/MenuButton.js.map +1 -1
  95. package/build/esm/Menu/MenuItem.d.ts +8 -8
  96. package/build/esm/Menu/MenuItem.js +29 -38
  97. package/build/esm/Menu/MenuItem.js.map +1 -1
  98. package/build/esm/Menu/MenuList.d.ts +7 -7
  99. package/build/esm/Menu/MenuList.js +61 -116
  100. package/build/esm/Menu/MenuList.js.map +1 -1
  101. package/build/esm/Menu/MenuPopover.d.ts +8 -8
  102. package/build/esm/Menu/MenuPopover.js +16 -19
  103. package/build/esm/Menu/MenuPopover.js.map +1 -1
  104. package/build/esm/Menu/context.d.ts +25 -25
  105. package/build/esm/Menu/context.js +14 -12
  106. package/build/esm/Menu/context.js.map +1 -1
  107. package/build/esm/Menu/fixtures/countryList.d.ts +1 -1
  108. package/build/esm/Menu/fixtures/countryList.js +1 -1
  109. package/build/esm/Menu/fixtures/countryList.js.map +1 -1
  110. package/build/esm/Menu/index.d.ts +6 -6
  111. package/build/esm/Menu/index.js.map +1 -1
  112. package/build/esm/Menu/scope.d.ts +1 -1
  113. package/build/esm/Menu/scope.js.map +1 -1
  114. package/build/esm/Modal/Modal.d.ts +9 -9
  115. package/build/esm/Modal/Modal.js +13 -18
  116. package/build/esm/Modal/Modal.js.map +1 -1
  117. package/build/esm/Modal/ModalBackdrop.d.ts +10 -10
  118. package/build/esm/Modal/ModalBackdrop.js +24 -33
  119. package/build/esm/Modal/ModalBackdrop.js.map +1 -1
  120. package/build/esm/Modal/index.d.ts +2 -2
  121. package/build/esm/Modal/index.js.map +1 -1
  122. package/build/esm/Popper/Popper.d.ts +35 -35
  123. package/build/esm/Popper/Popper.js +44 -60
  124. package/build/esm/Popper/Popper.js.map +1 -1
  125. package/build/esm/Popper/PopperArrow.d.ts +6 -6
  126. package/build/esm/Popper/PopperArrow.js +11 -16
  127. package/build/esm/Popper/PopperArrow.js.map +1 -1
  128. package/build/esm/Popper/context.d.ts +6 -6
  129. package/build/esm/Popper/context.js +3 -5
  130. package/build/esm/Popper/context.js.map +1 -1
  131. package/build/esm/Popper/index.d.ts +3 -3
  132. package/build/esm/Popper/index.js.map +1 -1
  133. package/build/esm/Portal/Portal.d.ts +7 -7
  134. package/build/esm/Portal/Portal.js +9 -11
  135. package/build/esm/Portal/Portal.js.map +1 -1
  136. package/build/esm/Portal/PortalSelectorProvider.d.ts +8 -8
  137. package/build/esm/Portal/PortalSelectorProvider.js +6 -4
  138. package/build/esm/Portal/PortalSelectorProvider.js.map +1 -1
  139. package/build/esm/Portal/index.d.ts +2 -2
  140. package/build/esm/Portal/index.js.map +1 -1
  141. package/build/esm/RadioButton/RadioButton.d.ts +10 -10
  142. package/build/esm/RadioButton/RadioButton.js +17 -23
  143. package/build/esm/RadioButton/RadioButton.js.map +1 -1
  144. package/build/esm/RadioButton/RadioGroup.d.ts +12 -12
  145. package/build/esm/RadioButton/RadioGroup.js +19 -28
  146. package/build/esm/RadioButton/RadioGroup.js.map +1 -1
  147. package/build/esm/RadioButton/context.d.ts +9 -9
  148. package/build/esm/RadioButton/context.js +8 -6
  149. package/build/esm/RadioButton/context.js.map +1 -1
  150. package/build/esm/RadioButton/index.d.ts +2 -2
  151. package/build/esm/RadioButton/index.js.map +1 -1
  152. package/build/esm/SkipNav/SkipNav.d.ts +7 -7
  153. package/build/esm/SkipNav/SkipNav.js +9 -11
  154. package/build/esm/SkipNav/SkipNav.js.map +1 -1
  155. package/build/esm/SkipNav/index.d.ts +1 -1
  156. package/build/esm/SkipNav/index.js.map +1 -1
  157. package/build/esm/Slider/Slider.d.ts +197 -197
  158. package/build/esm/Slider/Slider.js +422 -489
  159. package/build/esm/Slider/Slider.js.map +1 -1
  160. package/build/esm/Slider/index.d.ts +1 -1
  161. package/build/esm/Slider/index.js.map +1 -1
  162. package/build/esm/Spinner/Spinner.d.ts +12 -12
  163. package/build/esm/Spinner/Spinner.js +31 -59
  164. package/build/esm/Spinner/Spinner.js.map +1 -1
  165. package/build/esm/Spinner/SpinnerButton.d.ts +8 -8
  166. package/build/esm/Spinner/SpinnerButton.js +14 -19
  167. package/build/esm/Spinner/SpinnerButton.js.map +1 -1
  168. package/build/esm/Spinner/context.d.ts +12 -12
  169. package/build/esm/Spinner/context.js +8 -7
  170. package/build/esm/Spinner/context.js.map +1 -1
  171. package/build/esm/Spinner/index.d.ts +2 -2
  172. package/build/esm/Spinner/index.js.map +1 -1
  173. package/build/esm/Tabs/Tab.d.ts +7 -7
  174. package/build/esm/Tabs/Tab.js +32 -50
  175. package/build/esm/Tabs/Tab.js.map +1 -1
  176. package/build/esm/Tabs/TabList.d.ts +9 -9
  177. package/build/esm/Tabs/TabList.js +24 -34
  178. package/build/esm/Tabs/TabList.js.map +1 -1
  179. package/build/esm/Tabs/TabPanel.d.ts +8 -8
  180. package/build/esm/Tabs/TabPanel.js +16 -23
  181. package/build/esm/Tabs/TabPanel.js.map +1 -1
  182. package/build/esm/Tabs/TabPanels.d.ts +8 -8
  183. package/build/esm/Tabs/TabPanels.js +15 -20
  184. package/build/esm/Tabs/TabPanels.js.map +1 -1
  185. package/build/esm/Tabs/Tabs.d.ts +10 -10
  186. package/build/esm/Tabs/Tabs.js +17 -33
  187. package/build/esm/Tabs/Tabs.js.map +1 -1
  188. package/build/esm/Tabs/context.d.ts +17 -17
  189. package/build/esm/Tabs/context.js +16 -13
  190. package/build/esm/Tabs/context.js.map +1 -1
  191. package/build/esm/Tabs/index.d.ts +5 -5
  192. package/build/esm/Tabs/index.js.map +1 -1
  193. package/build/esm/Tabs/scopeQuery.d.ts +1 -1
  194. package/build/esm/Tabs/scopeQuery.js.map +1 -1
  195. package/build/esm/Tooltip/Tooltip.d.ts +10 -10
  196. package/build/esm/Tooltip/Tooltip.js +20 -30
  197. package/build/esm/Tooltip/Tooltip.js.map +1 -1
  198. package/build/esm/Tooltip/index.d.ts +1 -1
  199. package/build/esm/Tooltip/index.js.map +1 -1
  200. package/build/esm/Tooltip/stateMachine.d.ts +28 -28
  201. package/build/esm/Tooltip/stateMachine.js +95 -81
  202. package/build/esm/Tooltip/stateMachine.js.map +1 -1
  203. package/build/esm/Tooltip/useTooltip.d.ts +10 -10
  204. package/build/esm/Tooltip/useTooltip.js +38 -50
  205. package/build/esm/Tooltip/useTooltip.js.map +1 -1
  206. package/build/esm/hooks/index.d.ts +13 -13
  207. package/build/esm/hooks/index.js.map +1 -1
  208. package/build/esm/hooks/useAutoFocus.d.ts +2 -2
  209. package/build/esm/hooks/useAutoFocus.js +3 -3
  210. package/build/esm/hooks/useAutoFocus.js.map +1 -1
  211. package/build/esm/hooks/useChildrenCounter.d.ts +7 -7
  212. package/build/esm/hooks/useChildrenCounter.js +6 -8
  213. package/build/esm/hooks/useChildrenCounter.js.map +1 -1
  214. package/build/esm/hooks/useControlledState.d.ts +3 -3
  215. package/build/esm/hooks/useControlledState.js +6 -16
  216. package/build/esm/hooks/useControlledState.js.map +1 -1
  217. package/build/esm/hooks/useFocusReturn.d.ts +2 -2
  218. package/build/esm/hooks/useFocusReturn.js +8 -12
  219. package/build/esm/hooks/useFocusReturn.js.map +1 -1
  220. package/build/esm/hooks/useFocusState.d.ts +11 -11
  221. package/build/esm/hooks/useFocusState.js +9 -15
  222. package/build/esm/hooks/useFocusState.js.map +1 -1
  223. package/build/esm/hooks/useGestureHandlers.d.ts +52 -52
  224. package/build/esm/hooks/useGestureHandlers.js +80 -100
  225. package/build/esm/hooks/useGestureHandlers.js.map +1 -1
  226. package/build/esm/hooks/useMeasure.d.ts +7 -7
  227. package/build/esm/hooks/useMeasure.js +7 -15
  228. package/build/esm/hooks/useMeasure.js.map +1 -1
  229. package/build/esm/hooks/useOnClickOutside.d.ts +2 -2
  230. package/build/esm/hooks/useOnClickOutside.js +4 -6
  231. package/build/esm/hooks/useOnClickOutside.js.map +1 -1
  232. package/build/esm/hooks/useOnKeyDown.d.ts +1 -1
  233. package/build/esm/hooks/useOnKeyDown.js +3 -4
  234. package/build/esm/hooks/useOnKeyDown.js.map +1 -1
  235. package/build/esm/hooks/useReducerMachine.d.ts +24 -24
  236. package/build/esm/hooks/useReducerMachine.js +15 -26
  237. package/build/esm/hooks/useReducerMachine.js.map +1 -1
  238. package/build/esm/hooks/useRemoveBodyScroll.d.ts +2 -2
  239. package/build/esm/hooks/useRemoveBodyScroll.js +9 -14
  240. package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
  241. package/build/esm/hooks/useScope.d.ts +11 -11
  242. package/build/esm/hooks/useScope.js +12 -14
  243. package/build/esm/hooks/useScope.js.map +1 -1
  244. package/build/esm/hooks/useThrottle.d.ts +1 -1
  245. package/build/esm/hooks/useThrottle.js +5 -10
  246. package/build/esm/hooks/useThrottle.js.map +1 -1
  247. package/build/esm/index.d.ts +15 -15
  248. package/build/esm/index.js +4 -2
  249. package/build/esm/index.js.map +1 -1
  250. package/build/esm/styles.d.js +2 -0
  251. package/build/esm/styles.d.js.map +1 -0
  252. package/build/esm/utils/assign-ref.d.ts +3 -3
  253. package/build/esm/utils/assign-ref.js +3 -5
  254. package/build/esm/utils/assign-ref.js.map +1 -1
  255. package/build/esm/utils/can-use-dom.d.ts +1 -1
  256. package/build/esm/utils/can-use-dom.js.map +1 -1
  257. package/build/esm/utils/clamp.d.ts +1 -1
  258. package/build/esm/utils/clamp.js.map +1 -1
  259. package/build/esm/utils/context.d.ts +7 -7
  260. package/build/esm/utils/context.js +13 -20
  261. package/build/esm/utils/context.js.map +1 -1
  262. package/build/esm/utils/create-subscription.d.ts +4 -4
  263. package/build/esm/utils/create-subscription.js +5 -10
  264. package/build/esm/utils/create-subscription.js.map +1 -1
  265. package/build/esm/utils/get-circular-index.d.ts +1 -1
  266. package/build/esm/utils/get-circular-index.js +0 -1
  267. package/build/esm/utils/get-circular-index.js.map +1 -1
  268. package/build/esm/utils/index.d.ts +10 -10
  269. package/build/esm/utils/index.js.map +1 -1
  270. package/build/esm/utils/is-right-click.d.ts +6 -6
  271. package/build/esm/utils/is-right-click.js +4 -4
  272. package/build/esm/utils/is-right-click.js.map +1 -1
  273. package/build/esm/utils/owner-document.d.ts +7 -7
  274. package/build/esm/utils/owner-document.js +6 -6
  275. package/build/esm/utils/owner-document.js.map +1 -1
  276. package/build/esm/utils/polymorphic.d.ts +39 -39
  277. package/build/esm/utils/polymorphic.js.map +1 -1
  278. package/build/esm/utils/rubber-band-clamp.d.ts +2 -2
  279. package/build/esm/utils/rubber-band-clamp.js +2 -5
  280. package/build/esm/utils/rubber-band-clamp.js.map +1 -1
  281. package/build/esm/utils/use-stable-callback.d.ts +16 -16
  282. package/build/esm/utils/use-stable-callback.js +24 -26
  283. package/build/esm/utils/use-stable-callback.js.map +1 -1
  284. package/build/esm/utils/wrap-event.d.ts +3 -3
  285. package/build/esm/utils/wrap-event.js +2 -5
  286. package/build/esm/utils/wrap-event.js.map +1 -1
  287. package/build/tsconfig-build.tsbuildinfo +1 -1
  288. package/package.json +7 -11
  289. package/src/Accordion/Accordion.story.tsx +74 -74
  290. package/src/Accordion/Accordion.tsx +59 -59
  291. package/src/Accordion/AccordionBody.tsx +52 -52
  292. package/src/Accordion/AccordionHeader.tsx +166 -167
  293. package/src/Accordion/AccordionItem.tsx +50 -50
  294. package/src/Accordion/context.ts +37 -37
  295. package/src/Accordion/index.ts +4 -4
  296. package/src/Accordion/scopeQuery.ts +7 -7
  297. package/src/Accordion/styles.css +21 -21
  298. package/src/CheckBox/CheckBox.tsx +41 -41
  299. package/src/CheckBox/index.ts +1 -1
  300. package/src/ComboBox/ComboBox.story.tsx +120 -120
  301. package/src/ComboBox/Combobox.tsx +148 -148
  302. package/src/ComboBox/ComboboxButton.tsx +61 -61
  303. package/src/ComboBox/ComboboxInput.tsx +187 -187
  304. package/src/ComboBox/ComboboxLabel.tsx +33 -33
  305. package/src/ComboBox/ComboboxList.tsx +47 -47
  306. package/src/ComboBox/ComboboxOption.tsx +110 -111
  307. package/src/ComboBox/ComboboxPopover.tsx +64 -64
  308. package/src/ComboBox/cities.ts +23194 -23194
  309. package/src/ComboBox/context.ts +35 -35
  310. package/src/ComboBox/hooks.tsx +448 -451
  311. package/src/ComboBox/index.ts +8 -8
  312. package/src/ComboBox/makeHash.ts +19 -19
  313. package/src/ComboBox/scopeQuery.ts +6 -6
  314. package/src/ComboBox/styles.css +32 -32
  315. package/src/FocusLock/FocusLock.tsx +66 -66
  316. package/src/FocusLock/index.ts +1 -1
  317. package/src/FocusLock/tabUtils.ts +40 -40
  318. package/src/FocusLock/useFocusLock.ts +55 -56
  319. package/src/List/List.story.tsx +18 -18
  320. package/src/List/List.tsx +17 -17
  321. package/src/List/ListItem.tsx +23 -23
  322. package/src/List/context.ts +19 -19
  323. package/src/List/index.ts +2 -2
  324. package/src/Menu/ContextMenu.story.tsx +73 -73
  325. package/src/Menu/ContextMenuTrigger.tsx +76 -76
  326. package/src/Menu/Menu.story.tsx +160 -160
  327. package/src/Menu/Menu.tsx +82 -83
  328. package/src/Menu/MenuButton.tsx +83 -83
  329. package/src/Menu/MenuComplex.story.tsx +58 -58
  330. package/src/Menu/MenuItem.tsx +87 -88
  331. package/src/Menu/MenuList.tsx +254 -254
  332. package/src/Menu/MenuPopover.tsx +35 -35
  333. package/src/Menu/context.ts +44 -44
  334. package/src/Menu/fixtures/countryList.ts +198 -198
  335. package/src/Menu/index.ts +6 -6
  336. package/src/Menu/scope.ts +7 -7
  337. package/src/Menu/styles.css +42 -42
  338. package/src/Modal/Modal.story.tsx +262 -258
  339. package/src/Modal/Modal.tsx +48 -48
  340. package/src/Modal/ModalBackdrop.tsx +78 -78
  341. package/src/Modal/NavDrawer.story.tsx +161 -158
  342. package/src/Modal/index.ts +2 -2
  343. package/src/Modal/styles.css +46 -46
  344. package/src/Popper/Popper.story.tsx +279 -263
  345. package/src/Popper/Popper.tsx +1 -1
  346. package/src/Popper/PopperArrow.tsx +35 -35
  347. package/src/Popper/context.ts +10 -10
  348. package/src/Popper/index.ts +3 -3
  349. package/src/Popper/styles.css +60 -60
  350. package/src/RadioButton/RadioButton.story.tsx +78 -77
  351. package/src/RadioButton/RadioButton.tsx +55 -55
  352. package/src/RadioButton/RadioGroup.tsx +60 -60
  353. package/src/RadioButton/context.ts +17 -17
  354. package/src/RadioButton/index.ts +2 -2
  355. package/src/SkipNav/SkipNav.tsx +16 -16
  356. package/src/SkipNav/index.tsx +1 -1
  357. package/src/Slider/Slider.story.tsx +45 -45
  358. package/src/Slider/Slider.tsx +1115 -1120
  359. package/src/Slider/index.ts +1 -1
  360. package/src/Slider/styles.css +131 -131
  361. package/src/Spinner/Spinner.story.tsx +31 -31
  362. package/src/Spinner/Spinner.tsx +117 -117
  363. package/src/Spinner/SpinnerButton.tsx +54 -54
  364. package/src/Spinner/context.ts +20 -20
  365. package/src/Spinner/index.ts +2 -2
  366. package/src/Spinner/styles.css +23 -23
  367. package/src/Tabs/Tab.story.tsx +80 -80
  368. package/src/Tabs/Tab.tsx +136 -136
  369. package/src/Tabs/TabList.tsx +71 -71
  370. package/src/Tabs/TabPanel.tsx +53 -53
  371. package/src/Tabs/TabPanels.tsx +30 -30
  372. package/src/Tabs/Tabs.tsx +46 -46
  373. package/src/Tabs/context.ts +30 -30
  374. package/src/Tabs/index.tsx +5 -5
  375. package/src/Tabs/scopeQuery.ts +6 -6
  376. package/src/Tooltip/Tooltip.story.tsx +61 -61
  377. package/src/Tooltip/Tooltip.tsx +53 -50
  378. package/src/Tooltip/index.ts +1 -1
  379. package/src/Tooltip/stateMachine.ts +192 -192
  380. package/src/Tooltip/styles.css +17 -17
  381. package/src/Tooltip/useTooltip.ts +136 -136
  382. package/src/hooks/index.ts +13 -13
  383. package/src/hooks/useAutoFocus.ts +22 -22
  384. package/src/hooks/useChildrenCounter.ts +51 -51
  385. package/src/hooks/useControlledState.ts +1 -6
  386. package/src/hooks/useFocusReturn.ts +43 -43
  387. package/src/hooks/useFocusState.ts +30 -30
  388. package/src/hooks/useGestureHandlers.ts +282 -286
  389. package/src/hooks/useMeasure.ts +33 -33
  390. package/src/hooks/useOnClickOutside.ts +32 -32
  391. package/src/hooks/useOnKeyDown.ts +19 -19
  392. package/src/hooks/useReducerMachine.ts +60 -60
  393. package/src/hooks/useRemoveBodyScroll.ts +38 -39
  394. package/src/hooks/useScope.ts +52 -52
  395. package/src/hooks/useThrottle.ts +19 -19
  396. package/src/index.ts +20 -20
  397. package/src/styles.d.ts +1 -0
  398. package/src/utils/assign-ref.ts +27 -27
  399. package/src/utils/can-use-dom.ts +7 -7
  400. package/src/utils/clamp.ts +3 -3
  401. package/src/utils/context.tsx +48 -48
  402. package/src/utils/create-subscription.ts +16 -16
  403. package/src/utils/get-circular-index.ts +7 -7
  404. package/src/utils/index.ts +10 -10
  405. package/src/utils/is-right-click.ts +14 -14
  406. package/src/utils/owner-document.ts +13 -13
  407. package/src/utils/polymorphic.ts +82 -78
  408. package/src/utils/rubber-band-clamp.ts +25 -25
  409. package/src/utils/use-stable-callback.ts +57 -58
  410. package/src/utils/wrap-event.ts +22 -22
@@ -1 +1 @@
1
- {"version":3,"file":"stateMachine.js","names":["createSubscription","restTimeout","startRestTimer","clearTimeout","setTimeout","send","Rest","undefined","clearRestTimer","leavingVisibleTimer","startLeavingVisibleTimer","TimeComplete","clearLeavingVisibleTimer","Idle","Focused","Visible","LeavingVisible","Dismissed","Blur","Focus","GlobalMouseMove","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","subscription","state","current","id","clearContextId","chart","initial","states","enter","on","leave","transition","currentState","event","payload","currentStateValue","stateDef","nextState","nextStateValue","nextDef","notify"],"sources":["../../../src/Tooltip/stateMachine.ts"],"sourcesContent":["import { createSubscription } from '../utils/create-subscription';\r\nimport type { StateChart as GenericStateChart } from '../hooks/useReducerMachine';\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n// Timeouts:\r\n\r\n// Manages when the user \"rests\" on an element. Keeps the interface from being\r\n// flashing tooltips all the time as the user moves the mouse around the screen.\r\nlet restTimeout: NodeJS.Timeout;\r\nfunction startRestTimer() {\r\n clearTimeout(restTimeout);\r\n restTimeout = setTimeout(() => {\r\n send(Rest, undefined);\r\n }, 200);\r\n}\r\n\r\nfunction clearRestTimer() {\r\n clearTimeout(restTimeout);\r\n}\r\n\r\n// Manages the delay to hide the tooltip after rest leaves.\r\nlet leavingVisibleTimer: NodeJS.Timeout;\r\nfunction startLeavingVisibleTimer() {\r\n clearTimeout(leavingVisibleTimer);\r\n leavingVisibleTimer = setTimeout(() => send(TimeComplete, undefined), 100);\r\n}\r\n\r\nfunction clearLeavingVisibleTimer() {\r\n clearTimeout(leavingVisibleTimer);\r\n}\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n// State machine\r\n\r\nexport type TooltipStates =\r\n | 'IDLE'\r\n | 'FOCUSED'\r\n | 'VISIBLE'\r\n | 'LEAVING_VISIBLE'\r\n | 'DISMISSED';\r\n\r\n// Nothing goin' on\r\nexport const Idle = 'IDLE' as const;\r\n// We're considering showing the tooltip, but we're gonna wait a sec\r\nexport const Focused = 'FOCUSED' as const;\r\n// It's on!\r\nexport const Visible = 'VISIBLE' as const;\r\n// Focus has left, but we want to keep it visible for a sec\r\nexport const LeavingVisible = 'LEAVING_VISIBLE' as const;\r\n// The user clicked the tool, so we want to hide the thing, we can't just use\r\n// IDLE because we need to ignore mousemove, etc.\r\nexport const Dismissed = 'DISMISSED' as const;\r\n\r\nexport type TooltipEventTypes =\r\n | 'BLUR'\r\n | 'FOCUS'\r\n | 'GLOBAL_MOUSE_MOVE'\r\n | 'MOUSE_DOWN'\r\n | 'MOUSE_ENTER'\r\n | 'MOUSE_LEAVE'\r\n | 'MOUSE_MOVE'\r\n | 'REST'\r\n | 'SELECT_WITH_KEYBOARD'\r\n | 'TIME_COMPLETE';\r\n\r\nexport const Blur = 'BLUR' as const;\r\nexport const Focus = 'FOCUS' as const;\r\nexport const GlobalMouseMove = 'GLOBAL_MOUSE_MOVE' as const;\r\nexport const MouseDown = 'MOUSE_DOWN' as const;\r\nexport const MouseEnter = 'MOUSE_ENTER' as const;\r\nexport const MouseLeave = 'MOUSE_LEAVE' as const;\r\nexport const MouseMove = 'MOUSE_MOVE' as const;\r\nexport const Rest = 'REST' as const;\r\nexport const SelectWithKeyboard = 'SELECT_WITH_KEYBOARD' as const;\r\nexport const TimeComplete = 'TIME_COMPLETE' as const;\r\n\r\nexport const subscription = createSubscription();\r\nexport const state = {\r\n current: {\r\n state: Idle as TooltipStates,\r\n id: '',\r\n },\r\n};\r\n\r\nfunction clearContextId() {\r\n state.current.id = '';\r\n}\r\n\r\nconst chart: GenericStateChart<TooltipStates, TooltipEventTypes> = {\r\n initial: Idle,\r\n states: {\r\n [Idle]: {\r\n enter: () => {\r\n clearContextId();\r\n },\r\n on: {\r\n [MouseEnter]: Focused,\r\n [Focus]: Visible,\r\n },\r\n },\r\n [Focused]: {\r\n enter: startRestTimer,\r\n leave: clearRestTimer,\r\n on: {\r\n [MouseMove]: Focused,\r\n [MouseLeave]: Idle,\r\n [MouseDown]: Dismissed,\r\n [Blur]: Idle,\r\n [Rest]: Visible,\r\n },\r\n },\r\n [Visible]: {\r\n on: {\r\n [Focus]: Focused,\r\n [MouseEnter]: Focused,\r\n [MouseLeave]: LeavingVisible,\r\n [Blur]: LeavingVisible,\r\n [MouseDown]: Dismissed,\r\n [SelectWithKeyboard]: Dismissed,\r\n [GlobalMouseMove]: LeavingVisible,\r\n },\r\n },\r\n [LeavingVisible]: {\r\n enter: () => {\r\n startLeavingVisibleTimer();\r\n },\r\n leave: () => {\r\n clearLeavingVisibleTimer();\r\n clearContextId();\r\n },\r\n on: {\r\n [MouseEnter]: Visible,\r\n [Focus]: Visible,\r\n [TimeComplete]: Idle,\r\n },\r\n },\r\n [Dismissed]: {\r\n leave: () => {\r\n clearContextId();\r\n },\r\n on: {\r\n [MouseLeave]: Idle,\r\n [Blur]: Idle,\r\n },\r\n },\r\n },\r\n};\r\n\r\nfunction transition(\r\n currentState: typeof state['current'],\r\n event: TooltipEventTypes,\r\n payload?: Omit<typeof state['current'], 'state'>\r\n): typeof state['current'] {\r\n const currentStateValue = currentState.state;\r\n const stateDef = chart.states[currentState.state];\r\n const nextState = stateDef?.on?.[event];\r\n\r\n // Really useful for debugging\r\n // console.log({\r\n // event,\r\n // state: state.current.state,\r\n // id: state.current.id,\r\n // nextState,\r\n // });\r\n\r\n if (!nextState) {\r\n return currentState;\r\n }\r\n\r\n if (stateDef && stateDef.leave) {\r\n stateDef.leave(currentStateValue, payload);\r\n }\r\n\r\n const nextStateValue = nextState;\r\n const nextDef = chart.states[nextStateValue];\r\n if (nextDef && nextDef.enter) {\r\n nextDef.enter(nextStateValue, payload);\r\n }\r\n\r\n return { ...currentState, ...payload, state: nextStateValue };\r\n}\r\n\r\nexport function send<T extends TooltipEventTypes>(\r\n event: T,\r\n payload?: Omit<typeof state['current'], 'state'>\r\n) {\r\n const nextState = transition(state.current, event, payload);\r\n if (state.current !== nextState) {\r\n state.current = nextState;\r\n subscription.notify();\r\n }\r\n}\r\n"],"mappings":";;;;;AAAA,SAASA,kBAAT,QAAmC,8BAAnC;AAGA;AACA;AAEA;AACA;AACA,IAAIC,WAAJ;;AACA,SAASC,cAAT,GAA0B;EACxBC,YAAY,CAACF,WAAD,CAAZ;EACAA,WAAW,GAAGG,UAAU,CAAC,YAAM;IAC7BC,IAAI,CAACC,IAAD,EAAOC,SAAP,CAAJ;EACD,CAFuB,EAErB,GAFqB,CAAxB;AAGD;;AAED,SAASC,cAAT,GAA0B;EACxBL,YAAY,CAACF,WAAD,CAAZ;AACD,C,CAED;;;AACA,IAAIQ,mBAAJ;;AACA,SAASC,wBAAT,GAAoC;EAClCP,YAAY,CAACM,mBAAD,CAAZ;EACAA,mBAAmB,GAAGL,UAAU,CAAC;IAAA,OAAMC,IAAI,CAACM,YAAD,EAAeJ,SAAf,CAAV;EAAA,CAAD,EAAsC,GAAtC,CAAhC;AACD;;AAED,SAASK,wBAAT,GAAoC;EAClCT,YAAY,CAACM,mBAAD,CAAZ;AACD,C,CAED;AACA;;;AASA;AACA,OAAO,IAAMI,IAAI,GAAG,MAAb,C,CACP;;AACA,OAAO,IAAMC,OAAO,GAAG,SAAhB,C,CACP;;AACA,OAAO,IAAMC,OAAO,GAAG,SAAhB,C,CACP;;AACA,OAAO,IAAMC,cAAc,GAAG,iBAAvB,C,CACP;AACA;;AACA,OAAO,IAAMC,SAAS,GAAG,WAAlB;AAcP,OAAO,IAAMC,IAAI,GAAG,MAAb;AACP,OAAO,IAAMC,KAAK,GAAG,OAAd;AACP,OAAO,IAAMC,eAAe,GAAG,mBAAxB;AACP,OAAO,IAAMC,SAAS,GAAG,YAAlB;AACP,OAAO,IAAMC,UAAU,GAAG,aAAnB;AACP,OAA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AAvB,CAA5B;;EACA,IAAIb,KAAK,CAACC,OAAN,KAAkBe,SAAtB,EAAiC;IAC/BhB,KAAK,CAACC,OAAN,GAAgBe,SAAhB;IACAjB,YAAY,CAACoB,MAAb;EACD;AACF"}
1
+ {"version":3,"file":"stateMachine.js","names":["createSubscription","restTimeout","startRestTimer","clearTimeout","setTimeout","send","Rest","undefined","clearRestTimer","leavingVisibleTimer","startLeavingVisibleTimer","TimeComplete","clearLeavingVisibleTimer","Idle","Focused","Visible","LeavingVisible","Dismissed","Blur","Focus","GlobalMouseMove","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","subscription","state","current","id","clearContextId","chart","initial","states","enter","on","leave","transition","currentState","event","payload","currentStateValue","stateDef","nextState","nextStateValue","nextDef","notify"],"sources":["../../../src/Tooltip/stateMachine.ts"],"sourcesContent":["import { createSubscription } from '../utils/create-subscription';\nimport type { StateChart as GenericStateChart } from '../hooks/useReducerMachine';\n\n////////////////////////////////////////////////////////////////////////////////\n// Timeouts:\n\n// Manages when the user \"rests\" on an element. Keeps the interface from being\n// flashing tooltips all the time as the user moves the mouse around the screen.\nlet restTimeout: NodeJS.Timeout;\nfunction startRestTimer() {\n clearTimeout(restTimeout);\n restTimeout = setTimeout(() => {\n send(Rest, undefined);\n }, 200);\n}\n\nfunction clearRestTimer() {\n clearTimeout(restTimeout);\n}\n\n// Manages the delay to hide the tooltip after rest leaves.\nlet leavingVisibleTimer: NodeJS.Timeout;\nfunction startLeavingVisibleTimer() {\n clearTimeout(leavingVisibleTimer);\n leavingVisibleTimer = setTimeout(() => send(TimeComplete, undefined), 100);\n}\n\nfunction clearLeavingVisibleTimer() {\n clearTimeout(leavingVisibleTimer);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// State machine\n\nexport type TooltipStates =\n | 'IDLE'\n | 'FOCUSED'\n | 'VISIBLE'\n | 'LEAVING_VISIBLE'\n | 'DISMISSED';\n\n// Nothing goin' on\nexport const Idle = 'IDLE' as const;\n// We're considering showing the tooltip, but we're gonna wait a sec\nexport const Focused = 'FOCUSED' as const;\n// It's on!\nexport const Visible = 'VISIBLE' as const;\n// Focus has left, but we want to keep it visible for a sec\nexport const LeavingVisible = 'LEAVING_VISIBLE' as const;\n// The user clicked the tool, so we want to hide the thing, we can't just use\n// IDLE because we need to ignore mousemove, etc.\nexport const Dismissed = 'DISMISSED' as const;\n\nexport type TooltipEventTypes =\n | 'BLUR'\n | 'FOCUS'\n | 'GLOBAL_MOUSE_MOVE'\n | 'MOUSE_DOWN'\n | 'MOUSE_ENTER'\n | 'MOUSE_LEAVE'\n | 'MOUSE_MOVE'\n | 'REST'\n | 'SELECT_WITH_KEYBOARD'\n | 'TIME_COMPLETE';\n\nexport const Blur = 'BLUR' as const;\nexport const Focus = 'FOCUS' as const;\nexport const GlobalMouseMove = 'GLOBAL_MOUSE_MOVE' as const;\nexport const MouseDown = 'MOUSE_DOWN' as const;\nexport const MouseEnter = 'MOUSE_ENTER' as const;\nexport const MouseLeave = 'MOUSE_LEAVE' as const;\nexport const MouseMove = 'MOUSE_MOVE' as const;\nexport const Rest = 'REST' as const;\nexport const SelectWithKeyboard = 'SELECT_WITH_KEYBOARD' as const;\nexport const TimeComplete = 'TIME_COMPLETE' as const;\n\nexport const subscription = createSubscription();\nexport const state = {\n current: {\n state: Idle as TooltipStates,\n id: '',\n },\n};\n\nfunction clearContextId() {\n state.current.id = '';\n}\n\nconst chart: GenericStateChart<TooltipStates, TooltipEventTypes> = {\n initial: Idle,\n states: {\n [Idle]: {\n enter: () => {\n clearContextId();\n },\n on: {\n [MouseEnter]: Focused,\n [Focus]: Visible,\n },\n },\n [Focused]: {\n enter: startRestTimer,\n leave: clearRestTimer,\n on: {\n [MouseMove]: Focused,\n [MouseLeave]: Idle,\n [MouseDown]: Dismissed,\n [Blur]: Idle,\n [Rest]: Visible,\n },\n },\n [Visible]: {\n on: {\n [Focus]: Focused,\n [MouseEnter]: Focused,\n [MouseLeave]: LeavingVisible,\n [Blur]: LeavingVisible,\n [MouseDown]: Dismissed,\n [SelectWithKeyboard]: Dismissed,\n [GlobalMouseMove]: LeavingVisible,\n },\n },\n [LeavingVisible]: {\n enter: () => {\n startLeavingVisibleTimer();\n },\n leave: () => {\n clearLeavingVisibleTimer();\n clearContextId();\n },\n on: {\n [MouseEnter]: Visible,\n [Focus]: Visible,\n [TimeComplete]: Idle,\n },\n },\n [Dismissed]: {\n leave: () => {\n clearContextId();\n },\n on: {\n [MouseLeave]: Idle,\n [Blur]: Idle,\n },\n },\n },\n};\n\nfunction transition(\n currentState: typeof state['current'],\n event: TooltipEventTypes,\n payload?: Omit<typeof state['current'], 'state'>\n): typeof state['current'] {\n const currentStateValue = currentState.state;\n const stateDef = chart.states[currentState.state];\n const nextState = stateDef?.on?.[event];\n\n // Really useful for debugging\n // console.log({\n // event,\n // state: state.current.state,\n // id: state.current.id,\n // nextState,\n // });\n\n if (!nextState) {\n return currentState;\n }\n\n if (stateDef && stateDef.leave) {\n stateDef.leave(currentStateValue, payload);\n }\n\n const nextStateValue = nextState;\n const nextDef = chart.states[nextStateValue];\n if (nextDef && nextDef.enter) {\n nextDef.enter(nextStateValue, payload);\n }\n\n return { ...currentState, ...payload, state: nextStateValue };\n}\n\nexport function send<T extends TooltipEventTypes>(\n event: T,\n payload?: Omit<typeof state['current'], 'state'>\n) {\n const nextState = transition(state.current, event, payload);\n if (state.current !== nextState) {\n state.current = nextState;\n subscription.notify();\n }\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,8BAA8B;AAGjE;AACA;;AAEA;AACA;AACA,IAAIC,WAA2B;AAC/B,SAASC,cAAcA,CAAA,EAAG;EACxBC,YAAY,CAACF,WAAW,CAAC;EACzBA,WAAW,GAAGG,UAAU,CAAC,MAAM;IAC7BC,IAAI,CAACC,IAAI,EAAEC,SAAS,CAAC;EACvB,CAAC,EAAE,GAAG,CAAC;AACT;AAEA,SAASC,cAAcA,CAAA,EAAG;EACxBL,YAAY,CAACF,WAAW,CAAC;AAC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F;AACF,CAAC;AAED,SAASwB,UAAUA,CACjBC,YAAqC,EACrCC,KAAwB,EACxBC,OAAgD,EACvB;EACzB,MAAMC,iBAAiB,GAAGH,YAAY,CAACX,KAAK;EAC5C,MAAMe,QAAQ,GAAGX,KAAK,CAACE,MAAM,CAACK,YAAY,CAACX,KAAK,CAAC;EACjD,MAAMgB,SAAS,GAAGD,QAAQ,EAAEP,EAAE,GAAGI,KAAK,CAAC;;EAEvC;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,IAAI,CAACI,SAAS,EAAE;IACd,OAAOL,YAAY;EACrB;EAEA,IAAII,QAAQ,IAAIA,QAAQ,CAACN,KAAK,EAAE;IAC9BM,QAAQ,CAACN,KAAK,CAACK,iBAAiB,EAAED,OAAO,CAAC;EAC5C;EAEA,MAAMI,cAAc,GAAGD,SAAS;EAChC,MAAME,OAAO,GAAGd,KAAK,CAACE,MAAM,CAACW,cAAc,CAAC;EAC5C,IAAIC,OAAO,IAAIA,OAAO,CAACX,KAAK,EAAE;IAC5BW,OAAO,CAACX,KAAK,CAACU,cAAc,EAAEJ,OAAO,CAAC;EACxC;EAEA,OAAO;IAAE,GAAGF,YAAY;IAAE,GAAGE,OAAO;IAAEb,KAAK,EAAEiB;EAAe,CAAC;AAC/D;AAEA,OAAO,SAASvC,IAAIA,CAClBkC,KAAQ,EACRC,OAAgD,EAChD;EACA,MAAMG,SAAS,GAAGN,UAAU,CAACV,KAAK,CAACC,OAAO,EAAEW,KAAK,EAAEC,OAAO,CAAC;EAC3D,IAAIb,KAAK,CAACC,OAAO,KAAKe,SAAS,EAAE;IAC/BhB,KAAK,CAACC,OAAO,GAAGe,SAAS;IACzBjB,YAAY,CAACoB,MAAM,CAAC,CAAC;EACvB;AACF","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- import type { HTMLAttributes, ReactNode, Ref, RefAttributes, RefObject } from 'react';
2
- export declare type ChildProps = HTMLAttributes<HTMLElement> & RefAttributes<HTMLElement>;
3
- export interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {
4
- anchorEl: RefObject<HTMLElement>;
5
- visible: boolean;
6
- children?: ReactNode;
7
- }
8
- export declare function useTooltip(childProps: ChildProps, childRef: Ref<HTMLElement> | undefined, tooltipProps: HTMLAttributes<HTMLElement> & {
9
- label?: ReactNode;
10
- }): [ChildProps, InjectedTooltipProps];
1
+ import type { HTMLAttributes, ReactNode, Ref, RefAttributes, RefObject } from 'react';
2
+ export type ChildProps = HTMLAttributes<HTMLElement> & RefAttributes<HTMLElement>;
3
+ export interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {
4
+ anchorEl: RefObject<HTMLElement | null>;
5
+ visible: boolean;
6
+ children?: ReactNode;
7
+ }
8
+ export declare function useTooltip(childProps: ChildProps, childRef: Ref<HTMLElement> | undefined, tooltipProps: HTMLAttributes<HTMLElement> & {
9
+ label?: ReactNode;
10
+ }): [ChildProps, InjectedTooltipProps];
@@ -1,87 +1,74 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- var _excluded = ["label", "onMouseEnter", "onMouseLeave", "onMouseMove"];
5
1
  import { useRef, useEffect, useState, useId } from 'react';
6
2
  import { assignMultipleRefs } from '../utils/assign-ref';
7
3
  import { wrapEvent } from '../utils/wrap-event';
8
4
  import { send, state, subscription, Blur, Focus, LeavingVisible, MouseDown, MouseEnter, MouseLeave, MouseMove, SelectWithKeyboard, Visible } from './stateMachine';
9
5
  export function useTooltip(childProps, childRef, tooltipProps) {
10
- var onMouseEnter = childProps.onMouseEnter,
11
- onMouseLeave = childProps.onMouseLeave,
12
- onMouseMove = childProps.onMouseMove,
13
- onMouseDown = childProps.onMouseDown,
14
- onKeyDown = childProps.onKeyDown,
15
- onFocus = childProps.onFocus,
16
- onBlur = childProps.onBlur;
17
- var anchorEl = useRef(null);
18
-
19
- var _useState = useState(false),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- visible = _useState2[0],
22
- setVisible = _useState2[1];
23
-
24
- var id = useId();
25
- useEffect(function () {
26
- subscription.subscribe(function () {
6
+ const {
7
+ onMouseEnter,
8
+ onMouseLeave,
9
+ onMouseMove,
10
+ onMouseDown,
11
+ onKeyDown,
12
+ onFocus,
13
+ onBlur
14
+ } = childProps;
15
+ const anchorEl = useRef(null);
16
+ const [visible, setVisible] = useState(false);
17
+ const id = useId();
18
+ useEffect(() => {
19
+ subscription.subscribe(() => {
27
20
  setVisible((state.current.state === Visible || state.current.state === LeavingVisible) && state.current.id === id);
28
21
  });
29
22
  }, [id]);
30
-
31
23
  function handleMouseEnter() {
32
24
  send(MouseEnter, {
33
- id: id
25
+ id
34
26
  });
35
27
  }
36
-
37
28
  function handleMouseMove() {
38
29
  send(MouseMove, {
39
- id: id
30
+ id
40
31
  });
41
32
  }
42
-
43
33
  function handleMouseLeave() {
44
34
  send(MouseLeave);
45
35
  }
46
-
47
36
  function handleMouseDown() {
48
37
  // Allow quick click from one tool to another
49
38
  if (state.current.id === id) {
50
39
  send(MouseDown);
51
40
  }
52
41
  }
53
-
54
42
  function handleFocus() {
55
43
  send(Focus, {
56
- id: id
44
+ id
57
45
  });
58
46
  }
59
-
60
47
  function handleBlur() {
61
48
  // Allow quick click from one tool to another
62
49
  if (state.current.id === id) {
63
50
  send(Blur, undefined);
64
51
  }
65
52
  }
66
-
67
53
  function handleKeyDown(event) {
68
54
  if (event.key === 'Enter' || event.key === ' ') {
69
55
  send(SelectWithKeyboard);
70
56
  }
71
57
  }
72
-
73
- var children = tooltipProps.label,
74
- tooltipOnMouseEnter = tooltipProps.onMouseEnter,
75
- tooltipOnMouseLeave = tooltipProps.onMouseLeave,
76
- tooltipOnMouseMove = tooltipProps.onMouseMove,
77
- otherTooltipProps = _objectWithoutProperties(tooltipProps, _excluded);
78
-
79
- var tooltipId = "tooltip-".concat(id);
80
- return [_extends(_extends(_extends({}, childProps), {}, {
81
- ref: assignMultipleRefs(childRef, anchorEl)
82
- }, visible && !childProps['aria-label'] && {
83
- 'aria-describedby': tooltipId
84
- }), {}, {
58
+ const {
59
+ label: children,
60
+ onMouseEnter: tooltipOnMouseEnter,
61
+ onMouseLeave: tooltipOnMouseLeave,
62
+ onMouseMove: tooltipOnMouseMove,
63
+ ...otherTooltipProps
64
+ } = tooltipProps;
65
+ const tooltipId = `tooltip-${id}`;
66
+ return [{
67
+ ...childProps,
68
+ ref: assignMultipleRefs(childRef, anchorEl),
69
+ ...(visible && !childProps['aria-label'] && {
70
+ 'aria-describedby': tooltipId
71
+ }),
85
72
  onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),
86
73
  onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),
87
74
  onMouseMove: wrapEvent(onMouseMove, handleMouseMove),
@@ -89,15 +76,16 @@ export function useTooltip(childProps, childRef, tooltipProps) {
89
76
  onFocus: wrapEvent(onFocus, handleFocus),
90
77
  onBlur: wrapEvent(onBlur, handleBlur),
91
78
  onKeyDown: wrapEvent(onKeyDown, handleKeyDown)
92
- }), _extends({
79
+ }, {
93
80
  id: tooltipId,
94
- anchorEl: anchorEl,
95
- visible: visible,
96
- children: children,
81
+ anchorEl,
82
+ visible,
83
+ children,
97
84
  onMouseEnter: wrapEvent(tooltipOnMouseEnter, handleMouseEnter),
98
85
  onMouseLeave: wrapEvent(tooltipOnMouseLeave, handleMouseLeave),
99
86
  onMouseMove: wrapEvent(tooltipOnMouseMove, handleMouseMove),
100
- role: 'tooltip'
101
- }, otherTooltipProps)];
87
+ role: 'tooltip',
88
+ ...otherTooltipProps
89
+ }];
102
90
  }
103
91
  //# sourceMappingURL=useTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTooltip.js","names":["useRef","useEffect","useState","useId","assignMultipleRefs","wrapEvent","send","state","subscription","Blur","Focus","LeavingVisible","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","Visible","useTooltip","childProps","childRef","tooltipProps","onMouseEnter","onMouseLeave","onMouseMove","onMouseDown","onKeyDown","onFocus","onBlur","anchorEl","visible","setVisible","id","subscribe","current","handleMouseEnter","handleMouseMove","handleMouseLeave","handleMouseDown","handleFocus","handleBlur","undefined","handleKeyDown","event","key","children","label","tooltipOnMouseEnter","tooltipOnMouseLeave","tooltipOnMouseMove","otherTooltipProps","tooltipId","ref","role"],"sources":["../../../src/Tooltip/useTooltip.ts"],"sourcesContent":["import type {\r\n HTMLAttributes,\r\n KeyboardEvent,\r\n ReactNode,\r\n Ref,\r\n RefAttributes,\r\n RefObject,\r\n} from 'react';\r\nimport { useRef, useEffect, useState, useId } from 'react';\r\n\r\nimport { assignMultipleRefs } from '../utils/assign-ref';\r\nimport { wrapEvent } from '../utils/wrap-event';\r\nimport {\r\n send,\r\n state,\r\n subscription,\r\n Blur,\r\n Focus,\r\n LeavingVisible,\r\n MouseDown,\r\n MouseEnter,\r\n MouseLeave,\r\n MouseMove,\r\n SelectWithKeyboard,\r\n Visible,\r\n} from './stateMachine';\r\n\r\nexport type ChildProps = HTMLAttributes<HTMLElement> &\r\n RefAttributes<HTMLElement>;\r\n\r\nexport interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {\r\n anchorEl: RefObject<HTMLElement>;\r\n visible: boolean;\r\n children?: ReactNode;\r\n}\r\n\r\nexport function useTooltip(\r\n childProps: ChildProps,\r\n childRef: Ref<HTMLElement> | undefined,\r\n tooltipProps: HTMLAttributes<HTMLElement> & { label?: ReactNode }\r\n): [ChildProps, InjectedTooltipProps] {\r\n const {\r\n onMouseEnter,\r\n onMouseLeave,\r\n onMouseMove,\r\n onMouseDown,\r\n onKeyDown,\r\n onFocus,\r\n onBlur,\r\n } = childProps;\r\n const anchorEl = useRef<HTMLElement>(null);\r\n const [visible, setVisible] = useState(false);\r\n const id = useId();\r\n\r\n useEffect(() => {\r\n subscription.subscribe(() => {\r\n setVisible(\r\n (state.current.state === Visible ||\r\n state.current.state === LeavingVisible) &&\r\n state.current.id === id\r\n );\r\n });\r\n }, [id]);\r\n\r\n function handleMouseEnter() {\r\n send(MouseEnter, { id });\r\n }\r\n\r\n function handleMouseMove() {\r\n send(MouseMove, { id });\r\n }\r\n\r\n function handleMouseLeave() {\r\n send(MouseLeave);\r\n }\r\n\r\n function handleMouseDown() {\r\n // Allow quick click from one tool to another\r\n if (state.current.id === id) {\r\n send(MouseDown);\r\n }\r\n }\r\n\r\n function handleFocus() {\r\n send(Focus, { id });\r\n }\r\n\r\n function handleBlur() {\r\n // Allow quick click from one tool to another\r\n if (state.current.id === id) {\r\n send(Blur, undefined);\r\n }\r\n }\r\n\r\n function handleKeyDown(event: KeyboardEvent<HTMLElement>) {\r\n if (event.key === 'Enter' || event.key === ' ') {\r\n send(SelectWithKeyboard);\r\n }\r\n }\r\n\r\n const {\r\n label: children,\r\n onMouseEnter: tooltipOnMouseEnter,\r\n onMouseLeave: tooltipOnMouseLeave,\r\n onMouseMove: tooltipOnMouseMove,\r\n ...otherTooltipProps\r\n } = tooltipProps;\r\n\r\n const tooltipId = `tooltip-${id}`;\r\n return [\r\n {\r\n ...childProps,\r\n ref: assignMultipleRefs(childRef, anchorEl),\r\n ...(visible &&\r\n !childProps['aria-label'] && { 'aria-describedby': tooltipId }),\r\n onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),\r\n onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),\r\n onMouseMove: wrapEvent(onMouseMove, handleMouseMove),\r\n onMouseDown: wrapEvent(onMouseDown, handleMouseDown),\r\n onFocus: wrapEvent(onFocus, handleFocus),\r\n onBlur: wrapEvent(onBlur, handleBlur),\r\n onKeyDown: wrapEvent(onKeyDown, handleKeyDown),\r\n },\r\n {\r\n id: tooltipId,\r\n anchorEl,\r\n visible,\r\n children,\r\n onMouseEnter: wrapEvent(tooltipOnMouseEnter, handleMouseEnter),\r\n onMouseLeave: wrapEvent(tooltipOnMouseLeave, handleMouseLeave),\r\n onMouseMove: wrapEvent(tooltipOnMouseMove, handleMouseMove),\r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CAACgB,QAAD,EAAWS,QAAX;EAHpB,GAICC,OAAO,IACT,CAACX,UAAU,CAAC,YAAD,CADT,IAC2B;IAAE,oBAAoBgC;EAAtB,CAL5B;IAMH7B,YAAY,EAAEjB,SAAS,CAACiB,YAAD,EAAea,gBAAf,CANpB;IAOHZ,YAAY,EAAElB,SAAS,CAACkB,YAAD,EAAec,gBAAf,CAPpB;IAQHb,WAAW,EAAEnB,SAAS,CAACmB,WAAD,EAAcY,eAAd,CARnB;IASHX,WAAW,EAAEpB,SAAS,CAACoB,WAAD,EAAca,eAAd,CATnB;IAUHX,OAAO,EAAEtB,SAAS,CAACsB,OAAD,EAAUY,WAAV,CAVf;IAWHX,MAAM,EAAEvB,SAAS,CAACuB,MAAD,EAASY,UAAT,CAXd;IAYHd,SAAS,EAAErB,SAAS,CAACqB,SAAD,EAAYgB,aAAZ;EAZjB;IAeHV,EAAE,EAAEmB,SAfD;IAgBHtB,QAAQ,EAARA,QAhBG;IAiBHC,OAAO,EAAPA,OAjBG;IAkBHe,QAAQ,EAARA,QAlBG;IAmBHvB,YAAY,EAAEjB,SAAS,CAAC0C,mBAAD,EAAsBZ,gBAAtB,CAnBpB;IAoBHZ,YAAY,EAAElB,SAAS,CAAC2C,mBAAD,EAAsBX,gBAAtB,CApBpB;IAqBHb,WAAW,EAAEnB,SAAS,CAAC4C,kBAAD,EAAqBb,eAArB,CArBnB;IAsBHiB,IAAI,EAAE;EAtBH,GAuBAH,iBAvBA,EAAP;AA0BD"}
1
+ {"version":3,"file":"useTooltip.js","names":["useRef","useEffect","useState","useId","assignMultipleRefs","wrapEvent","send","state","subscription","Blur","Focus","LeavingVisible","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","Visible","useTooltip","childProps","childRef","tooltipProps","onMouseEnter","onMouseLeave","onMouseMove","onMouseDown","onKeyDown","onFocus","onBlur","anchorEl","visible","setVisible","id","subscribe","current","handleMouseEnter","handleMouseMove","handleMouseLeave","handleMouseDown","handleFocus","handleBlur","undefined","handleKeyDown","event","key","label","children","tooltipOnMouseEnter","tooltipOnMouseLeave","tooltipOnMouseMove","otherTooltipProps","tooltipId","ref","role"],"sources":["../../../src/Tooltip/useTooltip.ts"],"sourcesContent":["import type {\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n Ref,\n RefAttributes,\n RefObject,\n} from 'react';\nimport { useRef, useEffect, useState, useId } from 'react';\n\nimport { assignMultipleRefs } from '../utils/assign-ref';\nimport { wrapEvent } from '../utils/wrap-event';\nimport {\n send,\n state,\n subscription,\n Blur,\n Focus,\n LeavingVisible,\n MouseDown,\n MouseEnter,\n MouseLeave,\n MouseMove,\n SelectWithKeyboard,\n Visible,\n} from './stateMachine';\n\nexport type ChildProps = HTMLAttributes<HTMLElement> &\n RefAttributes<HTMLElement>;\n\nexport interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {\n anchorEl: RefObject<HTMLElement | null>;\n visible: boolean;\n children?: ReactNode;\n}\n\nexport function useTooltip(\n childProps: ChildProps,\n childRef: Ref<HTMLElement> | undefined,\n tooltipProps: HTMLAttributes<HTMLElement> & { label?: ReactNode }\n): [ChildProps, InjectedTooltipProps] {\n const {\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onKeyDown,\n onFocus,\n onBlur,\n } = childProps;\n const anchorEl = useRef<HTMLElement>(null);\n const [visible, setVisible] = useState(false);\n const id = useId();\n\n useEffect(() => {\n subscription.subscribe(() => {\n setVisible(\n (state.current.state === Visible ||\n state.current.state === LeavingVisible) &&\n state.current.id === id\n );\n });\n }, [id]);\n\n function handleMouseEnter() {\n send(MouseEnter, { id });\n }\n\n function handleMouseMove() {\n send(MouseMove, { id });\n }\n\n function handleMouseLeave() {\n send(MouseLeave);\n }\n\n function handleMouseDown() {\n // Allow quick click from one tool to another\n if (state.current.id === id) {\n send(MouseDown);\n }\n }\n\n function handleFocus() {\n send(Focus, { id });\n }\n\n function handleBlur() {\n // Allow quick click from one tool to another\n if (state.current.id === id) {\n send(Blur, undefined);\n }\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLElement>) {\n if (event.key === 'Enter' || event.key === ' ') {\n send(SelectWithKeyboard);\n }\n }\n\n const {\n label: children,\n onMouseEnter: tooltipOnMouseEnter,\n onMouseLeave: tooltipOnMouseLeave,\n onMouseMove: tooltipOnMouseMove,\n ...otherTooltipProps\n } = tooltipProps;\n\n const tooltipId = `tooltip-${id}`;\n return [\n {\n ...childProps,\n ref: assignMultipleRefs(childRef, anchorEl),\n ...(visible &&\n !childProps['aria-label'] && { 'aria-describedby': tooltipId }),\n onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),\n onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),\n onMouseMove: wrapEvent(onMouseMove, handleMouseMove),\n onMouseDown: wrapEvent(onMouseDown, handleMouseDown),\n onFocus: wrapEvent(onFocus, handleFocus),\n onBlur: wrapEvent(onBlur, handleBlur),\n onKeyDown: wrapEvent(onKeyDown, handleKeyDown),\n },\n {\n id: tooltipId,\n anchorEl,\n visible,\n children,\n onMouseEnter: wrapEvent(tooltipOnMouseEnter, handleMouseEnter),\n onMouseLeave: wrapEvent(tooltipOnMouseLeave, handleMouseLeave),\n onMouseMove: wrapEvent(tooltipOnMouseMove, handleMouseMove),\n role: 'tooltip',\n ...otherTooltipProps,\n },\n ];\n}\n"],"mappings":"AAQA,SAASA,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,OAAO;AAE1D,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SACEC,IAAI,EACJC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,SAAS,EACTC,kBAAkB,EAClBC,OAAO,QACF,gBAAgB;AAWvB,OAAO,SAASC,UAAUA,CACxBC,UAAsB,EACtBC,QAAsC,EACtCC,YAAiE,EAC7B;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,YAAY,EAAElB,SAAS,CAAC2C,mBAAmB,EAAEX,gBAAgB,CAAC;IAC9Db,WAAW,EAAEnB,SAAS,CAAC4C,kBAAkB,EAAEb,eAAe,CAAC;IAC3DiB,IAAI,EAAE,SAAS;IACf,GAAGH;EACL,CAAC,CACF;AACH","ignoreList":[]}
@@ -1,13 +1,13 @@
1
- export * from './useAutoFocus';
2
- export * from './useControlledState';
3
- export * from './useChildrenCounter';
4
- export * from './useFocusReturn';
5
- export * from './useFocusState';
6
- export * from './useOnClickOutside';
7
- export * from './useOnKeyDown';
8
- export * from './useReducerMachine';
9
- export * from './useRemoveBodyScroll';
10
- export * from './useThrottle';
11
- export * from './useMeasure';
12
- export * from './useGestureHandlers';
13
- export * from './useScope';
1
+ export * from './useAutoFocus';
2
+ export * from './useControlledState';
3
+ export * from './useChildrenCounter';
4
+ export * from './useFocusReturn';
5
+ export * from './useFocusState';
6
+ export * from './useOnClickOutside';
7
+ export * from './useOnKeyDown';
8
+ export * from './useReducerMachine';
9
+ export * from './useRemoveBodyScroll';
10
+ export * from './useThrottle';
11
+ export * from './useMeasure';
12
+ export * from './useGestureHandlers';
13
+ export * from './useScope';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useAutoFocus';\r\nexport * from './useControlledState';\r\nexport * from './useChildrenCounter';\r\nexport * from './useFocusReturn';\r\nexport * from './useFocusState';\r\nexport * from './useOnClickOutside';\r\nexport * from './useOnKeyDown';\r\nexport * from './useReducerMachine';\r\nexport * from './useRemoveBodyScroll';\r\nexport * from './useThrottle';\r\nexport * from './useMeasure';\r\nexport * from './useGestureHandlers';\r\nexport * from './useScope';\r\n"],"mappings":"AAAA,cAAc,gBAAd;AACA,cAAc,sBAAd;AACA,cAAc,sBAAd;AACA,cAAc,kBAAd;AACA,cAAc,iBAAd;AACA,cAAc,qBAAd;AACA,cAAc,gBAAd;AACA,cAAc,qBAAd;AACA,cAAc,uBAAd;AACA,cAAc,eAAd;AACA,cAAc,cAAd;AACA,cAAc,sBAAd;AACA,cAAc,YAAd"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useAutoFocus';\nexport * from './useControlledState';\nexport * from './useChildrenCounter';\nexport * from './useFocusReturn';\nexport * from './useFocusState';\nexport * from './useOnClickOutside';\nexport * from './useOnKeyDown';\nexport * from './useReducerMachine';\nexport * from './useRemoveBodyScroll';\nexport * from './useThrottle';\nexport * from './useMeasure';\nexport * from './useGestureHandlers';\nexport * from './useScope';\n"],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,YAAY","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { MutableRefObject } from 'react';
2
- export declare function useAutoFocus(open: boolean, elementRef: MutableRefObject<HTMLElement | null>): void;
1
+ import type { MutableRefObject } from 'react';
2
+ export declare function useAutoFocus(open: boolean, elementRef: MutableRefObject<HTMLElement | null>): void;
@@ -1,14 +1,14 @@
1
1
  import { useEffect } from 'react';
2
2
  import { focusOnChildNode } from '../FocusLock/tabUtils';
3
3
  export function useAutoFocus(open, elementRef) {
4
- useEffect(function () {
4
+ useEffect(() => {
5
5
  if (open) {
6
6
  // We will only autoFocus on the first child if the currently active element isn't already trapped inside the modal
7
7
  if (elementRef.current && !elementRef.current.contains(document.activeElement)) {
8
8
  focusOnChildNode(elementRef.current, 0);
9
9
  }
10
- } // eslint-disable-next-line react-hooks/exhaustive-deps
11
-
10
+ }
11
+ // eslint-disable-next-line react-hooks/exhaustive-deps
12
12
  }, [open]);
13
13
  }
14
14
  //# sourceMappingURL=useAutoFocus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoFocus.js","names":["useEffect","focusOnChildNode","useAutoFocus","open","elementRef","current","contains","document","activeElement"],"sources":["../../../src/hooks/useAutoFocus.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\r\nimport { useEffect } from 'react';\r\n\r\nimport { focusOnChildNode } from '../FocusLock/tabUtils';\r\n\r\nexport function useAutoFocus(\r\n open: boolean,\r\n elementRef: MutableRefObject<HTMLElement | null>\r\n) {\r\n useEffect(() => {\r\n if (open) {\r\n // We will only autoFocus on the first child if the currently active element isn't already trapped inside the modal\r\n if (\r\n elementRef.current &&\r\n !elementRef.current.contains(document.activeElement)\r\n ) {\r\n focusOnChildNode(elementRef.current, 0);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [open]);\r\n}\r\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,OAA1B;AAEA,SAASC,gBAAT,QAAiC,uBAAjC;AAEA,OAAO,SAASC,YAAT,CACLC,IADK,EAELC,UAFK,EAGL;EACAJ,SAAS,CAAC,YAAM;IACd,IAAIG,IAAJ,EAAU;MACR;MACA,IACEC,UAAU,CAACC,OAAX,IACA,CAACD,UAAU,CAACC,OAAX,CAAmBC,QAAnB,CAA4BC,QAAQ,CAACC,aAArC,CAFH,EAGE;QACAP,gBAAgB,CAACG,UAAU,CAACC,OAAZ,EAAqB,CAArB,CAAhB;MACD;IACF,CATa,CAUd;;EACD,CAXQ,EAWN,CAACF,IAAD,CAXM,CAAT;AAYD"}
1
+ {"version":3,"file":"useAutoFocus.js","names":["useEffect","focusOnChildNode","useAutoFocus","open","elementRef","current","contains","document","activeElement"],"sources":["../../../src/hooks/useAutoFocus.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useEffect } from 'react';\n\nimport { focusOnChildNode } from '../FocusLock/tabUtils';\n\nexport function useAutoFocus(\n open: boolean,\n elementRef: MutableRefObject<HTMLElement | null>\n) {\n useEffect(() => {\n if (open) {\n // We will only autoFocus on the first child if the currently active element isn't already trapped inside the modal\n if (\n elementRef.current &&\n !elementRef.current.contains(document.activeElement)\n ) {\n focusOnChildNode(elementRef.current, 0);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,SAASC,YAAYA,CAC1BC,IAAa,EACbC,UAAgD,EAChD;EACAJ,SAAS,CAAC,MAAM;IACd,IAAIG,IAAI,EAAE;MACR;MACA,IACEC,UAAU,CAACC,OAAO,IAClB,CAACD,UAAU,CAACC,OAAO,CAACC,QAAQ,CAACC,QAAQ,CAACC,aAAa,CAAC,EACpD;QACAP,gBAAgB,CAACG,UAAU,CAACC,OAAO,EAAE,CAAC,CAAC;MACzC;IACF;IACA;EACF,CAAC,EAAE,CAACF,IAAI,CAAC,CAAC;AACZ","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import type { MutableRefObject } from 'react';
2
- export declare function useChildrenCounterParent<T>(itemsRef: MutableRefObject<T[] & {
3
- isNewRender?: boolean;
4
- }>): void;
5
- export declare function useChildrenCounterChild<T>(itemsRef: MutableRefObject<T[] & {
6
- isNewRender?: boolean;
7
- }> | undefined, itemIndexRef: MutableRefObject<number>, obj: T | ((idx: number) => T), disabled?: boolean): void;
1
+ import type { MutableRefObject } from 'react';
2
+ export declare function useChildrenCounterParent<T>(itemsRef: MutableRefObject<T[] & {
3
+ isNewRender?: boolean;
4
+ }>): void;
5
+ export declare function useChildrenCounterChild<T>(itemsRef: MutableRefObject<T[] & {
6
+ isNewRender?: boolean;
7
+ }> | undefined, itemIndexRef: MutableRefObject<number>, obj: T | ((idx: number) => T), disabled?: boolean): void;
@@ -6,32 +6,30 @@ export function useChildrenCounterParent(itemsRef) {
6
6
  // the array
7
7
  itemsRef.current = [];
8
8
  itemsRef.current.isNewRender = true;
9
- useEffect(function () {
9
+ useEffect(() => {
10
10
  // Rendering is finished. Meaning any children can now rerender,
11
11
  // and they should not push any new items to our array, because
12
12
  // it is not a new render
13
13
  itemsRef.current.isNewRender = false;
14
14
  });
15
- useEffect(function () {
15
+ useEffect(() => {
16
16
  // When we are unmounting, it means there are no children anymore.
17
17
  // Clear out our items array
18
- return function () {
18
+ return () => {
19
19
  itemsRef.current = [];
20
20
  };
21
21
  }, [itemsRef]);
22
22
  }
23
23
  export function useChildrenCounterChild(itemsRef, itemIndexRef, obj) {
24
- var disabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
25
-
24
+ let disabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
26
25
  if (itemsRef && itemsRef.current.isNewRender) {
27
26
  if (disabled) {
28
27
  itemIndexRef.current = -1;
29
28
  return;
30
- } // push this option to the optionsRef array
31
-
29
+ }
32
30
 
31
+ // push this option to the optionsRef array
33
32
  itemIndexRef.current = itemsRef.current.length;
34
-
35
33
  if (obj instanceof Function) {
36
34
  itemsRef.current.push(obj(itemIndexRef.current));
37
35
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"useChildrenCounter.js","names":["useEffect","useChildrenCounterParent","itemsRef","current","isNewRender","useChildrenCounterChild","itemIndexRef","obj","disabled","length","Function","push"],"sources":["../../../src/hooks/useChildrenCounter.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\r\nimport { useEffect } from 'react';\r\n\r\nexport function useChildrenCounterParent<T>(\r\n itemsRef: MutableRefObject<T[] & { isNewRender?: boolean }>\r\n) {\r\n // Reset the options ref every render so that they are always\r\n // accurate and ready for keyboard navigation handlers. Using layout\r\n // effect to schedule this effect before the ComboboxOptions push into\r\n // the array\r\n itemsRef.current = [];\r\n itemsRef.current.isNewRender = true;\r\n\r\n useEffect(() => {\r\n // Rendering is finished. Meaning any children can now rerender,\r\n // and they should not push any new items to our array, because\r\n // it is not a new render\r\n itemsRef.current.isNewRender = false;\r\n });\r\n\r\n useEffect(() => {\r\n // When we are unmounting, it means there are no children anymore.\r\n // Clear out our items array\r\n return () => {\r\n itemsRef.current = [];\r\n };\r\n }, [itemsRef]);\r\n}\r\n\r\nexport function useChildrenCounterChild<T>(\r\n itemsRef: MutableRefObject<T[] & { isNewRender?: boolean }> | undefined,\r\n itemIndexRef: MutableRefObject<number>,\r\n obj: T | ((idx: number) => T),\r\n disabled = false\r\n) {\r\n if (itemsRef && itemsRef.current.isNewRender) {\r\n if (disabled) {\r\n itemIndexRef.current = -1;\r\n return;\r\n }\r\n\r\n // push this option to the optionsRef array\r\n itemIndexRef.current = itemsRef.current.length;\r\n\r\n if (obj instanceof Function) {\r\n itemsRef.current.push(obj(itemIndexRef.current));\r\n } else {\r\n itemsRef.current.push(obj);\r\n }\r\n }\r\n}\r\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,OAA1B;AAEA,OAAO,SAASC,wBAAT,CACLC,QADK,EAEL;EACA;EACA;EACA;EACA;EACAA,QAAQ,CAACC,OAAT,GAAmB,EAAnB;EACAD,QAAQ,CAACC,OAAT,CAAiBC,WAAjB,GAA+B,IAA/B;EAEAJ,SAAS,CAAC,YAAM;IACd;IACA;IACA;IACAE,QAAQ,CAACC,OAAT,CAAiBC,WAAjB,GAA+B,KAA/B;EACD,CALQ,CAAT;EAOAJ,SAAS,CAAC,YAAM;IACd;IACA;IACA,OAAO,YAAM;MACXE,QAAQ,CAACC,OAAT,GAAmB,EAAnB;IACD,CAFD;EAGD,CANQ,EAMN,CAACD,QAAD,CANM,CAAT;AAOD;AAED,OAAO,SAASG,uBAAT,CACLH,QADK,EAELI,YAFK,EAGLC,GAHK,EAKL;EAAA,IADAC,QACA,uEADW,KACX;;EACA,IAAIN,QAAQ,IAAIA,QAAQ,CAACC,OAAT,CAAiBC,WAAjC,EAA8C;IAC5C,IAAII,QAAJ,EAAc;MACZF,YAAY,CAACH,OAAb,GAAuB,CAAC,CAAxB;MACA;IACD,CAJ2C,CAM5C;;;IACAG,YAAY,CAACH,OAAb,GAAuBD,QAAQ,CAACC,OAAT,CAAiBM,MAAxC;;IAEA,IAAIF,GAAG,YAAYG,QAAnB,EAA6B;MAC3BR,QAAQ,CAACC,OAAT,CAAiBQ,IAAjB,CAAsBJ,GAAG,CAACD,YAAY,CAACH,OAAd,CAAzB;IACD,CAFD,MAEO;MACLD,QAAQ,CAACC,OAAT,CAAiBQ,IAAjB,CAAsBJ,GAAtB;IACD;EACF;AACF"}
1
+ {"version":3,"file":"useChildrenCounter.js","names":["useEffect","useChildrenCounterParent","itemsRef","current","isNewRender","useChildrenCounterChild","itemIndexRef","obj","disabled","arguments","length","undefined","Function","push"],"sources":["../../../src/hooks/useChildrenCounter.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useEffect } from 'react';\n\nexport function useChildrenCounterParent<T>(\n itemsRef: MutableRefObject<T[] & { isNewRender?: boolean }>\n) {\n // Reset the options ref every render so that they are always\n // accurate and ready for keyboard navigation handlers. Using layout\n // effect to schedule this effect before the ComboboxOptions push into\n // the array\n itemsRef.current = [];\n itemsRef.current.isNewRender = true;\n\n useEffect(() => {\n // Rendering is finished. Meaning any children can now rerender,\n // and they should not push any new items to our array, because\n // it is not a new render\n itemsRef.current.isNewRender = false;\n });\n\n useEffect(() => {\n // When we are unmounting, it means there are no children anymore.\n // Clear out our items array\n return () => {\n itemsRef.current = [];\n };\n }, [itemsRef]);\n}\n\nexport function useChildrenCounterChild<T>(\n itemsRef: MutableRefObject<T[] & { isNewRender?: boolean }> | undefined,\n itemIndexRef: MutableRefObject<number>,\n obj: T | ((idx: number) => T),\n disabled = false\n) {\n if (itemsRef && itemsRef.current.isNewRender) {\n if (disabled) {\n itemIndexRef.current = -1;\n return;\n }\n\n // push this option to the optionsRef array\n itemIndexRef.current = itemsRef.current.length;\n\n if (obj instanceof Function) {\n itemsRef.current.push(obj(itemIndexRef.current));\n } else {\n itemsRef.current.push(obj);\n }\n }\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,OAAO;AAEjC,OAAO,SAASC,wBAAwBA,CACtCC,QAA2D,EAC3D;EACA;EACA;EACA;EACA;EACAA,QAAQ,CAACC,OAAO,GAAG,EAAE;EACrBD,QAAQ,CAACC,OAAO,CAACC,WAAW,GAAG,IAAI;EAEnCJ,SAAS,CAAC,MAAM;IACd;IACA;IACA;IACAE,QAAQ,CAACC,OAAO,CAACC,WAAW,GAAG,KAAK;EACtC,CAAC,CAAC;EAEFJ,SAAS,CAAC,MAAM;IACd;IACA;IACA,OAAO,MAAM;MACXE,QAAQ,CAACC,OAAO,GAAG,EAAE;IACvB,CAAC;EACH,CAAC,EAAE,CAACD,QAAQ,CAAC,CAAC;AAChB;AAEA,OAAO,SAASG,uBAAuBA,CACrCH,QAAuE,EACvEI,YAAsC,EACtCC,GAA6B,EAE7B;EAAA,IADAC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEhB,IAAIP,QAAQ,IAAIA,QAAQ,CAACC,OAAO,CAACC,WAAW,EAAE;IAC5C,IAAII,QAAQ,EAAE;MACZF,YAAY,CAACH,OAAO,GAAG,CAAC,CAAC;MACzB;IACF;;IAEA;IACAG,YAAY,CAACH,OAAO,GAAGD,QAAQ,CAACC,OAAO,CAACO,MAAM;IAE9C,IAAIH,GAAG,YAAYK,QAAQ,EAAE;MAC3BV,QAAQ,CAACC,OAAO,CAACU,IAAI,CAACN,GAAG,CAACD,YAAY,CAACH,OAAO,CAAC,CAAC;IAClD,CAAC,MAAM;MACLD,QAAQ,CAACC,OAAO,CAACU,IAAI,CAACN,GAAG,CAAC;IAC5B;EACF;AACF","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { Dispatch, SetStateAction, SyntheticEvent } from 'react';
2
- import type { CustomEventHandler } from '../utils';
3
- export declare function useControlledState<V, E extends SyntheticEvent<any> | Event, H extends unknown[]>(valueProp: V | undefined, onChangeProp: CustomEventHandler<E, H> | undefined, defaultValue: V | (() => V), defaultOnChange: (setValue: Dispatch<SetStateAction<V>>) => CustomEventHandler<E, H>): [V, CustomEventHandler<E, H>];
1
+ import type { Dispatch, SetStateAction, SyntheticEvent } from 'react';
2
+ import type { CustomEventHandler } from '../utils';
3
+ export declare function useControlledState<V, E extends SyntheticEvent<any> | Event, H extends unknown[]>(valueProp: V | undefined, onChangeProp: CustomEventHandler<E, H> | undefined, defaultValue: V | (() => V), defaultOnChange: (setValue: Dispatch<SetStateAction<V>>) => CustomEventHandler<E, H>): [V, CustomEventHandler<E, H>];
@@ -1,27 +1,17 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import { useRef, useState } from 'react';
3
2
  import { wrapEvent } from '../utils';
4
3
  export function useControlledState(valueProp, onChangeProp, defaultValue, defaultOnChange) {
5
- var isControlled = valueProp !== undefined;
6
- var wasControlled = useRef(isControlled);
7
- var hasWarned = useRef(false);
8
-
9
- var _useState = useState(defaultValue),
10
- _useState2 = _slicedToArray(_useState, 2),
11
- valueState = _useState2[0],
12
- setValueState = _useState2[1];
13
-
4
+ const isControlled = valueProp !== undefined;
5
+ const wasControlled = useRef(isControlled);
6
+ const hasWarned = useRef(false);
7
+ const [valueState, setValueState] = useState(defaultValue);
14
8
  if (isControlled) {
15
9
  if (!wasControlled.current && !hasWarned.current && process.env.NODE_ENV !== 'production') {
16
10
  console.warn('Trying to change from controlled to uncontrolled.');
17
11
  hasWarned.current = true;
18
12
  }
19
-
20
- return [// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
21
- valueProp, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
13
+ return [valueProp, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
22
14
  }
23
-
24
- return [// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
25
- valueState, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
15
+ return [valueState, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
26
16
  }
27
17
  //# sourceMappingURL=useControlledState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useControlledState.js","names":["useRef","useState","wrapEvent","useControlledState","valueProp","onChangeProp","defaultValue","defaultOnChange","isControlled","undefined","wasControlled","hasWarned","valueState","setValueState","current","process","env","NODE_ENV","console","warn"],"sources":["../../../src/hooks/useControlledState.ts"],"sourcesContent":["import type { Dispatch, SetStateAction, SyntheticEvent } from 'react';\nimport { useRef, useState } from 'react';\n\nimport type { CustomEventHandler } from '../utils';\nimport { wrapEvent } from '../utils';\n\nexport function useControlledState<\n V,\n E extends SyntheticEvent<any> | Event,\n H extends unknown[]\n>(\n valueProp: V | undefined,\n onChangeProp: CustomEventHandler<E, H> | undefined,\n defaultValue: V | (() => V),\n defaultOnChange: (\n setValue: Dispatch<SetStateAction<V>>\n ) => CustomEventHandler<E, H>\n): [V, CustomEventHandler<E, H>] {\n const isControlled = valueProp !== undefined;\n const wasControlled = useRef(isControlled);\n const hasWarned = useRef(false);\n const [valueState, setValueState] = useState<V>(defaultValue);\n\n if (isControlled) {\n if (\n !wasControlled.current &&\n !hasWarned.current &&\n process.env.NODE_ENV !== 'production'\n ) {\n console.warn('Trying to change from controlled to uncontrolled.');\n hasWarned.current = true;\n }\n return [\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n valueProp!,\n wrapEvent(onChangeProp, defaultOnChange(setValueState)),\n ];\n }\n\n return [\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n valueState!,\n wrapEvent(onChangeProp, defaultOnChange(setValueState)),\n ];\n}\n"],"mappings":";AACA,SAASA,MAAT,EAAiBC,QAAjB,QAAiC,OAAjC;AAGA,SAASC,SAAT,QAA0B,UAA1B;AAEA,OAAO,SAASC,kBAAT,CAKLC,SALK,EAMLC,YANK,EAOLC,YAPK,EAQLC,eARK,EAW0B;EAC/B,IAAMC,YAAY,GAAGJ,SAAS,KAAKK,SAAnC;EACA,IAAMC,aAAa,GAAGV,MAAM,CAACQ,YAAD,CAA5B;EACA,IAAMG,SAAS,GAAGX,MAAM,CAAC,KAAD,CAAxB;;EACA,gBAAoCC,QAAQ,CAAIK,YAAJ,CAA5C;EAAA;EAAA,IAAOM,UAAP;EAAA,IAAmBC,aAAnB;;EAEA,IAAIL,YAAJ,EAAkB;IAChB,IACE,CAACE,aAAa,CAACI,OAAf,IACA,CAACH,SAAS,CAACG,OADX,IAEAC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAH3B,EAIE;MACAC,OAAO,CAACC,IAAR,CAAa,mDAAb;MACAR,SAAS,CAACG,OAAV,GAAoB,IAApB;IACD;;IACD,OAAO,CACL;IACAV,SAFK,EAGLF,SAAS,CAACG,YAAD,EAAeE,eAAe,CAACM,aAAD,CAA9B,CAHJ,CAAP;EAKD;;EAED,OAAO,CACL;EACAD,UAFK,EAGLV,SAAS,CAACG,YAAD,EAAeE,eAAe,CAACM,aAAD,CAA9B,CAHJ,CAAP;AAKD"}
1
+ {"version":3,"file":"useControlledState.js","names":["useRef","useState","wrapEvent","useControlledState","valueProp","onChangeProp","defaultValue","defaultOnChange","isControlled","undefined","wasControlled","hasWarned","valueState","setValueState","current","process","env","NODE_ENV","console","warn"],"sources":["../../../src/hooks/useControlledState.ts"],"sourcesContent":["import type { Dispatch, SetStateAction, SyntheticEvent } from 'react';\nimport { useRef, useState } from 'react';\n\nimport type { CustomEventHandler } from '../utils';\nimport { wrapEvent } from '../utils';\n\nexport function useControlledState<\n V,\n E extends SyntheticEvent<any> | Event,\n H extends unknown[]\n>(\n valueProp: V | undefined,\n onChangeProp: CustomEventHandler<E, H> | undefined,\n defaultValue: V | (() => V),\n defaultOnChange: (\n setValue: Dispatch<SetStateAction<V>>\n ) => CustomEventHandler<E, H>\n): [V, CustomEventHandler<E, H>] {\n const isControlled = valueProp !== undefined;\n const wasControlled = useRef(isControlled);\n const hasWarned = useRef(false);\n const [valueState, setValueState] = useState<V>(defaultValue);\n\n if (isControlled) {\n if (\n !wasControlled.current &&\n !hasWarned.current &&\n process.env.NODE_ENV !== 'production'\n ) {\n console.warn('Trying to change from controlled to uncontrolled.');\n hasWarned.current = true;\n }\n return [\n valueProp!,\n wrapEvent(onChangeProp, defaultOnChange(setValueState)),\n ];\n }\n\n return [valueState!, wrapEvent(onChangeProp, defaultOnChange(setValueState))];\n}\n"],"mappings":"AACA,SAASA,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGxC,SAASC,SAAS,QAAQ,UAAU;AAEpC,OAAO,SAASC,kBAAkBA,CAKhCC,SAAwB,EACxBC,YAAkD,EAClDC,YAA2B,EAC3BC,eAE6B,EACE;EAC/B,MAAMC,YAAY,GAAGJ,SAAS,KAAKK,SAAS;EAC5C,MAAMC,aAAa,GAAGV,MAAM,CAACQ,YAAY,CAAC;EAC1C,MAAMG,SAAS,GAAGX,MAAM,CAAC,KAAK,CAAC;EAC/B,MAAM,CAACY,UAAU,EAAEC,aAAa,CAAC,GAAGZ,QAAQ,CAAIK,YAAY,CAAC;EAE7D,IAAIE,YAAY,EAAE;IAChB,IACE,CAACE,aAAa,CAACI,OAAO,IACtB,CAACH,SAAS,CAACG,OAAO,IAClBC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EACrC;MACAC,OAAO,CAACC,IAAI,CAAC,mDAAmD,CAAC;MACjER,SAAS,CAACG,OAAO,GAAG,IAAI;IAC1B;IACA,OAAO,CACLV,SAAS,EACTF,SAAS,CAACG,YAAY,EAAEE,eAAe,CAACM,aAAa,CAAC,CAAC,CACxD;EACH;EAEA,OAAO,CAACD,UAAU,EAAGV,SAAS,CAACG,YAAY,EAAEE,eAAe,CAACM,aAAa,CAAC,CAAC,CAAC;AAC/E","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { MutableRefObject } from 'react';
2
- export declare function useFocusReturn(open: boolean, rootEl: MutableRefObject<HTMLElement | null>): void;
1
+ import type { MutableRefObject } from 'react';
2
+ export declare function useFocusReturn(open: boolean, rootEl: MutableRefObject<HTMLElement | null>): void;
@@ -1,27 +1,23 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  export function useFocusReturn(open, rootEl) {
3
- var previousFocusRef = useRef(function () {
3
+ const previousFocusRef = useRef((() => {
4
4
  if (open && typeof document !== 'undefined' && document.activeElement instanceof HTMLElement) {
5
5
  return document.activeElement;
6
6
  }
7
-
8
7
  return null;
9
- }());
10
- useEffect(function () {
8
+ })());
9
+ useEffect(() => {
11
10
  if (open) {
12
- var _rootEl$current;
13
-
14
11
  // once opened, keep track of the element that triggered
15
12
  // the Modal opening
16
- if (!previousFocusRef.current && document.activeElement instanceof HTMLElement && !((_rootEl$current = rootEl.current) !== null && _rootEl$current !== void 0 && _rootEl$current.contains(document.activeElement))) {
13
+ if (!previousFocusRef.current && document.activeElement instanceof HTMLElement && !rootEl.current?.contains(document.activeElement)) {
17
14
  previousFocusRef.current = document.activeElement;
18
15
  }
19
-
20
- var rootElement = rootEl.current;
21
- var previousElement = previousFocusRef.current;
22
- return function () {
16
+ const rootElement = rootEl.current;
17
+ const previousElement = previousFocusRef.current;
18
+ return () => {
23
19
  // on unmount, return focus to that element
24
- if (previousElement && !(rootElement !== null && rootElement !== void 0 && rootElement.contains(document.activeElement))) {
20
+ if (previousElement && !rootElement?.contains(document.activeElement)) {
25
21
  previousElement.focus({
26
22
  preventScroll: true
27
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusReturn.js","names":["useEffect","useRef","useFocusReturn","open","rootEl","previousFocusRef","document","activeElement","HTMLElement","current","contains","rootElement","previousElement","focus","preventScroll"],"sources":["../../../src/hooks/useFocusReturn.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\r\nimport { useEffect, useRef } from 'react';\r\n\r\nexport function useFocusReturn(\r\n open: boolean,\r\n rootEl: MutableRefObject<HTMLElement | null>\r\n) {\r\n const previousFocusRef = useRef<HTMLElement | null>(\r\n (() => {\r\n if (\r\n open &&\r\n typeof document !== 'undefined' &&\r\n document.activeElement instanceof HTMLElement\r\n ) {\r\n return document.activeElement;\r\n }\r\n return null;\r\n })()\r\n );\r\n\r\n useEffect(() => {\r\n if (open) {\r\n // once opened, keep track of the element that triggered\r\n // the Modal opening\r\n if (\r\n !previousFocusRef.current &&\r\n document.activeElement instanceof HTMLElement &&\r\n !rootEl.current?.contains(document.activeElement)\r\n ) {\r\n previousFocusRef.current = document.activeElement;\r\n }\r\n\r\n const rootElement = rootEl.current;\r\n const previousElement = previousFocusRef.current;\r\n return () => {\r\n // on unmount, return focus to that element\r\n if (previousElement && !rootElement?.contains(document.activeElement)) {\r\n previousElement.focus({ preventScroll: true });\r\n }\r\n };\r\n }\r\n }, [open, rootEl]);\r\n}\r\n"],"mappings":"AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AAEA,OAAO,SAASC,cAAT,CACLC,IADK,EAELC,MAFK,EAGL;EACA,IAAMC,gBAAgB,GAAGJ,MAAM,CAC5B,YAAM;IACL,IACEE,IAAI,IACJ,OAAOG,QAAP,KAAoB,WADpB,IAEAA,QAAQ,CAACC,aAAT,YAAkCC,WAHpC,EAIE;MACA,OAAOF,QAAQ,CAACC,aAAhB;IACD;;IACD,OAAO,IAAP;EACD,CATD,EAD6B,CAA/B;EAaAP,SAAS,CAAC,YAAM;IACd,IAAIG,IAAJ,EAAU;MAAA;;MACR;MACA;MACA,IACE,CAACE,gBAAgB,CAACI,OAAlB,IACAH,QAAQ,CAACC,aAAT,YAAkCC,WADlC,IAEA,qBAACJ,MAAM,CAACK,OAAR,4CAAC,gBAAgBC,QAAhB,CAAyBJ,QAAQ,CAACC,aAAlC,CAAD,CAHF,EAIE;QACAF,gBAAgB,CAACI,OAAjB,GAA2BH,QAAQ,CAACC,aAApC;MACD;;MAED,IAAMI,WAAW,GAAGP,MAAM,CAACK,OAA3B;MACA,IAAMG,eAAe,GAAGP,gBAAgB,CAACI,OAAzC;MACA,OAAO,YAAM;QACX;QACA,IAAIG,eAAe,IAAI,EAACD,WAAD,aAACA,WAAD,eAACA,WAAW,CAAED,QAAb,CAAsBJ,QAAQ,CAACC,aAA/B,CAAD,CAAvB,EAAuE;UACrEK,eAAe,CAACC,KAAhB,CAAsB;YAAEC,aAAa,EAAE;UAAjB,CAAtB;QACD;MACF,CALD;IAMD;EACF,CArBQ,EAqBN,CAACX,IAAD,EAAOC,MAAP,CArBM,CAAT;AAsBD"}
1
+ {"version":3,"file":"useFocusReturn.js","names":["useEffect","useRef","useFocusReturn","open","rootEl","previousFocusRef","document","activeElement","HTMLElement","current","contains","rootElement","previousElement","focus","preventScroll"],"sources":["../../../src/hooks/useFocusReturn.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\nexport function useFocusReturn(\n open: boolean,\n rootEl: MutableRefObject<HTMLElement | null>\n) {\n const previousFocusRef = useRef<HTMLElement | null>(\n (() => {\n if (\n open &&\n typeof document !== 'undefined' &&\n document.activeElement instanceof HTMLElement\n ) {\n return document.activeElement;\n }\n return null;\n })()\n );\n\n useEffect(() => {\n if (open) {\n // once opened, keep track of the element that triggered\n // the Modal opening\n if (\n !previousFocusRef.current &&\n document.activeElement instanceof HTMLElement &&\n !rootEl.current?.contains(document.activeElement)\n ) {\n previousFocusRef.current = document.activeElement;\n }\n\n const rootElement = rootEl.current;\n const previousElement = previousFocusRef.current;\n return () => {\n // on unmount, return focus to that element\n if (previousElement && !rootElement?.contains(document.activeElement)) {\n previousElement.focus({ preventScroll: true });\n }\n };\n }\n }, [open, rootEl]);\n}\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAO,SAASC,cAAcA,CAC5BC,IAAa,EACbC,MAA4C,EAC5C;EACA,MAAMC,gBAAgB,GAAGJ,MAAM,CAC7B,CAAC,MAAM;IACL,IACEE,IAAI,IACJ,OAAOG,QAAQ,KAAK,WAAW,IAC/BA,QAAQ,CAACC,aAAa,YAAYC,WAAW,EAC7C;MACA,OAAOF,QAAQ,CAACC,aAAa;IAC/B;IACA,OAAO,IAAI;EACb,CAAC,EAAE,CACL,CAAC;EAEDP,SAAS,CAAC,MAAM;IACd,IAAIG,IAAI,EAAE;MACR;MACA;MACA,IACE,CAACE,gBAAgB,CAACI,OAAO,IACzBH,QAAQ,CAACC,aAAa,YAAYC,WAAW,IAC7C,CAACJ,MAAM,CAACK,OAAO,EAAEC,QAAQ,CAACJ,QAAQ,CAACC,aAAa,CAAC,EACjD;QACAF,gBAAgB,CAACI,OAAO,GAAGH,QAAQ,CAACC,aAAa;MACnD;MAEA,MAAMI,WAAW,GAAGP,MAAM,CAACK,OAAO;MAClC,MAAMG,eAAe,GAAGP,gBAAgB,CAACI,OAAO;MAChD,OAAO,MAAM;QACX;QACA,IAAIG,eAAe,IAAI,CAACD,WAAW,EAAED,QAAQ,CAACJ,QAAQ,CAACC,aAAa,CAAC,EAAE;UACrEK,eAAe,CAACC,KAAK,CAAC;YAAEC,aAAa,EAAE;UAAK,CAAC,CAAC;QAChD;MACF,CAAC;IACH;EACF,CAAC,EAAE,CAACX,IAAI,EAAEC,MAAM,CAAC,CAAC;AACpB","ignoreList":[]}
@@ -1,11 +1,11 @@
1
- import type { FocusEventHandler } from 'react';
2
- export declare function useFocusState<T>(props?: {
3
- onFocus?: FocusEventHandler<T>;
4
- onBlur?: FocusEventHandler<T>;
5
- }): {
6
- bind: {
7
- onFocus: import("../utils/wrap-event").CustomEventHandler<import("react").FocusEvent<T, Element>, []>;
8
- onBlur: import("../utils/wrap-event").CustomEventHandler<import("react").FocusEvent<T, Element>, []>;
9
- };
10
- hasFocus: boolean;
11
- };
1
+ import type { FocusEventHandler } from 'react';
2
+ export declare function useFocusState<T>(props?: {
3
+ onFocus?: FocusEventHandler<T>;
4
+ onBlur?: FocusEventHandler<T>;
5
+ }): {
6
+ bind: {
7
+ onFocus: import("..").CustomEventHandler<import("react").FocusEvent<T, Element>, []>;
8
+ onBlur: import("..").CustomEventHandler<import("react").FocusEvent<T, Element>, []>;
9
+ };
10
+ hasFocus: boolean;
11
+ };