@drjoshcsimmons/scl 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index100.js +218 -8
- package/dist/index101.js +648 -48
- package/dist/index102.js +167 -205
- package/dist/index104.js +1 -1
- package/dist/index106.js +12 -21
- package/dist/index107.js +15 -3
- package/dist/index108.js +3 -32
- package/dist/index109.js +32 -12
- package/dist/index11.js +2 -2
- package/dist/index110.js +18 -12
- package/dist/index112.js +1 -1
- package/dist/index115.js +1 -1
- package/dist/index116.js +1 -1
- package/dist/index117.js +25 -2
- package/dist/index118.js +29 -2
- package/dist/index119.js +5 -25
- package/dist/index12.js +1 -1
- package/dist/index120.js +2 -29
- package/dist/index121.js +2 -5
- package/dist/index125.js +1 -1
- package/dist/index126.js +1 -1
- package/dist/index13.js +2 -2
- package/dist/index130.js +1 -1
- package/dist/index14.js +2 -2
- package/dist/index15.js +2 -2
- package/dist/index17.js +4 -4
- package/dist/index18.js +2 -2
- package/dist/index20.js +2 -2
- package/dist/index21.js +1 -1
- package/dist/index23.js +2 -2
- package/dist/index24.js +1 -1
- package/dist/index25.js +4 -4
- package/dist/index26.js +1 -1
- package/dist/index27.js +3 -3
- package/dist/index29.js +1 -1
- package/dist/index31.js +1 -1
- package/dist/index33.js +1 -1
- package/dist/index36.js +2 -2
- package/dist/index37.js +1 -1
- package/dist/index4.js +2 -2
- package/dist/index45.js +237 -33
- package/dist/index46.js +11 -125
- package/dist/index47.js +33 -237
- package/dist/index48.js +118 -11
- package/dist/index49.js +70 -57
- package/dist/index5.js +1 -1
- package/dist/index50.js +298 -237
- package/dist/index51.js +6 -3
- package/dist/index52.js +249 -62
- package/dist/index53.js +12 -236
- package/dist/index54.js +60 -11
- package/dist/index55.js +242 -298
- package/dist/index56.js +249 -12
- package/dist/index57.js +9 -225
- package/dist/index58.js +125 -11
- package/dist/index59.js +12 -31
- package/dist/index6.js +1 -1
- package/dist/index60.js +16 -258
- package/dist/index61.js +225 -12
- package/dist/index62.js +11 -118
- package/dist/index63.js +4 -5
- package/dist/index64.js +238 -19
- package/dist/index65.js +234 -16
- package/dist/index66.js +509 -220
- package/dist/index67.js +143 -112
- package/dist/index68.js +112 -143
- package/dist/index69.js +323 -241
- package/dist/index7.js +1 -1
- package/dist/index70.js +2 -2
- package/dist/index71.js +392 -487
- package/dist/index72.js +20 -433
- package/dist/index73.js +823 -299
- package/dist/index74.js +9 -860
- package/dist/index75.js +31 -9
- package/dist/index76.js +5 -66
- package/dist/index77.js +64 -23
- package/dist/index78.js +51 -6
- package/dist/index79.js +4 -54
- package/dist/index8.js +1 -1
- package/dist/index80.js +25 -44
- package/dist/index81.js +33 -51
- package/dist/index82.js +67 -32
- package/dist/index83.js +1 -1
- package/dist/index84.js +54 -7
- package/dist/index85.js +10 -5
- package/dist/index86.js +30 -25
- package/dist/index87.js +11 -67
- package/dist/index88.js +43 -52
- package/dist/index89.js +7 -10
- package/dist/index9.js +2 -2
- package/dist/index90.js +15 -4
- package/dist/index91.js +124 -29
- package/dist/index92.js +131 -9
- package/dist/index93.js +14 -181
- package/dist/index94.js +13 -13
- package/dist/index95.js +8 -649
- package/dist/index96.js +47 -122
- package/dist/index97.js +47 -128
- package/dist/index98.js +6 -14
- package/dist/index99.js +24 -14
- package/package.json +3 -2
package/dist/index55.js
CHANGED
|
@@ -1,312 +1,256 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
y.emit();
|
|
1
|
+
import u from "react";
|
|
2
|
+
var z = (e) => e.type === "checkbox", k = (e) => e instanceof Date, w = (e) => e == null;
|
|
3
|
+
const H = (e) => typeof e == "object";
|
|
4
|
+
var p = (e) => !w(e) && !Array.isArray(e) && H(e) && !k(e), J = (e) => p(e) && e.target ? z(e.target) ? e.target.checked : e.target.value : e, Q = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, X = (e, s) => e.has(Q(s)), Y = (e) => {
|
|
5
|
+
const s = e.constructor && e.constructor.prototype;
|
|
6
|
+
return p(s) && s.hasOwnProperty("isPrototypeOf");
|
|
7
|
+
}, Z = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
8
|
+
function W(e) {
|
|
9
|
+
if (e instanceof Date)
|
|
10
|
+
return new Date(e);
|
|
11
|
+
const s = typeof FileList < "u" && e instanceof FileList;
|
|
12
|
+
if (Z && (e instanceof Blob || s))
|
|
13
|
+
return e;
|
|
14
|
+
const t = Array.isArray(e);
|
|
15
|
+
if (!t && !(p(e) && Y(e)))
|
|
16
|
+
return e;
|
|
17
|
+
const n = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
18
|
+
for (const r in e)
|
|
19
|
+
Object.prototype.hasOwnProperty.call(e, r) && (n[r] = W(e[r]));
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
var G = (e) => /^\w*$/.test(e), R = (e) => e === void 0, j = (e) => Array.isArray(e) ? e.filter(Boolean) : [], $ = (e) => j(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
|
|
23
|
+
if (!s || !p(e))
|
|
24
|
+
return t;
|
|
25
|
+
const n = (G(s) ? [s] : $(s)).reduce((r, a) => w(r) ? r : r[a], e);
|
|
26
|
+
return R(n) || n === e ? R(e[s]) ? t : e[s] : n;
|
|
27
|
+
}, P = (e) => typeof e == "boolean", E = (e) => typeof e == "function", D = (e, s, t) => {
|
|
28
|
+
let n = -1;
|
|
29
|
+
const r = G(s) ? [s] : $(s), a = r.length, i = a - 1;
|
|
30
|
+
for (; ++n < a; ) {
|
|
31
|
+
const l = r[n];
|
|
32
|
+
let c = t;
|
|
33
|
+
if (n !== i) {
|
|
34
|
+
const f = e[l];
|
|
35
|
+
c = p(f) || Array.isArray(f) ? f : isNaN(+r[n + 1]) ? {} : [];
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
d.current.forEach((e) => e());
|
|
42
|
-
} }), []), _ = n.useMemo(() => ({ value: (e, u, o) => {
|
|
43
|
-
var l;
|
|
44
|
-
u !== ((l = c.current.get(e)) == null ? void 0 : l.value) && (c.current.set(e, { value: u, keywords: o }), r.current.filtered.items.set(e, te(u, o)), g(2, () => {
|
|
45
|
-
G(), y.emit();
|
|
46
|
-
}));
|
|
47
|
-
}, item: (e, u) => (v.current.add(e), u && (i.current.has(u) ? i.current.get(u).add(e) : i.current.set(u, /* @__PURE__ */ new Set([e]))), g(3, () => {
|
|
48
|
-
T(), G(), r.current.value || H(), y.emit();
|
|
49
|
-
}), () => {
|
|
50
|
-
c.current.delete(e), v.current.delete(e), r.current.filtered.items.delete(e);
|
|
51
|
-
let o = P();
|
|
52
|
-
g(4, () => {
|
|
53
|
-
T(), (o == null ? void 0 : o.getAttribute("id")) === e && H(), y.emit();
|
|
54
|
-
});
|
|
55
|
-
}), group: (e) => (i.current.has(e) || i.current.set(e, /* @__PURE__ */ new Set()), () => {
|
|
56
|
-
c.current.delete(e), i.current.delete(e);
|
|
57
|
-
}), filter: () => m.current.shouldFilter, label: b || t["aria-label"], getDisablePointerSelection: () => m.current.disablePointerSelection, listId: U, inputId: W, labelId: ee, listInnerRef: A }), []);
|
|
58
|
-
function te(e, u) {
|
|
59
|
-
var o, l;
|
|
60
|
-
let f = (l = (o = m.current) == null ? void 0 : o.filter) != null ? l : Ce;
|
|
61
|
-
return e ? f(e, r.current.search, u) : 0;
|
|
62
|
-
}
|
|
63
|
-
function G() {
|
|
64
|
-
if (!r.current.search || m.current.shouldFilter === !1) return;
|
|
65
|
-
let e = r.current.filtered.items, u = [];
|
|
66
|
-
r.current.filtered.groups.forEach((l) => {
|
|
67
|
-
let f = i.current.get(l), p = 0;
|
|
68
|
-
f.forEach((C) => {
|
|
69
|
-
let E = e.get(C);
|
|
70
|
-
p = Math.max(E, p);
|
|
71
|
-
}), u.push([l, p]);
|
|
72
|
-
});
|
|
73
|
-
let o = A.current;
|
|
74
|
-
L().sort((l, f) => {
|
|
75
|
-
var p, C;
|
|
76
|
-
let E = l.getAttribute("id"), N = f.getAttribute("id");
|
|
77
|
-
return ((p = e.get(N)) != null ? p : 0) - ((C = e.get(E)) != null ? C : 0);
|
|
78
|
-
}).forEach((l) => {
|
|
79
|
-
let f = l.closest(X);
|
|
80
|
-
f ? f.appendChild(l.parentElement === f ? l : l.closest(`${X} > *`)) : o.appendChild(l.parentElement === o ? l : l.closest(`${X} > *`));
|
|
81
|
-
}), u.sort((l, f) => f[1] - l[1]).forEach((l) => {
|
|
82
|
-
var f;
|
|
83
|
-
let p = (f = A.current) == null ? void 0 : f.querySelector(`${$}[${D}="${encodeURIComponent(l[0])}"]`);
|
|
84
|
-
p == null || p.parentElement.appendChild(p);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function H() {
|
|
88
|
-
let e = L().find((o) => o.getAttribute("aria-disabled") !== "true"), u = e == null ? void 0 : e.getAttribute(D);
|
|
89
|
-
y.setState("value", u || void 0);
|
|
90
|
-
}
|
|
91
|
-
function T() {
|
|
92
|
-
var e, u, o, l;
|
|
93
|
-
if (!r.current.search || m.current.shouldFilter === !1) {
|
|
94
|
-
r.current.filtered.count = v.current.size;
|
|
37
|
+
if (l === "__proto__" || l === "constructor" || l === "prototype")
|
|
95
38
|
return;
|
|
96
|
-
|
|
97
|
-
r.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
98
|
-
let f = 0;
|
|
99
|
-
for (let p of v.current) {
|
|
100
|
-
let C = (u = (e = c.current.get(p)) == null ? void 0 : e.value) != null ? u : "", E = (l = (o = c.current.get(p)) == null ? void 0 : o.keywords) != null ? l : [], N = te(C, E);
|
|
101
|
-
r.current.filtered.items.set(p, N), N > 0 && f++;
|
|
102
|
-
}
|
|
103
|
-
for (let [p, C] of i.current) for (let E of C) if (r.current.filtered.items.get(E) > 0) {
|
|
104
|
-
r.current.filtered.groups.add(p);
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
r.current.filtered.count = f;
|
|
39
|
+
e[l] = c, e = e[l];
|
|
108
40
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
u && y.setState("value", u.getAttribute(D));
|
|
125
|
-
}
|
|
126
|
-
function Q(e) {
|
|
127
|
-
var u;
|
|
128
|
-
let o = P(), l = L(), f = l.findIndex((C) => C === o), p = l[f + e];
|
|
129
|
-
(u = m.current) != null && u.loop && (p = f + e < 0 ? l[l.length - 1] : f + e === l.length ? l[0] : l[f + e]), p && y.setState("value", p.getAttribute(D));
|
|
130
|
-
}
|
|
131
|
-
function ne(e) {
|
|
132
|
-
let u = P(), o = u == null ? void 0 : u.closest($), l;
|
|
133
|
-
for (; o && !l; ) o = e > 0 ? Pe(o, $) : De(o, $), l = o == null ? void 0 : o.querySelector(ie);
|
|
134
|
-
l ? y.setState("value", l.getAttribute(D)) : Q(e);
|
|
135
|
-
}
|
|
136
|
-
let le = () => J(L().length - 1), ae = (e) => {
|
|
137
|
-
e.preventDefault(), e.metaKey ? le() : e.altKey ? ne(1) : Q(1);
|
|
138
|
-
}, ue = (e) => {
|
|
139
|
-
e.preventDefault(), e.metaKey ? J(0) : e.altKey ? ne(-1) : Q(-1);
|
|
41
|
+
};
|
|
42
|
+
const I = {
|
|
43
|
+
BLUR: "blur",
|
|
44
|
+
CHANGE: "change"
|
|
45
|
+
}, B = {
|
|
46
|
+
all: "all"
|
|
47
|
+
}, L = u.createContext(null);
|
|
48
|
+
L.displayName = "HookFormContext";
|
|
49
|
+
const M = () => u.useContext(L), oe = (e) => {
|
|
50
|
+
const { children: s, ...t } = e;
|
|
51
|
+
return u.createElement(L.Provider, { value: t }, s);
|
|
52
|
+
};
|
|
53
|
+
var ee = (e, s, t, n = !0) => {
|
|
54
|
+
const r = {
|
|
55
|
+
defaultValues: s._defaultValues
|
|
140
56
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
case "n":
|
|
147
|
-
case "j": {
|
|
148
|
-
x && e.ctrlKey && ae(e);
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
case "ArrowDown": {
|
|
152
|
-
ae(e);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
case "p":
|
|
156
|
-
case "k": {
|
|
157
|
-
x && e.ctrlKey && ue(e);
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
case "ArrowUp": {
|
|
161
|
-
ue(e);
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
case "Home": {
|
|
165
|
-
e.preventDefault(), J(0);
|
|
166
|
-
break;
|
|
57
|
+
for (const a in e)
|
|
58
|
+
Object.defineProperty(r, a, {
|
|
59
|
+
get: () => {
|
|
60
|
+
const i = a;
|
|
61
|
+
return s._proxyFormState[i] !== B.all && (s._proxyFormState[i] = !n || B.all), t && (t[i] = !0), e[i];
|
|
167
62
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (!(!g || t.disabled)) return g.addEventListener(Y, V), () => g.removeEventListener(Y, V);
|
|
192
|
-
}, [w, t.onSelect, t.disabled]);
|
|
193
|
-
function V() {
|
|
194
|
-
var g, y;
|
|
195
|
-
B(), (y = (g = b.current).onSelect) == null || y.call(g, h.current);
|
|
196
|
-
}
|
|
197
|
-
function B() {
|
|
198
|
-
R.setState("value", h.current, !0);
|
|
199
|
-
}
|
|
200
|
-
if (!w) return null;
|
|
201
|
-
let { disabled: x, value: j, onSelect: U, forceMount: ee, keywords: W, ...A } = t;
|
|
202
|
-
return n.createElement(I.div, { ref: q(c, a), ...A, id: i, "cmdk-item": "", role: "option", "aria-disabled": !!x, "aria-selected": !!k, "data-disabled": !!x, "data-selected": !!k, onPointerMove: x || m.getDisablePointerSelection() ? void 0 : B, onClick: x ? void 0 : V }, t.children);
|
|
203
|
-
}), ke = n.forwardRef((t, a) => {
|
|
204
|
-
let { heading: r, children: v, forceMount: i, ...c } = t, d = K(), m = n.useRef(null), b = n.useRef(null), s = K(), h = O(), R = S((w) => i || h.filter() === !1 ? !0 : w.search ? w.filtered.groups.has(d) : !0);
|
|
205
|
-
M(() => h.group(d), []), ve(d, m, [t.value, t.heading, b]);
|
|
206
|
-
let k = n.useMemo(() => ({ id: d, forceMount: i }), [i]);
|
|
207
|
-
return n.createElement(I.div, { ref: q(m, a), ...c, "cmdk-group": "", role: "presentation", hidden: R ? void 0 : !0 }, r && n.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": !0, id: s }, r), z(t, (w) => n.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? s : void 0 }, n.createElement(se.Provider, { value: k }, w))));
|
|
208
|
-
}), Se = n.forwardRef((t, a) => {
|
|
209
|
-
let { alwaysRender: r, ...v } = t, i = n.useRef(null), c = S((d) => !d.search);
|
|
210
|
-
return !r && !c ? null : n.createElement(I.div, { ref: q(i, a), ...v, "cmdk-separator": "", role: "separator" });
|
|
211
|
-
}), Ie = n.forwardRef((t, a) => {
|
|
212
|
-
let { onValueChange: r, ...v } = t, i = t.value != null, c = Z(), d = S((s) => s.search), m = S((s) => s.selectedItemId), b = O();
|
|
213
|
-
return n.useEffect(() => {
|
|
214
|
-
t.value != null && c.setState("search", t.value);
|
|
215
|
-
}, [t.value]), n.createElement(I.input, { ref: a, ...v, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": m, id: b.inputId, type: "text", value: i ? t.value : d, onChange: (s) => {
|
|
216
|
-
i || c.setState("search", s.target.value), r == null || r(s.target.value);
|
|
217
|
-
} });
|
|
218
|
-
}), Re = n.forwardRef((t, a) => {
|
|
219
|
-
let { children: r, label: v = "Suggestions", ...i } = t, c = n.useRef(null), d = n.useRef(null), m = S((s) => s.selectedItemId), b = O();
|
|
220
|
-
return n.useEffect(() => {
|
|
221
|
-
if (d.current && c.current) {
|
|
222
|
-
let s = d.current, h = c.current, R, k = new ResizeObserver(() => {
|
|
223
|
-
R = requestAnimationFrame(() => {
|
|
224
|
-
let w = s.offsetHeight;
|
|
225
|
-
h.style.setProperty("--cmdk-list-height", w.toFixed(1) + "px");
|
|
226
|
-
});
|
|
63
|
+
});
|
|
64
|
+
return r;
|
|
65
|
+
};
|
|
66
|
+
const q = typeof window < "u" ? u.useLayoutEffect : u.useEffect;
|
|
67
|
+
function te(e) {
|
|
68
|
+
const s = M(), { control: t = s.control, disabled: n, name: r, exact: a } = e || {}, [i, l] = u.useState(t._formState), c = u.useRef({
|
|
69
|
+
isDirty: !1,
|
|
70
|
+
isLoading: !1,
|
|
71
|
+
dirtyFields: !1,
|
|
72
|
+
touchedFields: !1,
|
|
73
|
+
validatingFields: !1,
|
|
74
|
+
isValidating: !1,
|
|
75
|
+
isValid: !1,
|
|
76
|
+
errors: !1
|
|
77
|
+
});
|
|
78
|
+
return q(() => t._subscribe({
|
|
79
|
+
name: r,
|
|
80
|
+
formState: c.current,
|
|
81
|
+
exact: a,
|
|
82
|
+
callback: (f) => {
|
|
83
|
+
!n && l({
|
|
84
|
+
...t._formState,
|
|
85
|
+
...f
|
|
227
86
|
});
|
|
228
|
-
return k.observe(s), () => {
|
|
229
|
-
cancelAnimationFrame(R), k.unobserve(s);
|
|
230
|
-
};
|
|
231
87
|
}
|
|
232
|
-
}, [
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return n.createElement(ge, { open: r, onOpenChange: v }, n.createElement(he, { container: d }, n.createElement(be, { "cmdk-overlay": "", className: i }), n.createElement(Ee, { "aria-label": t.label, "cmdk-dialog": "", className: c }, n.createElement(fe, { ref: a, ...m }))));
|
|
236
|
-
}), Ae = n.forwardRef((t, a) => S((r) => r.filtered.count === 0) ? n.createElement(I.div, { ref: a, ...t, "cmdk-empty": "", role: "presentation" }) : null), Me = n.forwardRef((t, a) => {
|
|
237
|
-
let { progress: r, children: v, label: i = "Loading...", ...c } = t;
|
|
238
|
-
return n.createElement(I.div, { ref: a, ...c, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": i }, z(t, (d) => n.createElement("div", { "aria-hidden": !0 }, d)));
|
|
239
|
-
}), Ne = Object.assign(fe, { List: Re, Item: we, Input: Ie, Group: ke, Separator: Se, Dialog: xe, Empty: Ae, Loading: Me });
|
|
240
|
-
function Pe(t, a) {
|
|
241
|
-
let r = t.nextElementSibling;
|
|
242
|
-
for (; r; ) {
|
|
243
|
-
if (r.matches(a)) return r;
|
|
244
|
-
r = r.nextElementSibling;
|
|
245
|
-
}
|
|
88
|
+
}), [r, n, a]), u.useEffect(() => {
|
|
89
|
+
c.current.isValid && t._setValid(!0);
|
|
90
|
+
}, [t]), u.useMemo(() => ee(i, t, c.current, !1), [i, t]);
|
|
246
91
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
92
|
+
var re = (e) => typeof e == "string", T = (e, s, t, n, r) => re(e) ? y(t, e, r) : Array.isArray(e) ? e.map((a) => y(t, a)) : t, U = (e) => w(e) || !H(e);
|
|
93
|
+
function S(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
94
|
+
if (U(e) || U(s))
|
|
95
|
+
return Object.is(e, s);
|
|
96
|
+
if (k(e) && k(s))
|
|
97
|
+
return e.getTime() === s.getTime();
|
|
98
|
+
const n = Object.keys(e), r = Object.keys(s);
|
|
99
|
+
if (n.length !== r.length)
|
|
100
|
+
return !1;
|
|
101
|
+
if (t.has(e) || t.has(s))
|
|
102
|
+
return !0;
|
|
103
|
+
t.add(e), t.add(s);
|
|
104
|
+
for (const a of n) {
|
|
105
|
+
const i = e[a];
|
|
106
|
+
if (!r.includes(a))
|
|
107
|
+
return !1;
|
|
108
|
+
if (a !== "ref") {
|
|
109
|
+
const l = s[a];
|
|
110
|
+
if (k(i) && k(l) || p(i) && p(l) || Array.isArray(i) && Array.isArray(l) ? !S(i, l, t) : !Object.is(i, l))
|
|
111
|
+
return !1;
|
|
112
|
+
}
|
|
252
113
|
}
|
|
114
|
+
return !0;
|
|
253
115
|
}
|
|
254
|
-
function
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
};
|
|
291
|
-
function Ke(t) {
|
|
292
|
-
let a = t.type;
|
|
293
|
-
return typeof a == "function" ? a(t.props) : "render" in a ? a.render(t.props) : t;
|
|
116
|
+
function se(e) {
|
|
117
|
+
const s = M(), { control: t = s.control, name: n, defaultValue: r, disabled: a, exact: i, compute: l } = e || {}, c = u.useRef(r), f = u.useRef(l), V = u.useRef(void 0), d = u.useRef(t), g = u.useRef(n);
|
|
118
|
+
f.current = l;
|
|
119
|
+
const [A, v] = u.useState(() => {
|
|
120
|
+
const o = t._getWatch(n, c.current);
|
|
121
|
+
return f.current ? f.current(o) : o;
|
|
122
|
+
}), C = u.useCallback((o) => {
|
|
123
|
+
const m = T(n, t._names, o || t._formValues, !1, c.current);
|
|
124
|
+
return f.current ? f.current(m) : m;
|
|
125
|
+
}, [t._formValues, t._names, n]), b = u.useCallback((o) => {
|
|
126
|
+
if (!a) {
|
|
127
|
+
const m = T(n, t._names, o || t._formValues, !1, c.current);
|
|
128
|
+
if (f.current) {
|
|
129
|
+
const _ = f.current(m);
|
|
130
|
+
S(_, V.current) || (v(_), V.current = _);
|
|
131
|
+
} else
|
|
132
|
+
v(m);
|
|
133
|
+
}
|
|
134
|
+
}, [t._formValues, t._names, a, n]);
|
|
135
|
+
q(() => ((d.current !== t || !S(g.current, n)) && (d.current = t, g.current = n, b()), t._subscribe({
|
|
136
|
+
name: n,
|
|
137
|
+
formState: {
|
|
138
|
+
values: !0
|
|
139
|
+
},
|
|
140
|
+
exact: i,
|
|
141
|
+
callback: (o) => {
|
|
142
|
+
b(o.values);
|
|
143
|
+
}
|
|
144
|
+
})), [t, i, n, b]), u.useEffect(() => t._removeUnmounted());
|
|
145
|
+
const h = d.current !== t, F = g.current, O = u.useMemo(() => {
|
|
146
|
+
if (a)
|
|
147
|
+
return null;
|
|
148
|
+
const o = !h && !S(F, n);
|
|
149
|
+
return h || o ? C() : null;
|
|
150
|
+
}, [a, h, n, F, C]);
|
|
151
|
+
return O !== null ? O : A;
|
|
294
152
|
}
|
|
295
|
-
function
|
|
296
|
-
|
|
153
|
+
function ne(e) {
|
|
154
|
+
const s = M(), { name: t, disabled: n, control: r = s.control, shouldUnregister: a, defaultValue: i, exact: l = !0 } = e, c = X(r._names.array, t), f = u.useMemo(() => y(r._formValues, t, y(r._defaultValues, t, i)), [r, t, i]), V = se({
|
|
155
|
+
control: r,
|
|
156
|
+
name: t,
|
|
157
|
+
defaultValue: f,
|
|
158
|
+
exact: l
|
|
159
|
+
}), d = te({
|
|
160
|
+
control: r,
|
|
161
|
+
name: t,
|
|
162
|
+
exact: l
|
|
163
|
+
}), g = u.useRef(e), A = u.useRef(void 0), v = u.useRef(r.register(t, {
|
|
164
|
+
...e.rules,
|
|
165
|
+
value: V,
|
|
166
|
+
...P(e.disabled) ? { disabled: e.disabled } : {}
|
|
167
|
+
}));
|
|
168
|
+
g.current = e;
|
|
169
|
+
const C = u.useMemo(() => Object.defineProperties({}, {
|
|
170
|
+
invalid: {
|
|
171
|
+
enumerable: !0,
|
|
172
|
+
get: () => !!y(d.errors, t)
|
|
173
|
+
},
|
|
174
|
+
isDirty: {
|
|
175
|
+
enumerable: !0,
|
|
176
|
+
get: () => !!y(d.dirtyFields, t)
|
|
177
|
+
},
|
|
178
|
+
isTouched: {
|
|
179
|
+
enumerable: !0,
|
|
180
|
+
get: () => !!y(d.touchedFields, t)
|
|
181
|
+
},
|
|
182
|
+
isValidating: {
|
|
183
|
+
enumerable: !0,
|
|
184
|
+
get: () => !!y(d.validatingFields, t)
|
|
185
|
+
},
|
|
186
|
+
error: {
|
|
187
|
+
enumerable: !0,
|
|
188
|
+
get: () => y(d.errors, t)
|
|
189
|
+
}
|
|
190
|
+
}), [d, t]), b = u.useCallback((o) => v.current.onChange({
|
|
191
|
+
target: {
|
|
192
|
+
value: J(o),
|
|
193
|
+
name: t
|
|
194
|
+
},
|
|
195
|
+
type: I.CHANGE
|
|
196
|
+
}), [t]), h = u.useCallback(() => v.current.onBlur({
|
|
197
|
+
target: {
|
|
198
|
+
value: y(r._formValues, t),
|
|
199
|
+
name: t
|
|
200
|
+
},
|
|
201
|
+
type: I.BLUR
|
|
202
|
+
}), [t, r._formValues]), F = u.useCallback((o) => {
|
|
203
|
+
const m = y(r._fields, t);
|
|
204
|
+
m && m._f && o && (m._f.ref = {
|
|
205
|
+
focus: () => E(o.focus) && o.focus(),
|
|
206
|
+
select: () => E(o.select) && o.select(),
|
|
207
|
+
setCustomValidity: (_) => E(o.setCustomValidity) && o.setCustomValidity(_),
|
|
208
|
+
reportValidity: () => E(o.reportValidity) && o.reportValidity()
|
|
209
|
+
});
|
|
210
|
+
}, [r._fields, t]), O = u.useMemo(() => ({
|
|
211
|
+
name: t,
|
|
212
|
+
value: V,
|
|
213
|
+
...P(n) || d.disabled ? { disabled: d.disabled || n } : {},
|
|
214
|
+
onChange: b,
|
|
215
|
+
onBlur: h,
|
|
216
|
+
ref: F
|
|
217
|
+
}), [t, n, d.disabled, b, h, F, V]);
|
|
218
|
+
return u.useEffect(() => {
|
|
219
|
+
const o = r._options.shouldUnregister || a, m = A.current;
|
|
220
|
+
m && m !== t && !c && r.unregister(m), r.register(t, {
|
|
221
|
+
...g.current.rules,
|
|
222
|
+
...P(g.current.disabled) ? { disabled: g.current.disabled } : {}
|
|
223
|
+
});
|
|
224
|
+
const _ = (x, K) => {
|
|
225
|
+
const N = y(r._fields, x);
|
|
226
|
+
N && N._f && (N._f.mount = K);
|
|
227
|
+
};
|
|
228
|
+
if (_(t, !0), o) {
|
|
229
|
+
const x = W(y(r._options.defaultValues, t, g.current.defaultValue));
|
|
230
|
+
D(r._defaultValues, t, x), R(y(r._formValues, t)) && D(r._formValues, t, x);
|
|
231
|
+
}
|
|
232
|
+
return !c && r.register(t), A.current = t, () => {
|
|
233
|
+
(c ? o && !r._state.action : o) ? r.unregister(t) : _(t, !1);
|
|
234
|
+
};
|
|
235
|
+
}, [t, r, c, a]), u.useEffect(() => {
|
|
236
|
+
r._setDisabledField({
|
|
237
|
+
disabled: n,
|
|
238
|
+
name: t
|
|
239
|
+
});
|
|
240
|
+
}, [n, t, r]), u.useMemo(() => ({
|
|
241
|
+
field: O,
|
|
242
|
+
formState: d,
|
|
243
|
+
fieldState: C
|
|
244
|
+
}), [O, d, C]);
|
|
297
245
|
}
|
|
298
|
-
|
|
246
|
+
const ae = (e) => e.render(ne(e));
|
|
299
247
|
export {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
fe as CommandRoot,
|
|
309
|
-
Se as CommandSeparator,
|
|
310
|
-
Ce as defaultFilter,
|
|
311
|
-
S as useCommandState
|
|
248
|
+
ae as Controller,
|
|
249
|
+
oe as FormProvider,
|
|
250
|
+
y as get,
|
|
251
|
+
D as set,
|
|
252
|
+
ne as useController,
|
|
253
|
+
M as useFormContext,
|
|
254
|
+
te as useFormState,
|
|
255
|
+
se as useWatch
|
|
312
256
|
};
|