@react-aria/slider 3.7.7-nightly.4552 → 3.7.7-nightly.4558
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +2 -352
- package/dist/main.js +4 -354
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -352
- package/dist/module.js.map +1 -1
- package/dist/useSlider.main.js +174 -0
- package/dist/useSlider.main.js.map +1 -0
- package/dist/useSlider.mjs +169 -0
- package/dist/useSlider.module.js +169 -0
- package/dist/useSlider.module.js.map +1 -0
- package/dist/useSliderThumb.main.js +196 -0
- package/dist/useSliderThumb.main.js.map +1 -0
- package/dist/useSliderThumb.mjs +191 -0
- package/dist/useSliderThumb.module.js +191 -0
- package/dist/useSliderThumb.module.js.map +1 -0
- package/dist/utils.main.js +16 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +10 -0
- package/dist/utils.module.js +10 -0
- package/dist/utils.module.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {getSliderThumbId as $aa519ee6cf463259$export$68e648cbec363a18, sliderData as $aa519ee6cf463259$export$d6c8d9636a3dc49c} from "./utils.mjs";
|
|
2
|
+
import {useGlobalListeners as $lSlq7$useGlobalListeners, focusWithoutScrolling as $lSlq7$focusWithoutScrolling, clamp as $lSlq7$clamp, mergeProps as $lSlq7$mergeProps, useFormReset as $lSlq7$useFormReset} from "@react-aria/utils";
|
|
3
|
+
import {useCallback as $lSlq7$useCallback, useEffect as $lSlq7$useEffect, useRef as $lSlq7$useRef} from "react";
|
|
4
|
+
import {useFocusable as $lSlq7$useFocusable} from "@react-aria/focus";
|
|
5
|
+
import {useKeyboard as $lSlq7$useKeyboard, useMove as $lSlq7$useMove} from "@react-aria/interactions";
|
|
6
|
+
import {useLabel as $lSlq7$useLabel} from "@react-aria/label";
|
|
7
|
+
import {useLocale as $lSlq7$useLocale} from "@react-aria/i18n";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
|
|
17
|
+
let { index: index = 0, isRequired: isRequired, validationState: validationState, isInvalid: isInvalid, trackRef: trackRef, inputRef: inputRef, orientation: orientation = state.orientation, name: name } = opts;
|
|
18
|
+
let isDisabled = opts.isDisabled || state.isDisabled;
|
|
19
|
+
let isVertical = orientation === "vertical";
|
|
20
|
+
let { direction: direction } = (0, $lSlq7$useLocale)();
|
|
21
|
+
let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $lSlq7$useGlobalListeners)();
|
|
22
|
+
let data = (0, $aa519ee6cf463259$export$d6c8d9636a3dc49c).get(state);
|
|
23
|
+
var _opts_arialabelledby;
|
|
24
|
+
const { labelProps: labelProps, fieldProps: fieldProps } = (0, $lSlq7$useLabel)({
|
|
25
|
+
...opts,
|
|
26
|
+
id: (0, $aa519ee6cf463259$export$68e648cbec363a18)(state, index),
|
|
27
|
+
"aria-labelledby": `${data.id} ${(_opts_arialabelledby = opts["aria-labelledby"]) !== null && _opts_arialabelledby !== void 0 ? _opts_arialabelledby : ""}`.trim()
|
|
28
|
+
});
|
|
29
|
+
const value = state.values[index];
|
|
30
|
+
const focusInput = (0, $lSlq7$useCallback)(()=>{
|
|
31
|
+
if (inputRef.current) (0, $lSlq7$focusWithoutScrolling)(inputRef.current);
|
|
32
|
+
}, [
|
|
33
|
+
inputRef
|
|
34
|
+
]);
|
|
35
|
+
const isFocused = state.focusedThumb === index;
|
|
36
|
+
(0, $lSlq7$useEffect)(()=>{
|
|
37
|
+
if (isFocused) focusInput();
|
|
38
|
+
}, [
|
|
39
|
+
isFocused,
|
|
40
|
+
focusInput
|
|
41
|
+
]);
|
|
42
|
+
let reverseX = direction === "rtl";
|
|
43
|
+
let currentPosition = (0, $lSlq7$useRef)(null);
|
|
44
|
+
let { keyboardProps: keyboardProps } = (0, $lSlq7$useKeyboard)({
|
|
45
|
+
onKeyDown (e) {
|
|
46
|
+
let { getThumbMaxValue: getThumbMaxValue, getThumbMinValue: getThumbMinValue, decrementThumb: decrementThumb, incrementThumb: incrementThumb, setThumbValue: setThumbValue, setThumbDragging: setThumbDragging, pageSize: pageSize } = state;
|
|
47
|
+
// these are the cases that useMove or useSlider don't handle
|
|
48
|
+
if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
|
|
49
|
+
e.continuePropagation();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
// remember to set this so that onChangeEnd is fired
|
|
55
|
+
setThumbDragging(index, true);
|
|
56
|
+
switch(e.key){
|
|
57
|
+
case "PageUp":
|
|
58
|
+
incrementThumb(index, pageSize);
|
|
59
|
+
break;
|
|
60
|
+
case "PageDown":
|
|
61
|
+
decrementThumb(index, pageSize);
|
|
62
|
+
break;
|
|
63
|
+
case "Home":
|
|
64
|
+
setThumbValue(index, getThumbMinValue(index));
|
|
65
|
+
break;
|
|
66
|
+
case "End":
|
|
67
|
+
setThumbValue(index, getThumbMaxValue(index));
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
setThumbDragging(index, false);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
let { moveProps: moveProps } = (0, $lSlq7$useMove)({
|
|
74
|
+
onMoveStart () {
|
|
75
|
+
currentPosition.current = null;
|
|
76
|
+
state.setThumbDragging(index, true);
|
|
77
|
+
},
|
|
78
|
+
onMove ({ deltaX: deltaX, deltaY: deltaY, pointerType: pointerType, shiftKey: shiftKey }) {
|
|
79
|
+
const { getThumbPercent: getThumbPercent, setThumbPercent: setThumbPercent, decrementThumb: decrementThumb, incrementThumb: incrementThumb, step: step, pageSize: pageSize } = state;
|
|
80
|
+
let { width: width, height: height } = trackRef.current.getBoundingClientRect();
|
|
81
|
+
let size = isVertical ? height : width;
|
|
82
|
+
if (currentPosition.current == null) currentPosition.current = getThumbPercent(index) * size;
|
|
83
|
+
if (pointerType === "keyboard") {
|
|
84
|
+
if (deltaX > 0 && reverseX || deltaX < 0 && !reverseX || deltaY > 0) decrementThumb(index, shiftKey ? pageSize : step);
|
|
85
|
+
else incrementThumb(index, shiftKey ? pageSize : step);
|
|
86
|
+
} else {
|
|
87
|
+
let delta = isVertical ? deltaY : deltaX;
|
|
88
|
+
if (isVertical || reverseX) delta = -delta;
|
|
89
|
+
currentPosition.current += delta;
|
|
90
|
+
setThumbPercent(index, (0, $lSlq7$clamp)(currentPosition.current / size, 0, 1));
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onMoveEnd () {
|
|
94
|
+
state.setThumbDragging(index, false);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
// Immediately register editability with the state
|
|
98
|
+
state.setThumbEditable(index, !isDisabled);
|
|
99
|
+
const { focusableProps: focusableProps } = (0, $lSlq7$useFocusable)((0, $lSlq7$mergeProps)(opts, {
|
|
100
|
+
onFocus: ()=>state.setFocusedThumb(index),
|
|
101
|
+
onBlur: ()=>state.setFocusedThumb(undefined)
|
|
102
|
+
}), inputRef);
|
|
103
|
+
let currentPointer = (0, $lSlq7$useRef)(undefined);
|
|
104
|
+
let onDown = (id)=>{
|
|
105
|
+
focusInput();
|
|
106
|
+
currentPointer.current = id;
|
|
107
|
+
state.setThumbDragging(index, true);
|
|
108
|
+
addGlobalListener(window, "mouseup", onUp, false);
|
|
109
|
+
addGlobalListener(window, "touchend", onUp, false);
|
|
110
|
+
addGlobalListener(window, "pointerup", onUp, false);
|
|
111
|
+
};
|
|
112
|
+
let onUp = (e)=>{
|
|
113
|
+
var _e_changedTouches;
|
|
114
|
+
var _e_pointerId;
|
|
115
|
+
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
116
|
+
if (id === currentPointer.current) {
|
|
117
|
+
focusInput();
|
|
118
|
+
state.setThumbDragging(index, false);
|
|
119
|
+
removeGlobalListener(window, "mouseup", onUp, false);
|
|
120
|
+
removeGlobalListener(window, "touchend", onUp, false);
|
|
121
|
+
removeGlobalListener(window, "pointerup", onUp, false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
let thumbPosition = state.getThumbPercent(index);
|
|
125
|
+
if (isVertical || direction === "rtl") thumbPosition = 1 - thumbPosition;
|
|
126
|
+
let interactions = !isDisabled ? (0, $lSlq7$mergeProps)(keyboardProps, moveProps, {
|
|
127
|
+
onMouseDown: (e)=>{
|
|
128
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
129
|
+
onDown();
|
|
130
|
+
},
|
|
131
|
+
onPointerDown: (e)=>{
|
|
132
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
133
|
+
onDown(e.pointerId);
|
|
134
|
+
},
|
|
135
|
+
onTouchStart: (e)=>{
|
|
136
|
+
onDown(e.changedTouches[0].identifier);
|
|
137
|
+
}
|
|
138
|
+
}) : {};
|
|
139
|
+
(0, $lSlq7$useFormReset)(inputRef, value, (v)=>{
|
|
140
|
+
state.setThumbValue(index, v);
|
|
141
|
+
});
|
|
142
|
+
// We install mouse handlers for the drag motion on the thumb div, but
|
|
143
|
+
// not the key handler for moving the thumb with the slider. Instead,
|
|
144
|
+
// we focus the range input, and let the browser handle the keyboard
|
|
145
|
+
// interactions; we then listen to input's onChange to update state.
|
|
146
|
+
return {
|
|
147
|
+
inputProps: (0, $lSlq7$mergeProps)(focusableProps, fieldProps, {
|
|
148
|
+
type: "range",
|
|
149
|
+
tabIndex: !isDisabled ? 0 : undefined,
|
|
150
|
+
min: state.getThumbMinValue(index),
|
|
151
|
+
max: state.getThumbMaxValue(index),
|
|
152
|
+
step: state.step,
|
|
153
|
+
value: value,
|
|
154
|
+
name: name,
|
|
155
|
+
disabled: isDisabled,
|
|
156
|
+
"aria-orientation": orientation,
|
|
157
|
+
"aria-valuetext": state.getThumbValueLabel(index),
|
|
158
|
+
"aria-required": isRequired || undefined,
|
|
159
|
+
"aria-invalid": isInvalid || validationState === "invalid" || undefined,
|
|
160
|
+
"aria-errormessage": opts["aria-errormessage"],
|
|
161
|
+
"aria-describedby": [
|
|
162
|
+
data["aria-describedby"],
|
|
163
|
+
opts["aria-describedby"]
|
|
164
|
+
].filter(Boolean).join(" "),
|
|
165
|
+
"aria-details": [
|
|
166
|
+
data["aria-details"],
|
|
167
|
+
opts["aria-details"]
|
|
168
|
+
].filter(Boolean).join(" "),
|
|
169
|
+
onChange: (e)=>{
|
|
170
|
+
state.setThumbValue(index, parseFloat(e.target.value));
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
thumbProps: {
|
|
174
|
+
...interactions,
|
|
175
|
+
style: {
|
|
176
|
+
position: "absolute",
|
|
177
|
+
[isVertical ? "top" : "left"]: `${thumbPosition * 100}%`,
|
|
178
|
+
transform: "translate(-50%, -50%)",
|
|
179
|
+
touchAction: "none"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
labelProps: labelProps,
|
|
183
|
+
isDragging: state.isThumbDragging(index),
|
|
184
|
+
isDisabled: isDisabled,
|
|
185
|
+
isFocused: isFocused
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
export {$47b897dc8cdb026b$export$8d15029008292ae as useSliderThumb};
|
|
191
|
+
//# sourceMappingURL=useSliderThumb.mjs.map
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {getSliderThumbId as $aa519ee6cf463259$export$68e648cbec363a18, sliderData as $aa519ee6cf463259$export$d6c8d9636a3dc49c} from "./utils.module.js";
|
|
2
|
+
import {useGlobalListeners as $lSlq7$useGlobalListeners, focusWithoutScrolling as $lSlq7$focusWithoutScrolling, clamp as $lSlq7$clamp, mergeProps as $lSlq7$mergeProps, useFormReset as $lSlq7$useFormReset} from "@react-aria/utils";
|
|
3
|
+
import {useCallback as $lSlq7$useCallback, useEffect as $lSlq7$useEffect, useRef as $lSlq7$useRef} from "react";
|
|
4
|
+
import {useFocusable as $lSlq7$useFocusable} from "@react-aria/focus";
|
|
5
|
+
import {useKeyboard as $lSlq7$useKeyboard, useMove as $lSlq7$useMove} from "@react-aria/interactions";
|
|
6
|
+
import {useLabel as $lSlq7$useLabel} from "@react-aria/label";
|
|
7
|
+
import {useLocale as $lSlq7$useLocale} from "@react-aria/i18n";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
|
|
17
|
+
let { index: index = 0, isRequired: isRequired, validationState: validationState, isInvalid: isInvalid, trackRef: trackRef, inputRef: inputRef, orientation: orientation = state.orientation, name: name } = opts;
|
|
18
|
+
let isDisabled = opts.isDisabled || state.isDisabled;
|
|
19
|
+
let isVertical = orientation === "vertical";
|
|
20
|
+
let { direction: direction } = (0, $lSlq7$useLocale)();
|
|
21
|
+
let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $lSlq7$useGlobalListeners)();
|
|
22
|
+
let data = (0, $aa519ee6cf463259$export$d6c8d9636a3dc49c).get(state);
|
|
23
|
+
var _opts_arialabelledby;
|
|
24
|
+
const { labelProps: labelProps, fieldProps: fieldProps } = (0, $lSlq7$useLabel)({
|
|
25
|
+
...opts,
|
|
26
|
+
id: (0, $aa519ee6cf463259$export$68e648cbec363a18)(state, index),
|
|
27
|
+
"aria-labelledby": `${data.id} ${(_opts_arialabelledby = opts["aria-labelledby"]) !== null && _opts_arialabelledby !== void 0 ? _opts_arialabelledby : ""}`.trim()
|
|
28
|
+
});
|
|
29
|
+
const value = state.values[index];
|
|
30
|
+
const focusInput = (0, $lSlq7$useCallback)(()=>{
|
|
31
|
+
if (inputRef.current) (0, $lSlq7$focusWithoutScrolling)(inputRef.current);
|
|
32
|
+
}, [
|
|
33
|
+
inputRef
|
|
34
|
+
]);
|
|
35
|
+
const isFocused = state.focusedThumb === index;
|
|
36
|
+
(0, $lSlq7$useEffect)(()=>{
|
|
37
|
+
if (isFocused) focusInput();
|
|
38
|
+
}, [
|
|
39
|
+
isFocused,
|
|
40
|
+
focusInput
|
|
41
|
+
]);
|
|
42
|
+
let reverseX = direction === "rtl";
|
|
43
|
+
let currentPosition = (0, $lSlq7$useRef)(null);
|
|
44
|
+
let { keyboardProps: keyboardProps } = (0, $lSlq7$useKeyboard)({
|
|
45
|
+
onKeyDown (e) {
|
|
46
|
+
let { getThumbMaxValue: getThumbMaxValue, getThumbMinValue: getThumbMinValue, decrementThumb: decrementThumb, incrementThumb: incrementThumb, setThumbValue: setThumbValue, setThumbDragging: setThumbDragging, pageSize: pageSize } = state;
|
|
47
|
+
// these are the cases that useMove or useSlider don't handle
|
|
48
|
+
if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
|
|
49
|
+
e.continuePropagation();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
// remember to set this so that onChangeEnd is fired
|
|
55
|
+
setThumbDragging(index, true);
|
|
56
|
+
switch(e.key){
|
|
57
|
+
case "PageUp":
|
|
58
|
+
incrementThumb(index, pageSize);
|
|
59
|
+
break;
|
|
60
|
+
case "PageDown":
|
|
61
|
+
decrementThumb(index, pageSize);
|
|
62
|
+
break;
|
|
63
|
+
case "Home":
|
|
64
|
+
setThumbValue(index, getThumbMinValue(index));
|
|
65
|
+
break;
|
|
66
|
+
case "End":
|
|
67
|
+
setThumbValue(index, getThumbMaxValue(index));
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
setThumbDragging(index, false);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
let { moveProps: moveProps } = (0, $lSlq7$useMove)({
|
|
74
|
+
onMoveStart () {
|
|
75
|
+
currentPosition.current = null;
|
|
76
|
+
state.setThumbDragging(index, true);
|
|
77
|
+
},
|
|
78
|
+
onMove ({ deltaX: deltaX, deltaY: deltaY, pointerType: pointerType, shiftKey: shiftKey }) {
|
|
79
|
+
const { getThumbPercent: getThumbPercent, setThumbPercent: setThumbPercent, decrementThumb: decrementThumb, incrementThumb: incrementThumb, step: step, pageSize: pageSize } = state;
|
|
80
|
+
let { width: width, height: height } = trackRef.current.getBoundingClientRect();
|
|
81
|
+
let size = isVertical ? height : width;
|
|
82
|
+
if (currentPosition.current == null) currentPosition.current = getThumbPercent(index) * size;
|
|
83
|
+
if (pointerType === "keyboard") {
|
|
84
|
+
if (deltaX > 0 && reverseX || deltaX < 0 && !reverseX || deltaY > 0) decrementThumb(index, shiftKey ? pageSize : step);
|
|
85
|
+
else incrementThumb(index, shiftKey ? pageSize : step);
|
|
86
|
+
} else {
|
|
87
|
+
let delta = isVertical ? deltaY : deltaX;
|
|
88
|
+
if (isVertical || reverseX) delta = -delta;
|
|
89
|
+
currentPosition.current += delta;
|
|
90
|
+
setThumbPercent(index, (0, $lSlq7$clamp)(currentPosition.current / size, 0, 1));
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onMoveEnd () {
|
|
94
|
+
state.setThumbDragging(index, false);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
// Immediately register editability with the state
|
|
98
|
+
state.setThumbEditable(index, !isDisabled);
|
|
99
|
+
const { focusableProps: focusableProps } = (0, $lSlq7$useFocusable)((0, $lSlq7$mergeProps)(opts, {
|
|
100
|
+
onFocus: ()=>state.setFocusedThumb(index),
|
|
101
|
+
onBlur: ()=>state.setFocusedThumb(undefined)
|
|
102
|
+
}), inputRef);
|
|
103
|
+
let currentPointer = (0, $lSlq7$useRef)(undefined);
|
|
104
|
+
let onDown = (id)=>{
|
|
105
|
+
focusInput();
|
|
106
|
+
currentPointer.current = id;
|
|
107
|
+
state.setThumbDragging(index, true);
|
|
108
|
+
addGlobalListener(window, "mouseup", onUp, false);
|
|
109
|
+
addGlobalListener(window, "touchend", onUp, false);
|
|
110
|
+
addGlobalListener(window, "pointerup", onUp, false);
|
|
111
|
+
};
|
|
112
|
+
let onUp = (e)=>{
|
|
113
|
+
var _e_changedTouches;
|
|
114
|
+
var _e_pointerId;
|
|
115
|
+
let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
|
|
116
|
+
if (id === currentPointer.current) {
|
|
117
|
+
focusInput();
|
|
118
|
+
state.setThumbDragging(index, false);
|
|
119
|
+
removeGlobalListener(window, "mouseup", onUp, false);
|
|
120
|
+
removeGlobalListener(window, "touchend", onUp, false);
|
|
121
|
+
removeGlobalListener(window, "pointerup", onUp, false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
let thumbPosition = state.getThumbPercent(index);
|
|
125
|
+
if (isVertical || direction === "rtl") thumbPosition = 1 - thumbPosition;
|
|
126
|
+
let interactions = !isDisabled ? (0, $lSlq7$mergeProps)(keyboardProps, moveProps, {
|
|
127
|
+
onMouseDown: (e)=>{
|
|
128
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
129
|
+
onDown();
|
|
130
|
+
},
|
|
131
|
+
onPointerDown: (e)=>{
|
|
132
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
133
|
+
onDown(e.pointerId);
|
|
134
|
+
},
|
|
135
|
+
onTouchStart: (e)=>{
|
|
136
|
+
onDown(e.changedTouches[0].identifier);
|
|
137
|
+
}
|
|
138
|
+
}) : {};
|
|
139
|
+
(0, $lSlq7$useFormReset)(inputRef, value, (v)=>{
|
|
140
|
+
state.setThumbValue(index, v);
|
|
141
|
+
});
|
|
142
|
+
// We install mouse handlers for the drag motion on the thumb div, but
|
|
143
|
+
// not the key handler for moving the thumb with the slider. Instead,
|
|
144
|
+
// we focus the range input, and let the browser handle the keyboard
|
|
145
|
+
// interactions; we then listen to input's onChange to update state.
|
|
146
|
+
return {
|
|
147
|
+
inputProps: (0, $lSlq7$mergeProps)(focusableProps, fieldProps, {
|
|
148
|
+
type: "range",
|
|
149
|
+
tabIndex: !isDisabled ? 0 : undefined,
|
|
150
|
+
min: state.getThumbMinValue(index),
|
|
151
|
+
max: state.getThumbMaxValue(index),
|
|
152
|
+
step: state.step,
|
|
153
|
+
value: value,
|
|
154
|
+
name: name,
|
|
155
|
+
disabled: isDisabled,
|
|
156
|
+
"aria-orientation": orientation,
|
|
157
|
+
"aria-valuetext": state.getThumbValueLabel(index),
|
|
158
|
+
"aria-required": isRequired || undefined,
|
|
159
|
+
"aria-invalid": isInvalid || validationState === "invalid" || undefined,
|
|
160
|
+
"aria-errormessage": opts["aria-errormessage"],
|
|
161
|
+
"aria-describedby": [
|
|
162
|
+
data["aria-describedby"],
|
|
163
|
+
opts["aria-describedby"]
|
|
164
|
+
].filter(Boolean).join(" "),
|
|
165
|
+
"aria-details": [
|
|
166
|
+
data["aria-details"],
|
|
167
|
+
opts["aria-details"]
|
|
168
|
+
].filter(Boolean).join(" "),
|
|
169
|
+
onChange: (e)=>{
|
|
170
|
+
state.setThumbValue(index, parseFloat(e.target.value));
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
thumbProps: {
|
|
174
|
+
...interactions,
|
|
175
|
+
style: {
|
|
176
|
+
position: "absolute",
|
|
177
|
+
[isVertical ? "top" : "left"]: `${thumbPosition * 100}%`,
|
|
178
|
+
transform: "translate(-50%, -50%)",
|
|
179
|
+
touchAction: "none"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
labelProps: labelProps,
|
|
183
|
+
isDragging: state.isThumbDragging(index),
|
|
184
|
+
isDisabled: isDisabled,
|
|
185
|
+
isFocused: isFocused
|
|
186
|
+
};
|
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f,OAAO;gBACL,UAAU;gBACV,CAAC,aAAa,QAAQ,OAAO,EAAE,CAAC,EAAE,gBAAgB,IAAI,CAAC,CAAC;gBACxD,WAAW;gBACX,aAAa;YACf;QACF;oBACA;QACA,YAAY,MAAM,eAAe,CAAC;oBAClC;mBACA;IACF;AACF","sources":["packages/@react-aria/slider/src/useSliderThumb.ts"],"sourcesContent":["import {AriaSliderThumbProps} from '@react-types/slider';\nimport {clamp, focusWithoutScrolling, mergeProps, useFormReset, useGlobalListeners} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {getSliderThumbId, sliderData} from './utils';\nimport React, {ChangeEvent, InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useEffect, useRef} from 'react';\nimport {SliderState} from '@react-stately/slider';\nimport {useFocusable} from '@react-aria/focus';\nimport {useKeyboard, useMove} from '@react-aria/interactions';\nimport {useLabel} from '@react-aria/label';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: DOMAttributes,\n\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n\n /** Props for the label element for this thumb (optional). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n\n /** Whether this thumb is currently being dragged. */\n isDragging: boolean,\n /** Whether the thumb is currently focused. */\n isFocused: boolean,\n /** Whether the thumb is disabled. */\n isDisabled: boolean\n}\n\nexport interface AriaSliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackRef: RefObject<Element>,\n /** A ref to the thumb input element. */\n inputRef: RefObject<HTMLInputElement>\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: AriaSliderThumbOptions,\n state: SliderState\n): SliderThumbAria {\n let {\n index = 0,\n isRequired,\n validationState,\n isInvalid,\n trackRef,\n inputRef,\n orientation = state.orientation,\n name\n } = opts;\n\n let isDisabled = opts.isDisabled || state.isDisabled;\n let isVertical = orientation === 'vertical';\n\n let {direction} = useLocale();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let data = sliderData.get(state);\n const {labelProps, fieldProps} = useLabel({\n ...opts,\n id: getSliderThumbId(state, index),\n 'aria-labelledby': `${data.id} ${opts['aria-labelledby'] ?? ''}`.trim()\n });\n\n const value = state.values[index];\n\n const focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n const isFocused = state.focusedThumb === index;\n\n useEffect(() => {\n if (isFocused) {\n focusInput();\n }\n }, [isFocused, focusInput]);\n\n let reverseX = direction === 'rtl';\n let currentPosition = useRef<number>(null);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n let {\n getThumbMaxValue,\n getThumbMinValue,\n decrementThumb,\n incrementThumb,\n setThumbValue,\n setThumbDragging,\n pageSize\n } = state;\n // these are the cases that useMove or useSlider don't handle\n if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {\n e.continuePropagation();\n return;\n }\n // same handling as useMove, stopPropagation to prevent useSlider from handling the event as well.\n e.preventDefault();\n // remember to set this so that onChangeEnd is fired\n setThumbDragging(index, true);\n switch (e.key) {\n case 'PageUp':\n incrementThumb(index, pageSize);\n break;\n case 'PageDown':\n decrementThumb(index, pageSize);\n break;\n case 'Home':\n setThumbValue(index, getThumbMinValue(index));\n break;\n case 'End':\n setThumbValue(index, getThumbMaxValue(index));\n break;\n }\n setThumbDragging(index, false);\n }\n });\n\n let {moveProps} = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({deltaX, deltaY, pointerType, shiftKey}) {\n const {\n getThumbPercent,\n setThumbPercent,\n decrementThumb,\n incrementThumb,\n step,\n pageSize\n } = state;\n let {width, height} = trackRef.current.getBoundingClientRect();\n let size = isVertical ? height : width;\n\n if (currentPosition.current == null) {\n currentPosition.current = getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n if ((deltaX > 0 && reverseX) || (deltaX < 0 && !reverseX) || deltaY > 0) {\n decrementThumb(index, shiftKey ? pageSize : step);\n } else {\n incrementThumb(index, shiftKey ? pageSize : step);\n }\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (isVertical || reverseX) {\n delta = -delta;\n }\n\n currentPosition.current += delta;\n setThumbPercent(index, clamp(currentPosition.current / size, 0, 1));\n }\n },\n onMoveEnd() {\n state.setThumbDragging(index, false);\n }\n });\n\n // Immediately register editability with the state\n state.setThumbEditable(index, !isDisabled);\n\n const {focusableProps} = useFocusable(\n mergeProps(opts, {\n onFocus: () => state.setFocusedThumb(index),\n onBlur: () => state.setFocusedThumb(undefined)\n }),\n inputRef\n );\n\n let currentPointer = useRef<number | undefined>(undefined);\n let onDown = (id?: number) => {\n focusInput();\n currentPointer.current = id;\n state.setThumbDragging(index, true);\n\n addGlobalListener(window, 'mouseup', onUp, false);\n addGlobalListener(window, 'touchend', onUp, false);\n addGlobalListener(window, 'pointerup', onUp, false);\n\n };\n\n let onUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setThumbDragging(index, false);\n removeGlobalListener(window, 'mouseup', onUp, false);\n removeGlobalListener(window, 'touchend', onUp, false);\n removeGlobalListener(window, 'pointerup', onUp, false);\n }\n };\n\n let thumbPosition = state.getThumbPercent(index);\n if (isVertical || direction === 'rtl') {\n thumbPosition = 1 - thumbPosition;\n }\n\n let interactions = !isDisabled ? mergeProps(\n keyboardProps,\n moveProps,\n {\n onMouseDown: (e: React.MouseEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent) => {onDown(e.changedTouches[0].identifier);}\n }\n ) : {};\n\n useFormReset(inputRef, value, (v) => {\n state.setThumbValue(index, v);\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 name,\n disabled: isDisabled,\n 'aria-orientation': orientation,\n 'aria-valuetext': state.getThumbValueLabel(index),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': isInvalid || validationState === 'invalid' || undefined,\n 'aria-errormessage': opts['aria-errormessage'],\n 'aria-describedby': [data['aria-describedby'], opts['aria-describedby']].filter(Boolean).join(' '),\n 'aria-details': [data['aria-details'], opts['aria-details']].filter(Boolean).join(' '),\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n state.setThumbValue(index, parseFloat(e.target.value));\n }\n }),\n thumbProps: {\n ...interactions,\n style: {\n position: 'absolute',\n [isVertical ? 'top' : 'left']: `${thumbPosition * 100}%`,\n transform: 'translate(-50%, -50%)',\n touchAction: 'none'\n }\n },\n labelProps,\n isDragging: state.isThumbDragging(index),\n isDisabled,\n isFocused\n };\n}\n"],"names":[],"version":3,"file":"useSliderThumb.module.js.map"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
$parcel$export(module.exports, "sliderData", () => $28db8d634be2fa58$export$d6c8d9636a3dc49c);
|
|
7
|
+
$parcel$export(module.exports, "getSliderThumbId", () => $28db8d634be2fa58$export$68e648cbec363a18);
|
|
8
|
+
const $28db8d634be2fa58$export$d6c8d9636a3dc49c = new WeakMap();
|
|
9
|
+
function $28db8d634be2fa58$export$68e648cbec363a18(state, index) {
|
|
10
|
+
let data = $28db8d634be2fa58$export$d6c8d9636a3dc49c.get(state);
|
|
11
|
+
if (!data) throw new Error("Unknown slider state");
|
|
12
|
+
return `${data.id}-${index}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=utils.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;AAQO,MAAM,4CAAa,IAAI;AAEvB,SAAS,0CAAiB,KAAkB,EAAE,KAAa;IAChE,IAAI,OAAO,0CAAW,GAAG,CAAC;IAC1B,IAAI,CAAC,MACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;AAC9B","sources":["packages/@react-aria/slider/src/utils.ts"],"sourcesContent":["import {SliderState} from '@react-stately/slider';\n\ninterface SliderData {\n id: string,\n 'aria-describedby'?: string,\n 'aria-details'?: string\n}\n\nexport const sliderData = new WeakMap<SliderState, SliderData>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let data = sliderData.get(state);\n if (!data) {\n throw new Error('Unknown slider state');\n }\n\n return `${data.id}-${index}`;\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const $aa519ee6cf463259$export$d6c8d9636a3dc49c = new WeakMap();
|
|
2
|
+
function $aa519ee6cf463259$export$68e648cbec363a18(state, index) {
|
|
3
|
+
let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
|
|
4
|
+
if (!data) throw new Error("Unknown slider state");
|
|
5
|
+
return `${data.id}-${index}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export {$aa519ee6cf463259$export$d6c8d9636a3dc49c as sliderData, $aa519ee6cf463259$export$68e648cbec363a18 as getSliderThumbId};
|
|
10
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const $aa519ee6cf463259$export$d6c8d9636a3dc49c = new WeakMap();
|
|
2
|
+
function $aa519ee6cf463259$export$68e648cbec363a18(state, index) {
|
|
3
|
+
let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
|
|
4
|
+
if (!data) throw new Error("Unknown slider state");
|
|
5
|
+
return `${data.id}-${index}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export {$aa519ee6cf463259$export$d6c8d9636a3dc49c as sliderData, $aa519ee6cf463259$export$68e648cbec363a18 as getSliderThumbId};
|
|
10
|
+
//# sourceMappingURL=utils.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAQO,MAAM,4CAAa,IAAI;AAEvB,SAAS,0CAAiB,KAAkB,EAAE,KAAa;IAChE,IAAI,OAAO,0CAAW,GAAG,CAAC;IAC1B,IAAI,CAAC,MACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;AAC9B","sources":["packages/@react-aria/slider/src/utils.ts"],"sourcesContent":["import {SliderState} from '@react-stately/slider';\n\ninterface SliderData {\n id: string,\n 'aria-describedby'?: string,\n 'aria-details'?: string\n}\n\nexport const sliderData = new WeakMap<SliderState, SliderData>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let data = sliderData.get(state);\n if (!data) {\n throw new Error('Unknown slider state');\n }\n\n return `${data.id}-${index}`;\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/slider",
|
|
3
|
-
"version": "3.7.7-nightly.
|
|
3
|
+
"version": "3.7.7-nightly.4558+c5e4b3701",
|
|
4
4
|
"description": "Slider",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
27
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
28
|
-
"@react-aria/label": "3.0.0-nightly.
|
|
29
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
30
|
-
"@react-stately/slider": "3.5.3-nightly.
|
|
31
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
32
|
-
"@react-types/slider": "3.7.2-nightly.
|
|
25
|
+
"@react-aria/focus": "3.0.0-nightly.2846+c5e4b3701",
|
|
26
|
+
"@react-aria/i18n": "3.0.0-nightly.2846+c5e4b3701",
|
|
27
|
+
"@react-aria/interactions": "3.0.0-nightly.2846+c5e4b3701",
|
|
28
|
+
"@react-aria/label": "3.0.0-nightly.2846+c5e4b3701",
|
|
29
|
+
"@react-aria/utils": "3.0.0-nightly.2846+c5e4b3701",
|
|
30
|
+
"@react-stately/slider": "3.5.3-nightly.4558+c5e4b3701",
|
|
31
|
+
"@react-types/shared": "3.0.0-nightly.2846+c5e4b3701",
|
|
32
|
+
"@react-types/slider": "3.7.2-nightly.4558+c5e4b3701",
|
|
33
33
|
"@swc/helpers": "^0.5.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "c5e4b3701fdb89eb551f1b3697ac253f06ef68fa"
|
|
42
42
|
}
|