@purpurds/slider 8.8.0 → 8.9.0

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/slider.es.js CHANGED
@@ -1,14 +1,14 @@
1
- import { jsx as S, jsxs as J } from "react/jsx-runtime";
1
+ import { jsx as h, jsxs as J } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
3
  import D, { forwardRef as ge, useId as be } from "react";
4
4
  import "react-dom";
5
5
  function Q(e, [t, n]) {
6
6
  return Math.min(n, Math.max(t, e));
7
7
  }
8
- function N(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
9
- return function(i) {
10
- if (e == null || e(i), n === !1 || !i.defaultPrevented)
11
- return t == null ? void 0 : t(i);
8
+ function A(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
9
+ return function(r) {
10
+ if (e?.(r), n === !1 || !r.defaultPrevented)
11
+ return t?.(r);
12
12
  };
13
13
  }
14
14
  function G(e, t) {
@@ -19,65 +19,63 @@ function G(e, t) {
19
19
  function ee(...e) {
20
20
  return (t) => {
21
21
  let n = !1;
22
- const o = e.map((i) => {
23
- const r = G(i, t);
24
- return !n && typeof r == "function" && (n = !0), r;
22
+ const i = e.map((r) => {
23
+ const o = G(r, t);
24
+ return !n && typeof o == "function" && (n = !0), o;
25
25
  });
26
26
  if (n)
27
27
  return () => {
28
- for (let i = 0; i < o.length; i++) {
29
- const r = o[i];
30
- typeof r == "function" ? r() : G(e[i], null);
28
+ for (let r = 0; r < i.length; r++) {
29
+ const o = i[r];
30
+ typeof o == "function" ? o() : G(e[r], null);
31
31
  }
32
32
  };
33
33
  };
34
34
  }
35
- function I(...e) {
35
+ function M(...e) {
36
36
  return l.useCallback(ee(...e), e);
37
37
  }
38
38
  function te(e, t = []) {
39
39
  let n = [];
40
- function o(r, s) {
40
+ function i(o, s) {
41
41
  const c = l.createContext(s), u = n.length;
42
42
  n = [...n, s];
43
43
  const d = (a) => {
44
- var h;
45
- const { scope: f, children: y, ..._ } = a, m = ((h = f == null ? void 0 : f[e]) == null ? void 0 : h[u]) || c, p = l.useMemo(() => _, Object.values(_));
46
- return /* @__PURE__ */ S(m.Provider, { value: p, children: y });
44
+ const { scope: p, children: y, ..._ } = a, m = p?.[e]?.[u] || c, f = l.useMemo(() => _, Object.values(_));
45
+ return /* @__PURE__ */ h(m.Provider, { value: f, children: y });
47
46
  };
48
- d.displayName = r + "Provider";
49
- function g(a, f) {
50
- var m;
51
- const y = ((m = f == null ? void 0 : f[e]) == null ? void 0 : m[u]) || c, _ = l.useContext(y);
47
+ d.displayName = o + "Provider";
48
+ function g(a, p) {
49
+ const y = p?.[e]?.[u] || c, _ = l.useContext(y);
52
50
  if (_) return _;
53
51
  if (s !== void 0) return s;
54
- throw new Error(`\`${a}\` must be used within \`${r}\``);
52
+ throw new Error(`\`${a}\` must be used within \`${o}\``);
55
53
  }
56
54
  return [d, g];
57
55
  }
58
- const i = () => {
59
- const r = n.map((s) => l.createContext(s));
56
+ const r = () => {
57
+ const o = n.map((s) => l.createContext(s));
60
58
  return function(c) {
61
- const u = (c == null ? void 0 : c[e]) || r;
59
+ const u = c?.[e] || o;
62
60
  return l.useMemo(
63
61
  () => ({ [`__scope${e}`]: { ...c, [e]: u } }),
64
62
  [c, u]
65
63
  );
66
64
  };
67
65
  };
68
- return i.scopeName = e, [o, ye(i, ...t)];
66
+ return r.scopeName = e, [i, ye(r, ...t)];
69
67
  }
70
68
  function ye(...e) {
71
69
  const t = e[0];
72
70
  if (e.length === 1) return t;
73
71
  const n = () => {
74
- const o = e.map((i) => ({
75
- useScope: i(),
76
- scopeName: i.scopeName
72
+ const i = e.map((r) => ({
73
+ useScope: r(),
74
+ scopeName: r.scopeName
77
75
  }));
78
- return function(r) {
79
- const s = o.reduce((c, { useScope: u, scopeName: d }) => {
80
- const a = u(r)[`__scope${d}`];
76
+ return function(o) {
77
+ const s = i.reduce((c, { useScope: u, scopeName: d }) => {
78
+ const a = u(o)[`__scope${d}`];
81
79
  return { ...c, ...a };
82
80
  }, {});
83
81
  return l.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
@@ -89,10 +87,7 @@ function ne(e) {
89
87
  const t = l.useRef(e);
90
88
  return l.useEffect(() => {
91
89
  t.current = e;
92
- }), l.useMemo(() => (...n) => {
93
- var o;
94
- return (o = t.current) == null ? void 0 : o.call(t, ...n);
95
- }, []);
90
+ }), l.useMemo(() => (...n) => t.current?.(...n), []);
96
91
  }
97
92
  function _e({
98
93
  prop: e,
@@ -100,102 +95,101 @@ function _e({
100
95
  onChange: n = () => {
101
96
  }
102
97
  }) {
103
- const [o, i] = Ce({ defaultProp: t, onChange: n }), r = e !== void 0, s = r ? e : o, c = ne(n), u = l.useCallback(
98
+ const [i, r] = we({ defaultProp: t, onChange: n }), o = e !== void 0, s = o ? e : i, c = ne(n), u = l.useCallback(
104
99
  (d) => {
105
- if (r) {
100
+ if (o) {
106
101
  const a = typeof d == "function" ? d(e) : d;
107
102
  a !== e && c(a);
108
103
  } else
109
- i(d);
104
+ r(d);
110
105
  },
111
- [r, e, i, c]
106
+ [o, e, r, c]
112
107
  );
113
108
  return [s, u];
114
109
  }
115
- function Ce({
110
+ function we({
116
111
  defaultProp: e,
117
112
  onChange: t
118
113
  }) {
119
- const n = l.useState(e), [o] = n, i = l.useRef(o), r = ne(t);
114
+ const n = l.useState(e), [i] = n, r = l.useRef(i), o = ne(t);
120
115
  return l.useEffect(() => {
121
- i.current !== o && (r(o), i.current = o);
122
- }, [o, i, r]), n;
116
+ r.current !== i && (o(i), r.current = i);
117
+ }, [i, r, o]), n;
123
118
  }
124
- var we = l.createContext(void 0);
125
- function xe(e) {
126
- const t = l.useContext(we);
119
+ var Ce = l.createContext(void 0);
120
+ function Re(e) {
121
+ const t = l.useContext(Ce);
127
122
  return e || t || "ltr";
128
123
  }
129
- function Re(e) {
124
+ function xe(e) {
130
125
  const t = l.useRef({ value: e, previous: e });
131
126
  return l.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
132
127
  }
133
- var Pe = globalThis != null && globalThis.document ? l.useLayoutEffect : () => {
128
+ var Ee = globalThis?.document ? l.useLayoutEffect : () => {
134
129
  };
135
- function Ee(e) {
130
+ function Pe(e) {
136
131
  const [t, n] = l.useState(void 0);
137
- return Pe(() => {
132
+ return Ee(() => {
138
133
  if (e) {
139
134
  n({ width: e.offsetWidth, height: e.offsetHeight });
140
- const o = new ResizeObserver((i) => {
141
- if (!Array.isArray(i) || !i.length)
135
+ const i = new ResizeObserver((r) => {
136
+ if (!Array.isArray(r) || !r.length)
142
137
  return;
143
- const r = i[0];
138
+ const o = r[0];
144
139
  let s, c;
145
- if ("borderBoxSize" in r) {
146
- const u = r.borderBoxSize, d = Array.isArray(u) ? u[0] : u;
140
+ if ("borderBoxSize" in o) {
141
+ const u = o.borderBoxSize, d = Array.isArray(u) ? u[0] : u;
147
142
  s = d.inlineSize, c = d.blockSize;
148
143
  } else
149
144
  s = e.offsetWidth, c = e.offsetHeight;
150
145
  n({ width: s, height: c });
151
146
  });
152
- return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
147
+ return i.observe(e, { box: "border-box" }), () => i.unobserve(e);
153
148
  } else
154
149
  n(void 0);
155
150
  }, [e]), t;
156
151
  }
157
152
  // @__NO_SIDE_EFFECTS__
158
- function F(e) {
159
- const t = /* @__PURE__ */ De(e), n = l.forwardRef((o, i) => {
160
- const { children: r, ...s } = o, c = l.Children.toArray(r), u = c.find(Me);
153
+ function j(e) {
154
+ const t = /* @__PURE__ */ De(e), n = l.forwardRef((i, r) => {
155
+ const { children: o, ...s } = i, c = l.Children.toArray(o), u = c.find(Ie);
161
156
  if (u) {
162
157
  const d = u.props.children, g = c.map((a) => a === u ? l.Children.count(d) > 1 ? l.Children.only(null) : l.isValidElement(d) ? d.props.children : null : a);
163
- return /* @__PURE__ */ S(t, { ...s, ref: i, children: l.isValidElement(d) ? l.cloneElement(d, void 0, g) : null });
158
+ return /* @__PURE__ */ h(t, { ...s, ref: r, children: l.isValidElement(d) ? l.cloneElement(d, void 0, g) : null });
164
159
  }
165
- return /* @__PURE__ */ S(t, { ...s, ref: i, children: r });
160
+ return /* @__PURE__ */ h(t, { ...s, ref: r, children: o });
166
161
  });
167
162
  return n.displayName = `${e}.Slot`, n;
168
163
  }
169
164
  // @__NO_SIDE_EFFECTS__
170
165
  function De(e) {
171
- const t = l.forwardRef((n, o) => {
172
- const { children: i, ...r } = n;
173
- if (l.isValidElement(i)) {
174
- const s = Ne(i), c = Ae(r, i.props);
175
- return i.type !== l.Fragment && (c.ref = o ? ee(o, s) : s), l.cloneElement(i, c);
166
+ const t = l.forwardRef((n, i) => {
167
+ const { children: r, ...o } = n;
168
+ if (l.isValidElement(r)) {
169
+ const s = Ne(r), c = Ae(o, r.props);
170
+ return r.type !== l.Fragment && (c.ref = i ? ee(i, s) : s), l.cloneElement(r, c);
176
171
  }
177
- return l.Children.count(i) > 1 ? l.Children.only(null) : null;
172
+ return l.Children.count(r) > 1 ? l.Children.only(null) : null;
178
173
  });
179
174
  return t.displayName = `${e}.SlotClone`, t;
180
175
  }
181
- var Ie = Symbol("radix.slottable");
182
- function Me(e) {
183
- return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Ie;
176
+ var Me = Symbol("radix.slottable");
177
+ function Ie(e) {
178
+ return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Me;
184
179
  }
185
180
  function Ae(e, t) {
186
181
  const n = { ...t };
187
- for (const o in t) {
188
- const i = e[o], r = t[o];
189
- /^on[A-Z]/.test(o) ? i && r ? n[o] = (...c) => {
190
- r(...c), i(...c);
191
- } : i && (n[o] = i) : o === "style" ? n[o] = { ...i, ...r } : o === "className" && (n[o] = [i, r].filter(Boolean).join(" "));
182
+ for (const i in t) {
183
+ const r = e[i], o = t[i];
184
+ /^on[A-Z]/.test(i) ? r && o ? n[i] = (...c) => {
185
+ o(...c), r(...c);
186
+ } : r && (n[i] = r) : i === "style" ? n[i] = { ...r, ...o } : i === "className" && (n[i] = [r, o].filter(Boolean).join(" "));
192
187
  }
193
188
  return { ...e, ...n };
194
189
  }
195
190
  function Ne(e) {
196
- var o, i;
197
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
198
- return n ? e.ref : (t = (i = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : i.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
191
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
192
+ return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
199
193
  }
200
194
  var Oe = [
201
195
  "a",
@@ -214,145 +208,144 @@ var Oe = [
214
208
  "span",
215
209
  "svg",
216
210
  "ul"
217
- ], K = Oe.reduce((e, t) => {
218
- const n = /* @__PURE__ */ F(`Primitive.${t}`), o = l.forwardRef((i, r) => {
219
- const { asChild: s, ...c } = i, u = s ? n : t;
220
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ S(u, { ...c, ref: r });
211
+ ], z = Oe.reduce((e, t) => {
212
+ const n = /* @__PURE__ */ j(`Primitive.${t}`), i = l.forwardRef((r, o) => {
213
+ const { asChild: s, ...c } = r, u = s ? n : t;
214
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ h(u, { ...c, ref: o });
221
215
  });
222
- return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
216
+ return i.displayName = `Primitive.${t}`, { ...e, [t]: i };
223
217
  }, {});
224
218
  function Te(e) {
225
- const t = e + "CollectionProvider", [n, o] = te(t), [i, r] = n(
219
+ const t = e + "CollectionProvider", [n, i] = te(t), [r, o] = n(
226
220
  t,
227
221
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
228
222
  ), s = (m) => {
229
- const { scope: p, children: h } = m, C = D.useRef(null), b = D.useRef(/* @__PURE__ */ new Map()).current;
230
- return /* @__PURE__ */ S(i, { scope: p, itemMap: b, collectionRef: C, children: h });
223
+ const { scope: f, children: S } = m, w = D.useRef(null), b = D.useRef(/* @__PURE__ */ new Map()).current;
224
+ return /* @__PURE__ */ h(r, { scope: f, itemMap: b, collectionRef: w, children: S });
231
225
  };
232
226
  s.displayName = t;
233
- const c = e + "CollectionSlot", u = /* @__PURE__ */ F(c), d = D.forwardRef(
234
- (m, p) => {
235
- const { scope: h, children: C } = m, b = r(c, h), v = I(p, b.collectionRef);
236
- return /* @__PURE__ */ S(u, { ref: v, children: C });
227
+ const c = e + "CollectionSlot", u = /* @__PURE__ */ j(c), d = D.forwardRef(
228
+ (m, f) => {
229
+ const { scope: S, children: w } = m, b = o(c, S), v = M(f, b.collectionRef);
230
+ return /* @__PURE__ */ h(u, { ref: v, children: w });
237
231
  }
238
232
  );
239
233
  d.displayName = c;
240
- const g = e + "CollectionItemSlot", a = "data-radix-collection-item", f = /* @__PURE__ */ F(g), y = D.forwardRef(
241
- (m, p) => {
242
- const { scope: h, children: C, ...b } = m, v = D.useRef(null), x = I(p, v), R = r(g, h);
243
- return D.useEffect(() => (R.itemMap.set(v, { ref: v, ...b }), () => void R.itemMap.delete(v))), /* @__PURE__ */ S(f, { [a]: "", ref: x, children: C });
234
+ const g = e + "CollectionItemSlot", a = "data-radix-collection-item", p = /* @__PURE__ */ j(g), y = D.forwardRef(
235
+ (m, f) => {
236
+ const { scope: S, children: w, ...b } = m, v = D.useRef(null), R = M(f, v), x = o(g, S);
237
+ return D.useEffect(() => (x.itemMap.set(v, { ref: v, ...b }), () => void x.itemMap.delete(v))), /* @__PURE__ */ h(p, { [a]: "", ref: R, children: w });
244
238
  }
245
239
  );
246
240
  y.displayName = g;
247
241
  function _(m) {
248
- const p = r(e + "CollectionConsumer", m);
242
+ const f = o(e + "CollectionConsumer", m);
249
243
  return D.useCallback(() => {
250
- const C = p.collectionRef.current;
251
- if (!C) return [];
252
- const b = Array.from(C.querySelectorAll(`[${a}]`));
253
- return Array.from(p.itemMap.values()).sort(
254
- (R, T) => b.indexOf(R.ref.current) - b.indexOf(T.ref.current)
244
+ const w = f.collectionRef.current;
245
+ if (!w) return [];
246
+ const b = Array.from(w.querySelectorAll(`[${a}]`));
247
+ return Array.from(f.itemMap.values()).sort(
248
+ (x, O) => b.indexOf(x.ref.current) - b.indexOf(O.ref.current)
255
249
  );
256
- }, [p.collectionRef, p.itemMap]);
250
+ }, [f.collectionRef, f.itemMap]);
257
251
  }
258
252
  return [
259
253
  { Provider: s, Slot: d, ItemSlot: y },
260
254
  _,
261
- o
255
+ i
262
256
  ];
263
257
  }
264
- var re = ["PageUp", "PageDown"], oe = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], ie = {
258
+ var oe = ["PageUp", "PageDown"], re = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], ie = {
265
259
  "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
266
260
  "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
267
261
  "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
268
262
  "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
269
- }, O = "Slider", [H, Ve, ke] = Te(O), [se] = te(O, [
263
+ }, N = "Slider", [F, Ve, ke] = Te(N), [se] = te(N, [
270
264
  ke
271
- ]), [Be, L] = se(O), ce = l.forwardRef(
265
+ ]), [Ke, B] = se(N), ce = l.forwardRef(
272
266
  (e, t) => {
273
267
  const {
274
268
  name: n,
275
- min: o = 0,
276
- max: i = 100,
277
- step: r = 1,
269
+ min: i = 0,
270
+ max: r = 100,
271
+ step: o = 1,
278
272
  orientation: s = "horizontal",
279
273
  disabled: c = !1,
280
274
  minStepsBetweenThumbs: u = 0,
281
- defaultValue: d = [o],
275
+ defaultValue: d = [i],
282
276
  value: g,
283
277
  onValueChange: a = () => {
284
278
  },
285
- onValueCommit: f = () => {
279
+ onValueCommit: p = () => {
286
280
  },
287
281
  inverted: y = !1,
288
282
  form: _,
289
283
  ...m
290
- } = e, p = l.useRef(/* @__PURE__ */ new Set()), h = l.useRef(0), b = s === "horizontal" ? ze : Ke, [v = [], x] = _e({
284
+ } = e, f = l.useRef(/* @__PURE__ */ new Set()), S = l.useRef(0), b = s === "horizontal" ? ze : Be, [v = [], R] = _e({
291
285
  prop: g,
292
286
  defaultProp: d,
293
- onChange: (w) => {
294
- var M;
295
- (M = [...p.current][h.current]) == null || M.focus(), a(w);
287
+ onChange: (C) => {
288
+ [...f.current][S.current]?.focus(), a(C);
296
289
  }
297
- }), R = l.useRef(v);
298
- function T(w) {
299
- const P = He(v, w);
300
- V(w, P);
290
+ }), x = l.useRef(v);
291
+ function O(C) {
292
+ const E = Fe(v, C);
293
+ T(C, E);
301
294
  }
302
- function Se(w) {
303
- V(w, h.current);
295
+ function he(C) {
296
+ T(C, S.current);
304
297
  }
305
298
  function ve() {
306
- const w = R.current[h.current];
307
- v[h.current] !== w && f(v);
299
+ const C = x.current[S.current];
300
+ v[S.current] !== C && p(v);
308
301
  }
309
- function V(w, P, { commit: M } = { commit: !1 }) {
310
- const q = qe(r), $ = Xe(Math.round((w - o) / r) * r + o, q), k = Q($, [o, i]);
311
- x((A = []) => {
312
- const E = je(A, k, P);
313
- if (Ye(E, u * r)) {
314
- h.current = E.indexOf(k);
315
- const X = String(E) !== String(A);
316
- return X && M && f(E), X ? E : A;
302
+ function T(C, E, { commit: H } = { commit: !1 }) {
303
+ const q = qe(o), L = Xe(Math.round((C - i) / o) * o + i, q), V = Q(L, [i, r]);
304
+ R((I = []) => {
305
+ const P = $e(I, V, E);
306
+ if (Ye(P, u * o)) {
307
+ S.current = P.indexOf(V);
308
+ const X = String(P) !== String(I);
309
+ return X && H && p(P), X ? P : I;
317
310
  } else
318
- return A;
311
+ return I;
319
312
  });
320
313
  }
321
- return /* @__PURE__ */ S(
322
- Be,
314
+ return /* @__PURE__ */ h(
315
+ Ke,
323
316
  {
324
317
  scope: e.__scopeSlider,
325
318
  name: n,
326
319
  disabled: c,
327
- min: o,
328
- max: i,
329
- valueIndexToChangeRef: h,
330
- thumbs: p.current,
320
+ min: i,
321
+ max: r,
322
+ valueIndexToChangeRef: S,
323
+ thumbs: f.current,
331
324
  values: v,
332
325
  orientation: s,
333
326
  form: _,
334
- children: /* @__PURE__ */ S(H.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ S(H.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ S(
327
+ children: /* @__PURE__ */ h(F.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ h(F.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ h(
335
328
  b,
336
329
  {
337
330
  "aria-disabled": c,
338
331
  "data-disabled": c ? "" : void 0,
339
332
  ...m,
340
333
  ref: t,
341
- onPointerDown: N(m.onPointerDown, () => {
342
- c || (R.current = v);
334
+ onPointerDown: A(m.onPointerDown, () => {
335
+ c || (x.current = v);
343
336
  }),
344
- min: o,
345
- max: i,
337
+ min: i,
338
+ max: r,
346
339
  inverted: y,
347
- onSlideStart: c ? void 0 : T,
348
- onSlideMove: c ? void 0 : Se,
340
+ onSlideStart: c ? void 0 : O,
341
+ onSlideMove: c ? void 0 : he,
349
342
  onSlideEnd: c ? void 0 : ve,
350
- onHomeKeyDown: () => !c && V(o, 0, { commit: !0 }),
351
- onEndKeyDown: () => !c && V(i, v.length - 1, { commit: !0 }),
352
- onStepKeyDown: ({ event: w, direction: P }) => {
343
+ onHomeKeyDown: () => !c && T(i, 0, { commit: !0 }),
344
+ onEndKeyDown: () => !c && T(r, v.length - 1, { commit: !0 }),
345
+ onStepKeyDown: ({ event: C, direction: E }) => {
353
346
  if (!c) {
354
- const $ = re.includes(w.key) || w.shiftKey && oe.includes(w.key) ? 10 : 1, k = h.current, A = v[k], E = r * $ * P;
355
- V(A + E, k, { commit: !0 });
347
+ const L = oe.includes(C.key) || C.shiftKey && re.includes(C.key) ? 10 : 1, V = S.current, I = v[V], P = o * L * E;
348
+ T(I + P, V, { commit: !0 });
356
349
  }
357
350
  }
358
351
  }
@@ -361,8 +354,8 @@ var re = ["PageUp", "PageDown"], oe = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arr
361
354
  );
362
355
  }
363
356
  );
364
- ce.displayName = O;
365
- var [le, ae] = se(O, {
357
+ ce.displayName = N;
358
+ var [le, ae] = se(N, {
366
359
  startEdge: "left",
367
360
  endEdge: "right",
368
361
  size: "width",
@@ -371,28 +364,28 @@ var [le, ae] = se(O, {
371
364
  (e, t) => {
372
365
  const {
373
366
  min: n,
374
- max: o,
375
- dir: i,
376
- inverted: r,
367
+ max: i,
368
+ dir: r,
369
+ inverted: o,
377
370
  onSlideStart: s,
378
371
  onSlideMove: c,
379
372
  onSlideEnd: u,
380
373
  onStepKeyDown: d,
381
374
  ...g
382
- } = e, [a, f] = l.useState(null), y = I(t, (b) => f(b)), _ = l.useRef(void 0), m = xe(i), p = m === "ltr", h = p && !r || !p && r;
383
- function C(b) {
384
- const v = _.current || a.getBoundingClientRect(), x = [0, v.width], T = Y(x, h ? [n, o] : [o, n]);
385
- return _.current = v, T(b - v.left);
375
+ } = e, [a, p] = l.useState(null), y = M(t, (b) => p(b)), _ = l.useRef(void 0), m = Re(r), f = m === "ltr", S = f && !o || !f && o;
376
+ function w(b) {
377
+ const v = _.current || a.getBoundingClientRect(), R = [0, v.width], O = Y(R, S ? [n, i] : [i, n]);
378
+ return _.current = v, O(b - v.left);
386
379
  }
387
- return /* @__PURE__ */ S(
380
+ return /* @__PURE__ */ h(
388
381
  le,
389
382
  {
390
383
  scope: e.__scopeSlider,
391
- startEdge: h ? "left" : "right",
392
- endEdge: h ? "right" : "left",
393
- direction: h ? 1 : -1,
384
+ startEdge: S ? "left" : "right",
385
+ endEdge: S ? "right" : "left",
386
+ direction: S ? 1 : -1,
394
387
  size: "width",
395
- children: /* @__PURE__ */ S(
388
+ children: /* @__PURE__ */ h(
396
389
  ue,
397
390
  {
398
391
  dir: m,
@@ -404,42 +397,42 @@ var [le, ae] = se(O, {
404
397
  "--radix-slider-thumb-transform": "translateX(-50%)"
405
398
  },
406
399
  onSlideStart: (b) => {
407
- const v = C(b.clientX);
408
- s == null || s(v);
400
+ const v = w(b.clientX);
401
+ s?.(v);
409
402
  },
410
403
  onSlideMove: (b) => {
411
- const v = C(b.clientX);
412
- c == null || c(v);
404
+ const v = w(b.clientX);
405
+ c?.(v);
413
406
  },
414
407
  onSlideEnd: () => {
415
- _.current = void 0, u == null || u();
408
+ _.current = void 0, u?.();
416
409
  },
417
410
  onStepKeyDown: (b) => {
418
- const x = ie[h ? "from-left" : "from-right"].includes(b.key);
419
- d == null || d({ event: b, direction: x ? -1 : 1 });
411
+ const R = ie[S ? "from-left" : "from-right"].includes(b.key);
412
+ d?.({ event: b, direction: R ? -1 : 1 });
420
413
  }
421
414
  }
422
415
  )
423
416
  }
424
417
  );
425
418
  }
426
- ), Ke = l.forwardRef(
419
+ ), Be = l.forwardRef(
427
420
  (e, t) => {
428
421
  const {
429
422
  min: n,
430
- max: o,
431
- inverted: i,
432
- onSlideStart: r,
423
+ max: i,
424
+ inverted: r,
425
+ onSlideStart: o,
433
426
  onSlideMove: s,
434
427
  onSlideEnd: c,
435
428
  onStepKeyDown: u,
436
429
  ...d
437
- } = e, g = l.useRef(null), a = I(t, g), f = l.useRef(void 0), y = !i;
430
+ } = e, g = l.useRef(null), a = M(t, g), p = l.useRef(void 0), y = !r;
438
431
  function _(m) {
439
- const p = f.current || g.current.getBoundingClientRect(), h = [0, p.height], b = Y(h, y ? [o, n] : [n, o]);
440
- return f.current = p, b(m - p.top);
432
+ const f = p.current || g.current.getBoundingClientRect(), S = [0, f.height], b = Y(S, y ? [i, n] : [n, i]);
433
+ return p.current = f, b(m - f.top);
441
434
  }
442
- return /* @__PURE__ */ S(
435
+ return /* @__PURE__ */ h(
443
436
  le,
444
437
  {
445
438
  scope: e.__scopeSlider,
@@ -447,7 +440,7 @@ var [le, ae] = se(O, {
447
440
  endEdge: y ? "top" : "bottom",
448
441
  size: "height",
449
442
  direction: y ? 1 : -1,
450
- children: /* @__PURE__ */ S(
443
+ children: /* @__PURE__ */ h(
451
444
  ue,
452
445
  {
453
446
  "data-orientation": "vertical",
@@ -458,19 +451,19 @@ var [le, ae] = se(O, {
458
451
  "--radix-slider-thumb-transform": "translateY(50%)"
459
452
  },
460
453
  onSlideStart: (m) => {
461
- const p = _(m.clientY);
462
- r == null || r(p);
454
+ const f = _(m.clientY);
455
+ o?.(f);
463
456
  },
464
457
  onSlideMove: (m) => {
465
- const p = _(m.clientY);
466
- s == null || s(p);
458
+ const f = _(m.clientY);
459
+ s?.(f);
467
460
  },
468
461
  onSlideEnd: () => {
469
- f.current = void 0, c == null || c();
462
+ p.current = void 0, c?.();
470
463
  },
471
464
  onStepKeyDown: (m) => {
472
- const h = ie[y ? "from-bottom" : "from-top"].includes(m.key);
473
- u == null || u({ event: m, direction: h ? -1 : 1 });
465
+ const S = ie[y ? "from-bottom" : "from-top"].includes(m.key);
466
+ u?.({ event: m, direction: S ? -1 : 1 });
474
467
  }
475
468
  }
476
469
  )
@@ -481,45 +474,45 @@ var [le, ae] = se(O, {
481
474
  (e, t) => {
482
475
  const {
483
476
  __scopeSlider: n,
484
- onSlideStart: o,
485
- onSlideMove: i,
486
- onSlideEnd: r,
477
+ onSlideStart: i,
478
+ onSlideMove: r,
479
+ onSlideEnd: o,
487
480
  onHomeKeyDown: s,
488
481
  onEndKeyDown: c,
489
482
  onStepKeyDown: u,
490
483
  ...d
491
- } = e, g = L(O, n);
492
- return /* @__PURE__ */ S(
493
- K.span,
484
+ } = e, g = B(N, n);
485
+ return /* @__PURE__ */ h(
486
+ z.span,
494
487
  {
495
488
  ...d,
496
489
  ref: t,
497
- onKeyDown: N(e.onKeyDown, (a) => {
498
- a.key === "Home" ? (s(a), a.preventDefault()) : a.key === "End" ? (c(a), a.preventDefault()) : re.concat(oe).includes(a.key) && (u(a), a.preventDefault());
490
+ onKeyDown: A(e.onKeyDown, (a) => {
491
+ a.key === "Home" ? (s(a), a.preventDefault()) : a.key === "End" ? (c(a), a.preventDefault()) : oe.concat(re).includes(a.key) && (u(a), a.preventDefault());
499
492
  }),
500
- onPointerDown: N(e.onPointerDown, (a) => {
501
- const f = a.target;
502
- f.setPointerCapture(a.pointerId), a.preventDefault(), g.thumbs.has(f) ? f.focus() : o(a);
493
+ onPointerDown: A(e.onPointerDown, (a) => {
494
+ const p = a.target;
495
+ p.setPointerCapture(a.pointerId), a.preventDefault(), g.thumbs.has(p) ? p.focus() : i(a);
503
496
  }),
504
- onPointerMove: N(e.onPointerMove, (a) => {
505
- a.target.hasPointerCapture(a.pointerId) && i(a);
497
+ onPointerMove: A(e.onPointerMove, (a) => {
498
+ a.target.hasPointerCapture(a.pointerId) && r(a);
506
499
  }),
507
- onPointerUp: N(e.onPointerUp, (a) => {
508
- const f = a.target;
509
- f.hasPointerCapture(a.pointerId) && (f.releasePointerCapture(a.pointerId), r(a));
500
+ onPointerUp: A(e.onPointerUp, (a) => {
501
+ const p = a.target;
502
+ p.hasPointerCapture(a.pointerId) && (p.releasePointerCapture(a.pointerId), o(a));
510
503
  })
511
504
  }
512
505
  );
513
506
  }
514
507
  ), de = "SliderTrack", fe = l.forwardRef(
515
508
  (e, t) => {
516
- const { __scopeSlider: n, ...o } = e, i = L(de, n);
517
- return /* @__PURE__ */ S(
518
- K.span,
509
+ const { __scopeSlider: n, ...i } = e, r = B(de, n);
510
+ return /* @__PURE__ */ h(
511
+ z.span,
519
512
  {
520
- "data-disabled": i.disabled ? "" : void 0,
521
- "data-orientation": i.orientation,
522
- ...o,
513
+ "data-disabled": r.disabled ? "" : void 0,
514
+ "data-orientation": r.orientation,
515
+ ...i,
523
516
  ref: t
524
517
  }
525
518
  );
@@ -528,20 +521,20 @@ var [le, ae] = se(O, {
528
521
  fe.displayName = de;
529
522
  var W = "SliderRange", pe = l.forwardRef(
530
523
  (e, t) => {
531
- const { __scopeSlider: n, ...o } = e, i = L(W, n), r = ae(W, n), s = l.useRef(null), c = I(t, s), u = i.values.length, d = i.values.map(
532
- (f) => he(f, i.min, i.max)
524
+ const { __scopeSlider: n, ...i } = e, r = B(W, n), o = ae(W, n), s = l.useRef(null), c = M(t, s), u = r.values.length, d = r.values.map(
525
+ (p) => Se(p, r.min, r.max)
533
526
  ), g = u > 1 ? Math.min(...d) : 0, a = 100 - Math.max(...d);
534
- return /* @__PURE__ */ S(
535
- K.span,
527
+ return /* @__PURE__ */ h(
528
+ z.span,
536
529
  {
537
- "data-orientation": i.orientation,
538
- "data-disabled": i.disabled ? "" : void 0,
539
- ...o,
530
+ "data-orientation": r.orientation,
531
+ "data-disabled": r.disabled ? "" : void 0,
532
+ ...i,
540
533
  ref: c,
541
534
  style: {
542
535
  ...e.style,
543
- [r.startEdge]: g + "%",
544
- [r.endEdge]: a + "%"
536
+ [o.startEdge]: g + "%",
537
+ [o.endEdge]: a + "%"
545
538
  }
546
539
  }
547
540
  );
@@ -550,15 +543,15 @@ var W = "SliderRange", pe = l.forwardRef(
550
543
  pe.displayName = W;
551
544
  var U = "SliderThumb", me = l.forwardRef(
552
545
  (e, t) => {
553
- const n = Ve(e.__scopeSlider), [o, i] = l.useState(null), r = I(t, (c) => i(c)), s = l.useMemo(
554
- () => o ? n().findIndex((c) => c.ref.current === o) : -1,
555
- [n, o]
546
+ const n = Ve(e.__scopeSlider), [i, r] = l.useState(null), o = M(t, (c) => r(c)), s = l.useMemo(
547
+ () => i ? n().findIndex((c) => c.ref.current === i) : -1,
548
+ [n, i]
556
549
  );
557
- return /* @__PURE__ */ S(Le, { ...e, ref: r, index: s });
550
+ return /* @__PURE__ */ h(He, { ...e, ref: o, index: s });
558
551
  }
559
- ), Le = l.forwardRef(
552
+ ), He = l.forwardRef(
560
553
  (e, t) => {
561
- const { __scopeSlider: n, index: o, name: i, ...r } = e, s = L(U, n), c = ae(U, n), [u, d] = l.useState(null), g = I(t, (C) => d(C)), a = u ? s.form || !!u.closest("form") : !0, f = Ee(u), y = s.values[o], _ = y === void 0 ? 0 : he(y, s.min, s.max), m = Fe(o, s.values.length), p = f == null ? void 0 : f[c.size], h = p ? We(p, _, c.direction) : 0;
554
+ const { __scopeSlider: n, index: i, name: r, ...o } = e, s = B(U, n), c = ae(U, n), [u, d] = l.useState(null), g = M(t, (w) => d(w)), a = u ? s.form || !!u.closest("form") : !0, p = Pe(u), y = s.values[i], _ = y === void 0 ? 0 : Se(y, s.min, s.max), m = je(i, s.values.length), f = p?.[c.size], S = f ? We(f, _, c.direction) : 0;
562
555
  return l.useEffect(() => {
563
556
  if (u)
564
557
  return s.thumbs.add(u), () => {
@@ -570,11 +563,11 @@ var U = "SliderThumb", me = l.forwardRef(
570
563
  style: {
571
564
  transform: "var(--radix-slider-thumb-transform)",
572
565
  position: "absolute",
573
- [c.startEdge]: `calc(${_}% + ${h}px)`
566
+ [c.startEdge]: `calc(${_}% + ${S}px)`
574
567
  },
575
568
  children: [
576
- /* @__PURE__ */ S(H.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ S(
577
- K.span,
569
+ /* @__PURE__ */ h(F.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ h(
570
+ z.span,
578
571
  {
579
572
  role: "slider",
580
573
  "aria-label": e["aria-label"] || m,
@@ -585,22 +578,22 @@ var U = "SliderThumb", me = l.forwardRef(
585
578
  "data-orientation": s.orientation,
586
579
  "data-disabled": s.disabled ? "" : void 0,
587
580
  tabIndex: s.disabled ? void 0 : 0,
588
- ...r,
581
+ ...o,
589
582
  ref: g,
590
583
  style: y === void 0 ? { display: "none" } : e.style,
591
- onFocus: N(e.onFocus, () => {
592
- s.valueIndexToChangeRef.current = o;
584
+ onFocus: A(e.onFocus, () => {
585
+ s.valueIndexToChangeRef.current = i;
593
586
  })
594
587
  }
595
588
  ) }),
596
- a && /* @__PURE__ */ S(
597
- $e,
589
+ a && /* @__PURE__ */ h(
590
+ Le,
598
591
  {
599
- name: i ?? (s.name ? s.name + (s.values.length > 1 ? "[]" : "") : void 0),
592
+ name: r ?? (s.name ? s.name + (s.values.length > 1 ? "[]" : "") : void 0),
600
593
  form: s.form,
601
594
  value: y
602
595
  },
603
- o
596
+ i
604
597
  )
605
598
  ]
606
599
  }
@@ -608,35 +601,35 @@ var U = "SliderThumb", me = l.forwardRef(
608
601
  }
609
602
  );
610
603
  me.displayName = U;
611
- var $e = (e) => {
612
- const { value: t, ...n } = e, o = l.useRef(null), i = Re(t);
604
+ var Le = (e) => {
605
+ const { value: t, ...n } = e, i = l.useRef(null), r = xe(t);
613
606
  return l.useEffect(() => {
614
- const r = o.current, s = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(s, "value").set;
615
- if (i !== t && u) {
607
+ const o = i.current, s = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(s, "value").set;
608
+ if (r !== t && u) {
616
609
  const d = new Event("input", { bubbles: !0 });
617
- u.call(r, t), r.dispatchEvent(d);
610
+ u.call(o, t), o.dispatchEvent(d);
618
611
  }
619
- }, [i, t]), /* @__PURE__ */ S("input", { style: { display: "none" }, ...n, ref: o, defaultValue: t });
612
+ }, [r, t]), /* @__PURE__ */ h("input", { style: { display: "none" }, ...n, ref: i, defaultValue: t });
620
613
  };
621
- function je(e = [], t, n) {
622
- const o = [...e];
623
- return o[n] = t, o.sort((i, r) => i - r);
614
+ function $e(e = [], t, n) {
615
+ const i = [...e];
616
+ return i[n] = t, i.sort((r, o) => r - o);
624
617
  }
625
- function he(e, t, n) {
626
- const r = 100 / (n - t) * (e - t);
627
- return Q(r, [0, 100]);
618
+ function Se(e, t, n) {
619
+ const o = 100 / (n - t) * (e - t);
620
+ return Q(o, [0, 100]);
628
621
  }
629
- function Fe(e, t) {
622
+ function je(e, t) {
630
623
  return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
631
624
  }
632
- function He(e, t) {
625
+ function Fe(e, t) {
633
626
  if (e.length === 1) return 0;
634
- const n = e.map((i) => Math.abs(i - t)), o = Math.min(...n);
635
- return n.indexOf(o);
627
+ const n = e.map((r) => Math.abs(r - t)), i = Math.min(...n);
628
+ return n.indexOf(i);
636
629
  }
637
630
  function We(e, t, n) {
638
- const o = e / 2, r = Y([0, 50], [0, o]);
639
- return (o - r(t) * n) * n;
631
+ const i = e / 2, o = Y([0, 50], [0, i]);
632
+ return (i - o(t) * n) * n;
640
633
  }
641
634
  function Ue(e) {
642
635
  return e.slice(0, -1).map((t, n) => e[n + 1] - t);
@@ -651,8 +644,8 @@ function Ye(e, t) {
651
644
  function Y(e, t) {
652
645
  return (n) => {
653
646
  if (e[0] === e[1] || t[0] === t[1]) return t[0];
654
- const o = (t[1] - t[0]) / (e[1] - e[0]);
655
- return t[0] + o * (n - e[0]);
647
+ const i = (t[1] - t[0]) / (e[1] - e[0]);
648
+ return t[0] + i * (n - e[0]);
656
649
  };
657
650
  }
658
651
  function qe(e) {
@@ -666,76 +659,71 @@ var Ge = ce, Ze = fe, Je = pe, Qe = me;
666
659
  function et(e) {
667
660
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
668
661
  }
669
- var j = { exports: {} };
670
- /*!
671
- Copyright (c) 2018 Jed Watson.
672
- Licensed under the MIT License (MIT), see
673
- http://jedwatson.github.io/classnames
674
- */
662
+ var $ = { exports: {} };
675
663
  var Z;
676
664
  function tt() {
677
665
  return Z || (Z = 1, (function(e) {
678
666
  (function() {
679
667
  var t = {}.hasOwnProperty;
680
668
  function n() {
681
- for (var r = "", s = 0; s < arguments.length; s++) {
669
+ for (var o = "", s = 0; s < arguments.length; s++) {
682
670
  var c = arguments[s];
683
- c && (r = i(r, o.call(this, c)));
671
+ c && (o = r(o, i.call(this, c)));
684
672
  }
685
- return r;
673
+ return o;
686
674
  }
687
- function o(r) {
688
- if (typeof r == "string" || typeof r == "number")
689
- return this && this[r] || r;
690
- if (typeof r != "object")
675
+ function i(o) {
676
+ if (typeof o == "string" || typeof o == "number")
677
+ return this && this[o] || o;
678
+ if (typeof o != "object")
691
679
  return "";
692
- if (Array.isArray(r))
693
- return n.apply(this, r);
694
- if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
695
- return r.toString();
680
+ if (Array.isArray(o))
681
+ return n.apply(this, o);
682
+ if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
683
+ return o.toString();
696
684
  var s = "";
697
- for (var c in r)
698
- t.call(r, c) && r[c] && (s = i(s, this && this[c] || c));
685
+ for (var c in o)
686
+ t.call(o, c) && o[c] && (s = r(s, this && this[c] || c));
699
687
  return s;
700
688
  }
701
- function i(r, s) {
702
- return s ? r ? r + " " + s : r + s : r;
689
+ function r(o, s) {
690
+ return s ? o ? o + " " + s : o + s : o;
703
691
  }
704
692
  e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
705
693
  })();
706
- })(j)), j.exports;
694
+ })($)), $.exports;
707
695
  }
708
696
  var nt = tt();
709
- const rt = /* @__PURE__ */ et(nt), ot = {
697
+ const ot = /* @__PURE__ */ et(nt), rt = {
710
698
  "purpur-slider": "_purpur-slider_14tuk_1",
711
699
  "purpur-slider__track": "_purpur-slider__track_14tuk_17",
712
700
  "purpur-slider__range": "_purpur-slider__range_14tuk_17",
713
701
  "purpur-slider__thumb": "_purpur-slider__thumb_14tuk_43"
714
- }, B = rt.bind(ot), dt = ["horizontal", "vertical"], z = "purpur-slider", it = (e) => String(e), st = ({
702
+ }, k = ot.bind(rt), dt = ["horizontal", "vertical"], K = "purpur-slider", it = (e) => String(e), st = ({
715
703
  "aria-label": e,
716
704
  "aria-valuetext": t,
717
705
  className: n,
718
- defaultValue: o,
719
- id: i,
720
- value: r,
706
+ defaultValue: i,
707
+ id: r,
708
+ value: o,
721
709
  ...s
722
710
  }, c) => {
723
- const u = be(), d = r || o;
711
+ const u = be(), d = o || i;
724
712
  return /* @__PURE__ */ J(
725
713
  Ge,
726
714
  {
727
715
  ...s,
728
- id: i || u,
716
+ id: r || u,
729
717
  ref: c,
730
- className: B(z, n),
731
- value: r,
732
- defaultValue: o,
718
+ className: k(K, n),
719
+ value: o,
720
+ defaultValue: i,
733
721
  children: [
734
- /* @__PURE__ */ S(Ze, { className: B(`${z}__track`), children: /* @__PURE__ */ S(Je, { className: B(`${z}__range`) }) }),
735
- d == null ? void 0 : d.map((g, a) => /* @__PURE__ */ S(
722
+ /* @__PURE__ */ h(Ze, { className: k(`${K}__track`), children: /* @__PURE__ */ h(Je, { className: k(`${K}__range`) }) }),
723
+ d?.map((g, a) => /* @__PURE__ */ h(
736
724
  Qe,
737
725
  {
738
- className: B(`${z}__thumb`),
726
+ className: k(`${K}__thumb`),
739
727
  "aria-label": e,
740
728
  "aria-valuetext": t
741
729
  },