@drjoshcsimmons/scl 0.2.5 → 0.2.7
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 +13 -217
- package/dist/index101.js +6 -14
- package/dist/index102.js +24 -47
- package/dist/index103.js +53 -48
- package/dist/index104.js +30 -9
- package/dist/index105.js +216 -45
- package/dist/index106.js +8 -649
- package/dist/index107.js +30 -15
- package/dist/index108.js +180 -3
- package/dist/index109.js +649 -8
- package/dist/index11.js +2 -2
- package/dist/index110.js +30 -30
- package/dist/index111.js +1 -1
- package/dist/index112.js +47 -29
- package/dist/index113.js +6 -48
- package/dist/index114.js +48 -6
- package/dist/index115.js +1 -1
- package/dist/index116.js +1 -1
- package/dist/index117.js +21 -206
- package/dist/index118.js +9 -22
- package/dist/index119.js +38 -400
- package/dist/index12.js +1 -1
- package/dist/index120.js +11 -14
- package/dist/index121.js +206 -9
- package/dist/index122.js +21 -37
- package/dist/index123.js +399 -17
- package/dist/index124.js +1 -1
- package/dist/index13.js +2 -2
- package/dist/index134.js +1 -1
- package/dist/index136.js +4 -4
- package/dist/index14.js +2 -2
- package/dist/index141.js +69 -65
- package/dist/index142.js +8 -68
- package/dist/index143.js +14 -9
- package/dist/index144.js +66 -14
- package/dist/index145.js +64 -65
- package/dist/index15.js +2 -2
- package/dist/index17.js +3 -3
- package/dist/index18.js +2 -2
- package/dist/index20.js +1 -1
- package/dist/index21.js +1 -1
- package/dist/index22.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/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 +220 -108
- package/dist/index46.js +11 -33
- package/dist/index47.js +33 -249
- package/dist/index48.js +73 -9
- package/dist/index49.js +116 -64
- package/dist/index5.js +1 -1
- package/dist/index50.js +507 -214
- package/dist/index51.js +260 -11
- package/dist/index52.js +12 -60
- package/dist/index53.js +60 -12
- package/dist/index54.js +1 -1
- package/dist/index55.js +12 -118
- package/dist/index56.js +9 -82
- package/dist/index57.js +298 -229
- package/dist/index58.js +12 -236
- package/dist/index59.js +82 -11
- package/dist/index6.js +1 -1
- package/dist/index60.js +7 -7
- package/dist/index61.js +425 -244
- package/dist/index62.js +221 -232
- package/dist/index63.js +225 -12
- package/dist/index64.js +11 -225
- package/dist/index65.js +1 -1
- package/dist/index66.js +333 -28
- package/dist/index67.js +153 -302
- package/dist/index68.js +22 -12
- package/dist/index69.js +811 -481
- package/dist/index7.js +1 -1
- package/dist/index70.js +9 -860
- package/dist/index71.js +31 -9
- package/dist/index72.js +241 -323
- package/dist/index73.js +210 -409
- package/dist/index74.js +98 -141
- package/dist/index75.js +238 -19
- package/dist/index76.js +64 -23
- package/dist/index77.js +42 -64
- package/dist/index78.js +25 -5
- package/dist/index79.js +6 -51
- package/dist/index8.js +1 -1
- package/dist/index80.js +51 -5
- package/dist/index81.js +33 -24
- package/dist/index82.js +10 -68
- package/dist/index83.js +7 -33
- package/dist/index84.js +54 -8
- package/dist/index85.js +10 -54
- package/dist/index86.js +4 -11
- package/dist/index87.js +30 -4
- package/dist/index88.js +13 -30
- package/dist/index89.js +8 -12
- package/dist/index9.js +2 -2
- package/dist/index90.js +66 -43
- package/dist/index91.js +3 -10
- package/dist/index92.js +124 -7
- package/dist/index93.js +134 -29
- package/dist/index94.js +14 -55
- package/dist/index95.js +15 -30
- package/dist/index96.js +9 -181
- package/dist/index97.js +47 -122
- package/dist/index98.js +46 -13
- package/dist/index99.js +29 -134
- package/package.json +5 -3
package/dist/index71.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import { composeEventHandlers as m } from "./index79.js";
|
|
3
|
+
import { useControllableState as p } from "./index80.js";
|
|
4
|
+
import { Primitive as b } from "./index81.js";
|
|
5
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
6
|
+
var r = "Toggle", t = f.forwardRef((e, a) => {
|
|
7
|
+
const { pressed: s, defaultPressed: d, onPressedChange: i, ...l } = e, [o, n] = p({
|
|
8
|
+
prop: s,
|
|
9
|
+
onChange: i,
|
|
10
|
+
defaultProp: d ?? !1,
|
|
11
|
+
caller: r
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ c(
|
|
14
|
+
b.button,
|
|
15
|
+
{
|
|
16
|
+
type: "button",
|
|
17
|
+
"aria-pressed": o,
|
|
18
|
+
"data-state": o ? "on" : "off",
|
|
19
|
+
"data-disabled": e.disabled ? "" : void 0,
|
|
20
|
+
...l,
|
|
21
|
+
ref: a,
|
|
22
|
+
onClick: m(e.onClick, () => {
|
|
23
|
+
e.disabled || n(!o);
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
t.displayName = r;
|
|
29
|
+
var C = t;
|
|
9
30
|
export {
|
|
10
|
-
|
|
31
|
+
C as Root,
|
|
32
|
+
t as Toggle
|
|
11
33
|
};
|
package/dist/index72.js
CHANGED
|
@@ -1,338 +1,256 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, []),
|
|
37
|
-
onClose: s.useCallback(() => {
|
|
38
|
-
window.clearTimeout(i.current), i.current = window.setTimeout(
|
|
39
|
-
() => l.current = !0,
|
|
40
|
-
r
|
|
41
|
-
);
|
|
42
|
-
}, [r]),
|
|
43
|
-
isPointerInTransitRef: v,
|
|
44
|
-
onPointerInTransitChange: s.useCallback((p) => {
|
|
45
|
-
v.current = p;
|
|
46
|
-
}, []),
|
|
47
|
-
disableHoverableContent: n,
|
|
48
|
-
children: a
|
|
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]) ? {} : [];
|
|
49
36
|
}
|
|
50
|
-
|
|
37
|
+
if (l === "__proto__" || l === "constructor" || l === "prototype")
|
|
38
|
+
return;
|
|
39
|
+
e[l] = c, e = e[l];
|
|
40
|
+
}
|
|
51
41
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = t, i = k(R, t.__scopeTooltip), p = O(o), [c, d] = s.useState(null), h = $(), u = s.useRef(0), m = l ?? i.disableHoverableContent, y = v ?? i.delayDuration, T = s.useRef(!1), [x, C] = re({
|
|
63
|
-
prop: r,
|
|
64
|
-
defaultProp: n ?? !1,
|
|
65
|
-
onChange: (H) => {
|
|
66
|
-
H ? (i.onOpen(), document.dispatchEvent(new CustomEvent(L))) : i.onClose(), a == null || a(H);
|
|
67
|
-
},
|
|
68
|
-
caller: R
|
|
69
|
-
}), w = s.useMemo(() => x ? T.current ? "delayed-open" : "instant-open" : "closed", [x]), P = s.useCallback(() => {
|
|
70
|
-
window.clearTimeout(u.current), u.current = 0, T.current = !1, C(!0);
|
|
71
|
-
}, [C]), E = s.useCallback(() => {
|
|
72
|
-
window.clearTimeout(u.current), u.current = 0, C(!1);
|
|
73
|
-
}, [C]), I = s.useCallback(() => {
|
|
74
|
-
window.clearTimeout(u.current), u.current = window.setTimeout(() => {
|
|
75
|
-
T.current = !0, C(!0), u.current = 0;
|
|
76
|
-
}, y);
|
|
77
|
-
}, [y, C]);
|
|
78
|
-
return s.useEffect(() => () => {
|
|
79
|
-
u.current && (window.clearTimeout(u.current), u.current = 0);
|
|
80
|
-
}, []), /* @__PURE__ */ f(z, { ...p, children: /* @__PURE__ */ f(
|
|
81
|
-
le,
|
|
82
|
-
{
|
|
83
|
-
scope: o,
|
|
84
|
-
contentId: h,
|
|
85
|
-
open: x,
|
|
86
|
-
stateAttribute: w,
|
|
87
|
-
trigger: c,
|
|
88
|
-
onTriggerChange: d,
|
|
89
|
-
onTriggerEnter: s.useCallback(() => {
|
|
90
|
-
i.isOpenDelayedRef.current ? I() : P();
|
|
91
|
-
}, [i.isOpenDelayedRef, I, P]),
|
|
92
|
-
onTriggerLeave: s.useCallback(() => {
|
|
93
|
-
m ? E() : (window.clearTimeout(u.current), u.current = 0);
|
|
94
|
-
}, [E, m]),
|
|
95
|
-
onOpen: P,
|
|
96
|
-
onClose: E,
|
|
97
|
-
disableHoverableContent: m,
|
|
98
|
-
children: e
|
|
99
|
-
}
|
|
100
|
-
) });
|
|
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);
|
|
101
52
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
...r,
|
|
112
|
-
ref: i,
|
|
113
|
-
onPointerMove: g(t.onPointerMove, (h) => {
|
|
114
|
-
h.pointerType !== "touch" && !c.current && !a.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
|
|
115
|
-
}),
|
|
116
|
-
onPointerLeave: g(t.onPointerLeave, () => {
|
|
117
|
-
n.onTriggerLeave(), c.current = !1;
|
|
118
|
-
}),
|
|
119
|
-
onPointerDown: g(t.onPointerDown, () => {
|
|
120
|
-
n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", d, { once: !0 });
|
|
121
|
-
}),
|
|
122
|
-
onFocus: g(t.onFocus, () => {
|
|
123
|
-
p.current || n.onOpen();
|
|
124
|
-
}),
|
|
125
|
-
onBlur: g(t.onBlur, n.onClose),
|
|
126
|
-
onClick: g(t.onClick, n.onClose)
|
|
53
|
+
var ee = (e, s, t, n = !0) => {
|
|
54
|
+
const r = {
|
|
55
|
+
defaultValues: s._defaultValues
|
|
56
|
+
};
|
|
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];
|
|
127
62
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
);
|
|
131
|
-
U.displayName = A;
|
|
132
|
-
var M = "TooltipPortal", [ce, ue] = D(M, {
|
|
133
|
-
forceMount: void 0
|
|
134
|
-
}), V = (t) => {
|
|
135
|
-
const { __scopeTooltip: o, forceMount: e, children: r, container: n } = t, a = _(M, o);
|
|
136
|
-
return /* @__PURE__ */ f(ce, { scope: o, forceMount: e, children: /* @__PURE__ */ f(G, { present: e || a.open, children: /* @__PURE__ */ f(ee, { asChild: !0, container: n, children: r }) }) });
|
|
63
|
+
});
|
|
64
|
+
return r;
|
|
137
65
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
(t,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}, [i, c, u, h]), s.useEffect(() => {
|
|
162
|
-
if (l) {
|
|
163
|
-
const m = (y) => {
|
|
164
|
-
const T = y.target, x = { x: y.clientX, y: y.clientY }, C = (i == null ? void 0 : i.contains(T)) || (c == null ? void 0 : c.contains(T)), w = !Ce(x, l);
|
|
165
|
-
C ? h() : w && (h(), p());
|
|
166
|
-
};
|
|
167
|
-
return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
|
|
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
|
|
86
|
+
});
|
|
168
87
|
}
|
|
169
|
-
}, [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const {
|
|
173
|
-
__scopeTooltip: e,
|
|
174
|
-
children: r,
|
|
175
|
-
"aria-label": n,
|
|
176
|
-
onEscapeKeyDown: a,
|
|
177
|
-
onPointerDownOutside: l,
|
|
178
|
-
...v
|
|
179
|
-
} = t, i = _(b, e), p = O(e), { onClose: c } = i;
|
|
180
|
-
return s.useEffect(() => (document.addEventListener(L, c), () => document.removeEventListener(L, c)), [c]), s.useEffect(() => {
|
|
181
|
-
if (i.trigger) {
|
|
182
|
-
const d = (h) => {
|
|
183
|
-
const u = h.target;
|
|
184
|
-
u != null && u.contains(i.trigger) && c();
|
|
185
|
-
};
|
|
186
|
-
return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
|
|
187
|
-
}
|
|
188
|
-
}, [i.trigger, c]), /* @__PURE__ */ f(
|
|
189
|
-
W,
|
|
190
|
-
{
|
|
191
|
-
asChild: !0,
|
|
192
|
-
disableOutsidePointerEvents: !1,
|
|
193
|
-
onEscapeKeyDown: a,
|
|
194
|
-
onPointerDownOutside: l,
|
|
195
|
-
onFocusOutside: (d) => d.preventDefault(),
|
|
196
|
-
onDismiss: c,
|
|
197
|
-
children: /* @__PURE__ */ se(
|
|
198
|
-
Q,
|
|
199
|
-
{
|
|
200
|
-
"data-state": i.stateAttribute,
|
|
201
|
-
...p,
|
|
202
|
-
...v,
|
|
203
|
-
ref: o,
|
|
204
|
-
style: {
|
|
205
|
-
...v.style,
|
|
206
|
-
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
207
|
-
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
208
|
-
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
209
|
-
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
210
|
-
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
211
|
-
},
|
|
212
|
-
children: [
|
|
213
|
-
/* @__PURE__ */ f(ve, { children: r }),
|
|
214
|
-
/* @__PURE__ */ f(de, { scope: e, isInside: !0, children: /* @__PURE__ */ f(ne, { id: i.contentId, role: "tooltip", children: n || r }) })
|
|
215
|
-
]
|
|
216
|
-
}
|
|
217
|
-
)
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
Y.displayName = b;
|
|
223
|
-
var X = "TooltipArrow", he = s.forwardRef(
|
|
224
|
-
(t, o) => {
|
|
225
|
-
const { __scopeTooltip: e, ...r } = t, n = O(e);
|
|
226
|
-
return fe(
|
|
227
|
-
X,
|
|
228
|
-
e
|
|
229
|
-
).isInside ? null : /* @__PURE__ */ f(Z, { ...n, ...r, ref: o });
|
|
230
|
-
}
|
|
231
|
-
);
|
|
232
|
-
he.displayName = X;
|
|
233
|
-
function me(t, o) {
|
|
234
|
-
const e = Math.abs(o.top - t.y), r = Math.abs(o.bottom - t.y), n = Math.abs(o.right - t.x), a = Math.abs(o.left - t.x);
|
|
235
|
-
switch (Math.min(e, r, n, a)) {
|
|
236
|
-
case a:
|
|
237
|
-
return "left";
|
|
238
|
-
case n:
|
|
239
|
-
return "right";
|
|
240
|
-
case e:
|
|
241
|
-
return "top";
|
|
242
|
-
case r:
|
|
243
|
-
return "bottom";
|
|
244
|
-
default:
|
|
245
|
-
throw new Error("unreachable");
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
function Te(t, o, e = 5) {
|
|
249
|
-
const r = [];
|
|
250
|
-
switch (o) {
|
|
251
|
-
case "top":
|
|
252
|
-
r.push(
|
|
253
|
-
{ x: t.x - e, y: t.y + e },
|
|
254
|
-
{ x: t.x + e, y: t.y + e }
|
|
255
|
-
);
|
|
256
|
-
break;
|
|
257
|
-
case "bottom":
|
|
258
|
-
r.push(
|
|
259
|
-
{ x: t.x - e, y: t.y - e },
|
|
260
|
-
{ x: t.x + e, y: t.y - e }
|
|
261
|
-
);
|
|
262
|
-
break;
|
|
263
|
-
case "left":
|
|
264
|
-
r.push(
|
|
265
|
-
{ x: t.x + e, y: t.y - e },
|
|
266
|
-
{ x: t.x + e, y: t.y + e }
|
|
267
|
-
);
|
|
268
|
-
break;
|
|
269
|
-
case "right":
|
|
270
|
-
r.push(
|
|
271
|
-
{ x: t.x - e, y: t.y - e },
|
|
272
|
-
{ x: t.x - e, y: t.y + e }
|
|
273
|
-
);
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
return r;
|
|
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]);
|
|
277
91
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
for (
|
|
291
|
-
const
|
|
292
|
-
|
|
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
|
+
}
|
|
293
113
|
}
|
|
294
|
-
return
|
|
114
|
+
return !0;
|
|
295
115
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
298
|
-
|
|
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;
|
|
299
152
|
}
|
|
300
|
-
function
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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)
|
|
309
189
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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);
|
|
320
231
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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]);
|
|
324
245
|
}
|
|
325
|
-
|
|
246
|
+
const ae = (e) => e.render(ne(e));
|
|
326
247
|
export {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
F as TooltipProvider,
|
|
336
|
-
U as TooltipTrigger,
|
|
337
|
-
Se as Trigger
|
|
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
|
|
338
256
|
};
|