@basic-ui/core 0.0.54 → 0.0.56

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 +6 -6
  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":"context.js","names":["useMemo","createContext","ReactCreateContext","useContext","useReactContext","rootName","defaultContext","Ctx","Provider","props","children","context","value","Object","values","childName","Error","displayName"],"sources":["../../../src/utils/context.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from 'react';\r\nimport {\r\n useMemo,\r\n createContext as ReactCreateContext,\r\n useContext as useReactContext,\r\n} from 'react';\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n\r\ntype ContextProvider<T> = FC<PropsWithChildren<T>>;\r\n\r\nexport function createContext<ContextValueType extends object | null>(\r\n rootName: string,\r\n defaultContext?: ContextValueType\r\n): [\r\n ContextProvider<ContextValueType>,\r\n (childName: string) => ContextValueType\r\n] {\r\n const Ctx = ReactCreateContext<ContextValueType | undefined>(defaultContext);\r\n\r\n function Provider(props: PropsWithChildren<ContextValueType>) {\r\n const { children, ...context } = props;\r\n const value = useMemo(\r\n () => context,\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n Object.values(context)\r\n ) as ContextValueType;\r\n return <Ctx.Provider value={value}>{children}</Ctx.Provider>;\r\n }\r\n\r\n function useContext(childName: string) {\r\n const context = useReactContext(Ctx);\r\n if (context) {\r\n return context;\r\n }\r\n if (defaultContext) {\r\n return defaultContext;\r\n }\r\n throw Error(\r\n `${childName} must be rendered inside of a ${rootName} component.`\r\n );\r\n }\r\n\r\n Ctx.displayName = `${rootName}Context`;\r\n Provider.displayName = `${rootName}Provider`;\r\n\r\n return [Provider, useContext];\r\n}\r\n"],"mappings":";;AACA,SACEA,OADF,EAEEC,aAAa,IAAIC,kBAFnB,EAGEC,UAAU,IAAIC,eAHhB,QAIO,OAJP,C,CAMA;;;AAIA,OAAO,SAASH,aAAT,CACLI,QADK,EAELC,cAFK,EAML;EACA,IAAMC,GAAG,gBAAGL,kBAAkB,CAA+BI,cAA/B,CAA9B;;EAEA,SAASE,QAAT,CAAkBC,KAAlB,EAA8D;IAC5D,IAAQC,QAAR,GAAiCD,KAAjC,CAAQC,QAAR;IAAA,IAAqBC,OAArB,4BAAiCF,KAAjC;;IACA,IAAMG,KAAK,GAAGZ,OAAO,CACnB;MAAA,OAAMW,OAAN;IAAA,CADmB,EAEnB;IACAE,MAAM,CAACC,MAAP,CAAcH,OAAd,CAHmB,CAArB;IAKA,oBAAO,KAAC,GAAD,CAAK,QAAL;MAAc,KAAK,EAAEC,KAArB;MAAA,UAA6BF;IAA7B,EAAP;EACD;;EAED,SAASP,UAAT,CAAoBY,SAApB,EAAuC;IACrC,IAAMJ,OAAO,GAAGP,eAAe,CAACG,GAAD,CAA/B;;IACA,IAAII,OAAJ,EAAa;MACX,OAAOA,OAAP;IACD;;IACD,IAAIL,cAAJ,EAAoB;MAClB,OAAOA,cAAP;IACD;;IACD,MAAMU,KAAK,WACND,SADM,2CACoCV,QADpC,iBAAX;EAGD;;EAEDE,GAAG,CAACU,WAAJ,aAAqBZ,QAArB;EACAG,QAAQ,CAACS,WAAT,aAA0BZ,QAA1B;EAEA,OAAO,CAACG,QAAD,EAAWL,UAAX,CAAP;AACD"}
1
+ {"version":3,"file":"context.js","names":["useMemo","createContext","ReactCreateContext","useContext","useReactContext","jsx","_jsx","rootName","defaultContext","Ctx","Provider","props","children","context","value","Object","values","childName","Error","displayName"],"sources":["../../../src/utils/context.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from 'react';\nimport {\n useMemo,\n createContext as ReactCreateContext,\n useContext as useReactContext,\n} from 'react';\n\n////////////////////////////////////////////////////////////////////////////////\n\ntype ContextProvider<T> = FC<PropsWithChildren<T>>;\n\nexport function createContext<ContextValueType extends object | null>(\n rootName: string,\n defaultContext?: ContextValueType\n): [\n ContextProvider<ContextValueType>,\n (childName: string) => ContextValueType\n] {\n const Ctx = ReactCreateContext<ContextValueType | undefined>(defaultContext);\n\n function Provider(props: PropsWithChildren<ContextValueType>) {\n const { children, ...context } = props;\n const value = useMemo(\n () => context,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(context)\n ) as ContextValueType;\n return <Ctx.Provider value={value}>{children}</Ctx.Provider>;\n }\n\n function useContext(childName: string) {\n const context = useReactContext(Ctx);\n if (context) {\n return context;\n }\n if (defaultContext) {\n return defaultContext;\n }\n throw Error(\n `${childName} must be rendered inside of a ${rootName} component.`\n );\n }\n\n Ctx.displayName = `${rootName}Context`;\n Provider.displayName = `${rootName}Provider`;\n\n return [Provider, useContext];\n}\n"],"mappings":"AACA,SACEA,OAAO,EACPC,aAAa,IAAIC,kBAAkB,EACnCC,UAAU,IAAIC,eAAe,QACxB,OAAO;;AAEd;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAIA,OAAO,SAASL,aAAaA,CAC3BM,QAAgB,EAChBC,cAAiC,EAIjC;EACA,MAAMC,GAAG,gBAAGP,kBAAkB,CAA+BM,cAAc,CAAC;EAE5E,SAASE,QAAQA,CAACC,KAA0C,EAAE;IAC5D,MAAM;MAAEC,QAAQ;MAAE,GAAGC;IAAQ,CAAC,GAAGF,KAAK;IACtC,MAAMG,KAAK,GAAGd,OAAO,CACnB,MAAMa,OAAO;IACb;IACAE,MAAM,CAACC,MAAM,CAACH,OAAO,CACvB,CAAqB;IACrB,oBAAOP,IAAA,CAACG,GAAG,CAACC,QAAQ;MAACI,KAAK,EAAEA,KAAM;MAAAF,QAAA,EAAEA;IAAQ,CAAe,CAAC;EAC9D;EAEA,SAAST,UAAUA,CAACc,SAAiB,EAAE;IACrC,MAAMJ,OAAO,GAAGT,eAAe,CAACK,GAAG,CAAC;IACpC,IAAII,OAAO,EAAE;MACX,OAAOA,OAAO;IAChB;IACA,IAAIL,cAAc,EAAE;MAClB,OAAOA,cAAc;IACvB;IACA,MAAMU,KAAK,CACT,GAAGD,SAAS,iCAAiCV,QAAQ,aACvD,CAAC;EACH;EAEAE,GAAG,CAACU,WAAW,GAAG,GAAGZ,QAAQ,SAAS;EACtCG,QAAQ,CAACS,WAAW,GAAG,GAAGZ,QAAQ,UAAU;EAE5C,OAAO,CAACG,QAAQ,EAAEP,UAAU,CAAC;AAC/B","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- export declare function createSubscription(): {
2
- subscribe: (fn: () => void) => () => void;
3
- notify: () => void;
4
- };
1
+ export declare function createSubscription(): {
2
+ subscribe: (fn: () => void) => () => void;
3
+ notify: () => void;
4
+ };
@@ -1,22 +1,17 @@
1
1
  export function createSubscription() {
2
- var subscriptions = [];
3
-
2
+ const subscriptions = [];
4
3
  function subscribe(fn) {
5
4
  subscriptions.push(fn);
6
- return function () {
5
+ return () => {
7
6
  subscriptions.splice(subscriptions.indexOf(fn), 1);
8
7
  };
9
8
  }
10
-
11
9
  function notify() {
12
- subscriptions.forEach(function (fn) {
13
- return fn();
14
- });
10
+ subscriptions.forEach(fn => fn());
15
11
  }
16
-
17
12
  return {
18
- subscribe: subscribe,
19
- notify: notify
13
+ subscribe,
14
+ notify
20
15
  };
21
16
  }
22
17
  //# sourceMappingURL=create-subscription.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-subscription.js","names":["createSubscription","subscriptions","subscribe","fn","push","splice","indexOf","notify","forEach"],"sources":["../../../src/utils/create-subscription.ts"],"sourcesContent":["export function createSubscription() {\r\n const subscriptions: (() => void)[] = [];\r\n\r\n function subscribe(fn: () => void) {\r\n subscriptions.push(fn);\r\n return () => {\r\n subscriptions.splice(subscriptions.indexOf(fn), 1);\r\n };\r\n }\r\n\r\n function notify() {\r\n subscriptions.forEach((fn) => fn());\r\n }\r\n\r\n return { subscribe, notify };\r\n}\r\n"],"mappings":"AAAA,OAAO,SAASA,kBAAT,GAA8B;EACnC,IAAMC,aAA6B,GAAG,EAAtC;;EAEA,SAASC,SAAT,CAAmBC,EAAnB,EAAmC;IACjCF,aAAa,CAACG,IAAd,CAAmBD,EAAnB;IACA,OAAO,YAAM;MACXF,aAAa,CAACI,MAAd,CAAqBJ,aAAa,CAACK,OAAd,CAAsBH,EAAtB,CAArB,EAAgD,CAAhD;IACD,CAFD;EAGD;;EAED,SAASI,MAAT,GAAkB;IAChBN,aAAa,CAACO,OAAd,CAAsB,UAACL,EAAD;MAAA,OAAQA,EAAE,EAAV;IAAA,CAAtB;EACD;;EAED,OAAO;IAAED,SAAS,EAATA,SAAF;IAAaK,MAAM,EAANA;EAAb,CAAP;AACD"}
1
+ {"version":3,"file":"create-subscription.js","names":["createSubscription","subscriptions","subscribe","fn","push","splice","indexOf","notify","forEach"],"sources":["../../../src/utils/create-subscription.ts"],"sourcesContent":["export function createSubscription() {\n const subscriptions: (() => void)[] = [];\n\n function subscribe(fn: () => void) {\n subscriptions.push(fn);\n return () => {\n subscriptions.splice(subscriptions.indexOf(fn), 1);\n };\n }\n\n function notify() {\n subscriptions.forEach((fn) => fn());\n }\n\n return { subscribe, notify };\n}\n"],"mappings":"AAAA,OAAO,SAASA,kBAAkBA,CAAA,EAAG;EACnC,MAAMC,aAA6B,GAAG,EAAE;EAExC,SAASC,SAASA,CAACC,EAAc,EAAE;IACjCF,aAAa,CAACG,IAAI,CAACD,EAAE,CAAC;IACtB,OAAO,MAAM;MACXF,aAAa,CAACI,MAAM,CAACJ,aAAa,CAACK,OAAO,CAACH,EAAE,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;EACH;EAEA,SAASI,MAAMA,CAAA,EAAG;IAChBN,aAAa,CAACO,OAAO,CAAEL,EAAE,IAAKA,EAAE,CAAC,CAAC,CAAC;EACrC;EAEA,OAAO;IAAED,SAAS;IAAEK;EAAO,CAAC;AAC9B","ignoreList":[]}
@@ -1 +1 @@
1
- export declare function getCircularIndex(index: number, maxLength: number): number | null;
1
+ export declare function getCircularIndex(index: number, maxLength: number): number | null;
@@ -2,7 +2,6 @@ export function getCircularIndex(index, maxLength) {
2
2
  if (maxLength < 0) {
3
3
  return null;
4
4
  }
5
-
6
5
  return (index % maxLength + maxLength) % maxLength;
7
6
  }
8
7
  //# sourceMappingURL=get-circular-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-circular-index.js","names":["getCircularIndex","index","maxLength"],"sources":["../../../src/utils/get-circular-index.ts"],"sourcesContent":["export function getCircularIndex(index: number, maxLength: number) {\r\n if (maxLength < 0) {\r\n return null;\r\n }\r\n\r\n return ((index % maxLength) + maxLength) % maxLength;\r\n}\r\n"],"mappings":"AAAA,OAAO,SAASA,gBAAT,CAA0BC,KAA1B,EAAyCC,SAAzC,EAA4D;EACjE,IAAIA,SAAS,GAAG,CAAhB,EAAmB;IACjB,OAAO,IAAP;EACD;;EAED,OAAO,CAAED,KAAK,GAAGC,SAAT,GAAsBA,SAAvB,IAAoCA,SAA3C;AACD"}
1
+ {"version":3,"file":"get-circular-index.js","names":["getCircularIndex","index","maxLength"],"sources":["../../../src/utils/get-circular-index.ts"],"sourcesContent":["export function getCircularIndex(index: number, maxLength: number) {\n if (maxLength < 0) {\n return null;\n }\n\n return ((index % maxLength) + maxLength) % maxLength;\n}\n"],"mappings":"AAAA,OAAO,SAASA,gBAAgBA,CAACC,KAAa,EAAEC,SAAiB,EAAE;EACjE,IAAIA,SAAS,GAAG,CAAC,EAAE;IACjB,OAAO,IAAI;EACb;EAEA,OAAO,CAAED,KAAK,GAAGC,SAAS,GAAIA,SAAS,IAAIA,SAAS;AACtD","ignoreList":[]}
@@ -1,10 +1,10 @@
1
- export * from './assign-ref';
2
- export * from './can-use-dom';
3
- export * from './context';
4
- export * from './get-circular-index';
5
- export * from './is-right-click';
6
- export * from './owner-document';
7
- export * from './polymorphic';
8
- export * from './rubber-band-clamp';
9
- export * from './use-stable-callback';
10
- export * from './wrap-event';
1
+ export * from './assign-ref';
2
+ export * from './can-use-dom';
3
+ export * from './context';
4
+ export * from './get-circular-index';
5
+ export * from './is-right-click';
6
+ export * from './owner-document';
7
+ export * from './polymorphic';
8
+ export * from './rubber-band-clamp';
9
+ export * from './use-stable-callback';
10
+ export * from './wrap-event';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './assign-ref';\r\nexport * from './can-use-dom';\r\nexport * from './context';\r\nexport * from './get-circular-index';\r\nexport * from './is-right-click';\r\nexport * from './owner-document';\r\nexport * from './polymorphic';\r\nexport * from './rubber-band-clamp';\r\nexport * from './use-stable-callback';\r\nexport * from './wrap-event';\r\n"],"mappings":"AAAA,cAAc,cAAd;AACA,cAAc,eAAd;AACA,cAAc,WAAd;AACA,cAAc,sBAAd;AACA,cAAc,kBAAd;AACA,cAAc,kBAAd;AACA,cAAc,eAAd;AACA,cAAc,qBAAd;AACA,cAAc,uBAAd;AACA,cAAc,cAAd"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './assign-ref';\nexport * from './can-use-dom';\nexport * from './context';\nexport * from './get-circular-index';\nexport * from './is-right-click';\nexport * from './owner-document';\nexport * from './polymorphic';\nexport * from './rubber-band-clamp';\nexport * from './use-stable-callback';\nexport * from './wrap-event';\n"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,cAAc","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- /**
2
- * Detects right clicks
3
- *
4
- * @param nativeEvent
5
- */
6
- export declare function isRightClick(nativeEvent: MouseEvent | PointerEvent | TouchEvent): boolean;
1
+ /**
2
+ * Detects right clicks
3
+ *
4
+ * @param nativeEvent
5
+ */
6
+ export declare function isRightClick(nativeEvent: MouseEvent | PointerEvent | TouchEvent): boolean;
@@ -1,7 +1,7 @@
1
- /**
2
- * Detects right clicks
3
- *
4
- * @param nativeEvent
1
+ /**
2
+ * Detects right clicks
3
+ *
4
+ * @param nativeEvent
5
5
  */
6
6
  export function isRightClick(nativeEvent) {
7
7
  return 'which' in nativeEvent ? nativeEvent.which === 3 : 'button' in nativeEvent ? nativeEvent.button === 2 : false;
@@ -1 +1 @@
1
- {"version":3,"file":"is-right-click.js","names":["isRightClick","nativeEvent","which","button"],"sources":["../../../src/utils/is-right-click.ts"],"sourcesContent":["/**\r\n * Detects right clicks\r\n *\r\n * @param nativeEvent\r\n */\r\nexport function isRightClick(\r\n nativeEvent: MouseEvent | PointerEvent | TouchEvent\r\n) {\r\n return 'which' in nativeEvent\r\n ? nativeEvent.which === 3\r\n : 'button' in nativeEvent\r\n ? (nativeEvent as any).button === 2\r\n : false;\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAT,CACLC,WADK,EAEL;EACA,OAAO,WAAWA,WAAX,GACHA,WAAW,CAACC,KAAZ,KAAsB,CADnB,GAEH,YAAYD,WAAZ,GACCA,WAAD,CAAqBE,MAArB,KAAgC,CADhC,GAEA,KAJJ;AAKD"}
1
+ {"version":3,"file":"is-right-click.js","names":["isRightClick","nativeEvent","which","button"],"sources":["../../../src/utils/is-right-click.ts"],"sourcesContent":["/**\n * Detects right clicks\n *\n * @param nativeEvent\n */\nexport function isRightClick(\n nativeEvent: MouseEvent | PointerEvent | TouchEvent\n) {\n return 'which' in nativeEvent\n ? nativeEvent.which === 3\n : 'button' in nativeEvent\n ? (nativeEvent as any).button === 2\n : false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAC1BC,WAAmD,EACnD;EACA,OAAO,OAAO,IAAIA,WAAW,GACzBA,WAAW,CAACC,KAAK,KAAK,CAAC,GACvB,QAAQ,IAAID,WAAW,GACtBA,WAAW,CAASE,MAAM,KAAK,CAAC,GACjC,KAAK;AACX","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- /**
2
- * Get an element's owner document. Useful when components are used in iframes
3
- * or other environments like dev tools.
4
- *
5
- * @param element
6
- */
7
- export declare function getOwnerDocument<T extends Element>(element: T | null | undefined): Document | null;
1
+ /**
2
+ * Get an element's owner document. Useful when components are used in iframes
3
+ * or other environments like dev tools.
4
+ *
5
+ * @param element
6
+ */
7
+ export declare function getOwnerDocument<T extends Element>(element: T | null | undefined): Document | null;
@@ -1,11 +1,11 @@
1
1
  import { canUseDOM } from './can-use-dom';
2
- /**
3
- * Get an element's owner document. Useful when components are used in iframes
4
- * or other environments like dev tools.
5
- *
6
- * @param element
7
- */
8
2
 
3
+ /**
4
+ * Get an element's owner document. Useful when components are used in iframes
5
+ * or other environments like dev tools.
6
+ *
7
+ * @param element
8
+ */
9
9
  export function getOwnerDocument(element) {
10
10
  return canUseDOM() ? element ? element.ownerDocument : document : null;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"owner-document.js","names":["canUseDOM","getOwnerDocument","element","ownerDocument","document"],"sources":["../../../src/utils/owner-document.ts"],"sourcesContent":["import { canUseDOM } from './can-use-dom';\r\n\r\n/**\r\n * Get an element's owner document. Useful when components are used in iframes\r\n * or other environments like dev tools.\r\n *\r\n * @param element\r\n */\r\nexport function getOwnerDocument<T extends Element>(\r\n element: T | null | undefined\r\n) {\r\n return canUseDOM() ? (element ? element.ownerDocument : document) : null;\r\n}\r\n"],"mappings":"AAAA,SAASA,SAAT,QAA0B,eAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CACLC,OADK,EAEL;EACA,OAAOF,SAAS,KAAME,OAAO,GAAGA,OAAO,CAACC,aAAX,GAA2BC,QAAxC,GAAoD,IAApE;AACD"}
1
+ {"version":3,"file":"owner-document.js","names":["canUseDOM","getOwnerDocument","element","ownerDocument","document"],"sources":["../../../src/utils/owner-document.ts"],"sourcesContent":["import { canUseDOM } from './can-use-dom';\n\n/**\n * Get an element's owner document. Useful when components are used in iframes\n * or other environments like dev tools.\n *\n * @param element\n */\nexport function getOwnerDocument<T extends Element>(\n element: T | null | undefined\n) {\n return canUseDOM() ? (element ? element.ownerDocument : document) : null;\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAe;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,OAA6B,EAC7B;EACA,OAAOF,SAAS,CAAC,CAAC,GAAIE,OAAO,GAAGA,OAAO,CAACC,aAAa,GAAGC,QAAQ,GAAI,IAAI;AAC1E","ignoreList":[]}
@@ -1,39 +1,39 @@
1
- import type * as React from 'react';
2
- export declare type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
3
- /**
4
- * Infers the OwnProps if E is a ForwardRefExoticComponentWithAs
5
- */
6
- export declare type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {};
7
- /**
8
- * Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs
9
- */
10
- export declare type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any> ? I : never;
11
- declare type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
12
- as?: E;
13
- innerAs?: E;
14
- }>>;
15
- export interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
16
- <As = IntrinsicElementString>(props: As extends '' ? {
17
- as: keyof JSX.IntrinsicElements;
18
- innerAs?: keyof JSX.IntrinsicElements;
19
- } : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
20
- as: As;
21
- innerAs?: As;
22
- }> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
23
- as: As;
24
- innerAs?: As;
25
- }> : never): React.ReactElement | null;
26
- }
27
- export interface MemoComponent<IntrinsicElementString, OwnProps = {}> extends React.MemoExoticComponent<ForwardRefComponent<IntrinsicElementString, OwnProps>> {
28
- <As = IntrinsicElementString>(props: As extends '' ? {
29
- as: keyof JSX.IntrinsicElements;
30
- innerAs?: keyof JSX.IntrinsicElements;
31
- } : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
32
- as: As;
33
- innerAs?: As;
34
- }> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
35
- as: As;
36
- innerAs?: As;
37
- }> : never): React.ReactElement | null;
38
- }
39
- export {};
1
+ import type * as React from 'react';
2
+ export type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
3
+ /**
4
+ * Infers the OwnProps if E is a ForwardRefExoticComponentWithAs
5
+ */
6
+ export type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {};
7
+ /**
8
+ * Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs
9
+ */
10
+ export type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any> ? I : never;
11
+ type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
12
+ as?: E;
13
+ innerAs?: E;
14
+ }>>;
15
+ export interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
16
+ <As = IntrinsicElementString>(props: As extends '' ? {
17
+ as: keyof React.JSX.IntrinsicElements;
18
+ innerAs?: keyof React.JSX.IntrinsicElements;
19
+ } : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
20
+ as: As;
21
+ innerAs?: As;
22
+ }> : As extends keyof React.JSX.IntrinsicElements ? Merge<React.JSX.IntrinsicElements[As], OwnProps & {
23
+ as: As;
24
+ innerAs?: As;
25
+ }> : never): React.ReactElement | null;
26
+ }
27
+ export interface MemoComponent<IntrinsicElementString, OwnProps = {}> extends React.MemoExoticComponent<ForwardRefComponent<IntrinsicElementString, OwnProps>> {
28
+ <As = IntrinsicElementString>(props: As extends '' ? {
29
+ as: keyof React.JSX.IntrinsicElements;
30
+ innerAs?: keyof React.JSX.IntrinsicElements;
31
+ } : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
32
+ as: As;
33
+ innerAs?: As;
34
+ }> : As extends keyof React.JSX.IntrinsicElements ? Merge<React.JSX.IntrinsicElements[As], OwnProps & {
35
+ as: As;
36
+ innerAs?: As;
37
+ }> : never): React.ReactElement | null;
38
+ }
39
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"polymorphic.js","names":[],"sources":["../../../src/utils/polymorphic.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\r\n// adapted from https://github.com/radix-ui/primitives/blob/2f139a832ba0cdfd445c937ebf63c2e79e0ef7ed/packages/react/polymorphic/src/polymorphic.ts\r\n// Would have liked to use it directly instead of copying but they are\r\n// (rightfully) treating it as an internal utility, so copy/paste it is to\r\n// prevent any needless churn if they make breaking changes. Big thanks to Jenna\r\n// for the heavy lifting! https://github.com/jjenzz\r\n\r\nimport type * as React from 'react';\r\n\r\n// eslint-disable-next-line @typescript-eslint/ban-types\r\nexport type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;\r\n\r\n/**\r\n * Infers the OwnProps if E is a ForwardRefExoticComponentWithAs\r\n */\r\nexport type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {};\r\n\r\n/**\r\n * Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs\r\n */\r\nexport type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any>\r\n ? I\r\n : never;\r\n\r\ntype ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<\r\n Merge<\r\n E extends React.ElementType ? React.ComponentPropsWithRef<E> : never,\r\n OwnProps & { as?: E; innerAs?: E }\r\n >\r\n>;\r\n\r\nexport interface ForwardRefComponent<\r\n IntrinsicElementString,\r\n OwnProps = {}\r\n /*\r\n * Extends original type to ensure built in React types play nice with\r\n * polymorphic components still e.g. `React.ElementRef` etc.\r\n */\r\n> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {\r\n /*\r\n * When `as` prop is passed, use this overload. Merges original own props\r\n * (without DOM props) and the inferred props from `as` element with the own\r\n * props taking precendence.\r\n *\r\n * We explicitly avoid `React.ElementType` and manually narrow the prop types\r\n * so that events are typed when using JSX.IntrinsicElements.\r\n */\r\n <As = IntrinsicElementString>(\r\n props: As extends ''\r\n ? {\r\n as: keyof JSX.IntrinsicElements;\r\n innerAs?: keyof JSX.IntrinsicElements;\r\n }\r\n : As extends React.ComponentType<infer P>\r\n ? Merge<P, OwnProps & { as: As; innerAs?: As }>\r\n : As extends keyof JSX.IntrinsicElements\r\n ? Merge<JSX.IntrinsicElements[As], OwnProps & { as: As; innerAs?: As }>\r\n : never\r\n ): React.ReactElement | null;\r\n}\r\n\r\nexport interface MemoComponent<IntrinsicElementString, OwnProps = {}>\r\n extends React.MemoExoticComponent<\r\n ForwardRefComponent<IntrinsicElementString, OwnProps>\r\n > {\r\n <As = IntrinsicElementString>(\r\n props: As extends ''\r\n ? {\r\n as: keyof JSX.IntrinsicElements;\r\n innerAs?: keyof JSX.IntrinsicElements;\r\n }\r\n : As extends React.ComponentType<infer P>\r\n ? Merge<P, OwnProps & { as: As; innerAs?: As }>\r\n : As extends keyof JSX.IntrinsicElements\r\n ? Merge<JSX.IntrinsicElements[As], OwnProps & { as: As; innerAs?: As }>\r\n : never\r\n ): React.ReactElement | null;\r\n}\r\n"],"mappings":""}
1
+ {"version":3,"file":"polymorphic.js","names":[],"sources":["../../../src/utils/polymorphic.ts"],"sourcesContent":["// adapted from https://github.com/radix-ui/primitives/blob/2f139a832ba0cdfd445c937ebf63c2e79e0ef7ed/packages/react/polymorphic/src/polymorphic.ts\n// Would have liked to use it directly instead of copying but they are\n// (rightfully) treating it as an internal utility, so copy/paste it is to\n// prevent any needless churn if they make breaking changes. Big thanks to Jenna\n// for the heavy lifting! https://github.com/jjenzz\n\nimport type * as React from 'react';\n\nexport type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;\n\n/**\n * Infers the OwnProps if E is a ForwardRefExoticComponentWithAs\n */\nexport type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {};\n\n/**\n * Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs\n */\nexport type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any>\n ? I\n : never;\n\ntype ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<\n Merge<\n E extends React.ElementType ? React.ComponentPropsWithRef<E> : never,\n OwnProps & { as?: E; innerAs?: E }\n >\n>;\n\nexport interface ForwardRefComponent<\n IntrinsicElementString,\n OwnProps = {}\n /*\n * Extends original type to ensure built in React types play nice with\n * polymorphic components still e.g. `React.ElementRef` etc.\n */\n> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {\n /*\n * When `as` prop is passed, use this overload. Merges original own props\n * (without DOM props) and the inferred props from `as` element with the own\n * props taking precendence.\n *\n * We explicitly avoid `React.ElementType` and manually narrow the prop types\n * so that events are typed when using JSX.IntrinsicElements.\n */\n <As = IntrinsicElementString>(\n props: As extends ''\n ? {\n as: keyof React.JSX.IntrinsicElements;\n innerAs?: keyof React.JSX.IntrinsicElements;\n }\n : As extends React.ComponentType<infer P>\n ? Merge<P, OwnProps & { as: As; innerAs?: As }>\n : As extends keyof React.JSX.IntrinsicElements\n ? Merge<\n React.JSX.IntrinsicElements[As],\n OwnProps & { as: As; innerAs?: As }\n >\n : never\n ): React.ReactElement | null;\n}\n\nexport interface MemoComponent<IntrinsicElementString, OwnProps = {}>\n extends React.MemoExoticComponent<\n ForwardRefComponent<IntrinsicElementString, OwnProps>\n > {\n <As = IntrinsicElementString>(\n props: As extends ''\n ? {\n as: keyof React.JSX.IntrinsicElements;\n innerAs?: keyof React.JSX.IntrinsicElements;\n }\n : As extends React.ComponentType<infer P>\n ? Merge<P, OwnProps & { as: As; innerAs?: As }>\n : As extends keyof React.JSX.IntrinsicElements\n ? Merge<\n React.JSX.IntrinsicElements[As],\n OwnProps & { as: As; innerAs?: As }\n >\n : never\n ): React.ReactElement | null;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export declare function rubberBand(distance: number, dimension: number, constant?: number): number;
2
- export declare function rubberBandClamp(min: number, max: number, delta: number, constant?: number): number;
1
+ export declare function rubberBand(distance: number, dimension: number, constant?: number): number;
2
+ export declare function rubberBandClamp(min: number, max: number, delta: number, constant?: number): number;
@@ -1,20 +1,17 @@
1
1
  // https://twitter.com/chpwn/status/285540192096497664
2
2
  // iOS constant = 0.55
3
3
  export function rubberBand(distance, dimension) {
4
- var constant = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.15;
4
+ let constant = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.15;
5
5
  return distance * dimension * constant / (dimension + constant * distance);
6
6
  }
7
7
  export function rubberBandClamp(min, max, delta) {
8
- var constant = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.15;
9
-
8
+ let constant = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.15;
10
9
  if (delta < min) {
11
10
  return -rubberBand(min - delta, max - min, constant) + min;
12
11
  }
13
-
14
12
  if (delta > max) {
15
13
  return rubberBand(delta - max, max - min, constant) + max;
16
14
  }
17
-
18
15
  return delta;
19
16
  }
20
17
  //# sourceMappingURL=rubber-band-clamp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rubber-band-clamp.js","names":["rubberBand","distance","dimension","constant","rubberBandClamp","min","max","delta"],"sources":["../../../src/utils/rubber-band-clamp.ts"],"sourcesContent":["// https://twitter.com/chpwn/status/285540192096497664\r\n// iOS constant = 0.55\r\nexport function rubberBand(\r\n distance: number,\r\n dimension: number,\r\n constant = 0.15\r\n) {\r\n return (distance * dimension * constant) / (dimension + constant * distance);\r\n}\r\n\r\nexport function rubberBandClamp(\r\n min: number,\r\n max: number,\r\n delta: number,\r\n constant = 0.15\r\n) {\r\n if (delta < min) {\r\n return -rubberBand(min - delta, max - min, constant) + min;\r\n }\r\n if (delta > max) {\r\n return rubberBand(delta - max, max - min, constant) + max;\r\n }\r\n\r\n return delta;\r\n}\r\n"],"mappings":"AAAA;AACA;AACA,OAAO,SAASA,UAAT,CACLC,QADK,EAELC,SAFK,EAIL;EAAA,IADAC,QACA,uEADW,IACX;EACA,OAAQF,QAAQ,GAAGC,SAAX,GAAuBC,QAAxB,IAAqCD,SAAS,GAAGC,QAAQ,GAAGF,QAA5D,CAAP;AACD;AAED,OAAO,SAASG,eAAT,CACLC,GADK,EAELC,GAFK,EAGLC,KAHK,EAKL;EAAA,IADAJ,QACA,uEADW,IACX;;EACA,IAAII,KAAK,GAAGF,GAAZ,EAAiB;IACf,OAAO,CAACL,UAAU,CAACK,GAAG,GAAGE,KAAP,EAAcD,GAAG,GAAGD,GAApB,EAAyBF,QAAzB,CAAX,GAAgDE,GAAvD;EACD;;EACD,IAAIE,KAAK,GAAGD,GAAZ,EAAiB;IACf,OAAON,UAAU,CAACO,KAAK,GAAGD,GAAT,EAAcA,GAAG,GAAGD,GAApB,EAAyBF,QAAzB,CAAV,GAA+CG,GAAtD;EACD;;EAED,OAAOC,KAAP;AACD"}
1
+ {"version":3,"file":"rubber-band-clamp.js","names":["rubberBand","distance","dimension","constant","arguments","length","undefined","rubberBandClamp","min","max","delta"],"sources":["../../../src/utils/rubber-band-clamp.ts"],"sourcesContent":["// https://twitter.com/chpwn/status/285540192096497664\n// iOS constant = 0.55\nexport function rubberBand(\n distance: number,\n dimension: number,\n constant = 0.15\n) {\n return (distance * dimension * constant) / (dimension + constant * distance);\n}\n\nexport function rubberBandClamp(\n min: number,\n max: number,\n delta: number,\n constant = 0.15\n) {\n if (delta < min) {\n return -rubberBand(min - delta, max - min, constant) + min;\n }\n if (delta > max) {\n return rubberBand(delta - max, max - min, constant) + max;\n }\n\n return delta;\n}\n"],"mappings":"AAAA;AACA;AACA,OAAO,SAASA,UAAUA,CACxBC,QAAgB,EAChBC,SAAiB,EAEjB;EAAA,IADAC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAEf,OAAQH,QAAQ,GAAGC,SAAS,GAAGC,QAAQ,IAAKD,SAAS,GAAGC,QAAQ,GAAGF,QAAQ,CAAC;AAC9E;AAEA,OAAO,SAASM,eAAeA,CAC7BC,GAAW,EACXC,GAAW,EACXC,KAAa,EAEb;EAAA,IADAP,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAEf,IAAIM,KAAK,GAAGF,GAAG,EAAE;IACf,OAAO,CAACR,UAAU,CAACQ,GAAG,GAAGE,KAAK,EAAED,GAAG,GAAGD,GAAG,EAAEL,QAAQ,CAAC,GAAGK,GAAG;EAC5D;EACA,IAAIE,KAAK,GAAGD,GAAG,EAAE;IACf,OAAOT,UAAU,CAACU,KAAK,GAAGD,GAAG,EAAEA,GAAG,GAAGD,GAAG,EAAEL,QAAQ,CAAC,GAAGM,GAAG;EAC3D;EAEA,OAAOC,KAAK;AACd","ignoreList":[]}
@@ -1,16 +1,16 @@
1
- /**
2
- * Converts a callback to a ref to avoid triggering re-renders when passed as a
3
- * prop and exposed as a stable function to avoid executing effects when passed
4
- * as a dependency.
5
- */
6
- export declare function useStableCallback<T extends (...args: any[]) => any>(callback: T | null | undefined): T;
7
- /**
8
- * Converts a callback to a ref to avoid triggering re-renders when passed as a
9
- * prop and exposed as a stable function to avoid executing effects when passed
10
- * as a dependency.
11
- *
12
- * Use this over `useStableCallback` when you want the callback to be cached in
13
- * `useLayoutEffect` instead of `useEffect` to deal with timing issues only when
14
- * needed.
15
- */
16
- export declare function useStableLayoutCallback<T extends (...args: any[]) => any>(callback: T | null | undefined): T;
1
+ /**
2
+ * Converts a callback to a ref to avoid triggering re-renders when passed as a
3
+ * prop and exposed as a stable function to avoid executing effects when passed
4
+ * as a dependency.
5
+ */
6
+ export declare function useStableCallback<T extends (...args: any[]) => any>(callback: T | null | undefined): T;
7
+ /**
8
+ * Converts a callback to a ref to avoid triggering re-renders when passed as a
9
+ * prop and exposed as a stable function to avoid executing effects when passed
10
+ * as a dependency.
11
+ *
12
+ * Use this over `useStableCallback` when you want the callback to be cached in
13
+ * `useLayoutEffect` instead of `useEffect` to deal with timing issues only when
14
+ * needed.
15
+ */
16
+ export declare function useStableLayoutCallback<T extends (...args: any[]) => any>(callback: T | null | undefined): T;
@@ -1,42 +1,40 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
2
  import { useRef, useEffect, useCallback, useLayoutEffect } from 'react';
3
- var useEnhancedEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
4
- /**
5
- * Converts a callback to a ref to avoid triggering re-renders when passed as a
6
- * prop and exposed as a stable function to avoid executing effects when
7
- * passed as a dependency.
8
- */
3
+ const useEnhancedEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
9
4
 
5
+ /**
6
+ * Converts a callback to a ref to avoid triggering re-renders when passed as a
7
+ * prop and exposed as a stable function to avoid executing effects when
8
+ * passed as a dependency.
9
+ */
10
10
  function createStableCallbackHook(useEffectHook, callback) {
11
- var callbackRef = useRef(callback);
12
- useEffectHook(function () {
11
+ const callbackRef = useRef(callback);
12
+ useEffectHook(() => {
13
13
  callbackRef.current = callback;
14
- }); // eslint-disable-next-line react-hooks/exhaustive-deps
15
-
14
+ });
16
15
  return useCallback(function () {
17
- callbackRef.current && callbackRef.current.apply(callbackRef, arguments);
16
+ callbackRef.current && callbackRef.current(...arguments);
18
17
  }, []);
19
18
  }
20
- /**
21
- * Converts a callback to a ref to avoid triggering re-renders when passed as a
22
- * prop and exposed as a stable function to avoid executing effects when passed
23
- * as a dependency.
24
- */
25
-
26
19
 
20
+ /**
21
+ * Converts a callback to a ref to avoid triggering re-renders when passed as a
22
+ * prop and exposed as a stable function to avoid executing effects when passed
23
+ * as a dependency.
24
+ */
27
25
  export function useStableCallback(callback) {
28
26
  return createStableCallbackHook(useEffect, callback);
29
27
  }
30
- /**
31
- * Converts a callback to a ref to avoid triggering re-renders when passed as a
32
- * prop and exposed as a stable function to avoid executing effects when passed
33
- * as a dependency.
34
- *
35
- * Use this over `useStableCallback` when you want the callback to be cached in
36
- * `useLayoutEffect` instead of `useEffect` to deal with timing issues only when
37
- * needed.
38
- */
39
28
 
29
+ /**
30
+ * Converts a callback to a ref to avoid triggering re-renders when passed as a
31
+ * prop and exposed as a stable function to avoid executing effects when passed
32
+ * as a dependency.
33
+ *
34
+ * Use this over `useStableCallback` when you want the callback to be cached in
35
+ * `useLayoutEffect` instead of `useEffect` to deal with timing issues only when
36
+ * needed.
37
+ */
40
38
  export function useStableLayoutCallback(callback) {
41
39
  return createStableCallbackHook(useEnhancedEffect, callback);
42
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-stable-callback.js","names":["useRef","useEffect","useCallback","useLayoutEffect","useEnhancedEffect","window","createStableCallbackHook","useEffectHook","callback","callbackRef","current","useStableCallback","useStableLayoutCallback"],"sources":["../../../src/utils/use-stable-callback.ts"],"sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\r\nimport { useRef, useEffect, useCallback, useLayoutEffect } from 'react';\r\nimport type * as React from 'react';\r\n\r\nconst useEnhancedEffect =\r\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\r\n\r\n/**\r\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\r\n * prop and exposed as a stable function to avoid executing effects when\r\n * passed as a dependency.\r\n */\r\nfunction createStableCallbackHook<T extends (...args: any[]) => any>(\r\n useEffectHook: (\r\n effect: React.EffectCallback,\r\n deps?: React.DependencyList | undefined\r\n ) => void,\r\n callback: T | null | undefined\r\n): T {\r\n const callbackRef = useRef(callback);\r\n useEffectHook(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n return useCallback(\r\n ((...args) => {\r\n callbackRef.current && callbackRef.current(...args);\r\n }) as T,\r\n []\r\n );\r\n}\r\n\r\n/**\r\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\r\n * prop and exposed as a stable function to avoid executing effects when passed\r\n * as a dependency.\r\n */\r\nexport function useStableCallback<T extends (...args: any[]) => any>(\r\n callback: T | null | undefined\r\n): T {\r\n return createStableCallbackHook(useEffect, callback);\r\n}\r\n\r\n/**\r\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\r\n * prop and exposed as a stable function to avoid executing effects when passed\r\n * as a dependency.\r\n *\r\n * Use this over `useStableCallback` when you want the callback to be cached in\r\n * `useLayoutEffect` instead of `useEffect` to deal with timing issues only when\r\n * needed.\r\n */\r\nexport function useStableLayoutCallback<T extends (...args: any[]) => any>(\r\n callback: T | null | undefined\r\n): T {\r\n return createStableCallbackHook(useEnhancedEffect, callback);\r\n}\r\n"],"mappings":"AAAA;AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,WAA5B,EAAyCC,eAAzC,QAAgE,OAAhE;AAGA,IAAMC,iBAAiB,GACrB,OAAOC,MAAP,KAAkB,WAAlB,GAAgCF,eAAhC,GAAkDF,SADpD;AAGA;AACA;AACA;AACA;AACA;;AACA,SAASK,wBAAT,CACEC,aADF,EAKEC,QALF,EAMK;EACH,IAAMC,WAAW,GAAGT,MAAM,CAACQ,QAAD,CAA1B;EACAD,aAAa,CAAC,YAAM;IAClBE,WAAW,CAACC,OAAZ,GAAsBF,QAAtB;EACD,CAFY,CAAb,CAFG,CAMH;;EACA,OAAON,WAAW,CACf,YAAa;IACZO,WAAW,CAACC,OAAZ,IAAuBD,WAAW,CAACC,OAAZ,OAAAD,WAAW,YAAlC;EACD,CAHe,EAIhB,EAJgB,CAAlB;AAMD;AAED;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASE,iBAAT,CACLH,QADK,EAEF;EACH,OAAOF,wBAAwB,CAACL,SAAD,EAAYO,QAAZ,CAA/B;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,uBAAT,CACLJ,QADK,EAEF;EACH,OAAOF,wBAAwB,CAACF,iBAAD,EAAoBI,QAApB,CAA/B;AACD"}
1
+ {"version":3,"file":"use-stable-callback.js","names":["useRef","useEffect","useCallback","useLayoutEffect","useEnhancedEffect","window","createStableCallbackHook","useEffectHook","callback","callbackRef","current","arguments","useStableCallback","useStableLayoutCallback"],"sources":["../../../src/utils/use-stable-callback.ts"],"sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\nimport { useRef, useEffect, useCallback, useLayoutEffect } from 'react';\nimport type * as React from 'react';\n\nconst useEnhancedEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n/**\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop and exposed as a stable function to avoid executing effects when\n * passed as a dependency.\n */\nfunction createStableCallbackHook<T extends (...args: any[]) => any>(\n useEffectHook: (\n effect: React.EffectCallback,\n deps?: React.DependencyList | undefined\n ) => void,\n callback: T | null | undefined\n): T {\n const callbackRef = useRef(callback);\n useEffectHook(() => {\n callbackRef.current = callback;\n });\n\n return useCallback(\n ((...args) => {\n callbackRef.current && callbackRef.current(...args);\n }) as T,\n []\n );\n}\n\n/**\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop and exposed as a stable function to avoid executing effects when passed\n * as a dependency.\n */\nexport function useStableCallback<T extends (...args: any[]) => any>(\n callback: T | null | undefined\n): T {\n return createStableCallbackHook(useEffect, callback);\n}\n\n/**\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop and exposed as a stable function to avoid executing effects when passed\n * as a dependency.\n *\n * Use this over `useStableCallback` when you want the callback to be cached in\n * `useLayoutEffect` instead of `useEffect` to deal with timing issues only when\n * needed.\n */\nexport function useStableLayoutCallback<T extends (...args: any[]) => any>(\n callback: T | null | undefined\n): T {\n return createStableCallbackHook(useEnhancedEffect, callback);\n}\n"],"mappings":"AAAA;AACA,SAASA,MAAM,EAAEC,SAAS,EAAEC,WAAW,EAAEC,eAAe,QAAQ,OAAO;AAGvE,MAAMC,iBAAiB,GACrB,OAAOC,MAAM,KAAK,WAAW,GAAGF,eAAe,GAAGF,SAAS;;AAE7D;AACA;AACA;AACA;AACA;AACA,SAASK,wBAAwBA,CAC/BC,aAGS,EACTC,QAA8B,EAC3B;EACH,MAAMC,WAAW,GAAGT,MAAM,CAACQ,QAAQ,CAAC;EACpCD,aAAa,CAAC,MAAM;IAClBE,WAAW,CAACC,OAAO,GAAGF,QAAQ;EAChC,CAAC,CAAC;EAEF,OAAON,WAAW,CACf,YAAa;IACZO,WAAW,CAACC,OAAO,IAAID,WAAW,CAACC,OAAO,CAAC,GAAAC,SAAO,CAAC;EACrD,CAAC,EACD,EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BJ,QAA8B,EAC3B;EACH,OAAOF,wBAAwB,CAACL,SAAS,EAAEO,QAAQ,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,uBAAuBA,CACrCL,QAA8B,EAC3B;EACH,OAAOF,wBAAwB,CAACF,iBAAiB,EAAEI,QAAQ,CAAC;AAC9D","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { SyntheticEvent } from 'react';
2
- export declare type CustomEventHandler<E extends SyntheticEvent<any> | Event, H extends unknown[]> = (e: E, ...args: H) => void;
3
- export declare function wrapEvent<EventType extends SyntheticEvent<any> | Event, H extends unknown[]>(theirHandler: CustomEventHandler<EventType, H> | undefined, ourHandler: CustomEventHandler<EventType, H>): CustomEventHandler<EventType, H>;
1
+ import type { SyntheticEvent } from 'react';
2
+ export type CustomEventHandler<E extends SyntheticEvent<any> | Event, H extends unknown[]> = (e: E, ...args: H) => void;
3
+ export declare function wrapEvent<EventType extends SyntheticEvent<any> | Event, H extends unknown[]>(theirHandler: CustomEventHandler<EventType, H> | undefined, ourHandler: CustomEventHandler<EventType, H>): CustomEventHandler<EventType, H>;
@@ -3,13 +3,10 @@ export function wrapEvent(theirHandler, ourHandler) {
3
3
  for (var _len = arguments.length, otherArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4
4
  otherArgs[_key - 1] = arguments[_key];
5
5
  }
6
-
7
- var ret = theirHandler && theirHandler.apply(void 0, [event].concat(otherArgs));
8
-
6
+ const ret = theirHandler && theirHandler(event, ...otherArgs);
9
7
  if (!event || !event.defaultPrevented) {
10
- return ourHandler.apply(void 0, [event].concat(otherArgs));
8
+ return ourHandler(event, ...otherArgs);
11
9
  }
12
-
13
10
  return ret;
14
11
  };
15
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrap-event.js","names":["wrapEvent","theirHandler","ourHandler","event","otherArgs","ret","defaultPrevented"],"sources":["../../../src/utils/wrap-event.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react';\r\n\r\nexport type CustomEventHandler<\r\n E extends SyntheticEvent<any> | Event,\r\n H extends unknown[]\r\n> = (e: E, ...args: H) => void;\r\n\r\nexport function wrapEvent<\r\n EventType extends SyntheticEvent<any> | Event,\r\n H extends unknown[]\r\n>(\r\n theirHandler: CustomEventHandler<EventType, H> | undefined,\r\n ourHandler: CustomEventHandler<EventType, H>\r\n): CustomEventHandler<EventType, H> {\r\n return (event: EventType, ...otherArgs: H) => {\r\n const ret = theirHandler && theirHandler(event, ...otherArgs);\r\n if (!event || !event.defaultPrevented) {\r\n return ourHandler(event, ...otherArgs);\r\n }\r\n return ret;\r\n };\r\n}\r\n"],"mappings":"AAOA,OAAO,SAASA,SAAT,CAILC,YAJK,EAKLC,UALK,EAM6B;EAClC,OAAO,UAACC,KAAD,EAAuC;IAAA,kCAAjBC,SAAiB;MAAjBA,SAAiB;IAAA;;IAC5C,IAAMC,GAAG,GAAGJ,YAAY,IAAIA,YAAY,MAAZ,UAAaE,KAAb,SAAuBC,SAAvB,EAA5B;;IACA,IAAI,CAACD,KAAD,IAAU,CAACA,KAAK,CAACG,gBAArB,EAAuC;MACrC,OAAOJ,UAAU,MAAV,UAAWC,KAAX,SAAqBC,SAArB,EAAP;IACD;;IACD,OAAOC,GAAP;EACD,CAND;AAOD"}
1
+ {"version":3,"file":"wrap-event.js","names":["wrapEvent","theirHandler","ourHandler","event","_len","arguments","length","otherArgs","Array","_key","ret","defaultPrevented"],"sources":["../../../src/utils/wrap-event.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react';\n\nexport type CustomEventHandler<\n E extends SyntheticEvent<any> | Event,\n H extends unknown[]\n> = (e: E, ...args: H) => void;\n\nexport function wrapEvent<\n EventType extends SyntheticEvent<any> | Event,\n H extends unknown[]\n>(\n theirHandler: CustomEventHandler<EventType, H> | undefined,\n ourHandler: CustomEventHandler<EventType, H>\n): CustomEventHandler<EventType, H> {\n return (event: EventType, ...otherArgs: H) => {\n const ret = theirHandler && theirHandler(event, ...otherArgs);\n if (!event || !event.defaultPrevented) {\n return ourHandler(event, ...otherArgs);\n }\n return ret;\n };\n}\n"],"mappings":"AAOA,OAAO,SAASA,SAASA,CAIvBC,YAA0D,EAC1DC,UAA4C,EACV;EAClC,OAAO,UAACC,KAAgB,EAAsB;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAjBC,SAAS,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAATF,SAAS,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;IAAA;IACpC,MAAMC,GAAG,GAAGT,YAAY,IAAIA,YAAY,CAACE,KAAK,EAAE,GAAGI,SAAS,CAAC;IAC7D,IAAI,CAACJ,KAAK,IAAI,CAACA,KAAK,CAACQ,gBAAgB,EAAE;MACrC,OAAOT,UAAU,CAACC,KAAK,EAAE,GAAGI,SAAS,CAAC;IACxC;IACA,OAAOG,GAAG;EACZ,CAAC;AACH","ignoreList":[]}