@react-aria/slider 3.0.5-nightly.3111 → 3.0.5
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/main.js +58 -51
- package/dist/main.js.map +1 -1
- package/dist/module.js +57 -50
- package/dist/module.js.map +1 -1
- package/package.json +11 -11
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
1
|
+
var $4hlMt$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $4hlMt$react = require("react");
|
|
3
|
+
var $4hlMt$reactariainteractions = require("@react-aria/interactions");
|
|
4
|
+
var $4hlMt$reactarialabel = require("@react-aria/label");
|
|
5
|
+
var $4hlMt$reactariai18n = require("@react-aria/i18n");
|
|
6
|
+
var $4hlMt$reactariafocus = require("@react-aria/focus");
|
|
7
7
|
|
|
8
8
|
function $parcel$exportWildcard(dest, source) {
|
|
9
9
|
Object.keys(source).forEach(function(key) {
|
|
@@ -24,13 +24,13 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
24
24
|
function $parcel$export(e, n, v, s) {
|
|
25
25
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
26
26
|
}
|
|
27
|
-
var $
|
|
27
|
+
var $8410f0d3cc2f072a$exports = {};
|
|
28
28
|
|
|
29
|
-
$parcel$export($
|
|
29
|
+
$parcel$export($8410f0d3cc2f072a$exports, "useSlider", () => $8410f0d3cc2f072a$export$56b2c08e277f365);
|
|
30
30
|
|
|
31
|
-
const $
|
|
32
|
-
function $
|
|
33
|
-
let id = $
|
|
31
|
+
const $6228e523e3103081$export$7a8d2b02c9371cbf = new WeakMap();
|
|
32
|
+
function $6228e523e3103081$export$68e648cbec363a18(state, index) {
|
|
33
|
+
let id = $6228e523e3103081$export$7a8d2b02c9371cbf.get(state);
|
|
34
34
|
if (!id) throw new Error('Unknown slider state');
|
|
35
35
|
return `${id}-${index}`;
|
|
36
36
|
}
|
|
@@ -40,23 +40,24 @@ function $a834cdc37005ff28$export$68e648cbec363a18(state, index) {
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
function $
|
|
44
|
-
let { labelProps: labelProps , fieldProps: fieldProps } = $
|
|
43
|
+
function $8410f0d3cc2f072a$export$56b2c08e277f365(props, state, trackRef) {
|
|
44
|
+
let { labelProps: labelProps , fieldProps: fieldProps } = $4hlMt$reactarialabel.useLabel(props);
|
|
45
45
|
let isVertical = props.orientation === 'vertical';
|
|
46
|
+
var _id;
|
|
46
47
|
// Attach id of the label to the state so it can be accessed by useSliderThumb.
|
|
47
|
-
$
|
|
48
|
-
let { direction: direction } = $
|
|
49
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
48
|
+
$6228e523e3103081$export$7a8d2b02c9371cbf.set(state, (_id = labelProps.id) !== null && _id !== void 0 ? _id : fieldProps.id);
|
|
49
|
+
let { direction: direction } = $4hlMt$reactariai18n.useLocale();
|
|
50
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $4hlMt$reactariautils.useGlobalListeners();
|
|
50
51
|
// When the user clicks or drags the track, we want the motion to set and drag the
|
|
51
52
|
// closest thumb. Hence we also need to install useMove() on the track element.
|
|
52
53
|
// Here, we keep track of which index is the "closest" to the drag start point.
|
|
53
54
|
// It is set onMouseDown/onTouchDown; see trackProps below.
|
|
54
|
-
const realTimeTrackDraggingIndex = $
|
|
55
|
-
const stateRef = $
|
|
55
|
+
const realTimeTrackDraggingIndex = $4hlMt$react.useRef(null);
|
|
56
|
+
const stateRef = $4hlMt$react.useRef(null);
|
|
56
57
|
stateRef.current = state;
|
|
57
58
|
const reverseX = direction === 'rtl';
|
|
58
|
-
const currentPosition = $
|
|
59
|
-
const { moveProps: moveProps } = $
|
|
59
|
+
const currentPosition = $4hlMt$react.useRef(null);
|
|
60
|
+
const { moveProps: moveProps } = $4hlMt$reactariainteractions.useMove({
|
|
60
61
|
onMoveStart () {
|
|
61
62
|
currentPosition.current = null;
|
|
62
63
|
},
|
|
@@ -67,7 +68,7 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
67
68
|
if (isVertical || reverseX) delta = -delta;
|
|
68
69
|
currentPosition.current += delta;
|
|
69
70
|
if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
|
|
70
|
-
const percent = $
|
|
71
|
+
const percent = $4hlMt$reactariautils.clamp(currentPosition.current / size, 0, 1);
|
|
71
72
|
stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
|
|
72
73
|
}
|
|
73
74
|
},
|
|
@@ -78,7 +79,7 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
|
-
let currentPointer = $
|
|
82
|
+
let currentPointer = $4hlMt$react.useRef(undefined);
|
|
82
83
|
let onDownTrack = (e, id, clientX, clientY)=>{
|
|
83
84
|
// We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.
|
|
84
85
|
if (trackRef.current && !props.isDisabled && state.values.every((_, i)=>!state.isThumbDragging(i)
|
|
@@ -120,7 +121,9 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
123
|
let onUpTrack = (e)=>{
|
|
123
|
-
|
|
124
|
+
var ref;
|
|
125
|
+
var _pointerId;
|
|
126
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
124
127
|
if (id === currentPointer.current) {
|
|
125
128
|
if (realTimeTrackDraggingIndex.current != null) {
|
|
126
129
|
state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
|
|
@@ -138,10 +141,11 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
138
141
|
// See https://bugs.webkit.org/show_bug.cgi?id=172464.
|
|
139
142
|
delete labelProps.htmlFor;
|
|
140
143
|
labelProps.onClick = ()=>{
|
|
141
|
-
// Safari does not focus <input type="range"> elements when clicking on an associated <label>,
|
|
144
|
+
var // Safari does not focus <input type="range"> elements when clicking on an associated <label>,
|
|
142
145
|
// so do it manually. In addition, make sure we show the focus ring.
|
|
143
|
-
|
|
144
|
-
$
|
|
146
|
+
ref;
|
|
147
|
+
(ref = document.getElementById($6228e523e3103081$export$68e648cbec363a18(state, 0))) === null || ref === void 0 ? void 0 : ref.focus();
|
|
148
|
+
$4hlMt$reactariainteractions.setInteractionModality('keyboard');
|
|
145
149
|
};
|
|
146
150
|
}
|
|
147
151
|
return {
|
|
@@ -153,7 +157,7 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
153
157
|
role: 'group',
|
|
154
158
|
...fieldProps
|
|
155
159
|
},
|
|
156
|
-
trackProps: $
|
|
160
|
+
trackProps: $4hlMt$reactariautils.mergeProps({
|
|
157
161
|
onMouseDown (e) {
|
|
158
162
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
159
163
|
onDownTrack(e, undefined, e.clientX, e.clientY);
|
|
@@ -167,7 +171,7 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
167
171
|
}
|
|
168
172
|
}, moveProps),
|
|
169
173
|
outputProps: {
|
|
170
|
-
htmlFor: state.values.map((_, index)=>$
|
|
174
|
+
htmlFor: state.values.map((_, index)=>$6228e523e3103081$export$68e648cbec363a18(state, index)
|
|
171
175
|
).join(' '),
|
|
172
176
|
'aria-live': 'off'
|
|
173
177
|
}
|
|
@@ -175,9 +179,9 @@ function $59b2df71a191ec9b$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
175
179
|
}
|
|
176
180
|
|
|
177
181
|
|
|
178
|
-
var $
|
|
182
|
+
var $e198e8de7fbcfebb$exports = {};
|
|
179
183
|
|
|
180
|
-
$parcel$export($
|
|
184
|
+
$parcel$export($e198e8de7fbcfebb$exports, "useSliderThumb", () => $e198e8de7fbcfebb$export$8d15029008292ae);
|
|
181
185
|
|
|
182
186
|
|
|
183
187
|
|
|
@@ -185,35 +189,36 @@ $parcel$export($d1bbfa318457062f$exports, "useSliderThumb", () => $d1bbfa3184570
|
|
|
185
189
|
|
|
186
190
|
|
|
187
191
|
|
|
188
|
-
function $
|
|
192
|
+
function $e198e8de7fbcfebb$export$8d15029008292ae(opts, state) {
|
|
189
193
|
let { index: index , isRequired: isRequired , isDisabled: isDisabled , validationState: validationState , trackRef: trackRef , inputRef: inputRef } = opts;
|
|
190
194
|
let isVertical = opts.orientation === 'vertical';
|
|
191
|
-
let { direction: direction } = $
|
|
192
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
193
|
-
let labelId = $
|
|
194
|
-
|
|
195
|
+
let { direction: direction } = $4hlMt$reactariai18n.useLocale();
|
|
196
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $4hlMt$reactariautils.useGlobalListeners();
|
|
197
|
+
let labelId = $6228e523e3103081$export$7a8d2b02c9371cbf.get(state);
|
|
198
|
+
var ref1;
|
|
199
|
+
const { labelProps: labelProps , fieldProps: fieldProps } = $4hlMt$reactarialabel.useLabel({
|
|
195
200
|
...opts,
|
|
196
|
-
id: $
|
|
197
|
-
'aria-labelledby': `${labelId} ${opts['aria-labelledby']
|
|
201
|
+
id: $6228e523e3103081$export$68e648cbec363a18(state, index),
|
|
202
|
+
'aria-labelledby': `${labelId} ${(ref1 = opts['aria-labelledby']) !== null && ref1 !== void 0 ? ref1 : ''}`.trim()
|
|
198
203
|
});
|
|
199
204
|
const value = state.values[index];
|
|
200
|
-
const focusInput = $
|
|
201
|
-
if (inputRef.current) $
|
|
205
|
+
const focusInput = $4hlMt$react.useCallback(()=>{
|
|
206
|
+
if (inputRef.current) $4hlMt$reactariautils.focusWithoutScrolling(inputRef.current);
|
|
202
207
|
}, [
|
|
203
208
|
inputRef
|
|
204
209
|
]);
|
|
205
210
|
const isFocused = state.focusedThumb === index;
|
|
206
|
-
$
|
|
211
|
+
$4hlMt$react.useEffect(()=>{
|
|
207
212
|
if (isFocused) focusInput();
|
|
208
213
|
}, [
|
|
209
214
|
isFocused,
|
|
210
215
|
focusInput
|
|
211
216
|
]);
|
|
212
|
-
const stateRef = $
|
|
217
|
+
const stateRef = $4hlMt$react.useRef(null);
|
|
213
218
|
stateRef.current = state;
|
|
214
219
|
let reverseX = direction === 'rtl';
|
|
215
|
-
let currentPosition = $
|
|
216
|
-
let { moveProps: moveProps } = $
|
|
220
|
+
let currentPosition = $4hlMt$react.useRef(null);
|
|
221
|
+
let { moveProps: moveProps } = $4hlMt$reactariainteractions.useMove({
|
|
217
222
|
onMoveStart () {
|
|
218
223
|
currentPosition.current = null;
|
|
219
224
|
state.setThumbDragging(index, true);
|
|
@@ -230,7 +235,7 @@ function $d1bbfa318457062f$export$8d15029008292ae(opts, state) {
|
|
|
230
235
|
let delta = isVertical ? deltaY : deltaX;
|
|
231
236
|
if (isVertical || reverseX) delta = -delta;
|
|
232
237
|
currentPosition.current += delta;
|
|
233
|
-
stateRef.current.setThumbPercent(index, $
|
|
238
|
+
stateRef.current.setThumbPercent(index, $4hlMt$reactariautils.clamp(currentPosition.current / size, 0, 1));
|
|
234
239
|
}
|
|
235
240
|
},
|
|
236
241
|
onMoveEnd () {
|
|
@@ -239,12 +244,12 @@ function $d1bbfa318457062f$export$8d15029008292ae(opts, state) {
|
|
|
239
244
|
});
|
|
240
245
|
// Immediately register editability with the state
|
|
241
246
|
state.setThumbEditable(index, !isDisabled);
|
|
242
|
-
const { focusableProps: focusableProps } = $
|
|
247
|
+
const { focusableProps: focusableProps } = $4hlMt$reactariafocus.useFocusable($4hlMt$reactariautils.mergeProps(opts, {
|
|
243
248
|
onFocus: ()=>state.setFocusedThumb(index)
|
|
244
249
|
,
|
|
245
250
|
onBlur: ()=>state.setFocusedThumb(undefined)
|
|
246
251
|
}), inputRef);
|
|
247
|
-
let currentPointer = $
|
|
252
|
+
let currentPointer = $4hlMt$react.useRef(undefined);
|
|
248
253
|
let onDown = (id)=>{
|
|
249
254
|
focusInput();
|
|
250
255
|
currentPointer.current = id;
|
|
@@ -254,7 +259,9 @@ function $d1bbfa318457062f$export$8d15029008292ae(opts, state) {
|
|
|
254
259
|
addGlobalListener(window, 'pointerup', onUp, false);
|
|
255
260
|
};
|
|
256
261
|
let onUp = (e)=>{
|
|
257
|
-
|
|
262
|
+
var ref;
|
|
263
|
+
var _pointerId;
|
|
264
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
258
265
|
if (id === currentPointer.current) {
|
|
259
266
|
focusInput();
|
|
260
267
|
state.setThumbDragging(index, false);
|
|
@@ -268,7 +275,7 @@ function $d1bbfa318457062f$export$8d15029008292ae(opts, state) {
|
|
|
268
275
|
// we focus the range input, and let the browser handle the keyboard
|
|
269
276
|
// interactions; we then listen to input's onChange to update state.
|
|
270
277
|
return {
|
|
271
|
-
inputProps: $
|
|
278
|
+
inputProps: $4hlMt$reactariautils.mergeProps(focusableProps, fieldProps, {
|
|
272
279
|
type: 'range',
|
|
273
280
|
tabIndex: !isDisabled ? 0 : undefined,
|
|
274
281
|
min: state.getThumbMinValue(index),
|
|
@@ -285,7 +292,7 @@ function $d1bbfa318457062f$export$8d15029008292ae(opts, state) {
|
|
|
285
292
|
state.setThumbValue(index, parseFloat(e.target.value));
|
|
286
293
|
}
|
|
287
294
|
}),
|
|
288
|
-
thumbProps: !isDisabled ? $
|
|
295
|
+
thumbProps: !isDisabled ? $4hlMt$reactariautils.mergeProps(moveProps, {
|
|
289
296
|
onMouseDown: (e)=>{
|
|
290
297
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
291
298
|
onDown();
|
|
@@ -304,8 +311,8 @@ function $d1bbfa318457062f$export$8d15029008292ae(opts, state) {
|
|
|
304
311
|
}
|
|
305
312
|
|
|
306
313
|
|
|
307
|
-
$parcel$exportWildcard(module.exports, $
|
|
308
|
-
$parcel$exportWildcard(module.exports, $
|
|
314
|
+
$parcel$exportWildcard(module.exports, $8410f0d3cc2f072a$exports);
|
|
315
|
+
$parcel$exportWildcard(module.exports, $e198e8de7fbcfebb$exports);
|
|
309
316
|
|
|
310
317
|
|
|
311
318
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEEO,KAAK,CAAC,yCAAS,GAAG,GAAG,CAAC,OAAO;SAEpB,yCAAgB,CAAC,KAAkB,EAAE,KAAa,EAAE,CAAC;IACnE,GAAG,CAAC,EAAE,GAAG,yCAAS,CAAC,GAAG,CAAC,KAAK;IAC5B,EAAE,GAAG,EAAE,EACL,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAsB;IAGxC,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK;AACvB,CAAC;;;;;;;SDkCe,wCAAS,CACvB,KAAsB,EACtB,KAAkB,EAClB,QAAgC,EACpB,CAAC;IACb,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,EAAA,CAAC,GAAG,8BAAQ,CAAC,KAAK;IAE7C,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,KAAK,CAAU;IAEjD,EAA+E,AAA/E,6EAA+E;IAC/E,yCAAS,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,IAAI,UAAU,CAAC,EAAE;IAEnD,GAAG,CAAC,CAAC,YAAA,SAAS,EAAA,CAAC,GAAG,8BAAS;IAE3B,GAAG,CAAC,CAAC,oBAAA,iBAAiB,yBAAE,oBAAoB,EAAA,C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AAC,CAAC,OAAO,EACtD,MAAM;gBAER,MAAM,CAAC,CAAC,CAAC,SAAS;YACpB,CAAC;YACD,YAAY,GAAG,CAAgC,GAAK,CAAC;gBAAA,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU;YAAE,CAAC;QAC/F,CAAC,IACC,CAAC;QAAA,CAAC;oBACN,UAAU;IACZ,CAAC;AACH,CAAC;;","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 */\n\nexport * from './useSlider';\nexport * from './useSliderThumb';\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {HTMLAttributes, 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\ninterface 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: HTMLAttributes<HTMLElement>,\n\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\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(\n props: AriaSliderProps,\n state: SliderState,\n trackRef: RefObject<HTMLElement>\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n // Find the closest thumb\n const trackPosition = trackRef.current.getBoundingClientRect()[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 (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<HTMLElement>) {\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<HTMLElement>) {\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<HTMLElement>) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); }\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMove} from '@react-aria/interactions';\n\ninterface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: HTMLAttributes<HTMLElement>,\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\ninterface SliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<HTMLElement>,\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: SliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index,\n isRequired,\n isDisabled,\n validationState,\n trackRef,\n inputRef\n } = opts;\n\n let isVertical = opts.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 let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n let size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n // (invert left/right according to language direction) + (according to vertical)\n let delta = ((reverseX ? -deltaX : deltaX) + (isVertical ? -deltaY : -deltaY)) * stateRef.current.step;\n currentPosition.current += delta * size;\n stateRef.current.setThumbValue(index, stateRef.current.getThumbValue(index) + delta);\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n stateRef.current.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 // 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': opts.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: !isDisabled ? mergeProps(\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent<HTMLElement>) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {},\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEEO,KAAK,CAAC,yCAAS,GAAG,GAAG,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AI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EACtD,MAAM;gBAER,MAAM,CAAC,CAAC,CAAC,SAAS;YACpB,CAAC;YACD,YAAY,GAAG,CAAgC,GAAK,CAAC;gBAAA,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU;YAAE,CAAC;QAC/F,CAAC,IACC,CAAC;QAAA,CAAC;oBACN,UAAU;IACZ,CAAC;AACH,CAAC;;","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 */\n\nexport * from './useSlider';\nexport * from './useSliderThumb';\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {HTMLAttributes, 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\ninterface 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: HTMLAttributes<HTMLElement>,\n\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\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(\n props: AriaSliderProps,\n state: SliderState,\n trackRef: RefObject<HTMLElement>\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n // Find the closest thumb\n const trackPosition = trackRef.current.getBoundingClientRect()[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 (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<HTMLElement>) {\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<HTMLElement>) {\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<HTMLElement>) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); }\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMove} from '@react-aria/interactions';\n\ninterface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: HTMLAttributes<HTMLElement>,\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\ninterface SliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<HTMLElement>,\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: SliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index,\n isRequired,\n isDisabled,\n validationState,\n trackRef,\n inputRef\n } = opts;\n\n let isVertical = opts.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 let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n let size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n // (invert left/right according to language direction) + (according to vertical)\n let delta = ((reverseX ? -deltaX : deltaX) + (isVertical ? -deltaY : -deltaY)) * stateRef.current.step;\n currentPosition.current += delta * size;\n stateRef.current.setThumbValue(index, stateRef.current.getThumbValue(index) + delta);\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n stateRef.current.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 // 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': opts.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: !isDisabled ? mergeProps(\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent<HTMLElement>) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {},\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {useGlobalListeners as $
|
|
2
|
-
import {useRef as $
|
|
3
|
-
import {useMove as $
|
|
4
|
-
import {useLabel as $
|
|
5
|
-
import {useLocale as $
|
|
6
|
-
import {useFocusable as $
|
|
1
|
+
import {useGlobalListeners as $axlgK$useGlobalListeners, clamp as $axlgK$clamp, mergeProps as $axlgK$mergeProps, focusWithoutScrolling as $axlgK$focusWithoutScrolling} from "@react-aria/utils";
|
|
2
|
+
import {useRef as $axlgK$useRef, useCallback as $axlgK$useCallback, useEffect as $axlgK$useEffect} from "react";
|
|
3
|
+
import {useMove as $axlgK$useMove, setInteractionModality as $axlgK$setInteractionModality} from "@react-aria/interactions";
|
|
4
|
+
import {useLabel as $axlgK$useLabel} from "@react-aria/label";
|
|
5
|
+
import {useLocale as $axlgK$useLocale} from "@react-aria/i18n";
|
|
6
|
+
import {useFocusable as $axlgK$useFocusable} from "@react-aria/focus";
|
|
7
7
|
|
|
8
8
|
function $parcel$export(e, n, v, s) {
|
|
9
9
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
10
|
}
|
|
11
|
-
var $
|
|
11
|
+
var $330dff91662306eb$exports = {};
|
|
12
12
|
|
|
13
|
-
$parcel$export($
|
|
13
|
+
$parcel$export($330dff91662306eb$exports, "useSlider", () => $330dff91662306eb$export$56b2c08e277f365);
|
|
14
14
|
|
|
15
|
-
const $
|
|
16
|
-
function $
|
|
17
|
-
let id = $
|
|
15
|
+
const $8983e12064147eaf$export$7a8d2b02c9371cbf = new WeakMap();
|
|
16
|
+
function $8983e12064147eaf$export$68e648cbec363a18(state, index) {
|
|
17
|
+
let id = $8983e12064147eaf$export$7a8d2b02c9371cbf.get(state);
|
|
18
18
|
if (!id) throw new Error('Unknown slider state');
|
|
19
19
|
return `${id}-${index}`;
|
|
20
20
|
}
|
|
@@ -24,23 +24,24 @@ function $21858bef1d0ccf3b$export$68e648cbec363a18(state, index) {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
function $
|
|
28
|
-
let { labelProps: labelProps , fieldProps: fieldProps } = $
|
|
27
|
+
function $330dff91662306eb$export$56b2c08e277f365(props, state, trackRef) {
|
|
28
|
+
let { labelProps: labelProps , fieldProps: fieldProps } = $axlgK$useLabel(props);
|
|
29
29
|
let isVertical = props.orientation === 'vertical';
|
|
30
|
+
var _id;
|
|
30
31
|
// Attach id of the label to the state so it can be accessed by useSliderThumb.
|
|
31
|
-
$
|
|
32
|
-
let { direction: direction } = $
|
|
33
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
32
|
+
$8983e12064147eaf$export$7a8d2b02c9371cbf.set(state, (_id = labelProps.id) !== null && _id !== void 0 ? _id : fieldProps.id);
|
|
33
|
+
let { direction: direction } = $axlgK$useLocale();
|
|
34
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $axlgK$useGlobalListeners();
|
|
34
35
|
// When the user clicks or drags the track, we want the motion to set and drag the
|
|
35
36
|
// closest thumb. Hence we also need to install useMove() on the track element.
|
|
36
37
|
// Here, we keep track of which index is the "closest" to the drag start point.
|
|
37
38
|
// It is set onMouseDown/onTouchDown; see trackProps below.
|
|
38
|
-
const realTimeTrackDraggingIndex = $
|
|
39
|
-
const stateRef = $
|
|
39
|
+
const realTimeTrackDraggingIndex = $axlgK$useRef(null);
|
|
40
|
+
const stateRef = $axlgK$useRef(null);
|
|
40
41
|
stateRef.current = state;
|
|
41
42
|
const reverseX = direction === 'rtl';
|
|
42
|
-
const currentPosition = $
|
|
43
|
-
const { moveProps: moveProps } = $
|
|
43
|
+
const currentPosition = $axlgK$useRef(null);
|
|
44
|
+
const { moveProps: moveProps } = $axlgK$useMove({
|
|
44
45
|
onMoveStart () {
|
|
45
46
|
currentPosition.current = null;
|
|
46
47
|
},
|
|
@@ -51,7 +52,7 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
51
52
|
if (isVertical || reverseX) delta = -delta;
|
|
52
53
|
currentPosition.current += delta;
|
|
53
54
|
if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
|
|
54
|
-
const percent = $
|
|
55
|
+
const percent = $axlgK$clamp(currentPosition.current / size, 0, 1);
|
|
55
56
|
stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
|
|
56
57
|
}
|
|
57
58
|
},
|
|
@@ -62,7 +63,7 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
|
-
let currentPointer = $
|
|
66
|
+
let currentPointer = $axlgK$useRef(undefined);
|
|
66
67
|
let onDownTrack = (e, id, clientX, clientY)=>{
|
|
67
68
|
// We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.
|
|
68
69
|
if (trackRef.current && !props.isDisabled && state.values.every((_, i)=>!state.isThumbDragging(i)
|
|
@@ -104,7 +105,9 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
104
105
|
}
|
|
105
106
|
};
|
|
106
107
|
let onUpTrack = (e)=>{
|
|
107
|
-
|
|
108
|
+
var ref;
|
|
109
|
+
var _pointerId;
|
|
110
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
108
111
|
if (id === currentPointer.current) {
|
|
109
112
|
if (realTimeTrackDraggingIndex.current != null) {
|
|
110
113
|
state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
|
|
@@ -122,10 +125,11 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
122
125
|
// See https://bugs.webkit.org/show_bug.cgi?id=172464.
|
|
123
126
|
delete labelProps.htmlFor;
|
|
124
127
|
labelProps.onClick = ()=>{
|
|
125
|
-
// Safari does not focus <input type="range"> elements when clicking on an associated <label>,
|
|
128
|
+
var // Safari does not focus <input type="range"> elements when clicking on an associated <label>,
|
|
126
129
|
// so do it manually. In addition, make sure we show the focus ring.
|
|
127
|
-
|
|
128
|
-
$
|
|
130
|
+
ref;
|
|
131
|
+
(ref = document.getElementById($8983e12064147eaf$export$68e648cbec363a18(state, 0))) === null || ref === void 0 ? void 0 : ref.focus();
|
|
132
|
+
$axlgK$setInteractionModality('keyboard');
|
|
129
133
|
};
|
|
130
134
|
}
|
|
131
135
|
return {
|
|
@@ -137,7 +141,7 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
137
141
|
role: 'group',
|
|
138
142
|
...fieldProps
|
|
139
143
|
},
|
|
140
|
-
trackProps: $
|
|
144
|
+
trackProps: $axlgK$mergeProps({
|
|
141
145
|
onMouseDown (e) {
|
|
142
146
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
143
147
|
onDownTrack(e, undefined, e.clientX, e.clientY);
|
|
@@ -151,7 +155,7 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
151
155
|
}
|
|
152
156
|
}, moveProps),
|
|
153
157
|
outputProps: {
|
|
154
|
-
htmlFor: state.values.map((_, index)=>$
|
|
158
|
+
htmlFor: state.values.map((_, index)=>$8983e12064147eaf$export$68e648cbec363a18(state, index)
|
|
155
159
|
).join(' '),
|
|
156
160
|
'aria-live': 'off'
|
|
157
161
|
}
|
|
@@ -159,9 +163,9 @@ function $9006468ca971c07d$export$56b2c08e277f365(props, state, trackRef) {
|
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
|
|
162
|
-
var $
|
|
166
|
+
var $661f0f6c696c467d$exports = {};
|
|
163
167
|
|
|
164
|
-
$parcel$export($
|
|
168
|
+
$parcel$export($661f0f6c696c467d$exports, "useSliderThumb", () => $661f0f6c696c467d$export$8d15029008292ae);
|
|
165
169
|
|
|
166
170
|
|
|
167
171
|
|
|
@@ -169,35 +173,36 @@ $parcel$export($fa28a9d9b8b61e27$exports, "useSliderThumb", () => $fa28a9d9b8b61
|
|
|
169
173
|
|
|
170
174
|
|
|
171
175
|
|
|
172
|
-
function $
|
|
176
|
+
function $661f0f6c696c467d$export$8d15029008292ae(opts, state) {
|
|
173
177
|
let { index: index , isRequired: isRequired , isDisabled: isDisabled , validationState: validationState , trackRef: trackRef , inputRef: inputRef } = opts;
|
|
174
178
|
let isVertical = opts.orientation === 'vertical';
|
|
175
|
-
let { direction: direction } = $
|
|
176
|
-
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $
|
|
177
|
-
let labelId = $
|
|
178
|
-
|
|
179
|
+
let { direction: direction } = $axlgK$useLocale();
|
|
180
|
+
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $axlgK$useGlobalListeners();
|
|
181
|
+
let labelId = $8983e12064147eaf$export$7a8d2b02c9371cbf.get(state);
|
|
182
|
+
var ref1;
|
|
183
|
+
const { labelProps: labelProps , fieldProps: fieldProps } = $axlgK$useLabel({
|
|
179
184
|
...opts,
|
|
180
|
-
id: $
|
|
181
|
-
'aria-labelledby': `${labelId} ${opts['aria-labelledby']
|
|
185
|
+
id: $8983e12064147eaf$export$68e648cbec363a18(state, index),
|
|
186
|
+
'aria-labelledby': `${labelId} ${(ref1 = opts['aria-labelledby']) !== null && ref1 !== void 0 ? ref1 : ''}`.trim()
|
|
182
187
|
});
|
|
183
188
|
const value = state.values[index];
|
|
184
|
-
const focusInput = $
|
|
185
|
-
if (inputRef.current) $
|
|
189
|
+
const focusInput = $axlgK$useCallback(()=>{
|
|
190
|
+
if (inputRef.current) $axlgK$focusWithoutScrolling(inputRef.current);
|
|
186
191
|
}, [
|
|
187
192
|
inputRef
|
|
188
193
|
]);
|
|
189
194
|
const isFocused = state.focusedThumb === index;
|
|
190
|
-
$
|
|
195
|
+
$axlgK$useEffect(()=>{
|
|
191
196
|
if (isFocused) focusInput();
|
|
192
197
|
}, [
|
|
193
198
|
isFocused,
|
|
194
199
|
focusInput
|
|
195
200
|
]);
|
|
196
|
-
const stateRef = $
|
|
201
|
+
const stateRef = $axlgK$useRef(null);
|
|
197
202
|
stateRef.current = state;
|
|
198
203
|
let reverseX = direction === 'rtl';
|
|
199
|
-
let currentPosition = $
|
|
200
|
-
let { moveProps: moveProps } = $
|
|
204
|
+
let currentPosition = $axlgK$useRef(null);
|
|
205
|
+
let { moveProps: moveProps } = $axlgK$useMove({
|
|
201
206
|
onMoveStart () {
|
|
202
207
|
currentPosition.current = null;
|
|
203
208
|
state.setThumbDragging(index, true);
|
|
@@ -214,7 +219,7 @@ function $fa28a9d9b8b61e27$export$8d15029008292ae(opts, state) {
|
|
|
214
219
|
let delta = isVertical ? deltaY : deltaX;
|
|
215
220
|
if (isVertical || reverseX) delta = -delta;
|
|
216
221
|
currentPosition.current += delta;
|
|
217
|
-
stateRef.current.setThumbPercent(index, $
|
|
222
|
+
stateRef.current.setThumbPercent(index, $axlgK$clamp(currentPosition.current / size, 0, 1));
|
|
218
223
|
}
|
|
219
224
|
},
|
|
220
225
|
onMoveEnd () {
|
|
@@ -223,12 +228,12 @@ function $fa28a9d9b8b61e27$export$8d15029008292ae(opts, state) {
|
|
|
223
228
|
});
|
|
224
229
|
// Immediately register editability with the state
|
|
225
230
|
state.setThumbEditable(index, !isDisabled);
|
|
226
|
-
const { focusableProps: focusableProps } = $
|
|
231
|
+
const { focusableProps: focusableProps } = $axlgK$useFocusable($axlgK$mergeProps(opts, {
|
|
227
232
|
onFocus: ()=>state.setFocusedThumb(index)
|
|
228
233
|
,
|
|
229
234
|
onBlur: ()=>state.setFocusedThumb(undefined)
|
|
230
235
|
}), inputRef);
|
|
231
|
-
let currentPointer = $
|
|
236
|
+
let currentPointer = $axlgK$useRef(undefined);
|
|
232
237
|
let onDown = (id)=>{
|
|
233
238
|
focusInput();
|
|
234
239
|
currentPointer.current = id;
|
|
@@ -238,7 +243,9 @@ function $fa28a9d9b8b61e27$export$8d15029008292ae(opts, state) {
|
|
|
238
243
|
addGlobalListener(window, 'pointerup', onUp, false);
|
|
239
244
|
};
|
|
240
245
|
let onUp = (e)=>{
|
|
241
|
-
|
|
246
|
+
var ref;
|
|
247
|
+
var _pointerId;
|
|
248
|
+
let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
|
|
242
249
|
if (id === currentPointer.current) {
|
|
243
250
|
focusInput();
|
|
244
251
|
state.setThumbDragging(index, false);
|
|
@@ -252,7 +259,7 @@ function $fa28a9d9b8b61e27$export$8d15029008292ae(opts, state) {
|
|
|
252
259
|
// we focus the range input, and let the browser handle the keyboard
|
|
253
260
|
// interactions; we then listen to input's onChange to update state.
|
|
254
261
|
return {
|
|
255
|
-
inputProps: $
|
|
262
|
+
inputProps: $axlgK$mergeProps(focusableProps, fieldProps, {
|
|
256
263
|
type: 'range',
|
|
257
264
|
tabIndex: !isDisabled ? 0 : undefined,
|
|
258
265
|
min: state.getThumbMinValue(index),
|
|
@@ -269,7 +276,7 @@ function $fa28a9d9b8b61e27$export$8d15029008292ae(opts, state) {
|
|
|
269
276
|
state.setThumbValue(index, parseFloat(e.target.value));
|
|
270
277
|
}
|
|
271
278
|
}),
|
|
272
|
-
thumbProps: !isDisabled ? $
|
|
279
|
+
thumbProps: !isDisabled ? $axlgK$mergeProps(moveProps, {
|
|
273
280
|
onMouseDown: (e)=>{
|
|
274
281
|
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
275
282
|
onDown();
|
|
@@ -290,5 +297,5 @@ function $fa28a9d9b8b61e27$export$8d15029008292ae(opts, state) {
|
|
|
290
297
|
|
|
291
298
|
|
|
292
299
|
|
|
293
|
-
export {$
|
|
300
|
+
export {$330dff91662306eb$export$56b2c08e277f365 as useSlider, $661f0f6c696c467d$export$8d15029008292ae as useSliderThumb};
|
|
294
301
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AEEO,KAAK,CAAC,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,WAAW;YACpC,CAAgB,iBAAE,KAAK,CAAC,kBAAkB,CAAC,KAAK;YAChD,CAAe,gBAAE,UAAU,IAAI,SAAS;YACxC,CAAc,eAAE,eAAe,KAAK,CAAS,YAAI,SAAS;YAC1D,CAAmB,oBAAE,IAAI,CAAC,CAAmB;YAC7C,QAAQ,GAAG,CAAgC,GAAK,CAAC;gBAC/C,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK;YACtD,CAAC;QACH,CAAC;QACD,UAAU,GAAG,UAAU,GAAG,iBAAU,CAClC,SAAS,EACT,CAAC;YACC,WAAW,GAAG,CAAgC,GAAK,CAAC;gBAClD,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EACtD,MAAM;gBAER,MAAM;YACR,CAAC;YACD,aAAa,GAAG,CAAkC,GAAK,CAAC;gBACtD,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EACtD,MAAM;gBAER,MAAM,CAAC,CAAC,CAAC,SAAS;YACpB,CAAC;YACD,YAAY,GAAG,CAAgC,GAAK,CAAC;gBAAA,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU;YAAE,CAAC;QAC/F,CAAC,IACC,CAAC;QAAA,CAAC;oBACN,UAAU;IACZ,CAAC;AACH,CAAC;;","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 */\n\nexport * from './useSlider';\nexport * from './useSliderThumb';\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {HTMLAttributes, 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\ninterface 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: HTMLAttributes<HTMLElement>,\n\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\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(\n props: AriaSliderProps,\n state: SliderState,\n trackRef: RefObject<HTMLElement>\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n // Find the closest thumb\n const trackPosition = trackRef.current.getBoundingClientRect()[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 (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<HTMLElement>) {\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<HTMLElement>) {\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<HTMLElement>) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); }\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMove} from '@react-aria/interactions';\n\ninterface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: HTMLAttributes<HTMLElement>,\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\ninterface SliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<HTMLElement>,\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: SliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index,\n isRequired,\n isDisabled,\n validationState,\n trackRef,\n inputRef\n } = opts;\n\n let isVertical = opts.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 let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n let size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n // (invert left/right according to language direction) + (according to vertical)\n let delta = ((reverseX ? -deltaX : deltaX) + (isVertical ? -deltaY : -deltaY)) * stateRef.current.step;\n currentPosition.current += delta * size;\n stateRef.current.setThumbValue(index, stateRef.current.getThumbValue(index) + delta);\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n stateRef.current.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 // 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': opts.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: !isDisabled ? mergeProps(\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent<HTMLElement>) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {},\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AEEO,KAAK,CAAC,yCAAS,GAAG,GAAG,CAAC,OAAO;SAEpB,yCAAgB,CAAC,KAAkB,EAAE,KAAa,EAAE,CAAC;IACnE,GAAG,CAAC,EAAE,GAAG,yCAAS,CAAC,GAAG,CAAC,KAAK;IAC5B,EAAE,GAAG,EAAE,EACL,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAsB;IAGxC,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK;AACvB,CAAC;;;;;;;SDkCe,wCAAS,CACvB,KAAsB,EACtB,KAAkB,EAClB,QAAgC,EACpB,CAAC;IACb,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,EAAA,CAAC,GAAG,eAAQ,CAAC,KAAK;IAE7C,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,KAAK,CAAU;QAG5B,GAAa;IADlC,EAA+E,AAA/E,6EAA+E;I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;YACpC,CAAgB,iBAAE,KAAK,CAAC,kBAAkB,CAAC,KAAK;YAChD,CAAe,gBAAE,UAAU,IAAI,SAAS;YACxC,CAAc,eAAE,eAAe,KAAK,CAAS,YAAI,SAAS;YAC1D,CAAmB,oBAAE,IAAI,CAAC,CAAmB;YAC7C,QAAQ,GAAG,CAAgC,GAAK,CAAC;gBAC/C,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK;YACtD,CAAC;QACH,CAAC;QACD,UAAU,GAAG,UAAU,GAAG,iBAAU,CAClC,SAAS,EACT,CAAC;YACC,WAAW,GAAG,CAAgC,GAAK,CAAC;gBAClD,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EACtD,MAAM;gBAER,MAAM;YACR,CAAC;YACD,aAAa,GAAG,CAAkC,GAAK,CAAC;gBACtD,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EACtD,MAAM;gBAER,MAAM,CAAC,CAAC,CAAC,SAAS;YACpB,CAAC;YACD,YAAY,GAAG,CAAgC,GAAK,CAAC;gBAAA,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU;YAAE,CAAC;QAC/F,CAAC,IACC,CAAC;QAAA,CAAC;oBACN,UAAU;IACZ,CAAC;AACH,CAAC;;","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 */\n\nexport * from './useSlider';\nexport * from './useSliderThumb';\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {HTMLAttributes, 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\ninterface 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: HTMLAttributes<HTMLElement>,\n\n /** Props for the track element. */\n trackProps: HTMLAttributes<HTMLElement>,\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(\n props: AriaSliderProps,\n state: SliderState,\n trackRef: RefObject<HTMLElement>\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\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 size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n // Find the closest thumb\n const trackPosition = trackRef.current.getBoundingClientRect()[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 (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<HTMLElement>) {\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<HTMLElement>) {\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<HTMLElement>) { onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY); }\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 {getSliderThumbId, sliderIds} from './utils';\nimport React, {ChangeEvent, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMove} from '@react-aria/interactions';\n\ninterface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: HTMLAttributes<HTMLElement>,\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\ninterface SliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<HTMLElement>,\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: SliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index,\n isRequired,\n isDisabled,\n validationState,\n trackRef,\n inputRef\n } = opts;\n\n let isVertical = opts.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 let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType}) {\n let size = isVertical ? trackRef.current.offsetHeight : trackRef.current.offsetWidth;\n\n if (currentPosition.current == null) {\n currentPosition.current = stateRef.current.getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n // (invert left/right according to language direction) + (according to vertical)\n let delta = ((reverseX ? -deltaX : deltaX) + (isVertical ? -deltaY : -deltaY)) * stateRef.current.step;\n currentPosition.current += delta * size;\n stateRef.current.setThumbValue(index, stateRef.current.getThumbValue(index) + delta);\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n stateRef.current.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 // 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': opts.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: !isDisabled ? mergeProps(\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent<HTMLElement>) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {},\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/slider",
|
|
3
|
-
"version": "3.0.5
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Slider",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/focus": "3.
|
|
22
|
-
"@react-aria/i18n": "3.
|
|
23
|
-
"@react-aria/interactions": "3.
|
|
24
|
-
"@react-aria/label": "3.
|
|
25
|
-
"@react-aria/utils": "3.
|
|
26
|
-
"@react-stately/radio": "3.
|
|
27
|
-
"@react-stately/slider": "3.0.5
|
|
28
|
-
"@react-types/radio": "3.
|
|
29
|
-
"@react-types/slider": "3.0.4
|
|
21
|
+
"@react-aria/focus": "^3.5.2",
|
|
22
|
+
"@react-aria/i18n": "^3.3.6",
|
|
23
|
+
"@react-aria/interactions": "^3.8.1",
|
|
24
|
+
"@react-aria/label": "^3.2.3",
|
|
25
|
+
"@react-aria/utils": "^3.11.2",
|
|
26
|
+
"@react-stately/radio": "^3.3.4",
|
|
27
|
+
"@react-stately/slider": "^3.0.5",
|
|
28
|
+
"@react-types/radio": "^3.1.4",
|
|
29
|
+
"@react-types/slider": "^3.0.4"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
|
|
38
38
|
}
|