@react-aria/slider 3.4.2-nightly.3940 → 3.4.2-nightly.3960

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.
package/dist/import.mjs CHANGED
@@ -51,8 +51,6 @@ function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
51
51
  // Here, we keep track of which index is the "closest" to the drag start point.
52
52
  // It is set onMouseDown/onTouchDown; see trackProps below.
53
53
  const realTimeTrackDraggingIndex = (0, $fA3fN$useRef)(null);
54
- const stateRef = (0, $fA3fN$useRef)(null);
55
- stateRef.current = state;
56
54
  const reverseX = direction === "rtl";
57
55
  const currentPosition = (0, $fA3fN$useRef)(null);
58
56
  const { moveProps: moveProps } = (0, $fA3fN$useMove)({
@@ -62,18 +60,18 @@ function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
62
60
  onMove ({ deltaX: deltaX , deltaY: deltaY }) {
63
61
  let { height: height , width: width } = trackRef.current.getBoundingClientRect();
64
62
  let size = isVertical ? height : width;
65
- if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
63
+ if (currentPosition.current == null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
66
64
  let delta = isVertical ? deltaY : deltaX;
67
65
  if (isVertical || reverseX) delta = -delta;
68
66
  currentPosition.current += delta;
69
67
  if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
70
68
  const percent = (0, $fA3fN$clamp)(currentPosition.current / size, 0, 1);
71
- stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
69
+ state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
72
70
  }
73
71
  },
74
72
  onMoveEnd () {
75
73
  if (realTimeTrackDraggingIndex.current != null) {
76
- stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);
74
+ state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
77
75
  realTimeTrackDraggingIndex.current = null;
78
76
  }
79
77
  }
@@ -213,13 +211,11 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
213
211
  isFocused,
214
212
  focusInput
215
213
  ]);
216
- const stateRef = (0, $fA3fN$useRef)(null);
217
- stateRef.current = state;
218
214
  let reverseX = direction === "rtl";
219
215
  let currentPosition = (0, $fA3fN$useRef)(null);
220
216
  let { keyboardProps: keyboardProps } = (0, $fA3fN$useKeyboard)({
221
217
  onKeyDown (e) {
222
- let { getThumbMaxValue: getThumbMaxValue , getThumbMinValue: getThumbMinValue , decrementThumb: decrementThumb , incrementThumb: incrementThumb , setThumbValue: setThumbValue , setThumbDragging: setThumbDragging , pageSize: pageSize } = stateRef.current;
218
+ let { getThumbMaxValue: getThumbMaxValue , getThumbMinValue: getThumbMinValue , decrementThumb: decrementThumb , incrementThumb: incrementThumb , setThumbValue: setThumbValue , setThumbDragging: setThumbDragging , pageSize: pageSize } = state;
223
219
  // these are the cases that useMove or useSlider don't handle
224
220
  if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
225
221
  e.continuePropagation();
@@ -249,10 +245,10 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
249
245
  let { moveProps: moveProps } = (0, $fA3fN$useMove)({
250
246
  onMoveStart () {
251
247
  currentPosition.current = null;
252
- stateRef.current.setThumbDragging(index, true);
248
+ state.setThumbDragging(index, true);
253
249
  },
254
250
  onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
255
- const { getThumbPercent: getThumbPercent , setThumbPercent: setThumbPercent , decrementThumb: decrementThumb , incrementThumb: incrementThumb , step: step , pageSize: pageSize } = stateRef.current;
251
+ const { getThumbPercent: getThumbPercent , setThumbPercent: setThumbPercent , decrementThumb: decrementThumb , incrementThumb: incrementThumb , step: step , pageSize: pageSize } = state;
256
252
  let { width: width , height: height } = trackRef.current.getBoundingClientRect();
257
253
  let size = isVertical ? height : width;
258
254
  if (currentPosition.current == null) currentPosition.current = getThumbPercent(index) * size;
@@ -267,7 +263,7 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
267
263
  }
268
264
  },
269
265
  onMoveEnd () {
270
- stateRef.current.setThumbDragging(index, false);
266
+ state.setThumbDragging(index, false);
271
267
  }
272
268
  });
273
269
  // Immediately register editability with the state
@@ -331,7 +327,7 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
331
327
  "aria-invalid": validationState === "invalid" || undefined,
332
328
  "aria-errormessage": opts["aria-errormessage"],
333
329
  onChange: (e)=>{
334
- stateRef.current.setThumbValue(index, parseFloat(e.target.value));
330
+ state.setThumbValue(index, parseFloat(e.target.value));
335
331
  }
336
332
  }),
337
333
  thumbProps: {
package/dist/main.js CHANGED
@@ -57,8 +57,6 @@ function $481f97d830e3ede6$export$56b2c08e277f365(props, state, trackRef) {
57
57
  // Here, we keep track of which index is the "closest" to the drag start point.
58
58
  // It is set onMouseDown/onTouchDown; see trackProps below.
59
59
  const realTimeTrackDraggingIndex = (0, $coMqq$react.useRef)(null);
60
- const stateRef = (0, $coMqq$react.useRef)(null);
61
- stateRef.current = state;
62
60
  const reverseX = direction === "rtl";
63
61
  const currentPosition = (0, $coMqq$react.useRef)(null);
64
62
  const { moveProps: moveProps } = (0, $coMqq$reactariainteractions.useMove)({
@@ -68,18 +66,18 @@ function $481f97d830e3ede6$export$56b2c08e277f365(props, state, trackRef) {
68
66
  onMove ({ deltaX: deltaX , deltaY: deltaY }) {
69
67
  let { height: height , width: width } = trackRef.current.getBoundingClientRect();
70
68
  let size = isVertical ? height : width;
71
- if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
69
+ if (currentPosition.current == null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
72
70
  let delta = isVertical ? deltaY : deltaX;
73
71
  if (isVertical || reverseX) delta = -delta;
74
72
  currentPosition.current += delta;
75
73
  if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
76
74
  const percent = (0, $coMqq$reactariautils.clamp)(currentPosition.current / size, 0, 1);
77
- stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
75
+ state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
78
76
  }
79
77
  },
80
78
  onMoveEnd () {
81
79
  if (realTimeTrackDraggingIndex.current != null) {
82
- stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);
80
+ state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
83
81
  realTimeTrackDraggingIndex.current = null;
84
82
  }
85
83
  }
@@ -219,13 +217,11 @@ function $5eb806b626475377$export$8d15029008292ae(opts, state) {
219
217
  isFocused,
220
218
  focusInput
221
219
  ]);
222
- const stateRef = (0, $coMqq$react.useRef)(null);
223
- stateRef.current = state;
224
220
  let reverseX = direction === "rtl";
225
221
  let currentPosition = (0, $coMqq$react.useRef)(null);
226
222
  let { keyboardProps: keyboardProps } = (0, $coMqq$reactariainteractions.useKeyboard)({
227
223
  onKeyDown (e) {
228
- let { getThumbMaxValue: getThumbMaxValue , getThumbMinValue: getThumbMinValue , decrementThumb: decrementThumb , incrementThumb: incrementThumb , setThumbValue: setThumbValue , setThumbDragging: setThumbDragging , pageSize: pageSize } = stateRef.current;
224
+ let { getThumbMaxValue: getThumbMaxValue , getThumbMinValue: getThumbMinValue , decrementThumb: decrementThumb , incrementThumb: incrementThumb , setThumbValue: setThumbValue , setThumbDragging: setThumbDragging , pageSize: pageSize } = state;
229
225
  // these are the cases that useMove or useSlider don't handle
230
226
  if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
231
227
  e.continuePropagation();
@@ -255,10 +251,10 @@ function $5eb806b626475377$export$8d15029008292ae(opts, state) {
255
251
  let { moveProps: moveProps } = (0, $coMqq$reactariainteractions.useMove)({
256
252
  onMoveStart () {
257
253
  currentPosition.current = null;
258
- stateRef.current.setThumbDragging(index, true);
254
+ state.setThumbDragging(index, true);
259
255
  },
260
256
  onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
261
- const { getThumbPercent: getThumbPercent , setThumbPercent: setThumbPercent , decrementThumb: decrementThumb , incrementThumb: incrementThumb , step: step , pageSize: pageSize } = stateRef.current;
257
+ const { getThumbPercent: getThumbPercent , setThumbPercent: setThumbPercent , decrementThumb: decrementThumb , incrementThumb: incrementThumb , step: step , pageSize: pageSize } = state;
262
258
  let { width: width , height: height } = trackRef.current.getBoundingClientRect();
263
259
  let size = isVertical ? height : width;
264
260
  if (currentPosition.current == null) currentPosition.current = getThumbPercent(index) * size;
@@ -273,7 +269,7 @@ function $5eb806b626475377$export$8d15029008292ae(opts, state) {
273
269
  }
274
270
  },
275
271
  onMoveEnd () {
276
- stateRef.current.setThumbDragging(index, false);
272
+ state.setThumbDragging(index, false);
277
273
  }
278
274
  });
279
275
  // Immediately register editability with the state
@@ -337,7 +333,7 @@ function $5eb806b626475377$export$8d15029008292ae(opts, state) {
337
333
  "aria-invalid": validationState === "invalid" || undefined,
338
334
  "aria-errormessage": opts["aria-errormessage"],
339
335
  onChange: (e)=>{
340
- stateRef.current.setThumbValue(index, parseFloat(e.target.value));
336
+ state.setThumbValue(index, parseFloat(e.target.value));
341
337
  }
342
338
  }),
343
339
  thumbProps: {
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;ACVO,MAAM,4CAAY,IAAI;AAEtB,SAAS,0CAAiB,KAAkB,EAAE,KAAa,EAAE;IAClE,IAAI,KAAK,0CAAU,GAAG,CAAC;IACvB,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,wBAAwB;IAG1C,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC;AACzB;;;;;;;ADmCO,SAAS,yCACd,KAAyB,EACzB,KAAkB,EAClB,QAA4B,EAChB;IACZ,IAAI,cAAC,WAAU,cAAE,WAAU,EAAC,GAAG,CAAA,GAAA,8BAAQ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aria/slider/src/useSlider.ts","packages/@react-aria/slider/src/utils.ts","packages/@react-aria/slider/src/useSliderThumb.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSlider} from './useSlider';\nexport {useSliderThumb} from './useSliderThumb';\nexport type {AriaSliderProps} from '@react-types/slider';\nexport type {SliderAria} from './useSlider';\nexport type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb';\nexport type {AriaSliderThumbProps} from '@react-types/slider';\nexport type {Orientation} from '@react-types/shared';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaSliderProps} from '@react-types/slider';\nimport {clamp, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {LabelHTMLAttributes, OutputHTMLAttributes, RefObject, useRef} from 'react';\nimport {setInteractionModality, useMove} from '@react-aria/interactions';\nimport {SliderState} from '@react-stately/slider';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Props for the root element of the slider component; groups slider inputs. */\n groupProps: DOMAttributes,\n\n /** Props for the track element. */\n trackProps: DOMAttributes,\n\n /** Props for the output element, displaying the value of the slider thumbs. */\n outputProps: OutputHTMLAttributes<HTMLOutputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a slider component representing one or more values.\n *\n * @param props Props for the slider.\n * @param state State for the slider, as returned by `useSliderState`.\n * @param trackRef Ref for the \"track\" element. The width of this element provides the \"length\"\n * of the track -- the span of one dimensional space that the slider thumb can be. It also\n * accepts click and drag motions, so that the closest thumb will follow clicks and drags on\n * the track.\n */\nexport function useSlider<T extends number | number[]>(\n props: AriaSliderProps<T>,\n state: SliderState,\n trackRef: RefObject<Element>\n): SliderAria {\n let {labelProps, fieldProps} = useLabel(props);\n\n let isVertical = props.orientation === 'vertical';\n\n // Attach id of the label to the state so it can be accessed by useSliderThumb.\n sliderIds.set(state, labelProps.id ?? fieldProps.id);\n\n let {direction} = useLocale();\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n // When the user clicks or drags the track, we want the motion to set and drag the\n // closest thumb. Hence we also need to install useMove() on the track element.\n // Here, we keep track of which index is the \"closest\" to the drag start point.\n // It is set onMouseDown/onTouchDown; see trackProps below.\n const realTimeTrackDraggingIndex = useRef<number | null>(null);\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n const reverseX = direction === 'rtl';\n const currentPosition = useRef<number>(null);\n const {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n },\n onMove({deltaX, deltaY}) {\n let {height, width} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;\n }\n\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n\n if (realTimeTrackDraggingIndex.current != null && trackRef.current) {\n const percent = clamp(currentPosition.current / size, 0, 1);\n stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);\n }\n },\n onMoveEnd() {\n if (realTimeTrackDraggingIndex.current != null) {\n stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n }\n });\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let onDownTrack = (e: React.UIEvent, id: number, clientX: number, clientY: number) => {\n // We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.\n if (trackRef.current && !props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) {\n let {height, width, top, left} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n // Find the closest thumb\n const trackPosition = isVertical ? top : left;\n const clickPosition = isVertical ? clientY : clientX;\n const offset = clickPosition - trackPosition;\n let percent = offset / size;\n if (direction === 'rtl' || isVertical) {\n percent = 1 - percent;\n }\n let value = state.getPercentValue(percent);\n\n // to find the closet thumb we split the array based on the first thumb position to the \"right/end\" of the click.\n let closestThumb;\n let split = state.values.findIndex(v => value - v < 0);\n if (split === 0) { // If the index is zero then the closetThumb is the first one\n closestThumb = split;\n } else if (split === -1) { // If no index is found they've clicked past all the thumbs\n closestThumb = state.values.length - 1;\n } else {\n let lastLeft = state.values[split - 1];\n let firstRight = state.values[split];\n // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one\n if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) {\n closestThumb = split - 1;\n } else {\n closestThumb = split;\n }\n }\n\n // Confirm that the found closest thumb is editable, not disabled, and move it\n if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {\n // Don't unfocus anything\n e.preventDefault();\n\n realTimeTrackDraggingIndex.current = closestThumb;\n state.setFocusedThumb(closestThumb);\n currentPointer.current = id;\n\n state.setThumbDragging(realTimeTrackDraggingIndex.current, true);\n state.setThumbValue(closestThumb, value);\n\n addGlobalListener(window, 'mouseup', onUpTrack, false);\n addGlobalListener(window, 'touchend', onUpTrack, false);\n addGlobalListener(window, 'pointerup', onUpTrack, false);\n } else {\n realTimeTrackDraggingIndex.current = null;\n }\n }\n };\n\n let onUpTrack = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n\n removeGlobalListener(window, 'mouseup', onUpTrack, false);\n removeGlobalListener(window, 'touchend', onUpTrack, false);\n removeGlobalListener(window, 'pointerup', onUpTrack, false);\n }\n };\n\n if ('htmlFor' in labelProps && labelProps.htmlFor) {\n // Ideally the `for` attribute should point to the first thumb, but VoiceOver on iOS\n // causes this to override the `aria-labelledby` on the thumb. This causes the first\n // thumb to only be announced as the slider label rather than its individual name as well.\n // See https://bugs.webkit.org/show_bug.cgi?id=172464.\n delete labelProps.htmlFor;\n labelProps.onClick = () => {\n // Safari does not focus <input type=\"range\"> elements when clicking on an associated <label>,\n // so do it manually. In addition, make sure we show the focus ring.\n document.getElementById(getSliderThumbId(state, 0))?.focus();\n setInteractionModality('keyboard');\n };\n }\n\n return {\n labelProps,\n // The root element of the Slider will have role=\"group\" to group together\n // all the thumb inputs in the Slider. The label of the Slider will\n // be used to label the group.\n groupProps: {\n role: 'group',\n ...fieldProps\n },\n trackProps: mergeProps({\n onMouseDown(e: React.MouseEvent) {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDownTrack(e, undefined, e.clientX, e.clientY);\n },\n onPointerDown(e: React.PointerEvent) {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onDownTrack(e, e.pointerId, e.clientX, e.clientY);\n },\n onTouchStart(e: React.TouchEvent) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); },\n style: {\n position: 'relative',\n touchAction: 'none'\n }\n }, moveProps),\n outputProps: {\n htmlFor: state.values.map((_, index) => getSliderThumbId(state, index)).join(' '),\n 'aria-live': 'off'\n }\n };\n}\n","import {SliderState} from '@react-stately/slider';\n\nexport const sliderIds = new WeakMap<SliderState, string>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let id = sliderIds.get(state);\n if (!id) {\n throw new Error('Unknown slider state');\n }\n\n return `${id}-${index}`;\n}\n","import {AriaSliderThumbProps} from '@react-types/slider';\nimport {clamp, focusWithoutScrolling, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: DOMAttributes,\n\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n\n /** Props for the label element for this thumb (optional). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Whether this thumb is currently being dragged. */\n isDragging: boolean,\n /** Whether the thumb is currently focused. */\n isFocused: boolean,\n /** Whether the thumb is disabled. */\n isDisabled: boolean\n}\n\nexport interface AriaSliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<Element>,\n /** A ref to the thumb input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: AriaSliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index = 0,\n isRequired,\n validationState,\n trackRef,\n inputRef,\n orientation = state.orientation\n } = opts;\n\n let isDisabled = opts.isDisabled || state.isDisabled;\n let isVertical = orientation === 'vertical';\n\n let {direction} = useLocale();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let labelId = sliderIds.get(state);\n const {labelProps, fieldProps} = useLabel({\n ...opts,\n id: getSliderThumbId(state, index),\n 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim()\n });\n\n const value = state.values[index];\n\n const focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n const isFocused = state.focusedThumb === index;\n\n useEffect(() => {\n if (isFocused) {\n focusInput();\n }\n }, [isFocused, focusInput]);\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n let reverseX = direction === 'rtl';\n let currentPosition = useRef<number>(null);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n let {\n getThumbMaxValue,\n getThumbMinValue,\n decrementThumb,\n incrementThumb,\n setThumbValue,\n setThumbDragging,\n pageSize\n } = stateRef.current;\n // these are the cases that useMove or useSlider don't handle\n if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {\n e.continuePropagation();\n return;\n }\n // same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.\n e.preventDefault();\n // remember to set this so that onChangeEnd is fired\n setThumbDragging(index, true);\n switch (e.key) {\n case 'PageUp':\n incrementThumb(index, pageSize);\n break;\n case 'PageDown':\n decrementThumb(index, pageSize);\n break;\n case 'Home':\n setThumbValue(index, getThumbMinValue(index));\n break;\n case 'End':\n setThumbValue(index, getThumbMaxValue(index));\n break;\n }\n setThumbDragging(index, false);\n }\n });\n\n let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n stateRef.current.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType, shiftKey}) {\n const {\n getThumbPercent,\n setThumbPercent,\n decrementThumb,\n incrementThumb,\n step,\n pageSize\n } = stateRef.current;\n let {width, height} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n if ((deltaX > 0 && reverseX) || (deltaX < 0 && !reverseX) || deltaY > 0) {\n decrementThumb(index, shiftKey ? pageSize : step);\n } else {\n incrementThumb(index, shiftKey ? pageSize : step);\n }\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n setThumbPercent(index, clamp(currentPosition.current / size, 0, 1));\n }\n },\n onMoveEnd() {\n stateRef.current.setThumbDragging(index, false);\n }\n });\n\n // Immediately register editability with the state\n state.setThumbEditable(index, !isDisabled);\n\n const {focusableProps} = useFocusable(\n mergeProps(opts, {\n onFocus: () => state.setFocusedThumb(index),\n onBlur: () => state.setFocusedThumb(undefined)\n }),\n inputRef\n );\n\n let currentPointer = useRef<number | undefined>(undefined);\n let onDown = (id?: number) => {\n focusInput();\n currentPointer.current = id;\n state.setThumbDragging(index, true);\n\n addGlobalListener(window, 'mouseup', onUp, false);\n addGlobalListener(window, 'touchend', onUp, false);\n addGlobalListener(window, 'pointerup', onUp, false);\n\n };\n\n let onUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setThumbDragging(index, false);\n removeGlobalListener(window, 'mouseup', onUp, false);\n removeGlobalListener(window, 'touchend', onUp, false);\n removeGlobalListener(window, 'pointerup', onUp, false);\n }\n };\n\n let thumbPosition = state.getThumbPercent(index);\n if (isVertical || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n let interactions = !isDisabled ? mergeProps(\n keyboardProps,\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {};\n\n // We install mouse handlers for the drag motion on the thumb div, but\n // not the key handler for moving the thumb with the slider. Instead,\n // we focus the range input, and let the browser handle the keyboard\n // interactions; we then listen to input's onChange to update state.\n return {\n inputProps: mergeProps(focusableProps, fieldProps, {\n type: 'range',\n tabIndex: !isDisabled ? 0 : undefined,\n min: state.getThumbMinValue(index),\n max: state.getThumbMaxValue(index),\n step: state.step,\n value: value,\n disabled: isDisabled,\n 'aria-orientation': orientation,\n 'aria-valuetext': state.getThumbValueLabel(index),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': validationState === 'invalid' || undefined,\n 'aria-errormessage': opts['aria-errormessage'],\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n stateRef.current.setThumbValue(index, parseFloat(e.target.value));\n }\n }),\n thumbProps: {\n ...interactions,\n style: {\n position: 'absolute',\n [isVertical ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none'\n }\n },\n labelProps,\n isDragging: state.isThumbDragging(index),\n isDisabled,\n isFocused\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;ACVO,MAAM,4CAAY,IAAI;AAEtB,SAAS,0CAAiB,KAAkB,EAAE,KAAa,EAAE;IAClE,IAAI,KAAK,0CAAU,GAAG,CAAC;IACvB,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,wBAAwB;IAG1C,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC;AACzB;;;;;;;ADmCO,SAAS,yCACd,KAAyB,EACzB,KAAkB,EAClB,QAA4B,EAChB;IACZ,IAAI,cAAC,WAAU,cAAE,WAAU,EAAC,GAAG,CAAA,GAAA,8BAAQ,AAAD,EAAE;IAExC,IAAI,aAAa,MAAM,WAAW,KAAK;QAGlB;IADr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,OAAO,EACtD;YAEF,OAAO,EAAE,SAAS;QACpB;QACA,cAAc,CAAC,IAAwB;YAAC,OAAO,EAAE,cAAc,CAAC,EAAE,CAAC,UAAU;QAAE;IACjF,KACE,CAAC,CAAC;IAEN,sEAAsE;IACtE,sEAAsE;IACtE,oEAAoE;IACpE,oEAAoE;IACpE,OAAO;QACL,YAAY,CAAA,GAAA,gCAAU,AAAD,EAAE,gBAAgB,YAAY;YACjD,MAAM;YACN,UAAU,CAAC,aAAa,IAAI,SAAS;YACrC,KAAK,MAAM,gBAAgB,CAAC;YAC5B,KAAK,MAAM,gBAAgB,CAAC;YAC5B,MAAM,MAAM,IAAI;YAChB,OAAO;YACP,UAAU;YACV,oBAAoB;YACpB,kBAAkB,MAAM,kBAAkB,CAAC;YAC3C,iBAAiB,cAAc;YAC/B,gBAAgB,oBAAoB,aAAa;YACjD,qBAAqB,IAAI,CAAC,oBAAoB;YAC9C,UAAU,CAAC,IAAqC;gBAC9C,MAAM,aAAa,CAAC,OAAO,WAAW,EAAE,MAAM,CAAC,KAAK;YACtD;QACF;QACA,YAAY;YACV,GAAG,YAAY;YACf,OAAO;gBACL,UAAU;gBACV,CAAC,aAAa,QAAQ,MAAM,CAAC,EAAE,CAAC,EAAE,gBAAgB,IAAI,CAAC,CAAC;gBACxD,WAAW;gBACX,aAAa;YACf;QACF;oBACA;QACA,YAAY,MAAM,eAAe,CAAC;oBAClC;mBACA;IACF;AACF;","sources":["packages/@react-aria/slider/src/index.ts","packages/@react-aria/slider/src/useSlider.ts","packages/@react-aria/slider/src/utils.ts","packages/@react-aria/slider/src/useSliderThumb.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSlider} from './useSlider';\nexport {useSliderThumb} from './useSliderThumb';\nexport type {AriaSliderProps} from '@react-types/slider';\nexport type {SliderAria} from './useSlider';\nexport type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb';\nexport type {AriaSliderThumbProps} from '@react-types/slider';\nexport type {Orientation} from '@react-types/shared';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaSliderProps} from '@react-types/slider';\nimport {clamp, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {LabelHTMLAttributes, OutputHTMLAttributes, RefObject, useRef} from 'react';\nimport {setInteractionModality, useMove} from '@react-aria/interactions';\nimport {SliderState} from '@react-stately/slider';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Props for the root element of the slider component; groups slider inputs. */\n groupProps: DOMAttributes,\n\n /** Props for the track element. */\n trackProps: DOMAttributes,\n\n /** Props for the output element, displaying the value of the slider thumbs. */\n outputProps: OutputHTMLAttributes<HTMLOutputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a slider component representing one or more values.\n *\n * @param props Props for the slider.\n * @param state State for the slider, as returned by `useSliderState`.\n * @param trackRef Ref for the \"track\" element. The width of this element provides the \"length\"\n * of the track -- the span of one dimensional space that the slider thumb can be. It also\n * accepts click and drag motions, so that the closest thumb will follow clicks and drags on\n * the track.\n */\nexport function useSlider<T extends number | number[]>(\n props: AriaSliderProps<T>,\n state: SliderState,\n trackRef: RefObject<Element>\n): SliderAria {\n let {labelProps, fieldProps} = useLabel(props);\n\n let isVertical = props.orientation === 'vertical';\n\n // Attach id of the label to the state so it can be accessed by useSliderThumb.\n sliderIds.set(state, labelProps.id ?? fieldProps.id);\n\n let {direction} = useLocale();\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n // When the user clicks or drags the track, we want the motion to set and drag the\n // closest thumb. Hence we also need to install useMove() on the track element.\n // Here, we keep track of which index is the \"closest\" to the drag start point.\n // It is set onMouseDown/onTouchDown; see trackProps below.\n const realTimeTrackDraggingIndex = useRef<number | null>(null);\n\n const reverseX = direction === 'rtl';\n const currentPosition = useRef<number>(null);\n const {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n },\n onMove({deltaX, deltaY}) {\n let {height, width} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;\n }\n\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n\n if (realTimeTrackDraggingIndex.current != null && trackRef.current) {\n const percent = clamp(currentPosition.current / size, 0, 1);\n state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);\n }\n },\n onMoveEnd() {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n }\n });\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let onDownTrack = (e: React.UIEvent, id: number, clientX: number, clientY: number) => {\n // We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.\n if (trackRef.current && !props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) {\n let {height, width, top, left} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n // Find the closest thumb\n const trackPosition = isVertical ? top : left;\n const clickPosition = isVertical ? clientY : clientX;\n const offset = clickPosition - trackPosition;\n let percent = offset / size;\n if (direction === 'rtl' || isVertical) {\n percent = 1 - percent;\n }\n let value = state.getPercentValue(percent);\n\n // to find the closet thumb we split the array based on the first thumb position to the \"right/end\" of the click.\n let closestThumb;\n let split = state.values.findIndex(v => value - v < 0);\n if (split === 0) { // If the index is zero then the closetThumb is the first one\n closestThumb = split;\n } else if (split === -1) { // If no index is found they've clicked past all the thumbs\n closestThumb = state.values.length - 1;\n } else {\n let lastLeft = state.values[split - 1];\n let firstRight = state.values[split];\n // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one\n if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) {\n closestThumb = split - 1;\n } else {\n closestThumb = split;\n }\n }\n\n // Confirm that the found closest thumb is editable, not disabled, and move it\n if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {\n // Don't unfocus anything\n e.preventDefault();\n\n realTimeTrackDraggingIndex.current = closestThumb;\n state.setFocusedThumb(closestThumb);\n currentPointer.current = id;\n\n state.setThumbDragging(realTimeTrackDraggingIndex.current, true);\n state.setThumbValue(closestThumb, value);\n\n addGlobalListener(window, 'mouseup', onUpTrack, false);\n addGlobalListener(window, 'touchend', onUpTrack, false);\n addGlobalListener(window, 'pointerup', onUpTrack, false);\n } else {\n realTimeTrackDraggingIndex.current = null;\n }\n }\n };\n\n let onUpTrack = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n\n removeGlobalListener(window, 'mouseup', onUpTrack, false);\n removeGlobalListener(window, 'touchend', onUpTrack, false);\n removeGlobalListener(window, 'pointerup', onUpTrack, false);\n }\n };\n\n if ('htmlFor' in labelProps && labelProps.htmlFor) {\n // Ideally the `for` attribute should point to the first thumb, but VoiceOver on iOS\n // causes this to override the `aria-labelledby` on the thumb. This causes the first\n // thumb to only be announced as the slider label rather than its individual name as well.\n // See https://bugs.webkit.org/show_bug.cgi?id=172464.\n delete labelProps.htmlFor;\n labelProps.onClick = () => {\n // Safari does not focus <input type=\"range\"> elements when clicking on an associated <label>,\n // so do it manually. In addition, make sure we show the focus ring.\n document.getElementById(getSliderThumbId(state, 0))?.focus();\n setInteractionModality('keyboard');\n };\n }\n\n return {\n labelProps,\n // The root element of the Slider will have role=\"group\" to group together\n // all the thumb inputs in the Slider. The label of the Slider will\n // be used to label the group.\n groupProps: {\n role: 'group',\n ...fieldProps\n },\n trackProps: mergeProps({\n onMouseDown(e: React.MouseEvent) {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDownTrack(e, undefined, e.clientX, e.clientY);\n },\n onPointerDown(e: React.PointerEvent) {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onDownTrack(e, e.pointerId, e.clientX, e.clientY);\n },\n onTouchStart(e: React.TouchEvent) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); },\n style: {\n position: 'relative',\n touchAction: 'none'\n }\n }, moveProps),\n outputProps: {\n htmlFor: state.values.map((_, index) => getSliderThumbId(state, index)).join(' '),\n 'aria-live': 'off'\n }\n };\n}\n","import {SliderState} from '@react-stately/slider';\n\nexport const sliderIds = new WeakMap<SliderState, string>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let id = sliderIds.get(state);\n if (!id) {\n throw new Error('Unknown slider state');\n }\n\n return `${id}-${index}`;\n}\n","import {AriaSliderThumbProps} from '@react-types/slider';\nimport {clamp, focusWithoutScrolling, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: DOMAttributes,\n\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n\n /** Props for the label element for this thumb (optional). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Whether this thumb is currently being dragged. */\n isDragging: boolean,\n /** Whether the thumb is currently focused. */\n isFocused: boolean,\n /** Whether the thumb is disabled. */\n isDisabled: boolean\n}\n\nexport interface AriaSliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<Element>,\n /** A ref to the thumb input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: AriaSliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index = 0,\n isRequired,\n validationState,\n trackRef,\n inputRef,\n orientation = state.orientation\n } = opts;\n\n let isDisabled = opts.isDisabled || state.isDisabled;\n let isVertical = orientation === 'vertical';\n\n let {direction} = useLocale();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let labelId = sliderIds.get(state);\n const {labelProps, fieldProps} = useLabel({\n ...opts,\n id: getSliderThumbId(state, index),\n 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim()\n });\n\n const value = state.values[index];\n\n const focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n const isFocused = state.focusedThumb === index;\n\n useEffect(() => {\n if (isFocused) {\n focusInput();\n }\n }, [isFocused, focusInput]);\n\n let reverseX = direction === 'rtl';\n let currentPosition = useRef<number>(null);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n let {\n getThumbMaxValue,\n getThumbMinValue,\n decrementThumb,\n incrementThumb,\n setThumbValue,\n setThumbDragging,\n pageSize\n } = state;\n // these are the cases that useMove or useSlider don't handle\n if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {\n e.continuePropagation();\n return;\n }\n // same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.\n e.preventDefault();\n // remember to set this so that onChangeEnd is fired\n setThumbDragging(index, true);\n switch (e.key) {\n case 'PageUp':\n incrementThumb(index, pageSize);\n break;\n case 'PageDown':\n decrementThumb(index, pageSize);\n break;\n case 'Home':\n setThumbValue(index, getThumbMinValue(index));\n break;\n case 'End':\n setThumbValue(index, getThumbMaxValue(index));\n break;\n }\n setThumbDragging(index, false);\n }\n });\n\n let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType, shiftKey}) {\n const {\n getThumbPercent,\n setThumbPercent,\n decrementThumb,\n incrementThumb,\n step,\n pageSize\n } = state;\n let {width, height} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n if ((deltaX > 0 && reverseX) || (deltaX < 0 && !reverseX) || deltaY > 0) {\n decrementThumb(index, shiftKey ? pageSize : step);\n } else {\n incrementThumb(index, shiftKey ? pageSize : step);\n }\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n setThumbPercent(index, clamp(currentPosition.current / size, 0, 1));\n }\n },\n onMoveEnd() {\n state.setThumbDragging(index, false);\n }\n });\n\n // Immediately register editability with the state\n state.setThumbEditable(index, !isDisabled);\n\n const {focusableProps} = useFocusable(\n mergeProps(opts, {\n onFocus: () => state.setFocusedThumb(index),\n onBlur: () => state.setFocusedThumb(undefined)\n }),\n inputRef\n );\n\n let currentPointer = useRef<number | undefined>(undefined);\n let onDown = (id?: number) => {\n focusInput();\n currentPointer.current = id;\n state.setThumbDragging(index, true);\n\n addGlobalListener(window, 'mouseup', onUp, false);\n addGlobalListener(window, 'touchend', onUp, false);\n addGlobalListener(window, 'pointerup', onUp, false);\n\n };\n\n let onUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setThumbDragging(index, false);\n removeGlobalListener(window, 'mouseup', onUp, false);\n removeGlobalListener(window, 'touchend', onUp, false);\n removeGlobalListener(window, 'pointerup', onUp, false);\n }\n };\n\n let thumbPosition = state.getThumbPercent(index);\n if (isVertical || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n let interactions = !isDisabled ? mergeProps(\n keyboardProps,\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {};\n\n // We install mouse handlers for the drag motion on the thumb div, but\n // not the key handler for moving the thumb with the slider. Instead,\n // we focus the range input, and let the browser handle the keyboard\n // interactions; we then listen to input's onChange to update state.\n return {\n inputProps: mergeProps(focusableProps, fieldProps, {\n type: 'range',\n tabIndex: !isDisabled ? 0 : undefined,\n min: state.getThumbMinValue(index),\n max: state.getThumbMaxValue(index),\n step: state.step,\n value: value,\n disabled: isDisabled,\n 'aria-orientation': orientation,\n 'aria-valuetext': state.getThumbValueLabel(index),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': validationState === 'invalid' || undefined,\n 'aria-errormessage': opts['aria-errormessage'],\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setThumbValue(index, parseFloat(e.target.value));\n }\n }),\n thumbProps: {\n ...interactions,\n style: {\n position: 'absolute',\n [isVertical ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none'\n }\n },\n labelProps,\n isDragging: state.isThumbDragging(index),\n isDisabled,\n isFocused\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -51,8 +51,6 @@ function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
51
51
  // Here, we keep track of which index is the "closest" to the drag start point.
52
52
  // It is set onMouseDown/onTouchDown; see trackProps below.
53
53
  const realTimeTrackDraggingIndex = (0, $fA3fN$useRef)(null);
54
- const stateRef = (0, $fA3fN$useRef)(null);
55
- stateRef.current = state;
56
54
  const reverseX = direction === "rtl";
57
55
  const currentPosition = (0, $fA3fN$useRef)(null);
58
56
  const { moveProps: moveProps } = (0, $fA3fN$useMove)({
@@ -62,18 +60,18 @@ function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
62
60
  onMove ({ deltaX: deltaX , deltaY: deltaY }) {
63
61
  let { height: height , width: width } = trackRef.current.getBoundingClientRect();
64
62
  let size = isVertical ? height : width;
65
- if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
63
+ if (currentPosition.current == null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
66
64
  let delta = isVertical ? deltaY : deltaX;
67
65
  if (isVertical || reverseX) delta = -delta;
68
66
  currentPosition.current += delta;
69
67
  if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
70
68
  const percent = (0, $fA3fN$clamp)(currentPosition.current / size, 0, 1);
71
- stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
69
+ state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
72
70
  }
73
71
  },
74
72
  onMoveEnd () {
75
73
  if (realTimeTrackDraggingIndex.current != null) {
76
- stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);
74
+ state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
77
75
  realTimeTrackDraggingIndex.current = null;
78
76
  }
79
77
  }
@@ -213,13 +211,11 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
213
211
  isFocused,
214
212
  focusInput
215
213
  ]);
216
- const stateRef = (0, $fA3fN$useRef)(null);
217
- stateRef.current = state;
218
214
  let reverseX = direction === "rtl";
219
215
  let currentPosition = (0, $fA3fN$useRef)(null);
220
216
  let { keyboardProps: keyboardProps } = (0, $fA3fN$useKeyboard)({
221
217
  onKeyDown (e) {
222
- let { getThumbMaxValue: getThumbMaxValue , getThumbMinValue: getThumbMinValue , decrementThumb: decrementThumb , incrementThumb: incrementThumb , setThumbValue: setThumbValue , setThumbDragging: setThumbDragging , pageSize: pageSize } = stateRef.current;
218
+ let { getThumbMaxValue: getThumbMaxValue , getThumbMinValue: getThumbMinValue , decrementThumb: decrementThumb , incrementThumb: incrementThumb , setThumbValue: setThumbValue , setThumbDragging: setThumbDragging , pageSize: pageSize } = state;
223
219
  // these are the cases that useMove or useSlider don't handle
224
220
  if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
225
221
  e.continuePropagation();
@@ -249,10 +245,10 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
249
245
  let { moveProps: moveProps } = (0, $fA3fN$useMove)({
250
246
  onMoveStart () {
251
247
  currentPosition.current = null;
252
- stateRef.current.setThumbDragging(index, true);
248
+ state.setThumbDragging(index, true);
253
249
  },
254
250
  onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
255
- const { getThumbPercent: getThumbPercent , setThumbPercent: setThumbPercent , decrementThumb: decrementThumb , incrementThumb: incrementThumb , step: step , pageSize: pageSize } = stateRef.current;
251
+ const { getThumbPercent: getThumbPercent , setThumbPercent: setThumbPercent , decrementThumb: decrementThumb , incrementThumb: incrementThumb , step: step , pageSize: pageSize } = state;
256
252
  let { width: width , height: height } = trackRef.current.getBoundingClientRect();
257
253
  let size = isVertical ? height : width;
258
254
  if (currentPosition.current == null) currentPosition.current = getThumbPercent(index) * size;
@@ -267,7 +263,7 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
267
263
  }
268
264
  },
269
265
  onMoveEnd () {
270
- stateRef.current.setThumbDragging(index, false);
266
+ state.setThumbDragging(index, false);
271
267
  }
272
268
  });
273
269
  // Immediately register editability with the state
@@ -331,7 +327,7 @@ function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
331
327
  "aria-invalid": validationState === "invalid" || undefined,
332
328
  "aria-errormessage": opts["aria-errormessage"],
333
329
  onChange: (e)=>{
334
- stateRef.current.setThumbValue(index, parseFloat(e.target.value));
330
+ state.setThumbValue(index, parseFloat(e.target.value));
335
331
  }
336
332
  }),
337
333
  thumbProps: {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;ACVO,MAAM,4CAAY,IAAI;AAEtB,SAAS,0CAAiB,KAAkB,EAAE,KAAa,EAAE;IAClE,IAAI,KAAK,0CAAU,GAAG,CAAC;IACvB,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,wBAAwB;IAG1C,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC;AACzB;;;;;;;ADmCO,SAAS,yCACd,KAAyB,EACzB,KAAkB,EAClB,QAA4B,EAChB;IACZ,IAAI,cAAC,WAAU,cAAE,WAAU,EAAC,GAAG,CAAA,GAAA,eAAQ,AAAD,EAAE;IAExC,IAAI,aAAa,MAAM,WAAW,KAAK;QAGlB;IADrB,+EAA+E;IAC/E,CAAA,GAAA,yCAAQ,EAAE,GAAG,CAAC,OAAO,CAAA,iBAAA,WAAW,EAAE,cAAb,4BAAA,iBAAiB,WA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QACF;QACA,eAAe,CAAC,IAA0B;YACxC,IAAI,EAAE,MAAM,KAAK,KAAK,EAAE,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,OAAO,EACtD;YAEF,OAAO,EAAE,SAAS;QACpB;QACA,cAAc,CAAC,IAAwB;YAAC,OAAO,EAAE,cAAc,CAAC,EAAE,CAAC,UAAU;QAAE;IACjF,KACE,CAAC,CAAC;IAEN,sEAAsE;IACtE,sEAAsE;IACtE,oEAAoE;IACpE,oEAAoE;IACpE,OAAO;QACL,YAAY,CAAA,GAAA,iBAAU,AAAD,EAAE,gBAAgB,YAAY;YACjD,MAAM;YACN,UAAU,CAAC,aAAa,IAAI,SAAS;YACrC,KAAK,MAAM,gBAAgB,CAAC;YAC5B,KAAK,MAAM,gBAAgB,CAAC;YAC5B,MAAM,MAAM,IAAI;YAChB,OAAO;YACP,UAAU;YACV,oBAAoB;YACpB,kBAAkB,MAAM,kBAAkB,CAAC;YAC3C,iBAAiB,cAAc;YAC/B,gBAAgB,oBAAoB,aAAa;YACjD,qBAAqB,IAAI,CAAC,oBAAoB;YAC9C,UAAU,CAAC,IAAqC;gBAC9C,SAAS,OAAO,CAAC,aAAa,CAAC,OAAO,WAAW,EAAE,MAAM,CAAC,KAAK;YACjE;QACF;QACA,YAAY;YACV,GAAG,YAAY;YACf,OAAO;gBACL,UAAU;gBACV,CAAC,aAAa,QAAQ,MAAM,CAAC,EAAE,CAAC,EAAE,gBAAgB,IAAI,CAAC,CAAC;gBACxD,WAAW;gBACX,aAAa;YACf;QACF;oBACA;QACA,YAAY,MAAM,eAAe,CAAC;oBAClC;mBACA;IACF;AACF;","sources":["packages/@react-aria/slider/src/index.ts","packages/@react-aria/slider/src/useSlider.ts","packages/@react-aria/slider/src/utils.ts","packages/@react-aria/slider/src/useSliderThumb.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSlider} from './useSlider';\nexport {useSliderThumb} from './useSliderThumb';\nexport type {AriaSliderProps} from '@react-types/slider';\nexport type {SliderAria} from './useSlider';\nexport type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb';\nexport type {AriaSliderThumbProps} from '@react-types/slider';\nexport type {Orientation} from '@react-types/shared';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaSliderProps} from '@react-types/slider';\nimport {clamp, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {LabelHTMLAttributes, OutputHTMLAttributes, RefObject, useRef} from 'react';\nimport {setInteractionModality, useMove} from '@react-aria/interactions';\nimport {SliderState} from '@react-stately/slider';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Props for the root element of the slider component; groups slider inputs. */\n groupProps: DOMAttributes,\n\n /** Props for the track element. */\n trackProps: DOMAttributes,\n\n /** Props for the output element, displaying the value of the slider thumbs. */\n outputProps: OutputHTMLAttributes<HTMLOutputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a slider component representing one or more values.\n *\n * @param props Props for the slider.\n * @param state State for the slider, as returned by `useSliderState`.\n * @param trackRef Ref for the \"track\" element. The width of this element provides the \"length\"\n * of the track -- the span of one dimensional space that the slider thumb can be. It also\n * accepts click and drag motions, so that the closest thumb will follow clicks and drags on\n * the track.\n */\nexport function useSlider<T extends number | number[]>(\n props: AriaSliderProps<T>,\n state: SliderState,\n trackRef: RefObject<Element>\n): SliderAria {\n let {labelProps, fieldProps} = useLabel(props);\n\n let isVertical = props.orientation === 'vertical';\n\n // Attach id of the label to the state so it can be accessed by useSliderThumb.\n sliderIds.set(state, labelProps.id ?? fieldProps.id);\n\n let {direction} = useLocale();\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n // When the user clicks or drags the track, we want the motion to set and drag the\n // closest thumb. Hence we also need to install useMove() on the track element.\n // Here, we keep track of which index is the \"closest\" to the drag start point.\n // It is set onMouseDown/onTouchDown; see trackProps below.\n const realTimeTrackDraggingIndex = useRef<number | null>(null);\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n const reverseX = direction === 'rtl';\n const currentPosition = useRef<number>(null);\n const {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n },\n onMove({deltaX, deltaY}) {\n let {height, width} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;\n }\n\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n\n if (realTimeTrackDraggingIndex.current != null && trackRef.current) {\n const percent = clamp(currentPosition.current / size, 0, 1);\n stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);\n }\n },\n onMoveEnd() {\n if (realTimeTrackDraggingIndex.current != null) {\n stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n }\n });\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let onDownTrack = (e: React.UIEvent, id: number, clientX: number, clientY: number) => {\n // We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.\n if (trackRef.current && !props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) {\n let {height, width, top, left} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n // Find the closest thumb\n const trackPosition = isVertical ? top : left;\n const clickPosition = isVertical ? clientY : clientX;\n const offset = clickPosition - trackPosition;\n let percent = offset / size;\n if (direction === 'rtl' || isVertical) {\n percent = 1 - percent;\n }\n let value = state.getPercentValue(percent);\n\n // to find the closet thumb we split the array based on the first thumb position to the \"right/end\" of the click.\n let closestThumb;\n let split = state.values.findIndex(v => value - v < 0);\n if (split === 0) { // If the index is zero then the closetThumb is the first one\n closestThumb = split;\n } else if (split === -1) { // If no index is found they've clicked past all the thumbs\n closestThumb = state.values.length - 1;\n } else {\n let lastLeft = state.values[split - 1];\n let firstRight = state.values[split];\n // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one\n if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) {\n closestThumb = split - 1;\n } else {\n closestThumb = split;\n }\n }\n\n // Confirm that the found closest thumb is editable, not disabled, and move it\n if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {\n // Don't unfocus anything\n e.preventDefault();\n\n realTimeTrackDraggingIndex.current = closestThumb;\n state.setFocusedThumb(closestThumb);\n currentPointer.current = id;\n\n state.setThumbDragging(realTimeTrackDraggingIndex.current, true);\n state.setThumbValue(closestThumb, value);\n\n addGlobalListener(window, 'mouseup', onUpTrack, false);\n addGlobalListener(window, 'touchend', onUpTrack, false);\n addGlobalListener(window, 'pointerup', onUpTrack, false);\n } else {\n realTimeTrackDraggingIndex.current = null;\n }\n }\n };\n\n let onUpTrack = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n\n removeGlobalListener(window, 'mouseup', onUpTrack, false);\n removeGlobalListener(window, 'touchend', onUpTrack, false);\n removeGlobalListener(window, 'pointerup', onUpTrack, false);\n }\n };\n\n if ('htmlFor' in labelProps && labelProps.htmlFor) {\n // Ideally the `for` attribute should point to the first thumb, but VoiceOver on iOS\n // causes this to override the `aria-labelledby` on the thumb. This causes the first\n // thumb to only be announced as the slider label rather than its individual name as well.\n // See https://bugs.webkit.org/show_bug.cgi?id=172464.\n delete labelProps.htmlFor;\n labelProps.onClick = () => {\n // Safari does not focus <input type=\"range\"> elements when clicking on an associated <label>,\n // so do it manually. In addition, make sure we show the focus ring.\n document.getElementById(getSliderThumbId(state, 0))?.focus();\n setInteractionModality('keyboard');\n };\n }\n\n return {\n labelProps,\n // The root element of the Slider will have role=\"group\" to group together\n // all the thumb inputs in the Slider. The label of the Slider will\n // be used to label the group.\n groupProps: {\n role: 'group',\n ...fieldProps\n },\n trackProps: mergeProps({\n onMouseDown(e: React.MouseEvent) {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDownTrack(e, undefined, e.clientX, e.clientY);\n },\n onPointerDown(e: React.PointerEvent) {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onDownTrack(e, e.pointerId, e.clientX, e.clientY);\n },\n onTouchStart(e: React.TouchEvent) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); },\n style: {\n position: 'relative',\n touchAction: 'none'\n }\n }, moveProps),\n outputProps: {\n htmlFor: state.values.map((_, index) => getSliderThumbId(state, index)).join(' '),\n 'aria-live': 'off'\n }\n };\n}\n","import {SliderState} from '@react-stately/slider';\n\nexport const sliderIds = new WeakMap<SliderState, string>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let id = sliderIds.get(state);\n if (!id) {\n throw new Error('Unknown slider state');\n }\n\n return `${id}-${index}`;\n}\n","import {AriaSliderThumbProps} from '@react-types/slider';\nimport {clamp, focusWithoutScrolling, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: DOMAttributes,\n\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n\n /** Props for the label element for this thumb (optional). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Whether this thumb is currently being dragged. */\n isDragging: boolean,\n /** Whether the thumb is currently focused. */\n isFocused: boolean,\n /** Whether the thumb is disabled. */\n isDisabled: boolean\n}\n\nexport interface AriaSliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<Element>,\n /** A ref to the thumb input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: AriaSliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index = 0,\n isRequired,\n validationState,\n trackRef,\n inputRef,\n orientation = state.orientation\n } = opts;\n\n let isDisabled = opts.isDisabled || state.isDisabled;\n let isVertical = orientation === 'vertical';\n\n let {direction} = useLocale();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let labelId = sliderIds.get(state);\n const {labelProps, fieldProps} = useLabel({\n ...opts,\n id: getSliderThumbId(state, index),\n 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim()\n });\n\n const value = state.values[index];\n\n const focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n const isFocused = state.focusedThumb === index;\n\n useEffect(() => {\n if (isFocused) {\n focusInput();\n }\n }, [isFocused, focusInput]);\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n let reverseX = direction === 'rtl';\n let currentPosition = useRef<number>(null);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n let {\n getThumbMaxValue,\n getThumbMinValue,\n decrementThumb,\n incrementThumb,\n setThumbValue,\n setThumbDragging,\n pageSize\n } = stateRef.current;\n // these are the cases that useMove or useSlider don't handle\n if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {\n e.continuePropagation();\n return;\n }\n // same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.\n e.preventDefault();\n // remember to set this so that onChangeEnd is fired\n setThumbDragging(index, true);\n switch (e.key) {\n case 'PageUp':\n incrementThumb(index, pageSize);\n break;\n case 'PageDown':\n decrementThumb(index, pageSize);\n break;\n case 'Home':\n setThumbValue(index, getThumbMinValue(index));\n break;\n case 'End':\n setThumbValue(index, getThumbMaxValue(index));\n break;\n }\n setThumbDragging(index, false);\n }\n });\n\n let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n stateRef.current.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType, shiftKey}) {\n const {\n getThumbPercent,\n setThumbPercent,\n decrementThumb,\n incrementThumb,\n step,\n pageSize\n } = stateRef.current;\n let {width, height} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n if ((deltaX > 0 && reverseX) || (deltaX < 0 && !reverseX) || deltaY > 0) {\n decrementThumb(index, shiftKey ? pageSize : step);\n } else {\n incrementThumb(index, shiftKey ? pageSize : step);\n }\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n setThumbPercent(index, clamp(currentPosition.current / size, 0, 1));\n }\n },\n onMoveEnd() {\n stateRef.current.setThumbDragging(index, false);\n }\n });\n\n // Immediately register editability with the state\n state.setThumbEditable(index, !isDisabled);\n\n const {focusableProps} = useFocusable(\n mergeProps(opts, {\n onFocus: () => state.setFocusedThumb(index),\n onBlur: () => state.setFocusedThumb(undefined)\n }),\n inputRef\n );\n\n let currentPointer = useRef<number | undefined>(undefined);\n let onDown = (id?: number) => {\n focusInput();\n currentPointer.current = id;\n state.setThumbDragging(index, true);\n\n addGlobalListener(window, 'mouseup', onUp, false);\n addGlobalListener(window, 'touchend', onUp, false);\n addGlobalListener(window, 'pointerup', onUp, false);\n\n };\n\n let onUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setThumbDragging(index, false);\n removeGlobalListener(window, 'mouseup', onUp, false);\n removeGlobalListener(window, 'touchend', onUp, false);\n removeGlobalListener(window, 'pointerup', onUp, false);\n }\n };\n\n let thumbPosition = state.getThumbPercent(index);\n if (isVertical || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n let interactions = !isDisabled ? mergeProps(\n keyboardProps,\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {};\n\n // We install mouse handlers for the drag motion on the thumb div, but\n // not the key handler for moving the thumb with the slider. Instead,\n // we focus the range input, and let the browser handle the keyboard\n // interactions; we then listen to input's onChange to update state.\n return {\n inputProps: mergeProps(focusableProps, fieldProps, {\n type: 'range',\n tabIndex: !isDisabled ? 0 : undefined,\n min: state.getThumbMinValue(index),\n max: state.getThumbMaxValue(index),\n step: state.step,\n value: value,\n disabled: isDisabled,\n 'aria-orientation': orientation,\n 'aria-valuetext': state.getThumbValueLabel(index),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': validationState === 'invalid' || undefined,\n 'aria-errormessage': opts['aria-errormessage'],\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n stateRef.current.setThumbValue(index, parseFloat(e.target.value));\n }\n }),\n thumbProps: {\n ...interactions,\n style: {\n position: 'absolute',\n [isVertical ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none'\n }\n },\n labelProps,\n isDragging: state.isThumbDragging(index),\n isDisabled,\n isFocused\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;ACVO,MAAM,4CAAY,IAAI;AAEtB,SAAS,0CAAiB,KAAkB,EAAE,KAAa,EAAE;IAClE,IAAI,KAAK,0CAAU,GAAG,CAAC;IACvB,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,wBAAwB;IAG1C,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC;AACzB;;;;;;;ADmCO,SAAS,yCACd,KAAyB,EACzB,KAAkB,EAClB,QAA4B,EAChB;IACZ,IAAI,cAAC,WAAU,cAAE,WAAU,EAAC,GAAG,CAAA,GAAA,eAAQ,AAAD,EAAE;IAExC,IAAI,aAAa,MAAM,WAAW,KAAK;QAGlB;IADrB,+EAA+E;IAC/E,CAAA,GAAA,yCAAQ,EAAE,GAAG,CAAC,OAAO,CAAA,iBAAA,WAAW,EAAE,cAAb,4BAAA,iBAAiB,WAAW,EAAE;IAEnD,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,gBAAS,AAAD;IAE1B,IAA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,OAAO;QACL,YAAY,CAAA,GAAA,iBAAU,AAAD,EAAE,gBAAgB,YAAY;YACjD,MAAM;YACN,UAAU,CAAC,aAAa,IAAI,SAAS;YACrC,KAAK,MAAM,gBAAgB,CAAC;YAC5B,KAAK,MAAM,gBAAgB,CAAC;YAC5B,MAAM,MAAM,IAAI;YAChB,OAAO;YACP,UAAU;YACV,oBAAoB;YACpB,kBAAkB,MAAM,kBAAkB,CAAC;YAC3C,iBAAiB,cAAc;YAC/B,gBAAgB,oBAAoB,aAAa;YACjD,qBAAqB,IAAI,CAAC,oBAAoB;YAC9C,UAAU,CAAC,IAAqC;gBAC9C,MAAM,aAAa,CAAC,OAAO,WAAW,EAAE,MAAM,CAAC,KAAK;YACtD;QACF;QACA,YAAY;YACV,GAAG,YAAY;YACf,OAAO;gBACL,UAAU;gBACV,CAAC,aAAa,QAAQ,MAAM,CAAC,EAAE,CAAC,EAAE,gBAAgB,IAAI,CAAC,CAAC;gBACxD,WAAW;gBACX,aAAa;YACf;QACF;oBACA;QACA,YAAY,MAAM,eAAe,CAAC;oBAClC;mBACA;IACF;AACF;","sources":["packages/@react-aria/slider/src/index.ts","packages/@react-aria/slider/src/useSlider.ts","packages/@react-aria/slider/src/utils.ts","packages/@react-aria/slider/src/useSliderThumb.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSlider} from './useSlider';\nexport {useSliderThumb} from './useSliderThumb';\nexport type {AriaSliderProps} from '@react-types/slider';\nexport type {SliderAria} from './useSlider';\nexport type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb';\nexport type {AriaSliderThumbProps} from '@react-types/slider';\nexport type {Orientation} from '@react-types/shared';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaSliderProps} from '@react-types/slider';\nimport {clamp, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {LabelHTMLAttributes, OutputHTMLAttributes, RefObject, useRef} from 'react';\nimport {setInteractionModality, useMove} from '@react-aria/interactions';\nimport {SliderState} from '@react-stately/slider';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Props for the root element of the slider component; groups slider inputs. */\n groupProps: DOMAttributes,\n\n /** Props for the track element. */\n trackProps: DOMAttributes,\n\n /** Props for the output element, displaying the value of the slider thumbs. */\n outputProps: OutputHTMLAttributes<HTMLOutputElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a slider component representing one or more values.\n *\n * @param props Props for the slider.\n * @param state State for the slider, as returned by `useSliderState`.\n * @param trackRef Ref for the \"track\" element. The width of this element provides the \"length\"\n * of the track -- the span of one dimensional space that the slider thumb can be. It also\n * accepts click and drag motions, so that the closest thumb will follow clicks and drags on\n * the track.\n */\nexport function useSlider<T extends number | number[]>(\n props: AriaSliderProps<T>,\n state: SliderState,\n trackRef: RefObject<Element>\n): SliderAria {\n let {labelProps, fieldProps} = useLabel(props);\n\n let isVertical = props.orientation === 'vertical';\n\n // Attach id of the label to the state so it can be accessed by useSliderThumb.\n sliderIds.set(state, labelProps.id ?? fieldProps.id);\n\n let {direction} = useLocale();\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n // When the user clicks or drags the track, we want the motion to set and drag the\n // closest thumb. Hence we also need to install useMove() on the track element.\n // Here, we keep track of which index is the \"closest\" to the drag start point.\n // It is set onMouseDown/onTouchDown; see trackProps below.\n const realTimeTrackDraggingIndex = useRef<number | null>(null);\n\n const reverseX = direction === 'rtl';\n const currentPosition = useRef<number>(null);\n const {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n },\n onMove({deltaX, deltaY}) {\n let {height, width} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;\n }\n\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n\n if (realTimeTrackDraggingIndex.current != null && trackRef.current) {\n const percent = clamp(currentPosition.current / size, 0, 1);\n state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);\n }\n },\n onMoveEnd() {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n }\n });\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let onDownTrack = (e: React.UIEvent, id: number, clientX: number, clientY: number) => {\n // We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.\n if (trackRef.current && !props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) {\n let {height, width, top, left} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n // Find the closest thumb\n const trackPosition = isVertical ? top : left;\n const clickPosition = isVertical ? clientY : clientX;\n const offset = clickPosition - trackPosition;\n let percent = offset / size;\n if (direction === 'rtl' || isVertical) {\n percent = 1 - percent;\n }\n let value = state.getPercentValue(percent);\n\n // to find the closet thumb we split the array based on the first thumb position to the \"right/end\" of the click.\n let closestThumb;\n let split = state.values.findIndex(v => value - v < 0);\n if (split === 0) { // If the index is zero then the closetThumb is the first one\n closestThumb = split;\n } else if (split === -1) { // If no index is found they've clicked past all the thumbs\n closestThumb = state.values.length - 1;\n } else {\n let lastLeft = state.values[split - 1];\n let firstRight = state.values[split];\n // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one\n if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) {\n closestThumb = split - 1;\n } else {\n closestThumb = split;\n }\n }\n\n // Confirm that the found closest thumb is editable, not disabled, and move it\n if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {\n // Don't unfocus anything\n e.preventDefault();\n\n realTimeTrackDraggingIndex.current = closestThumb;\n state.setFocusedThumb(closestThumb);\n currentPointer.current = id;\n\n state.setThumbDragging(realTimeTrackDraggingIndex.current, true);\n state.setThumbValue(closestThumb, value);\n\n addGlobalListener(window, 'mouseup', onUpTrack, false);\n addGlobalListener(window, 'touchend', onUpTrack, false);\n addGlobalListener(window, 'pointerup', onUpTrack, false);\n } else {\n realTimeTrackDraggingIndex.current = null;\n }\n }\n };\n\n let onUpTrack = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n\n removeGlobalListener(window, 'mouseup', onUpTrack, false);\n removeGlobalListener(window, 'touchend', onUpTrack, false);\n removeGlobalListener(window, 'pointerup', onUpTrack, false);\n }\n };\n\n if ('htmlFor' in labelProps && labelProps.htmlFor) {\n // Ideally the `for` attribute should point to the first thumb, but VoiceOver on iOS\n // causes this to override the `aria-labelledby` on the thumb. This causes the first\n // thumb to only be announced as the slider label rather than its individual name as well.\n // See https://bugs.webkit.org/show_bug.cgi?id=172464.\n delete labelProps.htmlFor;\n labelProps.onClick = () => {\n // Safari does not focus <input type=\"range\"> elements when clicking on an associated <label>,\n // so do it manually. In addition, make sure we show the focus ring.\n document.getElementById(getSliderThumbId(state, 0))?.focus();\n setInteractionModality('keyboard');\n };\n }\n\n return {\n labelProps,\n // The root element of the Slider will have role=\"group\" to group together\n // all the thumb inputs in the Slider. The label of the Slider will\n // be used to label the group.\n groupProps: {\n role: 'group',\n ...fieldProps\n },\n trackProps: mergeProps({\n onMouseDown(e: React.MouseEvent) {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDownTrack(e, undefined, e.clientX, e.clientY);\n },\n onPointerDown(e: React.PointerEvent) {\n if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {\n return;\n }\n onDownTrack(e, e.pointerId, e.clientX, e.clientY);\n },\n onTouchStart(e: React.TouchEvent) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); },\n style: {\n position: 'relative',\n touchAction: 'none'\n }\n }, moveProps),\n outputProps: {\n htmlFor: state.values.map((_, index) => getSliderThumbId(state, index)).join(' '),\n 'aria-live': 'off'\n }\n };\n}\n","import {SliderState} from '@react-stately/slider';\n\nexport const sliderIds = new WeakMap<SliderState, string>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let id = sliderIds.get(state);\n if (!id) {\n throw new Error('Unknown slider state');\n }\n\n return `${id}-${index}`;\n}\n","import {AriaSliderThumbProps} from '@react-types/slider';\nimport {clamp, focusWithoutScrolling, mergeProps, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: DOMAttributes,\n\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n\n /** Props for the label element for this thumb (optional). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Whether this thumb is currently being dragged. */\n isDragging: boolean,\n /** Whether the thumb is currently focused. */\n isFocused: boolean,\n /** Whether the thumb is disabled. */\n isDisabled: boolean\n}\n\nexport interface AriaSliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<Element>,\n /** A ref to the thumb input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: AriaSliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index = 0,\n isRequired,\n validationState,\n trackRef,\n inputRef,\n orientation = state.orientation\n } = opts;\n\n let isDisabled = opts.isDisabled || state.isDisabled;\n let isVertical = orientation === 'vertical';\n\n let {direction} = useLocale();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let labelId = sliderIds.get(state);\n const {labelProps, fieldProps} = useLabel({\n ...opts,\n id: getSliderThumbId(state, index),\n 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim()\n });\n\n const value = state.values[index];\n\n const focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n const isFocused = state.focusedThumb === index;\n\n useEffect(() => {\n if (isFocused) {\n focusInput();\n }\n }, [isFocused, focusInput]);\n\n let reverseX = direction === 'rtl';\n let currentPosition = useRef<number>(null);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n let {\n getThumbMaxValue,\n getThumbMinValue,\n decrementThumb,\n incrementThumb,\n setThumbValue,\n setThumbDragging,\n pageSize\n } = state;\n // these are the cases that useMove or useSlider don't handle\n if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {\n e.continuePropagation();\n return;\n }\n // same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.\n e.preventDefault();\n // remember to set this so that onChangeEnd is fired\n setThumbDragging(index, true);\n switch (e.key) {\n case 'PageUp':\n incrementThumb(index, pageSize);\n break;\n case 'PageDown':\n decrementThumb(index, pageSize);\n break;\n case 'Home':\n setThumbValue(index, getThumbMinValue(index));\n break;\n case 'End':\n setThumbValue(index, getThumbMaxValue(index));\n break;\n }\n setThumbDragging(index, false);\n }\n });\n\n let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType, shiftKey}) {\n const {\n getThumbPercent,\n setThumbPercent,\n decrementThumb,\n incrementThumb,\n step,\n pageSize\n } = state;\n let {width, height} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n if ((deltaX > 0 && reverseX) || (deltaX < 0 && !reverseX) || deltaY > 0) {\n decrementThumb(index, shiftKey ? pageSize : step);\n } else {\n incrementThumb(index, shiftKey ? pageSize : step);\n }\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n setThumbPercent(index, clamp(currentPosition.current / size, 0, 1));\n }\n },\n onMoveEnd() {\n state.setThumbDragging(index, false);\n }\n });\n\n // Immediately register editability with the state\n state.setThumbEditable(index, !isDisabled);\n\n const {focusableProps} = useFocusable(\n mergeProps(opts, {\n onFocus: () => state.setFocusedThumb(index),\n onBlur: () => state.setFocusedThumb(undefined)\n }),\n inputRef\n );\n\n let currentPointer = useRef<number | undefined>(undefined);\n let onDown = (id?: number) => {\n focusInput();\n currentPointer.current = id;\n state.setThumbDragging(index, true);\n\n addGlobalListener(window, 'mouseup', onUp, false);\n addGlobalListener(window, 'touchend', onUp, false);\n addGlobalListener(window, 'pointerup', onUp, false);\n\n };\n\n let onUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setThumbDragging(index, false);\n removeGlobalListener(window, 'mouseup', onUp, false);\n removeGlobalListener(window, 'touchend', onUp, false);\n removeGlobalListener(window, 'pointerup', onUp, false);\n }\n };\n\n let thumbPosition = state.getThumbPercent(index);\n if (isVertical || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n let interactions = !isDisabled ? mergeProps(\n keyboardProps,\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {};\n\n // We install mouse handlers for the drag motion on the thumb div, but\n // not the key handler for moving the thumb with the slider. Instead,\n // we focus the range input, and let the browser handle the keyboard\n // interactions; we then listen to input's onChange to update state.\n return {\n inputProps: mergeProps(focusableProps, fieldProps, {\n type: 'range',\n tabIndex: !isDisabled ? 0 : undefined,\n min: state.getThumbMinValue(index),\n max: state.getThumbMaxValue(index),\n step: state.step,\n value: value,\n disabled: isDisabled,\n 'aria-orientation': orientation,\n 'aria-valuetext': state.getThumbValueLabel(index),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': validationState === 'invalid' || undefined,\n 'aria-errormessage': opts['aria-errormessage'],\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setThumbValue(index, parseFloat(e.target.value));\n }\n }),\n thumbProps: {\n ...interactions,\n style: {\n position: 'absolute',\n [isVertical ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none'\n }\n },\n labelProps,\n isDragging: state.isThumbDragging(index),\n isDisabled,\n isFocused\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;ACsBA;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAElD,gFAAgF;IAChF,UAAU,EAAE,aAAa,CAAC;IAE1B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAE1B,+EAA+E;IAC/E,WAAW,EAAE,qBAAqB,iBAAiB,CAAC,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,0BAA0B,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EACnD,KAAK,EAAE,gBAAgB,CAAC,CAAC,EACzB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,UAAU,OAAO,CAAC,GAC3B,UAAU,CA0KZ;ACjND;IACE,qEAAqE;IACrE,UAAU,EAAE,aAAa,CAAC;IAE1B,yDAAyD;IACzD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAElD,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAElD,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,uCAAwC,SAAQ,oBAAoB;IAClE,kCAAkC;IAClC,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,EAAE,UAAU,gBAAgB,CAAC,CAAA;CACtC;AAED;;;;;GAKG;AACH,+BACE,IAAI,EAAE,sBAAsB,EAC5B,KAAK,EAAE,WAAW,GACjB,eAAe,CA0NjB;AC1PD,YAAY,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGzD,YAAY,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/slider/src/packages/@react-aria/slider/src/utils.ts","packages/@react-aria/slider/src/packages/@react-aria/slider/src/useSlider.ts","packages/@react-aria/slider/src/packages/@react-aria/slider/src/useSliderThumb.ts","packages/@react-aria/slider/src/packages/@react-aria/slider/src/index.ts","packages/@react-aria/slider/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSlider} from './useSlider';\nexport {useSliderThumb} from './useSliderThumb';\nexport type {AriaSliderProps} from '@react-types/slider';\nexport type {SliderAria} from './useSlider';\nexport type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb';\nexport type {AriaSliderThumbProps} from '@react-types/slider';\nexport type {Orientation} from '@react-types/shared';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;ACsBA;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAElD,gFAAgF;IAChF,UAAU,EAAE,aAAa,CAAC;IAE1B,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAE1B,+EAA+E;IAC/E,WAAW,EAAE,qBAAqB,iBAAiB,CAAC,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,0BAA0B,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EACnD,KAAK,EAAE,gBAAgB,CAAC,CAAC,EACzB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,UAAU,OAAO,CAAC,GAC3B,UAAU,CAwKZ;AC/MD;IACE,qEAAqE;IACrE,UAAU,EAAE,aAAa,CAAC;IAE1B,yDAAyD;IACzD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAElD,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAElD,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,uCAAwC,SAAQ,oBAAoB;IAClE,kCAAkC;IAClC,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,EAAE,UAAU,gBAAgB,CAAC,CAAA;CACtC;AAED;;;;;GAKG;AACH,+BACE,IAAI,EAAE,sBAAsB,EAC5B,KAAK,EAAE,WAAW,GACjB,eAAe,CAwNjB;ACxPD,YAAY,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGzD,YAAY,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/slider/src/packages/@react-aria/slider/src/utils.ts","packages/@react-aria/slider/src/packages/@react-aria/slider/src/useSlider.ts","packages/@react-aria/slider/src/packages/@react-aria/slider/src/useSliderThumb.ts","packages/@react-aria/slider/src/packages/@react-aria/slider/src/index.ts","packages/@react-aria/slider/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useSlider} from './useSlider';\nexport {useSliderThumb} from './useSliderThumb';\nexport type {AriaSliderProps} from '@react-types/slider';\nexport type {SliderAria} from './useSlider';\nexport type {AriaSliderThumbOptions, SliderThumbAria} from './useSliderThumb';\nexport type {AriaSliderThumbProps} from '@react-types/slider';\nexport type {Orientation} from '@react-types/shared';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/slider",
3
- "version": "3.4.2-nightly.3940+b1545c0d2",
3
+ "version": "3.4.2-nightly.3960+16f72e9fb",
4
4
  "description": "Slider",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,16 +22,16 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "3.0.0-nightly.2238+b1545c0d2",
26
- "@react-aria/i18n": "3.0.0-nightly.2238+b1545c0d2",
27
- "@react-aria/interactions": "3.0.0-nightly.2238+b1545c0d2",
28
- "@react-aria/label": "3.0.0-nightly.2238+b1545c0d2",
29
- "@react-aria/utils": "3.0.0-nightly.2238+b1545c0d2",
30
- "@react-stately/radio": "3.0.0-nightly.2238+b1545c0d2",
31
- "@react-stately/slider": "3.3.3-nightly.3940+b1545c0d2",
32
- "@react-types/radio": "3.0.0-nightly.2238+b1545c0d2",
33
- "@react-types/shared": "3.0.0-nightly.2238+b1545c0d2",
34
- "@react-types/slider": "3.5.2-nightly.3940+b1545c0d2",
25
+ "@react-aria/focus": "3.0.0-nightly.2258+16f72e9fb",
26
+ "@react-aria/i18n": "3.0.0-nightly.2258+16f72e9fb",
27
+ "@react-aria/interactions": "3.0.0-nightly.2258+16f72e9fb",
28
+ "@react-aria/label": "3.0.0-nightly.2258+16f72e9fb",
29
+ "@react-aria/utils": "3.0.0-nightly.2258+16f72e9fb",
30
+ "@react-stately/radio": "3.0.0-nightly.2258+16f72e9fb",
31
+ "@react-stately/slider": "3.3.3-nightly.3960+16f72e9fb",
32
+ "@react-types/radio": "3.0.0-nightly.2258+16f72e9fb",
33
+ "@react-types/shared": "3.0.0-nightly.2258+16f72e9fb",
34
+ "@react-types/slider": "3.5.2-nightly.3960+16f72e9fb",
35
35
  "@swc/helpers": "^0.4.14"
36
36
  },
37
37
  "peerDependencies": {
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "b1545c0d225b12672fb6a4e7b787268591d66b90"
43
+ "gitHead": "16f72e9fbfc28adf104c3cb7557f1d3cab617960"
44
44
  }
package/src/useSlider.ts CHANGED
@@ -66,8 +66,6 @@ export function useSlider<T extends number | number[]>(
66
66
  // It is set onMouseDown/onTouchDown; see trackProps below.
67
67
  const realTimeTrackDraggingIndex = useRef<number | null>(null);
68
68
 
69
- const stateRef = useRef<SliderState>(null);
70
- stateRef.current = state;
71
69
  const reverseX = direction === 'rtl';
72
70
  const currentPosition = useRef<number>(null);
73
71
  const {moveProps} = useMove({
@@ -79,7 +77,7 @@ export function useSlider<T extends number | number[]>(
79
77
  let size = isVertical ? height : width;
80
78
 
81
79
  if (currentPosition.current == null) {
82
- currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
80
+ currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
83
81
  }
84
82
 
85
83
  let delta = isVertical ? deltaY : deltaX;
@@ -91,12 +89,12 @@ export function useSlider<T extends number | number[]>(
91
89
 
92
90
  if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
93
91
  const percent = clamp(currentPosition.current / size, 0, 1);
94
- stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
92
+ state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
95
93
  }
96
94
  },
97
95
  onMoveEnd() {
98
96
  if (realTimeTrackDraggingIndex.current != null) {
99
- stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);
97
+ state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
100
98
  realTimeTrackDraggingIndex.current = null;
101
99
  }
102
100
  }
@@ -82,8 +82,6 @@ export function useSliderThumb(
82
82
  }
83
83
  }, [isFocused, focusInput]);
84
84
 
85
- const stateRef = useRef<SliderState>(null);
86
- stateRef.current = state;
87
85
  let reverseX = direction === 'rtl';
88
86
  let currentPosition = useRef<number>(null);
89
87
 
@@ -97,7 +95,7 @@ export function useSliderThumb(
97
95
  setThumbValue,
98
96
  setThumbDragging,
99
97
  pageSize
100
- } = stateRef.current;
98
+ } = state;
101
99
  // these are the cases that useMove or useSlider don't handle
102
100
  if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
103
101
  e.continuePropagation();
@@ -128,7 +126,7 @@ export function useSliderThumb(
128
126
  let {moveProps} = useMove({
129
127
  onMoveStart() {
130
128
  currentPosition.current = null;
131
- stateRef.current.setThumbDragging(index, true);
129
+ state.setThumbDragging(index, true);
132
130
  },
133
131
  onMove({deltaX, deltaY, pointerType, shiftKey}) {
134
132
  const {
@@ -138,7 +136,7 @@ export function useSliderThumb(
138
136
  incrementThumb,
139
137
  step,
140
138
  pageSize
141
- } = stateRef.current;
139
+ } = state;
142
140
  let {width, height} = trackRef.current.getBoundingClientRect();
143
141
  let size = isVertical ? height : width;
144
142
 
@@ -162,7 +160,7 @@ export function useSliderThumb(
162
160
  }
163
161
  },
164
162
  onMoveEnd() {
165
- stateRef.current.setThumbDragging(index, false);
163
+ state.setThumbDragging(index, false);
166
164
  }
167
165
  });
168
166
 
@@ -244,7 +242,7 @@ export function useSliderThumb(
244
242
  'aria-invalid': validationState === 'invalid' || undefined,
245
243
  'aria-errormessage': opts['aria-errormessage'],
246
244
  onChange: (e: ChangeEvent<HTMLInputElement>) => {
247
- stateRef.current.setThumbValue(index, parseFloat(e.target.value));
245
+ state.setThumbValue(index, parseFloat(e.target.value));
248
246
  }
249
247
  }),
250
248
  thumbProps: {