@hot-updater/console 0.28.0 → 0.29.1
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/.output/nitro.json +17 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/.output/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/.output/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/.output/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/.output/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/.output/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/.output/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/.output/public/assets/main-Dlx8-qN-.js +61 -0
- package/.output/public/assets/routes-DB0tWmiJ.js +10 -0
- package/.output/public/assets/styles-Bfxg4M1x.css +2 -0
- package/.output/public/favicon-16x16.png +0 -0
- package/.output/public/favicon-32x32.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/logo.svg +1 -0
- package/.output/public/manifest.json +30 -0
- package/.output/public/robots.txt +3 -0
- package/.output/server/_chunks/ssr-renderer.mjs +15 -0
- package/.output/server/_libs/@floating-ui/core+[...].mjs +698 -0
- package/.output/server/_libs/@floating-ui/dom+[...].mjs +644 -0
- package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +839 -0
- package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +2093 -0
- package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +287 -0
- package/.output/server/_libs/@radix-ui/react-select+[...].mjs +1003 -0
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +196 -0
- package/.output/server/_libs/@tanstack/form-core+[...].mjs +2396 -0
- package/.output/server/_libs/@tanstack/react-form+[...].mjs +298 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +13068 -0
- package/.output/server/_libs/@tanstack/react-table+[...].mjs +2372 -0
- package/.output/server/_libs/chownr.mjs +60 -0
- package/.output/server/_libs/class-variance-authority+clsx.mjs +69 -0
- package/.output/server/_libs/core-util-is.mjs +67 -0
- package/.output/server/_libs/dayjs.mjs +408 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1158 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/immediate.mjs +57 -0
- package/.output/server/_libs/inherits.mjs +39 -0
- package/.output/server/_libs/isaacs__fs-minipass+minipass.mjs +1120 -0
- package/.output/server/_libs/isarray.mjs +10 -0
- package/.output/server/_libs/jszip+[...].mjs +8311 -0
- package/.output/server/_libs/lucide-react.mjs +371 -0
- package/.output/server/_libs/minizlib.mjs +345 -0
- package/.output/server/_libs/next-themes.mjs +49 -0
- package/.output/server/_libs/radix-ui__number.mjs +6 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
- package/.output/server/_libs/radix-ui__react-collection.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-direction.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-label.mjs +22 -0
- package/.output/server/_libs/radix-ui__react-separator.mjs +31 -0
- package/.output/server/_libs/radix-ui__react-slider.mjs +451 -0
- package/.output/server/_libs/radix-ui__react-switch.mjs +118 -0
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +491 -0
- package/.output/server/_libs/semver.mjs +1339 -0
- package/.output/server/_libs/sonner.mjs +908 -0
- package/.output/server/_libs/tailwind-merge.mjs +1962 -0
- package/.output/server/_libs/tanstack__history.mjs +322 -0
- package/.output/server/_libs/tanstack__query-core.mjs +2073 -0
- package/.output/server/_libs/tanstack__react-query.mjs +146 -0
- package/.output/server/_libs/tanstack__router-core.mjs +6 -0
- package/.output/server/_libs/tar.mjs +1996 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_runtime.mjs +26 -0
- package/.output/server/_ssr/api-rpc-D3ZehMIN.mjs +217 -0
- package/.output/server/_ssr/config.server-JUYQ7UbI.mjs +26 -0
- package/.output/server/_ssr/deleteBundle-DWUxu9-K.mjs +22 -0
- package/.output/server/_ssr/extract-timestamp-from-uuidv7-B90UBADU.mjs +24 -0
- package/.output/server/_ssr/promoteBundle-DtMHuubR.mjs +1571 -0
- package/.output/server/_ssr/router-pgc7NX76.mjs +250 -0
- package/.output/server/_ssr/routes-PqTTQSoI.mjs +1833 -0
- package/.output/server/_ssr/sidebar-DXng0IOP.mjs +439 -0
- package/.output/server/_ssr/ssr.mjs +5050 -0
- package/.output/server/_ssr/start-DQK0r85G.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-DTbQVOpU.mjs +17 -0
- package/.output/server/index.mjs +417 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/README.md +191 -2
- package/package.json +77 -50
- package/dist/.gitkeep +0 -0
- package/dist/assets/favicon-BkwcEHsj.ico +0 -0
- package/dist/assets/index-DUlKsori.css +0 -1
- package/dist/assets/index-ijmIcyn1.js +0 -27
- package/dist/assets/logo-BYNFyja1.png +0 -0
- package/dist/index.cjs +0 -2129
- package/dist/index.d.cts +0 -218
- package/dist/index.d.ts +0 -218
- package/dist/index.html +0 -14
- package/dist/index.js +0 -2125
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { r as __toESM } from "../_runtime.mjs";
|
|
2
|
+
import { E as useControllableState, N as useComposedRefs, O as createContextScope, P as require_jsx_runtime, k as Primitive } from "./@radix-ui/react-alert-dialog+[...].mjs";
|
|
3
|
+
import { u as require_react } from "./@floating-ui/react-dom+[...].mjs";
|
|
4
|
+
import { p as usePrevious } from "./@radix-ui/react-select+[...].mjs";
|
|
5
|
+
import { t as createCollection } from "./radix-ui__react-collection.mjs";
|
|
6
|
+
import { t as composeEventHandlers } from "./radix-ui__primitive.mjs";
|
|
7
|
+
import { t as useDirection } from "./radix-ui__react-direction.mjs";
|
|
8
|
+
import { o as useSize } from "./@radix-ui/react-popper+[...].mjs";
|
|
9
|
+
import { t as clamp } from "./radix-ui__number.mjs";
|
|
10
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-slider@1.3.6_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react_c6a3fae91eb6750caf661d179680cb4a/node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
11
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
12
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
13
|
+
var PAGE_KEYS = ["PageUp", "PageDown"];
|
|
14
|
+
var ARROW_KEYS = [
|
|
15
|
+
"ArrowUp",
|
|
16
|
+
"ArrowDown",
|
|
17
|
+
"ArrowLeft",
|
|
18
|
+
"ArrowRight"
|
|
19
|
+
];
|
|
20
|
+
var BACK_KEYS = {
|
|
21
|
+
"from-left": [
|
|
22
|
+
"Home",
|
|
23
|
+
"PageDown",
|
|
24
|
+
"ArrowDown",
|
|
25
|
+
"ArrowLeft"
|
|
26
|
+
],
|
|
27
|
+
"from-right": [
|
|
28
|
+
"Home",
|
|
29
|
+
"PageDown",
|
|
30
|
+
"ArrowDown",
|
|
31
|
+
"ArrowRight"
|
|
32
|
+
],
|
|
33
|
+
"from-bottom": [
|
|
34
|
+
"Home",
|
|
35
|
+
"PageDown",
|
|
36
|
+
"ArrowDown",
|
|
37
|
+
"ArrowLeft"
|
|
38
|
+
],
|
|
39
|
+
"from-top": [
|
|
40
|
+
"Home",
|
|
41
|
+
"PageDown",
|
|
42
|
+
"ArrowUp",
|
|
43
|
+
"ArrowLeft"
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
var SLIDER_NAME = "Slider";
|
|
47
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(SLIDER_NAME);
|
|
48
|
+
var [createSliderContext, createSliderScope] = createContextScope(SLIDER_NAME, [createCollectionScope]);
|
|
49
|
+
var [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
|
|
50
|
+
var Slider = import_react.forwardRef((props, forwardedRef) => {
|
|
51
|
+
const { name, min = 0, max = 100, step = 1, orientation = "horizontal", disabled = false, minStepsBetweenThumbs = 0, defaultValue = [min], value, onValueChange = () => {}, onValueCommit = () => {}, inverted = false, form, ...sliderProps } = props;
|
|
52
|
+
const thumbRefs = import_react.useRef(/* @__PURE__ */ new Set());
|
|
53
|
+
const valueIndexToChangeRef = import_react.useRef(0);
|
|
54
|
+
const SliderOrientation = orientation === "horizontal" ? SliderHorizontal : SliderVertical;
|
|
55
|
+
const [values = [], setValues] = useControllableState({
|
|
56
|
+
prop: value,
|
|
57
|
+
defaultProp: defaultValue,
|
|
58
|
+
onChange: (value2) => {
|
|
59
|
+
[...thumbRefs.current][valueIndexToChangeRef.current]?.focus();
|
|
60
|
+
onValueChange(value2);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const valuesBeforeSlideStartRef = import_react.useRef(values);
|
|
64
|
+
function handleSlideStart(value2) {
|
|
65
|
+
updateValues(value2, getClosestValueIndex(values, value2));
|
|
66
|
+
}
|
|
67
|
+
function handleSlideMove(value2) {
|
|
68
|
+
updateValues(value2, valueIndexToChangeRef.current);
|
|
69
|
+
}
|
|
70
|
+
function handleSlideEnd() {
|
|
71
|
+
const prevValue = valuesBeforeSlideStartRef.current[valueIndexToChangeRef.current];
|
|
72
|
+
if (values[valueIndexToChangeRef.current] !== prevValue) onValueCommit(values);
|
|
73
|
+
}
|
|
74
|
+
function updateValues(value2, atIndex, { commit } = { commit: false }) {
|
|
75
|
+
const decimalCount = getDecimalCount(step);
|
|
76
|
+
const nextValue = clamp(roundValue(Math.round((value2 - min) / step) * step + min, decimalCount), [min, max]);
|
|
77
|
+
setValues((prevValues = []) => {
|
|
78
|
+
const nextValues = getNextSortedValues(prevValues, nextValue, atIndex);
|
|
79
|
+
if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {
|
|
80
|
+
valueIndexToChangeRef.current = nextValues.indexOf(nextValue);
|
|
81
|
+
const hasChanged = String(nextValues) !== String(prevValues);
|
|
82
|
+
if (hasChanged && commit) onValueCommit(nextValues);
|
|
83
|
+
return hasChanged ? nextValues : prevValues;
|
|
84
|
+
} else return prevValues;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderProvider, {
|
|
88
|
+
scope: props.__scopeSlider,
|
|
89
|
+
name,
|
|
90
|
+
disabled,
|
|
91
|
+
min,
|
|
92
|
+
max,
|
|
93
|
+
valueIndexToChangeRef,
|
|
94
|
+
thumbs: thumbRefs.current,
|
|
95
|
+
values,
|
|
96
|
+
orientation,
|
|
97
|
+
form,
|
|
98
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, {
|
|
99
|
+
scope: props.__scopeSlider,
|
|
100
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, {
|
|
101
|
+
scope: props.__scopeSlider,
|
|
102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderOrientation, {
|
|
103
|
+
"aria-disabled": disabled,
|
|
104
|
+
"data-disabled": disabled ? "" : void 0,
|
|
105
|
+
...sliderProps,
|
|
106
|
+
ref: forwardedRef,
|
|
107
|
+
onPointerDown: composeEventHandlers(sliderProps.onPointerDown, () => {
|
|
108
|
+
if (!disabled) valuesBeforeSlideStartRef.current = values;
|
|
109
|
+
}),
|
|
110
|
+
min,
|
|
111
|
+
max,
|
|
112
|
+
inverted,
|
|
113
|
+
onSlideStart: disabled ? void 0 : handleSlideStart,
|
|
114
|
+
onSlideMove: disabled ? void 0 : handleSlideMove,
|
|
115
|
+
onSlideEnd: disabled ? void 0 : handleSlideEnd,
|
|
116
|
+
onHomeKeyDown: () => !disabled && updateValues(min, 0, { commit: true }),
|
|
117
|
+
onEndKeyDown: () => !disabled && updateValues(max, values.length - 1, { commit: true }),
|
|
118
|
+
onStepKeyDown: ({ event, direction: stepDirection }) => {
|
|
119
|
+
if (!disabled) {
|
|
120
|
+
const multiplier = PAGE_KEYS.includes(event.key) || event.shiftKey && ARROW_KEYS.includes(event.key) ? 10 : 1;
|
|
121
|
+
const atIndex = valueIndexToChangeRef.current;
|
|
122
|
+
const value2 = values[atIndex];
|
|
123
|
+
updateValues(value2 + step * multiplier * stepDirection, atIndex, { commit: true });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
Slider.displayName = SLIDER_NAME;
|
|
132
|
+
var [SliderOrientationProvider, useSliderOrientationContext] = createSliderContext(SLIDER_NAME, {
|
|
133
|
+
startEdge: "left",
|
|
134
|
+
endEdge: "right",
|
|
135
|
+
size: "width",
|
|
136
|
+
direction: 1
|
|
137
|
+
});
|
|
138
|
+
var SliderHorizontal = import_react.forwardRef((props, forwardedRef) => {
|
|
139
|
+
const { min, max, dir, inverted, onSlideStart, onSlideMove, onSlideEnd, onStepKeyDown, ...sliderProps } = props;
|
|
140
|
+
const [slider, setSlider] = import_react.useState(null);
|
|
141
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setSlider(node));
|
|
142
|
+
const rectRef = import_react.useRef(void 0);
|
|
143
|
+
const direction = useDirection(dir);
|
|
144
|
+
const isDirectionLTR = direction === "ltr";
|
|
145
|
+
const isSlidingFromLeft = isDirectionLTR && !inverted || !isDirectionLTR && inverted;
|
|
146
|
+
function getValueFromPointer(pointerPosition) {
|
|
147
|
+
const rect = rectRef.current || slider.getBoundingClientRect();
|
|
148
|
+
const value = linearScale([0, rect.width], isSlidingFromLeft ? [min, max] : [max, min]);
|
|
149
|
+
rectRef.current = rect;
|
|
150
|
+
return value(pointerPosition - rect.left);
|
|
151
|
+
}
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderOrientationProvider, {
|
|
153
|
+
scope: props.__scopeSlider,
|
|
154
|
+
startEdge: isSlidingFromLeft ? "left" : "right",
|
|
155
|
+
endEdge: isSlidingFromLeft ? "right" : "left",
|
|
156
|
+
direction: isSlidingFromLeft ? 1 : -1,
|
|
157
|
+
size: "width",
|
|
158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderImpl, {
|
|
159
|
+
dir: direction,
|
|
160
|
+
"data-orientation": "horizontal",
|
|
161
|
+
...sliderProps,
|
|
162
|
+
ref: composedRefs,
|
|
163
|
+
style: {
|
|
164
|
+
...sliderProps.style,
|
|
165
|
+
["--radix-slider-thumb-transform"]: "translateX(-50%)"
|
|
166
|
+
},
|
|
167
|
+
onSlideStart: (event) => {
|
|
168
|
+
const value = getValueFromPointer(event.clientX);
|
|
169
|
+
onSlideStart?.(value);
|
|
170
|
+
},
|
|
171
|
+
onSlideMove: (event) => {
|
|
172
|
+
const value = getValueFromPointer(event.clientX);
|
|
173
|
+
onSlideMove?.(value);
|
|
174
|
+
},
|
|
175
|
+
onSlideEnd: () => {
|
|
176
|
+
rectRef.current = void 0;
|
|
177
|
+
onSlideEnd?.();
|
|
178
|
+
},
|
|
179
|
+
onStepKeyDown: (event) => {
|
|
180
|
+
const isBackKey = BACK_KEYS[isSlidingFromLeft ? "from-left" : "from-right"].includes(event.key);
|
|
181
|
+
onStepKeyDown?.({
|
|
182
|
+
event,
|
|
183
|
+
direction: isBackKey ? -1 : 1
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
var SliderVertical = import_react.forwardRef((props, forwardedRef) => {
|
|
190
|
+
const { min, max, inverted, onSlideStart, onSlideMove, onSlideEnd, onStepKeyDown, ...sliderProps } = props;
|
|
191
|
+
const sliderRef = import_react.useRef(null);
|
|
192
|
+
const ref = useComposedRefs(forwardedRef, sliderRef);
|
|
193
|
+
const rectRef = import_react.useRef(void 0);
|
|
194
|
+
const isSlidingFromBottom = !inverted;
|
|
195
|
+
function getValueFromPointer(pointerPosition) {
|
|
196
|
+
const rect = rectRef.current || sliderRef.current.getBoundingClientRect();
|
|
197
|
+
const value = linearScale([0, rect.height], isSlidingFromBottom ? [max, min] : [min, max]);
|
|
198
|
+
rectRef.current = rect;
|
|
199
|
+
return value(pointerPosition - rect.top);
|
|
200
|
+
}
|
|
201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderOrientationProvider, {
|
|
202
|
+
scope: props.__scopeSlider,
|
|
203
|
+
startEdge: isSlidingFromBottom ? "bottom" : "top",
|
|
204
|
+
endEdge: isSlidingFromBottom ? "top" : "bottom",
|
|
205
|
+
size: "height",
|
|
206
|
+
direction: isSlidingFromBottom ? 1 : -1,
|
|
207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderImpl, {
|
|
208
|
+
"data-orientation": "vertical",
|
|
209
|
+
...sliderProps,
|
|
210
|
+
ref,
|
|
211
|
+
style: {
|
|
212
|
+
...sliderProps.style,
|
|
213
|
+
["--radix-slider-thumb-transform"]: "translateY(50%)"
|
|
214
|
+
},
|
|
215
|
+
onSlideStart: (event) => {
|
|
216
|
+
const value = getValueFromPointer(event.clientY);
|
|
217
|
+
onSlideStart?.(value);
|
|
218
|
+
},
|
|
219
|
+
onSlideMove: (event) => {
|
|
220
|
+
const value = getValueFromPointer(event.clientY);
|
|
221
|
+
onSlideMove?.(value);
|
|
222
|
+
},
|
|
223
|
+
onSlideEnd: () => {
|
|
224
|
+
rectRef.current = void 0;
|
|
225
|
+
onSlideEnd?.();
|
|
226
|
+
},
|
|
227
|
+
onStepKeyDown: (event) => {
|
|
228
|
+
const isBackKey = BACK_KEYS[isSlidingFromBottom ? "from-bottom" : "from-top"].includes(event.key);
|
|
229
|
+
onStepKeyDown?.({
|
|
230
|
+
event,
|
|
231
|
+
direction: isBackKey ? -1 : 1
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
var SliderImpl = import_react.forwardRef((props, forwardedRef) => {
|
|
238
|
+
const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
|
|
239
|
+
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
241
|
+
...sliderProps,
|
|
242
|
+
ref: forwardedRef,
|
|
243
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
244
|
+
if (event.key === "Home") {
|
|
245
|
+
onHomeKeyDown(event);
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
} else if (event.key === "End") {
|
|
248
|
+
onEndKeyDown(event);
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
} else if (PAGE_KEYS.concat(ARROW_KEYS).includes(event.key)) {
|
|
251
|
+
onStepKeyDown(event);
|
|
252
|
+
event.preventDefault();
|
|
253
|
+
}
|
|
254
|
+
}),
|
|
255
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
256
|
+
const target = event.target;
|
|
257
|
+
target.setPointerCapture(event.pointerId);
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
if (context.thumbs.has(target)) target.focus();
|
|
260
|
+
else onSlideStart(event);
|
|
261
|
+
}),
|
|
262
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
263
|
+
if (event.target.hasPointerCapture(event.pointerId)) onSlideMove(event);
|
|
264
|
+
}),
|
|
265
|
+
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
266
|
+
const target = event.target;
|
|
267
|
+
if (target.hasPointerCapture(event.pointerId)) {
|
|
268
|
+
target.releasePointerCapture(event.pointerId);
|
|
269
|
+
onSlideEnd(event);
|
|
270
|
+
}
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
var TRACK_NAME = "SliderTrack";
|
|
275
|
+
var SliderTrack = import_react.forwardRef((props, forwardedRef) => {
|
|
276
|
+
const { __scopeSlider, ...trackProps } = props;
|
|
277
|
+
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
279
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
280
|
+
"data-orientation": context.orientation,
|
|
281
|
+
...trackProps,
|
|
282
|
+
ref: forwardedRef
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
SliderTrack.displayName = TRACK_NAME;
|
|
286
|
+
var RANGE_NAME = "SliderRange";
|
|
287
|
+
var SliderRange = import_react.forwardRef((props, forwardedRef) => {
|
|
288
|
+
const { __scopeSlider, ...rangeProps } = props;
|
|
289
|
+
const context = useSliderContext(RANGE_NAME, __scopeSlider);
|
|
290
|
+
const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider);
|
|
291
|
+
const composedRefs = useComposedRefs(forwardedRef, import_react.useRef(null));
|
|
292
|
+
const valuesCount = context.values.length;
|
|
293
|
+
const percentages = context.values.map((value) => convertValueToPercentage(value, context.min, context.max));
|
|
294
|
+
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
295
|
+
const offsetEnd = 100 - Math.max(...percentages);
|
|
296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
297
|
+
"data-orientation": context.orientation,
|
|
298
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
299
|
+
...rangeProps,
|
|
300
|
+
ref: composedRefs,
|
|
301
|
+
style: {
|
|
302
|
+
...props.style,
|
|
303
|
+
[orientation.startEdge]: offsetStart + "%",
|
|
304
|
+
[orientation.endEdge]: offsetEnd + "%"
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
SliderRange.displayName = RANGE_NAME;
|
|
309
|
+
var THUMB_NAME = "SliderThumb";
|
|
310
|
+
var SliderThumb = import_react.forwardRef((props, forwardedRef) => {
|
|
311
|
+
const getItems = useCollection(props.__scopeSlider);
|
|
312
|
+
const [thumb, setThumb] = import_react.useState(null);
|
|
313
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
314
|
+
const index = import_react.useMemo(() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1, [getItems, thumb]);
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderThumbImpl, {
|
|
316
|
+
...props,
|
|
317
|
+
ref: composedRefs,
|
|
318
|
+
index
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
var SliderThumbImpl = import_react.forwardRef((props, forwardedRef) => {
|
|
322
|
+
const { __scopeSlider, index, name, ...thumbProps } = props;
|
|
323
|
+
const context = useSliderContext(THUMB_NAME, __scopeSlider);
|
|
324
|
+
const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider);
|
|
325
|
+
const [thumb, setThumb] = import_react.useState(null);
|
|
326
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
327
|
+
const isFormControl = thumb ? context.form || !!thumb.closest("form") : true;
|
|
328
|
+
const size = useSize(thumb);
|
|
329
|
+
const value = context.values[index];
|
|
330
|
+
const percent = value === void 0 ? 0 : convertValueToPercentage(value, context.min, context.max);
|
|
331
|
+
const label = getLabel(index, context.values.length);
|
|
332
|
+
const orientationSize = size?.[orientation.size];
|
|
333
|
+
const thumbInBoundsOffset = orientationSize ? getThumbInBoundsOffset(orientationSize, percent, orientation.direction) : 0;
|
|
334
|
+
import_react.useEffect(() => {
|
|
335
|
+
if (thumb) {
|
|
336
|
+
context.thumbs.add(thumb);
|
|
337
|
+
return () => {
|
|
338
|
+
context.thumbs.delete(thumb);
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}, [thumb, context.thumbs]);
|
|
342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
343
|
+
style: {
|
|
344
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
345
|
+
position: "absolute",
|
|
346
|
+
[orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
|
|
347
|
+
},
|
|
348
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, {
|
|
349
|
+
scope: props.__scopeSlider,
|
|
350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
351
|
+
role: "slider",
|
|
352
|
+
"aria-label": props["aria-label"] || label,
|
|
353
|
+
"aria-valuemin": context.min,
|
|
354
|
+
"aria-valuenow": value,
|
|
355
|
+
"aria-valuemax": context.max,
|
|
356
|
+
"aria-orientation": context.orientation,
|
|
357
|
+
"data-orientation": context.orientation,
|
|
358
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
359
|
+
tabIndex: context.disabled ? void 0 : 0,
|
|
360
|
+
...thumbProps,
|
|
361
|
+
ref: composedRefs,
|
|
362
|
+
style: value === void 0 ? { display: "none" } : props.style,
|
|
363
|
+
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
364
|
+
context.valueIndexToChangeRef.current = index;
|
|
365
|
+
})
|
|
366
|
+
})
|
|
367
|
+
}), isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SliderBubbleInput, {
|
|
368
|
+
name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
|
|
369
|
+
form: context.form,
|
|
370
|
+
value
|
|
371
|
+
}, index)]
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
SliderThumb.displayName = THUMB_NAME;
|
|
375
|
+
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
376
|
+
var SliderBubbleInput = import_react.forwardRef(({ __scopeSlider, value, ...props }, forwardedRef) => {
|
|
377
|
+
const ref = import_react.useRef(null);
|
|
378
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
379
|
+
const prevValue = usePrevious(value);
|
|
380
|
+
import_react.useEffect(() => {
|
|
381
|
+
const input = ref.current;
|
|
382
|
+
if (!input) return;
|
|
383
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
384
|
+
const setValue = Object.getOwnPropertyDescriptor(inputProto, "value").set;
|
|
385
|
+
if (prevValue !== value && setValue) {
|
|
386
|
+
const event = new Event("input", { bubbles: true });
|
|
387
|
+
setValue.call(input, value);
|
|
388
|
+
input.dispatchEvent(event);
|
|
389
|
+
}
|
|
390
|
+
}, [prevValue, value]);
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.input, {
|
|
392
|
+
style: { display: "none" },
|
|
393
|
+
...props,
|
|
394
|
+
ref: composedRefs,
|
|
395
|
+
defaultValue: value
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
SliderBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
399
|
+
function getNextSortedValues(prevValues = [], nextValue, atIndex) {
|
|
400
|
+
const nextValues = [...prevValues];
|
|
401
|
+
nextValues[atIndex] = nextValue;
|
|
402
|
+
return nextValues.sort((a, b) => a - b);
|
|
403
|
+
}
|
|
404
|
+
function convertValueToPercentage(value, min, max) {
|
|
405
|
+
return clamp(100 / (max - min) * (value - min), [0, 100]);
|
|
406
|
+
}
|
|
407
|
+
function getLabel(index, totalValues) {
|
|
408
|
+
if (totalValues > 2) return `Value ${index + 1} of ${totalValues}`;
|
|
409
|
+
else if (totalValues === 2) return ["Minimum", "Maximum"][index];
|
|
410
|
+
else return;
|
|
411
|
+
}
|
|
412
|
+
function getClosestValueIndex(values, nextValue) {
|
|
413
|
+
if (values.length === 1) return 0;
|
|
414
|
+
const distances = values.map((value) => Math.abs(value - nextValue));
|
|
415
|
+
const closestDistance = Math.min(...distances);
|
|
416
|
+
return distances.indexOf(closestDistance);
|
|
417
|
+
}
|
|
418
|
+
function getThumbInBoundsOffset(width, left, direction) {
|
|
419
|
+
const halfWidth = width / 2;
|
|
420
|
+
return (halfWidth - linearScale([0, 50], [0, halfWidth])(left) * direction) * direction;
|
|
421
|
+
}
|
|
422
|
+
function getStepsBetweenValues(values) {
|
|
423
|
+
return values.slice(0, -1).map((value, index) => values[index + 1] - value);
|
|
424
|
+
}
|
|
425
|
+
function hasMinStepsBetweenValues(values, minStepsBetweenValues) {
|
|
426
|
+
if (minStepsBetweenValues > 0) {
|
|
427
|
+
const stepsBetweenValues = getStepsBetweenValues(values);
|
|
428
|
+
return Math.min(...stepsBetweenValues) >= minStepsBetweenValues;
|
|
429
|
+
}
|
|
430
|
+
return true;
|
|
431
|
+
}
|
|
432
|
+
function linearScale(input, output) {
|
|
433
|
+
return (value) => {
|
|
434
|
+
if (input[0] === input[1] || output[0] === output[1]) return output[0];
|
|
435
|
+
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
436
|
+
return output[0] + ratio * (value - input[0]);
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function getDecimalCount(value) {
|
|
440
|
+
return (String(value).split(".")[1] || "").length;
|
|
441
|
+
}
|
|
442
|
+
function roundValue(value, decimalCount) {
|
|
443
|
+
const rounder = Math.pow(10, decimalCount);
|
|
444
|
+
return Math.round(value * rounder) / rounder;
|
|
445
|
+
}
|
|
446
|
+
var Root = Slider;
|
|
447
|
+
var Track = SliderTrack;
|
|
448
|
+
var Range = SliderRange;
|
|
449
|
+
var Thumb = SliderThumb;
|
|
450
|
+
//#endregion
|
|
451
|
+
export { Track as i, Root as n, Thumb as r, Range as t };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { r as __toESM } from "../_runtime.mjs";
|
|
2
|
+
import { E as useControllableState, N as useComposedRefs, O as createContextScope, P as require_jsx_runtime, k as Primitive } from "./@radix-ui/react-alert-dialog+[...].mjs";
|
|
3
|
+
import { u as require_react } from "./@floating-ui/react-dom+[...].mjs";
|
|
4
|
+
import { p as usePrevious } from "./@radix-ui/react-select+[...].mjs";
|
|
5
|
+
import { t as composeEventHandlers } from "./radix-ui__primitive.mjs";
|
|
6
|
+
import { o as useSize } from "./@radix-ui/react-popper+[...].mjs";
|
|
7
|
+
//#region ../../node_modules/.pnpm/@radix-ui+react-switch@1.2.6_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react_e3738c514c10df2ef7e24af5ee461853/node_modules/@radix-ui/react-switch/dist/index.mjs
|
|
8
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
9
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
10
|
+
var SWITCH_NAME = "Switch";
|
|
11
|
+
var [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);
|
|
12
|
+
var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
|
|
13
|
+
var Switch = import_react.forwardRef((props, forwardedRef) => {
|
|
14
|
+
const { __scopeSwitch, name, checked: checkedProp, defaultChecked, required, disabled, value = "on", onCheckedChange, form, ...switchProps } = props;
|
|
15
|
+
const [button, setButton] = import_react.useState(null);
|
|
16
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
17
|
+
const hasConsumerStoppedPropagationRef = import_react.useRef(false);
|
|
18
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
19
|
+
const [checked, setChecked] = useControllableState({
|
|
20
|
+
prop: checkedProp,
|
|
21
|
+
defaultProp: defaultChecked ?? false,
|
|
22
|
+
onChange: onCheckedChange,
|
|
23
|
+
caller: SWITCH_NAME
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SwitchProvider, {
|
|
26
|
+
scope: __scopeSwitch,
|
|
27
|
+
checked,
|
|
28
|
+
disabled,
|
|
29
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.button, {
|
|
30
|
+
type: "button",
|
|
31
|
+
role: "switch",
|
|
32
|
+
"aria-checked": checked,
|
|
33
|
+
"aria-required": required,
|
|
34
|
+
"data-state": getState(checked),
|
|
35
|
+
"data-disabled": disabled ? "" : void 0,
|
|
36
|
+
disabled,
|
|
37
|
+
value,
|
|
38
|
+
...switchProps,
|
|
39
|
+
ref: composedRefs,
|
|
40
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
41
|
+
setChecked((prevChecked) => !prevChecked);
|
|
42
|
+
if (isFormControl) {
|
|
43
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
44
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
}), isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SwitchBubbleInput, {
|
|
48
|
+
control: button,
|
|
49
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
50
|
+
name,
|
|
51
|
+
value,
|
|
52
|
+
checked,
|
|
53
|
+
required,
|
|
54
|
+
disabled,
|
|
55
|
+
form,
|
|
56
|
+
style: { transform: "translateX(-100%)" }
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
Switch.displayName = SWITCH_NAME;
|
|
61
|
+
var THUMB_NAME = "SwitchThumb";
|
|
62
|
+
var SwitchThumb = import_react.forwardRef((props, forwardedRef) => {
|
|
63
|
+
const { __scopeSwitch, ...thumbProps } = props;
|
|
64
|
+
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
66
|
+
"data-state": getState(context.checked),
|
|
67
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
68
|
+
...thumbProps,
|
|
69
|
+
ref: forwardedRef
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
SwitchThumb.displayName = THUMB_NAME;
|
|
73
|
+
var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
|
|
74
|
+
var SwitchBubbleInput = import_react.forwardRef(({ __scopeSwitch, control, checked, bubbles = true, ...props }, forwardedRef) => {
|
|
75
|
+
const ref = import_react.useRef(null);
|
|
76
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
77
|
+
const prevChecked = usePrevious(checked);
|
|
78
|
+
const controlSize = useSize(control);
|
|
79
|
+
import_react.useEffect(() => {
|
|
80
|
+
const input = ref.current;
|
|
81
|
+
if (!input) return;
|
|
82
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
83
|
+
const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
|
|
84
|
+
if (prevChecked !== checked && setChecked) {
|
|
85
|
+
const event = new Event("click", { bubbles });
|
|
86
|
+
setChecked.call(input, checked);
|
|
87
|
+
input.dispatchEvent(event);
|
|
88
|
+
}
|
|
89
|
+
}, [
|
|
90
|
+
prevChecked,
|
|
91
|
+
checked,
|
|
92
|
+
bubbles
|
|
93
|
+
]);
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
95
|
+
type: "checkbox",
|
|
96
|
+
"aria-hidden": true,
|
|
97
|
+
defaultChecked: checked,
|
|
98
|
+
...props,
|
|
99
|
+
tabIndex: -1,
|
|
100
|
+
ref: composedRefs,
|
|
101
|
+
style: {
|
|
102
|
+
...props.style,
|
|
103
|
+
...controlSize,
|
|
104
|
+
position: "absolute",
|
|
105
|
+
pointerEvents: "none",
|
|
106
|
+
opacity: 0,
|
|
107
|
+
margin: 0
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
112
|
+
function getState(checked) {
|
|
113
|
+
return checked ? "checked" : "unchecked";
|
|
114
|
+
}
|
|
115
|
+
var Root = Switch;
|
|
116
|
+
var Thumb = SwitchThumb;
|
|
117
|
+
//#endregion
|
|
118
|
+
export { Thumb as n, Root as t };
|