UNPKG

23.8 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4import _typeof from "@babel/runtime/helpers/esm/typeof";
5import * as React from 'react';
6import { unstable_ownerDocument as ownerDocument, unstable_useControlled as useControlled, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible, visuallyHidden } from '@mui/utils';
7import { areArraysEqual } from '../utils';
8var INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
9function asc(a, b) {
10 return a - b;
11}
12function clamp(value, min, max) {
13 if (value == null) {
14 return min;
15 }
16 return Math.min(Math.max(min, value), max);
17}
18function findClosest(values, currentValue) {
19 var _values$reduce;
20 var _ref = (_values$reduce = values.reduce(function (acc, value, index) {
21 var distance = Math.abs(currentValue - value);
22 if (acc === null || distance < acc.distance || distance === acc.distance) {
23 return {
24 distance: distance,
25 index: index
26 };
27 }
28 return acc;
29 }, null)) != null ? _values$reduce : {},
30 closestIndex = _ref.index;
31 return closestIndex;
32}
33function trackFinger(event, touchId) {
34 // The event is TouchEvent
35 if (touchId.current !== undefined && event.changedTouches) {
36 var touchEvent = event;
37 for (var i = 0; i < touchEvent.changedTouches.length; i += 1) {
38 var touch = touchEvent.changedTouches[i];
39 if (touch.identifier === touchId.current) {
40 return {
41 x: touch.clientX,
42 y: touch.clientY
43 };
44 }
45 }
46 return false;
47 }
48
49 // The event is MouseEvent
50 return {
51 x: event.clientX,
52 y: event.clientY
53 };
54}
55export function valueToPercent(value, min, max) {
56 return (value - min) * 100 / (max - min);
57}
58function percentToValue(percent, min, max) {
59 return (max - min) * percent + min;
60}
61function getDecimalPrecision(num) {
62 // This handles the case when num is very small (0.00000001), js will turn this into 1e-8.
63 // When num is bigger than 1 or less than -1 it won't get converted to this notation so it's fine.
64 if (Math.abs(num) < 1) {
65 var parts = num.toExponential().split('e-');
66 var matissaDecimalPart = parts[0].split('.')[1];
67 return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
68 }
69 var decimalPart = num.toString().split('.')[1];
70 return decimalPart ? decimalPart.length : 0;
71}
72function roundValueToStep(value, step, min) {
73 var nearest = Math.round((value - min) / step) * step + min;
74 return Number(nearest.toFixed(getDecimalPrecision(step)));
75}
76function setValueIndex(_ref2) {
77 var values = _ref2.values,
78 newValue = _ref2.newValue,
79 index = _ref2.index;
80 var output = values.slice();
81 output[index] = newValue;
82 return output.sort(asc);
83}
84function focusThumb(_ref3) {
85 var _sliderRef$current, _doc$activeElement;
86 var sliderRef = _ref3.sliderRef,
87 activeIndex = _ref3.activeIndex,
88 setActive = _ref3.setActive;
89 var doc = ownerDocument(sliderRef.current);
90 if (!((_sliderRef$current = sliderRef.current) != null && _sliderRef$current.contains(doc.activeElement)) || Number(doc == null ? void 0 : (_doc$activeElement = doc.activeElement) == null ? void 0 : _doc$activeElement.getAttribute('data-index')) !== activeIndex) {
91 var _sliderRef$current2;
92 (_sliderRef$current2 = sliderRef.current) == null ? void 0 : _sliderRef$current2.querySelector("[type=\"range\"][data-index=\"".concat(activeIndex, "\"]")).focus();
93 }
94 if (setActive) {
95 setActive(activeIndex);
96 }
97}
98function areValuesEqual(newValue, oldValue) {
99 if (typeof newValue === 'number' && typeof oldValue === 'number') {
100 return newValue === oldValue;
101 }
102 if (_typeof(newValue) === 'object' && _typeof(oldValue) === 'object') {
103 return areArraysEqual(newValue, oldValue);
104 }
105 return false;
106}
107var axisProps = {
108 horizontal: {
109 offset: function offset(percent) {
110 return {
111 left: "".concat(percent, "%")
112 };
113 },
114 leap: function leap(percent) {
115 return {
116 width: "".concat(percent, "%")
117 };
118 }
119 },
120 'horizontal-reverse': {
121 offset: function offset(percent) {
122 return {
123 right: "".concat(percent, "%")
124 };
125 },
126 leap: function leap(percent) {
127 return {
128 width: "".concat(percent, "%")
129 };
130 }
131 },
132 vertical: {
133 offset: function offset(percent) {
134 return {
135 bottom: "".concat(percent, "%")
136 };
137 },
138 leap: function leap(percent) {
139 return {
140 height: "".concat(percent, "%")
141 };
142 }
143 }
144};
145export var Identity = function Identity(x) {
146 return x;
147};
148
149// TODO: remove support for Safari < 13.
150// https://caniuse.com/#search=touch-action
151//
152// Safari, on iOS, supports touch action since v13.
153// Over 80% of the iOS phones are compatible
154// in August 2020.
155// Utilizing the CSS.supports method to check if touch-action is supported.
156// Since CSS.supports is supported on all but Edge@12 and IE and touch-action
157// is supported on both Edge@12 and IE if CSS.supports is not available that means that
158// touch-action will be supported
159var cachedSupportsTouchActionNone;
160function doesSupportTouchActionNone() {
161 if (cachedSupportsTouchActionNone === undefined) {
162 if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
163 cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
164 } else {
165 cachedSupportsTouchActionNone = true;
166 }
167 }
168 return cachedSupportsTouchActionNone;
169}
170/**
171 *
172 * Demos:
173 *
174 * - [Slider](https://mui.com/base/react-slider/#hook)
175 *
176 * API:
177 *
178 * - [useSlider API](https://mui.com/base/react-slider/hooks-api/#use-slider)
179 */
180export default function useSlider(parameters) {
181 var ariaLabelledby = parameters['aria-labelledby'],
182 defaultValue = parameters.defaultValue,
183 _parameters$disabled = parameters.disabled,
184 disabled = _parameters$disabled === void 0 ? false : _parameters$disabled,
185 _parameters$disableSw = parameters.disableSwap,
186 disableSwap = _parameters$disableSw === void 0 ? false : _parameters$disableSw,
187 _parameters$isRtl = parameters.isRtl,
188 isRtl = _parameters$isRtl === void 0 ? false : _parameters$isRtl,
189 _parameters$marks = parameters.marks,
190 marksProp = _parameters$marks === void 0 ? false : _parameters$marks,
191 _parameters$max = parameters.max,
192 max = _parameters$max === void 0 ? 100 : _parameters$max,
193 _parameters$min = parameters.min,
194 min = _parameters$min === void 0 ? 0 : _parameters$min,
195 name = parameters.name,
196 onChange = parameters.onChange,
197 onChangeCommitted = parameters.onChangeCommitted,
198 _parameters$orientati = parameters.orientation,
199 orientation = _parameters$orientati === void 0 ? 'horizontal' : _parameters$orientati,
200 ref = parameters.rootRef,
201 _parameters$scale = parameters.scale,
202 scale = _parameters$scale === void 0 ? Identity : _parameters$scale,
203 _parameters$step = parameters.step,
204 step = _parameters$step === void 0 ? 1 : _parameters$step,
205 tabIndex = parameters.tabIndex,
206 valueProp = parameters.value;
207 var touchId = React.useRef();
208 // We can't use the :active browser pseudo-classes.
209 // - The active state isn't triggered when clicking on the rail.
210 // - The active state isn't transferred when inversing a range slider.
211 var _React$useState = React.useState(-1),
212 active = _React$useState[0],
213 setActive = _React$useState[1];
214 var _React$useState2 = React.useState(-1),
215 open = _React$useState2[0],
216 setOpen = _React$useState2[1];
217 var _React$useState3 = React.useState(false),
218 dragging = _React$useState3[0],
219 setDragging = _React$useState3[1];
220 var moveCount = React.useRef(0);
221 var _useControlled = useControlled({
222 controlled: valueProp,
223 default: defaultValue != null ? defaultValue : min,
224 name: 'Slider'
225 }),
226 _useControlled2 = _slicedToArray(_useControlled, 2),
227 valueDerived = _useControlled2[0],
228 setValueState = _useControlled2[1];
229 var handleChange = onChange && function (event, value, thumbIndex) {
230 // Redefine target to allow name and value to be read.
231 // This allows seamless integration with the most popular form libraries.
232 // https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
233 // Clone the event to not override `target` of the original event.
234 var nativeEvent = event.nativeEvent || event;
235 // @ts-ignore The nativeEvent is function, not object
236 var clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
237 Object.defineProperty(clonedEvent, 'target', {
238 writable: true,
239 value: {
240 value: value,
241 name: name
242 }
243 });
244 onChange(clonedEvent, value, thumbIndex);
245 };
246 var range = Array.isArray(valueDerived);
247 var values = range ? valueDerived.slice().sort(asc) : [valueDerived];
248 values = values.map(function (value) {
249 return clamp(value, min, max);
250 });
251 var marks = marksProp === true && step !== null ? _toConsumableArray(Array(Math.floor((max - min) / step) + 1)).map(function (_, index) {
252 return {
253 value: min + step * index
254 };
255 }) : marksProp || [];
256 var marksValues = marks.map(function (mark) {
257 return mark.value;
258 });
259 var _useIsFocusVisible = useIsFocusVisible(),
260 isFocusVisibleRef = _useIsFocusVisible.isFocusVisibleRef,
261 handleBlurVisible = _useIsFocusVisible.onBlur,
262 handleFocusVisible = _useIsFocusVisible.onFocus,
263 focusVisibleRef = _useIsFocusVisible.ref;
264 var _React$useState4 = React.useState(-1),
265 focusedThumbIndex = _React$useState4[0],
266 setFocusedThumbIndex = _React$useState4[1];
267 var sliderRef = React.useRef();
268 var handleFocusRef = useForkRef(focusVisibleRef, sliderRef);
269 var handleRef = useForkRef(ref, handleFocusRef);
270 var createHandleHiddenInputFocus = function createHandleHiddenInputFocus(otherHandlers) {
271 return function (event) {
272 var _otherHandlers$onFocu;
273 var index = Number(event.currentTarget.getAttribute('data-index'));
274 handleFocusVisible(event);
275 if (isFocusVisibleRef.current === true) {
276 setFocusedThumbIndex(index);
277 }
278 setOpen(index);
279 otherHandlers == null ? void 0 : (_otherHandlers$onFocu = otherHandlers.onFocus) == null ? void 0 : _otherHandlers$onFocu.call(otherHandlers, event);
280 };
281 };
282 var createHandleHiddenInputBlur = function createHandleHiddenInputBlur(otherHandlers) {
283 return function (event) {
284 var _otherHandlers$onBlur;
285 handleBlurVisible(event);
286 if (isFocusVisibleRef.current === false) {
287 setFocusedThumbIndex(-1);
288 }
289 setOpen(-1);
290 otherHandlers == null ? void 0 : (_otherHandlers$onBlur = otherHandlers.onBlur) == null ? void 0 : _otherHandlers$onBlur.call(otherHandlers, event);
291 };
292 };
293 useEnhancedEffect(function () {
294 if (disabled && sliderRef.current.contains(document.activeElement)) {
295 var _document$activeEleme;
296 // This is necessary because Firefox and Safari will keep focus
297 // on a disabled element:
298 // https://codesandbox.io/s/mui-pr-22247-forked-h151h?file=/src/App.js
299 // @ts-ignore
300 (_document$activeEleme = document.activeElement) == null ? void 0 : _document$activeEleme.blur();
301 }
302 }, [disabled]);
303 if (disabled && active !== -1) {
304 setActive(-1);
305 }
306 if (disabled && focusedThumbIndex !== -1) {
307 setFocusedThumbIndex(-1);
308 }
309 var createHandleHiddenInputChange = function createHandleHiddenInputChange(otherHandlers) {
310 return function (event) {
311 var _otherHandlers$onChan;
312 (_otherHandlers$onChan = otherHandlers.onChange) == null ? void 0 : _otherHandlers$onChan.call(otherHandlers, event);
313 var index = Number(event.currentTarget.getAttribute('data-index'));
314 var value = values[index];
315 var marksIndex = marksValues.indexOf(value);
316
317 // @ts-ignore
318 var newValue = event.target.valueAsNumber;
319 if (marks && step == null) {
320 newValue = newValue < value ? marksValues[marksIndex - 1] : marksValues[marksIndex + 1];
321 }
322 newValue = clamp(newValue, min, max);
323 if (marks && step == null) {
324 var currentMarkIndex = marksValues.indexOf(values[index]);
325 newValue = newValue < values[index] ? marksValues[currentMarkIndex - 1] : marksValues[currentMarkIndex + 1];
326 }
327 if (range) {
328 // Bound the new value to the thumb's neighbours.
329 if (disableSwap) {
330 newValue = clamp(newValue, values[index - 1] || -Infinity, values[index + 1] || Infinity);
331 }
332 var previousValue = newValue;
333 newValue = setValueIndex({
334 values: values,
335 newValue: newValue,
336 index: index
337 });
338 var activeIndex = index;
339
340 // Potentially swap the index if needed.
341 if (!disableSwap) {
342 activeIndex = newValue.indexOf(previousValue);
343 }
344 focusThumb({
345 sliderRef: sliderRef,
346 activeIndex: activeIndex
347 });
348 }
349 setValueState(newValue);
350 setFocusedThumbIndex(index);
351 if (handleChange && !areValuesEqual(newValue, valueDerived)) {
352 handleChange(event, newValue, index);
353 }
354 if (onChangeCommitted) {
355 onChangeCommitted(event, newValue);
356 }
357 };
358 };
359 var previousIndex = React.useRef();
360 var axis = orientation;
361 if (isRtl && orientation === 'horizontal') {
362 axis += '-reverse';
363 }
364 var getFingerNewValue = function getFingerNewValue(_ref4) {
365 var finger = _ref4.finger,
366 _ref4$move = _ref4.move,
367 move = _ref4$move === void 0 ? false : _ref4$move;
368 var slider = sliderRef.current;
369 var _getBoundingClientRec = slider.getBoundingClientRect(),
370 width = _getBoundingClientRec.width,
371 height = _getBoundingClientRec.height,
372 bottom = _getBoundingClientRec.bottom,
373 left = _getBoundingClientRec.left;
374 var percent;
375 if (axis.indexOf('vertical') === 0) {
376 percent = (bottom - finger.y) / height;
377 } else {
378 percent = (finger.x - left) / width;
379 }
380 if (axis.indexOf('-reverse') !== -1) {
381 percent = 1 - percent;
382 }
383 var newValue;
384 newValue = percentToValue(percent, min, max);
385 if (step) {
386 newValue = roundValueToStep(newValue, step, min);
387 } else {
388 var closestIndex = findClosest(marksValues, newValue);
389 newValue = marksValues[closestIndex];
390 }
391 newValue = clamp(newValue, min, max);
392 var activeIndex = 0;
393 if (range) {
394 if (!move) {
395 activeIndex = findClosest(values, newValue);
396 } else {
397 activeIndex = previousIndex.current;
398 }
399
400 // Bound the new value to the thumb's neighbours.
401 if (disableSwap) {
402 newValue = clamp(newValue, values[activeIndex - 1] || -Infinity, values[activeIndex + 1] || Infinity);
403 }
404 var previousValue = newValue;
405 newValue = setValueIndex({
406 values: values,
407 newValue: newValue,
408 index: activeIndex
409 });
410
411 // Potentially swap the index if needed.
412 if (!(disableSwap && move)) {
413 activeIndex = newValue.indexOf(previousValue);
414 previousIndex.current = activeIndex;
415 }
416 }
417 return {
418 newValue: newValue,
419 activeIndex: activeIndex
420 };
421 };
422 var handleTouchMove = useEventCallback(function (nativeEvent) {
423 var finger = trackFinger(nativeEvent, touchId);
424 if (!finger) {
425 return;
426 }
427 moveCount.current += 1;
428
429 // Cancel move in case some other element consumed a mouseup event and it was not fired.
430 // @ts-ignore buttons doesn't not exists on touch event
431 if (nativeEvent.type === 'mousemove' && nativeEvent.buttons === 0) {
432 // eslint-disable-next-line @typescript-eslint/no-use-before-define
433 handleTouchEnd(nativeEvent);
434 return;
435 }
436 var _getFingerNewValue = getFingerNewValue({
437 finger: finger,
438 move: true
439 }),
440 newValue = _getFingerNewValue.newValue,
441 activeIndex = _getFingerNewValue.activeIndex;
442 focusThumb({
443 sliderRef: sliderRef,
444 activeIndex: activeIndex,
445 setActive: setActive
446 });
447 setValueState(newValue);
448 if (!dragging && moveCount.current > INTENTIONAL_DRAG_COUNT_THRESHOLD) {
449 setDragging(true);
450 }
451 if (handleChange && !areValuesEqual(newValue, valueDerived)) {
452 handleChange(nativeEvent, newValue, activeIndex);
453 }
454 });
455 var handleTouchEnd = useEventCallback(function (nativeEvent) {
456 var finger = trackFinger(nativeEvent, touchId);
457 setDragging(false);
458 if (!finger) {
459 return;
460 }
461 var _getFingerNewValue2 = getFingerNewValue({
462 finger: finger,
463 move: true
464 }),
465 newValue = _getFingerNewValue2.newValue;
466 setActive(-1);
467 if (nativeEvent.type === 'touchend') {
468 setOpen(-1);
469 }
470 if (onChangeCommitted) {
471 onChangeCommitted(nativeEvent, newValue);
472 }
473 touchId.current = undefined;
474
475 // eslint-disable-next-line @typescript-eslint/no-use-before-define
476 stopListening();
477 });
478 var handleTouchStart = useEventCallback(function (nativeEvent) {
479 if (disabled) {
480 return;
481 }
482 // If touch-action: none; is not supported we need to prevent the scroll manually.
483 if (!doesSupportTouchActionNone()) {
484 nativeEvent.preventDefault();
485 }
486 var touch = nativeEvent.changedTouches[0];
487 if (touch != null) {
488 // A number that uniquely identifies the current finger in the touch session.
489 touchId.current = touch.identifier;
490 }
491 var finger = trackFinger(nativeEvent, touchId);
492 if (finger !== false) {
493 var _getFingerNewValue3 = getFingerNewValue({
494 finger: finger
495 }),
496 newValue = _getFingerNewValue3.newValue,
497 activeIndex = _getFingerNewValue3.activeIndex;
498 focusThumb({
499 sliderRef: sliderRef,
500 activeIndex: activeIndex,
501 setActive: setActive
502 });
503 setValueState(newValue);
504 if (handleChange && !areValuesEqual(newValue, valueDerived)) {
505 handleChange(nativeEvent, newValue, activeIndex);
506 }
507 }
508 moveCount.current = 0;
509 var doc = ownerDocument(sliderRef.current);
510 doc.addEventListener('touchmove', handleTouchMove);
511 doc.addEventListener('touchend', handleTouchEnd);
512 });
513 var stopListening = React.useCallback(function () {
514 var doc = ownerDocument(sliderRef.current);
515 doc.removeEventListener('mousemove', handleTouchMove);
516 doc.removeEventListener('mouseup', handleTouchEnd);
517 doc.removeEventListener('touchmove', handleTouchMove);
518 doc.removeEventListener('touchend', handleTouchEnd);
519 }, [handleTouchEnd, handleTouchMove]);
520 React.useEffect(function () {
521 var slider = sliderRef.current;
522 slider.addEventListener('touchstart', handleTouchStart, {
523 passive: doesSupportTouchActionNone()
524 });
525 return function () {
526 // @ts-ignore
527 slider.removeEventListener('touchstart', handleTouchStart, {
528 passive: doesSupportTouchActionNone()
529 });
530 stopListening();
531 };
532 }, [stopListening, handleTouchStart]);
533 React.useEffect(function () {
534 if (disabled) {
535 stopListening();
536 }
537 }, [disabled, stopListening]);
538 var createHandleMouseDown = function createHandleMouseDown(otherHandlers) {
539 return function (event) {
540 var _otherHandlers$onMous;
541 (_otherHandlers$onMous = otherHandlers.onMouseDown) == null ? void 0 : _otherHandlers$onMous.call(otherHandlers, event);
542 if (disabled) {
543 return;
544 }
545 if (event.defaultPrevented) {
546 return;
547 }
548
549 // Only handle left clicks
550 if (event.button !== 0) {
551 return;
552 }
553
554 // Avoid text selection
555 event.preventDefault();
556 var finger = trackFinger(event, touchId);
557 if (finger !== false) {
558 var _getFingerNewValue4 = getFingerNewValue({
559 finger: finger
560 }),
561 newValue = _getFingerNewValue4.newValue,
562 activeIndex = _getFingerNewValue4.activeIndex;
563 focusThumb({
564 sliderRef: sliderRef,
565 activeIndex: activeIndex,
566 setActive: setActive
567 });
568 setValueState(newValue);
569 if (handleChange && !areValuesEqual(newValue, valueDerived)) {
570 handleChange(event, newValue, activeIndex);
571 }
572 }
573 moveCount.current = 0;
574 var doc = ownerDocument(sliderRef.current);
575 doc.addEventListener('mousemove', handleTouchMove);
576 doc.addEventListener('mouseup', handleTouchEnd);
577 };
578 };
579 var trackOffset = valueToPercent(range ? values[0] : min, min, max);
580 var trackLeap = valueToPercent(values[values.length - 1], min, max) - trackOffset;
581 var getRootProps = function getRootProps() {
582 var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
583 var ownEventHandlers = {
584 onMouseDown: createHandleMouseDown(otherHandlers || {})
585 };
586 var mergedEventHandlers = _extends({}, otherHandlers, ownEventHandlers);
587 return _extends({
588 ref: handleRef
589 }, mergedEventHandlers);
590 };
591 var createHandleMouseOver = function createHandleMouseOver(otherHandlers) {
592 return function (event) {
593 var _otherHandlers$onMous2;
594 (_otherHandlers$onMous2 = otherHandlers.onMouseOver) == null ? void 0 : _otherHandlers$onMous2.call(otherHandlers, event);
595 var index = Number(event.currentTarget.getAttribute('data-index'));
596 setOpen(index);
597 };
598 };
599 var createHandleMouseLeave = function createHandleMouseLeave(otherHandlers) {
600 return function (event) {
601 var _otherHandlers$onMous3;
602 (_otherHandlers$onMous3 = otherHandlers.onMouseLeave) == null ? void 0 : _otherHandlers$onMous3.call(otherHandlers, event);
603 setOpen(-1);
604 };
605 };
606 var getThumbProps = function getThumbProps() {
607 var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
608 var ownEventHandlers = {
609 onMouseOver: createHandleMouseOver(otherHandlers || {}),
610 onMouseLeave: createHandleMouseLeave(otherHandlers || {})
611 };
612 return _extends({}, otherHandlers, ownEventHandlers);
613 };
614 var getHiddenInputProps = function getHiddenInputProps() {
615 var _parameters$step2;
616 var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
617 var ownEventHandlers = {
618 onChange: createHandleHiddenInputChange(otherHandlers || {}),
619 onFocus: createHandleHiddenInputFocus(otherHandlers || {}),
620 onBlur: createHandleHiddenInputBlur(otherHandlers || {})
621 };
622 var mergedEventHandlers = _extends({}, otherHandlers, ownEventHandlers);
623 return _extends({
624 tabIndex: tabIndex,
625 'aria-labelledby': ariaLabelledby,
626 'aria-orientation': orientation,
627 'aria-valuemax': scale(max),
628 'aria-valuemin': scale(min),
629 name: name,
630 type: 'range',
631 min: parameters.min,
632 max: parameters.max,
633 step: (_parameters$step2 = parameters.step) != null ? _parameters$step2 : undefined,
634 disabled: disabled
635 }, mergedEventHandlers, {
636 style: _extends({}, visuallyHidden, {
637 direction: isRtl ? 'rtl' : 'ltr',
638 // So that VoiceOver's focus indicator matches the thumb's dimensions
639 width: '100%',
640 height: '100%'
641 })
642 });
643 };
644 return {
645 active: active,
646 axis: axis,
647 axisProps: axisProps,
648 dragging: dragging,
649 focusedThumbIndex: focusedThumbIndex,
650 getHiddenInputProps: getHiddenInputProps,
651 getRootProps: getRootProps,
652 getThumbProps: getThumbProps,
653 marks: marks,
654 open: open,
655 range: range,
656 rootRef: handleRef,
657 trackLeap: trackLeap,
658 trackOffset: trackOffset,
659 values: values
660 };
661}
\No newline at end of file