@la-batcave/ui 3.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/README.md +95 -0
- package/dist/Alert.d.ts +27 -0
- package/dist/Alert.js +56 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +40 -0
- package/dist/Badge.d.ts +56 -0
- package/dist/Badge.js +74 -0
- package/dist/Button.d.ts +53 -0
- package/dist/Button.js +66 -0
- package/dist/Card.d.ts +18 -0
- package/dist/Card.js +98 -0
- package/dist/CodeBlock.d.ts +45 -0
- package/dist/CodeBlock.js +306 -0
- package/dist/Collapse.d.ts +58 -0
- package/dist/Collapse.js +89 -0
- package/dist/Combobox.d.ts +44 -0
- package/dist/Combobox.js +409 -0
- package/dist/DarkMode.d.ts +59 -0
- package/dist/DarkMode.js +56 -0
- package/dist/DatePicker.d.ts +48 -0
- package/dist/DatePicker.js +2954 -0
- package/dist/Dialog.d.ts +119 -0
- package/dist/Dialog.js +337 -0
- package/dist/Drawer.d.ts +28 -0
- package/dist/Drawer.js +1126 -0
- package/dist/Dropdown.d.ts +23 -0
- package/dist/Dropdown.js +247 -0
- package/dist/EasyForm.d.ts +138 -0
- package/dist/EasyForm.js +286 -0
- package/dist/HoverCard.d.ts +10 -0
- package/dist/HoverCard.js +195 -0
- package/dist/Input.d.ts +230 -0
- package/dist/Input.js +2216 -0
- package/dist/LogViewer.d.ts +57 -0
- package/dist/LogViewer.js +120 -0
- package/dist/Menubar.d.ts +32 -0
- package/dist/Menubar.js +398 -0
- package/dist/Navbar.d.ts +20 -0
- package/dist/Navbar.js +31 -0
- package/dist/Pagination.d.ts +78 -0
- package/dist/Pagination.js +106 -0
- package/dist/Popover.d.ts +11 -0
- package/dist/Popover.js +28 -0
- package/dist/ProgressBar.d.ts +35 -0
- package/dist/ProgressBar.js +210 -0
- package/dist/Resizable.d.ts +23 -0
- package/dist/Resizable.js +1532 -0
- package/dist/Separator.d.ts +4 -0
- package/dist/Separator.js +46 -0
- package/dist/Sheet.d.ts +29 -0
- package/dist/Sheet.js +104 -0
- package/dist/Sidebar.d.ts +117 -0
- package/dist/Sidebar.js +237 -0
- package/dist/Skeleton.d.ts +57 -0
- package/dist/Skeleton.js +47 -0
- package/dist/Table.d.ts +71 -0
- package/dist/Table.js +94 -0
- package/dist/Tabs.d.ts +76 -0
- package/dist/Tabs.js +202 -0
- package/dist/Toast.d.ts +54 -0
- package/dist/Toast.js +827 -0
- package/dist/Tooltip.d.ts +29 -0
- package/dist/Tooltip.js +352 -0
- package/dist/Typography.d.ts +101 -0
- package/dist/Typography.js +123 -0
- package/dist/Widget.d.ts +133 -0
- package/dist/Widget.js +207 -0
- package/dist/_shared/Combination-D_l4PLF_.js +676 -0
- package/dist/_shared/index-B03TCNO5.js +142 -0
- package/dist/_shared/index-B1f-hyuh.js +31 -0
- package/dist/_shared/index-BC7vfx-u.js +13 -0
- package/dist/_shared/index-BrLJJgkl.js +67 -0
- package/dist/_shared/index-C0gNQvxa.js +269 -0
- package/dist/_shared/index-C3aZemLI.js +268 -0
- package/dist/_shared/index-CXeb1OMI.js +198 -0
- package/dist/_shared/index-CukUn3R0.js +626 -0
- package/dist/_shared/index-DLcqcWxM.js +29 -0
- package/dist/_shared/index-DlSuDb9N.js +283 -0
- package/dist/_shared/index-V-Ajw7Ac.js +79 -0
- package/dist/_shared/index-uPOYJZpG.js +34 -0
- package/dist/_shared/index-uu9PT5Nu.js +1588 -0
- package/dist/_shared/utils-eGXXUFl7.js +2935 -0
- package/dist/backgrounds/Aurora.d.ts +7 -0
- package/dist/backgrounds/Aurora.js +126 -0
- package/dist/backgrounds/Iridescence.d.ts +7 -0
- package/dist/backgrounds/Iridescence.js +77 -0
- package/dist/backgrounds/Lightning.d.ts +8 -0
- package/dist/backgrounds/Lightning.js +75 -0
- package/dist/backgrounds/LiquidChrome.d.ts +9 -0
- package/dist/backgrounds/LiquidChrome.js +89 -0
- package/dist/backgrounds/Particles.d.ts +15 -0
- package/dist/backgrounds/Particles.js +137 -0
- package/dist/backgrounds/PixelSnow.d.ts +9 -0
- package/dist/backgrounds/PixelSnow.js +52 -0
- package/dist/backgrounds/Silk.d.ts +8 -0
- package/dist/backgrounds/Silk.js +92 -0
- package/dist/backgrounds/Squares.d.ts +9 -0
- package/dist/backgrounds/Squares.js +75 -0
- package/dist/backgrounds/Threads.d.ts +7 -0
- package/dist/backgrounds/Threads.js +110 -0
- package/dist/backgrounds/Waves.d.ts +14 -0
- package/dist/backgrounds/Waves.js +139 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +318 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { P as O, c as h, a as L, u as W } from "./index-CXeb1OMI.js";
|
|
3
|
+
import { c as H, u as _ } from "./index-DLcqcWxM.js";
|
|
4
|
+
import { P as j, D as $ } from "./index-B03TCNO5.js";
|
|
5
|
+
import { h as G, R as B, u as K, F as Z } from "./Combination-D_l4PLF_.js";
|
|
6
|
+
import { u as U } from "./index-BC7vfx-u.js";
|
|
7
|
+
import { c as E, C as q, R as z, A as y, a as J } from "./index-uu9PT5Nu.js";
|
|
8
|
+
import { P as x } from "./index-V-Ajw7Ac.js";
|
|
9
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
10
|
+
// @__NO_SIDE_EFFECTS__
|
|
11
|
+
function Q(e) {
|
|
12
|
+
const r = /* @__PURE__ */ X(e), t = a.forwardRef((n, o) => {
|
|
13
|
+
const { children: s, ...c } = n, i = a.Children.toArray(s), p = i.find(ee);
|
|
14
|
+
if (p) {
|
|
15
|
+
const u = p.props.children, P = i.map((d) => d === p ? a.Children.count(u) > 1 ? a.Children.only(null) : a.isValidElement(u) ? u.props.children : null : d);
|
|
16
|
+
return /* @__PURE__ */ l(r, { ...c, ref: o, children: a.isValidElement(u) ? a.cloneElement(u, void 0, P) : null });
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ l(r, { ...c, ref: o, children: s });
|
|
19
|
+
});
|
|
20
|
+
return t.displayName = `${e}.Slot`, t;
|
|
21
|
+
}
|
|
22
|
+
// @__NO_SIDE_EFFECTS__
|
|
23
|
+
function X(e) {
|
|
24
|
+
const r = a.forwardRef((t, n) => {
|
|
25
|
+
const { children: o, ...s } = t;
|
|
26
|
+
if (a.isValidElement(o)) {
|
|
27
|
+
const c = re(o), i = oe(s, o.props);
|
|
28
|
+
return o.type !== a.Fragment && (i.ref = n ? H(n, c) : c), a.cloneElement(o, i);
|
|
29
|
+
}
|
|
30
|
+
return a.Children.count(o) > 1 ? a.Children.only(null) : null;
|
|
31
|
+
});
|
|
32
|
+
return r.displayName = `${e}.SlotClone`, r;
|
|
33
|
+
}
|
|
34
|
+
var Y = /* @__PURE__ */ Symbol("radix.slottable");
|
|
35
|
+
function ee(e) {
|
|
36
|
+
return a.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Y;
|
|
37
|
+
}
|
|
38
|
+
function oe(e, r) {
|
|
39
|
+
const t = { ...r };
|
|
40
|
+
for (const n in r) {
|
|
41
|
+
const o = e[n], s = r[n];
|
|
42
|
+
/^on[A-Z]/.test(n) ? o && s ? t[n] = (...i) => {
|
|
43
|
+
const p = s(...i);
|
|
44
|
+
return o(...i), p;
|
|
45
|
+
} : o && (t[n] = o) : n === "style" ? t[n] = { ...o, ...s } : n === "className" && (t[n] = [o, s].filter(Boolean).join(" "));
|
|
46
|
+
}
|
|
47
|
+
return { ...e, ...t };
|
|
48
|
+
}
|
|
49
|
+
function re(e) {
|
|
50
|
+
let r = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning;
|
|
51
|
+
return t ? e.ref : (r = Object.getOwnPropertyDescriptor(e, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
|
|
52
|
+
}
|
|
53
|
+
var m = "Popover", [S] = L(m, [
|
|
54
|
+
E
|
|
55
|
+
]), C = E(), [te, f] = S(m), w = (e) => {
|
|
56
|
+
const {
|
|
57
|
+
__scopePopover: r,
|
|
58
|
+
children: t,
|
|
59
|
+
open: n,
|
|
60
|
+
defaultOpen: o,
|
|
61
|
+
onOpenChange: s,
|
|
62
|
+
modal: c = !1
|
|
63
|
+
} = e, i = C(r), p = a.useRef(null), [u, P] = a.useState(!1), [d, v] = W({
|
|
64
|
+
prop: n,
|
|
65
|
+
defaultProp: o ?? !1,
|
|
66
|
+
onChange: s,
|
|
67
|
+
caller: m
|
|
68
|
+
});
|
|
69
|
+
return /* @__PURE__ */ l(z, { ...i, children: /* @__PURE__ */ l(
|
|
70
|
+
te,
|
|
71
|
+
{
|
|
72
|
+
scope: r,
|
|
73
|
+
contentId: U(),
|
|
74
|
+
triggerRef: p,
|
|
75
|
+
open: d,
|
|
76
|
+
onOpenChange: v,
|
|
77
|
+
onOpenToggle: a.useCallback(() => v((R) => !R), [v]),
|
|
78
|
+
hasCustomAnchor: u,
|
|
79
|
+
onCustomAnchorAdd: a.useCallback(() => P(!0), []),
|
|
80
|
+
onCustomAnchorRemove: a.useCallback(() => P(!1), []),
|
|
81
|
+
modal: c,
|
|
82
|
+
children: t
|
|
83
|
+
}
|
|
84
|
+
) });
|
|
85
|
+
};
|
|
86
|
+
w.displayName = m;
|
|
87
|
+
var b = "PopoverAnchor", ne = a.forwardRef(
|
|
88
|
+
(e, r) => {
|
|
89
|
+
const { __scopePopover: t, ...n } = e, o = f(b, t), s = C(t), { onCustomAnchorAdd: c, onCustomAnchorRemove: i } = o;
|
|
90
|
+
return a.useEffect(() => (c(), () => i()), [c, i]), /* @__PURE__ */ l(y, { ...s, ...n, ref: r });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
ne.displayName = b;
|
|
94
|
+
var N = "PopoverTrigger", F = a.forwardRef(
|
|
95
|
+
(e, r) => {
|
|
96
|
+
const { __scopePopover: t, ...n } = e, o = f(N, t), s = C(t), c = _(r, o.triggerRef), i = /* @__PURE__ */ l(
|
|
97
|
+
x.button,
|
|
98
|
+
{
|
|
99
|
+
type: "button",
|
|
100
|
+
"aria-haspopup": "dialog",
|
|
101
|
+
"aria-expanded": o.open,
|
|
102
|
+
"aria-controls": o.contentId,
|
|
103
|
+
"data-state": V(o.open),
|
|
104
|
+
...n,
|
|
105
|
+
ref: c,
|
|
106
|
+
onClick: h(e.onClick, o.onOpenToggle)
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
return o.hasCustomAnchor ? i : /* @__PURE__ */ l(y, { asChild: !0, ...s, children: i });
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
F.displayName = N;
|
|
113
|
+
var A = "PopoverPortal", [se, ae] = S(A, {
|
|
114
|
+
forceMount: void 0
|
|
115
|
+
}), D = (e) => {
|
|
116
|
+
const { __scopePopover: r, forceMount: t, children: n, container: o } = e, s = f(A, r);
|
|
117
|
+
return /* @__PURE__ */ l(se, { scope: r, forceMount: t, children: /* @__PURE__ */ l(O, { present: t || s.open, children: /* @__PURE__ */ l(j, { asChild: !0, container: o, children: n }) }) });
|
|
118
|
+
};
|
|
119
|
+
D.displayName = A;
|
|
120
|
+
var g = "PopoverContent", I = a.forwardRef(
|
|
121
|
+
(e, r) => {
|
|
122
|
+
const t = ae(g, e.__scopePopover), { forceMount: n = t.forceMount, ...o } = e, s = f(g, e.__scopePopover);
|
|
123
|
+
return /* @__PURE__ */ l(O, { present: n || s.open, children: s.modal ? /* @__PURE__ */ l(ie, { ...o, ref: r }) : /* @__PURE__ */ l(le, { ...o, ref: r }) });
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
I.displayName = g;
|
|
127
|
+
var ce = /* @__PURE__ */ Q("PopoverContent.RemoveScroll"), ie = a.forwardRef(
|
|
128
|
+
(e, r) => {
|
|
129
|
+
const t = f(g, e.__scopePopover), n = a.useRef(null), o = _(r, n), s = a.useRef(!1);
|
|
130
|
+
return a.useEffect(() => {
|
|
131
|
+
const c = n.current;
|
|
132
|
+
if (c) return G(c);
|
|
133
|
+
}, []), /* @__PURE__ */ l(B, { as: ce, allowPinchZoom: !0, children: /* @__PURE__ */ l(
|
|
134
|
+
T,
|
|
135
|
+
{
|
|
136
|
+
...e,
|
|
137
|
+
ref: o,
|
|
138
|
+
trapFocus: t.open,
|
|
139
|
+
disableOutsidePointerEvents: !0,
|
|
140
|
+
onCloseAutoFocus: h(e.onCloseAutoFocus, (c) => {
|
|
141
|
+
c.preventDefault(), s.current || t.triggerRef.current?.focus();
|
|
142
|
+
}),
|
|
143
|
+
onPointerDownOutside: h(
|
|
144
|
+
e.onPointerDownOutside,
|
|
145
|
+
(c) => {
|
|
146
|
+
const i = c.detail.originalEvent, p = i.button === 0 && i.ctrlKey === !0, u = i.button === 2 || p;
|
|
147
|
+
s.current = u;
|
|
148
|
+
},
|
|
149
|
+
{ checkForDefaultPrevented: !1 }
|
|
150
|
+
),
|
|
151
|
+
onFocusOutside: h(
|
|
152
|
+
e.onFocusOutside,
|
|
153
|
+
(c) => c.preventDefault(),
|
|
154
|
+
{ checkForDefaultPrevented: !1 }
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
) });
|
|
158
|
+
}
|
|
159
|
+
), le = a.forwardRef(
|
|
160
|
+
(e, r) => {
|
|
161
|
+
const t = f(g, e.__scopePopover), n = a.useRef(!1), o = a.useRef(!1);
|
|
162
|
+
return /* @__PURE__ */ l(
|
|
163
|
+
T,
|
|
164
|
+
{
|
|
165
|
+
...e,
|
|
166
|
+
ref: r,
|
|
167
|
+
trapFocus: !1,
|
|
168
|
+
disableOutsidePointerEvents: !1,
|
|
169
|
+
onCloseAutoFocus: (s) => {
|
|
170
|
+
e.onCloseAutoFocus?.(s), s.defaultPrevented || (n.current || t.triggerRef.current?.focus(), s.preventDefault()), n.current = !1, o.current = !1;
|
|
171
|
+
},
|
|
172
|
+
onInteractOutside: (s) => {
|
|
173
|
+
e.onInteractOutside?.(s), s.defaultPrevented || (n.current = !0, s.detail.originalEvent.type === "pointerdown" && (o.current = !0));
|
|
174
|
+
const c = s.target;
|
|
175
|
+
t.triggerRef.current?.contains(c) && s.preventDefault(), s.detail.originalEvent.type === "focusin" && o.current && s.preventDefault();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
), T = a.forwardRef(
|
|
181
|
+
(e, r) => {
|
|
182
|
+
const {
|
|
183
|
+
__scopePopover: t,
|
|
184
|
+
trapFocus: n,
|
|
185
|
+
onOpenAutoFocus: o,
|
|
186
|
+
onCloseAutoFocus: s,
|
|
187
|
+
disableOutsidePointerEvents: c,
|
|
188
|
+
onEscapeKeyDown: i,
|
|
189
|
+
onPointerDownOutside: p,
|
|
190
|
+
onFocusOutside: u,
|
|
191
|
+
onInteractOutside: P,
|
|
192
|
+
...d
|
|
193
|
+
} = e, v = f(g, t), R = C(t);
|
|
194
|
+
return K(), /* @__PURE__ */ l(
|
|
195
|
+
Z,
|
|
196
|
+
{
|
|
197
|
+
asChild: !0,
|
|
198
|
+
loop: !0,
|
|
199
|
+
trapped: n,
|
|
200
|
+
onMountAutoFocus: o,
|
|
201
|
+
onUnmountAutoFocus: s,
|
|
202
|
+
children: /* @__PURE__ */ l(
|
|
203
|
+
$,
|
|
204
|
+
{
|
|
205
|
+
asChild: !0,
|
|
206
|
+
disableOutsidePointerEvents: c,
|
|
207
|
+
onInteractOutside: P,
|
|
208
|
+
onEscapeKeyDown: i,
|
|
209
|
+
onPointerDownOutside: p,
|
|
210
|
+
onFocusOutside: u,
|
|
211
|
+
onDismiss: () => v.onOpenChange(!1),
|
|
212
|
+
children: /* @__PURE__ */ l(
|
|
213
|
+
q,
|
|
214
|
+
{
|
|
215
|
+
"data-state": V(v.open),
|
|
216
|
+
role: "dialog",
|
|
217
|
+
id: v.contentId,
|
|
218
|
+
...R,
|
|
219
|
+
...d,
|
|
220
|
+
ref: r,
|
|
221
|
+
style: {
|
|
222
|
+
...d.style,
|
|
223
|
+
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
224
|
+
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
225
|
+
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
226
|
+
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
227
|
+
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
), M = "PopoverClose", k = a.forwardRef(
|
|
237
|
+
(e, r) => {
|
|
238
|
+
const { __scopePopover: t, ...n } = e, o = f(M, t);
|
|
239
|
+
return /* @__PURE__ */ l(
|
|
240
|
+
x.button,
|
|
241
|
+
{
|
|
242
|
+
type: "button",
|
|
243
|
+
...n,
|
|
244
|
+
ref: r,
|
|
245
|
+
onClick: h(e.onClick, () => o.onOpenChange(!1))
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
k.displayName = M;
|
|
251
|
+
var pe = "PopoverArrow", ue = a.forwardRef(
|
|
252
|
+
(e, r) => {
|
|
253
|
+
const { __scopePopover: t, ...n } = e, o = C(t);
|
|
254
|
+
return /* @__PURE__ */ l(J, { ...o, ...n, ref: r });
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
ue.displayName = pe;
|
|
258
|
+
function V(e) {
|
|
259
|
+
return e ? "open" : "closed";
|
|
260
|
+
}
|
|
261
|
+
var Re = w, Ae = F, Oe = D, _e = I, Ee = k;
|
|
262
|
+
export {
|
|
263
|
+
_e as C,
|
|
264
|
+
Oe as P,
|
|
265
|
+
Re as R,
|
|
266
|
+
Ae as T,
|
|
267
|
+
Ee as a
|
|
268
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
3
|
+
import { u as E } from "./index-DLcqcWxM.js";
|
|
4
|
+
function I(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
5
|
+
return function(r) {
|
|
6
|
+
if (e?.(r), t === !1 || !r.defaultPrevented)
|
|
7
|
+
return n?.(r);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function U(e, n) {
|
|
11
|
+
const t = o.createContext(n), s = (c) => {
|
|
12
|
+
const { children: i, ...u } = c, a = o.useMemo(() => u, Object.values(u));
|
|
13
|
+
return /* @__PURE__ */ S(t.Provider, { value: a, children: i });
|
|
14
|
+
};
|
|
15
|
+
s.displayName = e + "Provider";
|
|
16
|
+
function r(c) {
|
|
17
|
+
const i = o.useContext(t);
|
|
18
|
+
if (i) return i;
|
|
19
|
+
if (n !== void 0) return n;
|
|
20
|
+
throw new Error(`\`${c}\` must be used within \`${e}\``);
|
|
21
|
+
}
|
|
22
|
+
return [s, r];
|
|
23
|
+
}
|
|
24
|
+
function _(e, n = []) {
|
|
25
|
+
let t = [];
|
|
26
|
+
function s(c, i) {
|
|
27
|
+
const u = o.createContext(i), a = t.length;
|
|
28
|
+
t = [...t, i];
|
|
29
|
+
const f = (l) => {
|
|
30
|
+
const { scope: p, children: m, ...v } = l, C = p?.[e]?.[a] || u, g = o.useMemo(() => v, Object.values(v));
|
|
31
|
+
return /* @__PURE__ */ S(C.Provider, { value: g, children: m });
|
|
32
|
+
};
|
|
33
|
+
f.displayName = c + "Provider";
|
|
34
|
+
function d(l, p) {
|
|
35
|
+
const m = p?.[e]?.[a] || u, v = o.useContext(m);
|
|
36
|
+
if (v) return v;
|
|
37
|
+
if (i !== void 0) return i;
|
|
38
|
+
throw new Error(`\`${l}\` must be used within \`${c}\``);
|
|
39
|
+
}
|
|
40
|
+
return [f, d];
|
|
41
|
+
}
|
|
42
|
+
const r = () => {
|
|
43
|
+
const c = t.map((i) => o.createContext(i));
|
|
44
|
+
return function(u) {
|
|
45
|
+
const a = u?.[e] || c;
|
|
46
|
+
return o.useMemo(
|
|
47
|
+
() => ({ [`__scope${e}`]: { ...u, [e]: a } }),
|
|
48
|
+
[u, a]
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
return r.scopeName = e, [s, M(r, ...n)];
|
|
53
|
+
}
|
|
54
|
+
function M(...e) {
|
|
55
|
+
const n = e[0];
|
|
56
|
+
if (e.length === 1) return n;
|
|
57
|
+
const t = () => {
|
|
58
|
+
const s = e.map((r) => ({
|
|
59
|
+
useScope: r(),
|
|
60
|
+
scopeName: r.scopeName
|
|
61
|
+
}));
|
|
62
|
+
return function(c) {
|
|
63
|
+
const i = s.reduce((u, { useScope: a, scopeName: f }) => {
|
|
64
|
+
const l = a(c)[`__scope${f}`];
|
|
65
|
+
return { ...u, ...l };
|
|
66
|
+
}, {});
|
|
67
|
+
return o.useMemo(() => ({ [`__scope${n.scopeName}`]: i }), [i]);
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
return t.scopeName = n.scopeName, t;
|
|
71
|
+
}
|
|
72
|
+
var h = globalThis?.document ? o.useLayoutEffect : () => {
|
|
73
|
+
}, P = o[" useInsertionEffect ".trim().toString()] || h;
|
|
74
|
+
function $({
|
|
75
|
+
prop: e,
|
|
76
|
+
defaultProp: n,
|
|
77
|
+
onChange: t = () => {
|
|
78
|
+
},
|
|
79
|
+
caller: s
|
|
80
|
+
}) {
|
|
81
|
+
const [r, c, i] = R({
|
|
82
|
+
defaultProp: n,
|
|
83
|
+
onChange: t
|
|
84
|
+
}), u = e !== void 0, a = u ? e : r;
|
|
85
|
+
{
|
|
86
|
+
const d = o.useRef(e !== void 0);
|
|
87
|
+
o.useEffect(() => {
|
|
88
|
+
const l = d.current;
|
|
89
|
+
l !== u && console.warn(
|
|
90
|
+
`${s} is changing from ${l ? "controlled" : "uncontrolled"} to ${u ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
91
|
+
), d.current = u;
|
|
92
|
+
}, [u, s]);
|
|
93
|
+
}
|
|
94
|
+
const f = o.useCallback(
|
|
95
|
+
(d) => {
|
|
96
|
+
if (u) {
|
|
97
|
+
const l = A(d) ? d(e) : d;
|
|
98
|
+
l !== e && i.current?.(l);
|
|
99
|
+
} else
|
|
100
|
+
c(d);
|
|
101
|
+
},
|
|
102
|
+
[u, e, c, i]
|
|
103
|
+
);
|
|
104
|
+
return [a, f];
|
|
105
|
+
}
|
|
106
|
+
function R({
|
|
107
|
+
defaultProp: e,
|
|
108
|
+
onChange: n
|
|
109
|
+
}) {
|
|
110
|
+
const [t, s] = o.useState(e), r = o.useRef(t), c = o.useRef(n);
|
|
111
|
+
return P(() => {
|
|
112
|
+
c.current = n;
|
|
113
|
+
}, [n]), o.useEffect(() => {
|
|
114
|
+
r.current !== t && (c.current?.(t), r.current = t);
|
|
115
|
+
}, [t, r]), [t, s, c];
|
|
116
|
+
}
|
|
117
|
+
function A(e) {
|
|
118
|
+
return typeof e == "function";
|
|
119
|
+
}
|
|
120
|
+
function L(e) {
|
|
121
|
+
const n = o.useRef(e);
|
|
122
|
+
return o.useEffect(() => {
|
|
123
|
+
n.current = e;
|
|
124
|
+
}), o.useMemo(() => (...t) => n.current?.(...t), []);
|
|
125
|
+
}
|
|
126
|
+
function w(e, n) {
|
|
127
|
+
return o.useReducer((t, s) => n[t][s] ?? t, e);
|
|
128
|
+
}
|
|
129
|
+
var x = (e) => {
|
|
130
|
+
const { present: n, children: t } = e, s = y(n), r = typeof t == "function" ? t({ present: s.isPresent }) : o.Children.only(t), c = E(s.ref, O(r));
|
|
131
|
+
return typeof t == "function" || s.isPresent ? o.cloneElement(r, { ref: c }) : null;
|
|
132
|
+
};
|
|
133
|
+
x.displayName = "Presence";
|
|
134
|
+
function y(e) {
|
|
135
|
+
const [n, t] = o.useState(), s = o.useRef(null), r = o.useRef(e), c = o.useRef("none"), i = e ? "mounted" : "unmounted", [u, a] = w(i, {
|
|
136
|
+
mounted: {
|
|
137
|
+
UNMOUNT: "unmounted",
|
|
138
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
139
|
+
},
|
|
140
|
+
unmountSuspended: {
|
|
141
|
+
MOUNT: "mounted",
|
|
142
|
+
ANIMATION_END: "unmounted"
|
|
143
|
+
},
|
|
144
|
+
unmounted: {
|
|
145
|
+
MOUNT: "mounted"
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return o.useEffect(() => {
|
|
149
|
+
const f = N(s.current);
|
|
150
|
+
c.current = u === "mounted" ? f : "none";
|
|
151
|
+
}, [u]), h(() => {
|
|
152
|
+
const f = s.current, d = r.current;
|
|
153
|
+
if (d !== e) {
|
|
154
|
+
const p = c.current, m = N(f);
|
|
155
|
+
e ? a("MOUNT") : m === "none" || f?.display === "none" ? a("UNMOUNT") : a(d && p !== m ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
|
|
156
|
+
}
|
|
157
|
+
}, [e, a]), h(() => {
|
|
158
|
+
if (n) {
|
|
159
|
+
let f;
|
|
160
|
+
const d = n.ownerDocument.defaultView ?? window, l = (m) => {
|
|
161
|
+
const C = N(s.current).includes(CSS.escape(m.animationName));
|
|
162
|
+
if (m.target === n && C && (a("ANIMATION_END"), !r.current)) {
|
|
163
|
+
const g = n.style.animationFillMode;
|
|
164
|
+
n.style.animationFillMode = "forwards", f = d.setTimeout(() => {
|
|
165
|
+
n.style.animationFillMode === "forwards" && (n.style.animationFillMode = g);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}, p = (m) => {
|
|
169
|
+
m.target === n && (c.current = N(s.current));
|
|
170
|
+
};
|
|
171
|
+
return n.addEventListener("animationstart", p), n.addEventListener("animationcancel", l), n.addEventListener("animationend", l), () => {
|
|
172
|
+
d.clearTimeout(f), n.removeEventListener("animationstart", p), n.removeEventListener("animationcancel", l), n.removeEventListener("animationend", l);
|
|
173
|
+
};
|
|
174
|
+
} else
|
|
175
|
+
a("ANIMATION_END");
|
|
176
|
+
}, [n, a]), {
|
|
177
|
+
isPresent: ["mounted", "unmountSuspended"].includes(u),
|
|
178
|
+
ref: o.useCallback((f) => {
|
|
179
|
+
s.current = f ? getComputedStyle(f) : null, t(f);
|
|
180
|
+
}, [])
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function N(e) {
|
|
184
|
+
return e?.animationName || "none";
|
|
185
|
+
}
|
|
186
|
+
function O(e) {
|
|
187
|
+
let n = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, t = n && "isReactWarning" in n && n.isReactWarning;
|
|
188
|
+
return t ? e.ref : (n = Object.getOwnPropertyDescriptor(e, "ref")?.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
x as P,
|
|
192
|
+
_ as a,
|
|
193
|
+
h as b,
|
|
194
|
+
I as c,
|
|
195
|
+
L as d,
|
|
196
|
+
U as e,
|
|
197
|
+
$ as u
|
|
198
|
+
};
|