@basic-ui/core 0.0.40 → 0.0.41

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 (251) hide show
  1. package/build/cjs/index.js.map +1 -1
  2. package/build/esm/Accordion/Accordion.d.ts +7 -7
  3. package/build/esm/Accordion/Accordion.js +0 -1
  4. package/build/esm/Accordion/Accordion.js.map +1 -1
  5. package/build/esm/Accordion/AccordionBody.d.ts +5 -5
  6. package/build/esm/Accordion/AccordionBody.js +0 -1
  7. package/build/esm/Accordion/AccordionBody.js.map +1 -1
  8. package/build/esm/Accordion/AccordionHeader.d.ts +6 -6
  9. package/build/esm/Accordion/AccordionHeader.js +0 -1
  10. package/build/esm/Accordion/AccordionHeader.js.map +1 -1
  11. package/build/esm/Accordion/AccordionItem.d.ts +7 -7
  12. package/build/esm/Accordion/AccordionItem.js +0 -1
  13. package/build/esm/Accordion/AccordionItem.js.map +1 -1
  14. package/build/esm/Accordion/context.d.ts +3 -3
  15. package/build/esm/Accordion/context.js +0 -0
  16. package/build/esm/Accordion/context.js.map +1 -1
  17. package/build/esm/Accordion/index.js +0 -0
  18. package/build/esm/Accordion/scopeQuery.js +0 -0
  19. package/build/esm/CheckBox/CheckBox.d.ts +6 -6
  20. package/build/esm/CheckBox/CheckBox.js +0 -1
  21. package/build/esm/CheckBox/CheckBox.js.map +1 -1
  22. package/build/esm/CheckBox/index.js +0 -0
  23. package/build/esm/ComboBox/Combobox.d.ts +10 -10
  24. package/build/esm/ComboBox/Combobox.js +0 -1
  25. package/build/esm/ComboBox/Combobox.js.map +1 -1
  26. package/build/esm/ComboBox/ComboboxButton.d.ts +8 -8
  27. package/build/esm/ComboBox/ComboboxButton.js +0 -1
  28. package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
  29. package/build/esm/ComboBox/ComboboxInput.d.ts +10 -10
  30. package/build/esm/ComboBox/ComboboxInput.js +0 -1
  31. package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
  32. package/build/esm/ComboBox/ComboboxLabel.d.ts +5 -5
  33. package/build/esm/ComboBox/ComboboxLabel.js +0 -1
  34. package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
  35. package/build/esm/ComboBox/ComboboxList.d.ts +6 -6
  36. package/build/esm/ComboBox/ComboboxList.js +0 -1
  37. package/build/esm/ComboBox/ComboboxList.js.map +1 -1
  38. package/build/esm/ComboBox/ComboboxOption.d.ts +7 -7
  39. package/build/esm/ComboBox/ComboboxOption.js +0 -1
  40. package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
  41. package/build/esm/ComboBox/ComboboxPopover.d.ts +8 -8
  42. package/build/esm/ComboBox/ComboboxPopover.js +0 -1
  43. package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
  44. package/build/esm/ComboBox/cities.js +0 -0
  45. package/build/esm/ComboBox/context.d.ts +10 -10
  46. package/build/esm/ComboBox/context.js +0 -0
  47. package/build/esm/ComboBox/context.js.map +1 -1
  48. package/build/esm/ComboBox/hooks.d.ts +3 -3
  49. package/build/esm/ComboBox/hooks.js +0 -0
  50. package/build/esm/ComboBox/hooks.js.map +1 -1
  51. package/build/esm/ComboBox/index.js +0 -0
  52. package/build/esm/ComboBox/makeHash.js +0 -0
  53. package/build/esm/ComboBox/scopeQuery.js +0 -0
  54. package/build/esm/FocusLock/FocusLock.d.ts +7 -7
  55. package/build/esm/FocusLock/FocusLock.js +0 -1
  56. package/build/esm/FocusLock/FocusLock.js.map +1 -1
  57. package/build/esm/FocusLock/index.js +0 -0
  58. package/build/esm/FocusLock/tabUtils.js +0 -0
  59. package/build/esm/FocusLock/useFocusLock.d.ts +4 -4
  60. package/build/esm/FocusLock/useFocusLock.js +0 -0
  61. package/build/esm/FocusLock/useFocusLock.js.map +1 -1
  62. package/build/esm/List/List.d.ts +6 -6
  63. package/build/esm/List/List.js +0 -1
  64. package/build/esm/List/List.js.map +1 -1
  65. package/build/esm/List/ListItem.d.ts +6 -6
  66. package/build/esm/List/ListItem.js +0 -1
  67. package/build/esm/List/ListItem.js.map +1 -1
  68. package/build/esm/List/context.js +0 -0
  69. package/build/esm/List/index.js +0 -0
  70. package/build/esm/Menu/Menu.d.ts +6 -6
  71. package/build/esm/Menu/Menu.js +0 -1
  72. package/build/esm/Menu/Menu.js.map +1 -1
  73. package/build/esm/Menu/MenuButton.d.ts +10 -10
  74. package/build/esm/Menu/MenuButton.js +0 -1
  75. package/build/esm/Menu/MenuButton.js.map +1 -1
  76. package/build/esm/Menu/MenuItem.d.ts +6 -6
  77. package/build/esm/Menu/MenuItem.js +0 -1
  78. package/build/esm/Menu/MenuItem.js.map +1 -1
  79. package/build/esm/Menu/MenuList.d.ts +5 -5
  80. package/build/esm/Menu/MenuList.js +0 -1
  81. package/build/esm/Menu/MenuList.js.map +1 -1
  82. package/build/esm/Menu/MenuPopover.d.ts +5 -5
  83. package/build/esm/Menu/MenuPopover.js +0 -1
  84. package/build/esm/Menu/MenuPopover.js.map +1 -1
  85. package/build/esm/Menu/context.d.ts +2 -2
  86. package/build/esm/Menu/context.js +0 -0
  87. package/build/esm/Menu/context.js.map +1 -1
  88. package/build/esm/Menu/index.js +0 -0
  89. package/build/esm/Menu/scope.js +0 -0
  90. package/build/esm/Modal/Modal.d.ts +6 -7
  91. package/build/esm/Modal/Modal.js +0 -1
  92. package/build/esm/Modal/Modal.js.map +1 -1
  93. package/build/esm/Modal/ModalBackdrop.d.ts +6 -6
  94. package/build/esm/Modal/ModalBackdrop.js +0 -1
  95. package/build/esm/Modal/ModalBackdrop.js.map +1 -1
  96. package/build/esm/Modal/index.js +0 -0
  97. package/build/esm/Popper/Popper.d.ts +7 -7
  98. package/build/esm/Popper/Popper.js +0 -1
  99. package/build/esm/Popper/Popper.js.map +1 -1
  100. package/build/esm/Popper/PopperArrow.d.ts +5 -5
  101. package/build/esm/Popper/PopperArrow.js +0 -1
  102. package/build/esm/Popper/PopperArrow.js.map +1 -1
  103. package/build/esm/Popper/context.js +0 -0
  104. package/build/esm/Popper/index.js +0 -0
  105. package/build/esm/Portal/Portal.js +0 -0
  106. package/build/esm/Portal/index.js +0 -0
  107. package/build/esm/RadioButton/RadioButton.d.ts +6 -6
  108. package/build/esm/RadioButton/RadioButton.js +0 -1
  109. package/build/esm/RadioButton/RadioButton.js.map +1 -1
  110. package/build/esm/RadioButton/RadioGroup.d.ts +7 -7
  111. package/build/esm/RadioButton/RadioGroup.js +0 -1
  112. package/build/esm/RadioButton/RadioGroup.js.map +1 -1
  113. package/build/esm/RadioButton/context.d.ts +2 -2
  114. package/build/esm/RadioButton/context.js +0 -0
  115. package/build/esm/RadioButton/context.js.map +1 -1
  116. package/build/esm/RadioButton/index.js +0 -0
  117. package/build/esm/SkipNav/SkipNav.d.ts +6 -6
  118. package/build/esm/SkipNav/SkipNav.js +0 -1
  119. package/build/esm/SkipNav/SkipNav.js.map +1 -1
  120. package/build/esm/SkipNav/index.js +0 -0
  121. package/build/esm/Spinner/Spinner.d.ts +7 -7
  122. package/build/esm/Spinner/Spinner.js +0 -1
  123. package/build/esm/Spinner/Spinner.js.map +1 -1
  124. package/build/esm/Spinner/SpinnerButton.d.ts +6 -6
  125. package/build/esm/Spinner/SpinnerButton.js +0 -1
  126. package/build/esm/Spinner/SpinnerButton.js.map +1 -1
  127. package/build/esm/Spinner/context.d.ts +2 -2
  128. package/build/esm/Spinner/context.js +0 -0
  129. package/build/esm/Spinner/context.js.map +1 -1
  130. package/build/esm/Spinner/index.js +0 -0
  131. package/build/esm/Tabs/Tab.d.ts +6 -6
  132. package/build/esm/Tabs/Tab.js +0 -1
  133. package/build/esm/Tabs/Tab.js.map +1 -1
  134. package/build/esm/Tabs/TabList.d.ts +6 -6
  135. package/build/esm/Tabs/TabList.js +0 -1
  136. package/build/esm/Tabs/TabList.js.map +1 -1
  137. package/build/esm/Tabs/TabPanel.d.ts +6 -6
  138. package/build/esm/Tabs/TabPanel.js +0 -1
  139. package/build/esm/Tabs/TabPanel.js.map +1 -1
  140. package/build/esm/Tabs/TabPanels.d.ts +5 -5
  141. package/build/esm/Tabs/TabPanels.js +0 -1
  142. package/build/esm/Tabs/TabPanels.js.map +1 -1
  143. package/build/esm/Tabs/Tabs.d.ts +6 -6
  144. package/build/esm/Tabs/Tabs.js +0 -1
  145. package/build/esm/Tabs/Tabs.js.map +1 -1
  146. package/build/esm/Tabs/context.d.ts +2 -2
  147. package/build/esm/Tabs/context.js +0 -0
  148. package/build/esm/Tabs/context.js.map +1 -1
  149. package/build/esm/Tabs/index.js +0 -0
  150. package/build/esm/Tabs/scopeQuery.js +0 -0
  151. package/build/esm/Tooltip/Tooltip.d.ts +7 -8
  152. package/build/esm/Tooltip/Tooltip.js +1 -1
  153. package/build/esm/Tooltip/Tooltip.js.map +1 -1
  154. package/build/esm/Tooltip/index.js +0 -0
  155. package/build/esm/Tooltip/stateMachine.js +0 -0
  156. package/build/esm/Tooltip/useTooltip.d.ts +7 -7
  157. package/build/esm/Tooltip/useTooltip.js +0 -0
  158. package/build/esm/Tooltip/useTooltip.js.map +1 -1
  159. package/build/esm/hooks/index.js +0 -0
  160. package/build/esm/hooks/useAutoFocus.d.ts +2 -2
  161. package/build/esm/hooks/useAutoFocus.js +0 -0
  162. package/build/esm/hooks/useAutoFocus.js.map +1 -1
  163. package/build/esm/hooks/useChildrenCounter.js +0 -0
  164. package/build/esm/hooks/useControlledState.d.ts +2 -6
  165. package/build/esm/hooks/useControlledState.js +0 -0
  166. package/build/esm/hooks/useControlledState.js.map +1 -1
  167. package/build/esm/hooks/useFocusReturn.js +0 -0
  168. package/build/esm/hooks/useFocusState.d.ts +3 -3
  169. package/build/esm/hooks/useFocusState.js +0 -0
  170. package/build/esm/hooks/useFocusState.js.map +1 -1
  171. package/build/esm/hooks/useGestureHandlers.d.ts +5 -5
  172. package/build/esm/hooks/useGestureHandlers.js +0 -0
  173. package/build/esm/hooks/useGestureHandlers.js.map +1 -1
  174. package/build/esm/hooks/useMeasure.d.ts +2 -2
  175. package/build/esm/hooks/useMeasure.js +0 -0
  176. package/build/esm/hooks/useMeasure.js.map +1 -1
  177. package/build/esm/hooks/useOnClickOutside.d.ts +2 -2
  178. package/build/esm/hooks/useOnClickOutside.js +0 -0
  179. package/build/esm/hooks/useOnClickOutside.js.map +1 -1
  180. package/build/esm/hooks/useOnKeyDown.js +0 -0
  181. package/build/esm/hooks/useReducerMachine.js +0 -0
  182. package/build/esm/hooks/useRemoveBodyScroll.js +0 -0
  183. package/build/esm/hooks/useScope.js +0 -0
  184. package/build/esm/hooks/useThrottle.js +0 -0
  185. package/build/esm/index.js +0 -0
  186. package/build/esm/utils/assignRef.js +0 -0
  187. package/build/esm/utils/clamp.js +0 -0
  188. package/build/esm/utils/createSubscription.js +0 -0
  189. package/build/esm/utils/getCircularIndex.js +0 -0
  190. package/build/esm/utils/index.js +0 -0
  191. package/build/esm/utils/rubberBandClamp.js +0 -0
  192. package/build/esm/utils/wrapEvent.d.ts +3 -3
  193. package/build/esm/utils/wrapEvent.js +0 -0
  194. package/build/esm/utils/wrapEvent.js.map +1 -1
  195. package/build/tsconfig-build.tsbuildinfo +1 -0
  196. package/build/tsconfig.tsbuildinfo +1 -1
  197. package/package.json +3 -3
  198. package/src/Accordion/Accordion.tsx +12 -6
  199. package/src/Accordion/AccordionBody.tsx +4 -5
  200. package/src/Accordion/AccordionHeader.tsx +30 -27
  201. package/src/Accordion/AccordionItem.tsx +12 -6
  202. package/src/Accordion/context.ts +3 -2
  203. package/src/CheckBox/CheckBox.tsx +5 -6
  204. package/src/ComboBox/ComboBox.story.tsx +3 -3
  205. package/src/ComboBox/Combobox.tsx +5 -8
  206. package/src/ComboBox/ComboboxButton.tsx +13 -7
  207. package/src/ComboBox/ComboboxInput.tsx +18 -10
  208. package/src/ComboBox/ComboboxLabel.tsx +4 -4
  209. package/src/ComboBox/ComboboxList.tsx +5 -6
  210. package/src/ComboBox/ComboboxOption.tsx +11 -7
  211. package/src/ComboBox/ComboboxPopover.tsx +13 -8
  212. package/src/ComboBox/context.ts +10 -9
  213. package/src/ComboBox/hooks.tsx +3 -2
  214. package/src/FocusLock/FocusLock.tsx +13 -7
  215. package/src/FocusLock/useFocusLock.ts +4 -3
  216. package/src/List/List.tsx +5 -5
  217. package/src/List/ListItem.tsx +5 -5
  218. package/src/Menu/Menu.story.tsx +2 -2
  219. package/src/Menu/Menu.tsx +13 -7
  220. package/src/Menu/MenuButton.tsx +12 -9
  221. package/src/Menu/MenuItem.tsx +14 -10
  222. package/src/Menu/MenuList.tsx +5 -5
  223. package/src/Menu/MenuPopover.tsx +4 -4
  224. package/src/Menu/context.ts +9 -4
  225. package/src/Modal/Modal.tsx +10 -6
  226. package/src/Modal/ModalBackdrop.tsx +14 -9
  227. package/src/Popper/Popper.tsx +6 -6
  228. package/src/Popper/PopperArrow.tsx +4 -4
  229. package/src/RadioButton/RadioButton.tsx +11 -6
  230. package/src/RadioButton/RadioGroup.tsx +11 -9
  231. package/src/RadioButton/context.ts +2 -4
  232. package/src/SkipNav/SkipNav.tsx +5 -5
  233. package/src/Spinner/Spinner.tsx +13 -9
  234. package/src/Spinner/SpinnerButton.tsx +11 -6
  235. package/src/Spinner/context.ts +2 -3
  236. package/src/Tabs/Tab.tsx +13 -8
  237. package/src/Tabs/TabList.tsx +5 -5
  238. package/src/Tabs/TabPanel.tsx +5 -5
  239. package/src/Tabs/TabPanels.tsx +4 -4
  240. package/src/Tabs/Tabs.tsx +5 -7
  241. package/src/Tabs/context.ts +2 -3
  242. package/src/Tooltip/Tooltip.story.tsx +1 -1
  243. package/src/Tooltip/Tooltip.tsx +13 -7
  244. package/src/Tooltip/useTooltip.ts +15 -9
  245. package/src/hooks/useAutoFocus.ts +2 -1
  246. package/src/hooks/useControlledState.ts +4 -7
  247. package/src/hooks/useFocusState.ts +3 -2
  248. package/src/hooks/useGestureHandlers.ts +11 -7
  249. package/src/hooks/useMeasure.ts +2 -1
  250. package/src/hooks/useOnClickOutside.ts +2 -2
  251. package/src/utils/wrapEvent.ts +4 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Menu/MenuList.tsx"],"names":["forwardRef","useEffect","useRef","useState","useLayoutEffect","React","useMenuContext","MenuListProvider","assignMultipleRefs","useOnClickOutside","useScope","queryScope","getCircularIndex","wrapEvent","useEnhancedEffect","window","MenuList","props","forwardedRef","as","Comp","onKeyDown","preferredId","id","defaultActiveItemValue","otherProps","menuListIdRef","buttonRef","onChange","openWithArrowKeyRef","open","navigationItem","setNavigationItem","mounted","setMounted","menuListRef","scope","onNavigate","el","focus","current","allItems","queryAllNodes","index","length","i","dataset","value","e","target","HTMLElement","contains","preventDefault","handleKeyDown","key","currentIndex","findIndex","nextIndex","firstLetter","toLowerCase","idx","dom","domText","innerText","charAt"],"mappings":";;;AAAA,SACEA,UADF,EAEEC,SAFF,EAGEC,MAHF,EAIEC,QAJF,EAKEC,eALF,QAMO,OANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,WAAjD;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,iBAAT,QAAkC,4BAAlC;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,UAAT,QAA2B,SAA3B;AACA,SAASC,gBAAT,EAA2BC,SAA3B,QAA4C,UAA5C;;AAEA,IAAMC,iBAAiB,GACrB,OAAOC,MAAP,KAAkB,WAAlB,GAAgCX,eAAhC,GAAkDH,SADpD;AASA,OAAO,IAAMe,QAAQ,gBAAGhB,UAAU,CAChC,SAASgB,QAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAuC;AAAA;;AAAA,kBAOjCD,KAPiC,CAEnCE,EAFmC;AAAA,MAE/BC,IAF+B,0BAExB,IAFwB;AAAA,MAGnCC,SAHmC,GAOjCJ,KAPiC,CAGnCI,SAHmC;AAAA,MAI/BC,WAJ+B,GAOjCL,KAPiC,CAInCM,EAJmC;AAAA,MAKnCC,sBALmC,GAOjCP,KAPiC,CAKnCO,sBALmC;AAAA,MAMhCC,UANgC,4BAOj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n useLayoutEffect,\n} from 'react';\nimport * as React from 'react';\n\nimport { useMenuContext, MenuListProvider } from './context';\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport { useOnClickOutside } from '../hooks/useOnClickOutside';\nimport { useScope } from '../hooks';\nimport { queryScope } from './scope';\nimport { getCircularIndex, wrapEvent } from '../utils';\n\nconst useEnhancedEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport interface MenuListProps extends React.HTMLAttributes<HTMLUListElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n defaultActiveItemValue?: string;\n}\n\nexport const MenuList = forwardRef<HTMLUListElement, MenuListProps>(\n function MenuList(props, forwardedRef) {\n const {\n as: Comp = 'ul',\n onKeyDown,\n id: preferredId,\n defaultActiveItemValue,\n ...otherProps\n } = props;\n\n const { menuListIdRef, buttonRef, onChange, openWithArrowKeyRef, open } =\n useMenuContext();\n\n const [navigationItem, setNavigationItem] = useState<\n HTMLElement | undefined\n >();\n\n const [mounted, setMounted] = useState(false);\n\n const menuListRef = useRef<HTMLUListElement>();\n\n const scope = useScope<HTMLLIElement, HTMLUListElement>(menuListRef);\n\n const onNavigate = (el: HTMLElement) => {\n el.focus();\n setNavigationItem(el);\n };\n\n menuListIdRef.current = preferredId || menuListIdRef.current;\n\n useEnhancedEffect(() => {\n if (!mounted) {\n const allItems = scope.current.queryAllNodes(queryScope);\n let index = getCircularIndex(\n openWithArrowKeyRef.current === 'ArrowUp' ? -1 : 0,\n allItems.length\n );\n\n if (defaultActiveItemValue) {\n for (let i = 0; i < allItems.length; i++) {\n if (allItems[i].dataset.value === defaultActiveItemValue) {\n index = i;\n break;\n }\n }\n }\n\n if (index !== null) {\n onNavigate && onNavigate(allItems[index]);\n }\n }\n\n openWithArrowKeyRef.current = null;\n setMounted(true);\n }, [\n mounted,\n navigationItem,\n onNavigate,\n openWithArrowKeyRef,\n scope,\n defaultActiveItemValue,\n ]);\n\n useOnClickOutside(\n menuListRef,\n (e) => {\n if (\n e.target instanceof HTMLElement &&\n e.target !== buttonRef.current &&\n !buttonRef.current?.contains(e.target)\n ) {\n onChange && onChange(e as any, false);\n }\n e.preventDefault();\n },\n true\n );\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLUListElement>) {\n switch (e.key) {\n case 'Escape':\n case 'Tab': {\n onChange && onChange(e, false);\n e.preventDefault(); // prevents focusing on next element, because we will be handling it\n buttonRef.current?.focus();\n break;\n }\n case 'Home':\n case 'End':\n case 'ArrowDown':\n case 'ArrowUp':\n e.preventDefault();\n const allItems = scope ? scope.current.queryAllNodes(queryScope) : [];\n const currentIndex = allItems.findIndex((e) => e === navigationItem);\n if (allItems.length === 0) {\n return;\n }\n let nextIndex: number = currentIndex;\n switch (e.key) {\n case 'ArrowUp':\n nextIndex += -1;\n break;\n case 'ArrowDown':\n nextIndex += 1;\n break;\n case 'Home':\n nextIndex = 0;\n break;\n case 'End':\n nextIndex = -1;\n break;\n }\n // We already checked if allItems.length = 0 above\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n nextIndex = getCircularIndex(nextIndex, allItems.length)!;\n onNavigate && onNavigate(allItems[nextIndex]);\n break;\n default: {\n if (e.key.length === 1) {\n // A-Z\n e.preventDefault();\n const allItems = scope\n ? scope.current.queryAllNodes(queryScope)\n : [];\n const currentIndex = allItems.findIndex(\n (e) => e === navigationItem\n );\n const firstLetter = e.key.toLowerCase();\n let nextIndex = -1;\n for (let i = 1; i < allItems.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const idx = getCircularIndex(currentIndex + i, allItems.length)!;\n const dom = allItems[idx];\n const domText = dom.innerText.toLowerCase();\n if (domText.length > 0 && domText.charAt(0) === firstLetter) {\n nextIndex = idx;\n break;\n }\n }\n if (nextIndex >= 0 && nextIndex < allItems.length) {\n onNavigate && onNavigate(allItems[nextIndex]);\n }\n }\n }\n }\n }\n\n if (!open) {\n return null;\n }\n\n return (\n <MenuListProvider\n value={{\n navigationItem,\n onNavigate,\n }}\n >\n <Comp\n ref={assignMultipleRefs(forwardedRef, menuListRef)}\n id={menuListIdRef.current}\n role=\"menu\"\n aria-labelledby={buttonRef.current?.id}\n data-menu-list=\"\"\n tabIndex=\"-1\"\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n {...otherProps}\n />\n </MenuListProvider>\n );\n }\n);\n"],"file":"MenuList.js"}
1
+ {"version":3,"sources":["../../../src/Menu/MenuList.tsx"],"names":["forwardRef","useEffect","useRef","useState","useLayoutEffect","useMenuContext","MenuListProvider","assignMultipleRefs","useOnClickOutside","useScope","queryScope","getCircularIndex","wrapEvent","useEnhancedEffect","window","MenuList","props","forwardedRef","as","Comp","onKeyDown","preferredId","id","defaultActiveItemValue","otherProps","menuListIdRef","buttonRef","onChange","openWithArrowKeyRef","open","navigationItem","setNavigationItem","mounted","setMounted","menuListRef","scope","onNavigate","el","focus","current","allItems","queryAllNodes","index","length","i","dataset","value","e","target","HTMLElement","contains","preventDefault","handleKeyDown","key","currentIndex","findIndex","nextIndex","firstLetter","toLowerCase","idx","dom","domText","innerText","charAt"],"mappings":";;;AACA,SACEA,UADF,EAEEC,SAFF,EAGEC,MAHF,EAIEC,QAJF,EAKEC,eALF,QAMO,OANP;AAQA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,WAAjD;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,iBAAT,QAAkC,4BAAlC;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,UAAT,QAA2B,SAA3B;AACA,SAASC,gBAAT,EAA2BC,SAA3B,QAA4C,UAA5C;;AAEA,IAAMC,iBAAiB,GACrB,OAAOC,MAAP,KAAkB,WAAlB,GAAgCV,eAAhC,GAAkDH,SADpD;AASA,OAAO,IAAMc,QAAQ,gBAAGf,UAAU,CAChC,SAASe,QAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAuC;AAAA;;AAAA,kBAOjCD,KAPiC,CAEnCE,EAFmC;AAAA,MAE/BC,IAF+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E,wBAAe,EALjB;AAME,MAAA,QAAQ,EAAC,IANX;AAOE,MAAA,SAAS,EAAEV,SAAS,CAACQ,SAAD,EAAYgC,aAAZ;AAPtB,OAQM5B,UARN;AANF,IADF;AAmBD,CA1K+B,CAA3B","sourcesContent":["import type { HTMLAttributes, ElementType, KeyboardEvent } from 'react';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n useLayoutEffect,\n} from 'react';\n\nimport { useMenuContext, MenuListProvider } from './context';\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport { useOnClickOutside } from '../hooks/useOnClickOutside';\nimport { useScope } from '../hooks';\nimport { queryScope } from './scope';\nimport { getCircularIndex, wrapEvent } from '../utils';\n\nconst useEnhancedEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport interface MenuListProps extends HTMLAttributes<HTMLUListElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n defaultActiveItemValue?: string;\n}\n\nexport const MenuList = forwardRef<HTMLUListElement, MenuListProps>(\n function MenuList(props, forwardedRef) {\n const {\n as: Comp = 'ul',\n onKeyDown,\n id: preferredId,\n defaultActiveItemValue,\n ...otherProps\n } = props;\n\n const { menuListIdRef, buttonRef, onChange, openWithArrowKeyRef, open } =\n useMenuContext();\n\n const [navigationItem, setNavigationItem] = useState<\n HTMLElement | undefined\n >();\n\n const [mounted, setMounted] = useState(false);\n\n const menuListRef = useRef<HTMLUListElement>();\n\n const scope = useScope<HTMLLIElement, HTMLUListElement>(menuListRef);\n\n const onNavigate = (el: HTMLElement) => {\n el.focus();\n setNavigationItem(el);\n };\n\n menuListIdRef.current = preferredId || menuListIdRef.current;\n\n useEnhancedEffect(() => {\n if (!mounted) {\n const allItems = scope.current.queryAllNodes(queryScope);\n let index = getCircularIndex(\n openWithArrowKeyRef.current === 'ArrowUp' ? -1 : 0,\n allItems.length\n );\n\n if (defaultActiveItemValue) {\n for (let i = 0; i < allItems.length; i++) {\n if (allItems[i].dataset.value === defaultActiveItemValue) {\n index = i;\n break;\n }\n }\n }\n\n if (index !== null) {\n onNavigate && onNavigate(allItems[index]);\n }\n }\n\n openWithArrowKeyRef.current = null;\n setMounted(true);\n }, [\n mounted,\n navigationItem,\n onNavigate,\n openWithArrowKeyRef,\n scope,\n defaultActiveItemValue,\n ]);\n\n useOnClickOutside(\n menuListRef,\n (e) => {\n if (\n e.target instanceof HTMLElement &&\n e.target !== buttonRef.current &&\n !buttonRef.current?.contains(e.target)\n ) {\n onChange && onChange(e as any, false);\n }\n e.preventDefault();\n },\n true\n );\n\n function handleKeyDown(e: KeyboardEvent<HTMLUListElement>) {\n switch (e.key) {\n case 'Escape':\n case 'Tab': {\n onChange && onChange(e, false);\n e.preventDefault(); // prevents focusing on next element, because we will be handling it\n buttonRef.current?.focus();\n break;\n }\n case 'Home':\n case 'End':\n case 'ArrowDown':\n case 'ArrowUp':\n e.preventDefault();\n const allItems = scope ? scope.current.queryAllNodes(queryScope) : [];\n const currentIndex = allItems.findIndex((e) => e === navigationItem);\n if (allItems.length === 0) {\n return;\n }\n let nextIndex: number = currentIndex;\n switch (e.key) {\n case 'ArrowUp':\n nextIndex += -1;\n break;\n case 'ArrowDown':\n nextIndex += 1;\n break;\n case 'Home':\n nextIndex = 0;\n break;\n case 'End':\n nextIndex = -1;\n break;\n }\n // We already checked if allItems.length = 0 above\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n nextIndex = getCircularIndex(nextIndex, allItems.length)!;\n onNavigate && onNavigate(allItems[nextIndex]);\n break;\n default: {\n if (e.key.length === 1) {\n // A-Z\n e.preventDefault();\n const allItems = scope\n ? scope.current.queryAllNodes(queryScope)\n : [];\n const currentIndex = allItems.findIndex(\n (e) => e === navigationItem\n );\n const firstLetter = e.key.toLowerCase();\n let nextIndex = -1;\n for (let i = 1; i < allItems.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const idx = getCircularIndex(currentIndex + i, allItems.length)!;\n const dom = allItems[idx];\n const domText = dom.innerText.toLowerCase();\n if (domText.length > 0 && domText.charAt(0) === firstLetter) {\n nextIndex = idx;\n break;\n }\n }\n if (nextIndex >= 0 && nextIndex < allItems.length) {\n onNavigate && onNavigate(allItems[nextIndex]);\n }\n }\n }\n }\n }\n\n if (!open) {\n return null;\n }\n\n return (\n <MenuListProvider\n value={{\n navigationItem,\n onNavigate,\n }}\n >\n <Comp\n ref={assignMultipleRefs(forwardedRef, menuListRef)}\n id={menuListIdRef.current}\n role=\"menu\"\n aria-labelledby={buttonRef.current?.id}\n data-menu-list=\"\"\n tabIndex=\"-1\"\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n {...otherProps}\n />\n </MenuListProvider>\n );\n }\n);\n"],"file":"MenuList.js"}
@@ -1,8 +1,8 @@
1
- import * as React from 'react';
1
+ import type { ElementType, ReactNode } from 'react';
2
2
  import type { PopperProps } from '../Popper';
3
3
  export interface MenuPopoverProps extends Omit<PopperProps, 'anchorEl'> {
4
- as?: React.ElementType<any>;
5
- innerAs?: React.ElementType<any>;
6
- children?: React.ReactNode;
4
+ as?: ElementType<any>;
5
+ innerAs?: ElementType<any>;
6
+ children?: ReactNode;
7
7
  }
8
- export declare const MenuPopover: React.ForwardRefExoticComponent<MenuPopoverProps & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const MenuPopover: import("react").ForwardRefExoticComponent<MenuPopoverProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef } from 'react';
4
- import * as React from 'react';
5
4
  import { Popper } from '../Popper';
6
5
  import { useMenuContext } from './context';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Menu/MenuPopover.tsx"],"names":["forwardRef","React","Popper","useMenuContext","MenuPopover","props","forwardedRef","as","otherProps","buttonRef","open"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAGA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,cAAT,QAA+B,WAA/B;;AAQA,OAAO,IAAMC,WAAW,gBAAGJ,UAAU,CACnC,SAASI,WAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA0C;AAAA,kBACFD,KADE,CAChCE,EADgC;AAAA,MAChCA,EADgC,0BAC3B,KAD2B;AAAA,MACjBC,UADiB,4BACFH,KADE;;AAAA,wBAEZF,cAAc,EAFF;AAAA,MAEhCM,SAFgC,mBAEhCA,SAFgC;AAAA,MAErBC,IAFqB,mBAErBA,IAFqB;;AAIxC,MAAI,CAACA,IAAL,EAAW;AACT,WAAO,IAAP;AACD;;AAED,sBACE,KAAC,MAAD;AAAQ,IAAA,EAAE,EAAEH,EAAZ;AAAgB,IAAA,GAAG,EAAED,YAArB;AAAmC,IAAA,QAAQ,EAAEG;AAA7C,KAA4DD,UAA5D,EADF;AAGD,CAZkC,CAA9B","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nimport type { PopperProps } from '../Popper';\nimport { Popper } from '../Popper';\nimport { useMenuContext } from './context';\n\nexport interface MenuPopoverProps extends Omit<PopperProps, 'anchorEl'> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n children?: React.ReactNode;\n}\n\nexport const MenuPopover = forwardRef<HTMLDivElement, MenuPopoverProps>(\n function MenuPopover(props, forwardedRef) {\n const { as = 'div', ...otherProps } = props;\n const { buttonRef, open } = useMenuContext();\n\n if (!open) {\n return null;\n }\n\n return (\n <Popper as={as} ref={forwardedRef} anchorEl={buttonRef} {...otherProps} />\n );\n }\n);\n"],"file":"MenuPopover.js"}
1
+ {"version":3,"sources":["../../../src/Menu/MenuPopover.tsx"],"names":["forwardRef","Popper","useMenuContext","MenuPopover","props","forwardedRef","as","otherProps","buttonRef","open"],"mappings":";;AACA,SAASA,UAAT,QAA2B,OAA3B;AAGA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,cAAT,QAA+B,WAA/B;;AAQA,OAAO,IAAMC,WAAW,gBAAGH,UAAU,CACnC,SAASG,WAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA0C;AAAA,kBACFD,KADE,CAChCE,EADgC;AAAA,MAChCA,EADgC,0BAC3B,KAD2B;AAAA,MACjBC,UADiB,4BACFH,KADE;;AAAA,wBAEZF,cAAc,EAFF;AAAA,MAEhCM,SAFgC,mBAEhCA,SAFgC;AAAA,MAErBC,IAFqB,mBAErBA,IAFqB;;AAIxC,MAAI,CAACA,IAAL,EAAW;AACT,WAAO,IAAP;AACD;;AAED,sBACE,KAAC,MAAD;AAAQ,IAAA,EAAE,EAAEH,EAAZ;AAAgB,IAAA,GAAG,EAAED,YAArB;AAAmC,IAAA,QAAQ,EAAEG;AAA7C,KAA4DD,UAA5D,EADF;AAGD,CAZkC,CAA9B","sourcesContent":["import type { ElementType, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport type { PopperProps } from '../Popper';\nimport { Popper } from '../Popper';\nimport { useMenuContext } from './context';\n\nexport interface MenuPopoverProps extends Omit<PopperProps, 'anchorEl'> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n}\n\nexport const MenuPopover = forwardRef<HTMLDivElement, MenuPopoverProps>(\n function MenuPopover(props, forwardedRef) {\n const { as = 'div', ...otherProps } = props;\n const { buttonRef, open } = useMenuContext();\n\n if (!open) {\n return null;\n }\n\n return (\n <Popper as={as} ref={forwardedRef} anchorEl={buttonRef} {...otherProps} />\n );\n }\n);\n"],"file":"MenuPopover.js"}
@@ -1,4 +1,4 @@
1
- import type { MutableRefObject } from 'react';
1
+ import type { KeyboardEvent, MouseEvent, MutableRefObject, PointerEvent } from 'react';
2
2
  export declare type ItemObject = {
3
3
  text: string;
4
4
  value: any;
@@ -8,7 +8,7 @@ export interface MenuContextProps {
8
8
  buttonRef: MutableRefObject<HTMLButtonElement | null>;
9
9
  menuListIdRef: MutableRefObject<undefined | string>;
10
10
  openWithArrowKeyRef: MutableRefObject<string | null>;
11
- onChange?: (e: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement> | React.PointerEvent<HTMLElement>, isOpen: boolean) => void;
11
+ onChange?: (e: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement> | PointerEvent<HTMLElement>, isOpen: boolean) => void;
12
12
  open: boolean;
13
13
  }
14
14
  export declare const MenuProvider: import("react").Provider<MenuContextProps>;
File without changes
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Menu/context.ts"],"names":["createContext","useContext","menuContext","MenuProvider","Provider","useMenuContext","menuListContext","MenuListProvider","useMenuListContext"],"mappings":"AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AAmBA,IAAMC,WAAW,gBAAGF,aAAa,CAAmB,IAAnB,CAAjC;IACyBG,Y,GAAiBD,W,CAA3BE,Q;;AACf,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB;AAAA,SAAMJ,UAAU,CAACC,WAAD,CAAhB;AAAA,CAAvB,C,CAEP;;AAMA,IAAMI,eAAe,gBAAGN,aAAa,CAAuB,IAAvB,CAArC;AACA,OAAO,IAAMO,gBAAgB,GAAGD,eAAe,CAACF,QAAzC;AACP,OAAO,IAAMI,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,SAAMP,UAAU,CAACK,eAAD,CAAhB;AAAA,CAA3B","sourcesContent":["import type { MutableRefObject } from 'react';\nimport { createContext, useContext } from 'react';\n\nexport type ItemObject = { text: string; value: any; id: string | undefined };\n\n// MenuRoot\nexport interface MenuContextProps {\n buttonRef: MutableRefObject<HTMLButtonElement | null>;\n menuListIdRef: MutableRefObject<undefined | string>;\n openWithArrowKeyRef: MutableRefObject<string | null>;\n onChange?: (\n e:\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement>\n | React.PointerEvent<HTMLElement>,\n isOpen: boolean\n ) => void;\n open: boolean;\n}\n\nconst menuContext = createContext<MenuContextProps>(null as any);\nexport const { Provider: MenuProvider } = menuContext;\nexport const useMenuContext = () => useContext(menuContext);\n\n// MenuList\nexport interface MenuListContextProps {\n navigationItem: HTMLElement | undefined;\n onNavigate: undefined | ((idx: HTMLElement) => void);\n}\n\nconst menuListContext = createContext<MenuListContextProps>(null as any);\nexport const MenuListProvider = menuListContext.Provider;\nexport const useMenuListContext = () => useContext(menuListContext);\n"],"file":"context.js"}
1
+ {"version":3,"sources":["../../../src/Menu/context.ts"],"names":["createContext","useContext","menuContext","MenuProvider","Provider","useMenuContext","menuListContext","MenuListProvider","useMenuListContext"],"mappings":"AAMA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AAmBA,IAAMC,WAAW,gBAAGF,aAAa,CAAmB,IAAnB,CAAjC;IACyBG,Y,GAAiBD,W,CAA3BE,Q;;AACf,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB;AAAA,SAAMJ,UAAU,CAACC,WAAD,CAAhB;AAAA,CAAvB,C,CAEP;;AAMA,IAAMI,eAAe,gBAAGN,aAAa,CAAuB,IAAvB,CAArC;AACA,OAAO,IAAMO,gBAAgB,GAAGD,eAAe,CAACF,QAAzC;AACP,OAAO,IAAMI,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,SAAMP,UAAU,CAACK,eAAD,CAAhB;AAAA,CAA3B","sourcesContent":["import type {\n KeyboardEvent,\n MouseEvent,\n MutableRefObject,\n PointerEvent,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nexport type ItemObject = { text: string; value: any; id: string | undefined };\n\n// MenuRoot\nexport interface MenuContextProps {\n buttonRef: MutableRefObject<HTMLButtonElement | null>;\n menuListIdRef: MutableRefObject<undefined | string>;\n openWithArrowKeyRef: MutableRefObject<string | null>;\n onChange?: (\n e:\n | KeyboardEvent<HTMLElement>\n | MouseEvent<HTMLElement>\n | PointerEvent<HTMLElement>,\n isOpen: boolean\n ) => void;\n open: boolean;\n}\n\nconst menuContext = createContext<MenuContextProps>(null as any);\nexport const { Provider: MenuProvider } = menuContext;\nexport const useMenuContext = () => useContext(menuContext);\n\n// MenuList\nexport interface MenuListContextProps {\n navigationItem: HTMLElement | undefined;\n onNavigate: undefined | ((idx: HTMLElement) => void);\n}\n\nconst menuListContext = createContext<MenuListContextProps>(null as any);\nexport const MenuListProvider = menuListContext.Provider;\nexport const useMenuListContext = () => useContext(menuListContext);\n"],"file":"context.js"}
File without changes
File without changes
@@ -1,10 +1,9 @@
1
- import type { ReactNode } from 'react';
2
- import * as React from 'react';
3
- export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
4
- as?: React.ElementType<any>;
5
- innerAs?: React.ElementType<any>;
1
+ import type { CSSProperties, ElementType, HTMLAttributes, ReactNode } from 'react';
2
+ export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
6
5
  children?: ReactNode;
7
- style?: React.CSSProperties;
6
+ style?: CSSProperties;
8
7
  trapFocus?: boolean;
9
8
  }
10
- export declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
9
+ export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef, useRef } from 'react';
4
- import * as React from 'react';
5
4
  import { useAutoFocus, useFocusReturn, useRemoveBodyScroll } from '../hooks';
6
5
  import { FocusLock } from '../FocusLock';
7
6
  import { assignMultipleRefs } from '../utils';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Modal/Modal.tsx"],"names":["forwardRef","useRef","React","useAutoFocus","useFocusReturn","useRemoveBodyScroll","FocusLock","assignMultipleRefs","Modal","ref","as","Comp","children","trapFocus","style","otherProps","modalRef"],"mappings":";;AACA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,OAAnC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,YAAT,EAAuBC,cAAvB,EAAuCC,mBAAvC,QAAkE,UAAlE;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AAUA,OAAO,IAAMC,KAAK,gBAAGR,UAAU,CAC7B,gBAEES,GAFF,EAGK;AAAA,qBAFDC,EAEC;AAAA,MAFGC,IAEH,wBAFU,KAEV;AAAA,MAFiBC,QAEjB,QAFiBA,QAEjB;AAAA,4BAF2BC,SAE3B;AAAA,MAF2BA,SAE3B,+BAFuC,IAEvC;AAAA,wBAF6CC,KAE7C;AAAA,MAF6CA,KAE7C,2BAFqD,EAErD;AAAA,MAF4DC,UAE5D;;AACH,MAAMC,QAAQ,GAAGf,MAAM,CAAiB,IAAjB,CAAvB;AAEAG,EAAAA,cAAc,CAACS,SAAD,EAAYG,QAAZ,CAAd;AACAX,EAAAA,mBAAmB,CAACQ,SAAD,CAAnB;AACAV,EAAAA,YAAY,CAACU,SAAD,EAAYG,QAAZ,CAAZ;AAEA,sBACE,KAAC,SAAD;AAAW,IAAA,QAAQ,EAAEA,QAArB;AAA+B,IAAA,OAAO,EAAEH,SAAxC;AAAA,2BACE,KAAC,IAAD;AACE,MAAA,GAAG,EAAEN,kBAAkB,CAACE,GAAD,EAAMO,QAAN,CADzB;AAEE,8BAAqB,EAFvB;AAGE,MAAA,IAAI,EAAC,QAHP;AAIE,oBAAW,MAJb;AAKE,MAAA,KAAK,EAAEF,KALT;AAME,MAAA,QAAQ,EAAE,CAAC;AANb,OAOMC,UAPN;AAAA,gBASGH;AATH;AADF,IADF;AAeD,CA1B4B,CAAxB","sourcesContent":["import type { ReactNode } from 'react';\nimport { forwardRef, useRef } from 'react';\nimport * as React from 'react';\n\nimport { useAutoFocus, useFocusReturn, useRemoveBodyScroll } from '../hooks';\nimport { FocusLock } from '../FocusLock';\nimport { assignMultipleRefs } from '../utils';\n\nexport interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n children?: ReactNode;\n style?: React.CSSProperties;\n trapFocus?: boolean;\n}\n\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(\n (\n { as: Comp = 'div', children, trapFocus = true, style = {}, ...otherProps },\n ref\n ) => {\n const modalRef = useRef<HTMLDivElement>(null);\n\n useFocusReturn(trapFocus, modalRef);\n useRemoveBodyScroll(trapFocus);\n useAutoFocus(trapFocus, modalRef);\n\n return (\n <FocusLock childRef={modalRef} enabled={trapFocus}>\n <Comp\n ref={assignMultipleRefs(ref, modalRef)}\n data-modal-container=\"\"\n role=\"dialog\"\n aria-modal=\"true\"\n style={style}\n tabIndex={-1}\n {...otherProps}\n >\n {children}\n </Comp>\n </FocusLock>\n );\n }\n);\n"],"file":"Modal.js"}
1
+ {"version":3,"sources":["../../../src/Modal/Modal.tsx"],"names":["forwardRef","useRef","useAutoFocus","useFocusReturn","useRemoveBodyScroll","FocusLock","assignMultipleRefs","Modal","ref","as","Comp","children","trapFocus","style","otherProps","modalRef"],"mappings":";;AAMA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,OAAnC;AAEA,SAASC,YAAT,EAAuBC,cAAvB,EAAuCC,mBAAvC,QAAkE,UAAlE;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AAUA,OAAO,IAAMC,KAAK,gBAAGP,UAAU,CAC7B,gBAEEQ,GAFF,EAGK;AAAA,qBAFDC,EAEC;AAAA,MAFGC,IAEH,wBAFU,KAEV;AAAA,MAFiBC,QAEjB,QAFiBA,QAEjB;AAAA,4BAF2BC,SAE3B;AAAA,MAF2BA,SAE3B,+BAFuC,IAEvC;AAAA,wBAF6CC,KAE7C;AAAA,MAF6CA,KAE7C,2BAFqD,EAErD;AAAA,MAF4DC,UAE5D;;AACH,MAAMC,QAAQ,GAAGd,MAAM,CAAiB,IAAjB,CAAvB;AAEAE,EAAAA,cAAc,CAACS,SAAD,EAAYG,QAAZ,CAAd;AACAX,EAAAA,mBAAmB,CAACQ,SAAD,CAAnB;AACAV,EAAAA,YAAY,CAACU,SAAD,EAAYG,QAAZ,CAAZ;AAEA,sBACE,KAAC,SAAD;AAAW,IAAA,QAAQ,EAAEA,QAArB;AAA+B,IAAA,OAAO,EAAEH,SAAxC;AAAA,2BACE,KAAC,IAAD;AACE,MAAA,GAAG,EAAEN,kBAAkB,CAACE,GAAD,EAAMO,QAAN,CADzB;AAEE,8BAAqB,EAFvB;AAGE,MAAA,IAAI,EAAC,QAHP;AAIE,oBAAW,MAJb;AAKE,MAAA,KAAK,EAAEF,KALT;AAME,MAAA,QAAQ,EAAE,CAAC;AANb,OAOMC,UAPN;AAAA,gBASGH;AATH;AADF,IADF;AAeD,CA1B4B,CAAxB","sourcesContent":["import type {\n CSSProperties,\n ElementType,\n HTMLAttributes,\n ReactNode,\n} from 'react';\nimport { forwardRef, useRef } from 'react';\n\nimport { useAutoFocus, useFocusReturn, useRemoveBodyScroll } from '../hooks';\nimport { FocusLock } from '../FocusLock';\nimport { assignMultipleRefs } from '../utils';\n\nexport interface ModalProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n style?: CSSProperties;\n trapFocus?: boolean;\n}\n\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(\n (\n { as: Comp = 'div', children, trapFocus = true, style = {}, ...otherProps },\n ref\n ) => {\n const modalRef = useRef<HTMLDivElement>(null);\n\n useFocusReturn(trapFocus, modalRef);\n useRemoveBodyScroll(trapFocus);\n useAutoFocus(trapFocus, modalRef);\n\n return (\n <FocusLock childRef={modalRef} enabled={trapFocus}>\n <Comp\n ref={assignMultipleRefs(ref, modalRef)}\n data-modal-container=\"\"\n role=\"dialog\"\n aria-modal=\"true\"\n style={style}\n tabIndex={-1}\n {...otherProps}\n >\n {children}\n </Comp>\n </FocusLock>\n );\n }\n);\n"],"file":"Modal.js"}
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- export interface ModalBackdropProps extends React.HTMLAttributes<HTMLDivElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
1
+ import type { HTMLAttributes, ElementType, CSSProperties } from 'react';
2
+ export interface ModalBackdropProps extends HTMLAttributes<HTMLDivElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
5
  onClose?: () => void;
6
- style?: React.CSSProperties;
6
+ style?: CSSProperties;
7
7
  disableCloseOnClick?: boolean;
8
8
  disableEscapeKeyDown?: boolean;
9
9
  }
10
- export declare const ModalBackdrop: React.ForwardRefExoticComponent<ModalBackdropProps & React.RefAttributes<HTMLDivElement>>;
10
+ export declare const ModalBackdrop: import("react").ForwardRefExoticComponent<ModalBackdropProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { useRef, forwardRef } from 'react';
4
- import * as React from 'react';
5
4
  import { assignMultipleRefs } from '../utils/assignRef';
6
5
  import { wrapEvent } from '../utils/wrapEvent';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Modal/ModalBackdrop.tsx"],"names":["useRef","forwardRef","React","assignMultipleRefs","wrapEvent","ModalBackdrop","forwardedRef","as","Comp","onClose","onClick","onMouseDown","onKeyDown","disableCloseOnClick","disableEscapeKeyDown","otherProps","ref","mouseDownTargetRef","handleClick","e","target","currentTarget","current","stopPropagation","handleMouseDown","handleKeyDown","key"],"mappings":";;AAAA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,OAAnC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,SAAT,QAA0B,oBAA1B;;AAYA,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D;AACE,IAAA,GAAG,EAAEpB,kBAAkB,CAACa,GAAD,EAAMV,YAAN,CADzB;AAEE,uBAAgB,EAFlB;AAGE,IAAA,OAAO,EAAEF,SAAS,CAACM,OAAD,EAAUQ,WAAV,CAHpB;AAIE,IAAA,WAAW,EAAEd,SAAS,CAACO,WAAD,EAAca,eAAd,CAJxB;AAKE,IAAA,SAAS,EAAEpB,SAAS,CAACQ,SAAD,EAAYa,aAAZ;AALtB,KAMMV,UANN,EADF;AAUD,CAvDoC,CAAhC","sourcesContent":["import { useRef, forwardRef } from 'react';\nimport * as React from 'react';\n\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport { wrapEvent } from '../utils/wrapEvent';\n\nexport interface ModalBackdropProps\n extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n onClose?: () => void;\n style?: React.CSSProperties;\n disableCloseOnClick?: boolean;\n disableEscapeKeyDown?: boolean;\n}\n\nexport const ModalBackdrop = forwardRef<HTMLDivElement, ModalBackdropProps>(\n (\n {\n as: Comp = 'div',\n onClose,\n onClick,\n onMouseDown,\n onKeyDown,\n disableCloseOnClick = false,\n disableEscapeKeyDown = false,\n ...otherProps\n },\n forwardedRef\n ) => {\n const ref = useRef();\n const mouseDownTargetRef = useRef<EventTarget | null>(null);\n\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n // Ignore the events not coming from the \"backdrop\"\n // We don't want to close the dialog when clicking the dialog content.\n if (e.target !== e.currentTarget) {\n return;\n }\n\n // Make sure the event starts and ends on the same DOM element.\n if (e.target !== mouseDownTargetRef.current) {\n return;\n }\n\n mouseDownTargetRef.current = null;\n !disableCloseOnClick && onClose?.();\n e.stopPropagation();\n };\n\n const handleMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\n mouseDownTargetRef.current = e.target;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n !disableEscapeKeyDown && onClose?.();\n e.stopPropagation();\n }\n };\n\n return (\n <Comp\n ref={assignMultipleRefs(ref, forwardedRef)}\n data-modal-root=\"\"\n onClick={wrapEvent(onClick, handleClick)}\n onMouseDown={wrapEvent(onMouseDown, handleMouseDown)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n {...otherProps}\n />\n );\n }\n);\n"],"file":"ModalBackdrop.js"}
1
+ {"version":3,"sources":["../../../src/Modal/ModalBackdrop.tsx"],"names":["useRef","forwardRef","assignMultipleRefs","wrapEvent","ModalBackdrop","forwardedRef","as","Comp","onClose","onClick","onMouseDown","onKeyDown","disableCloseOnClick","disableEscapeKeyDown","otherProps","ref","mouseDownTargetRef","handleClick","e","target","currentTarget","current","stopPropagation","handleMouseDown","handleKeyDown","key"],"mappings":";;AAOA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,OAAnC;AAEA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,SAAT,QAA0B,oBAA1B;;AAWA,OAAO,IAAMC,aAAa,gBAAGH,UAAU,CACrC,gBAWEI,YAXF,EAYK;AAAA,qBAVDC,EAUC;AAAA,MAVGC,IAUH,wBAVU,KAUV;AAAA,MATDC,OASC,QATDA,OASC;AAAA,MARDC,OAQC,QARDA,OAQC;AAAA,MAPDC,WAOC,QAPDA,WAOC;AAAA,MANDC,SAMC,QANDA,SAMC;AAAA,mCALDC,mBAKC;AAAA,MALDA,mBAKC,sCALqB,KAKrB;AAAA,mCAJDC,oBAIC;AAAA,MAJDA,oBAIC,sCAJsB,KAItB;AAAA,MAHEC,UAGF;;AACH,MAAMC,GAAG,GAAGf,MAAM,EAAlB;AACA,MAAMgB,kBAAkB,GAAGhB,MAAM,CAAqB,IAArB,CAAjC;;AAEA,MAAMiB,WAAW,GAAG,SAAdA,WAAc,CAACC,CAAD,EAAmC;AACrD;AACA;AACA,QAAIA,CAAC,CAACC,MAAF,KAAaD,CAAC,CAACE,aAAnB,EAAkC;AAChC;AACD,KALoD,CAOrD;;;AACA,QAAIF,CAAC,CAACC,MAAF,KAAaH,kBAAkB,CAACK,OAApC,EAA6C;AAC3C;AACD;;AAEDL,IAAAA,kBAAkB,CAACK,OAAnB,GAA6B,IAA7B;AACA,KAACT,mBAAD,KAAwBJ,OAAxB,oBAAwBA,OAAO,EAA/B;AACAU,IAAAA,CAAC,CAACI,eAAF;AACD,GAfD;;AAiBA,MAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACL,CAAD,EAAmC;AACzDF,IAAAA,kBAAkB,CAACK,OAAnB,GAA6BH,CAAC,CAACC,MAA/B;AACD,GAFD;;AAIA,MAAMK,aAAa,GAAG,SAAhBA,aAAgB,CAACN,CAAD,EAAsC;AAC1D,QAAIA,CAAC,CAACO,GAAF,KAAU,QAAd,EAAwB;AACtB,OAACZ,oBAAD,KAAyBL,OAAzB,oBAAyBA,OAAO,EAAhC;AACAU,MAAAA,CAAC,CAACI,eAAF;AACD;AACF,GALD;;AAOA,sBACE,KAAC,IAAD;AACE,IAAA,GAAG,EAAEpB,kBAAkB,CAACa,GAAD,EAAMV,YAAN,CADzB;AAEE,uBAAgB,EAFlB;AAGE,IAAA,OAAO,EAAEF,SAAS,CAACM,OAAD,EAAUQ,WAAV,CAHpB;AAIE,IAAA,WAAW,EAAEd,SAAS,CAACO,WAAD,EAAca,eAAd,CAJxB;AAKE,IAAA,SAAS,EAAEpB,SAAS,CAACQ,SAAD,EAAYa,aAAZ;AALtB,KAMMV,UANN,EADF;AAUD,CAvDoC,CAAhC","sourcesContent":["import type {\n HTMLAttributes,\n ElementType,\n CSSProperties,\n MouseEvent,\n KeyboardEvent,\n} from 'react';\nimport { useRef, forwardRef } from 'react';\n\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport { wrapEvent } from '../utils/wrapEvent';\n\nexport interface ModalBackdropProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n onClose?: () => void;\n style?: CSSProperties;\n disableCloseOnClick?: boolean;\n disableEscapeKeyDown?: boolean;\n}\n\nexport const ModalBackdrop = forwardRef<HTMLDivElement, ModalBackdropProps>(\n (\n {\n as: Comp = 'div',\n onClose,\n onClick,\n onMouseDown,\n onKeyDown,\n disableCloseOnClick = false,\n disableEscapeKeyDown = false,\n ...otherProps\n },\n forwardedRef\n ) => {\n const ref = useRef();\n const mouseDownTargetRef = useRef<EventTarget | null>(null);\n\n const handleClick = (e: MouseEvent<HTMLDivElement>) => {\n // Ignore the events not coming from the \"backdrop\"\n // We don't want to close the dialog when clicking the dialog content.\n if (e.target !== e.currentTarget) {\n return;\n }\n\n // Make sure the event starts and ends on the same DOM element.\n if (e.target !== mouseDownTargetRef.current) {\n return;\n }\n\n mouseDownTargetRef.current = null;\n !disableCloseOnClick && onClose?.();\n e.stopPropagation();\n };\n\n const handleMouseDown = (e: MouseEvent<HTMLDivElement>) => {\n mouseDownTargetRef.current = e.target;\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n !disableEscapeKeyDown && onClose?.();\n e.stopPropagation();\n }\n };\n\n return (\n <Comp\n ref={assignMultipleRefs(ref, forwardedRef)}\n data-modal-root=\"\"\n onClick={wrapEvent(onClick, handleClick)}\n onMouseDown={wrapEvent(onMouseDown, handleMouseDown)}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n {...otherProps}\n />\n );\n }\n);\n"],"file":"ModalBackdrop.js"}
File without changes
@@ -1,15 +1,15 @@
1
- import * as React from 'react';
1
+ import type { HTMLAttributes, ElementType, RefObject, ReactNode } from 'react';
2
2
  import type { Placement, Modifier, PositioningStrategy, Rect } from '@popperjs/core';
3
3
  export declare type OffsetsFunction = (arg0: {
4
4
  popper: Rect;
5
5
  reference: Rect;
6
6
  placement: Placement;
7
7
  }) => [number | null | undefined, number | null | undefined];
8
- export interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {
9
- as?: React.ElementType<any>;
10
- innerAs?: React.ElementType<any>;
11
- anchorEl: React.RefObject<HTMLElement>;
12
- children?: React.ReactNode;
8
+ export interface PopperProps extends HTMLAttributes<HTMLDivElement> {
9
+ as?: ElementType<any>;
10
+ innerAs?: ElementType<any>;
11
+ anchorEl: RefObject<HTMLElement>;
12
+ children?: ReactNode;
13
13
  placement?: Placement;
14
14
  strategy?: PositioningStrategy;
15
15
  modifiers?: Array<Partial<Modifier<any, any>>>;
@@ -32,4 +32,4 @@ export interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {
32
32
  */
33
33
  arrowPadding?: number;
34
34
  }
35
- export declare const Popper: React.MemoExoticComponent<React.ForwardRefExoticComponent<PopperProps & React.RefAttributes<HTMLDivElement>>>;
35
+ export declare const Popper: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<PopperProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import { forwardRef, useRef, useEffect, useLayoutEffect, useMemo, memo } from 'react';
5
- import * as React from 'react';
6
5
  import { createPopper } from '@popperjs/core';
7
6
  import { assignMultipleRefs } from '../utils/assignRef';
8
7
  import { PopperProvider } from './context';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Popper/Popper.tsx"],"names":["forwardRef","useRef","useEffect","useLayoutEffect","useMemo","memo","React","createPopper","assignMultipleRefs","PopperProvider","Portal","useEnhancedEffect","window","emptyModifiers","Popper","forwardedRef","placement","strategy","as","Comp","innerAs","anchorEl","children","modifiers","usePortal","style","portalSelector","distance","skidding","arrowPadding","offsetFn","props","arrowRef","popperRef","popperEngineInstance","defaultModifiers","arrowModifier","name","options","element","padding","offsetModifier","offset","current","destroy","forceUpdate","hidden","contextValue","ret","position","left","top"],"mappings":";;;AAAA,SACEA,UADF,EAEEC,MAFF,EAGEC,SAHF,EAIEC,eAJF,EAKEC,OALF,EAMEC,IANF,QAOO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AiB,CAAC,YAAM;AAAA;;AACtB,6BAAAuB,oBAAoB,CAACS,OAArB,2CAA8BE,WAA9B;AACD,GAFgB,EAEd,CAACd,KAAK,CAACe,MAAN,IAAgBf,KAAK,CAAC,aAAD,CAAtB,CAFc,CAAjB;AAIA,MAAMgB,YAAgC,GAAG;AACvCf,IAAAA,QAAQ,EAARA;AADuC,GAAzC;;AAIA,MAAMgB,GAAG,gBACP,KAAC,cAAD;AAAgB,IAAA,KAAK,EAAED,YAAvB;AAAA,2BACE,KAAC,IAAD,eACMhB,KADN;AAEE,MAAA,EAAE,EAAEX,OAFN;AAGE,MAAA,GAAG,EAAEZ,kBAAkB,CAACyB,SAAD,EAAYlB,YAAZ,CAHzB;AAIE,MAAA,KAAK;AAAIkC,QAAAA,QAAQ,EAAE,OAAd;AAAuBC,QAAAA,IAAI,EAAE,CAAC,IAA9B;AAAoCC,QAAAA,GAAG,EAAE,CAAC;AAA1C,SAAmD1B,KAAnD,CAJP;AAAA,gBAMGH;AANH;AADF,IADF;;AAaA,MAAIE,SAAJ,EAAe;AACb,wBAAO,KAAC,MAAD;AAAQ,MAAA,QAAQ,EAAEE,cAAlB;AAAA,gBAAmCsB;AAAnC,MAAP;AACD;;AAED,SAAOA,GAAP;AACD,CAxFS,CADc,CAAnB","sourcesContent":["import {\n forwardRef,\n useRef,\n useEffect,\n useLayoutEffect,\n useMemo,\n memo,\n} from 'react';\nimport * as React from 'react';\nimport type {\n Placement,\n Modifier,\n PositioningStrategy,\n Instance,\n Rect,\n} from '@popperjs/core';\nimport { createPopper } from '@popperjs/core';\nimport type { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';\nimport type { ArrowModifier } from '@popperjs/core/lib/modifiers/arrow';\n\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport type { PopperContextProps } from './context';\nimport { PopperProvider } from './context';\nimport { Portal } from '../Portal';\n\nconst useEnhancedEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport type OffsetsFunction = (arg0: {\n popper: Rect;\n reference: Rect;\n placement: Placement;\n}) => [number | null | undefined, number | null | undefined];\n\nexport interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n anchorEl: React.RefObject<HTMLElement>;\n children?: React.ReactNode;\n placement?: Placement;\n strategy?: PositioningStrategy;\n modifiers?: Array<Partial<Modifier<any, any>>>;\n usePortal?: boolean;\n portalSelector?: string;\n /**\n * Displaces the popper along the reference element.\n */\n skidding?: number;\n /**\n * Displaces the popper away from, or toward, the reference element in the direction of its placement. A positive number displaces it further away, while a negative number lets it overlap the reference.\n */\n distance?: number;\n /**\n * An optional function that must return a pair of [skidding, padding]. Useful for doing things like, displace the popper by 100%.\n */\n offsetFn?: OffsetsFunction;\n /**\n * If you don't want the arrow to reach the very edge of the popper (this is common if your popper has rounded corners using border-radius), you can apply some padding to it.\n */\n arrowPadding?: number;\n}\n\nconst emptyModifiers: Array<Partial<Modifier<any, any>>> = [];\nexport const Popper = memo(\n forwardRef<HTMLDivElement, PopperProps>(function Popper(\n {\n placement = 'bottom',\n strategy = 'absolute',\n as: Comp = 'div',\n innerAs,\n anchorEl,\n children,\n modifiers = emptyModifiers,\n usePortal = false,\n style = {},\n portalSelector = 'body',\n distance = 0,\n skidding = 0,\n arrowPadding = 5,\n offsetFn,\n ...props\n },\n forwardedRef\n ) {\n const arrowRef = useRef<HTMLSpanElement>(null);\n\n const popperRef = useRef<HTMLDivElement | null>(null);\n const popperEngineInstance = useRef<null | Instance>(null);\n\n const defaultModifiers: Array<Partial<Modifier<any, any>>> = useMemo(() => {\n const arrowModifier: Omit<ArrowModifier, 'enabled' | 'fn' | 'phase'> = {\n name: 'arrow',\n options: {\n element: '[data-popper-arrow]',\n padding: arrowPadding,\n },\n };\n const offsetModifier: Omit<OffsetModifier, 'enabled' | 'fn' | 'phase'> = {\n name: 'offset',\n options: {\n offset: offsetFn ?? [skidding, distance],\n },\n };\n\n return [arrowModifier, offsetModifier];\n }, [arrowPadding, distance, skidding, offsetFn]);\n\n useEnhancedEffect(() => {\n if (anchorEl && anchorEl.current && popperRef.current) {\n popperEngineInstance.current = createPopper(\n anchorEl.current,\n popperRef.current,\n {\n placement,\n strategy,\n modifiers: [...defaultModifiers, ...modifiers],\n }\n );\n }\n\n return () => {\n popperEngineInstance.current && popperEngineInstance.current.destroy();\n popperEngineInstance.current = null;\n };\n }, [anchorEl, modifiers, placement, strategy, defaultModifiers]);\n\n useEnhancedEffect(() => {\n popperEngineInstance.current?.forceUpdate();\n }, [props.hidden || props['aria-hidden']]);\n\n const contextValue: PopperContextProps = {\n arrowRef,\n };\n\n const ret = (\n <PopperProvider value={contextValue}>\n <Comp\n {...props}\n as={innerAs}\n ref={assignMultipleRefs(popperRef, forwardedRef)}\n style={{ position: 'fixed', left: -5000, top: -5000, ...style }}\n >\n {children}\n </Comp>\n </PopperProvider>\n );\n\n if (usePortal) {\n return <Portal selector={portalSelector}>{ret}</Portal>;\n }\n\n return ret;\n })\n);\n"],"file":"Popper.js"}
1
+ {"version":3,"sources":["../../../src/Popper/Popper.tsx"],"names":["forwardRef","useRef","useEffect","useLayoutEffect","useMemo","memo","createPopper","assignMultipleRefs","PopperProvider","Portal","useEnhancedEffect","window","emptyModifiers","Popper","forwardedRef","placement","strategy","as","Comp","innerAs","anchorEl","children","modifiers","usePortal","style","portalSelector","distance","skidding","arrowPadding","offsetFn","props","arrowRef","popperRef","popperEngineInstance","defaultModifiers","arrowModifier","name","options","element","padding","offsetModifier","offset","current","destroy","forceUpdate","hidden","contextValue","ret","position","left","top"],"mappings":";;;AACA,SACEA,UADF,EAEEC,MAFF,EAGEC,SAHF,EAIEC,eAJF,EAKEC,OALF,EAMEC,IANF,QAOO,OAPP;AAeA,SAASC,YAAT,QAA6B,gBAA7B;AAIA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA,SAASC,cAAT,QAA+B,WAA/B;AACA,SAASC,MAAT,QAAuB,WAAvB;;AAEA,IAAMC,iB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Cf,IAAAA,QAAQ,EAARA;AADuC,GAAzC;;AAIA,MAAMgB,GAAG,gBACP,KAAC,cAAD;AAAgB,IAAA,KAAK,EAAED,YAAvB;AAAA,2BACE,KAAC,IAAD,eACMhB,KADN;AAEE,MAAA,EAAE,EAAEX,OAFN;AAGE,MAAA,GAAG,EAAEZ,kBAAkB,CAACyB,SAAD,EAAYlB,YAAZ,CAHzB;AAIE,MAAA,KAAK;AAAIkC,QAAAA,QAAQ,EAAE,OAAd;AAAuBC,QAAAA,IAAI,EAAE,CAAC,IAA9B;AAAoCC,QAAAA,GAAG,EAAE,CAAC;AAA1C,SAAmD1B,KAAnD,CAJP;AAAA,gBAMGH;AANH;AADF,IADF;;AAaA,MAAIE,SAAJ,EAAe;AACb,wBAAO,KAAC,MAAD;AAAQ,MAAA,QAAQ,EAAEE,cAAlB;AAAA,gBAAmCsB;AAAnC,MAAP;AACD;;AAED,SAAOA,GAAP;AACD,CAxFS,CADc,CAAnB","sourcesContent":["import type { HTMLAttributes, ElementType, RefObject, ReactNode } from 'react';\nimport {\n forwardRef,\n useRef,\n useEffect,\n useLayoutEffect,\n useMemo,\n memo,\n} from 'react';\nimport type {\n Placement,\n Modifier,\n PositioningStrategy,\n Instance,\n Rect,\n} from '@popperjs/core';\nimport { createPopper } from '@popperjs/core';\nimport type { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';\nimport type { ArrowModifier } from '@popperjs/core/lib/modifiers/arrow';\n\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport type { PopperContextProps } from './context';\nimport { PopperProvider } from './context';\nimport { Portal } from '../Portal';\n\nconst useEnhancedEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport type OffsetsFunction = (arg0: {\n popper: Rect;\n reference: Rect;\n placement: Placement;\n}) => [number | null | undefined, number | null | undefined];\n\nexport interface PopperProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n anchorEl: RefObject<HTMLElement>;\n children?: ReactNode;\n placement?: Placement;\n strategy?: PositioningStrategy;\n modifiers?: Array<Partial<Modifier<any, any>>>;\n usePortal?: boolean;\n portalSelector?: string;\n /**\n * Displaces the popper along the reference element.\n */\n skidding?: number;\n /**\n * Displaces the popper away from, or toward, the reference element in the direction of its placement. A positive number displaces it further away, while a negative number lets it overlap the reference.\n */\n distance?: number;\n /**\n * An optional function that must return a pair of [skidding, padding]. Useful for doing things like, displace the popper by 100%.\n */\n offsetFn?: OffsetsFunction;\n /**\n * If you don't want the arrow to reach the very edge of the popper (this is common if your popper has rounded corners using border-radius), you can apply some padding to it.\n */\n arrowPadding?: number;\n}\n\nconst emptyModifiers: Array<Partial<Modifier<any, any>>> = [];\nexport const Popper = memo(\n forwardRef<HTMLDivElement, PopperProps>(function Popper(\n {\n placement = 'bottom',\n strategy = 'absolute',\n as: Comp = 'div',\n innerAs,\n anchorEl,\n children,\n modifiers = emptyModifiers,\n usePortal = false,\n style = {},\n portalSelector = 'body',\n distance = 0,\n skidding = 0,\n arrowPadding = 5,\n offsetFn,\n ...props\n },\n forwardedRef\n ) {\n const arrowRef = useRef<HTMLSpanElement>(null);\n\n const popperRef = useRef<HTMLDivElement | null>(null);\n const popperEngineInstance = useRef<null | Instance>(null);\n\n const defaultModifiers: Array<Partial<Modifier<any, any>>> = useMemo(() => {\n const arrowModifier: Omit<ArrowModifier, 'enabled' | 'fn' | 'phase'> = {\n name: 'arrow',\n options: {\n element: '[data-popper-arrow]',\n padding: arrowPadding,\n },\n };\n const offsetModifier: Omit<OffsetModifier, 'enabled' | 'fn' | 'phase'> = {\n name: 'offset',\n options: {\n offset: offsetFn ?? [skidding, distance],\n },\n };\n\n return [arrowModifier, offsetModifier];\n }, [arrowPadding, distance, skidding, offsetFn]);\n\n useEnhancedEffect(() => {\n if (anchorEl && anchorEl.current && popperRef.current) {\n popperEngineInstance.current = createPopper(\n anchorEl.current,\n popperRef.current,\n {\n placement,\n strategy,\n modifiers: [...defaultModifiers, ...modifiers],\n }\n );\n }\n\n return () => {\n popperEngineInstance.current && popperEngineInstance.current.destroy();\n popperEngineInstance.current = null;\n };\n }, [anchorEl, modifiers, placement, strategy, defaultModifiers]);\n\n useEnhancedEffect(() => {\n popperEngineInstance.current?.forceUpdate();\n }, [props.hidden || props['aria-hidden']]);\n\n const contextValue: PopperContextProps = {\n arrowRef,\n };\n\n const ret = (\n <PopperProvider value={contextValue}>\n <Comp\n {...props}\n as={innerAs}\n ref={assignMultipleRefs(popperRef, forwardedRef)}\n style={{ position: 'fixed', left: -5000, top: -5000, ...style }}\n >\n {children}\n </Comp>\n </PopperProvider>\n );\n\n if (usePortal) {\n return <Portal selector={portalSelector}>{ret}</Portal>;\n }\n\n return ret;\n })\n);\n"],"file":"Popper.js"}
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
2
- export interface PopperArrowProps extends React.HTMLAttributes<HTMLDivElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
1
+ import type { ElementType, HTMLAttributes } from 'react';
2
+ export interface PopperArrowProps extends HTMLAttributes<HTMLDivElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
5
  }
6
- export declare const PopperArrow: React.ForwardRefExoticComponent<PopperArrowProps & React.RefAttributes<HTMLDivElement>>;
6
+ export declare const PopperArrow: import("react").ForwardRefExoticComponent<PopperArrowProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef } from 'react';
4
- import * as React from 'react';
5
4
  import { usePopperContext } from './context';
6
5
  import { assignRef } from '../utils/assignRef';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Popper/PopperArrow.tsx"],"names":["forwardRef","React","usePopperContext","assignRef","PopperArrow","ref","as","Comp","props","ctx","node","arrowRef","current","Error"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,gBAAT,QAAiC,WAAjC;AACA,SAASC,SAAT,QAA0B,oBAA1B;;AAOA,OAAO,IAAMC,WAAW,gBAAGJ,UAAU,CACnC,SAASI,WAAT,OAAqDC,KAArD,EAA0D;AAAA,qBAAnCC,EAAmC;AAAA,MAA/BC,IAA+B,wBAAxB,KAAwB;AAAA,MAAdC,KAAc;;AACxD,MAAMC,GAAG,GAAGP,gBAAgB,EAA5B;;AAEA,MAAIO,GAAG,KAAK,IAAZ,EAAkB;AAChB,WAAO,IAAP;AACD;;AAED,sBACE,KAAC,IAAD,eACMD,KADN;AAEE,IAAA,GAAG,EAAE,aAACE,IAAD,EAAiC;AACpC,UAAIA,IAAI,IAAID,GAAG,CAACE,QAAJ,CAAaC,OAArB,IAAgCH,GAAG,CAACE,QAAJ,CAAaC,OAAb,KAAyBF,IAA7D,EAAmE;AACjE,cAAM,IAAIG,KAAJ,CACJ,gEADI,CAAN;AAGD;;AAEDV,MAAAA,SAAS,CAACE,KAAD,EAAMK,IAAN,CAAT;AACAP,MAAAA,SAAS,CAACM,GAAG,CAACE,QAAL,EAAeD,IAAf,CAAT;AACD,KAXH;AAYE,yBAAkB;AAZpB,KADF;AAgBD,CAxBkC,CAA9B","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nimport { usePopperContext } from './context';\nimport { assignRef } from '../utils/assignRef';\n\nexport interface PopperArrowProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n}\n\nexport const PopperArrow = forwardRef<HTMLDivElement, PopperArrowProps>(\n function PopperArrow({ as: Comp = 'div', ...props }, ref) {\n const ctx = usePopperContext();\n\n if (ctx === null) {\n return null;\n }\n\n return (\n <Comp\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node && ctx.arrowRef.current && ctx.arrowRef.current !== node) {\n throw new Error(\n 'You can only render one <PopperArrow /> per <Popper> component'\n );\n }\n\n assignRef(ref, node);\n assignRef(ctx.arrowRef, node);\n }}\n data-popper-arrow=\"\"\n />\n );\n }\n);\n"],"file":"PopperArrow.js"}
1
+ {"version":3,"sources":["../../../src/Popper/PopperArrow.tsx"],"names":["forwardRef","usePopperContext","assignRef","PopperArrow","ref","as","Comp","props","ctx","node","arrowRef","current","Error"],"mappings":";;AACA,SAASA,UAAT,QAA2B,OAA3B;AAEA,SAASC,gBAAT,QAAiC,WAAjC;AACA,SAASC,SAAT,QAA0B,oBAA1B;;AAOA,OAAO,IAAMC,WAAW,gBAAGH,UAAU,CACnC,SAASG,WAAT,OAAqDC,KAArD,EAA0D;AAAA,qBAAnCC,EAAmC;AAAA,MAA/BC,IAA+B,wBAAxB,KAAwB;AAAA,MAAdC,KAAc;;AACxD,MAAMC,GAAG,GAAGP,gBAAgB,EAA5B;;AAEA,MAAIO,GAAG,KAAK,IAAZ,EAAkB;AAChB,WAAO,IAAP;AACD;;AAED,sBACE,KAAC,IAAD,eACMD,KADN;AAEE,IAAA,GAAG,EAAE,aAACE,IAAD,EAAiC;AACpC,UAAIA,IAAI,IAAID,GAAG,CAACE,QAAJ,CAAaC,OAArB,IAAgCH,GAAG,CAACE,QAAJ,CAAaC,OAAb,KAAyBF,IAA7D,EAAmE;AACjE,cAAM,IAAIG,KAAJ,CACJ,gEADI,CAAN;AAGD;;AAEDV,MAAAA,SAAS,CAACE,KAAD,EAAMK,IAAN,CAAT;AACAP,MAAAA,SAAS,CAACM,GAAG,CAACE,QAAL,EAAeD,IAAf,CAAT;AACD,KAXH;AAYE,yBAAkB;AAZpB,KADF;AAgBD,CAxBkC,CAA9B","sourcesContent":["import type { ElementType, HTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\n\nimport { usePopperContext } from './context';\nimport { assignRef } from '../utils/assignRef';\n\nexport interface PopperArrowProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n}\n\nexport const PopperArrow = forwardRef<HTMLDivElement, PopperArrowProps>(\n function PopperArrow({ as: Comp = 'div', ...props }, ref) {\n const ctx = usePopperContext();\n\n if (ctx === null) {\n return null;\n }\n\n return (\n <Comp\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node && ctx.arrowRef.current && ctx.arrowRef.current !== node) {\n throw new Error(\n 'You can only render one <PopperArrow /> per <Popper> component'\n );\n }\n\n assignRef(ref, node);\n assignRef(ctx.arrowRef, node);\n }}\n data-popper-arrow=\"\"\n />\n );\n }\n);\n"],"file":"PopperArrow.js"}
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
1
+ import type { ElementType, InputHTMLAttributes, ReactNode } from 'react';
2
2
  import type { RadioValue } from './context';
3
- export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value'> {
4
- as?: React.ElementType<any>;
5
- innerAs?: React.ElementType<any>;
6
- children?: React.ReactNode;
3
+ export interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value'> {
4
+ as?: ElementType<any>;
5
+ innerAs?: ElementType<any>;
6
+ children?: ReactNode;
7
7
  checked?: boolean;
8
8
  value: RadioValue;
9
9
  }
10
- export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
10
+ export declare const RadioButton: import("react").ForwardRefExoticComponent<RadioButtonProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef } from 'react';
4
- import * as React from 'react';
5
4
  import { useRadioGroupContext } from './context';
6
5
  import { wrapEvent } from '../utils';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/RadioButton/RadioButton.tsx"],"names":["forwardRef","React","useRadioGroupContext","wrapEvent","RadioButton","props","forwardedRef","as","Comp","valueProp","value","onChangeProp","onChange","checkedProp","checked","nameProp","name","otherProps","radioGroupContext","handleChange","e","String"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAGA,SAASC,oBAAT,QAAqC,WAArC;AACA,SAASC,SAAT,QAA0B,UAA1B;;AAWA,OAAO,IAAMC,WAAW,gBAAGJ,UAAU,CACnC,SAASI,WAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA0C;AAAA,kBAQpCD,KARoC,CAEtCE,EAFsC;AAAA,MAElCC,IAFkC,0BAE3B,OAF2B;AAAA,MAG/BC,SAH+B,GAQpCJ,KARoC,CAGtCK,KAHsC;AAAA,MAI5BC,YAJ4B,GAQpCN,KARoC,CAItCO,QAJsC;AAAA,MAK7BC,WAL6B,GAQpCR,KARoC,CAKtCS,OALsC;AAAA,MAMhCC,QANgC,GAQpCV,KARoC,CAMtCW,IANsC;AAAA,MAOnCC,UAPmC,4BAQpCZ,KARoC;;AASxC,MAAMa,iBAAiB,GAAGhB,oBAAoB,EAA9C;;AAEA,MAAMiB,YAAY,GAAG,SAAfA,YAAe,CAACC,CAAD,EAA4C;AAC/DF,IAAAA,iBAAiB,QAAjB,YAAAA,iBAAiB,CAAEN,QAAnB,oBAAAM,iBAAiB,CAAEN,QAAnB,CAA8BQ,CAA9B,EAAiCX,SAAjC;AACD,GAFD;;AAIA,MAAMK,OAAO,GAAGI,iBAAiB,GAC7BA,iBAAiB,CAACR,KAAlB,KAA4BD,SADC,GAE7BI,WAFJ;AAIA,sBACE,KAAC,IAAD;AACE,IAAA,GAAG,EAAEP,YADP;AAEE,IAAA,IAAI,EAAC,OAFP;AAGE,IAAA,OAAO,EAAEQ,OAHX;AAIE,oBAAcO,MAAM,CAACP,OAAD,CAJtB;AAKE,IAAA,IAAI,EAAEI,iBAAiB,GAAGA,iBAAiB,CAACF,IAArB,GAA4BD,QALrD;AAME,IAAA,QAAQ,EAAEZ,SAAS,CAACQ,YAAD,EAAeQ,YAAf,CANrB;AAOE,IAAA,KAAK,EAAEV;AAPT,KAQMQ,UARN,EADF;AAYD,CAhCkC,CAA9B","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nimport type { RadioValue } from './context';\nimport { useRadioGroupContext } from './context';\nimport { wrapEvent } from '../utils';\n\nexport interface RadioButtonProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value'> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n children?: React.ReactNode;\n checked?: boolean;\n value: RadioValue;\n}\n\nexport const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(\n function RadioButton(props, forwardedRef) {\n const {\n as: Comp = 'input',\n value: valueProp,\n onChange: onChangeProp,\n checked: checkedProp,\n name: nameProp,\n ...otherProps\n } = props;\n const radioGroupContext = useRadioGroupContext();\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n radioGroupContext?.onChange?.(e, valueProp);\n };\n\n const checked = radioGroupContext\n ? radioGroupContext.value === valueProp\n : checkedProp;\n\n return (\n <Comp\n ref={forwardedRef}\n type=\"radio\"\n checked={checked}\n aria-checked={String(checked)}\n name={radioGroupContext ? radioGroupContext.name : nameProp}\n onChange={wrapEvent(onChangeProp, handleChange)}\n value={valueProp}\n {...otherProps}\n />\n );\n }\n);\n"],"file":"RadioButton.js"}
1
+ {"version":3,"sources":["../../../src/RadioButton/RadioButton.tsx"],"names":["forwardRef","useRadioGroupContext","wrapEvent","RadioButton","props","forwardedRef","as","Comp","valueProp","value","onChangeProp","onChange","checkedProp","checked","nameProp","name","otherProps","radioGroupContext","handleChange","e","String"],"mappings":";;AAMA,SAASA,UAAT,QAA2B,OAA3B;AAGA,SAASC,oBAAT,QAAqC,WAArC;AACA,SAASC,SAAT,QAA0B,UAA1B;;AAWA,OAAO,IAAMC,WAAW,gBAAGH,UAAU,CACnC,SAASG,WAAT,CAAqBC,KAArB,EAA4BC,YAA5B,EAA0C;AAAA,kBAQpCD,KARoC,CAEtCE,EAFsC;AAAA,MAElCC,IAFkC,0BAE3B,OAF2B;AAAA,MAG/BC,SAH+B,GAQpCJ,KARoC,CAGtCK,KAHsC;AAAA,MAI5BC,YAJ4B,GAQpCN,KARoC,CAItCO,QAJsC;AAAA,MAK7BC,WAL6B,GAQpCR,KARoC,CAKtCS,OALsC;AAAA,MAMhCC,QANgC,GAQpCV,KARoC,CAMtCW,IANsC;AAAA,MAOnCC,UAPmC,4BAQpCZ,KARoC;;AASxC,MAAMa,iBAAiB,GAAGhB,oBAAoB,EAA9C;;AAEA,MAAMiB,YAAY,GAAG,SAAfA,YAAe,CAACC,CAAD,EAAsC;AACzDF,IAAAA,iBAAiB,QAAjB,YAAAA,iBAAiB,CAAEN,QAAnB,oBAAAM,iBAAiB,CAAEN,QAAnB,CAA8BQ,CAA9B,EAAiCX,SAAjC;AACD,GAFD;;AAIA,MAAMK,OAAO,GAAGI,iBAAiB,GAC7BA,iBAAiB,CAACR,KAAlB,KAA4BD,SADC,GAE7BI,WAFJ;AAIA,sBACE,KAAC,IAAD;AACE,IAAA,GAAG,EAAEP,YADP;AAEE,IAAA,IAAI,EAAC,OAFP;AAGE,IAAA,OAAO,EAAEQ,OAHX;AAIE,oBAAcO,MAAM,CAACP,OAAD,CAJtB;AAKE,IAAA,IAAI,EAAEI,iBAAiB,GAAGA,iBAAiB,CAACF,IAArB,GAA4BD,QALrD;AAME,IAAA,QAAQ,EAAEZ,SAAS,CAACQ,YAAD,EAAeQ,YAAf,CANrB;AAOE,IAAA,KAAK,EAAEV;AAPT,KAQMQ,UARN,EADF;AAYD,CAhCkC,CAA9B","sourcesContent":["import type {\n ChangeEvent,\n ElementType,\n InputHTMLAttributes,\n ReactNode,\n} from 'react';\nimport { forwardRef } from 'react';\n\nimport type { RadioValue } from './context';\nimport { useRadioGroupContext } from './context';\nimport { wrapEvent } from '../utils';\n\nexport interface RadioButtonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value'> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n checked?: boolean;\n value: RadioValue;\n}\n\nexport const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(\n function RadioButton(props, forwardedRef) {\n const {\n as: Comp = 'input',\n value: valueProp,\n onChange: onChangeProp,\n checked: checkedProp,\n name: nameProp,\n ...otherProps\n } = props;\n const radioGroupContext = useRadioGroupContext();\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n radioGroupContext?.onChange?.(e, valueProp);\n };\n\n const checked = radioGroupContext\n ? radioGroupContext.value === valueProp\n : checkedProp;\n\n return (\n <Comp\n ref={forwardedRef}\n type=\"radio\"\n checked={checked}\n aria-checked={String(checked)}\n name={radioGroupContext ? radioGroupContext.name : nameProp}\n onChange={wrapEvent(onChangeProp, handleChange)}\n value={valueProp}\n {...otherProps}\n />\n );\n }\n);\n"],"file":"RadioButton.js"}
@@ -1,12 +1,12 @@
1
- import * as React from 'react';
1
+ import type { ChangeEvent, ElementType, HTMLAttributes, ReactNode } from 'react';
2
2
  import type { RadioValue } from './context';
3
- export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value' | 'defaultValue'> {
4
- as?: React.ElementType<any>;
5
- innerAs?: React.ElementType<any>;
6
- children?: React.ReactNode;
3
+ export interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'value' | 'defaultValue'> {
4
+ as?: ElementType<any>;
5
+ innerAs?: ElementType<any>;
6
+ children?: ReactNode;
7
7
  value?: RadioValue;
8
8
  defaultValue?: RadioValue;
9
9
  name?: string;
10
- onChange?: (e: React.ChangeEvent<HTMLInputElement>, value: RadioValue) => void;
10
+ onChange?: (e: ChangeEvent<HTMLInputElement>, value: RadioValue) => void;
11
11
  }
12
- export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
12
+ export declare const RadioGroup: import("react").ForwardRefExoticComponent<RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import { forwardRef, useId } from 'react';
5
- import * as React from 'react';
6
5
  import { RadioGroupProvider } from './context';
7
6
  import { useControlledState } from '../hooks';
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/RadioButton/RadioGroup.tsx"],"names":["forwardRef","useId","React","RadioGroupProvider","useControlledState","RadioGroup","props","forwardedRef","as","Comp","onChangeProp","onChange","valueProp","value","nameProp","name","defaultValue","otherProps","setValue","e","fallbackId"],"mappings":";;;AAAA,SAASA,UAAT,EAAqBC,KAArB,QAAkC,OAAlC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAGA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AAmBA,OAAO,IAAMC,UAAU,gBAAGL,UAAU,CAClC,SAASK,UAAT,CAAoBC,KAApB,EAA2BC,YAA3B,EAAyC;AAAA,kBAQnCD,KARmC,CAErCE,EAFqC;AAAA,MAEjCC,IAFiC,0BAE1B,KAF0B;AAAA,MAG3BC,YAH2B,GAQnCJ,KARmC,CAGrCK,QAHqC;AAAA,MAI9BC,SAJ8B,GAQnCN,KARmC,CAIrCO,KAJqC;AAAA,MAK/BC,QAL+B,GAQnCR,KARmC,CAKrCS,IALqC;AAAA,MAMrCC,YANqC,GAQnCV,KARmC,CAMrCU,YANqC;AAAA,MAOlCC,UAPkC,4BAQnCX,KARmC;;AAAA,4BASbF,kBAAkB,CAC1CQ,SAD0C,EAE1CF,YAF0C,EAG1CM,YAH0C,EAI1C,UAACE,QAAD;AAAA,WAAc,UAACC,CAAD,EAAIN,KAAJ,EAAc;AAC1BK,MAAAA,QAAQ,CAACL,KAAD,CAAR;AACD,KAFD;AAAA,GAJ0C,CATL;AAAA;AAAA,MAShCA,KATgC;AAAA,MASzBF,QATyB;;AAkBvC,MAAMS,UAAU,GAAGnB,KAAK,EAAxB;AAEA,sBACE,KAAC,kBAAD;AACE,IAAA,KAAK,EAAE;AACLY,MAAAA,KAAK,EAALA,KADK;AAELF,MAAAA,QAAQ,EAARA,QAFK;AAGLI,MAAAA,IAAI,EAAED,QAAQ,IAAIM;AAHb,KADT;AAAA,2BAOE,KAAC,IAAD;AAAM,MAAA,GAAG,EAAEb,YAAX;AAAyB,MAAA,IAAI,EAAC;AAA9B,OAA+CU,UAA/C;AAPF,IADF;AAWD,CAhCiC,CAA7B","sourcesContent":["import { forwardRef, useId } from 'react';\nimport * as React from 'react';\n\nimport type { RadioValue } from './context';\nimport { RadioGroupProvider } from './context';\nimport { useControlledState } from '../hooks';\n\nexport interface RadioGroupProps\n extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'value' | 'defaultValue'\n > {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n children?: React.ReactNode;\n value?: RadioValue;\n defaultValue?: RadioValue;\n name?: string;\n onChange?: (\n e: React.ChangeEvent<HTMLInputElement>,\n value: RadioValue\n ) => void;\n}\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n function RadioGroup(props, forwardedRef) {\n const {\n as: Comp = 'div',\n onChange: onChangeProp,\n value: valueProp,\n name: nameProp,\n defaultValue,\n ...otherProps\n } = props;\n const [value, onChange] = useControlledState(\n valueProp,\n onChangeProp,\n defaultValue,\n (setValue) => (e, value) => {\n setValue(value);\n }\n );\n\n const fallbackId = useId();\n\n return (\n <RadioGroupProvider\n value={{\n value,\n onChange,\n name: nameProp || fallbackId,\n }}\n >\n <Comp ref={forwardedRef} role=\"radiogroup\" {...otherProps} />\n </RadioGroupProvider>\n );\n }\n);\n"],"file":"RadioGroup.js"}
1
+ {"version":3,"sources":["../../../src/RadioButton/RadioGroup.tsx"],"names":["forwardRef","useId","RadioGroupProvider","useControlledState","RadioGroup","props","forwardedRef","as","Comp","onChangeProp","onChange","valueProp","value","nameProp","name","defaultValue","otherProps","setValue","e","fallbackId"],"mappings":";;;AAMA,SAASA,UAAT,EAAqBC,KAArB,QAAkC,OAAlC;AAGA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,kBAAT,QAAmC,UAAnC;;AAgBA,OAAO,IAAMC,UAAU,gBAAGJ,UAAU,CAClC,SAASI,UAAT,CAAoBC,KAApB,EAA2BC,YAA3B,EAAyC;AAAA,kBAQnCD,KARmC,CAErCE,EAFqC;AAAA,MAEjCC,IAFiC,0BAE1B,KAF0B;AAAA,MAG3BC,YAH2B,GAQnCJ,KARmC,CAGrCK,QAHqC;AAAA,MAI9BC,SAJ8B,GAQnCN,KARmC,CAIrCO,KAJqC;AAAA,MAK/BC,QAL+B,GAQnCR,KARmC,CAKrCS,IALqC;AAAA,MAMrCC,YANqC,GAQnCV,KARmC,CAMrCU,YANqC;AAAA,MAOlCC,UAPkC,4BAQnCX,KARmC;;AAAA,4BASbF,kBAAkB,CAC1CQ,SAD0C,EAE1CF,YAF0C,EAG1CM,YAH0C,EAI1C,UAACE,QAAD;AAAA,WAAc,UAACC,CAAD,EAAIN,KAAJ,EAAc;AAC1BK,MAAAA,QAAQ,CAACL,KAAD,CAAR;AACD,KAFD;AAAA,GAJ0C,CATL;AAAA;AAAA,MAShCA,KATgC;AAAA,MASzBF,QATyB;;AAkBvC,MAAMS,UAAU,GAAGlB,KAAK,EAAxB;AAEA,sBACE,KAAC,kBAAD;AACE,IAAA,KAAK,EAAE;AACLW,MAAAA,KAAK,EAALA,KADK;AAELF,MAAAA,QAAQ,EAARA,QAFK;AAGLI,MAAAA,IAAI,EAAED,QAAQ,IAAIM;AAHb,KADT;AAAA,2BAOE,KAAC,IAAD;AAAM,MAAA,GAAG,EAAEb,YAAX;AAAyB,MAAA,IAAI,EAAC;AAA9B,OAA+CU,UAA/C;AAPF,IADF;AAWD,CAhCiC,CAA7B","sourcesContent":["import type {\n ChangeEvent,\n ElementType,\n HTMLAttributes,\n ReactNode,\n} from 'react';\nimport { forwardRef, useId } from 'react';\n\nimport type { RadioValue } from './context';\nimport { RadioGroupProvider } from './context';\nimport { useControlledState } from '../hooks';\n\nexport interface RadioGroupProps\n extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'value' | 'defaultValue'\n > {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n value?: RadioValue;\n defaultValue?: RadioValue;\n name?: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>, value: RadioValue) => void;\n}\n\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n function RadioGroup(props, forwardedRef) {\n const {\n as: Comp = 'div',\n onChange: onChangeProp,\n value: valueProp,\n name: nameProp,\n defaultValue,\n ...otherProps\n } = props;\n const [value, onChange] = useControlledState(\n valueProp,\n onChangeProp,\n defaultValue,\n (setValue) => (e, value) => {\n setValue(value);\n }\n );\n\n const fallbackId = useId();\n\n return (\n <RadioGroupProvider\n value={{\n value,\n onChange,\n name: nameProp || fallbackId,\n }}\n >\n <Comp ref={forwardedRef} role=\"radiogroup\" {...otherProps} />\n </RadioGroupProvider>\n );\n }\n);\n"],"file":"RadioGroup.js"}
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import type { ChangeEvent } from 'react';
2
2
  export declare type RadioValue = string | number | boolean;
3
3
  export interface RadioGroupContextProps {
4
4
  value: RadioValue | undefined;
5
- onChange?: (e: React.ChangeEvent<HTMLInputElement>, value: RadioValue) => void;
5
+ onChange?: (e: ChangeEvent<HTMLInputElement>, value: RadioValue) => void;
6
6
  name: string | undefined;
7
7
  }
8
8
  export declare const RadioGroupProvider: import("react").Provider<RadioGroupContextProps | undefined>;
File without changes
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/RadioButton/context.ts"],"names":["createContext","useContext","RadioGroupContext","undefined","RadioGroupProvider","Provider","useRadioGroupContext"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AAcA,IAAMC,iBAAiB,gBAAGF,aAAa,CACrCG,SADqC,CAAvC;IAGyBC,kB,GAAuBF,iB,CAAjCG,Q;;AACf,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB;AAAA,SAAML,UAAU,CAACC,iBAAD,CAAhB;AAAA,CAA7B","sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type RadioValue = string | number | boolean;\n\n// RadioGroup Component\nexport interface RadioGroupContextProps {\n value: RadioValue | undefined;\n onChange?: (\n e: React.ChangeEvent<HTMLInputElement>,\n value: RadioValue\n ) => void;\n name: string | undefined;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextProps | undefined>(\n undefined\n);\nexport const { Provider: RadioGroupProvider } = RadioGroupContext;\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n"],"file":"context.js"}
1
+ {"version":3,"sources":["../../../src/RadioButton/context.ts"],"names":["createContext","useContext","RadioGroupContext","undefined","RadioGroupProvider","Provider","useRadioGroupContext"],"mappings":"AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AAWA,IAAMC,iBAAiB,gBAAGF,aAAa,CACrCG,SADqC,CAAvC;IAGyBC,kB,GAAuBF,iB,CAAjCG,Q;;AACf,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB;AAAA,SAAML,UAAU,CAACC,iBAAD,CAAhB;AAAA,CAA7B","sourcesContent":["import type { ChangeEvent } from 'react';\nimport { createContext, useContext } from 'react';\n\nexport type RadioValue = string | number | boolean;\n\n// RadioGroup Component\nexport interface RadioGroupContextProps {\n value: RadioValue | undefined;\n onChange?: (e: ChangeEvent<HTMLInputElement>, value: RadioValue) => void;\n name: string | undefined;\n}\n\nconst RadioGroupContext = createContext<RadioGroupContextProps | undefined>(\n undefined\n);\nexport const { Provider: RadioGroupProvider } = RadioGroupContext;\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n"],"file":"context.js"}
File without changes
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
- export interface SkipNavProps extends React.HTMLAttributes<HTMLDivElement> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
5
- children?: React.ReactNode;
1
+ import type { ElementType, HTMLAttributes, ReactNode } from 'react';
2
+ export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
+ children?: ReactNode;
6
6
  }
7
- export declare const SkipNav: React.ForwardRefExoticComponent<SkipNavProps & React.RefAttributes<HTMLDivElement>>;
7
+ export declare const SkipNav: import("react").ForwardRefExoticComponent<SkipNavProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import { forwardRef } from 'react';
4
- import * as React from 'react';
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  export var SkipNav = /*#__PURE__*/forwardRef(function SkipNav(props, forwardedRef) {
7
6
  var _props$as = props.as,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/SkipNav/SkipNav.tsx"],"names":["forwardRef","React","SkipNav","props","forwardedRef","as","Comp","otherProps"],"mappings":";;AAAA,SAASA,UAAT,QAA2B,OAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;;AAQA,OAAO,IAAMC,OAAO,gBAAGF,UAAU,CAC/B,SAASE,OAAT,CAAiBC,KAAjB,EAAwBC,YAAxB,EAAsC;AAAA,kBACQD,KADR,CAC5BE,EAD4B;AAAA,MACxBC,IADwB,0BACjB,KADiB;AAAA,MACPC,UADO,4BACQJ,KADR;;AAGpC,sBAAO,KAAC,IAAD;AAAM,IAAA,GAAG,EAAEC;AAAX,KAA6BG,UAA7B,EAAP;AACD,CAL8B,CAA1B","sourcesContent":["import { forwardRef } from 'react';\nimport * as React from 'react';\n\nexport interface SkipNavProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n innerAs?: React.ElementType<any>;\n children?: React.ReactNode;\n}\n\nexport const SkipNav = forwardRef<HTMLDivElement, SkipNavProps>(\n function SkipNav(props, forwardedRef) {\n const { as: Comp = 'div', ...otherProps } = props;\n\n return <Comp ref={forwardedRef} {...otherProps} />;\n }\n);\n"],"file":"SkipNav.js"}
1
+ {"version":3,"sources":["../../../src/SkipNav/SkipNav.tsx"],"names":["forwardRef","SkipNav","props","forwardedRef","as","Comp","otherProps"],"mappings":";;AACA,SAASA,UAAT,QAA2B,OAA3B;;AAQA,OAAO,IAAMC,OAAO,gBAAGD,UAAU,CAC/B,SAASC,OAAT,CAAiBC,KAAjB,EAAwBC,YAAxB,EAAsC;AAAA,kBACQD,KADR,CAC5BE,EAD4B;AAAA,MACxBC,IADwB,0BACjB,KADiB;AAAA,MACPC,UADO,4BACQJ,KADR;;AAGpC,sBAAO,KAAC,IAAD;AAAM,IAAA,GAAG,EAAEC;AAAX,KAA6BG,UAA7B,EAAP;AACD,CAL8B,CAA1B","sourcesContent":["import type { ElementType, HTMLAttributes, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nexport interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n}\n\nexport const SkipNav = forwardRef<HTMLDivElement, SkipNavProps>(\n function SkipNav(props, forwardedRef) {\n const { as: Comp = 'div', ...otherProps } = props;\n\n return <Comp ref={forwardedRef} {...otherProps} />;\n }\n);\n"],"file":"SkipNav.js"}
File without changes
@@ -1,12 +1,12 @@
1
- import * as React from 'react';
2
- export interface SpinnerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
3
- as?: React.ElementType<any>;
4
- innerAs?: React.ElementType<any>;
5
- children?: React.ReactNode;
1
+ import type { HTMLAttributes, ElementType, ReactNode, MouseEvent, KeyboardEvent } from 'react';
2
+ export interface SpinnerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
3
+ as?: ElementType<any>;
4
+ innerAs?: ElementType<any>;
5
+ children?: ReactNode;
6
6
  value?: number;
7
7
  minValue?: number;
8
8
  maxValue?: number;
9
9
  stepSize?: number;
10
- onChange?: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLDivElement>, value: number) => void;
10
+ onChange?: (e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLDivElement>, value: number) => void;
11
11
  }
12
- export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<HTMLDivElement>>;
12
+ export declare const Spinner: import("react").ForwardRefExoticComponent<SpinnerProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import { forwardRef, useState, useRef } from 'react';
5
- import * as React from 'react';
6
5
  import { SpinnerProvider } from './context';
7
6
  import { clamp as clampFunc } from '../utils/clamp';
8
7
  import { wrapEvent, assignMultipleRefs } from '../utils';