@eightshift/ui-components 5.0.0 → 5.0.2
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/Button-BpwTmkAe.js +185 -0
- package/dist/Collection-n5d0zIgb.js +2398 -0
- package/dist/Color-lVhk8V_G.js +2452 -0
- package/dist/ColorSwatch-DntWEAC3.js +64 -0
- package/dist/ComboBox-BJpTEATT.js +1915 -0
- package/dist/Dialog-O9uw63D7.js +2317 -0
- package/dist/FieldError-DHrSdE_Q.js +42 -0
- package/dist/FocusScope-BEPI2m7u.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-DDPhPPTQ.js +48 -0
- package/dist/Heading-ba38ScjJ.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input-BmDS8Juy.js +133 -0
- package/dist/Label-JS_ob-kh.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-BTxlCGcc.js +664 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-5aDgmImj.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-CaTBkETC.js +332 -0
- package/dist/Slider-C-S1oEH9.js +853 -0
- package/dist/Text-BuJgePCv.js +16 -0
- package/dist/VisuallyHidden-BYi0pekx.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5908 -0
- package/dist/assets/style-editor.css +5908 -0
- package/dist/assets/style.css +5914 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +396 -0
- package/dist/components/animated-visibility/animated-visibility.js +105 -0
- package/dist/components/base-control/base-control.js +86 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
- package/dist/components/button/button.js +387 -0
- package/dist/components/checkbox/checkbox.js +323 -0
- package/dist/components/color-pickers/color-picker.js +272 -0
- package/dist/components/color-pickers/color-swatch.js +59 -0
- package/dist/components/color-pickers/gradient-editor.js +534 -0
- package/dist/components/color-pickers/solid-color-picker.js +1567 -0
- package/dist/components/component-toggle/component-toggle.js +161 -0
- package/dist/components/container-panel/container-panel.js +131 -0
- package/dist/components/draggable/draggable-context.js +5 -0
- package/dist/components/draggable/draggable-handle.js +46 -0
- package/dist/components/draggable/draggable.js +7320 -0
- package/dist/components/draggable-list/draggable-list-context.js +5 -0
- package/dist/components/draggable-list/draggable-list-item.js +77 -0
- package/dist/components/draggable-list/draggable-list.js +151 -0
- package/dist/components/expandable/expandable.js +342 -0
- package/dist/components/index.js +137 -0
- package/dist/components/input-field/input-field.js +231 -0
- package/dist/components/item-collection/item-collection.js +59 -0
- package/dist/components/layout/hstack.js +30 -0
- package/dist/components/layout/vstack.js +30 -0
- package/dist/components/link-input/link-input.js +284 -0
- package/dist/components/matrix-align/matrix-align.js +134 -0
- package/dist/components/menu/menu.js +285 -0
- package/dist/components/modal/modal.js +305 -0
- package/dist/components/notice/notice.js +123 -0
- package/dist/components/number-picker/number-picker.js +292 -0
- package/dist/components/option-select/option-select.js +264 -0
- package/dist/components/options-panel/options-panel.js +158 -0
- package/dist/components/placeholders/file-placeholder.js +42 -0
- package/dist/components/placeholders/image-placeholder.js +88 -0
- package/dist/components/placeholders/media-placeholder.js +63 -0
- package/dist/components/popover/popover.js +207 -0
- package/dist/components/radio/radio.js +582 -0
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +119 -0
- package/dist/components/repeater/repeater.js +280 -0
- package/dist/components/responsive/mini-responsive.js +498 -0
- package/dist/components/responsive/responsive-legacy.js +343 -0
- package/dist/components/responsive/responsive.js +583 -0
- package/dist/components/responsive-preview/responsive-preview.js +123 -0
- package/dist/components/rich-label/rich-label.js +66 -0
- package/dist/components/select/async-multi-select.js +157 -0
- package/dist/components/select/async-single-select.js +137 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +151 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +26 -0
- package/dist/components/select/single-select.js +131 -0
- package/dist/components/select/styles.js +49 -0
- package/dist/components/select/v2/async-select.js +297 -0
- package/dist/components/select/v2/shared.js +24 -0
- package/dist/components/select/v2/single-select.js +1004 -0
- package/dist/components/slider/column-config-slider.js +210 -0
- package/dist/components/slider/slider.js +345 -0
- package/dist/components/slider/utils.js +94 -0
- package/dist/components/spacer/spacer.js +97 -0
- package/dist/components/tabs/tabs.js +703 -0
- package/dist/components/toggle/switch.js +156 -0
- package/dist/components/toggle/toggle.js +64 -0
- package/dist/components/toggle-button/toggle-button.js +343 -0
- package/dist/components/tooltip/tooltip.js +527 -0
- package/dist/context-BbYZoHvX.js +92 -0
- package/dist/default-i18n-CT_oS1Fy.js +922 -0
- package/dist/filterDOMProps-EDDcM64A.js +28 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +113 -0
- package/dist/icons/icons.js +30495 -0
- package/dist/icons/index.js +11 -0
- package/dist/icons/jsx-svg.js +50 -0
- package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
- package/dist/index-BljRBEr_.js +44 -0
- package/dist/index-CFozsmNS.js +28321 -0
- package/dist/index.js +139 -0
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
- package/dist/number-GajL10e1.js +36 -0
- package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
- package/dist/react-select-async.esm-D937XTWW.js +107 -0
- package/dist/react-select.esm-Ciai3aKf.js +15 -0
- package/dist/style-admin.js +1 -0
- package/dist/style-editor.js +1 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-8DpK8fJl.js +46 -0
- package/dist/useButton-Bt3BffJm.js +50 -0
- package/dist/useEvent-ICdlokG-.js +23 -0
- package/dist/useFocusRing-Bv0UJQl8.js +107 -0
- package/dist/useFormReset-D2YaWRIA.js +22 -0
- package/dist/useFormValidation-Dy0PXJg5.js +224 -0
- package/dist/useHover-C2SkI1Fn.js +895 -0
- package/dist/useLabel-BPCd5c7-.js +27 -0
- package/dist/useLabels-B7-lUnAF.js +23 -0
- package/dist/useListState-DkyH7elT.js +168 -0
- package/dist/useLocalizedStringFormatter-C9GO0IDB.js +121 -0
- package/dist/useNumberField-CU1_u8ze.js +1215 -0
- package/dist/useNumberFormatter-CZ9QUnRt.js +13 -0
- package/dist/usePress-BrJylgPR.js +688 -0
- package/dist/useSingleSelectListState-C4sorv2p.js +38 -0
- package/dist/useToggle-CDa3YAZI.js +59 -0
- package/dist/useToggleState-ibcBUHnB.js +19 -0
- package/dist/utilities/array-helpers.js +56 -0
- package/dist/utilities/debounce-throttle.js +123 -0
- package/dist/utilities/es-dash.js +382 -0
- package/dist/utilities/index.js +27 -0
- package/dist/utilities/text-helpers.js +136 -0
- package/dist/utils-CZt7LCbO.js +403 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +24 -24
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, d as $3ef42575df84b30b$export$9d1611c77c2fe928, a as $64fa3d84918910a7$export$29f1550f4b0d4415, g as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, b as $64fa3d84918910a7$export$4d86445c2cf5e3, i as $64fa3d84918910a7$export$2881499e37b75b9a, $ as $64fa3d84918910a7$export$fabf2dc03a41866e } from "./utils-CZt7LCbO.js";
|
|
2
|
+
import { a as $01b77f81d0f07f68$export$75b6ee27786ba447 } from "./Label-JS_ob-kh.js";
|
|
3
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
4
|
+
import React__default, { useRef, useMemo, useCallback, useState, useEffect, forwardRef, createContext, useContext } from "react";
|
|
5
|
+
import { $ as $a916eb452884faea$export$b7a616150fdb9f44 } from "./useNumberFormatter-CZ9QUnRt.js";
|
|
6
|
+
import { g as $03deb23ff14920c4$export$4eaf04e54aa8eed6, b as $458b0a5536c1a7cf$export$40bfa8c7b0832715, q as $507fabe10e71c6fb$export$8397ddfc504fdb9a, z as $7215afc6de606d6b$export$de79e2c695e052f3, A as $46d819fcbaf35654$export$8f71654801c2f7cd, a as $f645667febf57a63$export$4c014de7c8940b4c, $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "./useHover-C2SkI1Fn.js";
|
|
7
|
+
import { $ as $9446cca9a3875146$export$cb6e0bb50bc19463, a as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-GajL10e1.js";
|
|
8
|
+
import { $ as $14c0b72509d70225$export$b0d6fa1ab32e3295, a as $14c0b72509d70225$export$16a4697467175487 } from "./textSelection-8DpK8fJl.js";
|
|
9
|
+
import { $ as $d191a55c9702f145$export$8467354a121f1b9f } from "./useLabel-BPCd5c7-.js";
|
|
10
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-BbYZoHvX.js";
|
|
11
|
+
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-D2YaWRIA.js";
|
|
12
|
+
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-Bv0UJQl8.js";
|
|
13
|
+
import { $ as $5c3e21d68f1c4674$export$439d29a4e110a164 } from "./VisuallyHidden-BYi0pekx.js";
|
|
14
|
+
function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
15
|
+
let { onMoveStart, onMove, onMoveEnd } = props;
|
|
16
|
+
let state = useRef({
|
|
17
|
+
didMove: false,
|
|
18
|
+
lastPosition: null,
|
|
19
|
+
id: null
|
|
20
|
+
});
|
|
21
|
+
let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
22
|
+
let move = $8ae05eaa5c114e9c$export$7f54fc3180508a52((originalEvent, pointerType, deltaX, deltaY) => {
|
|
23
|
+
if (deltaX === 0 && deltaY === 0) return;
|
|
24
|
+
if (!state.current.didMove) {
|
|
25
|
+
state.current.didMove = true;
|
|
26
|
+
onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
|
|
27
|
+
type: "movestart",
|
|
28
|
+
pointerType,
|
|
29
|
+
shiftKey: originalEvent.shiftKey,
|
|
30
|
+
metaKey: originalEvent.metaKey,
|
|
31
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
32
|
+
altKey: originalEvent.altKey
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
onMove === null || onMove === void 0 ? void 0 : onMove({
|
|
36
|
+
type: "move",
|
|
37
|
+
pointerType,
|
|
38
|
+
deltaX,
|
|
39
|
+
deltaY,
|
|
40
|
+
shiftKey: originalEvent.shiftKey,
|
|
41
|
+
metaKey: originalEvent.metaKey,
|
|
42
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
43
|
+
altKey: originalEvent.altKey
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
let end = $8ae05eaa5c114e9c$export$7f54fc3180508a52((originalEvent, pointerType) => {
|
|
47
|
+
$14c0b72509d70225$export$b0d6fa1ab32e3295();
|
|
48
|
+
if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
|
49
|
+
type: "moveend",
|
|
50
|
+
pointerType,
|
|
51
|
+
shiftKey: originalEvent.shiftKey,
|
|
52
|
+
metaKey: originalEvent.metaKey,
|
|
53
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
54
|
+
altKey: originalEvent.altKey
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
let moveProps = useMemo(() => {
|
|
58
|
+
let moveProps2 = {};
|
|
59
|
+
let start = () => {
|
|
60
|
+
$14c0b72509d70225$export$16a4697467175487();
|
|
61
|
+
state.current.didMove = false;
|
|
62
|
+
};
|
|
63
|
+
if (typeof PointerEvent === "undefined" && process.env.NODE_ENV === "test") {
|
|
64
|
+
let onMouseMove = (e) => {
|
|
65
|
+
if (e.button === 0) {
|
|
66
|
+
var _state_current_lastPosition, _state_current_lastPosition1;
|
|
67
|
+
var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
|
|
68
|
+
move(e, "mouse", e.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
|
|
69
|
+
state.current.lastPosition = {
|
|
70
|
+
pageX: e.pageX,
|
|
71
|
+
pageY: e.pageY
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
let onMouseUp = (e) => {
|
|
76
|
+
if (e.button === 0) {
|
|
77
|
+
end(e, "mouse");
|
|
78
|
+
removeGlobalListener(window, "mousemove", onMouseMove, false);
|
|
79
|
+
removeGlobalListener(window, "mouseup", onMouseUp, false);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
moveProps2.onMouseDown = (e) => {
|
|
83
|
+
if (e.button === 0) {
|
|
84
|
+
start();
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
state.current.lastPosition = {
|
|
88
|
+
pageX: e.pageX,
|
|
89
|
+
pageY: e.pageY
|
|
90
|
+
};
|
|
91
|
+
addGlobalListener(window, "mousemove", onMouseMove, false);
|
|
92
|
+
addGlobalListener(window, "mouseup", onMouseUp, false);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
let onTouchMove = (e) => {
|
|
96
|
+
let touch = [
|
|
97
|
+
...e.changedTouches
|
|
98
|
+
].findIndex(({ identifier }) => identifier === state.current.id);
|
|
99
|
+
if (touch >= 0) {
|
|
100
|
+
var _state_current_lastPosition, _state_current_lastPosition1;
|
|
101
|
+
let { pageX, pageY } = e.changedTouches[touch];
|
|
102
|
+
var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
|
|
103
|
+
move(e, "touch", pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
|
|
104
|
+
state.current.lastPosition = {
|
|
105
|
+
pageX,
|
|
106
|
+
pageY
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
let onTouchEnd = (e) => {
|
|
111
|
+
let touch = [
|
|
112
|
+
...e.changedTouches
|
|
113
|
+
].findIndex(({ identifier }) => identifier === state.current.id);
|
|
114
|
+
if (touch >= 0) {
|
|
115
|
+
end(e, "touch");
|
|
116
|
+
state.current.id = null;
|
|
117
|
+
removeGlobalListener(window, "touchmove", onTouchMove);
|
|
118
|
+
removeGlobalListener(window, "touchend", onTouchEnd);
|
|
119
|
+
removeGlobalListener(window, "touchcancel", onTouchEnd);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
moveProps2.onTouchStart = (e) => {
|
|
123
|
+
if (e.changedTouches.length === 0 || state.current.id != null) return;
|
|
124
|
+
let { pageX, pageY, identifier } = e.changedTouches[0];
|
|
125
|
+
start();
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
state.current.lastPosition = {
|
|
129
|
+
pageX,
|
|
130
|
+
pageY
|
|
131
|
+
};
|
|
132
|
+
state.current.id = identifier;
|
|
133
|
+
addGlobalListener(window, "touchmove", onTouchMove, false);
|
|
134
|
+
addGlobalListener(window, "touchend", onTouchEnd, false);
|
|
135
|
+
addGlobalListener(window, "touchcancel", onTouchEnd, false);
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
let onPointerMove = (e) => {
|
|
139
|
+
if (e.pointerId === state.current.id) {
|
|
140
|
+
var _state_current_lastPosition, _state_current_lastPosition1;
|
|
141
|
+
let pointerType = e.pointerType || "mouse";
|
|
142
|
+
var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
|
|
143
|
+
move(e, pointerType, e.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
|
|
144
|
+
state.current.lastPosition = {
|
|
145
|
+
pageX: e.pageX,
|
|
146
|
+
pageY: e.pageY
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
let onPointerUp = (e) => {
|
|
151
|
+
if (e.pointerId === state.current.id) {
|
|
152
|
+
let pointerType = e.pointerType || "mouse";
|
|
153
|
+
end(e, pointerType);
|
|
154
|
+
state.current.id = null;
|
|
155
|
+
removeGlobalListener(window, "pointermove", onPointerMove, false);
|
|
156
|
+
removeGlobalListener(window, "pointerup", onPointerUp, false);
|
|
157
|
+
removeGlobalListener(window, "pointercancel", onPointerUp, false);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
moveProps2.onPointerDown = (e) => {
|
|
161
|
+
if (e.button === 0 && state.current.id == null) {
|
|
162
|
+
start();
|
|
163
|
+
e.stopPropagation();
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
state.current.lastPosition = {
|
|
166
|
+
pageX: e.pageX,
|
|
167
|
+
pageY: e.pageY
|
|
168
|
+
};
|
|
169
|
+
state.current.id = e.pointerId;
|
|
170
|
+
addGlobalListener(window, "pointermove", onPointerMove, false);
|
|
171
|
+
addGlobalListener(window, "pointerup", onPointerUp, false);
|
|
172
|
+
addGlobalListener(window, "pointercancel", onPointerUp, false);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
let triggerKeyboardMove = (e, deltaX, deltaY) => {
|
|
177
|
+
start();
|
|
178
|
+
move(e, "keyboard", deltaX, deltaY);
|
|
179
|
+
end(e, "keyboard");
|
|
180
|
+
};
|
|
181
|
+
moveProps2.onKeyDown = (e) => {
|
|
182
|
+
switch (e.key) {
|
|
183
|
+
case "Left":
|
|
184
|
+
case "ArrowLeft":
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
e.stopPropagation();
|
|
187
|
+
triggerKeyboardMove(e, -1, 0);
|
|
188
|
+
break;
|
|
189
|
+
case "Right":
|
|
190
|
+
case "ArrowRight":
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
triggerKeyboardMove(e, 1, 0);
|
|
194
|
+
break;
|
|
195
|
+
case "Up":
|
|
196
|
+
case "ArrowUp":
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
e.stopPropagation();
|
|
199
|
+
triggerKeyboardMove(e, 0, -1);
|
|
200
|
+
break;
|
|
201
|
+
case "Down":
|
|
202
|
+
case "ArrowDown":
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
e.stopPropagation();
|
|
205
|
+
triggerKeyboardMove(e, 0, 1);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
return moveProps2;
|
|
210
|
+
}, [
|
|
211
|
+
state,
|
|
212
|
+
addGlobalListener,
|
|
213
|
+
removeGlobalListener,
|
|
214
|
+
move,
|
|
215
|
+
end
|
|
216
|
+
]);
|
|
217
|
+
return {
|
|
218
|
+
moveProps
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE = 0;
|
|
222
|
+
const $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE = 100;
|
|
223
|
+
const $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE = 1;
|
|
224
|
+
function $28f99e3e86e6ec45$export$e5fda3247f5d67f9(props) {
|
|
225
|
+
const { isDisabled = false, minValue = $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE, maxValue = $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE, numberFormatter: formatter, step = $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE, orientation = "horizontal" } = props;
|
|
226
|
+
let pageSize = useMemo(() => {
|
|
227
|
+
let calcPageSize = (maxValue - minValue) / 10;
|
|
228
|
+
calcPageSize = $9446cca9a3875146$export$cb6e0bb50bc19463(calcPageSize, 0, calcPageSize + step, step);
|
|
229
|
+
return Math.max(calcPageSize, step);
|
|
230
|
+
}, [
|
|
231
|
+
step,
|
|
232
|
+
maxValue,
|
|
233
|
+
minValue
|
|
234
|
+
]);
|
|
235
|
+
let restrictValues = useCallback((values2) => values2 === null || values2 === void 0 ? void 0 : values2.map((val, idx) => {
|
|
236
|
+
let min = idx === 0 ? minValue : values2[idx - 1];
|
|
237
|
+
let max = idx === values2.length - 1 ? maxValue : values2[idx + 1];
|
|
238
|
+
return $9446cca9a3875146$export$cb6e0bb50bc19463(val, min, max, step);
|
|
239
|
+
}), [
|
|
240
|
+
minValue,
|
|
241
|
+
maxValue,
|
|
242
|
+
step
|
|
243
|
+
]);
|
|
244
|
+
let value = useMemo(() => restrictValues($28f99e3e86e6ec45$var$convertValue(props.value)), [
|
|
245
|
+
props.value
|
|
246
|
+
]);
|
|
247
|
+
let defaultValue = useMemo(() => {
|
|
248
|
+
var _convertValue;
|
|
249
|
+
return restrictValues((_convertValue = $28f99e3e86e6ec45$var$convertValue(props.defaultValue)) !== null && _convertValue !== void 0 ? _convertValue : [
|
|
250
|
+
minValue
|
|
251
|
+
]);
|
|
252
|
+
}, [
|
|
253
|
+
props.defaultValue,
|
|
254
|
+
minValue
|
|
255
|
+
]);
|
|
256
|
+
let onChange = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChange);
|
|
257
|
+
let onChangeEnd = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChangeEnd);
|
|
258
|
+
const [values, setValuesState] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange);
|
|
259
|
+
const [isDraggings, setDraggingsState] = useState(new Array(values.length).fill(false));
|
|
260
|
+
const isEditablesRef = useRef(new Array(values.length).fill(true));
|
|
261
|
+
const [focusedIndex, setFocusedIndex] = useState(void 0);
|
|
262
|
+
const valuesRef = useRef(values);
|
|
263
|
+
const isDraggingsRef = useRef(isDraggings);
|
|
264
|
+
let setValues = (values2) => {
|
|
265
|
+
valuesRef.current = values2;
|
|
266
|
+
setValuesState(values2);
|
|
267
|
+
};
|
|
268
|
+
let setDraggings = (draggings) => {
|
|
269
|
+
isDraggingsRef.current = draggings;
|
|
270
|
+
setDraggingsState(draggings);
|
|
271
|
+
};
|
|
272
|
+
function getValuePercent(value2) {
|
|
273
|
+
return (value2 - minValue) / (maxValue - minValue);
|
|
274
|
+
}
|
|
275
|
+
function getThumbMinValue(index) {
|
|
276
|
+
return index === 0 ? minValue : values[index - 1];
|
|
277
|
+
}
|
|
278
|
+
function getThumbMaxValue(index) {
|
|
279
|
+
return index === values.length - 1 ? maxValue : values[index + 1];
|
|
280
|
+
}
|
|
281
|
+
function isThumbEditable(index) {
|
|
282
|
+
return isEditablesRef.current[index];
|
|
283
|
+
}
|
|
284
|
+
function setThumbEditable(index, editable) {
|
|
285
|
+
isEditablesRef.current[index] = editable;
|
|
286
|
+
}
|
|
287
|
+
function updateValue(index, value2) {
|
|
288
|
+
if (isDisabled || !isThumbEditable(index)) return;
|
|
289
|
+
const thisMin = getThumbMinValue(index);
|
|
290
|
+
const thisMax = getThumbMaxValue(index);
|
|
291
|
+
value2 = $9446cca9a3875146$export$cb6e0bb50bc19463(value2, thisMin, thisMax, step);
|
|
292
|
+
let newValues = $28f99e3e86e6ec45$var$replaceIndex(valuesRef.current, index, value2);
|
|
293
|
+
setValues(newValues);
|
|
294
|
+
}
|
|
295
|
+
function updateDragging(index, dragging) {
|
|
296
|
+
if (isDisabled || !isThumbEditable(index)) return;
|
|
297
|
+
if (dragging) valuesRef.current = values;
|
|
298
|
+
const wasDragging = isDraggingsRef.current[index];
|
|
299
|
+
isDraggingsRef.current = $28f99e3e86e6ec45$var$replaceIndex(isDraggingsRef.current, index, dragging);
|
|
300
|
+
setDraggings(isDraggingsRef.current);
|
|
301
|
+
if (onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean)) onChangeEnd(valuesRef.current);
|
|
302
|
+
}
|
|
303
|
+
function getFormattedValue(value2) {
|
|
304
|
+
return formatter.format(value2);
|
|
305
|
+
}
|
|
306
|
+
function setThumbPercent(index, percent) {
|
|
307
|
+
updateValue(index, getPercentValue(percent));
|
|
308
|
+
}
|
|
309
|
+
function getRoundedValue(value2) {
|
|
310
|
+
return Math.round((value2 - minValue) / step) * step + minValue;
|
|
311
|
+
}
|
|
312
|
+
function getPercentValue(percent) {
|
|
313
|
+
const val = percent * (maxValue - minValue) + minValue;
|
|
314
|
+
return $9446cca9a3875146$export$7d15b64cf5a3a4c4(getRoundedValue(val), minValue, maxValue);
|
|
315
|
+
}
|
|
316
|
+
function incrementThumb(index, stepSize = 1) {
|
|
317
|
+
let s = Math.max(stepSize, step);
|
|
318
|
+
updateValue(index, $9446cca9a3875146$export$cb6e0bb50bc19463(values[index] + s, minValue, maxValue, step));
|
|
319
|
+
}
|
|
320
|
+
function decrementThumb(index, stepSize = 1) {
|
|
321
|
+
let s = Math.max(stepSize, step);
|
|
322
|
+
updateValue(index, $9446cca9a3875146$export$cb6e0bb50bc19463(values[index] - s, minValue, maxValue, step));
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
values,
|
|
326
|
+
getThumbValue: (index) => values[index],
|
|
327
|
+
setThumbValue: updateValue,
|
|
328
|
+
setThumbPercent,
|
|
329
|
+
isThumbDragging: (index) => isDraggings[index],
|
|
330
|
+
setThumbDragging: updateDragging,
|
|
331
|
+
focusedThumb: focusedIndex,
|
|
332
|
+
setFocusedThumb: setFocusedIndex,
|
|
333
|
+
getThumbPercent: (index) => getValuePercent(values[index]),
|
|
334
|
+
getValuePercent,
|
|
335
|
+
getThumbValueLabel: (index) => getFormattedValue(values[index]),
|
|
336
|
+
getFormattedValue,
|
|
337
|
+
getThumbMinValue,
|
|
338
|
+
getThumbMaxValue,
|
|
339
|
+
getPercentValue,
|
|
340
|
+
isThumbEditable,
|
|
341
|
+
setThumbEditable,
|
|
342
|
+
incrementThumb,
|
|
343
|
+
decrementThumb,
|
|
344
|
+
step,
|
|
345
|
+
pageSize,
|
|
346
|
+
orientation,
|
|
347
|
+
isDisabled
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function $28f99e3e86e6ec45$var$replaceIndex(array, index, value) {
|
|
351
|
+
if (array[index] === value) return array;
|
|
352
|
+
return [
|
|
353
|
+
...array.slice(0, index),
|
|
354
|
+
value,
|
|
355
|
+
...array.slice(index + 1)
|
|
356
|
+
];
|
|
357
|
+
}
|
|
358
|
+
function $28f99e3e86e6ec45$var$convertValue(value) {
|
|
359
|
+
if (value == null) return void 0;
|
|
360
|
+
return Array.isArray(value) ? value : [
|
|
361
|
+
value
|
|
362
|
+
];
|
|
363
|
+
}
|
|
364
|
+
function $28f99e3e86e6ec45$var$createOnChange(value, defaultValue, onChange) {
|
|
365
|
+
return (newValue) => {
|
|
366
|
+
if (typeof value === "number" || typeof defaultValue === "number") onChange === null || onChange === void 0 ? void 0 : onChange(newValue[0]);
|
|
367
|
+
else onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
const $aa519ee6cf463259$export$d6c8d9636a3dc49c = /* @__PURE__ */ new WeakMap();
|
|
371
|
+
function $aa519ee6cf463259$export$68e648cbec363a18(state, index) {
|
|
372
|
+
let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
|
|
373
|
+
if (!data) throw new Error("Unknown slider state");
|
|
374
|
+
return `${data.id}-${index}`;
|
|
375
|
+
}
|
|
376
|
+
function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
|
|
377
|
+
let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f(props);
|
|
378
|
+
let isVertical = props.orientation === "vertical";
|
|
379
|
+
var _labelProps_id;
|
|
380
|
+
$aa519ee6cf463259$export$d6c8d9636a3dc49c.set(state, {
|
|
381
|
+
id: (_labelProps_id = labelProps.id) !== null && _labelProps_id !== void 0 ? _labelProps_id : fieldProps.id,
|
|
382
|
+
"aria-describedby": props["aria-describedby"],
|
|
383
|
+
"aria-details": props["aria-details"]
|
|
384
|
+
});
|
|
385
|
+
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
386
|
+
let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
387
|
+
const realTimeTrackDraggingIndex = useRef(null);
|
|
388
|
+
const reverseX = direction === "rtl";
|
|
389
|
+
const currentPosition = useRef(null);
|
|
390
|
+
const { moveProps } = $e8a7022cf87cba2a$export$36da96379f79f245({
|
|
391
|
+
onMoveStart() {
|
|
392
|
+
currentPosition.current = null;
|
|
393
|
+
},
|
|
394
|
+
onMove({ deltaX, deltaY }) {
|
|
395
|
+
if (!trackRef.current) return;
|
|
396
|
+
let { height, width } = trackRef.current.getBoundingClientRect();
|
|
397
|
+
let size = isVertical ? height : width;
|
|
398
|
+
if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
|
|
399
|
+
let delta = isVertical ? deltaY : deltaX;
|
|
400
|
+
if (isVertical || reverseX) delta = -delta;
|
|
401
|
+
currentPosition.current += delta;
|
|
402
|
+
if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
|
|
403
|
+
const percent = $9446cca9a3875146$export$7d15b64cf5a3a4c4(currentPosition.current / size, 0, 1);
|
|
404
|
+
state.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
onMoveEnd() {
|
|
408
|
+
if (realTimeTrackDraggingIndex.current != null) {
|
|
409
|
+
state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
|
|
410
|
+
realTimeTrackDraggingIndex.current = null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
let currentPointer = useRef(void 0);
|
|
415
|
+
let onDownTrack = (e, id, clientX, clientY) => {
|
|
416
|
+
if (trackRef.current && !props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) {
|
|
417
|
+
let { height, width, top, left } = trackRef.current.getBoundingClientRect();
|
|
418
|
+
let size = isVertical ? height : width;
|
|
419
|
+
const trackPosition = isVertical ? top : left;
|
|
420
|
+
const clickPosition = isVertical ? clientY : clientX;
|
|
421
|
+
const offset = clickPosition - trackPosition;
|
|
422
|
+
let percent = offset / size;
|
|
423
|
+
if (direction === "rtl" || isVertical) percent = 1 - percent;
|
|
424
|
+
let value = state.getPercentValue(percent);
|
|
425
|
+
let closestThumb;
|
|
426
|
+
let split = state.values.findIndex((v) => value - v < 0);
|
|
427
|
+
if (split === 0) closestThumb = split;
|
|
428
|
+
else if (split === -1) closestThumb = state.values.length - 1;
|
|
429
|
+
else {
|
|
430
|
+
let lastLeft = state.values[split - 1];
|
|
431
|
+
let firstRight = state.values[split];
|
|
432
|
+
if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) closestThumb = split - 1;
|
|
433
|
+
else closestThumb = split;
|
|
434
|
+
}
|
|
435
|
+
if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {
|
|
436
|
+
e.preventDefault();
|
|
437
|
+
realTimeTrackDraggingIndex.current = closestThumb;
|
|
438
|
+
state.setFocusedThumb(closestThumb);
|
|
439
|
+
currentPointer.current = id;
|
|
440
|
+
state.setThumbDragging(realTimeTrackDraggingIndex.current, true);
|
|
441
|
+
state.setThumbValue(closestThumb, value);
|
|
442
|
+
addGlobalListener(window, "mouseup", onUpTrack, false);
|
|
443
|
+
addGlobalListener(window, "touchend", onUpTrack, false);
|
|
444
|
+
addGlobalListener(window, "pointerup", onUpTrack, false);
|
|
445
|
+
} else realTimeTrackDraggingIndex.current = null;
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
let onUpTrack = (e) => {
|
|
449
|
+
var _e_changedTouches;
|
|
450
|
+
var _e_pointerId;
|
|
451
|
+
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;
|
|
452
|
+
if (id === currentPointer.current) {
|
|
453
|
+
if (realTimeTrackDraggingIndex.current != null) {
|
|
454
|
+
state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
|
|
455
|
+
realTimeTrackDraggingIndex.current = null;
|
|
456
|
+
}
|
|
457
|
+
removeGlobalListener(window, "mouseup", onUpTrack, false);
|
|
458
|
+
removeGlobalListener(window, "touchend", onUpTrack, false);
|
|
459
|
+
removeGlobalListener(window, "pointerup", onUpTrack, false);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
if ("htmlFor" in labelProps && labelProps.htmlFor) {
|
|
463
|
+
delete labelProps.htmlFor;
|
|
464
|
+
labelProps.onClick = () => {
|
|
465
|
+
var _document_getElementById;
|
|
466
|
+
(_document_getElementById = document.getElementById($aa519ee6cf463259$export$68e648cbec363a18(state, 0))) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
|
|
467
|
+
$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
labelProps,
|
|
472
|
+
// The root element of the Slider will have role="group" to group together
|
|
473
|
+
// all the thumb inputs in the Slider. The label of the Slider will
|
|
474
|
+
// be used to label the group.
|
|
475
|
+
groupProps: {
|
|
476
|
+
role: "group",
|
|
477
|
+
...fieldProps
|
|
478
|
+
},
|
|
479
|
+
trackProps: $3ef42575df84b30b$export$9d1611c77c2fe928({
|
|
480
|
+
onMouseDown(e) {
|
|
481
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
482
|
+
onDownTrack(e, void 0, e.clientX, e.clientY);
|
|
483
|
+
},
|
|
484
|
+
onPointerDown(e) {
|
|
485
|
+
if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
|
|
486
|
+
onDownTrack(e, e.pointerId, e.clientX, e.clientY);
|
|
487
|
+
},
|
|
488
|
+
onTouchStart(e) {
|
|
489
|
+
onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
|
490
|
+
},
|
|
491
|
+
style: {
|
|
492
|
+
position: "relative",
|
|
493
|
+
touchAction: "none"
|
|
494
|
+
}
|
|
495
|
+
}, moveProps),
|
|
496
|
+
outputProps: {
|
|
497
|
+
htmlFor: state.values.map((_, index) => $aa519ee6cf463259$export$68e648cbec363a18(state, index)).join(" "),
|
|
498
|
+
"aria-live": "off"
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function $47b897dc8cdb026b$export$8d15029008292ae(opts, state) {
|
|
503
|
+
let { index = 0, isRequired, validationState, isInvalid, trackRef, inputRef, orientation = state.orientation, name } = opts;
|
|
504
|
+
let isDisabled = opts.isDisabled || state.isDisabled;
|
|
505
|
+
let isVertical = orientation === "vertical";
|
|
506
|
+
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
507
|
+
let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
508
|
+
let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
|
|
509
|
+
var _opts_arialabelledby;
|
|
510
|
+
const { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f({
|
|
511
|
+
...opts,
|
|
512
|
+
id: $aa519ee6cf463259$export$68e648cbec363a18(state, index),
|
|
513
|
+
"aria-labelledby": `${data.id} ${(_opts_arialabelledby = opts["aria-labelledby"]) !== null && _opts_arialabelledby !== void 0 ? _opts_arialabelledby : ""}`.trim()
|
|
514
|
+
});
|
|
515
|
+
const value = state.values[index];
|
|
516
|
+
const focusInput = useCallback(() => {
|
|
517
|
+
if (inputRef.current) $7215afc6de606d6b$export$de79e2c695e052f3(inputRef.current);
|
|
518
|
+
}, [
|
|
519
|
+
inputRef
|
|
520
|
+
]);
|
|
521
|
+
const isFocused = state.focusedThumb === index;
|
|
522
|
+
useEffect(() => {
|
|
523
|
+
if (isFocused) focusInput();
|
|
524
|
+
}, [
|
|
525
|
+
isFocused,
|
|
526
|
+
focusInput
|
|
527
|
+
]);
|
|
528
|
+
let reverseX = direction === "rtl";
|
|
529
|
+
let currentPosition = useRef(null);
|
|
530
|
+
let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd({
|
|
531
|
+
onKeyDown(e) {
|
|
532
|
+
let { getThumbMaxValue, getThumbMinValue, decrementThumb, incrementThumb, setThumbValue, setThumbDragging, pageSize } = state;
|
|
533
|
+
if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
|
|
534
|
+
e.continuePropagation();
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
e.preventDefault();
|
|
538
|
+
setThumbDragging(index, true);
|
|
539
|
+
switch (e.key) {
|
|
540
|
+
case "PageUp":
|
|
541
|
+
incrementThumb(index, pageSize);
|
|
542
|
+
break;
|
|
543
|
+
case "PageDown":
|
|
544
|
+
decrementThumb(index, pageSize);
|
|
545
|
+
break;
|
|
546
|
+
case "Home":
|
|
547
|
+
setThumbValue(index, getThumbMinValue(index));
|
|
548
|
+
break;
|
|
549
|
+
case "End":
|
|
550
|
+
setThumbValue(index, getThumbMaxValue(index));
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
setThumbDragging(index, false);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
let { moveProps } = $e8a7022cf87cba2a$export$36da96379f79f245({
|
|
557
|
+
onMoveStart() {
|
|
558
|
+
currentPosition.current = null;
|
|
559
|
+
state.setThumbDragging(index, true);
|
|
560
|
+
},
|
|
561
|
+
onMove({ deltaX, deltaY, pointerType, shiftKey }) {
|
|
562
|
+
const { getThumbPercent, setThumbPercent, decrementThumb, incrementThumb, step, pageSize } = state;
|
|
563
|
+
if (!trackRef.current) return;
|
|
564
|
+
let { width, height } = trackRef.current.getBoundingClientRect();
|
|
565
|
+
let size = isVertical ? height : width;
|
|
566
|
+
if (currentPosition.current == null) currentPosition.current = getThumbPercent(index) * size;
|
|
567
|
+
if (pointerType === "keyboard") {
|
|
568
|
+
if (deltaX > 0 && reverseX || deltaX < 0 && !reverseX || deltaY > 0) decrementThumb(index, shiftKey ? pageSize : step);
|
|
569
|
+
else incrementThumb(index, shiftKey ? pageSize : step);
|
|
570
|
+
} else {
|
|
571
|
+
let delta = isVertical ? deltaY : deltaX;
|
|
572
|
+
if (isVertical || reverseX) delta = -delta;
|
|
573
|
+
currentPosition.current += delta;
|
|
574
|
+
setThumbPercent(index, $9446cca9a3875146$export$7d15b64cf5a3a4c4(currentPosition.current / size, 0, 1));
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
onMoveEnd() {
|
|
578
|
+
state.setThumbDragging(index, false);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
state.setThumbEditable(index, !isDisabled);
|
|
582
|
+
const { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c($3ef42575df84b30b$export$9d1611c77c2fe928(opts, {
|
|
583
|
+
onFocus: () => state.setFocusedThumb(index),
|
|
584
|
+
onBlur: () => state.setFocusedThumb(void 0)
|
|
585
|
+
}), inputRef);
|
|
586
|
+
let currentPointer = useRef(void 0);
|
|
587
|
+
let onDown = (id) => {
|
|
588
|
+
focusInput();
|
|
589
|
+
currentPointer.current = id;
|
|
590
|
+
state.setThumbDragging(index, true);
|
|
591
|
+
addGlobalListener(window, "mouseup", onUp, false);
|
|
592
|
+
addGlobalListener(window, "touchend", onUp, false);
|
|
593
|
+
addGlobalListener(window, "pointerup", onUp, false);
|
|
594
|
+
};
|
|
595
|
+
let onUp = (e) => {
|
|
596
|
+
var _e_changedTouches;
|
|
597
|
+
var _e_pointerId;
|
|
598
|
+
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;
|
|
599
|
+
if (id === currentPointer.current) {
|
|
600
|
+
focusInput();
|
|
601
|
+
state.setThumbDragging(index, false);
|
|
602
|
+
removeGlobalListener(window, "mouseup", onUp, false);
|
|
603
|
+
removeGlobalListener(window, "touchend", onUp, false);
|
|
604
|
+
removeGlobalListener(window, "pointerup", onUp, false);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
let thumbPosition = state.getThumbPercent(index);
|
|
608
|
+
if (isVertical || direction === "rtl") thumbPosition = 1 - thumbPosition;
|
|
609
|
+
let interactions = !isDisabled ? $3ef42575df84b30b$export$9d1611c77c2fe928(keyboardProps, moveProps, {
|
|
610
|
+
onMouseDown: (e) => {
|
|
611
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
612
|
+
onDown();
|
|
613
|
+
},
|
|
614
|
+
onPointerDown: (e) => {
|
|
615
|
+
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
616
|
+
onDown(e.pointerId);
|
|
617
|
+
},
|
|
618
|
+
onTouchStart: (e) => {
|
|
619
|
+
onDown(e.changedTouches[0].identifier);
|
|
620
|
+
}
|
|
621
|
+
}) : {};
|
|
622
|
+
$99facab73266f662$export$5add1d006293d136(inputRef, value, (v) => {
|
|
623
|
+
state.setThumbValue(index, v);
|
|
624
|
+
});
|
|
625
|
+
return {
|
|
626
|
+
inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928(focusableProps, fieldProps, {
|
|
627
|
+
type: "range",
|
|
628
|
+
tabIndex: !isDisabled ? 0 : void 0,
|
|
629
|
+
min: state.getThumbMinValue(index),
|
|
630
|
+
max: state.getThumbMaxValue(index),
|
|
631
|
+
step: state.step,
|
|
632
|
+
value,
|
|
633
|
+
name,
|
|
634
|
+
disabled: isDisabled,
|
|
635
|
+
"aria-orientation": orientation,
|
|
636
|
+
"aria-valuetext": state.getThumbValueLabel(index),
|
|
637
|
+
"aria-required": isRequired || void 0,
|
|
638
|
+
"aria-invalid": isInvalid || validationState === "invalid" || void 0,
|
|
639
|
+
"aria-errormessage": opts["aria-errormessage"],
|
|
640
|
+
"aria-describedby": [
|
|
641
|
+
data["aria-describedby"],
|
|
642
|
+
opts["aria-describedby"]
|
|
643
|
+
].filter(Boolean).join(" "),
|
|
644
|
+
"aria-details": [
|
|
645
|
+
data["aria-details"],
|
|
646
|
+
opts["aria-details"]
|
|
647
|
+
].filter(Boolean).join(" "),
|
|
648
|
+
onChange: (e) => {
|
|
649
|
+
state.setThumbValue(index, parseFloat(e.target.value));
|
|
650
|
+
}
|
|
651
|
+
}),
|
|
652
|
+
thumbProps: {
|
|
653
|
+
...interactions,
|
|
654
|
+
style: {
|
|
655
|
+
position: "absolute",
|
|
656
|
+
[isVertical ? "top" : "left"]: `${thumbPosition * 100}%`,
|
|
657
|
+
transform: "translate(-50%, -50%)",
|
|
658
|
+
touchAction: "none"
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
labelProps,
|
|
662
|
+
isDragging: state.isThumbDragging(index),
|
|
663
|
+
isDisabled,
|
|
664
|
+
isFocused
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
const $6f909507e6374d18$export$e99164f0030f3bff = /* @__PURE__ */ createContext(null);
|
|
668
|
+
const $6f909507e6374d18$export$1e7083018727fa60 = /* @__PURE__ */ createContext(null);
|
|
669
|
+
const $6f909507e6374d18$export$f1fce0420cc6d8ee = /* @__PURE__ */ createContext(null);
|
|
670
|
+
const $6f909507e6374d18$export$6189c2744041d8f8 = /* @__PURE__ */ createContext(null);
|
|
671
|
+
const $6f909507e6374d18$export$472062a354075cee = /* @__PURE__ */ forwardRef(function Slider(props, ref) {
|
|
672
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $6f909507e6374d18$export$e99164f0030f3bff);
|
|
673
|
+
let trackRef = useRef(null);
|
|
674
|
+
let numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44(props.formatOptions);
|
|
675
|
+
let state = $28f99e3e86e6ec45$export$e5fda3247f5d67f9({
|
|
676
|
+
...props,
|
|
677
|
+
numberFormatter
|
|
678
|
+
});
|
|
679
|
+
let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(!props["aria-label"] && !props["aria-labelledby"]);
|
|
680
|
+
let { groupProps, trackProps, labelProps, outputProps } = $bcca50147b47f54d$export$56b2c08e277f365({
|
|
681
|
+
...props,
|
|
682
|
+
label
|
|
683
|
+
}, state, trackRef);
|
|
684
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
685
|
+
...props,
|
|
686
|
+
values: {
|
|
687
|
+
orientation: state.orientation,
|
|
688
|
+
isDisabled: state.isDisabled,
|
|
689
|
+
state
|
|
690
|
+
},
|
|
691
|
+
defaultClassName: "react-aria-Slider"
|
|
692
|
+
});
|
|
693
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
694
|
+
delete DOMProps.id;
|
|
695
|
+
return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
696
|
+
values: [
|
|
697
|
+
[
|
|
698
|
+
$6f909507e6374d18$export$1e7083018727fa60,
|
|
699
|
+
state
|
|
700
|
+
],
|
|
701
|
+
[
|
|
702
|
+
$6f909507e6374d18$export$f1fce0420cc6d8ee,
|
|
703
|
+
{
|
|
704
|
+
...trackProps,
|
|
705
|
+
ref: trackRef
|
|
706
|
+
}
|
|
707
|
+
],
|
|
708
|
+
[
|
|
709
|
+
$6f909507e6374d18$export$6189c2744041d8f8,
|
|
710
|
+
outputProps
|
|
711
|
+
],
|
|
712
|
+
[
|
|
713
|
+
$01b77f81d0f07f68$export$75b6ee27786ba447,
|
|
714
|
+
{
|
|
715
|
+
...labelProps,
|
|
716
|
+
ref: labelRef
|
|
717
|
+
}
|
|
718
|
+
]
|
|
719
|
+
]
|
|
720
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
721
|
+
...DOMProps,
|
|
722
|
+
...groupProps,
|
|
723
|
+
...renderProps,
|
|
724
|
+
ref,
|
|
725
|
+
slot: props.slot || void 0,
|
|
726
|
+
"data-orientation": state.orientation,
|
|
727
|
+
"data-disabled": state.isDisabled || void 0
|
|
728
|
+
}));
|
|
729
|
+
});
|
|
730
|
+
const $6f909507e6374d18$export$a590f758a961cb5b = /* @__PURE__ */ forwardRef(function SliderOutput(props, ref) {
|
|
731
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $6f909507e6374d18$export$6189c2744041d8f8);
|
|
732
|
+
let { children, style, className, ...otherProps } = props;
|
|
733
|
+
let state = useContext($6f909507e6374d18$export$1e7083018727fa60);
|
|
734
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
735
|
+
className,
|
|
736
|
+
style,
|
|
737
|
+
children,
|
|
738
|
+
defaultChildren: state.getThumbValueLabel(0),
|
|
739
|
+
defaultClassName: "react-aria-SliderOutput",
|
|
740
|
+
values: {
|
|
741
|
+
orientation: state.orientation,
|
|
742
|
+
isDisabled: state.isDisabled,
|
|
743
|
+
state
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
return /* @__PURE__ */ React__default.createElement("output", {
|
|
747
|
+
...otherProps,
|
|
748
|
+
...renderProps,
|
|
749
|
+
ref,
|
|
750
|
+
"data-orientation": state.orientation || void 0,
|
|
751
|
+
"data-disabled": state.isDisabled || void 0
|
|
752
|
+
});
|
|
753
|
+
});
|
|
754
|
+
const $6f909507e6374d18$export$105594979f116971 = /* @__PURE__ */ forwardRef(function SliderTrack(props, ref) {
|
|
755
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $6f909507e6374d18$export$f1fce0420cc6d8ee);
|
|
756
|
+
let state = useContext($6f909507e6374d18$export$1e7083018727fa60);
|
|
757
|
+
let { onHoverStart, onHoverEnd, onHoverChange, ...otherProps } = props;
|
|
758
|
+
let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
759
|
+
onHoverStart,
|
|
760
|
+
onHoverEnd,
|
|
761
|
+
onHoverChange
|
|
762
|
+
});
|
|
763
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
764
|
+
...props,
|
|
765
|
+
defaultClassName: "react-aria-SliderTrack",
|
|
766
|
+
values: {
|
|
767
|
+
orientation: state.orientation,
|
|
768
|
+
isDisabled: state.isDisabled,
|
|
769
|
+
isHovered,
|
|
770
|
+
state
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
774
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(otherProps, hoverProps),
|
|
775
|
+
...renderProps,
|
|
776
|
+
ref,
|
|
777
|
+
"data-hovered": isHovered || void 0,
|
|
778
|
+
"data-orientation": state.orientation || void 0,
|
|
779
|
+
"data-disabled": state.isDisabled || void 0
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
const $6f909507e6374d18$export$2c1b491743890dec = /* @__PURE__ */ forwardRef(function SliderThumb(props, ref) {
|
|
783
|
+
let { inputRef: userInputRef = null } = props;
|
|
784
|
+
let state = useContext($6f909507e6374d18$export$1e7083018727fa60);
|
|
785
|
+
let { ref: trackRef } = $64fa3d84918910a7$export$fabf2dc03a41866e($6f909507e6374d18$export$f1fce0420cc6d8ee);
|
|
786
|
+
let { index = 0 } = props;
|
|
787
|
+
let defaultInputRef = useRef(null);
|
|
788
|
+
let inputRef = userInputRef || defaultInputRef;
|
|
789
|
+
let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(!props["aria-label"] && !props["aria-labelledby"]);
|
|
790
|
+
let { thumbProps, inputProps, labelProps, isDragging, isFocused, isDisabled } = $47b897dc8cdb026b$export$8d15029008292ae({
|
|
791
|
+
...props,
|
|
792
|
+
index,
|
|
793
|
+
trackRef,
|
|
794
|
+
inputRef,
|
|
795
|
+
label
|
|
796
|
+
}, state);
|
|
797
|
+
let { focusProps, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f();
|
|
798
|
+
let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456(props);
|
|
799
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
800
|
+
...props,
|
|
801
|
+
defaultClassName: "react-aria-SliderThumb",
|
|
802
|
+
values: {
|
|
803
|
+
state,
|
|
804
|
+
isHovered,
|
|
805
|
+
isDragging,
|
|
806
|
+
isFocused,
|
|
807
|
+
isFocusVisible,
|
|
808
|
+
isDisabled
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
812
|
+
delete DOMProps.id;
|
|
813
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
814
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, thumbProps, hoverProps),
|
|
815
|
+
...renderProps,
|
|
816
|
+
ref,
|
|
817
|
+
style: {
|
|
818
|
+
...thumbProps.style,
|
|
819
|
+
...renderProps.style
|
|
820
|
+
},
|
|
821
|
+
"data-hovered": isHovered || void 0,
|
|
822
|
+
"data-dragging": isDragging || void 0,
|
|
823
|
+
"data-focused": isFocused || void 0,
|
|
824
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
825
|
+
"data-disabled": isDisabled || void 0
|
|
826
|
+
}, /* @__PURE__ */ React__default.createElement($5c3e21d68f1c4674$export$439d29a4e110a164, null, /* @__PURE__ */ React__default.createElement("input", {
|
|
827
|
+
ref: inputRef,
|
|
828
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps)
|
|
829
|
+
})), /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
830
|
+
values: [
|
|
831
|
+
[
|
|
832
|
+
$01b77f81d0f07f68$export$75b6ee27786ba447,
|
|
833
|
+
{
|
|
834
|
+
...labelProps,
|
|
835
|
+
ref: labelRef
|
|
836
|
+
}
|
|
837
|
+
]
|
|
838
|
+
]
|
|
839
|
+
}, renderProps.children));
|
|
840
|
+
});
|
|
841
|
+
export {
|
|
842
|
+
$6f909507e6374d18$export$472062a354075cee as $,
|
|
843
|
+
$6f909507e6374d18$export$105594979f116971 as a,
|
|
844
|
+
$6f909507e6374d18$export$2c1b491743890dec as b,
|
|
845
|
+
$6f909507e6374d18$export$a590f758a961cb5b as c,
|
|
846
|
+
$6f909507e6374d18$export$1e7083018727fa60 as d,
|
|
847
|
+
$28f99e3e86e6ec45$export$e5fda3247f5d67f9 as e,
|
|
848
|
+
$e8a7022cf87cba2a$export$36da96379f79f245 as f,
|
|
849
|
+
$bcca50147b47f54d$export$56b2c08e277f365 as g,
|
|
850
|
+
$47b897dc8cdb026b$export$8d15029008292ae as h,
|
|
851
|
+
$6f909507e6374d18$export$f1fce0420cc6d8ee as i,
|
|
852
|
+
$6f909507e6374d18$export$6189c2744041d8f8 as j
|
|
853
|
+
};
|