@drjoshcsimmons/scl 0.1.12 → 0.1.14
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 +12 -47
- package/dist/index101.js +8 -54
- package/dist/index102.js +30 -11
- package/dist/index103.js +4 -30
- package/dist/index104.js +24 -12
- package/dist/index105.js +6 -30
- package/dist/index107.js +1 -1
- package/dist/index108.js +30 -650
- package/dist/index109.js +1 -1
- package/dist/index11.js +2 -2
- package/dist/index110.js +647 -27
- package/dist/index112.js +14 -8
- package/dist/index113.js +11 -47
- package/dist/index114.js +200 -42
- package/dist/index115.js +21 -20
- package/dist/index116.js +400 -9
- package/dist/index117.js +48 -38
- package/dist/index118.js +48 -18
- package/dist/index119.js +21 -12
- package/dist/index12.js +1 -1
- package/dist/index120.js +9 -206
- package/dist/index121.js +37 -21
- package/dist/index122.js +17 -399
- package/dist/index124.js +1 -1
- package/dist/index126.js +3 -3
- package/dist/index127.js +3 -3
- package/dist/index129.js +1 -1
- package/dist/index13.js +2 -2
- package/dist/index130.js +1 -1
- package/dist/index131.js +5 -2
- package/dist/index132.js +3 -2
- package/dist/index133.js +24 -5
- package/dist/index134.js +113 -3
- package/dist/index135.js +15 -23
- package/dist/index136.js +519 -107
- package/dist/index137.js +126 -14
- package/dist/index138.js +125 -516
- package/dist/index139.js +2 -128
- package/dist/index14.js +2 -2
- package/dist/index140.js +2 -134
- 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 +4 -4
- package/dist/index18.js +2 -2
- package/dist/index20.js +2 -2
- 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/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 +33 -237
- package/dist/index46.js +241 -11
- package/dist/index47.js +212 -211
- package/dist/index48.js +4 -4
- package/dist/index49.js +246 -104
- package/dist/index5.js +1 -1
- package/dist/index50.js +12 -33
- package/dist/index51.js +509 -109
- package/dist/index52.js +20 -433
- package/dist/index53.js +158 -57
- package/dist/index54.js +66 -247
- package/dist/index55.js +334 -16
- package/dist/index56.js +236 -31
- package/dist/index57.js +11 -310
- package/dist/index58.js +82 -12
- package/dist/index59.js +221 -232
- package/dist/index6.js +1 -1
- package/dist/index60.js +3 -6
- package/dist/index61.js +112 -143
- package/dist/index62.js +16 -247
- package/dist/index63.js +860 -9
- package/dist/index64.js +9 -241
- package/dist/index65.js +30 -72
- package/dist/index66.js +433 -20
- package/dist/index67.js +53 -75
- package/dist/index68.js +102 -209
- package/dist/index69.js +225 -11
- package/dist/index7.js +1 -1
- package/dist/index70.js +4 -5
- package/dist/index71.js +12 -860
- package/dist/index72.js +125 -9
- package/dist/index73.js +283 -503
- package/dist/index74.js +12 -125
- package/dist/index75.js +241 -323
- package/dist/index76.js +5 -66
- package/dist/index77.js +25 -44
- package/dist/index78.js +64 -23
- package/dist/index79.js +123 -5
- package/dist/index8.js +1 -1
- package/dist/index80.js +13 -50
- package/dist/index81.js +133 -32
- package/dist/index82.js +1 -1
- package/dist/index83.js +218 -7
- package/dist/index84.js +14 -181
- package/dist/index85.js +67 -23
- package/dist/index86.js +33 -5
- package/dist/index87.js +42 -63
- package/dist/index88.js +52 -4
- package/dist/index89.js +50 -4
- package/dist/index9.js +2 -2
- package/dist/index90.js +9 -30
- package/dist/index91.js +45 -14
- package/dist/index92.js +7 -124
- package/dist/index93.js +40 -127
- package/dist/index94.js +30 -14
- package/dist/index95.js +179 -13
- package/dist/index96.js +55 -9
- package/dist/index97.js +11 -50
- package/dist/index98.js +4 -48
- package/dist/index99.js +30 -219
- package/package.json +1 -1
package/dist/index54.js
CHANGED
|
@@ -1,256 +1,75 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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]) ? {} : [];
|
|
36
|
-
}
|
|
37
|
-
if (l === "__proto__" || l === "constructor" || l === "prototype")
|
|
38
|
-
return;
|
|
39
|
-
e[l] = c, e = e[l];
|
|
40
|
-
}
|
|
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
|
|
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];
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { createContextScope as C } from "./index96.js";
|
|
3
|
+
import { useCallbackRef as h } from "./index97.js";
|
|
4
|
+
import { useLayoutEffect as f } from "./index98.js";
|
|
5
|
+
import { Primitive as m } from "./index99.js";
|
|
6
|
+
import { useIsHydrated as _ } from "./index100.js";
|
|
7
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
8
|
+
var v = "Avatar", [y] = C(v), [x, A] = y(v), L = i.forwardRef(
|
|
9
|
+
(t, e) => {
|
|
10
|
+
const { __scopeAvatar: o, ...r } = t, [n, a] = i.useState("idle");
|
|
11
|
+
return /* @__PURE__ */ l(
|
|
12
|
+
x,
|
|
13
|
+
{
|
|
14
|
+
scope: o,
|
|
15
|
+
imageLoadingStatus: n,
|
|
16
|
+
onImageLoadingStatusChange: a,
|
|
17
|
+
children: /* @__PURE__ */ l(m.span, { ...r, ref: e })
|
|
62
18
|
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
L.displayName = v;
|
|
23
|
+
var S = "AvatarImage", E = i.forwardRef(
|
|
24
|
+
(t, e) => {
|
|
25
|
+
const { __scopeAvatar: o, src: r, onLoadingStatusChange: n = () => {
|
|
26
|
+
}, ...a } = t, u = A(S, o), s = N(r, a), d = h((c) => {
|
|
27
|
+
n(c), u.onImageLoadingStatusChange(c);
|
|
63
28
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
});
|
|
87
|
-
}
|
|
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]);
|
|
91
|
-
}
|
|
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
|
-
}
|
|
29
|
+
return f(() => {
|
|
30
|
+
s !== "idle" && d(s);
|
|
31
|
+
}, [s, d]), s === "loaded" ? /* @__PURE__ */ l(m.img, { ...a, ref: e, src: r }) : null;
|
|
113
32
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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;
|
|
33
|
+
);
|
|
34
|
+
E.displayName = S;
|
|
35
|
+
var I = "AvatarFallback", R = i.forwardRef(
|
|
36
|
+
(t, e) => {
|
|
37
|
+
const { __scopeAvatar: o, delayMs: r, ...n } = t, a = A(I, o), [u, s] = i.useState(r === void 0);
|
|
38
|
+
return i.useEffect(() => {
|
|
39
|
+
if (r !== void 0) {
|
|
40
|
+
const d = window.setTimeout(() => s(!0), r);
|
|
41
|
+
return () => window.clearTimeout(d);
|
|
42
|
+
}
|
|
43
|
+
}, [r]), u && a.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ l(m.span, { ...n, ref: e }) : null;
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
R.displayName = I;
|
|
47
|
+
function p(t, e) {
|
|
48
|
+
return t ? e ? (t.src !== e && (t.src = e), t.complete && t.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
152
49
|
}
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}),
|
|
160
|
-
|
|
161
|
-
|
|
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);
|
|
50
|
+
function N(t, { referrerPolicy: e, crossOrigin: o }) {
|
|
51
|
+
const r = _(), n = i.useRef(null), a = r ? (n.current || (n.current = new window.Image()), n.current) : null, [u, s] = i.useState(
|
|
52
|
+
() => p(a, t)
|
|
53
|
+
);
|
|
54
|
+
return f(() => {
|
|
55
|
+
s(p(a, t));
|
|
56
|
+
}, [a, t]), f(() => {
|
|
57
|
+
const d = (w) => () => {
|
|
58
|
+
s(w);
|
|
227
59
|
};
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return !c && r.register(t), A.current = t, () => {
|
|
233
|
-
(c ? o && !r._state.action : o) ? r.unregister(t) : _(t, !1);
|
|
60
|
+
if (!a) return;
|
|
61
|
+
const c = d("loaded"), g = d("error");
|
|
62
|
+
return a.addEventListener("load", c), a.addEventListener("error", g), e && (a.referrerPolicy = e), typeof o == "string" && (a.crossOrigin = o), () => {
|
|
63
|
+
a.removeEventListener("load", c), a.removeEventListener("error", g);
|
|
234
64
|
};
|
|
235
|
-
}, [
|
|
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]);
|
|
65
|
+
}, [a, o, e]), u;
|
|
245
66
|
}
|
|
246
|
-
|
|
67
|
+
var H = L, j = E, B = R;
|
|
247
68
|
export {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
te as useFormState,
|
|
255
|
-
se as useWatch
|
|
69
|
+
L as Avatar,
|
|
70
|
+
R as AvatarFallback,
|
|
71
|
+
E as AvatarImage,
|
|
72
|
+
B as Fallback,
|
|
73
|
+
j as Image,
|
|
74
|
+
H as Root
|
|
256
75
|
};
|
package/dist/index55.js
CHANGED
|
@@ -1,20 +1,338 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import { composeEventHandlers as g } from "./index76.js";
|
|
3
|
+
import { useComposedRefs as N } from "./index77.js";
|
|
4
|
+
import { createContextScope as K } from "./index78.js";
|
|
5
|
+
import { DismissableLayer as W } from "./index79.js";
|
|
6
|
+
import { useId as $ } from "./index82.js";
|
|
7
|
+
import { createPopperScope as S, Root as z, Anchor as J, Content as Q, Arrow as Z } from "./index83.js";
|
|
8
|
+
import { Portal as ee } from "./index84.js";
|
|
9
|
+
import { Presence as G } from "./index85.js";
|
|
10
|
+
import { Primitive as te } from "./index86.js";
|
|
11
|
+
import { createSlottable as oe } from "./index101.js";
|
|
12
|
+
import { useControllableState as re } from "./index88.js";
|
|
13
|
+
import { Root as ne } from "./index102.js";
|
|
14
|
+
import { jsx as f, jsxs as se } from "react/jsx-runtime";
|
|
15
|
+
var [D] = K("Tooltip", [
|
|
16
|
+
S
|
|
17
|
+
]), O = S(), j = "TooltipProvider", ie = 700, L = "tooltip.open", [ae, k] = D(j), F = (t) => {
|
|
18
|
+
const {
|
|
19
|
+
__scopeTooltip: o,
|
|
20
|
+
delayDuration: e = ie,
|
|
21
|
+
skipDelayDuration: r = 300,
|
|
22
|
+
disableHoverableContent: n = !1,
|
|
23
|
+
children: a
|
|
24
|
+
} = t, l = s.useRef(!0), v = s.useRef(!1), i = s.useRef(0);
|
|
25
|
+
return s.useEffect(() => {
|
|
26
|
+
const p = i.current;
|
|
27
|
+
return () => window.clearTimeout(p);
|
|
28
|
+
}, []), /* @__PURE__ */ f(
|
|
29
|
+
ae,
|
|
30
|
+
{
|
|
31
|
+
scope: o,
|
|
32
|
+
isOpenDelayedRef: l,
|
|
33
|
+
delayDuration: e,
|
|
34
|
+
onOpen: s.useCallback(() => {
|
|
35
|
+
window.clearTimeout(i.current), l.current = !1;
|
|
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
|
|
12
49
|
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
F.displayName = j;
|
|
53
|
+
var R = "Tooltip", [le, _] = D(R), B = (t) => {
|
|
54
|
+
const {
|
|
55
|
+
__scopeTooltip: o,
|
|
56
|
+
children: e,
|
|
57
|
+
open: r,
|
|
58
|
+
defaultOpen: n,
|
|
59
|
+
onOpenChange: a,
|
|
60
|
+
disableHoverableContent: l,
|
|
61
|
+
delayDuration: v
|
|
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
|
+
) });
|
|
101
|
+
};
|
|
102
|
+
B.displayName = R;
|
|
103
|
+
var A = "TooltipTrigger", U = s.forwardRef(
|
|
104
|
+
(t, o) => {
|
|
105
|
+
const { __scopeTooltip: e, ...r } = t, n = _(A, e), a = k(A, e), l = O(e), v = s.useRef(null), i = N(o, v, n.onTriggerChange), p = s.useRef(!1), c = s.useRef(!1), d = s.useCallback(() => p.current = !1, []);
|
|
106
|
+
return s.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ f(J, { asChild: !0, ...l, children: /* @__PURE__ */ f(
|
|
107
|
+
te.button,
|
|
108
|
+
{
|
|
109
|
+
"aria-describedby": n.open ? n.contentId : void 0,
|
|
110
|
+
"data-state": n.stateAttribute,
|
|
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)
|
|
127
|
+
}
|
|
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 }) }) });
|
|
137
|
+
};
|
|
138
|
+
V.displayName = M;
|
|
139
|
+
var b = "TooltipContent", Y = s.forwardRef(
|
|
140
|
+
(t, o) => {
|
|
141
|
+
const e = ue(b, t.__scopeTooltip), { forceMount: r = e.forceMount, side: n = "top", ...a } = t, l = _(b, t.__scopeTooltip);
|
|
142
|
+
return /* @__PURE__ */ f(G, { present: r || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ f(q, { side: n, ...a, ref: o }) : /* @__PURE__ */ f(pe, { side: n, ...a, ref: o }) });
|
|
143
|
+
}
|
|
144
|
+
), pe = s.forwardRef((t, o) => {
|
|
145
|
+
const e = _(b, t.__scopeTooltip), r = k(b, t.__scopeTooltip), n = s.useRef(null), a = N(o, n), [l, v] = s.useState(null), { trigger: i, onClose: p } = e, c = n.current, { onPointerInTransitChange: d } = r, h = s.useCallback(() => {
|
|
146
|
+
v(null), d(!1);
|
|
147
|
+
}, [d]), u = s.useCallback(
|
|
148
|
+
(m, y) => {
|
|
149
|
+
const T = m.currentTarget, x = { x: m.clientX, y: m.clientY }, C = me(x, T.getBoundingClientRect()), w = Te(x, C), P = ye(y.getBoundingClientRect()), E = xe([...w, ...P]);
|
|
150
|
+
v(E), d(!0);
|
|
151
|
+
},
|
|
152
|
+
[d]
|
|
153
|
+
);
|
|
154
|
+
return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
|
|
155
|
+
if (i && c) {
|
|
156
|
+
const m = (T) => u(T, c), y = (T) => u(T, i);
|
|
157
|
+
return i.addEventListener("pointerleave", m), c.addEventListener("pointerleave", y), () => {
|
|
158
|
+
i.removeEventListener("pointerleave", m), c.removeEventListener("pointerleave", y);
|
|
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);
|
|
168
|
+
}
|
|
169
|
+
}, [i, c, l, p, h]), /* @__PURE__ */ f(q, { ...t, ref: a });
|
|
170
|
+
}), [de, fe] = D(R, { isInside: !1 }), ve = oe("TooltipContent"), q = s.forwardRef(
|
|
171
|
+
(t, o) => {
|
|
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;
|
|
277
|
+
}
|
|
278
|
+
function ye(t) {
|
|
279
|
+
const { top: o, right: e, bottom: r, left: n } = t;
|
|
280
|
+
return [
|
|
281
|
+
{ x: n, y: o },
|
|
282
|
+
{ x: e, y: o },
|
|
283
|
+
{ x: e, y: r },
|
|
284
|
+
{ x: n, y: r }
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
function Ce(t, o) {
|
|
288
|
+
const { x: e, y: r } = t;
|
|
289
|
+
let n = !1;
|
|
290
|
+
for (let a = 0, l = o.length - 1; a < o.length; l = a++) {
|
|
291
|
+
const v = o[a], i = o[l], p = v.x, c = v.y, d = i.x, h = i.y;
|
|
292
|
+
c > r != h > r && e < (d - p) * (r - c) / (h - c) + p && (n = !n);
|
|
293
|
+
}
|
|
294
|
+
return n;
|
|
295
|
+
}
|
|
296
|
+
function xe(t) {
|
|
297
|
+
const o = t.slice();
|
|
298
|
+
return o.sort((e, r) => e.x < r.x ? -1 : e.x > r.x ? 1 : e.y < r.y ? -1 : e.y > r.y ? 1 : 0), ge(o);
|
|
299
|
+
}
|
|
300
|
+
function ge(t) {
|
|
301
|
+
if (t.length <= 1) return t.slice();
|
|
302
|
+
const o = [];
|
|
303
|
+
for (let r = 0; r < t.length; r++) {
|
|
304
|
+
const n = t[r];
|
|
305
|
+
for (; o.length >= 2; ) {
|
|
306
|
+
const a = o[o.length - 1], l = o[o.length - 2];
|
|
307
|
+
if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) o.pop();
|
|
308
|
+
else break;
|
|
309
|
+
}
|
|
310
|
+
o.push(n);
|
|
311
|
+
}
|
|
312
|
+
o.pop();
|
|
313
|
+
const e = [];
|
|
314
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
315
|
+
const n = t[r];
|
|
316
|
+
for (; e.length >= 2; ) {
|
|
317
|
+
const a = e[e.length - 1], l = e[e.length - 2];
|
|
318
|
+
if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) e.pop();
|
|
319
|
+
else break;
|
|
320
|
+
}
|
|
321
|
+
e.push(n);
|
|
13
322
|
}
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
var
|
|
323
|
+
return e.pop(), o.length === 1 && e.length === 1 && o[0].x === e[0].x && o[0].y === e[0].y ? o : o.concat(e);
|
|
324
|
+
}
|
|
325
|
+
var He = F, Ne = B, Se = U, Ge = V, je = Y;
|
|
17
326
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
327
|
+
je as Content,
|
|
328
|
+
Ge as Portal,
|
|
329
|
+
He as Provider,
|
|
330
|
+
Ne as Root,
|
|
331
|
+
B as Tooltip,
|
|
332
|
+
he as TooltipArrow,
|
|
333
|
+
Y as TooltipContent,
|
|
334
|
+
V as TooltipPortal,
|
|
335
|
+
F as TooltipProvider,
|
|
336
|
+
U as TooltipTrigger,
|
|
337
|
+
Se as Trigger
|
|
20
338
|
};
|