jaguar-form 1.0.7 → 1.0.8

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.
Files changed (37) hide show
  1. package/README.md +4 -0
  2. package/dist/{Cascader-iWlk7VJR.js → Cascader-COGUcdDS.js} +4 -4
  3. package/dist/{Select-CoEW4UIq.js → Select-BxwT7MHH.js} +81 -77
  4. package/dist/{TreeSelect-BWksr9iW.js → TreeSelect-W5sgU5nW.js} +4 -4
  5. package/dist/{compound-BW6G7E_-.js → compound-nXxRSVJu.js} +27 -27
  6. package/dist/compound.js +1 -1
  7. package/dist/core.js +1 -1
  8. package/dist/date-time.js +1 -1
  9. package/dist/{form-B-BSf2n1.js → form-D6O5PqrZ.js} +62 -49
  10. package/dist/form.js +3 -3
  11. package/dist/{icons-BwE05e0C.js → icons-B1dOXz-r.js} +1 -1
  12. package/dist/{image-upload-D9oPG0Eh.js → image-upload-BFVs81x3.js} +46 -42
  13. package/dist/image-upload.js +1 -1
  14. package/dist/index.js +15 -15
  15. package/dist/input.js +1 -1
  16. package/dist/inputs-w_es2t_C.js +862 -0
  17. package/dist/{lazy-tree-C9l9lzQw.js → lazy-tree-DNvNf_Yv.js} +20 -17
  18. package/dist/{pickers-Bci1y8cc.js → pickers-5zLmSrsp.js} +3 -3
  19. package/dist/select.js +2 -2
  20. package/dist/selection-CA_66JX9.js +223 -0
  21. package/dist/{slider-AM0Egz9P.js → slider-Bhd1Z4LP.js} +35 -35
  22. package/dist/slider.js +1 -1
  23. package/dist/{store-CFSQW-Fv.js → store-C9eBd8Y7.js} +205 -194
  24. package/dist/style.css +1 -1
  25. package/dist/tree-select.js +1 -1
  26. package/dist/types/components/extended-inputs.d.ts +4 -1
  27. package/dist/types/components/image-upload/index.d.ts +1 -1
  28. package/dist/types/components/inputs.d.ts +28 -8
  29. package/dist/types/config/index.d.ts +32 -1
  30. package/dist/types/entries/input.d.ts +2 -2
  31. package/dist/types/form/index.d.ts +3 -0
  32. package/dist/types/form/store.d.ts +1 -0
  33. package/dist/types/primitives/Control.d.ts +7 -2
  34. package/dist/{useControllable-QDX_UWRh.js → useControllable-Dt38Jg9E.js} +54 -21
  35. package/package.json +1 -1
  36. package/dist/inputs-DpZdLaoP.js +0 -718
  37. package/dist/selection-DCIzhR5q.js +0 -197
@@ -1,5 +1,5 @@
1
- import { o as e, t } from "./useControllable-QDX_UWRh.js";
2
- import { o as n, t as r } from "./selection-DCIzhR5q.js";
1
+ import { l as e, t } from "./useControllable-Dt38Jg9E.js";
2
+ import { o as n, t as r } from "./selection-CA_66JX9.js";
3
3
  import { useCallback as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
4
4
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
5
5
  // src/primitives/selection.tsx
@@ -139,6 +139,7 @@ function g(e, t) {
139
139
  }
140
140
  function _({ items: e, render: t, getKey: n = h, itemHeight: r = 36, maxHeight: l = 216, activeIndex: f, variableHeight: p = !1, id: m, className: _, role: v, label: y, multiple: b, activeId: x, tabIndex: S }) {
141
141
  let [C, w] = c(0), [T, E] = c(l), [D, O] = c(0), k = s(null), A = s(/* @__PURE__ */ new Map()), j = s(null), M = s(0), N = s(0), P = o(() => e.map(n), [e, n]), F = o(() => {
142
+ if (!p) return [];
142
143
  let e = [0];
143
144
  for (let t of P) e.push(e[e.length - 1] + (p ? A.current.get(t) ?? r : r));
144
145
  return e;
@@ -147,7 +148,7 @@ function _({ items: e, render: t, getKey: n = h, itemHeight: r = 36, maxHeight:
147
148
  r,
148
149
  p,
149
150
  D
150
- ]), I = F.at(-1) ?? 0, L = e.length > 100, R = L && e.length ? Math.max(0, g(F, C) - 4) : 0, z = L && e.length ? Math.min(e.length, g(F, C + T) + 6) : e.length;
151
+ ]), I = p ? F.at(-1) ?? 0 : e.length * r, L = e.length > 100, R = (e) => p ? F[e] : e * r, z = (t) => p ? g(F, t) : Math.min(e.length - 1, Math.floor(t / Math.max(1, r))), B = L && e.length ? Math.max(0, z(C) - 4) : 0, V = L && e.length ? Math.min(e.length, z(C + T) + 6) : e.length;
151
152
  a(() => {
152
153
  let e = k.current;
153
154
  if (!e) return;
@@ -165,13 +166,15 @@ function _({ items: e, render: t, getKey: n = h, itemHeight: r = 36, maxHeight:
165
166
  }, [I, T]), a(() => {
166
167
  let t = k.current;
167
168
  if (!t || f === void 0 || f < 0 || f >= e.length) return;
168
- let n = F[f], r = F[f + 1];
169
+ let n = R(f), r = R(f + 1);
169
170
  n < t.scrollTop ? t.scrollTop = n : r > t.scrollTop + t.clientHeight && (t.scrollTop = r - t.clientHeight), w(t.scrollTop);
170
171
  }, [
171
172
  f,
172
173
  F,
173
174
  e.length,
174
- T
175
+ T,
176
+ r,
177
+ p
175
178
  ]), a(() => {
176
179
  if (!p || !k.current) return;
177
180
  let e = k.current, t = new ResizeObserver((e) => {
@@ -188,16 +191,16 @@ function _({ items: e, render: t, getKey: n = h, itemHeight: r = 36, maxHeight:
188
191
  }, [
189
192
  p,
190
193
  P,
191
- R,
192
- z
194
+ B,
195
+ V
193
196
  ]), a(() => {
194
197
  let e = new Set(P);
195
198
  for (let t of A.current.keys()) e.has(t) || A.current.delete(t);
196
199
  }, [P]), a(() => () => cancelAnimationFrame(N.current), []);
197
- let B = i((e) => {
200
+ let H = i((e) => {
198
201
  let t = e.currentTarget.scrollTop;
199
202
  cancelAnimationFrame(N.current), N.current = requestAnimationFrame(() => w(t));
200
- }, []), V = f !== void 0 && f >= 0 && f < e.length, H = V && f >= R && f < z, U = (e, n) => /* @__PURE__ */ u("div", {
203
+ }, []), U = f !== void 0 && f >= 0 && f < e.length, W = U && f >= B && f < V, G = (e, n) => /* @__PURE__ */ u("div", {
201
204
  role: "presentation",
202
205
  "data-virtual-index": n,
203
206
  "data-variable-row": p || void 0,
@@ -211,37 +214,37 @@ function _({ items: e, render: t, getKey: n = h, itemHeight: r = 36, maxHeight:
211
214
  tabIndex: S,
212
215
  "aria-label": y,
213
216
  "aria-multiselectable": b || void 0,
214
- "aria-activedescendant": V ? x : void 0,
217
+ "aria-activedescendant": U ? x : void 0,
215
218
  ref: k,
216
219
  style: {
217
220
  maxHeight: l,
218
221
  overflowY: "auto"
219
222
  },
220
- onScroll: B,
223
+ onScroll: H,
221
224
  children: L ? /* @__PURE__ */ d("div", {
222
225
  role: "presentation",
223
226
  style: {
224
227
  height: I,
225
228
  position: "relative"
226
229
  },
227
- children: [V && !H && /* @__PURE__ */ u("div", {
230
+ children: [U && !W && /* @__PURE__ */ u("div", {
228
231
  role: "presentation",
229
232
  style: {
230
233
  position: "absolute",
231
- top: F[f],
234
+ top: R(f),
232
235
  insetInline: 0
233
236
  },
234
- children: U(e[f], f)
237
+ children: G(e[f], f)
235
238
  }), /* @__PURE__ */ u("div", {
236
239
  role: "presentation",
237
240
  style: {
238
241
  position: "absolute",
239
- top: F[R],
242
+ top: R(B),
240
243
  insetInline: 0
241
244
  },
242
- children: e.slice(R, z).map((e, t) => U(e, R + t))
245
+ children: e.slice(B, V).map((e, t) => G(e, B + t))
243
246
  })]
244
- }) : e.map(U)
247
+ }) : e.map(G)
245
248
  });
246
249
  }
247
250
  // src/utils/tree.ts
@@ -1,9 +1,9 @@
1
1
  import { useId as e, useLayoutEffect as t, useMemo as n, useRef as r, useState as i } from "react";
2
2
  import a from "dayjs";
3
3
  import { i as o } from "./locale-yHkdw2xz.js";
4
- import { a as s, t as c } from "./useControllable-QDX_UWRh.js";
5
- import { n as l, o as u, r as d, s as f } from "./selection-DCIzhR5q.js";
6
- import { t as p } from "./icons-BwE05e0C.js";
4
+ import { c as s, t as c } from "./useControllable-Dt38Jg9E.js";
5
+ import { n as l, o as u, r as d, s as f } from "./selection-CA_66JX9.js";
6
+ import { t as p } from "./icons-B1dOXz-r.js";
7
7
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
8
8
  // src/utils/date.ts
9
9
  var _ = (e) => String(e).padStart(2, "0");
package/dist/select.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as e, t } from "./Select-CoEW4UIq.js";
2
- import { t as n } from "./Cascader-iWlk7VJR.js";
1
+ import { n as e, t } from "./Select-BxwT7MHH.js";
2
+ import { t as n } from "./Cascader-COGUcdDS.js";
3
3
  export { n as Cascader, t as MultiSelect, e as Select };
@@ -0,0 +1,223 @@
1
+ import { a as e, c as t, i as n, r, s as i, u as a } from "./useControllable-Dt38Jg9E.js";
2
+ import { t as o } from "./icons-B1dOXz-r.js";
3
+ import { createContext as s, useCallback as c, useContext as l, useEffect as u, useId as d, useLayoutEffect as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
4
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
5
+ import { FloatingFocusManager as v, FloatingNode as y, FloatingOverlay as b, FloatingPortal as x, FloatingTree as S, autoUpdate as C, flip as w, offset as T, shift as E, size as D, useDismiss as O, useFloating as ee, useFloatingNodeId as te, useFloatingTree as k, useInteractions as A, useRole as j, useTransitionStyles as M } from "@floating-ui/react";
6
+ // src/primitives/Control.tsx
7
+ function N({ children: e, actions: t, prefix: n, suffix: r, prefixIcon: s, suffixIcon: c, size: l, variant: u, status: d, disabled: f, readOnly: p, className: m, style: h, floatingLabel: v, floatingFilled: y, floatingOpen: b, id: x, "aria-invalid": S }) {
8
+ let C = i();
9
+ return /* @__PURE__ */ _("div", {
10
+ className: a("rfe-control", !!v && "rfe-floating-shell", m),
11
+ style: h,
12
+ "data-size": l ?? C.size,
13
+ "data-variant": u ?? C.variant,
14
+ "data-status": S ? "error" : d ?? "default",
15
+ "data-disabled": f || void 0,
16
+ "data-readonly": p || void 0,
17
+ "data-floating-filled": y || void 0,
18
+ "data-floating-open": b || void 0,
19
+ children: [
20
+ (s || n) && /* @__PURE__ */ _("span", {
21
+ className: "rfe-affix",
22
+ children: [/* @__PURE__ */ g(o, { source: s }), n]
23
+ }),
24
+ e,
25
+ (c || r) && /* @__PURE__ */ _("span", {
26
+ className: "rfe-affix",
27
+ children: [/* @__PURE__ */ g(o, { source: c }), r]
28
+ }),
29
+ t,
30
+ v && /* @__PURE__ */ g("label", {
31
+ className: "rfe-shell-label",
32
+ htmlFor: x,
33
+ children: v
34
+ })
35
+ ]
36
+ });
37
+ }
38
+ function P({ name: e, source: t, label: n, onClick: r, disabled: i, hidden: a, repeat: s }) {
39
+ let c = p(null), l = p(!1), d = p(!1), f = p(r);
40
+ f.current = r;
41
+ let m = () => {
42
+ l.current = !1, c.current !== null && clearTimeout(c.current), c.current = null;
43
+ };
44
+ return u(() => {
45
+ if (s) return window.addEventListener("blur", m), () => {
46
+ window.removeEventListener("blur", m), m();
47
+ };
48
+ }, [!!s]), u(() => {
49
+ (i || a) && m();
50
+ }, [i, a]), /* @__PURE__ */ g("button", {
51
+ className: "rfe-action",
52
+ type: "button",
53
+ "aria-label": n,
54
+ title: n,
55
+ disabled: i || a,
56
+ style: a ? { visibility: "hidden" } : void 0,
57
+ onMouseDown: (e) => e.preventDefault(),
58
+ onPointerDown: s ? (e) => {
59
+ if (e.button !== 0 || i || a) return;
60
+ m(), d.current = !1, l.current = !0, e.currentTarget.setPointerCapture?.(e.pointerId);
61
+ let t = () => {
62
+ l.current && (d.current = !0, f.current(), l.current && (c.current = setTimeout(t, Math.max(16, s.interval ?? 80))));
63
+ };
64
+ c.current = setTimeout(t, Math.max(0, s.delay ?? 400));
65
+ } : void 0,
66
+ onPointerUp: m,
67
+ onPointerCancel: m,
68
+ onLostPointerCapture: m,
69
+ onBlur: m,
70
+ onClick: (e) => {
71
+ e.stopPropagation(), e.detail !== 0 && d.current ? d.current = !1 : (d.current = !1, r());
72
+ },
73
+ children: /* @__PURE__ */ g(o, {
74
+ name: e,
75
+ source: t
76
+ })
77
+ });
78
+ }
79
+ // src/components/compound/context.ts
80
+ var F = s(null), I = () => l(F), L = "(max-width: 560px)", R = "(prefers-reduced-motion: reduce)", z = (e) => {
81
+ let t = window.matchMedia(R);
82
+ return t.addEventListener("change", e), () => t.removeEventListener("change", e);
83
+ }, ne = () => typeof window < "u" && window.matchMedia(R).matches, re = (e) => {
84
+ let t = window.matchMedia(L);
85
+ return t.addEventListener("change", e), () => t.removeEventListener("change", e);
86
+ }, ie = () => typeof window < "u" && window.matchMedia(L).matches;
87
+ function B(e) {
88
+ return k() ? /* @__PURE__ */ g(V, { ...e }) : /* @__PURE__ */ g(S, { children: /* @__PURE__ */ g(V, { ...e }) });
89
+ }
90
+ function V({ open: a, onOpenChange: o, children: s, trigger: l, placement: u = "bottom-start", popupWidth: p = "trigger", popupMaxHeight: S = 320, portalContainer: k, role: N = "dialog", label: P, popupMode: F, layout: L = "content", initialFocus: R = 0 }) {
91
+ let B = I(), [V, H] = m(null), U = i(), W = t(), G = d(), K = te(), q = h(re, ie, () => !1), J = h(z, ne, () => !1), Y = F ?? U.popupMode, X = Y === "sheet" || Y === "auto" && q, [ae, oe] = m(null), { refs: Z, floatingStyles: se, context: Q, placement: ce } = ee({
92
+ nodeId: K,
93
+ open: a,
94
+ onOpenChange: o,
95
+ placement: u,
96
+ strategy: X ? "fixed" : "absolute",
97
+ whileElementsMounted: X ? void 0 : C,
98
+ middleware: X ? [] : [
99
+ T(6),
100
+ w(),
101
+ E({ padding: 8 }),
102
+ D({
103
+ padding: 8,
104
+ apply({ availableHeight: e, availableWidth: t, rects: n, elements: r }) {
105
+ Object.assign(r.floating.style, {
106
+ maxHeight: `${Math.max(0, Math.min(e, S))}px`,
107
+ maxWidth: `${Math.max(0, t)}px`,
108
+ width: `${Math.max(0, Math.min(t, p === "trigger" ? n.reference.width : p))}px`
109
+ });
110
+ }
111
+ })
112
+ ]
113
+ }), le = c((e) => {
114
+ Z.setFloating(e), H(e);
115
+ }, [Z.setFloating]);
116
+ f(() => {
117
+ if (a && V) return B?.registerPopup(V);
118
+ }, [
119
+ a,
120
+ V,
121
+ B
122
+ ]);
123
+ let ue = c((e) => {
124
+ Z.setReference(e), oe(e?.closest("dialog[open]") ?? null);
125
+ }, [Z.setReference]), de = O(Q, { bubbles: {
126
+ escapeKey: !1,
127
+ outsidePress: !0
128
+ } }), fe = j(Q, { role: N }), { getReferenceProps: pe, getFloatingProps: me } = A([de, fe]), { isMounted: he, styles: ge } = M(Q, {
129
+ duration: n(U.motion) && !J ? {
130
+ open: r(U.motion, 160),
131
+ close: r(U.motion, 100)
132
+ } : 0,
133
+ initial: ({ side: e }) => ({
134
+ opacity: 0,
135
+ transform: X ? "translateY(16px)" : `translateY(${e === "top" ? 4 : -4}px) scale(.985)`
136
+ })
137
+ }), _e = {
138
+ lang: W.code,
139
+ dir: W.direction,
140
+ "data-theme": U.theme,
141
+ "data-density": U.density,
142
+ "data-motion": n(U.motion) ? "on" : "off"
143
+ }, $ = /* @__PURE__ */ g(v, {
144
+ context: Q,
145
+ modal: X,
146
+ initialFocus: R,
147
+ disabled: !a,
148
+ returnFocus: !0,
149
+ children: /* @__PURE__ */ g("div", {
150
+ ..._e,
151
+ className: "rfe-scope rfe-popup-position",
152
+ "data-sheet": X || void 0,
153
+ ref: le,
154
+ style: {
155
+ ...e(U),
156
+ ...X ? {
157
+ position: "fixed",
158
+ insetInline: 0,
159
+ bottom: 0,
160
+ width: "100%",
161
+ maxWidth: "100%",
162
+ maxHeight: "85dvh"
163
+ } : se
164
+ },
165
+ ...me({
166
+ id: G,
167
+ "aria-label": P,
168
+ "aria-modal": X || void 0
169
+ }),
170
+ children: /* @__PURE__ */ _("div", {
171
+ className: "rfe-panel",
172
+ "data-layout": L,
173
+ "data-side": ce.split("-")[0],
174
+ style: {
175
+ ...ge,
176
+ pointerEvents: a ? "auto" : "none"
177
+ },
178
+ inert: !a,
179
+ children: [X && /* @__PURE__ */ g("span", {
180
+ className: "rfe-sheet-handle",
181
+ "aria-hidden": "true"
182
+ }), s]
183
+ })
184
+ })
185
+ });
186
+ return /* @__PURE__ */ _(y, {
187
+ id: K,
188
+ children: [l(pe({
189
+ "aria-expanded": a,
190
+ "aria-controls": a ? G : void 0
191
+ }), ue, G), he && /* @__PURE__ */ g(x, {
192
+ root: k ?? ae ?? void 0,
193
+ children: X ? /* @__PURE__ */ g(b, {
194
+ lockScroll: a,
195
+ className: "rfe-sheet-overlay",
196
+ style: e(U),
197
+ children: $
198
+ }) : $
199
+ })]
200
+ });
201
+ }
202
+ // src/utils/selection.ts
203
+ function H(e, t, n, r) {
204
+ if (e <= 0) return -1;
205
+ let i = n === "ArrowUp" || n === "End", a = i ? -1 : 1, o = n === "Home" ? 0 : n === "End" ? e - 1 : t < 0 ? i ? e - 1 : 0 : t + a;
206
+ for (; o >= 0 && o < e;) {
207
+ if (r(o)) return o;
208
+ o += a;
209
+ }
210
+ return t >= 0 && t < e && r(t) ? t : -1;
211
+ }
212
+ function U(e, t, n, r, i = 1, a = 4) {
213
+ if (e <= 0 || i <= 0 || !n) return 0;
214
+ let o = (o) => {
215
+ let s = 1, c = 0, l = t.slice(0, o).map((t) => Math.min(t, e));
216
+ o < n && l.push(Math.min(r, e));
217
+ for (let t of l) if (c && c + a + t > e && (s++, c = 0), c += t + (c ? a : 0), s > i) return !1;
218
+ return !0;
219
+ }, s = Math.min(t.length, n);
220
+ for (; s > 0 && !o(s);) s--;
221
+ return s;
222
+ }
223
+ export { I as a, F as i, H as n, P as o, B as r, N as s, U as t };
@@ -1,5 +1,5 @@
1
1
  import { useId as e, useLayoutEffect as t, useMemo as n, useRef as r, useState as i } from "react";
2
- import { a, i as o, s, t as c } from "./useControllable-QDX_UWRh.js";
2
+ import { c as a, s as o, t as s, u as c } from "./useControllable-Dt38Jg9E.js";
3
3
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
4
4
  // src/components/slider/math.ts
5
5
  function f(e = 0, t = 100, n = 1) {
@@ -35,20 +35,20 @@ function _(e, t, n = 1) {
35
35
  return Math.abs(r - i) < 1e-9 ? e[0] === e[1] ? t < e[0] ? 0 : t > e[1] ? 1 : n : n : r < i ? 0 : 1;
36
36
  }
37
37
  // src/components/slider/index.tsx
38
- function v(c) {
39
- let g = o(), { text: v, direction: y } = a(), b = y === "rtl", x = e(), { min: S, max: C, step: w } = f(c.min, c.max, c.step), T = c.values.length === 2, E = !!(c.disabled || c.loading), D = E || c.readOnly, O = c.formatValue ?? String, [k, A] = i(null), [j, M] = i(null), [te, N] = i(null), [P, ne] = i({
38
+ function v(s) {
39
+ let g = o(), { text: v, direction: y } = a(), b = y === "rtl", x = e(), { min: S, max: C, step: w } = f(s.min, s.max, s.step), T = s.values.length === 2, E = !!(s.disabled || s.loading), D = E || s.readOnly, O = s.formatValue ?? String, [k, A] = i(null), [j, M] = i(null), [te, N] = i(null), [P, ne] = i({
40
40
  width: 0,
41
41
  first: 0,
42
42
  second: 0
43
- }), F = r(null), I = r(null), L = r([]), R = r(c.values), z = r(!1), B = r(null), V = r(1);
43
+ }), F = r(null), I = r(null), L = r([]), R = r(s.values), z = r(!1), B = r(null), V = r(1);
44
44
  t(() => {
45
- B.current || (R.current = c.values);
46
- }, [c.values]);
47
- let H = (e) => b ? 100 - m(e, S, C) : m(e, S, C), U = c.values.map(H), re = H(S), W = U.at(-1), G = T ? U[0] : re, K = n(() => Object.entries(c.marks ?? {}).filter(([e]) => Number.isFinite(Number(e)) && Number(e) >= S && Number(e) <= C).sort(([e], [t]) => Number(e) - Number(t)), [
48
- c.marks,
45
+ B.current || (R.current = s.values);
46
+ }, [s.values]);
47
+ let H = (e) => b ? 100 - m(e, S, C) : m(e, S, C), U = s.values.map(H), re = H(S), W = U.at(-1), G = T ? U[0] : re, K = n(() => Object.entries(s.marks ?? {}).filter(([e]) => Number.isFinite(Number(e)) && Number(e) >= S && Number(e) <= C).sort(([e], [t]) => Number(e) - Number(t)), [
48
+ s.marks,
49
49
  S,
50
50
  C
51
- ]), ie = c.thumbLabels ?? [v.minimum, v.maximum], q = c.tooltip ?? "auto", J = (e) => !E && (q === "always" || q === "auto" && (k === e || j === e || te === e)), Y = c.values.map(O);
51
+ ]), ie = s.thumbLabels ?? [v.minimum, v.maximum], q = s.tooltip ?? "auto", J = (e) => !E && (q === "always" || q === "auto" && (k === e || j === e || te === e)), Y = s.values.map(O);
52
52
  t(() => {
53
53
  if (!F.current) return;
54
54
  let e = () => {
@@ -67,10 +67,10 @@ function v(c) {
67
67
  }, [Y.join("\0"), T]);
68
68
  let X = T && J(0) && J(1) && P.width > 0 && Math.abs(U[1] - U[0]) * P.width / 100 < (P.first + P.second) / 2 + 8, Z = (e, t) => {
69
69
  if (D) return;
70
- let n = T ? ee(R.current, e, t, S, C, w, c.minDistance) : [p(t, S, C, w)];
71
- n.every((e, t) => e === R.current[t]) || (R.current = n, z.current = !0, V.current = e, c.update(n));
70
+ let n = T ? ee(R.current, e, t, S, C, w, s.minDistance) : [p(t, S, C, w)];
71
+ n.every((e, t) => e === R.current[t]) || (R.current = n, z.current = !0, V.current = e, s.update(n));
72
72
  }, Q = () => {
73
- B.current = null, A(null), z.current && (z.current = !1, c.onChangeEnd?.([...R.current]));
73
+ B.current = null, A(null), z.current && (z.current = !1, s.onChangeEnd?.([...R.current]));
74
74
  }, $ = (e) => {
75
75
  let t = F.current?.getBoundingClientRect() ?? e.currentTarget.getBoundingClientRect(), n = Math.max(0, Math.min(1, (e.clientX - t.left) / Math.max(1, t.width)));
76
76
  return S + (b ? 1 - n : n) * (C - S);
@@ -88,21 +88,21 @@ function v(c) {
88
88
  if (!T || D) return;
89
89
  let t = $(e), n = B.current;
90
90
  n ? n.pointer === e.pointerId && (n.overlap && Math.abs(t - n.start) > w / 4 && (n.index = t < n.start ? 0 : 1, n.overlap = !1, A(n.index), I.current?.querySelectorAll("input")[n.index]?.focus({ preventScroll: !0 })), Z(n.index, t)) : N(_(R.current, t, V.current));
91
- }, se = T ? h(S, C, w, c.minDistance) : 0;
91
+ }, se = T ? h(S, C, w, s.minDistance) : 0;
92
92
  return /* @__PURE__ */ d("div", {
93
- className: s("rfe-slider", c.className),
93
+ className: c("rfe-slider", s.className),
94
94
  dir: y,
95
- style: c.style,
96
- "data-size": c.size ?? g.size,
97
- "data-status": c["aria-invalid"] ? "error" : c.status ?? "default",
95
+ style: s.style,
96
+ "data-size": s.size ?? g.size,
97
+ "data-status": s["aria-invalid"] ? "error" : s.status ?? "default",
98
98
  "data-disabled": E || void 0,
99
- "data-readonly": c.readOnly || void 0,
99
+ "data-readonly": s.readOnly || void 0,
100
100
  "data-range": T || void 0,
101
101
  children: [
102
- c.showValue && /* @__PURE__ */ u("div", {
102
+ s.showValue && /* @__PURE__ */ u("div", {
103
103
  className: "rfe-slider-heading",
104
104
  children: /* @__PURE__ */ u("output", {
105
- htmlFor: c.values.map((e, t) => t === 0 ? c.id ?? `${x}-0` : `${x}-1`).join(" "),
105
+ htmlFor: s.values.map((e, t) => t === 0 ? s.id ?? `${x}-0` : `${x}-1`).join(" "),
106
106
  children: Y.join(" – ")
107
107
  })
108
108
  }),
@@ -129,7 +129,7 @@ function v(c) {
129
129
  }),
130
130
  K.map(([e]) => /* @__PURE__ */ u("span", {
131
131
  className: "rfe-slider-tick",
132
- "data-selected": Number(e) >= (T ? c.values[0] : S) && Number(e) <= c.values.at(-1),
132
+ "data-selected": Number(e) >= (T ? s.values[0] : S) && Number(e) <= s.values.at(-1),
133
133
  style: { left: `${H(Number(e))}%` }
134
134
  }, e)),
135
135
  U.map((e, t) => /* @__PURE__ */ u("span", {
@@ -148,30 +148,30 @@ function v(c) {
148
148
  children: Y.join(" – ")
149
149
  })
150
150
  ]
151
- }), c.values.map((e, t) => /* @__PURE__ */ u("input", {
151
+ }), s.values.map((e, t) => /* @__PURE__ */ u("input", {
152
152
  className: "rfe-slider-input",
153
153
  style: { zIndex: k === t || j === t ? 3 : t + 1 },
154
- id: t === 0 ? c.id ?? `${x}-0` : `${x}-1`,
155
- name: c.name,
154
+ id: t === 0 ? s.id ?? `${x}-0` : `${x}-1`,
155
+ name: s.name,
156
156
  type: "range",
157
157
  min: S,
158
158
  max: C,
159
159
  step: w,
160
160
  value: e,
161
161
  disabled: E,
162
- "aria-readonly": c.readOnly || void 0,
163
- "aria-invalid": c["aria-invalid"] ?? (c.status === "error" || void 0),
164
- "aria-describedby": c["aria-describedby"],
165
- "aria-label": T ? [c["aria-label"], ie[t]].filter(Boolean).join(" · ") : c["aria-label"] ?? (c.id ? void 0 : v.slider),
162
+ "aria-readonly": s.readOnly || void 0,
163
+ "aria-invalid": s["aria-invalid"] ?? (s.status === "error" || void 0),
164
+ "aria-describedby": s["aria-describedby"],
165
+ "aria-label": T ? [s["aria-label"], ie[t]].filter(Boolean).join(" · ") : s["aria-label"] ?? (s.id ? void 0 : v.slider),
166
166
  "aria-valuetext": O(e),
167
- "aria-valuemin": T && t === 1 ? c.values[0] + se : S,
168
- "aria-valuemax": T && t === 0 ? c.values[1] - se : C,
167
+ "aria-valuemin": T && t === 1 ? s.values[0] + se : S,
168
+ "aria-valuemax": T && t === 0 ? s.values[1] - se : C,
169
169
  onChange: (e) => Z(t, Number(e.target.value)),
170
170
  onFocus: () => {
171
171
  M(t), V.current = t;
172
172
  },
173
173
  onBlur: () => {
174
- M(null), B.current || Q(), c.onBlur?.();
174
+ M(null), B.current || Q(), s.onBlur?.();
175
175
  },
176
176
  onPointerDown: (e) => {
177
177
  D ? e.preventDefault() : A(t);
@@ -193,7 +193,7 @@ function v(c) {
193
193
  ].includes(e.key) && Q();
194
194
  },
195
195
  onKeyDown: (e) => {
196
- c.readOnly && [
196
+ s.readOnly && [
197
197
  "ArrowLeft",
198
198
  "ArrowRight",
199
199
  "ArrowUp",
@@ -206,7 +206,7 @@ function v(c) {
206
206
  }
207
207
  }, t))]
208
208
  }),
209
- (c.showLimits || K.length > 0) && /* @__PURE__ */ u("div", {
209
+ (s.showLimits || K.length > 0) && /* @__PURE__ */ u("div", {
210
210
  className: "rfe-slider-labels",
211
211
  "aria-hidden": "true",
212
212
  children: K.length ? K.map(([e, t]) => /* @__PURE__ */ u("span", {
@@ -224,7 +224,7 @@ function v(c) {
224
224
  });
225
225
  }
226
226
  function y(e) {
227
- let { min: t, max: n, step: r } = f(e.min, e.max, e.step), [i, a] = c(e.value, e.defaultValue ?? t, e.onChange);
227
+ let { min: t, max: n, step: r } = f(e.min, e.max, e.step), [i, a] = s(e.value, e.defaultValue ?? t, e.onChange);
228
228
  return /* @__PURE__ */ u(v, {
229
229
  ...e,
230
230
  values: [p(i, t, n, r)],
@@ -233,7 +233,7 @@ function y(e) {
233
233
  });
234
234
  }
235
235
  function b(e) {
236
- let { min: t, max: n, step: r } = f(e.min, e.max, e.step), [i, a] = c(e.value, e.defaultValue ?? [t, n], e.onChange);
236
+ let { min: t, max: n, step: r } = f(e.min, e.max, e.step), [i, a] = s(e.value, e.defaultValue ?? [t, n], e.onChange);
237
237
  return /* @__PURE__ */ u(v, {
238
238
  ...e,
239
239
  values: g(i, t, n, r, e.minDistance),
package/dist/slider.js CHANGED
@@ -1 +1 @@
1
- export { t as RangeSlider, n as Slider } from "./slider-AM0Egz9P.js";
1
+ export { t as RangeSlider, n as Slider } from "./slider-Bhd1Z4LP.js";