@basic-ui/core 0.0.53 → 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 (302) hide show
  1. package/build/cjs/index.js +278 -505
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/Accordion/Accordion.js +20 -29
  4. package/build/esm/Accordion/Accordion.js.map +1 -1
  5. package/build/esm/Accordion/AccordionBody.js +18 -32
  6. package/build/esm/Accordion/AccordionBody.js.map +1 -1
  7. package/build/esm/Accordion/AccordionHeader.js +37 -74
  8. package/build/esm/Accordion/AccordionHeader.js.map +1 -1
  9. package/build/esm/Accordion/AccordionItem.js +19 -22
  10. package/build/esm/Accordion/AccordionItem.js.map +1 -1
  11. package/build/esm/Accordion/context.js +16 -13
  12. package/build/esm/Accordion/context.js.map +1 -1
  13. package/build/esm/Accordion/index.js.map +1 -1
  14. package/build/esm/Accordion/scopeQuery.js.map +1 -1
  15. package/build/esm/CheckBox/CheckBox.js +15 -25
  16. package/build/esm/CheckBox/CheckBox.js.map +1 -1
  17. package/build/esm/CheckBox/index.js.map +1 -1
  18. package/build/esm/ComboBox/Combobox.d.ts +7 -7
  19. package/build/esm/ComboBox/Combobox.js +52 -59
  20. package/build/esm/ComboBox/Combobox.js.map +1 -1
  21. package/build/esm/ComboBox/ComboboxButton.js +23 -28
  22. package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
  23. package/build/esm/ComboBox/ComboboxInput.js +67 -70
  24. package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
  25. package/build/esm/ComboBox/ComboboxLabel.js +15 -17
  26. package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
  27. package/build/esm/ComboBox/ComboboxList.js +19 -20
  28. package/build/esm/ComboBox/ComboboxList.js.map +1 -1
  29. package/build/esm/ComboBox/ComboboxOption.js +41 -45
  30. package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
  31. package/build/esm/ComboBox/ComboboxPopover.js +22 -21
  32. package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
  33. package/build/esm/ComboBox/cities.js.map +1 -1
  34. package/build/esm/ComboBox/context.js +5 -6
  35. package/build/esm/ComboBox/context.js.map +1 -1
  36. package/build/esm/ComboBox/hooks.d.ts +2 -2
  37. package/build/esm/ComboBox/hooks.js +175 -148
  38. package/build/esm/ComboBox/hooks.js.map +1 -1
  39. package/build/esm/ComboBox/index.js.map +1 -1
  40. package/build/esm/ComboBox/makeHash.js +3 -6
  41. package/build/esm/ComboBox/makeHash.js.map +1 -1
  42. package/build/esm/ComboBox/scopeQuery.js.map +1 -1
  43. package/build/esm/FocusLock/FocusLock.js +26 -32
  44. package/build/esm/FocusLock/FocusLock.js.map +1 -1
  45. package/build/esm/FocusLock/index.js.map +1 -1
  46. package/build/esm/FocusLock/tabUtils.js +5 -7
  47. package/build/esm/FocusLock/tabUtils.js.map +1 -1
  48. package/build/esm/FocusLock/useFocusLock.js +14 -19
  49. package/build/esm/FocusLock/useFocusLock.js.map +1 -1
  50. package/build/esm/List/List.js +9 -11
  51. package/build/esm/List/List.js.map +1 -1
  52. package/build/esm/List/ListItem.js +9 -11
  53. package/build/esm/List/ListItem.js.map +1 -1
  54. package/build/esm/List/context.js +6 -6
  55. package/build/esm/List/context.js.map +1 -1
  56. package/build/esm/List/index.js.map +1 -1
  57. package/build/esm/Menu/ContextMenuTrigger.d.ts +4 -4
  58. package/build/esm/Menu/ContextMenuTrigger.js +32 -37
  59. package/build/esm/Menu/ContextMenuTrigger.js.map +1 -1
  60. package/build/esm/Menu/Menu.js +33 -49
  61. package/build/esm/Menu/Menu.js.map +1 -1
  62. package/build/esm/Menu/MenuButton.d.ts +4 -4
  63. package/build/esm/Menu/MenuButton.js +28 -44
  64. package/build/esm/Menu/MenuButton.js.map +1 -1
  65. package/build/esm/Menu/MenuItem.js +29 -38
  66. package/build/esm/Menu/MenuItem.js.map +1 -1
  67. package/build/esm/Menu/MenuList.js +61 -116
  68. package/build/esm/Menu/MenuList.js.map +1 -1
  69. package/build/esm/Menu/MenuPopover.js +16 -19
  70. package/build/esm/Menu/MenuPopover.js.map +1 -1
  71. package/build/esm/Menu/context.d.ts +1 -1
  72. package/build/esm/Menu/context.js +14 -12
  73. package/build/esm/Menu/context.js.map +1 -1
  74. package/build/esm/Menu/fixtures/countryList.js +1 -1
  75. package/build/esm/Menu/fixtures/countryList.js.map +1 -1
  76. package/build/esm/Menu/index.js.map +1 -1
  77. package/build/esm/Menu/scope.js.map +1 -1
  78. package/build/esm/Modal/Modal.js +13 -18
  79. package/build/esm/Modal/Modal.js.map +1 -1
  80. package/build/esm/Modal/ModalBackdrop.js +24 -33
  81. package/build/esm/Modal/ModalBackdrop.js.map +1 -1
  82. package/build/esm/Modal/index.js.map +1 -1
  83. package/build/esm/Popper/Popper.d.ts +3 -3
  84. package/build/esm/Popper/Popper.js +44 -61
  85. package/build/esm/Popper/Popper.js.map +1 -1
  86. package/build/esm/Popper/PopperArrow.js +11 -16
  87. package/build/esm/Popper/PopperArrow.js.map +1 -1
  88. package/build/esm/Popper/context.js +3 -5
  89. package/build/esm/Popper/context.js.map +1 -1
  90. package/build/esm/Popper/index.js.map +1 -1
  91. package/build/esm/Portal/Portal.js +9 -11
  92. package/build/esm/Portal/Portal.js.map +1 -1
  93. package/build/esm/Portal/PortalSelectorProvider.d.ts +3 -3
  94. package/build/esm/Portal/PortalSelectorProvider.js +6 -4
  95. package/build/esm/Portal/PortalSelectorProvider.js.map +1 -1
  96. package/build/esm/Portal/index.js.map +1 -1
  97. package/build/esm/RadioButton/RadioButton.js +17 -23
  98. package/build/esm/RadioButton/RadioButton.js.map +1 -1
  99. package/build/esm/RadioButton/RadioGroup.js +19 -28
  100. package/build/esm/RadioButton/RadioGroup.js.map +1 -1
  101. package/build/esm/RadioButton/context.d.ts +1 -1
  102. package/build/esm/RadioButton/context.js +8 -6
  103. package/build/esm/RadioButton/context.js.map +1 -1
  104. package/build/esm/RadioButton/index.js.map +1 -1
  105. package/build/esm/SkipNav/SkipNav.js +9 -11
  106. package/build/esm/SkipNav/SkipNav.js.map +1 -1
  107. package/build/esm/SkipNav/index.js.map +1 -1
  108. package/build/esm/Slider/Slider.d.ts +7 -7
  109. package/build/esm/Slider/Slider.js +340 -407
  110. package/build/esm/Slider/Slider.js.map +1 -1
  111. package/build/esm/Slider/index.js.map +1 -1
  112. package/build/esm/Spinner/Spinner.js +31 -59
  113. package/build/esm/Spinner/Spinner.js.map +1 -1
  114. package/build/esm/Spinner/SpinnerButton.js +14 -19
  115. package/build/esm/Spinner/SpinnerButton.js.map +1 -1
  116. package/build/esm/Spinner/context.js +8 -7
  117. package/build/esm/Spinner/context.js.map +1 -1
  118. package/build/esm/Spinner/index.js.map +1 -1
  119. package/build/esm/Tabs/Tab.js +32 -50
  120. package/build/esm/Tabs/Tab.js.map +1 -1
  121. package/build/esm/Tabs/TabList.js +24 -34
  122. package/build/esm/Tabs/TabList.js.map +1 -1
  123. package/build/esm/Tabs/TabPanel.js +16 -23
  124. package/build/esm/Tabs/TabPanel.js.map +1 -1
  125. package/build/esm/Tabs/TabPanels.js +15 -20
  126. package/build/esm/Tabs/TabPanels.js.map +1 -1
  127. package/build/esm/Tabs/Tabs.js +17 -33
  128. package/build/esm/Tabs/Tabs.js.map +1 -1
  129. package/build/esm/Tabs/context.js +16 -13
  130. package/build/esm/Tabs/context.js.map +1 -1
  131. package/build/esm/Tabs/index.js.map +1 -1
  132. package/build/esm/Tabs/scopeQuery.js.map +1 -1
  133. package/build/esm/Tooltip/Tooltip.d.ts +2 -2
  134. package/build/esm/Tooltip/Tooltip.js +20 -30
  135. package/build/esm/Tooltip/Tooltip.js.map +1 -1
  136. package/build/esm/Tooltip/index.js.map +1 -1
  137. package/build/esm/Tooltip/stateMachine.d.ts +2 -2
  138. package/build/esm/Tooltip/stateMachine.js +95 -81
  139. package/build/esm/Tooltip/stateMachine.js.map +1 -1
  140. package/build/esm/Tooltip/useTooltip.d.ts +2 -2
  141. package/build/esm/Tooltip/useTooltip.js +38 -50
  142. package/build/esm/Tooltip/useTooltip.js.map +1 -1
  143. package/build/esm/hooks/index.js.map +1 -1
  144. package/build/esm/hooks/useAutoFocus.js +3 -3
  145. package/build/esm/hooks/useAutoFocus.js.map +1 -1
  146. package/build/esm/hooks/useChildrenCounter.js +6 -8
  147. package/build/esm/hooks/useChildrenCounter.js.map +1 -1
  148. package/build/esm/hooks/useControlledState.js +6 -16
  149. package/build/esm/hooks/useControlledState.js.map +1 -1
  150. package/build/esm/hooks/useFocusReturn.js +8 -12
  151. package/build/esm/hooks/useFocusReturn.js.map +1 -1
  152. package/build/esm/hooks/useFocusState.d.ts +2 -2
  153. package/build/esm/hooks/useFocusState.js +9 -15
  154. package/build/esm/hooks/useFocusState.js.map +1 -1
  155. package/build/esm/hooks/useGestureHandlers.d.ts +1 -1
  156. package/build/esm/hooks/useGestureHandlers.js +80 -100
  157. package/build/esm/hooks/useGestureHandlers.js.map +1 -1
  158. package/build/esm/hooks/useMeasure.js +7 -15
  159. package/build/esm/hooks/useMeasure.js.map +1 -1
  160. package/build/esm/hooks/useOnClickOutside.js +4 -6
  161. package/build/esm/hooks/useOnClickOutside.js.map +1 -1
  162. package/build/esm/hooks/useOnKeyDown.js +3 -4
  163. package/build/esm/hooks/useOnKeyDown.js.map +1 -1
  164. package/build/esm/hooks/useReducerMachine.d.ts +1 -1
  165. package/build/esm/hooks/useReducerMachine.js +15 -26
  166. package/build/esm/hooks/useReducerMachine.js.map +1 -1
  167. package/build/esm/hooks/useRemoveBodyScroll.js +9 -14
  168. package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
  169. package/build/esm/hooks/useScope.d.ts +2 -2
  170. package/build/esm/hooks/useScope.js +12 -14
  171. package/build/esm/hooks/useScope.js.map +1 -1
  172. package/build/esm/hooks/useThrottle.js +5 -10
  173. package/build/esm/hooks/useThrottle.js.map +1 -1
  174. package/build/esm/index.js +4 -2
  175. package/build/esm/index.js.map +1 -1
  176. package/build/esm/styles.d.js +2 -0
  177. package/build/esm/styles.d.js.map +1 -0
  178. package/build/esm/utils/assign-ref.js +3 -5
  179. package/build/esm/utils/assign-ref.js.map +1 -1
  180. package/build/esm/utils/can-use-dom.js.map +1 -1
  181. package/build/esm/utils/clamp.js.map +1 -1
  182. package/build/esm/utils/context.d.ts +1 -1
  183. package/build/esm/utils/context.js +13 -20
  184. package/build/esm/utils/context.js.map +1 -1
  185. package/build/esm/utils/create-subscription.js +5 -10
  186. package/build/esm/utils/create-subscription.js.map +1 -1
  187. package/build/esm/utils/get-circular-index.js +0 -1
  188. package/build/esm/utils/get-circular-index.js.map +1 -1
  189. package/build/esm/utils/index.js.map +1 -1
  190. package/build/esm/utils/is-right-click.js.map +1 -1
  191. package/build/esm/utils/owner-document.js +1 -1
  192. package/build/esm/utils/owner-document.js.map +1 -1
  193. package/build/esm/utils/polymorphic.d.ts +10 -10
  194. package/build/esm/utils/polymorphic.js.map +1 -1
  195. package/build/esm/utils/rubber-band-clamp.js +2 -5
  196. package/build/esm/utils/rubber-band-clamp.js.map +1 -1
  197. package/build/esm/utils/use-stable-callback.js +8 -10
  198. package/build/esm/utils/use-stable-callback.js.map +1 -1
  199. package/build/esm/utils/wrap-event.d.ts +1 -1
  200. package/build/esm/utils/wrap-event.js +2 -5
  201. package/build/esm/utils/wrap-event.js.map +1 -1
  202. package/build/tsconfig-build.tsbuildinfo +1 -1
  203. package/package.json +6 -6
  204. package/src/Accordion/Accordion.tsx +1 -1
  205. package/src/Accordion/AccordionBody.tsx +1 -1
  206. package/src/Accordion/AccordionHeader.tsx +1 -2
  207. package/src/ComboBox/Combobox.tsx +2 -2
  208. package/src/ComboBox/ComboboxList.tsx +1 -1
  209. package/src/ComboBox/ComboboxOption.tsx +0 -1
  210. package/src/ComboBox/hooks.tsx +0 -3
  211. package/src/FocusLock/useFocusLock.ts +0 -1
  212. package/src/Menu/Menu.tsx +2 -3
  213. package/src/Menu/MenuItem.tsx +1 -2
  214. package/src/Menu/MenuList.tsx +4 -4
  215. package/src/Modal/Modal.story.tsx +11 -7
  216. package/src/Modal/ModalBackdrop.tsx +1 -1
  217. package/src/Modal/NavDrawer.story.tsx +9 -6
  218. package/src/Popper/Popper.story.tsx +23 -7
  219. package/src/Popper/Popper.tsx +2 -2
  220. package/src/RadioButton/RadioButton.story.tsx +2 -1
  221. package/src/Slider/Slider.tsx +6 -11
  222. package/src/Spinner/Spinner.tsx +1 -1
  223. package/src/Tabs/TabList.tsx +1 -1
  224. package/src/Tooltip/Tooltip.tsx +8 -5
  225. package/src/Tooltip/useTooltip.ts +1 -1
  226. package/src/hooks/useControlledState.ts +1 -6
  227. package/src/hooks/useGestureHandlers.ts +0 -4
  228. package/src/hooks/useRemoveBodyScroll.ts +0 -1
  229. package/src/hooks/useScope.ts +1 -1
  230. package/src/styles.d.ts +1 -0
  231. package/src/utils/polymorphic.ts +14 -10
  232. package/src/utils/use-stable-callback.ts +0 -1
  233. package/build/esm/Carousel/Carousel.d.ts +0 -9
  234. package/build/esm/Carousel/Carousel.js +0 -38
  235. package/build/esm/Carousel/Carousel.js.map +0 -1
  236. package/build/esm/Carousel/Fader.d.ts +0 -14
  237. package/build/esm/Carousel/Fader.js +0 -76
  238. package/build/esm/Carousel/Fader.js.map +0 -1
  239. package/build/esm/Carousel/FaderItem.d.ts +0 -5
  240. package/build/esm/Carousel/FaderItem.js +0 -16
  241. package/build/esm/Carousel/FaderItem.js.map +0 -1
  242. package/build/esm/Carousel/Preloader.d.ts +0 -7
  243. package/build/esm/Carousel/Preloader.js +0 -70
  244. package/build/esm/Carousel/Preloader.js.map +0 -1
  245. package/build/esm/Carousel/Slider.d.ts +0 -14
  246. package/build/esm/Carousel/Slider.js +0 -212
  247. package/build/esm/Carousel/Slider.js.map +0 -1
  248. package/build/esm/Carousel/SliderItem.d.ts +0 -12
  249. package/build/esm/Carousel/SliderItem.js +0 -41
  250. package/build/esm/Carousel/SliderItem.js.map +0 -1
  251. package/build/esm/Carousel/context.d.ts +0 -10
  252. package/build/esm/Carousel/context.js +0 -8
  253. package/build/esm/Carousel/context.js.map +0 -1
  254. package/build/esm/Carousel/getSliderParams.d.ts +0 -9
  255. package/build/esm/Carousel/getSliderParams.js +0 -85
  256. package/build/esm/Carousel/getSliderParams.js.map +0 -1
  257. package/build/esm/Carousel/index.d.ts +0 -7
  258. package/build/esm/Carousel/index.js +0 -8
  259. package/build/esm/Carousel/index.js.map +0 -1
  260. package/build/esm/Carousel/useCarouselGestures.d.ts +0 -30
  261. package/build/esm/Carousel/useCarouselGestures.js +0 -33
  262. package/build/esm/Carousel/useCarouselGestures.js.map +0 -1
  263. package/build/esm/DatePicker/DatePicker.d.ts +0 -24
  264. package/build/esm/DatePicker/DatePicker.js +0 -101
  265. package/build/esm/DatePicker/DatePicker.js.map +0 -1
  266. package/build/esm/DatePicker/DatePickerSelect.d.ts +0 -8
  267. package/build/esm/DatePicker/DatePickerSelect.js +0 -201
  268. package/build/esm/DatePicker/DatePickerSelect.js.map +0 -1
  269. package/build/esm/DatePicker/RangeDatePicker.d.ts +0 -28
  270. package/build/esm/DatePicker/RangeDatePicker.js +0 -94
  271. package/build/esm/DatePicker/RangeDatePicker.js.map +0 -1
  272. package/build/esm/DatePicker/adjustDates.d.ts +0 -4
  273. package/build/esm/DatePicker/adjustDates.js +0 -18
  274. package/build/esm/DatePicker/adjustDates.js.map +0 -1
  275. package/build/esm/DatePicker/contexts.d.ts +0 -31
  276. package/build/esm/DatePicker/contexts.js +0 -15
  277. package/build/esm/DatePicker/contexts.js.map +0 -1
  278. package/build/esm/DatePicker/dateTypes.d.ts +0 -2
  279. package/build/esm/DatePicker/dateTypes.js +0 -2
  280. package/build/esm/DatePicker/dateTypes.js.map +0 -1
  281. package/build/esm/DatePicker/hooks.d.ts +0 -36
  282. package/build/esm/DatePicker/hooks.js +0 -98
  283. package/build/esm/DatePicker/hooks.js.map +0 -1
  284. package/build/esm/DatePicker/index.d.ts +0 -5
  285. package/build/esm/DatePicker/index.js +0 -6
  286. package/build/esm/DatePicker/index.js.map +0 -1
  287. package/build/esm/hooks/useId.d.ts +0 -1
  288. package/build/esm/hooks/useId.js +0 -25
  289. package/build/esm/hooks/useId.js.map +0 -1
  290. package/build/esm/utils/assignRef.d.ts +0 -3
  291. package/build/esm/utils/assignRef.js +0 -25
  292. package/build/esm/utils/assignRef.js.map +0 -1
  293. package/build/esm/utils/getCircularIndex.d.ts +0 -1
  294. package/build/esm/utils/getCircularIndex.js +0 -8
  295. package/build/esm/utils/getCircularIndex.js.map +0 -1
  296. package/build/esm/utils/rubberBandClamp.d.ts +0 -2
  297. package/build/esm/utils/rubberBandClamp.js +0 -20
  298. package/build/esm/utils/rubberBandClamp.js.map +0 -1
  299. package/build/esm/utils/wrapEvent.d.ts +0 -3
  300. package/build/esm/utils/wrapEvent.js +0 -16
  301. package/build/esm/utils/wrapEvent.js.map +0 -1
  302. package/build/tsconfig.tsbuildinfo +0 -7270
@@ -33,7 +33,7 @@ export const ModalBackdrop = forwardRef<HTMLDivElement, ModalBackdropProps>(
33
33
  },
34
34
  forwardedRef
35
35
  ) => {
36
- const ref = useRef();
36
+ const ref = useRef(null);
37
37
  const mouseDownTargetRef = useRef<EventTarget | null>(null);
38
38
 
39
39
  const handleClick = (e: MouseEvent<HTMLDivElement>) => {
@@ -1,3 +1,4 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
1
2
  import { useState } from 'react';
2
3
  import { useSpring, animated } from 'react-spring';
3
4
 
@@ -35,7 +36,7 @@ const LoremIpsum = ({ numOfParagraphs = 20 }) => {
35
36
  return <>{content}</>;
36
37
  };
37
38
 
38
- const Wrapper = ({ children }) => {
39
+ const Wrapper = ({ children }: { children: ReactNode }) => {
39
40
  return (
40
41
  <div style={{ maxWidth: 900, margin: '0 auto' }}>
41
42
  <div
@@ -67,7 +68,7 @@ const Wrapper = ({ children }) => {
67
68
  const SimpleModalControlledAnimated = () => {
68
69
  const [open, setOpen] = useState(false);
69
70
  const [pointerEvents, setPointerEvents] =
70
- useState<PointerEventsProperty>('none');
71
+ useState<CSSProperties['pointerEvents']>('none');
71
72
  const [{ transformX, opacity }, set] = useSpring(() => ({
72
73
  transformX: -120,
73
74
  opacity: 0,
@@ -135,10 +136,12 @@ const SimpleModalControlledAnimated = () => {
135
136
  <Modal
136
137
  as={animated.div}
137
138
  className="nav-drawer-left"
138
- style={{
139
- transform: transformX.to(trans),
140
- opacity,
141
- }}
139
+ style={
140
+ {
141
+ transform: transformX.to(trans),
142
+ opacity,
143
+ } as any
144
+ }
142
145
  >
143
146
  <button>This is a cool button</button>
144
147
  Hello world
@@ -1,5 +1,7 @@
1
+ import type { ReactNode, RefObject } from 'react';
1
2
  import { useRef, useState, useEffect } from 'react';
2
3
  import { useSpring, animated } from 'react-spring';
4
+ import type { Placement } from '@popperjs/core';
3
5
 
4
6
  import { Popper } from './Popper';
5
7
  import { PopperArrow } from './PopperArrow';
@@ -28,7 +30,21 @@ const placements = [
28
30
  'left-end',
29
31
  ];
30
32
 
31
- const Tooltip = ({ children, open, placement, anchorEl, showArrow }) => {
33
+ const AnimatedDiv = animated.div as any;
34
+
35
+ const Tooltip = ({
36
+ children,
37
+ open,
38
+ placement,
39
+ anchorEl,
40
+ showArrow,
41
+ }: {
42
+ children: ReactNode;
43
+ open: boolean;
44
+ placement: Placement;
45
+ anchorEl: RefObject<HTMLElement | null>;
46
+ showArrow: boolean;
47
+ }) => {
32
48
  const [visible, setVisible] = useState(open);
33
49
  const [animationProps, set] = useSpring(() => ({
34
50
  opacity: open ? 1 : 0,
@@ -60,7 +76,7 @@ const Tooltip = ({ children, open, placement, anchorEl, showArrow }) => {
60
76
  skidding={0}
61
77
  style={{ zIndex: 1100 }}
62
78
  >
63
- <animated.div style={animationProps}>
79
+ <AnimatedDiv style={animationProps}>
64
80
  <div
65
81
  style={{
66
82
  backgroundColor: '#fff',
@@ -71,7 +87,7 @@ const Tooltip = ({ children, open, placement, anchorEl, showArrow }) => {
71
87
  {children}
72
88
  </div>
73
89
  {showArrow && <PopperArrow color="#f00" />}
74
- </animated.div>
90
+ </AnimatedDiv>
75
91
  </Popper>
76
92
  );
77
93
  };
@@ -119,7 +135,7 @@ const PopperExample = ({ showAll = false, showArrow = false }) => {
119
135
  key={`placement_${placement}`}
120
136
  open={open}
121
137
  showArrow={showArrow}
122
- placement={placement}
138
+ placement={placement as Placement}
123
139
  >
124
140
  {placement}
125
141
  </Tooltip>
@@ -190,9 +206,9 @@ const PopperFixedExample = () => {
190
206
 
191
207
  const JumpingPopperExample = () => {
192
208
  const [currentPopperIndex, setCurrentPopperIndex] = useState(0);
193
- const ref1 = useRef();
194
- const ref2 = useRef();
195
- const ref3 = useRef();
209
+ const ref1 = useRef<HTMLButtonElement | null>(null);
210
+ const ref2 = useRef<HTMLButtonElement | null>(null);
211
+ const ref3 = useRef<HTMLButtonElement | null>(null);
196
212
  const allRefs = [ref1, ref2, ref3];
197
213
 
198
214
  useEffect(() => {
@@ -35,7 +35,7 @@ export type OffsetsFunction = (arg0: {
35
35
  export interface PopperProps extends HTMLAttributes<HTMLDivElement> {
36
36
  as?: ElementType<any>;
37
37
  innerAs?: ElementType<any>;
38
- anchorEl: RefObject<HTMLElement>;
38
+ anchorEl: RefObject<HTMLElement | null>;
39
39
  children?: ReactNode;
40
40
  placement?: Placement;
41
41
  strategy?: PositioningStrategy;
@@ -73,7 +73,7 @@ export const Popper = memo(
73
73
  modifiers = emptyModifiers,
74
74
  usePortal = false,
75
75
  style = {},
76
- portalSelector = 'body',
76
+ portalSelector,
77
77
  distance = 0,
78
78
  skidding = 0,
79
79
  arrowPadding = 5,
@@ -1,6 +1,7 @@
1
1
  import { useState } from 'react';
2
2
 
3
3
  import { RadioButton, RadioGroup } from './';
4
+ import type { RadioValue } from './context';
4
5
  // import './styles.css';
5
6
 
6
7
  export default {
@@ -35,7 +36,7 @@ const UncontrolledExample = (props: { initialValue?: string }) => {
35
36
  };
36
37
 
37
38
  const ControlledExample = () => {
38
- const [value, setValue] = useState(undefined);
39
+ const [value, setValue] = useState<RadioValue | undefined>(undefined);
39
40
 
40
41
  return (
41
42
  <RadioGroup
@@ -32,7 +32,7 @@ import {
32
32
  useLayoutEffect,
33
33
  useId,
34
34
  } from 'react';
35
- import type { ReactNode, KeyboardEvent } from 'react';
35
+ import type { ReactElement, ReactNode, KeyboardEvent } from 'react';
36
36
 
37
37
  import { createContext } from '../utils/context';
38
38
  import type * as Polymorphic from '../utils/polymorphic';
@@ -233,7 +233,7 @@ const SliderInput = forwardRef(function SliderInput(
233
233
  },
234
234
  forwardedRef
235
235
  ) {
236
- const touchId: TouchIdRef = useRef();
236
+ const touchId: TouchIdRef = useRef<number | undefined>(undefined);
237
237
 
238
238
  const fallbackId = useId();
239
239
  const id = rest.id || fallbackId;
@@ -395,7 +395,6 @@ const SliderInput = forwardRef(function SliderInput(
395
395
  return;
396
396
  }
397
397
 
398
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
399
398
  const ownerDocument = getOwnerDocument(sliderRef.current)!;
400
399
  const ownerWindow = ownerDocument.defaultView || window;
401
400
  pointerDownRef.current = true;
@@ -471,7 +470,6 @@ const SliderInput = forwardRef(function SliderInput(
471
470
  });
472
471
 
473
472
  const addMoveListener = useCallback(() => {
474
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
475
473
  const ownerDocument = getOwnerDocument(sliderRef.current)!;
476
474
  const touchListener = wrapEvent(
477
475
  appEvents.current.onTouchMove,
@@ -490,7 +488,6 @@ const SliderInput = forwardRef(function SliderInput(
490
488
  }, [handlePointerMove]);
491
489
 
492
490
  const addEndListener = useCallback(() => {
493
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
494
491
  const ownerDocument = getOwnerDocument(sliderRef.current)!;
495
492
  const ownerWindow = ownerDocument.defaultView || window;
496
493
  const pointerListener = wrapEvent(
@@ -523,13 +520,12 @@ const SliderInput = forwardRef(function SliderInput(
523
520
  // e.preventDefault is ignored by React's synthetic touchStart event, so
524
521
  // we attach the listener directly to the DOM node
525
522
  // https://github.com/facebook/react/issues/9809#issuecomment-413978405
526
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
523
+
527
524
  const sliderElement = sliderRef.current!;
528
525
  if (!sliderElement) {
529
526
  return noop;
530
527
  }
531
528
 
532
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
533
529
  const ownerDocument = getOwnerDocument(sliderElement)!;
534
530
  const ownerWindow = ownerDocument.defaultView || window;
535
531
  const touchListener = wrapEvent(
@@ -730,7 +726,7 @@ const SliderRange = memo(SliderRangeImpl) as Polymorphic.MemoComponent<
730
726
  *
731
727
  * @see Docs https://reach.tech/slider#sliderrange-props
732
728
  */
733
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
729
+
734
730
  interface SliderRangeProps {}
735
731
 
736
732
  ////////////////////////////////////////////////////////////////////////////////
@@ -840,7 +836,7 @@ const SliderHandle = memo(SliderHandleImpl) as Polymorphic.MemoComponent<
840
836
  *
841
837
  * @see Docs https://reach.tech/slider#sliderhandle-props
842
838
  */
843
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
839
+
844
840
  interface SliderHandleProps {}
845
841
 
846
842
  ////////////////////////////////////////////////////////////////////////////////
@@ -1028,7 +1024,6 @@ function useDimensions(ref: React.RefObject<HTMLElement | null>) {
1028
1024
  : 0; */
1029
1025
 
1030
1026
  useLayoutEffect(() => {
1031
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1032
1027
  const ownerDocument = getOwnerDocument(ref.current)!;
1033
1028
  const ownerWindow = ownerDocument.defaultView || window;
1034
1029
  if (ref.current) {
@@ -1094,7 +1089,7 @@ type SliderChildrenRender = (props: {
1094
1089
  max?: number;
1095
1090
  min?: number;
1096
1091
  value?: number;
1097
- }) => JSX.Element;
1092
+ }) => ReactElement;
1098
1093
 
1099
1094
  ////////////////////////////////////////////////////////////////////////////////
1100
1095
  // Exports
@@ -41,7 +41,7 @@ export const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(
41
41
  ...otherProps
42
42
  } = props;
43
43
  const [spinnerHasFocus, setSpinnerHasFocus] = useState(false);
44
- const ref = useRef<HTMLDivElement>();
44
+ const ref = useRef<HTMLDivElement | null>(null);
45
45
 
46
46
  const clamp = (value: number) => clampFunc(value, minValue, maxValue);
47
47
 
@@ -30,7 +30,7 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
30
30
  ...otherProps
31
31
  } = props;
32
32
 
33
- const ref = useRef();
33
+ const ref = useRef(null);
34
34
  const tabsScope = useScope(ref);
35
35
  const tabsContext = useTabsContext();
36
36
  const id = useId();
@@ -3,7 +3,7 @@ import type {
3
3
  HTMLAttributes,
4
4
  ReactElement,
5
5
  ReactNode,
6
- RefAttributes,
6
+ Ref,
7
7
  } from 'react';
8
8
  import { forwardRef, cloneElement, Children } from 'react';
9
9
 
@@ -27,12 +27,15 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
27
27
  disabled = false,
28
28
  ...otherProps
29
29
  } = props;
30
- const child: ReactElement & RefAttributes<any> = Children.only(
31
- children
32
- ) as any;
30
+ const child = Children.only(children) as ReactElement<
31
+ HTMLAttributes<HTMLElement>
32
+ >;
33
+ // React 19: ref lives in props. React <=18: ref lives on element directly.
34
+ const childRef =
35
+ (child.props as { ref?: Ref<HTMLElement> }).ref ?? (child as any).ref;
33
36
  const [childProps, { visible, ...tooltipProps }] = useTooltip(
34
37
  child.props,
35
- child.ref,
38
+ childRef,
36
39
  otherProps
37
40
  );
38
41
 
@@ -29,7 +29,7 @@ export type ChildProps = HTMLAttributes<HTMLElement> &
29
29
  RefAttributes<HTMLElement>;
30
30
 
31
31
  export interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {
32
- anchorEl: RefObject<HTMLElement>;
32
+ anchorEl: RefObject<HTMLElement | null>;
33
33
  visible: boolean;
34
34
  children?: ReactNode;
35
35
  }
@@ -31,15 +31,10 @@ export function useControlledState<
31
31
  hasWarned.current = true;
32
32
  }
33
33
  return [
34
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
35
34
  valueProp!,
36
35
  wrapEvent(onChangeProp, defaultOnChange(setValueState)),
37
36
  ];
38
37
  }
39
38
 
40
- return [
41
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42
- valueState!,
43
- wrapEvent(onChangeProp, defaultOnChange(setValueState)),
44
- ];
39
+ return [valueState!, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
45
40
  }
@@ -189,7 +189,6 @@ export function gestureHandlers(
189
189
 
190
190
  // Touch handlers
191
191
 
192
- /* eslint-disable @typescript-eslint/no-use-before-define */
193
192
  function handleTouchMove(e: TouchEvent) {
194
193
  if (e.cancelable) {
195
194
  // prevent drag & drop behaviour from browser
@@ -213,7 +212,6 @@ export function gestureHandlers(
213
212
  return;
214
213
  }
215
214
 
216
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
217
215
  const ownerDocument = getOwnerDocument(e.currentTarget)!;
218
216
  const ownerWindow = ownerDocument.defaultView || window;
219
217
  ownerWindow.addEventListener('touchmove', handleTouchMove, {
@@ -241,7 +239,6 @@ export function gestureHandlers(
241
239
  return;
242
240
  }
243
241
 
244
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
245
242
  const ownerDocument = getOwnerDocument(e.currentTarget)!;
246
243
  const ownerWindow = ownerDocument.defaultView || window;
247
244
  if (e.button === 0) {
@@ -256,7 +253,6 @@ export function gestureHandlers(
256
253
  this.removeEventListener('mouseup', handleMouseUp);
257
254
  handleUp();
258
255
  }
259
- /* eslint-enable @typescript-eslint/no-use-before-define */
260
256
 
261
257
  return {
262
258
  onMouseDown: handleMouseDown,
@@ -10,7 +10,6 @@ export function useRemoveBodyScroll(
10
10
  ) {
11
11
  useEffect(() => {
12
12
  if (open && elementRef.current) {
13
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
14
13
  const ownerDocument = getOwnerDocument(elementRef.current)!;
15
14
  const ownerWindow = ownerDocument.defaultView || window;
16
15
  scrollBodyCount += 1;
@@ -25,7 +25,7 @@ export function getScope<T extends HTMLElement, R extends HTMLElement>(
25
25
 
26
26
  const filtered: T[] = [];
27
27
  allNodes.forEach((node) => {
28
- const props = {};
28
+ const props: Record<string, any> = {};
29
29
  const { attributes } = node;
30
30
  for (let i = 0; i < attributes.length; i++) {
31
31
  const attr = attributes[i];
@@ -0,0 +1 @@
1
+ declare module '*.css';
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
1
  // adapted from https://github.com/radix-ui/primitives/blob/2f139a832ba0cdfd445c937ebf63c2e79e0ef7ed/packages/react/polymorphic/src/polymorphic.ts
3
2
  // Would have liked to use it directly instead of copying but they are
4
3
  // (rightfully) treating it as an internal utility, so copy/paste it is to
@@ -7,7 +6,6 @@
7
6
 
8
7
  import type * as React from 'react';
9
8
 
10
- // eslint-disable-next-line @typescript-eslint/ban-types
11
9
  export type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
12
10
 
13
11
  /**
@@ -48,13 +46,16 @@ export interface ForwardRefComponent<
48
46
  <As = IntrinsicElementString>(
49
47
  props: As extends ''
50
48
  ? {
51
- as: keyof JSX.IntrinsicElements;
52
- innerAs?: keyof JSX.IntrinsicElements;
49
+ as: keyof React.JSX.IntrinsicElements;
50
+ innerAs?: keyof React.JSX.IntrinsicElements;
53
51
  }
54
52
  : As extends React.ComponentType<infer P>
55
53
  ? Merge<P, OwnProps & { as: As; innerAs?: As }>
56
- : As extends keyof JSX.IntrinsicElements
57
- ? Merge<JSX.IntrinsicElements[As], OwnProps & { as: As; innerAs?: As }>
54
+ : As extends keyof React.JSX.IntrinsicElements
55
+ ? Merge<
56
+ React.JSX.IntrinsicElements[As],
57
+ OwnProps & { as: As; innerAs?: As }
58
+ >
58
59
  : never
59
60
  ): React.ReactElement | null;
60
61
  }
@@ -66,13 +67,16 @@ export interface MemoComponent<IntrinsicElementString, OwnProps = {}>
66
67
  <As = IntrinsicElementString>(
67
68
  props: As extends ''
68
69
  ? {
69
- as: keyof JSX.IntrinsicElements;
70
- innerAs?: keyof JSX.IntrinsicElements;
70
+ as: keyof React.JSX.IntrinsicElements;
71
+ innerAs?: keyof React.JSX.IntrinsicElements;
71
72
  }
72
73
  : As extends React.ComponentType<infer P>
73
74
  ? Merge<P, OwnProps & { as: As; innerAs?: As }>
74
- : As extends keyof JSX.IntrinsicElements
75
- ? Merge<JSX.IntrinsicElements[As], OwnProps & { as: As; innerAs?: As }>
75
+ : As extends keyof React.JSX.IntrinsicElements
76
+ ? Merge<
77
+ React.JSX.IntrinsicElements[As],
78
+ OwnProps & { as: As; innerAs?: As }
79
+ >
76
80
  : never
77
81
  ): React.ReactElement | null;
78
82
  }
@@ -22,7 +22,6 @@ function createStableCallbackHook<T extends (...args: any[]) => any>(
22
22
  callbackRef.current = callback;
23
23
  });
24
24
 
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
25
  return useCallback(
27
26
  ((...args) => {
28
27
  callbackRef.current && callbackRef.current(...args);
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export interface CarouselProps extends React.HTMLAttributes<HTMLElement> {
3
- as?: React.ElementType<any>;
4
- isRTL?: boolean;
5
- currentSlide?: number;
6
- slidesToShow?: number;
7
- children?: React.ReactNode;
8
- }
9
- export declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLElement>>;
@@ -1,38 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import React, { forwardRef, useMemo, useRef } from 'react';
4
- import { assignMultipleRefs } from '../utils/assignRef';
5
- import { CarouselProvider } from './context';
6
- export var Carousel = forwardRef(function Carousel(_ref, forwardedRef) {
7
- var _ref$as = _ref.as,
8
- Comp = _ref$as === void 0 ? 'section' : _ref$as,
9
- _ref$currentSlide = _ref.currentSlide,
10
- currentSlide = _ref$currentSlide === void 0 ? 0 : _ref$currentSlide,
11
- _ref$slidesToShow = _ref.slidesToShow,
12
- slidesToShow = _ref$slidesToShow === void 0 ? 1 : _ref$slidesToShow,
13
- _ref$isRTL = _ref.isRTL,
14
- isRTL = _ref$isRTL === void 0 ? false : _ref$isRTL,
15
- children = _ref.children,
16
- otherProps = _objectWithoutProperties(_ref, ["as", "currentSlide", "slidesToShow", "isRTL", "children"]);
17
-
18
- var containerRef = useRef(null);
19
- var contextValue = useMemo(function () {
20
- return {
21
- slidesToShow: slidesToShow,
22
- isRTL: isRTL,
23
- currentSlide: currentSlide,
24
- itemWidth: 100 / slidesToShow,
25
- containerRef: containerRef
26
- };
27
- }, [currentSlide, isRTL, slidesToShow]);
28
- return /*#__PURE__*/React.createElement(CarouselProvider, {
29
- value: contextValue
30
- }, /*#__PURE__*/React.createElement(Comp, _extends({
31
- ref: assignMultipleRefs(forwardedRef, containerRef)
32
- }, otherProps, {
33
- role: "region",
34
- "data-carousel-root": "",
35
- "aria-roledescription": "carousel"
36
- }), children));
37
- });
38
- //# sourceMappingURL=Carousel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/Carousel/Carousel.tsx"],"names":["React","forwardRef","useMemo","useRef","assignMultipleRefs","CarouselProvider","Carousel","forwardedRef","as","Comp","currentSlide","slidesToShow","isRTL","children","otherProps","containerRef","contextValue","itemWidth"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,OAA5B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,gBAAT,QAAiC,WAAjC;AAUA,OAAO,IAAMC,QAAQ,GAAGL,UAAU,CAChC,SAASK,QAAT,OASEC,YATF,EAUE;AAAA,qBAREC,EAQF;AAAA,MARMC,IAQN,wBARa,SAQb;AAAA,+BAPEC,YAOF;AAAA,MAPEA,YAOF,kCAPiB,CAOjB;AAAA,+BANEC,YAMF;AAAA,MANEA,YAMF,kCANiB,CAMjB;AAAA,wBALEC,KAKF;AAAA,MALEA,KAKF,2BALU,KAKV;AAAA,MAJEC,QAIF,QAJEA,QAIF;AAAA,MAHKC,UAGL;;AACA,MAAMC,YAAY,GAAGZ,MAAM,CAAqB,IAArB,CAA3B;AACA,MAAMa,YAAY,GAAGd,OAAO,CAC1B;AAAA,WAAO;AACLS,MAAAA,YAAY,EAAZA,YADK;AAELC,MAAAA,KAAK,EAALA,KAFK;AAGLF,MAAAA,YAAY,EAAZA,YAHK;AAILO,MAAAA,SAAS,EAAE,MAAMN,YAJZ;AAKLI,MAAAA,YAAY,EAAZA;AALK,KAAP;AAAA,GAD0B,EAQ1B,CAACL,YAAD,EAAeE,KAAf,EAAsBD,YAAtB,CAR0B,CAA5B;AAWA,sBACE,oBAAC,gBAAD;AAAkB,IAAA,KAAK,EAAEK;AAAzB,kBACE,oBAAC,IAAD;AACE,IAAA,GAAG,EAAEZ,kBAAkB,CAACG,YAAD,EAAeQ,YAAf;AADzB,KAEMD,UAFN;AAGE,IAAA,IAAI,EAAC,QAHP;AAIE,0BAAmB,EAJrB;AAKE,4BAAqB;AALvB,MAOGD,QAPH,CADF,CADF;AAaD,CArC+B,CAA3B","sourcesContent":["import React, { forwardRef, useMemo, useRef } from 'react';\nimport { assignMultipleRefs } from '../utils/assignRef';\nimport { CarouselProvider } from './context';\n\nexport interface CarouselProps extends React.HTMLAttributes<HTMLElement> {\n as?: React.ElementType<any>;\n isRTL?: boolean;\n currentSlide?: number;\n slidesToShow?: number;\n children?: React.ReactNode;\n}\n\nexport const Carousel = forwardRef<HTMLElement, CarouselProps>(\n function Carousel(\n {\n as: Comp = 'section',\n currentSlide = 0,\n slidesToShow = 1,\n isRTL = false,\n children,\n ...otherProps\n },\n forwardedRef\n ) {\n const containerRef = useRef<HTMLElement | null>(null);\n const contextValue = useMemo(\n () => ({\n slidesToShow,\n isRTL,\n currentSlide,\n itemWidth: 100 / slidesToShow,\n containerRef,\n }),\n [currentSlide, isRTL, slidesToShow]\n );\n\n return (\n <CarouselProvider value={contextValue}>\n <Comp\n ref={assignMultipleRefs(forwardedRef, containerRef)}\n {...otherProps}\n role=\"region\"\n data-carousel-root=\"\"\n aria-roledescription=\"carousel\"\n >\n {children}\n </Comp>\n </CarouselProvider>\n );\n }\n);\n"],"file":"Carousel.js"}
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { SpringConfig } from 'react-spring';
3
- import { GestureHandlersState } from '../hooks';
4
- export declare const faderConfig: SpringConfig;
5
- export interface FaderProps extends React.HTMLAttributes<HTMLDivElement> {
6
- as?: React.ElementType<any>;
7
- mouseSwipe?: boolean;
8
- touchSwipe?: boolean;
9
- onSwipeRight?: (s: Partial<GestureHandlersState>) => void;
10
- onSwipeLeft?: (s: Partial<GestureHandlersState>) => void;
11
- springConfig?: SpringConfig;
12
- children?: React.ReactNode[] | React.ReactNode;
13
- }
14
- export declare const Fader: React.ForwardRefExoticComponent<FaderProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,76 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import React, { forwardRef, Children, useMemo } from 'react';
4
- import { useTransition, animated } from 'react-spring';
5
- import { getCircularIndex } from '../utils/getCircularIndex';
6
- import { useCarouselGestures } from './useCarouselGestures';
7
- import { useCarouselContext } from './context';
8
- export var faderConfig = {
9
- tension: 280,
10
- friction: 75,
11
- clamp: true
12
- };
13
- export var Fader = forwardRef(function Fader(_ref, ref) {
14
- var _ref$as = _ref.as,
15
- Comp = _ref$as === void 0 ? 'div' : _ref$as,
16
- maybeSingleChildren = _ref.children,
17
- _ref$springConfig = _ref.springConfig,
18
- springConfig = _ref$springConfig === void 0 ? faderConfig : _ref$springConfig,
19
- _ref$mouseSwipe = _ref.mouseSwipe,
20
- mouseSwipe = _ref$mouseSwipe === void 0 ? false : _ref$mouseSwipe,
21
- _ref$touchSwipe = _ref.touchSwipe,
22
- touchSwipe = _ref$touchSwipe === void 0 ? false : _ref$touchSwipe,
23
- onSwipeLeft = _ref.onSwipeLeft,
24
- onSwipeRight = _ref.onSwipeRight,
25
- otherProps = _objectWithoutProperties(_ref, ["as", "children", "springConfig", "mouseSwipe", "touchSwipe", "onSwipeLeft", "onSwipeRight"]);
26
-
27
- var _useCarouselContext = useCarouselContext(),
28
- _useCarouselContext$i = _useCarouselContext.isRTL,
29
- isRTL = _useCarouselContext$i === void 0 ? false : _useCarouselContext$i,
30
- _useCarouselContext$c = _useCarouselContext.currentSlide,
31
- nextSlideIndex = _useCarouselContext$c === void 0 ? 0 : _useCarouselContext$c,
32
- containerRef = _useCarouselContext.containerRef;
33
-
34
- var children = useMemo(function () {
35
- return Children.toArray(maybeSingleChildren);
36
- }, [maybeSingleChildren]);
37
- var transitions = useTransition(nextSlideIndex, {
38
- config: springConfig,
39
- from: {
40
- opacity: 0
41
- },
42
- enter: {
43
- opacity: 1
44
- },
45
- leave: {
46
- opacity: 0
47
- }
48
- });
49
-
50
- var _useCarouselGestures = useCarouselGestures({
51
- onSwipeLeft: onSwipeLeft,
52
- onSwipeRight: onSwipeRight,
53
- isRTL: isRTL,
54
- containerRef: containerRef
55
- }),
56
- handlers = _useCarouselGestures.handlers;
57
-
58
- return /*#__PURE__*/React.createElement(Comp, _extends({
59
- onTouchStart: touchSwipe ? handlers.onTouchStart : undefined,
60
- onMouseDown: mouseSwipe ? handlers.onMouseDown : undefined,
61
- "aria-live": "polite",
62
- "data-carousel-slider": "",
63
- ref: ref
64
- }, otherProps), transitions(function (style, item) {
65
- var idx = getCircularIndex(item, children.length);
66
-
67
- if (idx !== null) {
68
- return /*#__PURE__*/React.createElement(animated.span, {
69
- style: style
70
- }, children[idx]);
71
- }
72
-
73
- return null;
74
- }));
75
- });
76
- //# sourceMappingURL=Fader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/Carousel/Fader.tsx"],"names":["React","forwardRef","Children","useMemo","useTransition","animated","getCircularIndex","useCarouselGestures","useCarouselContext","faderConfig","tension","friction","clamp","Fader","ref","as","Comp","maybeSingleChildren","children","springConfig","mouseSwipe","touchSwipe","onSwipeLeft","onSwipeRight","otherProps","isRTL","currentSlide","nextSlideIndex","containerRef","toArray","transitions","config","from","opacity","enter","leave","handlers","onTouchStart","undefined","onMouseDown","style","item","idx","length"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,OAAtC,QAAqD,OAArD;AACA,SAASC,aAAT,EAAsCC,QAAtC,QAAsD,cAAtD;AACA,SAASC,gBAAT,QAAiC,2BAAjC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,kBAAT,QAAmC,WAAnC;AAGA,OAAO,IAAMC,WAAyB,GAAG;AACvCC,EAAAA,OAAO,EAAE,GAD8B;AAEvCC,EAAAA,QAAQ,EAAE,EAF6B;AAGvCC,EAAAA,KAAK,EAAE;AAHgC,CAAlC;AAgBP,OAAO,IAAMC,KAAK,GAAGZ,UAAU,CAAC,SAASY,KAAT,OAW9BC,GAX8B,EAY9B;AAAA,qBAVEC,EAUF;AAAA,MAVMC,IAUN,wBAVa,KAUb;AAAA,MATYC,mBASZ,QATEC,QASF;AAAA,+BAREC,YAQF;AAAA,MAREA,YAQF,kCARiBV,WAQjB;AAAA,6BAPEW,UAOF;AAAA,MAPEA,UAOF,gCAPe,KAOf;AAAA,6BANEC,UAMF;AAAA,MANEA,UAMF,gCANe,KAMf;AAAA,MALEC,WAKF,QALEA,WAKF;AAAA,MAJEC,YAIF,QAJEA,YAIF;AAAA,MAHKC,UAGL;;AAAA,4BAKIhB,kBAAkB,EALtB;AAAA,kDAEEiB,KAFF;AAAA,MAEEA,KAFF,sCAEU,KAFV;AAAA,kDAGEC,YAHF;AAAA,MAGgBC,cAHhB,sCAGiC,CAHjC;AAAA,MAIEC,YAJF,uBAIEA,YAJF;;AAMA,MAAMV,QAAQ,GAAGf,OAAO,CAAC;AAAA,WAAMD,QAAQ,CAAC2B,OAAT,CAAiBZ,mBAAjB,CAAN;AAAA,GAAD,EAA8C,CACpEA,mBADoE,CAA9C,CAAxB;AAIA,MAAMa,WAAW,GAAG1B,aAAa,CAACuB,cAAD,EAAiB;AAChDI,IAAAA,MAAM,EAAEZ,YADwC;AAEhDa,IAAAA,IAAI,EAAE;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAF0C;AAGhDC,IAAAA,KAAK,EAAE;AAAED,MAAAA,OAAO,EAAE;AAAX,KAHyC;AAIhDE,IAAAA,KAAK,EAAE;AAAEF,MAAAA,OAAO,EAAE;AAAX;AAJyC,GAAjB,CAAjC;;AAVA,6BAiBqB1B,mBAAmB,CAAC;AACvCe,IAAAA,WAAW,EAAXA,WADuC;AAEvCC,IAAAA,YAAY,EAAZA,YAFuC;AAGvCE,IAAAA,KAAK,EAALA,KAHuC;AAIvCG,IAAAA,YAAY,EAAZA;AAJuC,GAAD,CAjBxC;AAAA,MAiBQQ,QAjBR,wBAiBQA,QAjBR;;AAwBA,sBACE,oBAAC,IAAD;AACE,IAAA,YAAY,EAAEf,UAAU,GAAGe,QAAQ,CAACC,YAAZ,GAA2BC,SADrD;AAEE,IAAA,WAAW,EAAElB,UAAU,GAAGgB,QAAQ,CAACG,WAAZ,GAA0BD,SAFnD;AAGE,iBAAU,QAHZ;AAIE,4BAAqB,EAJvB;AAKE,IAAA,GAAG,EAAExB;AALP,KAMMU,UANN,GAQGM,WAAW,CAAC,UAACU,KAAD,EAAQC,IAAR,EAAiB;AAC5B,QAAMC,GAAG,GAAGpC,gBAAgB,CAACmC,IAAD,EAAOvB,QAAQ,CAACyB,MAAhB,CAA5B;;AACA,QAAID,GAAG,KAAK,IAAZ,EAAkB;AAChB,0BAAO,oBAAC,QAAD,CAAU,IAAV;AAAe,QAAA,KAAK,EAAEF;AAAtB,SAA8BtB,QAAQ,CAACwB,GAAD,CAAtC,CAAP;AACD;;AAED,WAAO,IAAP;AACD,GAPW,CARd,CADF;AAmBD,CAvD8B,CAAxB","sourcesContent":["import React, { forwardRef, Children, useMemo } from 'react';\nimport { useTransition, SpringConfig, animated } from 'react-spring';\nimport { getCircularIndex } from '../utils/getCircularIndex';\nimport { useCarouselGestures } from './useCarouselGestures';\nimport { useCarouselContext } from './context';\nimport { GestureHandlersState } from '../hooks';\n\nexport const faderConfig: SpringConfig = {\n tension: 280,\n friction: 75,\n clamp: true,\n};\n\nexport interface FaderProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n mouseSwipe?: boolean;\n touchSwipe?: boolean;\n onSwipeRight?: (s: Partial<GestureHandlersState>) => void;\n onSwipeLeft?: (s: Partial<GestureHandlersState>) => void;\n springConfig?: SpringConfig;\n children?: React.ReactNode[] | React.ReactNode;\n}\n\nexport const Fader = forwardRef(function Fader(\n {\n as: Comp = 'div',\n children: maybeSingleChildren,\n springConfig = faderConfig,\n mouseSwipe = false,\n touchSwipe = false,\n onSwipeLeft,\n onSwipeRight,\n ...otherProps\n }: FaderProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const {\n isRTL = false,\n currentSlide: nextSlideIndex = 0,\n containerRef,\n } = useCarouselContext();\n const children = useMemo(() => Children.toArray(maybeSingleChildren), [\n maybeSingleChildren,\n ]);\n\n const transitions = useTransition(nextSlideIndex, {\n config: springConfig,\n from: { opacity: 0 },\n enter: { opacity: 1 },\n leave: { opacity: 0 },\n });\n\n const { handlers } = useCarouselGestures({\n onSwipeLeft,\n onSwipeRight,\n isRTL,\n containerRef,\n });\n\n return (\n <Comp\n onTouchStart={touchSwipe ? handlers.onTouchStart : undefined}\n onMouseDown={mouseSwipe ? handlers.onMouseDown : undefined}\n aria-live=\"polite\"\n data-carousel-slider=\"\"\n ref={ref}\n {...otherProps}\n >\n {transitions((style, item) => {\n const idx = getCircularIndex(item, children.length);\n if (idx !== null) {\n return <animated.span style={style}>{children[idx]}</animated.span>;\n }\n\n return null;\n })}\n </Comp>\n );\n});\n"],"file":"Fader.js"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export interface FaderItemProps extends React.HTMLAttributes<HTMLDivElement> {
3
- as?: React.ElementType<any>;
4
- }
5
- export declare const FaderItem: React.ForwardRefExoticComponent<FaderItemProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,16 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import React, { forwardRef } from 'react';
4
- export var FaderItem = forwardRef(function FaderItem(_ref, ref) {
5
- var _ref$as = _ref.as,
6
- Comp = _ref$as === void 0 ? 'div' : _ref$as,
7
- props = _objectWithoutProperties(_ref, ["as"]);
8
-
9
- return /*#__PURE__*/React.createElement(Comp, _extends({
10
- role: "group",
11
- "aria-roledescription": "slide",
12
- "data-carousel-fader-item": "",
13
- ref: ref
14
- }, props));
15
- });
16
- //# sourceMappingURL=FaderItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/Carousel/FaderItem.tsx"],"names":["React","forwardRef","FaderItem","ref","as","Comp","props"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AAMA,OAAO,IAAMC,SAAS,GAAGD,UAAU,CACjC,SAASC,SAAT,OAAmDC,GAAnD,EAAwD;AAAA,qBAAnCC,EAAmC;AAAA,MAA/BC,IAA+B,wBAAxB,KAAwB;AAAA,MAAdC,KAAc;;AACtD,sBACE,oBAAC,IAAD;AACE,IAAA,IAAI,EAAC,OADP;AAEE,4BAAqB,OAFvB;AAGE,gCAAyB,EAH3B;AAIE,IAAA,GAAG,EAAEH;AAJP,KAKMG,KALN,EADF;AASD,CAXgC,CAA5B","sourcesContent":["import React, { forwardRef } from 'react';\n\nexport interface FaderItemProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType<any>;\n}\n\nexport const FaderItem = forwardRef<HTMLDivElement, FaderItemProps>(\n function FaderItem({ as: Comp = 'div', ...props }, ref) {\n return (\n <Comp\n role=\"group\"\n aria-roledescription=\"slide\"\n data-carousel-fader-item=\"\"\n ref={ref}\n {...props}\n />\n );\n }\n);\n"],"file":"FaderItem.js"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- export interface PreloaderProps {
3
- children: React.ReactNode[] | React.ReactNode;
4
- preloadNextCount?: number;
5
- preloadPrevCount?: number;
6
- }
7
- export declare const Preloader: React.ForwardRefExoticComponent<PreloaderProps & React.RefAttributes<HTMLDivElement>>;