@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
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["forwardRef","memo","useRef","useState","useCallback","useEffect","useLayoutEffect","useId","createContext","isRightClick","getOwnerDocument","useStableLayoutCallback","assignMultipleRefs","wrapEvent","useControlledState","noop","SliderProvider","useSliderContext","Slider","forwardedRef","children","props","SliderInput","ariaLabel","ariaLabelledBy","ariaValueTextProp","as","Comp","innerAs","defaultValue","disabled","controlledValue","value","getAriaLabel","getAriaValueText","handleAlignment","max","min","name","onChangeProp","onChange","onKeyDown","onMouseDown","onMouseMove","onMouseUp","onPointerDown","onPointerUp","onTouchEnd","onTouchMove","onTouchStart","orientation","step","rest","touchId","fallbackId","id","pointerDownRef","trackRef","handleRef","sliderRef","hasFocus","setHasFocus","useDimensions","x","ref","handleDimensions","setValue","e","v","_value","clamp","trackPercent","valueToPercent","isVertical","handleSize","height","width","handlePosition","handlePositionRef","current","getNewValueFromEvent","event","getNewValue","getPointerPosition","handleKeyDown","newValue","tenSteps","keyStep","key","roundValueToStep","ariaValueText","rangeStyle","removeMoveEvents","removeStartEvents","removeEndEvents","appEvents","handleSlideStart","ownerDocument","ownerWindow","defaultView","window","changedTouches","preventDefault","touch","identifier","requestAnimationFrame","focus","addMoveListener","addEndListener","setPointerCapture","pointerId","releasePointerCapture","handlePointerMove","handleSlideStop","undefined","touchListener","mouseListener","addEventListener","removeEventListener","pointerListener","addStartListener","sliderElement","inputFallbackId","inputId","SliderTrackImpl","SliderTrack","style","position","SliderRangeImpl","SliderRange","SliderHandleImpl","SliderHandle","onBlur","onFocus","sliderMin","sliderMax","bottom","left","SliderMarkerImpl","SliderMarker","sliderValue","inRange","absoluteStartPosition","state","val","getDecimalPrecision","num","Math","abs","parts","toExponential","split","matissaDecimalPart","length","parseInt","decimalPart","toString","percentToValue","percent","nearest","round","Number","toFixed","i","clientX","y","clientY","track","getBoundingClientRect","diff","setDimensions","getComputedStyle","_newHeight","_newWidth","newHeight","parseFloat","newWidth"],"sources":["../../../src/Slider/Slider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\n\n/**\n * Welcome to @reach/slider!\n *\n * A UI input component where the user selects a value from within a given\n * range. A Slider has a handle that can be moved along a track to change its\n * value. When the user's mouse or focus is on the Slider's handle, the value\n * can be incremented with keyboard controls.\n *\n * Random thoughts/notes:\n * - Currently testing this against the behavior of the native input range\n * element to get our slider on par. We'll explore animated and multi-handle\n * sliders next.\n * - We may want to research some use cases for reversed sliders in RTL\n * languages if that's a thing\n *\n * @see Docs https://reach.tech/slider\n * @see Source https://github.com/reach/reach-ui/tree/main/packages/slider\n * @see WAI-ARIA https://www.w3.org/TR/wai-aria-practices-1.2/#slider\n * @see Example https://github.com/Stanko/aria-progress-range-slider\n * @see Example http://www.oaa-accessibility.org/examplep/slider1/\n */\n\nimport {\n forwardRef,\n memo,\n useRef,\n useState,\n useCallback,\n useEffect,\n useLayoutEffect,\n useId,\n} from 'react';\nimport type { ReactNode, KeyboardEvent } from 'react';\n\nimport { createContext } from '../utils/context';\nimport type * as Polymorphic from '../utils/polymorphic';\nimport { isRightClick } from '../utils/is-right-click';\nimport { getOwnerDocument } from '../utils/owner-document';\nimport { useStableLayoutCallback } from '../utils/use-stable-callback';\nimport { assignMultipleRefs, wrapEvent } from '../utils';\nimport { useControlledState } from '../hooks';\n\nconst noop = () => {\n /* noop */\n};\n\ntype SliderOrientation = 'horizontal' | 'vertical';\ntype SliderHandleAlignment = 'center' | 'contain';\n\nconst [SliderProvider, useSliderContext] =\n createContext<ISliderContext>('Slider');\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Slider\n *\n * @see Docs https://reach.tech/slider#slider\n */\nconst Slider = forwardRef(function Slider(\n { children, ...props },\n forwardedRef\n) {\n return (\n <SliderInput {...props} ref={forwardedRef} data-reach-slider=\"\">\n <SliderTrack>\n <SliderRange />\n <SliderHandle />\n {children}\n </SliderTrack>\n </SliderInput>\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderProps>;\n\n/**\n * @see Docs https://reach.tech/slider#slider-props\n */\ninterface SliderProps {\n /**\n * `Slider` can accept `SliderMarker` children to enhance display of specific\n * values along the track.\n *\n * @see Docs https://reach.tech/slider#slider-children\n */\n children?: ReactNode;\n /**\n * The defaultValue is used to set an initial value for an uncontrolled\n * Slider.\n *\n * @see Docs https://reach.tech/slider#slider-defaultvalue\n */\n defaultValue?: number;\n /**\n * @see Docs https://reach.tech/slider#slider-disabled\n */\n disabled?: boolean;\n /**\n * Whether or not the slider should be disabled from user interaction.\n *\n * @see Docs https://reach.tech/slider#slider-value\n */\n value?: number;\n /**\n * A function used to set a human-readable name for the slider.\n *\n * @see Docs https://reach.tech/slider#slider-getarialabel\n */\n getAriaLabel?(value: number): string;\n /**\n * A function used to set a human-readable value text based on the slider's\n * current value.\n *\n * @see Docs https://reach.tech/slider#slider-getariavaluetext\n */\n getAriaValueText?(value: number): string;\n /**\n * When set to `center`, the slider's handle will be positioned directly\n * centered over the slider's curremt value on the track. This means that when\n * the slider is at its min or max value, a visiable slider handle will extend\n * beyond the width (or height in vertical mode) of the slider track. When set\n * to `contain`, the slider handle will always be contained within the bounds\n * of the track, meaning its position will be slightly offset from the actual\n * value depending on where it sits on the track.\n *\n * @see Docs https://reach.tech/slider#slider-handlealignment\n */\n handleAlignment?: SliderHandleAlignment;\n /**\n * The maximum value of the slider. Defaults to `100`.\n *\n * @see Docs https://reach.tech/slider#slider-max\n */\n max?: number;\n /**\n * The minimum value of the slider. Defaults to `0`.\n *\n * @see Docs https://reach.tech/slider#slider-min\n */\n min?: number;\n /**\n * If the slider is used as a form input, it should accept a `name` prop to\n * identify its value in context of the form.\n *\n * @see Docs https://reach.tech/slider#slider-name\n */\n name?: string;\n /**\n * Callback that fires when the slider value changes. When the `value` prop is\n * set, the Slider state becomes controlled and `onChange` must be used to\n * update the value in response to user interaction.\n *\n * @see Docs https://reach.tech/slider#slider-onchange\n */\n onChange?(\n e: SomePointerEvent | KeyboardEvent,\n newValue: number,\n props?: {\n min?: number;\n max?: number;\n handlePosition?: string;\n }\n ): void;\n\n // We use native DOM events for the slider since they are global\n onMouseDown?(event: MouseEvent): void;\n onMouseMove?(event: MouseEvent): void;\n onMouseUp?(event: MouseEvent): void;\n onPointerDown?(event: PointerEvent): void;\n onPointerUp?(event: PointerEvent): void;\n onTouchEnd?(event: TouchEvent): void;\n onTouchMove?(event: TouchEvent): void;\n onTouchStart?(event: TouchEvent): void;\n\n /**\n * Sets the slider to horizontal or vertical mode.\n *\n * @see Docs https://reach.tech/slider#slider-orientation\n */\n orientation?: SliderOrientation;\n /**\n * The step attribute is a number that specifies the granularity that the\n * value must adhere to as it changes. Step sets minimum intervals of change,\n * creating a \"snap\" effect when the handle is moved along the track.\n *\n * @see Docs https://reach.tech/slider#slider-step\n */\n step?: number;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderInput\n *\n * The parent component of the slider interface. This is a lower level component\n * if you need more control over styles or rendering the slider's inner\n * components.\n *\n * @see Docs https://reach.tech/slider#sliderinput\n */\nconst SliderInput = forwardRef(function SliderInput(\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-valuetext': ariaValueTextProp,\n as: Comp = 'div',\n innerAs,\n defaultValue,\n disabled = false,\n value: controlledValue,\n getAriaLabel,\n getAriaValueText,\n handleAlignment = 'center',\n max = 100,\n min = 0,\n name,\n onChange: onChangeProp,\n onKeyDown,\n onMouseDown,\n onMouseMove,\n onMouseUp,\n onPointerDown,\n onPointerUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n orientation = 'horizontal',\n step = 1,\n children,\n ...rest\n },\n forwardedRef\n) {\n const touchId: TouchIdRef = useRef();\n\n const fallbackId = useId();\n const id = rest.id || fallbackId;\n\n // Track whether or not the pointer is down without updating the component\n const pointerDownRef = useRef(false);\n\n const trackRef: TrackRef = useRef(null);\n const handleRef: HandleRef = useRef(null);\n const sliderRef: SliderRef = useRef(null);\n\n const [hasFocus, setHasFocus] = useState(false);\n\n const { ref: x, ...handleDimensions } = useDimensions(handleRef);\n\n const [_value, onChange] = useControlledState(\n controlledValue,\n onChangeProp,\n defaultValue || min,\n (setValue) => (e, v) => setValue(v)\n );\n const value = clamp(_value, min, max);\n const trackPercent = valueToPercent(value, min, max);\n const isVertical = orientation === 'vertical';\n\n const handleSize = isVertical\n ? handleDimensions.height\n : handleDimensions.width;\n\n // TODO: Consider removing the `handleAlignment` prop\n // We may want to use accept a `handlePosition` prop instead and let apps\n // define their own positioning logic, similar to how we do for popovers.\n const handlePosition = `calc(${trackPercent}% - ${\n handleAlignment === 'center'\n ? `${handleSize}px / 2`\n : `${handleSize}px * ${trackPercent * 0.01}`\n })`;\n const handlePositionRef = useRef(handlePosition);\n useLayoutEffect(() => {\n handlePositionRef.current = handlePosition;\n }, [handlePosition]);\n\n const getNewValueFromEvent = useCallback(\n (event: SomePointerEvent) => {\n return getNewValue(getPointerPosition(event, touchId), trackRef.current, {\n step,\n orientation,\n min,\n max,\n });\n },\n [max, min, orientation, step]\n );\n\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_kbd_interaction\n const handleKeyDown = useStableLayoutCallback((event: KeyboardEvent) => {\n if (disabled) {\n return;\n }\n\n let newValue: number;\n const tenSteps = (max - min) / 10;\n const keyStep = step || (max - min) / 100;\n\n switch (event.key) {\n // Decrease the value of the slider by one step.\n case 'ArrowLeft':\n case 'ArrowDown':\n newValue = value - keyStep;\n break;\n // Increase the value of the slider by one step\n case 'ArrowRight':\n case 'ArrowUp':\n newValue = value + keyStep;\n break;\n // Decrement the slider by an amount larger than the step change made by\n // `ArrowDown`.\n case 'PageDown':\n newValue = value - tenSteps;\n break;\n // Increment the slider by an amount larger than the step change made by\n // `ArrowUp`.\n case 'PageUp':\n newValue = value + tenSteps;\n break;\n // Set the slider to the first allowed value in its range.\n case 'Home':\n newValue = min;\n break;\n // Set the slider to the last allowed value in its range.\n case 'End':\n newValue = max;\n break;\n default:\n return;\n }\n\n newValue = clamp(\n step ? roundValueToStep(newValue, step, min) : newValue,\n min,\n max\n );\n onChange(event, newValue);\n });\n\n const ariaValueText = getAriaValueText\n ? getAriaValueText(value)\n : ariaValueTextProp;\n\n const rangeStyle = { [isVertical ? 'height' : 'width']: `${trackPercent}%` };\n\n // Slide events!\n // We will try to use pointer events if they are supported to leverage\n // setPointerCapture and releasePointerCapture. We'll fall back to separate\n // mouse and touch events.\n // TODO: This could be more concise\n const removeMoveEvents = useRef<() => void>(noop);\n const removeStartEvents = useRef<() => void>(noop);\n const removeEndEvents = useRef<() => void>(noop);\n\n // Store our event handlers in refs so we aren't attaching/detaching events\n // on every render if the user doesn't useCallback\n const appEvents = useRef({\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n onPointerDown,\n onPointerUp,\n });\n useLayoutEffect(() => {\n appEvents.current.onMouseMove = onMouseMove;\n appEvents.current.onMouseDown = onMouseDown;\n appEvents.current.onMouseUp = onMouseUp;\n appEvents.current.onTouchStart = onTouchStart;\n appEvents.current.onTouchEnd = onTouchEnd;\n appEvents.current.onTouchMove = onTouchMove;\n appEvents.current.onPointerDown = onPointerDown;\n appEvents.current.onPointerUp = onPointerUp;\n }, [\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n onPointerDown,\n onPointerUp,\n ]);\n\n const handleSlideStart = useStableLayoutCallback(\n (event: SomePointerEvent) => {\n if (isRightClick(event)) return;\n\n if (disabled) {\n pointerDownRef.current = false;\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ownerDocument = getOwnerDocument(sliderRef.current)!;\n const ownerWindow = ownerDocument.defaultView || window;\n pointerDownRef.current = true;\n\n if ((event as TouchEvent).changedTouches) {\n // Prevent scrolling for touch events\n event.preventDefault();\n const touch = (event as TouchEvent).changedTouches?.[0];\n if (touch != null) {\n touchId.current = touch.identifier;\n }\n }\n\n const newValue = getNewValueFromEvent(event);\n if (newValue == null) {\n return;\n }\n ownerWindow.requestAnimationFrame(() => handleRef.current?.focus());\n onChange(event, newValue);\n\n removeMoveEvents.current = addMoveListener();\n removeEndEvents.current = addEndListener();\n }\n );\n\n const setPointerCapture = useStableLayoutCallback((event: PointerEvent) => {\n if (isRightClick(event)) return;\n if (disabled) {\n pointerDownRef.current = false;\n return;\n }\n pointerDownRef.current = true;\n sliderRef.current?.setPointerCapture(event.pointerId);\n });\n\n const releasePointerCapture = useStableLayoutCallback(\n (event: PointerEvent) => {\n if (isRightClick(event)) return;\n sliderRef.current?.releasePointerCapture(event.pointerId);\n pointerDownRef.current = false;\n }\n );\n\n const handlePointerMove = useStableLayoutCallback(\n (event: SomePointerEvent) => {\n if (disabled || !pointerDownRef.current) {\n pointerDownRef.current = false;\n return;\n }\n\n const newValue = getNewValueFromEvent(event);\n if (newValue == null) {\n return;\n }\n onChange?.(event, newValue);\n }\n );\n\n const handleSlideStop = useStableLayoutCallback((event: SomePointerEvent) => {\n if (isRightClick(event)) return;\n\n pointerDownRef.current = false;\n\n const newValue = getNewValueFromEvent(event);\n if (newValue == null) {\n return;\n }\n\n touchId.current = undefined;\n\n removeMoveEvents.current();\n removeEndEvents.current();\n });\n\n const addMoveListener = useCallback(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ownerDocument = getOwnerDocument(sliderRef.current)!;\n const touchListener = wrapEvent(\n appEvents.current.onTouchMove,\n handlePointerMove\n );\n const mouseListener = wrapEvent(\n appEvents.current.onMouseMove,\n handlePointerMove\n );\n ownerDocument.addEventListener('touchmove', touchListener);\n ownerDocument.addEventListener('mousemove', mouseListener);\n return () => {\n ownerDocument.removeEventListener('touchmove', touchListener);\n ownerDocument.removeEventListener('mousemove', mouseListener);\n };\n }, [handlePointerMove]);\n\n const addEndListener = useCallback(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ownerDocument = getOwnerDocument(sliderRef.current)!;\n const ownerWindow = ownerDocument.defaultView || window;\n const pointerListener = wrapEvent(\n appEvents.current.onPointerUp,\n releasePointerCapture\n );\n const touchListener = wrapEvent(\n appEvents.current.onTouchEnd,\n handleSlideStop\n );\n const mouseListener = wrapEvent(\n appEvents.current.onMouseUp,\n handleSlideStop\n );\n if ('PointerEvent' in ownerWindow) {\n ownerDocument.addEventListener('pointerup', pointerListener);\n }\n ownerDocument.addEventListener('touchend', touchListener);\n ownerDocument.addEventListener('mouseup', mouseListener);\n return () => {\n if ('PointerEvent' in ownerWindow) {\n ownerDocument.removeEventListener('pointerup', pointerListener);\n }\n ownerDocument.removeEventListener('touchend', touchListener);\n ownerDocument.removeEventListener('mouseup', mouseListener);\n };\n }, [handleSlideStop, releasePointerCapture]);\n\n const addStartListener = useCallback(() => {\n // e.preventDefault is ignored by React's synthetic touchStart event, so\n // we attach the listener directly to the DOM node\n // https://github.com/facebook/react/issues/9809#issuecomment-413978405\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const sliderElement = sliderRef.current!;\n if (!sliderElement) {\n return noop;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ownerDocument = getOwnerDocument(sliderElement)!;\n const ownerWindow = ownerDocument.defaultView || window;\n const touchListener = wrapEvent(\n appEvents.current.onTouchStart,\n handleSlideStart\n );\n const mouseListener = wrapEvent(\n appEvents.current.onMouseDown,\n handleSlideStart\n );\n const pointerListener = wrapEvent(\n appEvents.current.onPointerDown,\n setPointerCapture\n );\n sliderElement.addEventListener('touchstart', touchListener);\n sliderElement.addEventListener('mousedown', mouseListener);\n if ('PointerEvent' in ownerWindow) {\n sliderElement.addEventListener('pointerdown', pointerListener);\n }\n return () => {\n sliderElement.removeEventListener('touchstart', touchListener);\n sliderElement.removeEventListener('mousedown', mouseListener);\n if ('PointerEvent' in ownerWindow) {\n sliderElement.removeEventListener('pointerdown', pointerListener);\n }\n };\n }, [setPointerCapture, handleSlideStart]);\n\n useEffect(() => {\n removeStartEvents.current = addStartListener();\n\n return () => {\n removeStartEvents.current();\n removeEndEvents.current();\n removeMoveEvents.current();\n };\n }, [addStartListener]);\n\n const inputFallbackId = useId();\n const inputId = id || inputFallbackId;\n\n return (\n <SliderProvider\n ariaLabel={getAriaLabel ? getAriaLabel(value) : ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n ariaValueText={ariaValueText}\n handleDimensions={handleDimensions}\n handleKeyDown={handleKeyDown}\n handlePosition={handlePosition}\n handleRef={handleRef}\n hasFocus={hasFocus}\n onKeyDown={onKeyDown}\n setHasFocus={setHasFocus}\n sliderId={id}\n sliderMax={max}\n sliderMin={min}\n value={value}\n disabled={!!disabled}\n isVertical={isVertical}\n orientation={orientation}\n trackPercent={trackPercent}\n trackRef={trackRef}\n rangeStyle={rangeStyle}\n updateValue={onChange}\n >\n <Comp\n {...rest}\n // @ts-ignore\n as={innerAs}\n ref={assignMultipleRefs(sliderRef, forwardedRef)}\n data-reach-slider-input=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n tabIndex={-1}\n >\n {typeof children === 'function'\n ? children({\n hasFocus,\n id,\n max,\n min,\n value,\n ariaValueText,\n })\n : children}\n {name && (\n // If the slider is used in a form we'll need an input field to\n // capture the value. We'll assume this when the component is given a\n // form field name (A `name` prop doesn't really make sense in any\n // other context).\n <input type=\"hidden\" value={value} name={name} id={inputId} />\n )}\n </Comp>\n </SliderProvider>\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderInputProps>;\n\n/**\n * @see Docs https://reach.tech/slider#sliderinput-props\n */\ntype SliderInputProps = Omit<SliderProps, 'children'> & {\n /**\n * Slider expects `<SliderTrack>` as its child; The track will accept all\n * additional slider sub-components as children. It can also accept a\n * function/render prop as its child to expose some of its internal state\n * variables.\n *\n * @see Docs https://reach.tech/slider#sliderinput-children\n */\n children: ReactNode | SliderChildrenRender;\n};\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderTrack\n *\n * @see Docs https://reach.tech/slider#slidertrack\n */\nconst SliderTrackImpl = forwardRef(function SliderTrack(\n { as: Comp = 'div', innerAs, children, style = {}, ...props },\n forwardedRef\n) {\n const { disabled, orientation, trackRef } = useSliderContext('SliderTrack');\n\n return (\n <Comp\n ref={assignMultipleRefs(trackRef, forwardedRef)}\n // @ts-ignore\n as={innerAs}\n style={{ ...style, position: 'relative' }}\n {...props}\n data-reach-slider-track=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n >\n {children}\n </Comp>\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderTrackProps>;\n\nconst SliderTrack = memo(SliderTrackImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderTrackProps\n>;\n\n/**\n * @see Docs https://reach.tech/slider#slidertrack-props\n */\ninterface SliderTrackProps {\n /**\n * `SliderTrack` expects `<SliderHandle>`, at minimum, for the Slider to\n * function. All other Slider subcomponents should be passed as children\n * inside the `SliderTrack`.\n *\n * @see Docs https://reach.tech/slider#slidertrack-children\n */\n children: ReactNode;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderRange\n *\n * The (typically) highlighted portion of the track that represents the space\n * between the slider's `min` value and its current value.\n *\n * @see Docs https://reach.tech/slider#sliderrange\n */\nconst SliderRangeImpl = forwardRef(function SliderRange(\n { as: Comp = 'div', innerAs, children, style = {}, ...props },\n forwardedRef\n) {\n const { disabled, orientation, rangeStyle } = useSliderContext('SliderRange');\n return (\n <Comp\n ref={forwardedRef}\n // @ts-ignore\n as={innerAs}\n style={{ position: 'absolute', ...rangeStyle, ...style }}\n {...props}\n data-reach-slider-range=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n />\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderRangeProps>;\n\nconst SliderRange = memo(SliderRangeImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderRangeProps\n>;\n\n/**\n * `SliderRange` accepts any props that a HTML div component accepts.\n * `SliderRange` will not accept or render any children.\n *\n * @see Docs https://reach.tech/slider#sliderrange-props\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface SliderRangeProps {}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderHandle\n *\n * The handle that the user drags along the track to set the slider value.\n *\n * @see Docs https://reach.tech/slider#sliderhandle\n */\nconst SliderHandleImpl = forwardRef(function SliderHandle(\n {\n // min,\n // max,\n as: Comp = 'div',\n innerAs,\n onBlur,\n onFocus,\n style = {},\n onKeyDown,\n ...props\n },\n forwardedRef\n) {\n const {\n ariaLabel,\n ariaLabelledBy,\n ariaValueText,\n disabled,\n handlePosition,\n handleRef,\n isVertical,\n handleKeyDown,\n orientation,\n setHasFocus,\n sliderMin,\n sliderMax,\n value,\n } = useSliderContext('SliderHandle');\n\n return (\n <Comp\n // @ts-ignore\n as={innerAs}\n aria-disabled={disabled || undefined}\n // If the slider has a visible label, it is referenced by\n // `aria-labelledby` on the slider element. Otherwise, the slider\n // element has a label provided by `aria-label`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-label={ariaLabel}\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\n // If the slider is vertically oriented, it has `aria-orientation` set\n // to vertical. The default value of `aria-orientation` for a slider is\n // horizontal.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-orientation={orientation}\n // The slider element has the `aria-valuemax` property set to a decimal\n // value representing the maximum allowed value of the slider.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuemax={sliderMax}\n // The slider element has the `aria-valuemin` property set to a decimal\n // value representing the minimum allowed value of the slider.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuemin={sliderMin}\n // The slider element has the `aria-valuenow` property set to a decimal\n // value representing the current value of the slider.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuenow={value}\n // If the value of `aria-valuenow` is not user-friendly, e.g., the day\n // of the week is represented by a number, the `aria-valuetext` property\n // is set to a string that makes the slider value understandable, e.g.,\n // \"Monday\".\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuetext={ariaValueText}\n // The element serving as the focusable slider control has role\n // `slider`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n {...props}\n data-reach-slider-handle=\"\"\n ref={assignMultipleRefs(handleRef, forwardedRef)}\n onBlur={wrapEvent(onBlur, () => {\n setHasFocus(false);\n })}\n onFocus={wrapEvent(onFocus, () => {\n setHasFocus(true);\n })}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n style={{\n position: 'absolute',\n ...(isVertical ? { bottom: handlePosition } : { left: handlePosition }),\n ...style,\n }}\n />\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderHandleProps>;\n\nconst SliderHandle = memo(SliderHandleImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderHandleProps\n>;\n\n/**\n * `SliderRange` accepts any props that a HTML div component accepts.\n *\n * @see Docs https://reach.tech/slider#sliderhandle-props\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface SliderHandleProps {}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderMarker\n *\n * A fixed value marker. These can be used to illustrate a range of steps or\n * highlight important points along the slider track.\n *\n * @see Docs https://reach.tech/slider#slidermarker\n */\nconst SliderMarkerImpl = forwardRef(function SliderMarker(\n { as: Comp = 'div', innerAs, children, style = {}, value, ...props },\n forwardedRef\n) {\n const {\n disabled,\n isVertical,\n orientation,\n sliderMin,\n sliderMax,\n value: sliderValue,\n } = useSliderContext('SliderMarker');\n\n const inRange = value >= sliderMin && value <= sliderMax;\n const absoluteStartPosition = `${valueToPercent(\n value,\n sliderMin,\n sliderMax\n )}%`;\n\n const state =\n value < sliderValue\n ? 'under-value'\n : value === sliderValue\n ? 'at-value'\n : 'over-value';\n\n return inRange ? (\n <Comp\n ref={forwardedRef}\n // @ts-ignore\n as={innerAs}\n style={{\n position: 'absolute',\n ...(isVertical\n ? { bottom: absoluteStartPosition }\n : { left: absoluteStartPosition }),\n ...style,\n }}\n {...props}\n data-reach-slider-marker=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n data-state={state}\n data-value={value}\n >\n {children}\n </Comp>\n ) : null;\n}) as Polymorphic.ForwardRefComponent<'div', SliderMarkerProps>;\n\nconst SliderMarker = memo(SliderMarkerImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderMarkerProps\n>;\n\n/**\n * @see Docs https://reach.tech/slider#slidermarker-props\n */\ninterface SliderMarkerProps {\n /**\n * The value to denote where the marker should appear along the track.\n *\n * @see Docs https://reach.tech/slider#slidermarker-value\n */\n value: number;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(val: number, min: number, max: number) {\n return val > max ? max : val < min ? min : val;\n}\n\n/**\n * This handles the case when num is very small (0.00000001), js will turn\n * this into 1e-8. When num is bigger than 1 or less than -1 it won't get\n * converted to this notation so it's fine.\n *\n * @param num\n * @see https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Slider/Slider.js#L69\n */\nfunction getDecimalPrecision(num: number) {\n if (Math.abs(num) < 1) {\n const parts = num.toExponential().split('e-');\n const matissaDecimalPart = parts[0].split('.')[1];\n return (\n (matissaDecimalPart ? matissaDecimalPart.length : 0) +\n parseInt(parts[1], 10)\n );\n }\n\n const decimalPart = num.toString().split('.')[1];\n return decimalPart ? decimalPart.length : 0;\n}\n\nfunction percentToValue(percent: number, min: number, max: number) {\n return (max - min) * percent + min;\n}\n\nfunction roundValueToStep(value: number, step: number, min: number) {\n const nearest = Math.round((value - min) / step) * step + min;\n return Number(nearest.toFixed(getDecimalPrecision(step)));\n}\n\nfunction getPointerPosition(event: SomePointerEvent, touchId: TouchIdRef) {\n if (touchId.current !== undefined && (event as TouchEvent).changedTouches) {\n for (let i = 0; i < (event as TouchEvent).changedTouches.length; i += 1) {\n const touch = (event as TouchEvent).changedTouches[i];\n if (touch.identifier === touchId.current) {\n return {\n x: touch.clientX,\n y: touch.clientY,\n };\n }\n }\n\n return false;\n }\n\n return {\n x: (event as PointerEvent | MouseEvent).clientX,\n y: (event as PointerEvent | MouseEvent).clientY,\n };\n}\n\nfunction getNewValue(\n handlePosition:\n | {\n x: number;\n y: number;\n }\n | false,\n track: HTMLElement | null,\n props: {\n orientation: SliderOrientation;\n min: number;\n max: number;\n step?: number;\n }\n) {\n const { orientation, min, max, step } = props;\n\n if (!track || !handlePosition) {\n return null;\n }\n\n const { left, width, bottom, height } = track.getBoundingClientRect();\n const isVertical = orientation === 'vertical';\n const diff = isVertical ? bottom - handlePosition.y : handlePosition.x - left;\n const percent = diff / (isVertical ? height : width);\n const newValue = percentToValue(percent, min, max);\n\n return clamp(\n step ? roundValueToStep(newValue, step, min) : newValue,\n min,\n max\n );\n}\n\nfunction useDimensions(ref: React.RefObject<HTMLElement | null>) {\n const [{ width, height }, setDimensions] = useState({\n width: 0,\n height: 0,\n });\n // Many existing `useDimensions` type hooks will use `getBoundingClientRect`\n // getBoundingClientRect does not work here when borders are applied.\n // getComputedStyle is not as performant so we may want to create a utility to\n // check for any conflicts with box sizing first and only use\n // `getComputedStyle` if neccessary.\n /* const { width, height } = ref.current\n ? ref.current.getBoundingClientRect()\n : 0; */\n\n useLayoutEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ownerDocument = getOwnerDocument(ref.current)!;\n const ownerWindow = ownerDocument.defaultView || window;\n if (ref.current) {\n const { height: _newHeight, width: _newWidth } =\n ownerWindow.getComputedStyle(ref.current);\n const newHeight = parseFloat(_newHeight);\n const newWidth = parseFloat(_newWidth);\n\n if (newHeight !== height || newWidth !== width) {\n setDimensions({ height: newHeight, width: newWidth });\n }\n }\n }, [ref, width, height]);\n return { ref, width, height };\n}\n\nfunction valueToPercent(value: number, min: number, max: number) {\n return ((value - min) * 100) / (max - min);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Types\n\ntype TrackRef = React.RefObject<HTMLDivElement | null>;\ntype HandleRef = React.RefObject<HTMLDivElement | null>;\ntype SliderRef = React.RefObject<HTMLDivElement | null>;\ntype TouchIdRef = React.MutableRefObject<number | undefined>;\n\ntype SomePointerEvent = TouchEvent | MouseEvent;\n\ninterface ISliderContext {\n ariaLabel: string | undefined;\n ariaLabelledBy: string | undefined;\n ariaValueText: string | undefined;\n handleDimensions: {\n width: number;\n height: number;\n };\n handlePosition: string;\n handleRef: HandleRef;\n hasFocus: boolean;\n onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;\n sliderId: string | undefined;\n sliderMax: number;\n sliderMin: number;\n value: number;\n disabled: boolean;\n isVertical: boolean;\n orientation: SliderOrientation;\n trackPercent: number;\n trackRef: TrackRef;\n rangeStyle: React.CSSProperties;\n updateValue: (e: SomePointerEvent | KeyboardEvent, newValue: any) => void;\n}\n\ntype SliderChildrenRender = (props: {\n ariaValueText?: string | undefined;\n hasFocus?: boolean;\n id?: string | undefined;\n sliderId?: string | undefined;\n max?: number;\n min?: number;\n value?: number;\n}) => JSX.Element;\n\n////////////////////////////////////////////////////////////////////////////////\n// Exports\n\nexport default Slider;\nexport type {\n SliderHandleProps,\n SliderInputProps,\n SliderMarkerProps,\n SliderProps,\n SliderRangeProps,\n SliderTrackProps,\n SliderHandleAlignment,\n SliderOrientation,\n};\nexport {\n Slider,\n SliderHandle,\n SliderInput,\n SliderMarker,\n SliderTrack,\n SliderRange,\n};\n"],"mappings":";;;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,UADF,EAEEC,IAFF,EAGEC,MAHF,EAIEC,QAJF,EAKEC,WALF,EAMEC,SANF,EAOEC,eAPF,EAQEC,KARF,QASO,OATP;AAYA,SAASC,aAAT,QAA8B,kBAA9B;AAEA,SAASC,YAAT,QAA6B,yBAA7B;AACA,SAASC,gBAAT,QAAiC,yBAAjC;AACA,SAASC,uBAAT,QAAwC,8BAAxC;AACA,SAASC,kBAAT,EAA6BC,SAA7B,QAA8C,UAA9C;AACA,SAASC,kBAAT,QAAmC,UAAnC;;;;AAEA,IAAMC,IAAI,GAAG,SAAPA,IAAO,GAAM;EACjB;AACD,CAFD;;AAOA,qBACEP,aAAa,CAAiB,QAAjB,CADf;AAAA;AAAA,IAAOQ,cAAP;AAAA,IAAuBC,gBAAvB,sB,CAGA;;AAEA;AACA;AACA;AACA;AACA;;;AACA,IAAMC,MAAM,gBAAGlB,UAAU,CAAC,SAASkB,MAAT,OAExBC,YAFwB,EAGxB;EAAA,IAFEC,QAEF,QAFEA,QAEF;EAAA,IAFeC,KAEf;;EACA,oBACE,KAAC,WAAD,wBAAiBA,KAAjB;IAAwB,GAAG,EAAEF,YAA7B;IAA2C,qBAAkB,EAA7D;IAAA,uBACE,MAAC,WAAD;MAAA,wBACE,KAAC,WAAD,KADF,eAEE,KAAC,YAAD,KAFF,EA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Aa,GAAGvF,gBAAgB,CAACsD,GAAG,CAACe,OAAL,CAAtC;IACA,IAAMmB,WAAW,GAAGD,aAAa,CAACE,WAAd,IAA6BC,MAAjD;;IACA,IAAIpC,GAAG,CAACe,OAAR,EAAiB;MACf,4BACEmB,WAAW,CAACyE,gBAAZ,CAA6B3G,GAAG,CAACe,OAAjC,CADF;MAAA,IAAgB6F,UAAhB,yBAAQjG,MAAR;MAAA,IAAmCkG,SAAnC,yBAA4BjG,KAA5B;;MAEA,IAAMkG,SAAS,GAAGC,UAAU,CAACH,UAAD,CAA5B;MACA,IAAMI,QAAQ,GAAGD,UAAU,CAACF,SAAD,CAA3B;;MAEA,IAAIC,SAAS,KAAKnG,MAAd,IAAwBqG,QAAQ,KAAKpG,KAAzC,EAAgD;QAC9C8F,aAAa,CAAC;UAAE/F,MAAM,EAAEmG,SAAV;UAAqBlG,KAAK,EAAEoG;QAA5B,CAAD,CAAb;MACD;IACF;EACF,CAdc,EAcZ,CAAChH,GAAD,EAAMY,KAAN,EAAaD,MAAb,CAdY,CAAf;EAeA,OAAO;IAAEX,GAAG,EAAHA,GAAF;IAAOY,KAAK,EAALA,KAAP;IAAcD,MAAM,EAANA;EAAd,CAAP;AACD;;AAED,SAASH,cAAT,CAAwBxC,KAAxB,EAAuCK,GAAvC,EAAoDD,GAApD,EAAiE;EAC/D,OAAQ,CAACJ,KAAK,GAAGK,GAAT,IAAgB,GAAjB,IAAyBD,GAAG,GAAGC,GAA/B,CAAP;AACD,C,CAED;AACA;;;AA8CA;AACA;AAEA,eAAenB,MAAf;AAWA,SACEA,MADF,EAEEiH,YAFF,EAGE7G,WAHF,EAIEqH,YAJF,EAKEd,WALF,EAMEI,WANF"}
1
+ {"version":3,"file":"Slider.js","names":["forwardRef","memo","useRef","useState","useCallback","useEffect","useLayoutEffect","useId","createContext","isRightClick","getOwnerDocument","useStableLayoutCallback","assignMultipleRefs","wrapEvent","useControlledState","jsx","_jsx","jsxs","_jsxs","noop","SliderProvider","useSliderContext","Slider","_ref","forwardedRef","children","props","SliderInput","ref","SliderTrack","SliderRange","SliderHandle","_ref2","ariaLabel","ariaLabelledBy","ariaValueTextProp","as","Comp","innerAs","defaultValue","disabled","value","controlledValue","getAriaLabel","getAriaValueText","handleAlignment","max","min","name","onChange","onChangeProp","onKeyDown","onMouseDown","onMouseMove","onMouseUp","onPointerDown","onPointerUp","onTouchEnd","onTouchMove","onTouchStart","orientation","step","rest","touchId","undefined","fallbackId","id","pointerDownRef","trackRef","handleRef","sliderRef","hasFocus","setHasFocus","x","handleDimensions","useDimensions","_value","setValue","e","v","clamp","trackPercent","valueToPercent","isVertical","handleSize","height","width","handlePosition","handlePositionRef","current","getNewValueFromEvent","event","getNewValue","getPointerPosition","handleKeyDown","newValue","tenSteps","keyStep","key","roundValueToStep","ariaValueText","rangeStyle","removeMoveEvents","removeStartEvents","removeEndEvents","appEvents","handleSlideStart","ownerDocument","ownerWindow","defaultView","window","changedTouches","preventDefault","touch","identifier","requestAnimationFrame","focus","addMoveListener","addEndListener","setPointerCapture","pointerId","releasePointerCapture","handlePointerMove","handleSlideStop","touchListener","mouseListener","addEventListener","removeEventListener","pointerListener","addStartListener","sliderElement","inputFallbackId","inputId","sliderId","sliderMax","sliderMin","updateValue","tabIndex","type","SliderTrackImpl","_ref3","style","position","SliderRangeImpl","_ref4","SliderHandleImpl","_ref5","onBlur","onFocus","role","bottom","left","SliderMarkerImpl","SliderMarker","_ref6","sliderValue","inRange","absoluteStartPosition","state","val","getDecimalPrecision","num","Math","abs","parts","toExponential","split","matissaDecimalPart","length","parseInt","decimalPart","toString","percentToValue","percent","nearest","round","Number","toFixed","i","clientX","y","clientY","track","getBoundingClientRect","diff","setDimensions","_newHeight","_newWidth","getComputedStyle","newHeight","parseFloat","newWidth"],"sources":["../../../src/Slider/Slider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\n\n/**\n * Welcome to @reach/slider!\n *\n * A UI input component where the user selects a value from within a given\n * range. A Slider has a handle that can be moved along a track to change its\n * value. When the user's mouse or focus is on the Slider's handle, the value\n * can be incremented with keyboard controls.\n *\n * Random thoughts/notes:\n * - Currently testing this against the behavior of the native input range\n * element to get our slider on par. We'll explore animated and multi-handle\n * sliders next.\n * - We may want to research some use cases for reversed sliders in RTL\n * languages if that's a thing\n *\n * @see Docs https://reach.tech/slider\n * @see Source https://github.com/reach/reach-ui/tree/main/packages/slider\n * @see WAI-ARIA https://www.w3.org/TR/wai-aria-practices-1.2/#slider\n * @see Example https://github.com/Stanko/aria-progress-range-slider\n * @see Example http://www.oaa-accessibility.org/examplep/slider1/\n */\n\nimport {\n forwardRef,\n memo,\n useRef,\n useState,\n useCallback,\n useEffect,\n useLayoutEffect,\n useId,\n} from 'react';\nimport type { ReactElement, ReactNode, KeyboardEvent } from 'react';\n\nimport { createContext } from '../utils/context';\nimport type * as Polymorphic from '../utils/polymorphic';\nimport { isRightClick } from '../utils/is-right-click';\nimport { getOwnerDocument } from '../utils/owner-document';\nimport { useStableLayoutCallback } from '../utils/use-stable-callback';\nimport { assignMultipleRefs, wrapEvent } from '../utils';\nimport { useControlledState } from '../hooks';\n\nconst noop = () => {\n /* noop */\n};\n\ntype SliderOrientation = 'horizontal' | 'vertical';\ntype SliderHandleAlignment = 'center' | 'contain';\n\nconst [SliderProvider, useSliderContext] =\n createContext<ISliderContext>('Slider');\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Slider\n *\n * @see Docs https://reach.tech/slider#slider\n */\nconst Slider = forwardRef(function Slider(\n { children, ...props },\n forwardedRef\n) {\n return (\n <SliderInput {...props} ref={forwardedRef} data-reach-slider=\"\">\n <SliderTrack>\n <SliderRange />\n <SliderHandle />\n {children}\n </SliderTrack>\n </SliderInput>\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderProps>;\n\n/**\n * @see Docs https://reach.tech/slider#slider-props\n */\ninterface SliderProps {\n /**\n * `Slider` can accept `SliderMarker` children to enhance display of specific\n * values along the track.\n *\n * @see Docs https://reach.tech/slider#slider-children\n */\n children?: ReactNode;\n /**\n * The defaultValue is used to set an initial value for an uncontrolled\n * Slider.\n *\n * @see Docs https://reach.tech/slider#slider-defaultvalue\n */\n defaultValue?: number;\n /**\n * @see Docs https://reach.tech/slider#slider-disabled\n */\n disabled?: boolean;\n /**\n * Whether or not the slider should be disabled from user interaction.\n *\n * @see Docs https://reach.tech/slider#slider-value\n */\n value?: number;\n /**\n * A function used to set a human-readable name for the slider.\n *\n * @see Docs https://reach.tech/slider#slider-getarialabel\n */\n getAriaLabel?(value: number): string;\n /**\n * A function used to set a human-readable value text based on the slider's\n * current value.\n *\n * @see Docs https://reach.tech/slider#slider-getariavaluetext\n */\n getAriaValueText?(value: number): string;\n /**\n * When set to `center`, the slider's handle will be positioned directly\n * centered over the slider's curremt value on the track. This means that when\n * the slider is at its min or max value, a visiable slider handle will extend\n * beyond the width (or height in vertical mode) of the slider track. When set\n * to `contain`, the slider handle will always be contained within the bounds\n * of the track, meaning its position will be slightly offset from the actual\n * value depending on where it sits on the track.\n *\n * @see Docs https://reach.tech/slider#slider-handlealignment\n */\n handleAlignment?: SliderHandleAlignment;\n /**\n * The maximum value of the slider. Defaults to `100`.\n *\n * @see Docs https://reach.tech/slider#slider-max\n */\n max?: number;\n /**\n * The minimum value of the slider. Defaults to `0`.\n *\n * @see Docs https://reach.tech/slider#slider-min\n */\n min?: number;\n /**\n * If the slider is used as a form input, it should accept a `name` prop to\n * identify its value in context of the form.\n *\n * @see Docs https://reach.tech/slider#slider-name\n */\n name?: string;\n /**\n * Callback that fires when the slider value changes. When the `value` prop is\n * set, the Slider state becomes controlled and `onChange` must be used to\n * update the value in response to user interaction.\n *\n * @see Docs https://reach.tech/slider#slider-onchange\n */\n onChange?(\n e: SomePointerEvent | KeyboardEvent,\n newValue: number,\n props?: {\n min?: number;\n max?: number;\n handlePosition?: string;\n }\n ): void;\n\n // We use native DOM events for the slider since they are global\n onMouseDown?(event: MouseEvent): void;\n onMouseMove?(event: MouseEvent): void;\n onMouseUp?(event: MouseEvent): void;\n onPointerDown?(event: PointerEvent): void;\n onPointerUp?(event: PointerEvent): void;\n onTouchEnd?(event: TouchEvent): void;\n onTouchMove?(event: TouchEvent): void;\n onTouchStart?(event: TouchEvent): void;\n\n /**\n * Sets the slider to horizontal or vertical mode.\n *\n * @see Docs https://reach.tech/slider#slider-orientation\n */\n orientation?: SliderOrientation;\n /**\n * The step attribute is a number that specifies the granularity that the\n * value must adhere to as it changes. Step sets minimum intervals of change,\n * creating a \"snap\" effect when the handle is moved along the track.\n *\n * @see Docs https://reach.tech/slider#slider-step\n */\n step?: number;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderInput\n *\n * The parent component of the slider interface. This is a lower level component\n * if you need more control over styles or rendering the slider's inner\n * components.\n *\n * @see Docs https://reach.tech/slider#sliderinput\n */\nconst SliderInput = forwardRef(function SliderInput(\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-valuetext': ariaValueTextProp,\n as: Comp = 'div',\n innerAs,\n defaultValue,\n disabled = false,\n value: controlledValue,\n getAriaLabel,\n getAriaValueText,\n handleAlignment = 'center',\n max = 100,\n min = 0,\n name,\n onChange: onChangeProp,\n onKeyDown,\n onMouseDown,\n onMouseMove,\n onMouseUp,\n onPointerDown,\n onPointerUp,\n onTouchEnd,\n onTouchMove,\n onTouchStart,\n orientation = 'horizontal',\n step = 1,\n children,\n ...rest\n },\n forwardedRef\n) {\n const touchId: TouchIdRef = useRef<number | undefined>(undefined);\n\n const fallbackId = useId();\n const id = rest.id || fallbackId;\n\n // Track whether or not the pointer is down without updating the component\n const pointerDownRef = useRef(false);\n\n const trackRef: TrackRef = useRef(null);\n const handleRef: HandleRef = useRef(null);\n const sliderRef: SliderRef = useRef(null);\n\n const [hasFocus, setHasFocus] = useState(false);\n\n const { ref: x, ...handleDimensions } = useDimensions(handleRef);\n\n const [_value, onChange] = useControlledState(\n controlledValue,\n onChangeProp,\n defaultValue || min,\n (setValue) => (e, v) => setValue(v)\n );\n const value = clamp(_value, min, max);\n const trackPercent = valueToPercent(value, min, max);\n const isVertical = orientation === 'vertical';\n\n const handleSize = isVertical\n ? handleDimensions.height\n : handleDimensions.width;\n\n // TODO: Consider removing the `handleAlignment` prop\n // We may want to use accept a `handlePosition` prop instead and let apps\n // define their own positioning logic, similar to how we do for popovers.\n const handlePosition = `calc(${trackPercent}% - ${\n handleAlignment === 'center'\n ? `${handleSize}px / 2`\n : `${handleSize}px * ${trackPercent * 0.01}`\n })`;\n const handlePositionRef = useRef(handlePosition);\n useLayoutEffect(() => {\n handlePositionRef.current = handlePosition;\n }, [handlePosition]);\n\n const getNewValueFromEvent = useCallback(\n (event: SomePointerEvent) => {\n return getNewValue(getPointerPosition(event, touchId), trackRef.current, {\n step,\n orientation,\n min,\n max,\n });\n },\n [max, min, orientation, step]\n );\n\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_kbd_interaction\n const handleKeyDown = useStableLayoutCallback((event: KeyboardEvent) => {\n if (disabled) {\n return;\n }\n\n let newValue: number;\n const tenSteps = (max - min) / 10;\n const keyStep = step || (max - min) / 100;\n\n switch (event.key) {\n // Decrease the value of the slider by one step.\n case 'ArrowLeft':\n case 'ArrowDown':\n newValue = value - keyStep;\n break;\n // Increase the value of the slider by one step\n case 'ArrowRight':\n case 'ArrowUp':\n newValue = value + keyStep;\n break;\n // Decrement the slider by an amount larger than the step change made by\n // `ArrowDown`.\n case 'PageDown':\n newValue = value - tenSteps;\n break;\n // Increment the slider by an amount larger than the step change made by\n // `ArrowUp`.\n case 'PageUp':\n newValue = value + tenSteps;\n break;\n // Set the slider to the first allowed value in its range.\n case 'Home':\n newValue = min;\n break;\n // Set the slider to the last allowed value in its range.\n case 'End':\n newValue = max;\n break;\n default:\n return;\n }\n\n newValue = clamp(\n step ? roundValueToStep(newValue, step, min) : newValue,\n min,\n max\n );\n onChange(event, newValue);\n });\n\n const ariaValueText = getAriaValueText\n ? getAriaValueText(value)\n : ariaValueTextProp;\n\n const rangeStyle = { [isVertical ? 'height' : 'width']: `${trackPercent}%` };\n\n // Slide events!\n // We will try to use pointer events if they are supported to leverage\n // setPointerCapture and releasePointerCapture. We'll fall back to separate\n // mouse and touch events.\n // TODO: This could be more concise\n const removeMoveEvents = useRef<() => void>(noop);\n const removeStartEvents = useRef<() => void>(noop);\n const removeEndEvents = useRef<() => void>(noop);\n\n // Store our event handlers in refs so we aren't attaching/detaching events\n // on every render if the user doesn't useCallback\n const appEvents = useRef({\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n onPointerDown,\n onPointerUp,\n });\n useLayoutEffect(() => {\n appEvents.current.onMouseMove = onMouseMove;\n appEvents.current.onMouseDown = onMouseDown;\n appEvents.current.onMouseUp = onMouseUp;\n appEvents.current.onTouchStart = onTouchStart;\n appEvents.current.onTouchEnd = onTouchEnd;\n appEvents.current.onTouchMove = onTouchMove;\n appEvents.current.onPointerDown = onPointerDown;\n appEvents.current.onPointerUp = onPointerUp;\n }, [\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n onPointerDown,\n onPointerUp,\n ]);\n\n const handleSlideStart = useStableLayoutCallback(\n (event: SomePointerEvent) => {\n if (isRightClick(event)) return;\n\n if (disabled) {\n pointerDownRef.current = false;\n return;\n }\n\n const ownerDocument = getOwnerDocument(sliderRef.current)!;\n const ownerWindow = ownerDocument.defaultView || window;\n pointerDownRef.current = true;\n\n if ((event as TouchEvent).changedTouches) {\n // Prevent scrolling for touch events\n event.preventDefault();\n const touch = (event as TouchEvent).changedTouches?.[0];\n if (touch != null) {\n touchId.current = touch.identifier;\n }\n }\n\n const newValue = getNewValueFromEvent(event);\n if (newValue == null) {\n return;\n }\n ownerWindow.requestAnimationFrame(() => handleRef.current?.focus());\n onChange(event, newValue);\n\n removeMoveEvents.current = addMoveListener();\n removeEndEvents.current = addEndListener();\n }\n );\n\n const setPointerCapture = useStableLayoutCallback((event: PointerEvent) => {\n if (isRightClick(event)) return;\n if (disabled) {\n pointerDownRef.current = false;\n return;\n }\n pointerDownRef.current = true;\n sliderRef.current?.setPointerCapture(event.pointerId);\n });\n\n const releasePointerCapture = useStableLayoutCallback(\n (event: PointerEvent) => {\n if (isRightClick(event)) return;\n sliderRef.current?.releasePointerCapture(event.pointerId);\n pointerDownRef.current = false;\n }\n );\n\n const handlePointerMove = useStableLayoutCallback(\n (event: SomePointerEvent) => {\n if (disabled || !pointerDownRef.current) {\n pointerDownRef.current = false;\n return;\n }\n\n const newValue = getNewValueFromEvent(event);\n if (newValue == null) {\n return;\n }\n onChange?.(event, newValue);\n }\n );\n\n const handleSlideStop = useStableLayoutCallback((event: SomePointerEvent) => {\n if (isRightClick(event)) return;\n\n pointerDownRef.current = false;\n\n const newValue = getNewValueFromEvent(event);\n if (newValue == null) {\n return;\n }\n\n touchId.current = undefined;\n\n removeMoveEvents.current();\n removeEndEvents.current();\n });\n\n const addMoveListener = useCallback(() => {\n const ownerDocument = getOwnerDocument(sliderRef.current)!;\n const touchListener = wrapEvent(\n appEvents.current.onTouchMove,\n handlePointerMove\n );\n const mouseListener = wrapEvent(\n appEvents.current.onMouseMove,\n handlePointerMove\n );\n ownerDocument.addEventListener('touchmove', touchListener);\n ownerDocument.addEventListener('mousemove', mouseListener);\n return () => {\n ownerDocument.removeEventListener('touchmove', touchListener);\n ownerDocument.removeEventListener('mousemove', mouseListener);\n };\n }, [handlePointerMove]);\n\n const addEndListener = useCallback(() => {\n const ownerDocument = getOwnerDocument(sliderRef.current)!;\n const ownerWindow = ownerDocument.defaultView || window;\n const pointerListener = wrapEvent(\n appEvents.current.onPointerUp,\n releasePointerCapture\n );\n const touchListener = wrapEvent(\n appEvents.current.onTouchEnd,\n handleSlideStop\n );\n const mouseListener = wrapEvent(\n appEvents.current.onMouseUp,\n handleSlideStop\n );\n if ('PointerEvent' in ownerWindow) {\n ownerDocument.addEventListener('pointerup', pointerListener);\n }\n ownerDocument.addEventListener('touchend', touchListener);\n ownerDocument.addEventListener('mouseup', mouseListener);\n return () => {\n if ('PointerEvent' in ownerWindow) {\n ownerDocument.removeEventListener('pointerup', pointerListener);\n }\n ownerDocument.removeEventListener('touchend', touchListener);\n ownerDocument.removeEventListener('mouseup', mouseListener);\n };\n }, [handleSlideStop, releasePointerCapture]);\n\n const addStartListener = useCallback(() => {\n // e.preventDefault is ignored by React's synthetic touchStart event, so\n // we attach the listener directly to the DOM node\n // https://github.com/facebook/react/issues/9809#issuecomment-413978405\n\n const sliderElement = sliderRef.current!;\n if (!sliderElement) {\n return noop;\n }\n\n const ownerDocument = getOwnerDocument(sliderElement)!;\n const ownerWindow = ownerDocument.defaultView || window;\n const touchListener = wrapEvent(\n appEvents.current.onTouchStart,\n handleSlideStart\n );\n const mouseListener = wrapEvent(\n appEvents.current.onMouseDown,\n handleSlideStart\n );\n const pointerListener = wrapEvent(\n appEvents.current.onPointerDown,\n setPointerCapture\n );\n sliderElement.addEventListener('touchstart', touchListener);\n sliderElement.addEventListener('mousedown', mouseListener);\n if ('PointerEvent' in ownerWindow) {\n sliderElement.addEventListener('pointerdown', pointerListener);\n }\n return () => {\n sliderElement.removeEventListener('touchstart', touchListener);\n sliderElement.removeEventListener('mousedown', mouseListener);\n if ('PointerEvent' in ownerWindow) {\n sliderElement.removeEventListener('pointerdown', pointerListener);\n }\n };\n }, [setPointerCapture, handleSlideStart]);\n\n useEffect(() => {\n removeStartEvents.current = addStartListener();\n\n return () => {\n removeStartEvents.current();\n removeEndEvents.current();\n removeMoveEvents.current();\n };\n }, [addStartListener]);\n\n const inputFallbackId = useId();\n const inputId = id || inputFallbackId;\n\n return (\n <SliderProvider\n ariaLabel={getAriaLabel ? getAriaLabel(value) : ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n ariaValueText={ariaValueText}\n handleDimensions={handleDimensions}\n handleKeyDown={handleKeyDown}\n handlePosition={handlePosition}\n handleRef={handleRef}\n hasFocus={hasFocus}\n onKeyDown={onKeyDown}\n setHasFocus={setHasFocus}\n sliderId={id}\n sliderMax={max}\n sliderMin={min}\n value={value}\n disabled={!!disabled}\n isVertical={isVertical}\n orientation={orientation}\n trackPercent={trackPercent}\n trackRef={trackRef}\n rangeStyle={rangeStyle}\n updateValue={onChange}\n >\n <Comp\n {...rest}\n // @ts-ignore\n as={innerAs}\n ref={assignMultipleRefs(sliderRef, forwardedRef)}\n data-reach-slider-input=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n tabIndex={-1}\n >\n {typeof children === 'function'\n ? children({\n hasFocus,\n id,\n max,\n min,\n value,\n ariaValueText,\n })\n : children}\n {name && (\n // If the slider is used in a form we'll need an input field to\n // capture the value. We'll assume this when the component is given a\n // form field name (A `name` prop doesn't really make sense in any\n // other context).\n <input type=\"hidden\" value={value} name={name} id={inputId} />\n )}\n </Comp>\n </SliderProvider>\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderInputProps>;\n\n/**\n * @see Docs https://reach.tech/slider#sliderinput-props\n */\ntype SliderInputProps = Omit<SliderProps, 'children'> & {\n /**\n * Slider expects `<SliderTrack>` as its child; The track will accept all\n * additional slider sub-components as children. It can also accept a\n * function/render prop as its child to expose some of its internal state\n * variables.\n *\n * @see Docs https://reach.tech/slider#sliderinput-children\n */\n children: ReactNode | SliderChildrenRender;\n};\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderTrack\n *\n * @see Docs https://reach.tech/slider#slidertrack\n */\nconst SliderTrackImpl = forwardRef(function SliderTrack(\n { as: Comp = 'div', innerAs, children, style = {}, ...props },\n forwardedRef\n) {\n const { disabled, orientation, trackRef } = useSliderContext('SliderTrack');\n\n return (\n <Comp\n ref={assignMultipleRefs(trackRef, forwardedRef)}\n // @ts-ignore\n as={innerAs}\n style={{ ...style, position: 'relative' }}\n {...props}\n data-reach-slider-track=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n >\n {children}\n </Comp>\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderTrackProps>;\n\nconst SliderTrack = memo(SliderTrackImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderTrackProps\n>;\n\n/**\n * @see Docs https://reach.tech/slider#slidertrack-props\n */\ninterface SliderTrackProps {\n /**\n * `SliderTrack` expects `<SliderHandle>`, at minimum, for the Slider to\n * function. All other Slider subcomponents should be passed as children\n * inside the `SliderTrack`.\n *\n * @see Docs https://reach.tech/slider#slidertrack-children\n */\n children: ReactNode;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderRange\n *\n * The (typically) highlighted portion of the track that represents the space\n * between the slider's `min` value and its current value.\n *\n * @see Docs https://reach.tech/slider#sliderrange\n */\nconst SliderRangeImpl = forwardRef(function SliderRange(\n { as: Comp = 'div', innerAs, children, style = {}, ...props },\n forwardedRef\n) {\n const { disabled, orientation, rangeStyle } = useSliderContext('SliderRange');\n return (\n <Comp\n ref={forwardedRef}\n // @ts-ignore\n as={innerAs}\n style={{ position: 'absolute', ...rangeStyle, ...style }}\n {...props}\n data-reach-slider-range=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n />\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderRangeProps>;\n\nconst SliderRange = memo(SliderRangeImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderRangeProps\n>;\n\n/**\n * `SliderRange` accepts any props that a HTML div component accepts.\n * `SliderRange` will not accept or render any children.\n *\n * @see Docs https://reach.tech/slider#sliderrange-props\n */\n\ninterface SliderRangeProps {}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderHandle\n *\n * The handle that the user drags along the track to set the slider value.\n *\n * @see Docs https://reach.tech/slider#sliderhandle\n */\nconst SliderHandleImpl = forwardRef(function SliderHandle(\n {\n // min,\n // max,\n as: Comp = 'div',\n innerAs,\n onBlur,\n onFocus,\n style = {},\n onKeyDown,\n ...props\n },\n forwardedRef\n) {\n const {\n ariaLabel,\n ariaLabelledBy,\n ariaValueText,\n disabled,\n handlePosition,\n handleRef,\n isVertical,\n handleKeyDown,\n orientation,\n setHasFocus,\n sliderMin,\n sliderMax,\n value,\n } = useSliderContext('SliderHandle');\n\n return (\n <Comp\n // @ts-ignore\n as={innerAs}\n aria-disabled={disabled || undefined}\n // If the slider has a visible label, it is referenced by\n // `aria-labelledby` on the slider element. Otherwise, the slider\n // element has a label provided by `aria-label`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-label={ariaLabel}\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\n // If the slider is vertically oriented, it has `aria-orientation` set\n // to vertical. The default value of `aria-orientation` for a slider is\n // horizontal.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-orientation={orientation}\n // The slider element has the `aria-valuemax` property set to a decimal\n // value representing the maximum allowed value of the slider.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuemax={sliderMax}\n // The slider element has the `aria-valuemin` property set to a decimal\n // value representing the minimum allowed value of the slider.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuemin={sliderMin}\n // The slider element has the `aria-valuenow` property set to a decimal\n // value representing the current value of the slider.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuenow={value}\n // If the value of `aria-valuenow` is not user-friendly, e.g., the day\n // of the week is represented by a number, the `aria-valuetext` property\n // is set to a string that makes the slider value understandable, e.g.,\n // \"Monday\".\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n aria-valuetext={ariaValueText}\n // The element serving as the focusable slider control has role\n // `slider`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n {...props}\n data-reach-slider-handle=\"\"\n ref={assignMultipleRefs(handleRef, forwardedRef)}\n onBlur={wrapEvent(onBlur, () => {\n setHasFocus(false);\n })}\n onFocus={wrapEvent(onFocus, () => {\n setHasFocus(true);\n })}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n style={{\n position: 'absolute',\n ...(isVertical ? { bottom: handlePosition } : { left: handlePosition }),\n ...style,\n }}\n />\n );\n}) as Polymorphic.ForwardRefComponent<'div', SliderHandleProps>;\n\nconst SliderHandle = memo(SliderHandleImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderHandleProps\n>;\n\n/**\n * `SliderRange` accepts any props that a HTML div component accepts.\n *\n * @see Docs https://reach.tech/slider#sliderhandle-props\n */\n\ninterface SliderHandleProps {}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * SliderMarker\n *\n * A fixed value marker. These can be used to illustrate a range of steps or\n * highlight important points along the slider track.\n *\n * @see Docs https://reach.tech/slider#slidermarker\n */\nconst SliderMarkerImpl = forwardRef(function SliderMarker(\n { as: Comp = 'div', innerAs, children, style = {}, value, ...props },\n forwardedRef\n) {\n const {\n disabled,\n isVertical,\n orientation,\n sliderMin,\n sliderMax,\n value: sliderValue,\n } = useSliderContext('SliderMarker');\n\n const inRange = value >= sliderMin && value <= sliderMax;\n const absoluteStartPosition = `${valueToPercent(\n value,\n sliderMin,\n sliderMax\n )}%`;\n\n const state =\n value < sliderValue\n ? 'under-value'\n : value === sliderValue\n ? 'at-value'\n : 'over-value';\n\n return inRange ? (\n <Comp\n ref={forwardedRef}\n // @ts-ignore\n as={innerAs}\n style={{\n position: 'absolute',\n ...(isVertical\n ? { bottom: absoluteStartPosition }\n : { left: absoluteStartPosition }),\n ...style,\n }}\n {...props}\n data-reach-slider-marker=\"\"\n data-disabled={disabled ? '' : undefined}\n data-orientation={orientation}\n data-state={state}\n data-value={value}\n >\n {children}\n </Comp>\n ) : null;\n}) as Polymorphic.ForwardRefComponent<'div', SliderMarkerProps>;\n\nconst SliderMarker = memo(SliderMarkerImpl) as Polymorphic.MemoComponent<\n 'div',\n SliderMarkerProps\n>;\n\n/**\n * @see Docs https://reach.tech/slider#slidermarker-props\n */\ninterface SliderMarkerProps {\n /**\n * The value to denote where the marker should appear along the track.\n *\n * @see Docs https://reach.tech/slider#slidermarker-value\n */\n value: number;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(val: number, min: number, max: number) {\n return val > max ? max : val < min ? min : val;\n}\n\n/**\n * This handles the case when num is very small (0.00000001), js will turn\n * this into 1e-8. When num is bigger than 1 or less than -1 it won't get\n * converted to this notation so it's fine.\n *\n * @param num\n * @see https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Slider/Slider.js#L69\n */\nfunction getDecimalPrecision(num: number) {\n if (Math.abs(num) < 1) {\n const parts = num.toExponential().split('e-');\n const matissaDecimalPart = parts[0].split('.')[1];\n return (\n (matissaDecimalPart ? matissaDecimalPart.length : 0) +\n parseInt(parts[1], 10)\n );\n }\n\n const decimalPart = num.toString().split('.')[1];\n return decimalPart ? decimalPart.length : 0;\n}\n\nfunction percentToValue(percent: number, min: number, max: number) {\n return (max - min) * percent + min;\n}\n\nfunction roundValueToStep(value: number, step: number, min: number) {\n const nearest = Math.round((value - min) / step) * step + min;\n return Number(nearest.toFixed(getDecimalPrecision(step)));\n}\n\nfunction getPointerPosition(event: SomePointerEvent, touchId: TouchIdRef) {\n if (touchId.current !== undefined && (event as TouchEvent).changedTouches) {\n for (let i = 0; i < (event as TouchEvent).changedTouches.length; i += 1) {\n const touch = (event as TouchEvent).changedTouches[i];\n if (touch.identifier === touchId.current) {\n return {\n x: touch.clientX,\n y: touch.clientY,\n };\n }\n }\n\n return false;\n }\n\n return {\n x: (event as PointerEvent | MouseEvent).clientX,\n y: (event as PointerEvent | MouseEvent).clientY,\n };\n}\n\nfunction getNewValue(\n handlePosition:\n | {\n x: number;\n y: number;\n }\n | false,\n track: HTMLElement | null,\n props: {\n orientation: SliderOrientation;\n min: number;\n max: number;\n step?: number;\n }\n) {\n const { orientation, min, max, step } = props;\n\n if (!track || !handlePosition) {\n return null;\n }\n\n const { left, width, bottom, height } = track.getBoundingClientRect();\n const isVertical = orientation === 'vertical';\n const diff = isVertical ? bottom - handlePosition.y : handlePosition.x - left;\n const percent = diff / (isVertical ? height : width);\n const newValue = percentToValue(percent, min, max);\n\n return clamp(\n step ? roundValueToStep(newValue, step, min) : newValue,\n min,\n max\n );\n}\n\nfunction useDimensions(ref: React.RefObject<HTMLElement | null>) {\n const [{ width, height }, setDimensions] = useState({\n width: 0,\n height: 0,\n });\n // Many existing `useDimensions` type hooks will use `getBoundingClientRect`\n // getBoundingClientRect does not work here when borders are applied.\n // getComputedStyle is not as performant so we may want to create a utility to\n // check for any conflicts with box sizing first and only use\n // `getComputedStyle` if neccessary.\n /* const { width, height } = ref.current\n ? ref.current.getBoundingClientRect()\n : 0; */\n\n useLayoutEffect(() => {\n const ownerDocument = getOwnerDocument(ref.current)!;\n const ownerWindow = ownerDocument.defaultView || window;\n if (ref.current) {\n const { height: _newHeight, width: _newWidth } =\n ownerWindow.getComputedStyle(ref.current);\n const newHeight = parseFloat(_newHeight);\n const newWidth = parseFloat(_newWidth);\n\n if (newHeight !== height || newWidth !== width) {\n setDimensions({ height: newHeight, width: newWidth });\n }\n }\n }, [ref, width, height]);\n return { ref, width, height };\n}\n\nfunction valueToPercent(value: number, min: number, max: number) {\n return ((value - min) * 100) / (max - min);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Types\n\ntype TrackRef = React.RefObject<HTMLDivElement | null>;\ntype HandleRef = React.RefObject<HTMLDivElement | null>;\ntype SliderRef = React.RefObject<HTMLDivElement | null>;\ntype TouchIdRef = React.MutableRefObject<number | undefined>;\n\ntype SomePointerEvent = TouchEvent | MouseEvent;\n\ninterface ISliderContext {\n ariaLabel: string | undefined;\n ariaLabelledBy: string | undefined;\n ariaValueText: string | undefined;\n handleDimensions: {\n width: number;\n height: number;\n };\n handlePosition: string;\n handleRef: HandleRef;\n hasFocus: boolean;\n onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n setHasFocus: React.Dispatch<React.SetStateAction<boolean>>;\n sliderId: string | undefined;\n sliderMax: number;\n sliderMin: number;\n value: number;\n disabled: boolean;\n isVertical: boolean;\n orientation: SliderOrientation;\n trackPercent: number;\n trackRef: TrackRef;\n rangeStyle: React.CSSProperties;\n updateValue: (e: SomePointerEvent | KeyboardEvent, newValue: any) => void;\n}\n\ntype SliderChildrenRender = (props: {\n ariaValueText?: string | undefined;\n hasFocus?: boolean;\n id?: string | undefined;\n sliderId?: string | undefined;\n max?: number;\n min?: number;\n value?: number;\n}) => ReactElement;\n\n////////////////////////////////////////////////////////////////////////////////\n// Exports\n\nexport default Slider;\nexport type {\n SliderHandleProps,\n SliderInputProps,\n SliderMarkerProps,\n SliderProps,\n SliderRangeProps,\n SliderTrackProps,\n SliderHandleAlignment,\n SliderOrientation,\n};\nexport {\n Slider,\n SliderHandle,\n SliderInput,\n SliderMarker,\n SliderTrack,\n SliderRange,\n};\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,UAAU,EACVC,IAAI,EACJC,MAAM,EACNC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,KAAK,QACA,OAAO;AAGd,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,kBAAkB,EAAEC,SAAS,QAAQ,UAAU;AACxD,SAASC,kBAAkB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9C,MAAMC,IAAI,GAAGA,CAAA,KAAM;EACjB;AAAA,CACD;AAKD,MAAM,CAACC,cAAc,EAAEC,gBAAgB,CAAC,GACtCb,aAAa,CAAiB,QAA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AW,CAACgF,gBAAgB,CAAChK,GAAG,CAAC6D,OAAO,CAAC;MAC3C,MAAMoG,SAAS,GAAGC,UAAU,CAACJ,UAAU,CAAC;MACxC,MAAMK,QAAQ,GAAGD,UAAU,CAACH,SAAS,CAAC;MAEtC,IAAIE,SAAS,KAAKxG,MAAM,IAAI0G,QAAQ,KAAKzG,KAAK,EAAE;QAC9CmG,aAAa,CAAC;UAAEpG,MAAM,EAAEwG,SAAS;UAAEvG,KAAK,EAAEyG;QAAS,CAAC,CAAC;MACvD;IACF;EACF,CAAC,EAAE,CAACnK,GAAG,EAAE0D,KAAK,EAAED,MAAM,CAAC,CAAC;EACxB,OAAO;IAAEzD,GAAG;IAAE0D,KAAK;IAAED;EAAO,CAAC;AAC/B;AAEA,SAASH,cAAcA,CAACzC,KAAa,EAAEM,GAAW,EAAED,GAAW,EAAE;EAC/D,OAAQ,CAACL,KAAK,GAAGM,GAAG,IAAI,GAAG,IAAKD,GAAG,GAAGC,GAAG,CAAC;AAC5C;;AAEA;AACA;;AA8CA;AACA;;AAEA,eAAezB,MAAM;AAWrB,SACEA,MAAM,EACNS,YAAY,EACZJ,WAAW,EACX8H,YAAY,EACZ5H,WAAW,EACXC,WAAW","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/Slider/index.ts"],"sourcesContent":["export * from './Slider';\n"],"mappings":"AAAA,cAAc,UAAd"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/Slider/index.ts"],"sourcesContent":["export * from './Slider';\n"],"mappings":"AAAA,cAAc,UAAU","ignoreList":[]}
@@ -1,101 +1,72 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["as", "minValue", "maxValue", "stepSize", "value", "onChange", "onKeyDown", "onBlur", "onFocus"];
5
1
  import { forwardRef, useState, useRef } from 'react';
6
2
  import { SpinnerProvider } from './context';
7
3
  import { clamp as clampFunc } from '../utils/clamp';
8
4
  import { wrapEvent, assignMultipleRefs } from '../utils';
9
5
  import { jsx as _jsx } from "react/jsx-runtime";
10
- export var Spinner = /*#__PURE__*/forwardRef(function Spinner(props, forwardedRef) {
11
- var _props$as = props.as,
12
- Comp = _props$as === void 0 ? 'div' : _props$as,
13
- _props$minValue = props.minValue,
14
- minValue = _props$minValue === void 0 ? -1000 : _props$minValue,
15
- _props$maxValue = props.maxValue,
16
- maxValue = _props$maxValue === void 0 ? 1000 : _props$maxValue,
17
- _props$stepSize = props.stepSize,
18
- stepSize = _props$stepSize === void 0 ? 10 : _props$stepSize,
19
- _props$value = props.value,
20
- value = _props$value === void 0 ? 0 : _props$value,
21
- onChange = props.onChange,
22
- onKeyDown = props.onKeyDown,
23
- onBlur = props.onBlur,
24
- onFocus = props.onFocus,
25
- otherProps = _objectWithoutProperties(props, _excluded);
26
-
27
- var _useState = useState(false),
28
- _useState2 = _slicedToArray(_useState, 2),
29
- spinnerHasFocus = _useState2[0],
30
- setSpinnerHasFocus = _useState2[1];
31
-
32
- var ref = useRef();
33
-
34
- var clamp = function clamp(value) {
35
- return clampFunc(value, minValue, maxValue);
36
- };
37
-
38
- var handleKeyDown = function handleKeyDown(e) {
39
- var nextValue = value;
40
-
6
+ export const Spinner = /*#__PURE__*/forwardRef(function Spinner(props, forwardedRef) {
7
+ const {
8
+ as: Comp = 'div',
9
+ minValue = -1000,
10
+ maxValue = 1000,
11
+ stepSize = 10,
12
+ value = 0,
13
+ onChange,
14
+ onKeyDown,
15
+ onBlur,
16
+ onFocus,
17
+ ...otherProps
18
+ } = props;
19
+ const [spinnerHasFocus, setSpinnerHasFocus] = useState(false);
20
+ const ref = useRef(null);
21
+ const clamp = value => clampFunc(value, minValue, maxValue);
22
+ const handleKeyDown = e => {
23
+ let nextValue = value;
41
24
  switch (e.key) {
42
25
  case 'ArrowUp':
43
26
  nextValue += 1;
44
27
  break;
45
-
46
28
  case 'ArrowDown':
47
29
  nextValue -= 1;
48
30
  break;
49
-
50
31
  case 'Home':
51
32
  nextValue = minValue;
52
33
  break;
53
-
54
34
  case 'End':
55
35
  nextValue = maxValue;
56
36
  break;
57
-
58
37
  case 'PageUp':
59
38
  nextValue += stepSize;
60
39
  break;
61
-
62
40
  case 'PageDown':
63
41
  nextValue -= stepSize;
64
42
  break;
65
-
66
43
  default:
67
44
  return;
68
45
  }
69
-
70
46
  ref.current && ref.current.focus();
71
47
  nextValue = clamp(nextValue);
72
-
73
48
  if (nextValue !== value) {
74
49
  e.preventDefault(); // prevent scrolling
75
-
76
50
  onChange && onChange(e, nextValue);
77
51
  }
78
52
  };
79
-
80
- var handleFocus = function handleFocus() {
53
+ const handleFocus = () => {
81
54
  setSpinnerHasFocus(true);
82
55
  };
83
-
84
- var handleBlur = function handleBlur() {
56
+ const handleBlur = () => {
85
57
  setSpinnerHasFocus(false);
86
58
  };
87
-
88
59
  return /*#__PURE__*/_jsx(SpinnerProvider, {
89
60
  value: {
90
- minValue: minValue,
91
- value: value,
92
- maxValue: maxValue,
93
- stepSize: stepSize,
94
- onChange: onChange,
95
- clamp: clamp,
96
- spinnerHasFocus: spinnerHasFocus
61
+ minValue,
62
+ value,
63
+ maxValue,
64
+ stepSize,
65
+ onChange,
66
+ clamp,
67
+ spinnerHasFocus
97
68
  },
98
- children: /*#__PURE__*/_jsx(Comp, _extends({
69
+ children: /*#__PURE__*/_jsx(Comp, {
99
70
  ref: assignMultipleRefs(forwardedRef, ref),
100
71
  "data-spinner-root": "",
101
72
  role: "spinbutton",
@@ -105,8 +76,9 @@ export var Spinner = /*#__PURE__*/forwardRef(function Spinner(props, forwardedRe
105
76
  tabIndex: 0,
106
77
  onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
107
78
  onFocus: wrapEvent(onFocus, handleFocus),
108
- onBlur: wrapEvent(onBlur, handleBlur)
109
- }, otherProps))
79
+ onBlur: wrapEvent(onBlur, handleBlur),
80
+ ...otherProps
81
+ })
110
82
  });
111
83
  });
112
84
  //# sourceMappingURL=Spinner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.js","names":["forwardRef","useState","useRef","SpinnerProvider","clamp","clampFunc","wrapEvent","assignMultipleRefs","Spinner","props","forwardedRef","as","Comp","minValue","maxValue","stepSize","value","onChange","onKeyDown","onBlur","onFocus","otherProps","spinnerHasFocus","setSpinnerHasFocus","ref","handleKeyDown","e","nextValue","key","current","focus","preventDefault","handleFocus","handleBlur"],"sources":["../../../src/Spinner/Spinner.tsx"],"sourcesContent":["import type {\n HTMLAttributes,\n ElementType,\n ReactNode,\n MouseEvent,\n KeyboardEvent,\n} from 'react';\nimport { forwardRef, useState, useRef } from 'react';\n\nimport { SpinnerProvider } from './context';\nimport { clamp as clampFunc } from '../utils/clamp';\nimport { wrapEvent, assignMultipleRefs } from '../utils';\n\nexport interface SpinnerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n value?: number;\n minValue?: number;\n maxValue?: number;\n stepSize?: number;\n onChange?: (\n e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLDivElement>,\n value: number\n ) => void;\n}\n\nexport const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(\n function Spinner(props, forwardedRef) {\n const {\n as: Comp = 'div',\n minValue = -1000,\n maxValue = 1000,\n stepSize = 10,\n value = 0,\n onChange,\n onKeyDown,\n onBlur,\n onFocus,\n ...otherProps\n } = props;\n const [spinnerHasFocus, setSpinnerHasFocus] = useState(false);\n const ref = useRef<HTMLDivElement>();\n\n const clamp = (value: number) => clampFunc(value, minValue, maxValue);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n let nextValue = value;\n switch (e.key) {\n case 'ArrowUp':\n nextValue += 1;\n break;\n case 'ArrowDown':\n nextValue -= 1;\n break;\n case 'Home':\n nextValue = minValue;\n break;\n case 'End':\n nextValue = maxValue;\n break;\n case 'PageUp':\n nextValue += stepSize;\n break;\n case 'PageDown':\n nextValue -= stepSize;\n break;\n default:\n return;\n }\n\n ref.current && ref.current.focus();\n nextValue = clamp(nextValue);\n if (nextValue !== value) {\n e.preventDefault(); // prevent scrolling\n onChange && onChange(e, nextValue);\n }\n };\n\n const handleFocus = () => {\n setSpinnerHasFocus(true);\n };\n\n const handleBlur = () => {\n setSpinnerHasFocus(false);\n };\n\n return (\n <SpinnerProvider\n value={{\n minValue,\n value,\n maxValue,\n stepSize,\n onChange,\n clamp,\n spinnerHasFocus,\n }}\n >\n <Comp\n ref={assignMultipleRefs(forwardedRef, ref)}\n data-spinner-root=\"\"\n role=\"spinbutton\"\n aria-valuenow={value}\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n tabIndex={0}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n onFocus={wrapEvent(onFocus, handleFocus)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n {...otherProps}\n />\n </SpinnerProvider>\n );\n }\n);\n"],"mappings":";;;;AAOA,SAASA,UAAT,EAAqBC,QAArB,EAA+BC,MAA/B,QAA6C,OAA7C;AAEA,SAASC,eAAT,QAAgC,WAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,gBAAnC;AACA,SAASC,SAAT,EAAoBC,kBAApB,QAA8C,UAA9C;;AAiBA,OAAO,IAAMC,OAAO,gBAAGR,UAAU,CAC/B,SAASQ,OAAT,CAAiBC,KAAjB,EAAwBC,YAAxB,EAAsC;EACpC,gBAWID,KAXJ,CACEE,EADF;EAAA,IACMC,IADN,0BACa,KADb;EAAA,sBAWIH,KAXJ,CAEEI,QAFF;EAAA,IAEEA,QAFF,gCAEa,CAAC,IAFd;EAAA,sBAWIJ,KAXJ,CAGEK,QAHF;EAAA,IAGEA,QAHF,gCAGa,IAHb;EAAA,sBAWIL,KAXJ,CAIEM,QAJF;EAAA,IAIEA,QAJF,gCAIa,EAJb;EAAA,mBAWIN,KAXJ,CA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;EAiCA,IAAMK,WAAW,GAAG,SAAdA,WAAc,GAAM;IACxBT,kBAAkB,CAAC,IAAD,CAAlB;EACD,CAFD;;EAIA,IAAMU,UAAU,GAAG,SAAbA,UAAa,GAAM;IACvBV,kBAAkB,CAAC,KAAD,CAAlB;EACD,CAFD;;EAIA,oBACE,KAAC,eAAD;IACE,KAAK,EAAE;MACLV,QAAQ,EAARA,QADK;MAELG,KAAK,EAALA,KAFK;MAGLF,QAAQ,EAARA,QAHK;MAILC,QAAQ,EAARA,QAJK;MAKLE,QAAQ,EAARA,QALK;MAMLb,KAAK,EAALA,KANK;MAOLkB,eAAe,EAAfA;IAPK,CADT;IAAA,uBAWE,KAAC,IAAD;MACE,GAAG,EAAEf,kBAAkB,CAACG,YAAD,EAAec,GAAf,CADzB;MAEE,qBAAkB,EAFpB;MAGE,IAAI,EAAC,YAHP;MAIE,iBAAeR,KAJjB;MAKE,iBAAeH,QALjB;MAME,iBAAeC,QANjB;MAOE,QAAQ,EAAE,CAPZ;MAQE,SAAS,EAAER,SAAS,CAACY,SAAD,EAAYO,aAAZ,CARtB;MASE,OAAO,EAAEnB,SAAS,CAACc,OAAD,EAAUY,WAAV,CATpB;MAUE,MAAM,EAAE1B,SAAS,CAACa,MAAD,EAASc,UAAT;IAVnB,GAWMZ,UAXN;EAXF,EADF;AA2BD,CAvF8B,CAA1B"}
1
+ {"version":3,"file":"Spinner.js","names":["forwardRef","useState","useRef","SpinnerProvider","clamp","clampFunc","wrapEvent","assignMultipleRefs","jsx","_jsx","Spinner","props","forwardedRef","as","Comp","minValue","maxValue","stepSize","value","onChange","onKeyDown","onBlur","onFocus","otherProps","spinnerHasFocus","setSpinnerHasFocus","ref","handleKeyDown","e","nextValue","key","current","focus","preventDefault","handleFocus","handleBlur","children","role","tabIndex"],"sources":["../../../src/Spinner/Spinner.tsx"],"sourcesContent":["import type {\n HTMLAttributes,\n ElementType,\n ReactNode,\n MouseEvent,\n KeyboardEvent,\n} from 'react';\nimport { forwardRef, useState, useRef } from 'react';\n\nimport { SpinnerProvider } from './context';\nimport { clamp as clampFunc } from '../utils/clamp';\nimport { wrapEvent, assignMultipleRefs } from '../utils';\n\nexport interface SpinnerProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n value?: number;\n minValue?: number;\n maxValue?: number;\n stepSize?: number;\n onChange?: (\n e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLDivElement>,\n value: number\n ) => void;\n}\n\nexport const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(\n function Spinner(props, forwardedRef) {\n const {\n as: Comp = 'div',\n minValue = -1000,\n maxValue = 1000,\n stepSize = 10,\n value = 0,\n onChange,\n onKeyDown,\n onBlur,\n onFocus,\n ...otherProps\n } = props;\n const [spinnerHasFocus, setSpinnerHasFocus] = useState(false);\n const ref = useRef<HTMLDivElement | null>(null);\n\n const clamp = (value: number) => clampFunc(value, minValue, maxValue);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n let nextValue = value;\n switch (e.key) {\n case 'ArrowUp':\n nextValue += 1;\n break;\n case 'ArrowDown':\n nextValue -= 1;\n break;\n case 'Home':\n nextValue = minValue;\n break;\n case 'End':\n nextValue = maxValue;\n break;\n case 'PageUp':\n nextValue += stepSize;\n break;\n case 'PageDown':\n nextValue -= stepSize;\n break;\n default:\n return;\n }\n\n ref.current && ref.current.focus();\n nextValue = clamp(nextValue);\n if (nextValue !== value) {\n e.preventDefault(); // prevent scrolling\n onChange && onChange(e, nextValue);\n }\n };\n\n const handleFocus = () => {\n setSpinnerHasFocus(true);\n };\n\n const handleBlur = () => {\n setSpinnerHasFocus(false);\n };\n\n return (\n <SpinnerProvider\n value={{\n minValue,\n value,\n maxValue,\n stepSize,\n onChange,\n clamp,\n spinnerHasFocus,\n }}\n >\n <Comp\n ref={assignMultipleRefs(forwardedRef, ref)}\n data-spinner-root=\"\"\n role=\"spinbutton\"\n aria-valuenow={value}\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n tabIndex={0}\n onKeyDown={wrapEvent(onKeyDown, handleKeyDown)}\n onFocus={wrapEvent(onFocus, handleFocus)}\n onBlur={wrapEvent(onBlur, handleBlur)}\n {...otherProps}\n />\n </SpinnerProvider>\n );\n }\n);\n"],"mappings":"AAOA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAEpD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,gBAAgB;AACnD,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAiBzD,OAAO,MAAMC,OAAO,gBAAGV,UAAU,CAC/B,SAASU,OAAOA,CAACC,KAAK,EAAEC,YAAY,EAAE;EACpC,MAAM;IACJC,EAAE,EAAEC,IAAI,GAAG,KAAK;IAChBC,QAAQ,GAAG,CAAC,IAAI;IAChBC,QAAQ,GAAG,IAAI;IACfC,QAAQ,GAAG,EAAE;IACbC,KAAK,GAAG,CAAC;IACTC,QAAQ;IACRC,SAAS;IACTC,MAAM;IACNC,OAAO;IACP,GAAGC;EACL,CAAC,GAAGZ,KAAK;EACT,MAAM,CAACa,eAAe,EAAEC,kBAAkB,CAAC,GAAGxB,QAAQ,CAAC,KAAK,CAAC;EAC7D,MAAMyB,GAAG,GAAGxB,MAAM,CAAwB,IAAI,CAAC;EAE/C,MAAME,KAAK,GAAIc,KAAa,IAAKb,SAAS,CAACa,KAAK,EAAEH,QAAQ,EAAEC,QAAQ,CAAC;EAErE,MAAMW,aAAa,GAAIC,CAAgC,IAAK;IAC1D,IAAIC,SAAS,GAAGX,KAAK;IACrB,QAAQU,CAAC,CAACE,GAAG;MACX,KAAK,SAAS;QACZD,SAAS,IAAI,CAAC;QACd;MACF,KAAK,WAAW;QACdA,SAAS,IAAI,CAAC;QACd;MACF,KAAK,MAAM;QACTA,SAAS,GAAGd,QA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AAEtB,CACF,CAAC","ignoreList":[]}
@@ -1,30 +1,25 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["as", "type", "onClick"];
4
1
  import { forwardRef } from 'react';
5
2
  import { useSpinnerContext } from './context';
6
3
  import { wrapEvent } from '../utils';
7
4
  import { jsx as _jsx } from "react/jsx-runtime";
8
- export var SpinnerButton = /*#__PURE__*/forwardRef(function SpinnerButton(props, forwardedRef) {
9
- var _props$as = props.as,
10
- Comp = _props$as === void 0 ? 'button' : _props$as,
11
- type = props.type,
12
- onClick = props.onClick,
13
- otherProps = _objectWithoutProperties(props, _excluded);
14
-
15
- var spinnerContext = useSpinnerContext();
16
-
5
+ export const SpinnerButton = /*#__PURE__*/forwardRef(function SpinnerButton(props, forwardedRef) {
6
+ const {
7
+ as: Comp = 'button',
8
+ type,
9
+ onClick,
10
+ ...otherProps
11
+ } = props;
12
+ const spinnerContext = useSpinnerContext();
17
13
  if (!spinnerContext) {
18
14
  throw new Error('Missing <Spinner /> in component tree');
19
15
  }
20
-
21
- var handleClick = function handleClick(e) {
22
- var delta = type === 'next' ? 1 : -1;
16
+ const handleClick = e => {
17
+ const delta = type === 'next' ? 1 : -1;
23
18
  spinnerContext.onChange && spinnerContext.onChange(e, spinnerContext.value + delta);
24
19
  };
25
-
26
- var disabled = type === 'next' ? spinnerContext.value + 1 > spinnerContext.maxValue : spinnerContext.value - 1 < spinnerContext.minValue;
27
- return /*#__PURE__*/_jsx(Comp, _extends(_extends({}, otherProps), {}, {
20
+ const disabled = type === 'next' ? spinnerContext.value + 1 > spinnerContext.maxValue : spinnerContext.value - 1 < spinnerContext.minValue;
21
+ return /*#__PURE__*/_jsx(Comp, {
22
+ ...otherProps,
28
23
  type: "button",
29
24
  ref: forwardedRef,
30
25
  tabIndex: -1,
@@ -32,6 +27,6 @@ export var SpinnerButton = /*#__PURE__*/forwardRef(function SpinnerButton(props,
32
27
  "data-spinner-has-focus": spinnerContext.spinnerHasFocus ? '' : undefined,
33
28
  disabled: disabled,
34
29
  onClick: wrapEvent(onClick, handleClick)
35
- }));
30
+ });
36
31
  });
37
32
  //# sourceMappingURL=SpinnerButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpinnerButton.js","names":["forwardRef","useSpinnerContext","wrapEvent","SpinnerButton","props","forwardedRef","as","Comp","type","onClick","otherProps","spinnerContext","Error","handleClick","e","delta","onChange","value","disabled","maxValue","minValue","spinnerHasFocus","undefined"],"sources":["../../../src/Spinner/SpinnerButton.tsx"],"sourcesContent":["import type {\n ButtonHTMLAttributes,\n ElementType,\n MouseEvent,\n ReactNode,\n} from 'react';\nimport { forwardRef } from 'react';\n\nimport { useSpinnerContext } from './context';\nimport { wrapEvent } from '../utils';\n\nexport interface SpinnerButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n type: 'next' | 'previous';\n}\n\nexport const SpinnerButton = forwardRef<HTMLButtonElement, SpinnerButtonProps>(\n function SpinnerButton(props, forwardedRef) {\n const { as: Comp = 'button', type, onClick, ...otherProps } = props;\n const spinnerContext = useSpinnerContext();\n\n if (!spinnerContext) {\n throw new Error('Missing <Spinner /> in component tree');\n }\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n const delta = type === 'next' ? 1 : -1;\n\n spinnerContext.onChange &&\n spinnerContext.onChange(e, spinnerContext.value + delta);\n };\n\n const disabled =\n type === 'next'\n ? spinnerContext.value + 1 > spinnerContext.maxValue\n : spinnerContext.value - 1 < spinnerContext.minValue;\n\n return (\n <Comp\n {...otherProps}\n type=\"button\"\n ref={forwardedRef}\n tabIndex={-1}\n data-spinner-button=\"\"\n data-spinner-has-focus={spinnerContext.spinnerHasFocus ? '' : undefined}\n disabled={disabled}\n onClick={wrapEvent(onClick, handleClick)}\n />\n );\n }\n);\n"],"mappings":";;;AAMA,SAASA,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AAUI,WAAV;EARpB,GADF;AAYD,CAjCoC,CAAhC"}
1
+ {"version":3,"file":"SpinnerButton.js","names":["forwardRef","useSpinnerContext","wrapEvent","jsx","_jsx","SpinnerButton","props","forwardedRef","as","Comp","type","onClick","otherProps","spinnerContext","Error","handleClick","e","delta","onChange","value","disabled","maxValue","minValue","ref","tabIndex","spinnerHasFocus","undefined"],"sources":["../../../src/Spinner/SpinnerButton.tsx"],"sourcesContent":["import type {\n ButtonHTMLAttributes,\n ElementType,\n MouseEvent,\n ReactNode,\n} from 'react';\nimport { forwardRef } from 'react';\n\nimport { useSpinnerContext } from './context';\nimport { wrapEvent } from '../utils';\n\nexport interface SpinnerButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n type: 'next' | 'previous';\n}\n\nexport const SpinnerButton = forwardRef<HTMLButtonElement, SpinnerButtonProps>(\n function SpinnerButton(props, forwardedRef) {\n const { as: Comp = 'button', type, onClick, ...otherProps } = props;\n const spinnerContext = useSpinnerContext();\n\n if (!spinnerContext) {\n throw new Error('Missing <Spinner /> in component tree');\n }\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n const delta = type === 'next' ? 1 : -1;\n\n spinnerContext.onChange &&\n spinnerContext.onChange(e, spinnerContext.value + delta);\n };\n\n const disabled =\n type === 'next'\n ? spinnerContext.value + 1 > spinnerContext.maxValue\n : spinnerContext.value - 1 < spinnerContext.minValue;\n\n return (\n <Comp\n {...otherProps}\n type=\"button\"\n ref={forwardedRef}\n tabIndex={-1}\n data-spinner-button=\"\"\n data-spinner-has-focus={spinnerContext.spinnerHasFocus ? '' : undefined}\n disabled={disabled}\n onClick={wrapEvent(onClick, handleClick)}\n />\n );\n }\n);\n"],"mappings":"AAMA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,SAASC,SAAS,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUrC,OAAO,MAAMC,aAAa,gBAAGL,UAAU,CACrC,SAASK,aAAaA,CAACC,KAAK,EAAEC,YAAY,EAAE;EAC1C,MAAM;IAAEC,EAAE,EAAEC,IAAI,GAAG,QAAQ;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;EAAW,CAAC,GAAGN,KAAK;EACnE,MAAMO,cAAc,GAAGZ,iBAAiB,CAAC,CAAC;EAE1C,IAAI,CAACY,cAAc,EAAE;IACnB,MAAM,IAAIC,KAAK,CAAC,uCAAuC,CAAC;EAC1D;EAEA,MAAMC,WAAW,GAAIC,CAAgC,IAAK;IACxD,MAAMC,KAAK,GAAGP,IAAI,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;IAEtCG,cAAc,CAACK,QAAQ,IACrBL,cAAc,CAACK,QAAQ,CAACF,CAAC,EAAEH,cAAc,CAACM,KAAK,GAAGF,KAAK,CAAC;EAC5D,CAAC;EAED,MAAMG,QAAQ,GACZV,IAAI,KAAK,MAAM,GACXG,cAAc,CAACM,KAAK,GAAG,CAAC,GAAGN,cAAc,CAACQ,QAAQ,GAClDR,cAAc,CAACM,KAAK,GAAG,CAAC,GAAGN,cAAc,CAACS,QAAQ;EAExD,oBACElB,IAAA,CAACK,IAAI;IAAA,GACCG,UAAU;IACdF,IAAI,EAAC,QAAQ;IACba,GAAG,EAAEhB,YAAa;IAClBiB,QAAQ,EAAE,CAAC,CAAE;IACb,uBAAoB,EAAE;IACtB,0BAAwBX,cAAc,CAACY,eAAe,GAAG,EAAE,GAAGC,SAAU;IACxEN,QAAQ,EAAEA,QAAS;IACnBT,OAAO,EAAET,SAAS,CAACS,OAAO,EAAEI,WAAW;EAAE,CAC1C,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
@@ -1,9 +1,10 @@
1
- import { createContext, useContext } from 'react'; // Spinner Component
1
+ import { createContext, useContext } from 'react';
2
2
 
3
- var spinbuttonContext = /*#__PURE__*/createContext(null);
4
- var SpinnerProvider = spinbuttonContext.Provider;
5
- export { SpinnerProvider };
6
- export var useSpinnerContext = function useSpinnerContext() {
7
- return useContext(spinbuttonContext);
8
- };
3
+ // Spinner Component
4
+
5
+ const spinbuttonContext = /*#__PURE__*/createContext(null);
6
+ export const {
7
+ Provider: SpinnerProvider
8
+ } = spinbuttonContext;
9
+ export const useSpinnerContext = () => useContext(spinbuttonContext);
9
10
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["createContext","useContext","spinbuttonContext","SpinnerProvider","Provider","useSpinnerContext"],"sources":["../../../src/Spinner/context.ts"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react';\nimport { createContext, useContext } from 'react';\n\n// Spinner Component\nexport interface SpinnerContextProps {\n value: number;\n minValue: number;\n maxValue: number;\n stepSize: number;\n onChange?: (\n e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLDivElement>,\n value: number\n ) => void;\n clamp: (value: number) => number;\n spinnerHasFocus: boolean;\n}\n\nconst spinbuttonContext = createContext<SpinnerContextProps | null>(null);\nexport const { Provider: SpinnerProvider } = spinbuttonContext;\nexport const useSpinnerContext = () => useContext(spinbuttonContext);\n"],"mappings":"AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C,C,CAEA;;AAcA,IAAMC,iBAAiB,gBAAGF,aAAa,CAA6B,IAA7B,CAAvC;AACO,IAAkBG,eAAlB,GAAsCD,iBAAtC,CAAQE,QAAR;;AACP,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB;EAAA,OAAMJ,UAAU,CAACC,iBAAD,CAAhB;AAAA,CAA1B"}
1
+ {"version":3,"file":"context.js","names":["createContext","useContext","spinbuttonContext","Provider","SpinnerProvider","useSpinnerContext"],"sources":["../../../src/Spinner/context.ts"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react';\nimport { createContext, useContext } from 'react';\n\n// Spinner Component\nexport interface SpinnerContextProps {\n value: number;\n minValue: number;\n maxValue: number;\n stepSize: number;\n onChange?: (\n e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLDivElement>,\n value: number\n ) => void;\n clamp: (value: number) => number;\n spinnerHasFocus: boolean;\n}\n\nconst spinbuttonContext = createContext<SpinnerContextProps | null>(null);\nexport const { Provider: SpinnerProvider } = spinbuttonContext;\nexport const useSpinnerContext = () => useContext(spinbuttonContext);\n"],"mappings":"AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;;AAEjD;;AAcA,MAAMC,iBAAiB,gBAAGF,aAAa,CAA6B,IAAI,CAAC;AACzE,OAAO,MAAM;EAAEG,QAAQ,EAAEC;AAAgB,CAAC,GAAGF,iBAAiB;AAC9D,OAAO,MAAMG,iBAAiB,GAAGA,CAAA,KAAMJ,UAAU,CAACC,iBAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/Spinner/index.ts"],"sourcesContent":["export * from './Spinner';\nexport * from './SpinnerButton';\n"],"mappings":"AAAA,cAAc,WAAd;AACA,cAAc,iBAAd"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/Spinner/index.ts"],"sourcesContent":["export * from './Spinner';\nexport * from './SpinnerButton';\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,iBAAiB","ignoreList":[]}