UNPKG

react-slider

Version:
1 lines 76.1 kB
{"version":3,"file":"ReactSlider.mjs","sources":["../../../../../src/components/ReactSlider/ReactSlider.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\n/**\n * To prevent text selection while dragging.\n * http://stackoverflow.com/questions/5429827/how-can-i-prevent-text-element-selection-with-cursor-drag\n */\nfunction pauseEvent(e) {\n if (e && e.stopPropagation) {\n e.stopPropagation();\n }\n if (e && e.preventDefault) {\n e.preventDefault();\n }\n return false;\n}\n\nfunction stopPropagation(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n}\n\nfunction sanitizeInValue(x) {\n if (x == null) {\n return [];\n }\n return Array.isArray(x) ? x.slice() : [x];\n}\n\nfunction prepareOutValue(x) {\n return x !== null && x.length === 1 ? x[0] : x.slice();\n}\n\nfunction trimSucceeding(length, nextValue, minDistance, max) {\n for (let i = 0; i < length; i += 1) {\n const padding = max - i * minDistance;\n if (nextValue[length - 1 - i] > padding) {\n // eslint-disable-next-line no-param-reassign\n nextValue[length - 1 - i] = padding;\n }\n }\n}\n\nfunction trimPreceding(length, nextValue, minDistance, min) {\n for (let i = 0; i < length; i += 1) {\n const padding = min + i * minDistance;\n if (nextValue[i] < padding) {\n // eslint-disable-next-line no-param-reassign\n nextValue[i] = padding;\n }\n }\n}\n\nfunction addHandlers(eventMap) {\n Object.keys(eventMap).forEach(key => {\n if (typeof document !== 'undefined') {\n document.addEventListener(key, eventMap[key], false);\n }\n });\n}\n\nfunction removeHandlers(eventMap) {\n Object.keys(eventMap).forEach(key => {\n if (typeof document !== 'undefined') {\n document.removeEventListener(key, eventMap[key], false);\n }\n });\n}\n\nfunction trimAlignValue(val, props) {\n return alignValue(trimValue(val, props), props);\n}\n\nfunction alignValue(val, props) {\n const valModStep = (val - props.min) % props.step;\n let alignedValue = val - valModStep;\n\n if (Math.abs(valModStep) * 2 >= props.step) {\n alignedValue += valModStep > 0 ? props.step : -props.step;\n }\n\n return parseFloat(alignedValue.toFixed(5));\n}\n\nfunction trimValue(val, props) {\n let trimmed = val;\n if (trimmed <= props.min) {\n trimmed = props.min;\n }\n if (trimmed >= props.max) {\n trimmed = props.max;\n }\n\n return trimmed;\n}\n\nclass ReactSlider extends React.Component {\n static displayName = 'ReactSlider';\n\n static propTypes = {\n /**\n * The minimum value of the slider.\n */\n min: PropTypes.number,\n\n /**\n * The maximum value of the slider.\n */\n max: PropTypes.number,\n\n /**\n * Value to be added or subtracted on each step the slider makes.\n * Must be greater than zero.\n * `max - min` should be evenly divisible by the step value.\n */\n step: PropTypes.number,\n\n /**\n * The result of the function is the value to be added or subtracted\n * when the `Page Up` or `Page Down` keys are pressed.\n *\n * The current `step` value will be passed as the only argument.\n * By default, paging will modify `step` by a factor of 10.\n */\n pageFn: PropTypes.func,\n\n /**\n * The minimal distance between any pair of thumbs.\n * Must be positive, but zero means they can sit on top of each other.\n */\n minDistance: PropTypes.number,\n\n /**\n * Determines the initial positions of the thumbs and the number of thumbs.\n *\n * If a number is passed a slider with one thumb will be rendered.\n * If an array is passed each value will determine the position of one thumb.\n * The values in the array must be sorted.\n */\n defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),\n\n /**\n * Like `defaultValue` but for\n * [controlled components](http://facebook.github.io/react/docs/forms.html#controlled-components).\n */\n // eslint-disable-next-line zillow/react/require-default-props\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),\n\n /**\n * Determines whether the slider moves horizontally (from left to right)\n * or vertically (from top to bottom).\n */\n orientation: PropTypes.oneOf(['horizontal', 'vertical']),\n\n /**\n * The css class set on the slider node.\n */\n className: PropTypes.string,\n\n /**\n * The css class set on each thumb node.\n *\n * In addition each thumb will receive a numbered css class of the form\n * `${thumbClassName}-${i}`, e.g. `thumb-0`, `thumb-1`, ...\n */\n thumbClassName: PropTypes.string,\n\n /**\n * The css class set on the thumb that is currently being moved.\n */\n thumbActiveClassName: PropTypes.string,\n\n /**\n * If `true` tracks between the thumbs will be rendered.\n */\n withTracks: PropTypes.bool,\n\n /**\n * The css class set on the tracks between the thumbs.\n * In addition track fragment will receive a numbered css class of the form\n * `${trackClassName}-${i}`, e.g. `track-0`, `track-1`, ...\n */\n trackClassName: PropTypes.string,\n\n /**\n * If `true` the active thumb will push other thumbs\n * within the constraints of `min`, `max`, `step` and `minDistance`.\n */\n pearling: PropTypes.bool,\n\n /**\n * If `true` the thumbs can't be moved.\n */\n disabled: PropTypes.bool,\n\n /**\n * Disables thumb move when clicking the slider track\n */\n snapDragDisabled: PropTypes.bool,\n\n /**\n * Inverts the slider.\n */\n invert: PropTypes.bool,\n\n /**\n * Shows passed marks on the track, if true it shows all the marks,\n * if an array of numbers it shows just the passed marks, if a number is passed\n * it shows just the marks in that steps: like passing 3 shows the marks 3, 6, 9\n */\n marks: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.number),\n PropTypes.bool,\n PropTypes.number,\n ]),\n\n /**\n * The css class set on the marks.\n */\n markClassName: PropTypes.string,\n\n /**\n * Callback called before starting to move a thumb. The callback will only be called if the\n * action will result in a change. The function will be called with two arguments, the first\n * being the initial value(s) the second being thumb index.\n */\n // eslint-disable-next-line max-len\n // eslint-disable-next-line zillow/react/require-default-props, zillow/react/no-unused-prop-types\n onBeforeChange: PropTypes.func,\n\n /**\n * Callback called on every value change.\n * The function will be called with two arguments, the first being the new value(s)\n * the second being thumb index.\n */\n // eslint-disable-next-line max-len\n // eslint-disable-next-line zillow/react/require-default-props, zillow/react/no-unused-prop-types\n onChange: PropTypes.func,\n\n /**\n * Callback called only after moving a thumb has ended. The callback will only be called if\n * the action resulted in a change. The function will be called with two arguments, the\n * first being the result value(s) the second being thumb index.\n */\n // eslint-disable-next-line max-len\n // eslint-disable-next-line zillow/react/require-default-props, zillow/react/no-unused-prop-types\n onAfterChange: PropTypes.func,\n\n /**\n * Callback called when the the slider is clicked (thumb or tracks).\n * Receives the value at the clicked position as argument.\n */\n // eslint-disable-next-line zillow/react/require-default-props\n onSliderClick: PropTypes.func,\n\n /**\n * aria-label for screen-readers to apply to the thumbs.\n * Use an array for more than one thumb.\n * The length of the array must match the number of thumbs in the value array.\n */\n // eslint-disable-next-line zillow/react/require-default-props\n ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),\n\n /**\n * aria-labelledby for screen-readers to apply to the thumbs.\n * Used when slider rendered with separate label.\n * Use an array for more than one thumb.\n * The length of the array must match the number of thumbs in the value array.\n */\n // eslint-disable-next-line zillow/react/require-default-props\n ariaLabelledby: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n ]),\n\n /**\n * aria-valuetext for screen-readers.\n * Can be a static string, or a function that returns a string.\n * The function will be passed a single argument,\n * an object with the following properties:\n *\n * state => `Value: ${state.value}`\n *\n * - `state.index` {`number`} the index of the thumb\n * - `state.value` {`number` | `array`} the current value state\n * - `state.valueNow` {`number`} the value of the thumb (i.e. aria-valuenow)\n */\n // eslint-disable-next-line zillow/react/require-default-props\n ariaValuetext: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n\n /**\n * Provide a custom render function for the track node.\n * The render function will be passed two arguments,\n * an object with props that should be added to your handle node,\n * and an object with track and slider state:\n *\n * (props, state) => <div {...props} />\n *\n * - `props` {`object`} props to be spread into your track node\n * - `state.index` {`number`} the index of the track\n * - `state.value` {`number` | `array`} the current value state\n */\n renderTrack: PropTypes.func,\n\n /**\n * Provide a custom render function for dynamic thumb content.\n * The render function will be passed two arguments,\n * an object with props that should be added to your thumb node,\n * and an object with thumb and slider state:\n *\n * (props, state) => <div {...props} />\n *\n * - `props` {`object`} props to be spread into your thumb node\n * - `state.index` {`number`} the index of the thumb\n * - `state.value` {`number` | `array`} the current value state\n * - `state.valueNow` {`number`} the value of the thumb (i.e. aria-valuenow)\n */\n // eslint-disable-next-line zillow/react/require-default-props\n renderThumb: PropTypes.func,\n\n /**\n * Provide a custom render function for the mark node.\n * The render function will be passed one argument,\n * an object with props that should be added to your handle node\n *\n * (props) => <span {...props} />\n *\n * - `props` {`object`} props to be spread into your track node\n */\n renderMark: PropTypes.func,\n };\n\n static defaultProps = {\n min: 0,\n max: 100,\n step: 1,\n pageFn: step => step * 10,\n minDistance: 0,\n defaultValue: 0,\n orientation: 'horizontal',\n className: 'slider',\n thumbClassName: 'thumb',\n thumbActiveClassName: 'active',\n trackClassName: 'track',\n markClassName: 'mark',\n withTracks: true,\n pearling: false,\n disabled: false,\n snapDragDisabled: false,\n invert: false,\n marks: [],\n renderThumb: props => <div {...props} />,\n renderTrack: props => <div {...props} />,\n renderMark: props => <span {...props} />,\n };\n\n constructor(props) {\n super(props);\n\n let value = sanitizeInValue(props.value);\n if (!value.length) {\n value = sanitizeInValue(props.defaultValue);\n }\n\n // array for storing resize timeouts ids\n this.pendingResizeTimeouts = [];\n\n const zIndices = [];\n for (let i = 0; i < value.length; i += 1) {\n value[i] = trimAlignValue(value[i], props);\n zIndices.push(i);\n }\n\n this.resizeObserver = null;\n this.resizeElementRef = React.createRef();\n\n this.state = {\n index: -1,\n upperBound: 0,\n sliderLength: 0,\n value,\n zIndices,\n };\n }\n\n componentDidMount() {\n if (typeof window !== 'undefined') {\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(this.resizeElementRef.current);\n this.resize();\n }\n }\n\n // Keep the internal `value` consistent with an outside `value` if present.\n // This basically allows the slider to be a controlled component.\n static getDerivedStateFromProps(props, state) {\n const value = sanitizeInValue(props.value);\n if (!value.length) {\n return null;\n }\n\n // Do not allow controlled upates to happen while we have pending updates\n if (state.pending) {\n return null;\n }\n\n return {\n value: value.map(item => trimAlignValue(item, props)),\n };\n }\n\n componentDidUpdate() {\n // If an upperBound has not yet been determined (due to the component being hidden\n // during the mount event, or during the last resize), then calculate it now\n if (this.state.upperBound === 0) {\n this.resize();\n }\n }\n\n componentWillUnmount() {\n this.clearPendingResizeTimeouts();\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n onKeyUp = () => {\n this.onEnd();\n };\n\n onMouseUp = () => {\n this.onEnd(this.getMouseEventMap());\n };\n\n onTouchEnd = e => {\n e.preventDefault();\n this.onEnd(this.getTouchEventMap());\n };\n\n onBlur = () => {\n this.setState({ index: -1 }, this.onEnd(this.getKeyDownEventMap()));\n };\n\n onEnd(eventMap) {\n if (eventMap) {\n removeHandlers(eventMap);\n }\n if (this.hasMoved) {\n this.fireChangeEvent('onAfterChange');\n }\n\n // Allow controlled updates to continue\n this.setState({ pending: false });\n\n this.hasMoved = false;\n }\n\n onMouseMove = e => {\n // Prevent controlled updates from happening while mouse is moving\n this.setState({ pending: true });\n\n const position = this.getMousePosition(e);\n const diffPosition = this.getDiffPosition(position[0]);\n const newValue = this.getValueFromPosition(diffPosition);\n this.move(newValue);\n };\n\n onTouchMove = e => {\n if (e.touches.length > 1) {\n return;\n }\n\n // Prevent controlled updates from happending while touch is moving\n this.setState({ pending: true });\n\n const position = this.getTouchPosition(e);\n\n if (typeof this.isScrolling === 'undefined') {\n const diffMainDir = position[0] - this.startPosition[0];\n const diffScrollDir = position[1] - this.startPosition[1];\n this.isScrolling = Math.abs(diffScrollDir) > Math.abs(diffMainDir);\n }\n\n if (this.isScrolling) {\n this.setState({ index: -1 });\n return;\n }\n\n const diffPosition = this.getDiffPosition(position[0]);\n const newValue = this.getValueFromPosition(diffPosition);\n\n this.move(newValue);\n };\n\n onKeyDown = e => {\n if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) {\n return;\n }\n\n // Prevent controlled updates from happening while a key is pressed\n this.setState({ pending: true });\n\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n case 'Left':\n case 'Down':\n e.preventDefault();\n this.moveDownByStep();\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n case 'Right':\n case 'Up':\n e.preventDefault();\n this.moveUpByStep();\n break;\n case 'Home':\n e.preventDefault();\n this.move(this.props.min);\n break;\n case 'End':\n e.preventDefault();\n this.move(this.props.max);\n break;\n case 'PageDown':\n e.preventDefault();\n this.moveDownByStep(this.props.pageFn(this.props.step));\n break;\n case 'PageUp':\n e.preventDefault();\n this.moveUpByStep(this.props.pageFn(this.props.step));\n break;\n default:\n }\n };\n\n onSliderMouseDown = e => {\n // do nothing if disabled or right click\n if (this.props.disabled || e.button === 2) {\n return;\n }\n\n // Prevent controlled updates from happening while mouse is moving\n this.setState({ pending: true });\n\n if (!this.props.snapDragDisabled) {\n const position = this.getMousePosition(e);\n this.forceValueFromPosition(position[0], i => {\n this.start(i, position[0]);\n addHandlers(this.getMouseEventMap());\n });\n }\n\n pauseEvent(e);\n };\n\n onSliderClick = e => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.props.onSliderClick && !this.hasMoved) {\n const position = this.getMousePosition(e);\n const valueAtPos = trimAlignValue(\n this.calcValue(this.calcOffsetFromPosition(position[0])),\n this.props\n );\n this.props.onSliderClick(valueAtPos);\n }\n };\n\n getValue() {\n return prepareOutValue(this.state.value);\n }\n\n getClosestIndex(pixelOffset) {\n let minDist = Number.MAX_VALUE;\n let closestIndex = -1;\n\n const { value } = this.state;\n const l = value.length;\n\n for (let i = 0; i < l; i += 1) {\n const offset = this.calcOffset(value[i]);\n const dist = Math.abs(pixelOffset - offset);\n if (dist < minDist) {\n minDist = dist;\n closestIndex = i;\n }\n }\n\n return closestIndex;\n }\n\n getMousePosition(e) {\n return [e[`page${this.axisKey()}`], e[`page${this.orthogonalAxisKey()}`]];\n }\n\n getTouchPosition(e) {\n const touch = e.touches[0];\n return [touch[`page${this.axisKey()}`], touch[`page${this.orthogonalAxisKey()}`]];\n }\n\n getKeyDownEventMap() {\n return {\n keydown: this.onKeyDown,\n keyup: this.onKeyUp,\n focusout: this.onBlur,\n };\n }\n\n getMouseEventMap() {\n return {\n mousemove: this.onMouseMove,\n mouseup: this.onMouseUp,\n };\n }\n\n getTouchEventMap() {\n return {\n touchmove: this.onTouchMove,\n touchend: this.onTouchEnd,\n };\n }\n\n getValueFromPosition(position) {\n const diffValue =\n (position / (this.state.sliderLength - this.state.thumbSize)) *\n (this.props.max - this.props.min);\n return trimAlignValue(this.state.startValue + diffValue, this.props);\n }\n\n getDiffPosition(position) {\n let diffPosition = position - this.state.startPosition;\n if (this.props.invert) {\n diffPosition *= -1;\n }\n return diffPosition;\n }\n\n // create the `keydown` handler for the i-th thumb\n createOnKeyDown = i => e => {\n if (this.props.disabled) {\n return;\n }\n this.start(i);\n addHandlers(this.getKeyDownEventMap());\n pauseEvent(e);\n };\n\n // create the `mousedown` handler for the i-th thumb\n createOnMouseDown = i => e => {\n // do nothing if disabled or right click\n if (this.props.disabled || e.button === 2) {\n return;\n }\n\n // Prevent controlled updates from happending while mouse is moving\n this.setState({ pending: true });\n\n const position = this.getMousePosition(e);\n this.start(i, position[0]);\n addHandlers(this.getMouseEventMap());\n pauseEvent(e);\n };\n\n // create the `touchstart` handler for the i-th thumb\n createOnTouchStart = i => e => {\n if (this.props.disabled || e.touches.length > 1) {\n return;\n }\n\n // Prevent controlled updates from happending while touch is moving\n this.setState({ pending: true });\n\n const position = this.getTouchPosition(e);\n this.startPosition = position;\n // don't know yet if the user is trying to scroll\n this.isScrolling = undefined;\n this.start(i, position[0]);\n addHandlers(this.getTouchEventMap());\n stopPropagation(e);\n };\n\n handleResize = () => {\n // setTimeout of 0 gives element enough time to have assumed its new size if\n // it is being resized\n const resizeTimeout = window.setTimeout(() => {\n // drop this timeout from pendingResizeTimeouts to reduce memory usage\n this.pendingResizeTimeouts.shift();\n this.resize();\n }, 0);\n\n this.pendingResizeTimeouts.push(resizeTimeout);\n };\n\n resize() {\n const { slider, thumb0: thumb } = this;\n if (!slider || !thumb) {\n return;\n }\n\n const sizeKey = this.sizeKey();\n\n // For the slider size, we want to use the client width/height, excluding any borders\n const sliderRect = slider.getBoundingClientRect();\n const sliderSize = slider[sizeKey];\n const sliderMax = sliderRect[this.posMaxKey()];\n const sliderMin = sliderRect[this.posMinKey()];\n\n // For the thumb size, we want to use the outer width/height, including any borders\n const thumbRect = thumb.getBoundingClientRect();\n const thumbSize = thumbRect[sizeKey.replace('client', '').toLowerCase()];\n\n const upperBound = sliderSize - thumbSize;\n const sliderLength = Math.abs(sliderMax - sliderMin);\n\n if (\n this.state.upperBound !== upperBound ||\n this.state.sliderLength !== sliderLength ||\n this.state.thumbSize !== thumbSize\n ) {\n this.setState({\n upperBound,\n sliderLength,\n thumbSize,\n });\n }\n }\n\n // calculates the offset of a thumb in pixels based on its value.\n calcOffset(value) {\n const range = this.props.max - this.props.min;\n if (range === 0) {\n return 0;\n }\n const ratio = (value - this.props.min) / range;\n return ratio * this.state.upperBound;\n }\n\n // calculates the value corresponding to a given pixel offset, i.e. the inverse of `calcOffset`.\n calcValue(offset) {\n const ratio = offset / this.state.upperBound;\n return ratio * (this.props.max - this.props.min) + this.props.min;\n }\n\n calcOffsetFromPosition(position) {\n const { slider } = this;\n\n const sliderRect = slider.getBoundingClientRect();\n const sliderMax = sliderRect[this.posMaxKey()];\n const sliderMin = sliderRect[this.posMinKey()];\n\n // The `position` value passed in is the mouse position based on the window height.\n // The slider bounding rect is based on the viewport, so we must add the window scroll\n // offset to normalize the values.\n const windowOffset = window[`page${this.axisKey()}Offset`];\n const sliderStart = windowOffset + (this.props.invert ? sliderMax : sliderMin);\n\n let pixelOffset = position - sliderStart;\n if (this.props.invert) {\n pixelOffset = this.state.sliderLength - pixelOffset;\n }\n pixelOffset -= this.state.thumbSize / 2;\n return pixelOffset;\n }\n\n // Snaps the nearest thumb to the value corresponding to `position`\n // and calls `callback` with that thumb's index.\n forceValueFromPosition(position, callback) {\n const pixelOffset = this.calcOffsetFromPosition(position);\n const closestIndex = this.getClosestIndex(pixelOffset);\n const nextValue = trimAlignValue(this.calcValue(pixelOffset), this.props);\n\n // Clone this.state.value since we'll modify it temporarily\n // eslint-disable-next-line zillow/react/no-access-state-in-setstate\n const value = this.state.value.slice();\n value[closestIndex] = nextValue;\n\n // Prevents the slider from shrinking below `props.minDistance`\n for (let i = 0; i < value.length - 1; i += 1) {\n if (value[i + 1] - value[i] < this.props.minDistance) {\n return;\n }\n }\n\n this.fireChangeEvent('onBeforeChange');\n this.hasMoved = true;\n this.setState({ value }, () => {\n callback(closestIndex);\n this.fireChangeEvent('onChange');\n });\n }\n\n // clear all pending timeouts to avoid error messages after unmounting\n clearPendingResizeTimeouts() {\n do {\n const nextTimeout = this.pendingResizeTimeouts.shift();\n\n clearTimeout(nextTimeout);\n } while (this.pendingResizeTimeouts.length);\n }\n\n start(i, position) {\n const thumbRef = this[`thumb${i}`];\n if (thumbRef) {\n thumbRef.focus();\n }\n\n const { zIndices } = this.state;\n // remove wherever the element is\n zIndices.splice(zIndices.indexOf(i), 1);\n // add to end\n zIndices.push(i);\n\n this.setState(prevState => ({\n startValue: prevState.value[i],\n startPosition: position !== undefined ? position : prevState.startPosition,\n index: i,\n zIndices,\n }));\n }\n\n moveUpByStep(step = this.props.step) {\n const oldValue = this.state.value[this.state.index];\n\n // if the slider is inverted and horizontal we want to honor the inverted value\n const newValue =\n this.props.invert && this.props.orientation === 'horizontal'\n ? oldValue - step\n : oldValue + step;\n\n const trimAlign = trimAlignValue(newValue, this.props);\n this.move(Math.min(trimAlign, this.props.max));\n }\n\n moveDownByStep(step = this.props.step) {\n const oldValue = this.state.value[this.state.index];\n\n // if the slider is inverted and horizontal we want to honor the inverted value\n const newValue =\n this.props.invert && this.props.orientation === 'horizontal'\n ? oldValue + step\n : oldValue - step;\n\n const trimAlign = trimAlignValue(newValue, this.props);\n this.move(Math.max(trimAlign, this.props.min));\n }\n\n move(newValue) {\n // Clone this.state.value since we'll modify it temporarily\n // eslint-disable-next-line zillow/react/no-access-state-in-setstate\n const value = this.state.value.slice();\n const { index } = this.state;\n const { length } = value;\n\n // Short circuit if the value is not changing\n const oldValue = value[index];\n if (newValue === oldValue) {\n return;\n }\n\n // Trigger only before the first movement\n if (!this.hasMoved) {\n this.fireChangeEvent('onBeforeChange');\n }\n this.hasMoved = true;\n\n // if \"pearling\" (= thumbs pushing each other) is disabled,\n // prevent the thumb from getting closer than `minDistance` to the previous or next thumb.\n const { pearling, max, min, minDistance } = this.props;\n if (!pearling) {\n if (index > 0) {\n const valueBefore = value[index - 1];\n if (newValue < valueBefore + minDistance) {\n // eslint-disable-next-line no-param-reassign\n newValue = valueBefore + minDistance;\n }\n }\n\n if (index < length - 1) {\n const valueAfter = value[index + 1];\n if (newValue > valueAfter - minDistance) {\n // eslint-disable-next-line no-param-reassign\n newValue = valueAfter - minDistance;\n }\n }\n }\n\n value[index] = newValue;\n\n // if \"pearling\" is enabled, let the current thumb push the pre- and succeeding thumbs.\n if (pearling && length > 1) {\n if (newValue > oldValue) {\n this.pushSucceeding(value, minDistance, index);\n trimSucceeding(length, value, minDistance, max);\n } else if (newValue < oldValue) {\n this.pushPreceding(value, minDistance, index);\n trimPreceding(length, value, minDistance, min);\n }\n }\n\n // Normally you would use `shouldComponentUpdate`,\n // but since the slider is a low-level component,\n // the extra complexity might be worth the extra performance.\n this.setState({ value }, this.fireChangeEvent.bind(this, 'onChange'));\n }\n\n pushSucceeding(value, minDistance, index) {\n let i;\n let padding;\n for (\n i = index, padding = value[i] + minDistance;\n value[i + 1] !== null && padding > value[i + 1];\n i += 1, padding = value[i] + minDistance\n ) {\n // eslint-disable-next-line no-param-reassign\n value[i + 1] = alignValue(padding, this.props);\n }\n }\n\n pushPreceding(value, minDistance, index) {\n for (\n let i = index, padding = value[i] - minDistance;\n value[i - 1] !== null && padding < value[i - 1];\n i -= 1, padding = value[i] - minDistance\n ) {\n // eslint-disable-next-line no-param-reassign\n value[i - 1] = alignValue(padding, this.props);\n }\n }\n\n axisKey() {\n if (this.props.orientation === 'vertical') {\n return 'Y';\n }\n // Defaults to 'horizontal';\n return 'X';\n }\n\n orthogonalAxisKey() {\n if (this.props.orientation === 'vertical') {\n return 'X';\n }\n // Defaults to 'horizontal'\n return 'Y';\n }\n\n posMinKey() {\n if (this.props.orientation === 'vertical') {\n return this.props.invert ? 'bottom' : 'top';\n }\n // Defaults to 'horizontal'\n return this.props.invert ? 'right' : 'left';\n }\n\n posMaxKey() {\n if (this.props.orientation === 'vertical') {\n return this.props.invert ? 'top' : 'bottom';\n }\n // Defaults to 'horizontal'\n return this.props.invert ? 'left' : 'right';\n }\n\n sizeKey() {\n if (this.props.orientation === 'vertical') {\n return 'clientHeight';\n }\n // Defaults to 'horizontal'\n return 'clientWidth';\n }\n\n fireChangeEvent(event) {\n if (this.props[event]) {\n this.props[event](prepareOutValue(this.state.value), this.state.index);\n }\n }\n\n buildThumbStyle(offset, i) {\n const style = {\n position: 'absolute',\n touchAction: 'none',\n willChange: this.state.index >= 0 ? this.posMinKey() : undefined,\n zIndex: this.state.zIndices.indexOf(i) + 1,\n };\n style[this.posMinKey()] = `${offset}px`;\n return style;\n }\n\n buildTrackStyle(min, max) {\n const obj = {\n position: 'absolute',\n willChange:\n this.state.index >= 0 ? `${this.posMinKey()},${this.posMaxKey()}` : undefined,\n };\n obj[this.posMinKey()] = min;\n obj[this.posMaxKey()] = max;\n return obj;\n }\n\n buildMarkStyle(offset) {\n return {\n position: 'absolute',\n [this.posMinKey()]: offset,\n };\n }\n\n renderThumb = (style, i) => {\n const className = `${this.props.thumbClassName} ${this.props.thumbClassName}-${i} ${\n this.state.index === i ? this.props.thumbActiveClassName : ''\n }`;\n\n const props = {\n 'ref': r => {\n this[`thumb${i}`] = r;\n },\n 'key': `${this.props.thumbClassName}-${i}`,\n className,\n style,\n 'onMouseDown': this.createOnMouseDown(i),\n 'onTouchStart': this.createOnTouchStart(i),\n 'onFocus': this.createOnKeyDown(i),\n 'tabIndex': 0,\n 'role': 'slider',\n 'aria-orientation': this.props.orientation,\n 'aria-valuenow': this.state.value[i],\n 'aria-valuemin': this.props.min,\n 'aria-valuemax': this.props.max,\n 'aria-label': Array.isArray(this.props.ariaLabel)\n ? this.props.ariaLabel[i]\n : this.props.ariaLabel,\n 'aria-labelledby': Array.isArray(this.props.ariaLabelledby)\n ? this.props.ariaLabelledby[i]\n : this.props.ariaLabelledby,\n 'aria-disabled': this.props.disabled,\n };\n\n const state = {\n index: i,\n value: prepareOutValue(this.state.value),\n valueNow: this.state.value[i],\n };\n\n if (this.props.ariaValuetext) {\n props['aria-valuetext'] =\n typeof this.props.ariaValuetext === 'string'\n ? this.props.ariaValuetext\n : this.props.ariaValuetext(state);\n }\n\n return this.props.renderThumb(props, state);\n };\n\n renderThumbs(offset) {\n const { length } = offset;\n\n const styles = [];\n for (let i = 0; i < length; i += 1) {\n styles[i] = this.buildThumbStyle(offset[i], i);\n }\n\n const res = [];\n for (let i = 0; i < length; i += 1) {\n res[i] = this.renderThumb(styles[i], i);\n }\n return res;\n }\n\n renderTrack = (i, offsetFrom, offsetTo) => {\n const props = {\n key: `${this.props.trackClassName}-${i}`,\n className: `${this.props.trackClassName} ${this.props.trackClassName}-${i}`,\n style: this.buildTrackStyle(offsetFrom, this.state.upperBound - offsetTo),\n };\n const state = {\n index: i,\n value: prepareOutValue(this.state.value),\n };\n return this.props.renderTrack(props, state);\n };\n\n renderTracks(offset) {\n const tracks = [];\n const lastIndex = offset.length - 1;\n\n tracks.push(this.renderTrack(0, 0, offset[0]));\n\n for (let i = 0; i < lastIndex; i += 1) {\n tracks.push(this.renderTrack(i + 1, offset[i], offset[i + 1]));\n }\n\n tracks.push(this.renderTrack(lastIndex + 1, offset[lastIndex], this.state.upperBound));\n\n return tracks;\n }\n\n renderMarks() {\n let { marks } = this.props;\n\n const range = this.props.max - this.props.min + 1;\n\n if (typeof marks === 'boolean') {\n marks = Array.from({ length: range }).map((_, key) => key);\n } else if (typeof marks === 'number') {\n marks = Array.from({ length: range })\n .map((_, key) => key)\n .filter(key => key % marks === 0);\n }\n\n return marks\n .map(parseFloat)\n .sort((a, b) => a - b)\n .map(mark => {\n const offset = this.calcOffset(mark);\n\n const props = {\n key: mark,\n className: this.props.markClassName,\n style: this.buildMarkStyle(offset),\n };\n\n return this.props.renderMark(props);\n });\n }\n\n render() {\n const offset = [];\n const { value } = this.state;\n const l = value.length;\n for (let i = 0; i < l; i += 1) {\n offset[i] = this.calcOffset(value[i], i);\n }\n\n const tracks = this.props.withTracks ? this.renderTracks(offset) : null;\n const thumbs = this.renderThumbs(offset);\n const marks = this.props.marks ? this.renderMarks() : null;\n\n return React.createElement(\n 'div',\n {\n ref: r => {\n this.slider = r;\n this.resizeElementRef.current = r;\n },\n style: { position: 'relative' },\n className: this.props.className + (this.props.disabled ? ' disabled' : ''),\n onMouseDown: this.onSliderMouseDown,\n onClick: this.onSliderClick,\n },\n tracks,\n thumbs,\n marks\n );\n }\n}\n\nexport default ReactSlider;\n"],"names":["pauseEvent","e","stopPropagation","preventDefault","sanitizeInValue","x","Array","isArray","slice","prepareOutValue","length","trimSucceeding","nextValue","minDistance","max","i","padding","trimPreceding","min","addHandlers","eventMap","Object","keys","forEach","key","document","addEventListener","removeHandlers","removeEventListener","trimAlignValue","val","props","alignValue","trimValue","valModStep","step","alignedValue","Math","abs","parseFloat","toFixed","trimmed","ReactSlider","onKeyUp","onEnd","onMouseUp","getMouseEventMap","onTouchEnd","getTouchEventMap","onBlur","setState","index","getKeyDownEventMap","onMouseMove","pending","position","getMousePosition","diffPosition","getDiffPosition","newValue","getValueFromPosition","move","onTouchMove","touches","getTouchPosition","isScrolling","diffMainDir","startPosition","diffScrollDir","onKeyDown","ctrlKey","shiftKey","altKey","metaKey","moveDownByStep","moveUpByStep","pageFn","onSliderMouseDown","disabled","button","snapDragDisabled","forceValueFromPosition","start","onSliderClick","hasMoved","valueAtPos","calcValue","calcOffsetFromPosition","createOnKeyDown","createOnMouseDown","createOnTouchStart","undefined","handleResize","resizeTimeout","window","setTimeout","pendingResizeTimeouts","shift","resize","push","renderThumb","style","className","thumbClassName","state","thumbActiveClassName","r","orientation","value","ariaLabel","ariaLabelledby","valueNow","ariaValuetext","renderTrack","offsetFrom","offsetTo","trackClassName","buildTrackStyle","upperBound","defaultValue","zIndices","resizeObserver","resizeElementRef","React","createRef","sliderLength","componentDidMount","ResizeObserver","observe","current","getDerivedStateFromProps","map","item","componentDidUpdate","componentWillUnmount","clearPendingResizeTimeouts","disconnect","fireChangeEvent","getValue","getClosestIndex","pixelOffset","minDist","Number","MAX_VALUE","closestIndex","l","offset","calcOffset","dist","axisKey","orthogonalAxisKey","touch","keydown","keyup","focusout","mousemove","mouseup","touchmove","touchend","diffValue","thumbSize","startValue","invert","slider","thumb0","thumb","sizeKey","sliderRect","getBoundingClientRect","sliderSize","sliderMax","posMaxKey","sliderMin","posMinKey","thumbRect","replace","toLowerCase","range","ratio","windowOffset","sliderStart","callback","nextTimeout","clearTimeout","thumbRef","focus","splice","indexOf","prevState","oldValue","trimAlign","pearling","valueBefore","valueAfter","pushSucceeding","pushPreceding","bind","event","buildThumbStyle","touchAction","willChange","zIndex","obj","buildMarkStyle","renderThumbs","styles","res","renderTracks","tracks","lastIndex","renderMarks","marks","from","_","filter","sort","a","b","mark","markClassName","renderMark","render","withTracks","thumbs","createElement","ref","onMouseDown","onClick","Component","displayName","defaultProps","propTypes","PropTypes","number","func","oneOfType","arrayOf","oneOf","string","bool","onBeforeChange","onChange","onAfterChange"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;;AACA,SAASA,UAAT,CAAoBC,CAApB,EAAuB;AACnB,EAAA,IAAIA,CAAC,IAAIA,CAAC,CAACC,eAAX,EAA4B;AACxBD,IAAAA,CAAC,CAACC,eAAF,EAAA,CAAA;AACH,GAAA;;AACD,EAAA,IAAID,CAAC,IAAIA,CAAC,CAACE,cAAX,EAA2B;AACvBF,IAAAA,CAAC,CAACE,cAAF,EAAA,CAAA;AACH,GAAA;;AACD,EAAA,OAAO,KAAP,CAAA;AACH,CAAA;;AAED,SAASD,eAAT,CAAyBD,CAAzB,EAA4B;EACxB,IAAIA,CAAC,CAACC,eAAN,EAAuB;AACnBD,IAAAA,CAAC,CAACC,eAAF,EAAA,CAAA;AACH,GAAA;AACJ,CAAA;;AAED,SAASE,eAAT,CAAyBC,CAAzB,EAA4B;EACxB,IAAIA,CAAC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