@spear-ai/spectral 1.3.62 → 1.3.63
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/.js +181 -152
- package/dist/Accordion.d.ts +37 -0
- package/dist/Accordion.js +465 -0
- package/dist/Alert/AlertBase.js +2 -2
- package/dist/Alert.js +4 -3
- package/dist/Avatar.js +1 -1
- package/dist/Badge.d.ts +12 -2
- package/dist/Badge.js +28 -4
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +13 -0
- package/dist/ButtonGroup/ButtonGroupButton.js +51 -0
- package/dist/ButtonGroup.d.ts +29 -0
- package/dist/ButtonGroup.js +89 -0
- package/dist/ButtonIcon.js +2 -1
- package/dist/Checkbox/CheckboxBase.js +1 -1
- package/dist/Checkbox.js +11 -12
- package/dist/Dialog/DialogBase.d.ts +1 -1
- package/dist/Dialog/DialogBase.js +2 -2
- package/dist/Dialog.js +4 -4
- package/dist/Drawer.js +24 -1283
- package/dist/HoverCard.d.ts +29 -0
- package/dist/HoverCard.js +207 -0
- package/dist/Icons/MessagesIcon.d.ts +3 -0
- package/dist/Icons/MessagesIcon.js +31 -0
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +50 -48
- package/dist/Input.d.ts +2 -0
- package/dist/Input.js +98 -89
- package/dist/InputGroup.d.ts +16 -0
- package/dist/InputGroup.js +129 -0
- package/dist/InputOTP.d.ts +0 -2
- package/dist/InputOTP.js +138 -142
- package/dist/Label.d.ts +3 -7
- package/dist/Label.js +11 -11
- package/dist/MultiSelect/MultiSelectBase.js +22 -22
- package/dist/Popover.d.ts +6 -7
- package/dist/Popover.js +60 -71
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +141 -134
- package/dist/Select.js +97 -895
- package/dist/Separator.d.ts +12 -0
- package/dist/Separator.js +24 -0
- package/dist/Skeleton.js +3 -3
- package/dist/Slider.d.ts +15 -3
- package/dist/Slider.js +464 -40
- package/dist/Switch/SwitchBase.js +1 -1
- package/dist/Switch.js +2 -2
- package/dist/Tabs/TabsBase.js +1 -1
- package/dist/Tabs.js +16 -16
- package/dist/Textarea.js +41 -42
- package/dist/Toggle.js +2 -2
- package/dist/ToggleGroup.js +1 -1
- package/dist/Tooltip/TooltipBase.js +29 -29
- package/dist/Tooltip.js +15 -15
- package/dist/Tray/TrayStoriesData.d.ts +39 -0
- package/dist/Tray/TrayStoriesData.js +438 -0
- package/dist/Tray.d.ts +28 -0
- package/dist/Tray.js +227 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/Accordion/Accordion.d.ts +37 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Badge/Badge.d.ts +12 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +29 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -0
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +13 -0
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Dialog/DialogBase.d.ts +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +29 -0
- package/dist/components/HoverCard/HoverCard.d.ts.map +1 -0
- package/dist/components/Icons/MessagesIcon.d.ts +3 -0
- package/dist/components/Icons/MessagesIcon.d.ts.map +1 -0
- package/dist/components/Icons/index.d.ts +1 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts +16 -0
- package/dist/components/InputGroup/InputGroup.d.ts.map +1 -0
- package/dist/components/InputOTP/InputOTP.d.ts +0 -2
- package/dist/components/InputOTP/InputOTP.d.ts.map +1 -1
- package/dist/components/Label/Label.d.ts +3 -7
- package/dist/components/Label/Label.d.ts.map +1 -1
- package/dist/components/Popover/Popover.d.ts +6 -7
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/components/Separator/Separator.d.ts +12 -0
- package/dist/components/Separator/Separator.d.ts.map +1 -0
- package/dist/components/Slider/Slider.d.ts +15 -3
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Tray/Tray.d.ts +28 -0
- package/dist/components/Tray/Tray.d.ts.map +1 -0
- package/dist/components/Tray/TrayStoriesData.d.ts +39 -0
- package/dist/components/Tray/TrayStoriesData.d.ts.map +1 -0
- package/dist/features/AuthCard/ForgotPasswordEmailForm.js +4 -3
- package/dist/features/AuthCard/ForgotPasswordResetForm.js +9 -9
- package/dist/features/AuthCard/PasswordInput.js +78 -9
- package/dist/features/AuthCard/SignInForm.js +8 -7
- package/dist/features/AuthCard/SignUpForm.js +8 -7
- package/dist/features/AuthCard.js +2 -2
- package/dist/features/LabelingTools.js +7 -6
- package/dist/features/SensorMetadata.js +3 -2
- package/dist/features/SettingsPopover.js +3 -2
- package/dist/index-0ioNhtNM.js +10 -0
- package/dist/{index-CBwRmAsQ.js → index-6Abv_Flm.js} +1 -1
- package/dist/{index-DUK1rxhf.js → index-B-GQStVW.js} +6 -5
- package/dist/index-B2oBi8ng.js +142 -0
- package/dist/index-BIpuW_o8.js +146 -0
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/index-BhufZRa2.js +232 -0
- package/dist/index-CAKA12cC.js +1265 -0
- package/dist/{index-Cfyte2YO.js → index-CGALWSq_.js} +1 -1
- package/dist/index-CVSxKOPp.js +13 -0
- package/dist/index-CevVJ05e.js +822 -0
- package/dist/{index-CRBC94ik.js → index-D29mdTf5.js} +1 -1
- package/dist/{index-FeGk8zep.js → index-NzygPVvJ.js} +10 -9
- package/dist/index-UEFPWH8U.js +54 -0
- package/dist/index-rKs9bXHr.js +6 -0
- package/dist/{index-Cb7rjMhE.js → index-y6Br5T4h.js} +6 -6
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/linear-cursor-small.png +0 -0
- package/dist/message-alert-matte-glass-gradient.webp +0 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +42 -0
- package/dist/primitives/input.d.ts +3 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +18 -0
- package/dist/primitives/select.d.ts +16 -0
- package/dist/primitives/select.d.ts.map +1 -0
- package/dist/primitives/select.js +196 -0
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +21 -20
- package/dist/primitives/textarea.d.ts +3 -0
- package/dist/primitives/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea.js +16 -0
- package/dist/{proxy-DD79Ok6n.js → proxy-C9AqCss6.js} +1 -1
- package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
- package/dist/styles/main.css +1 -1
- package/dist/utils/formFieldUtils.js +1 -1
- package/dist/utils/twUtils.js +2728 -2
- package/package.json +13 -8
- package/dist/Accordion/AccordionBase.d.ts +0 -42
- package/dist/Accordion/AccordionBase.js +0 -225
- package/dist/Badge/BadgeBase.d.ts +0 -13
- package/dist/Badge/BadgeBase.js +0 -35
- package/dist/PasswordInput-ClY_hxuN.js +0 -261
- package/dist/components/Accordion/AccordionBase.d.ts +0 -42
- package/dist/components/Accordion/AccordionBase.d.ts.map +0 -1
- package/dist/components/Badge/BadgeBase.d.ts +0 -13
- package/dist/components/Badge/BadgeBase.d.ts.map +0 -1
- package/dist/index-CA7haECj.js +0 -248
- package/dist/index-CbXx14YO.js +0 -59
- package/dist/index-VXXKXen4.js +0 -15
- package/dist/index-cCg4yNa8.js +0 -132
- package/dist/primitives/label.d.ts +0 -5
- package/dist/primitives/label.d.ts.map +0 -1
- package/dist/primitives/label.js +0 -27
- package/dist/twUtils-CRiPKpXj.js +0 -2743
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { a as T, P as m, b as h, h as k, d as M } from "./index-BhufZRa2.js";
|
|
4
|
+
import { u as b } from "./index-0ioNhtNM.js";
|
|
5
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
6
|
+
import U from "react-dom";
|
|
7
|
+
function z(n, e = globalThis?.document) {
|
|
8
|
+
const t = b(n);
|
|
9
|
+
r.useEffect(() => {
|
|
10
|
+
const i = (s) => {
|
|
11
|
+
s.key === "Escape" && t(s);
|
|
12
|
+
};
|
|
13
|
+
return e.addEventListener("keydown", i, { capture: !0 }), () => e.removeEventListener("keydown", i, { capture: !0 });
|
|
14
|
+
}, [t, e]);
|
|
15
|
+
}
|
|
16
|
+
var H = "DismissableLayer", p = "dismissableLayer.update", K = "dismissableLayer.pointerDownOutside", j = "dismissableLayer.focusOutside", R, B = r.createContext({
|
|
17
|
+
layers: /* @__PURE__ */ new Set(),
|
|
18
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
19
|
+
branches: /* @__PURE__ */ new Set()
|
|
20
|
+
}), X = r.forwardRef(
|
|
21
|
+
(n, e) => {
|
|
22
|
+
const {
|
|
23
|
+
disableOutsidePointerEvents: t = !1,
|
|
24
|
+
onEscapeKeyDown: i,
|
|
25
|
+
onPointerDownOutside: s,
|
|
26
|
+
onFocusOutside: a,
|
|
27
|
+
onInteractOutside: d,
|
|
28
|
+
onDismiss: l,
|
|
29
|
+
...E
|
|
30
|
+
} = n, c = r.useContext(B), [u, F] = r.useState(null), f = u?.ownerDocument ?? globalThis?.document, [, I] = r.useState({}), S = T(e, (o) => F(o)), D = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = D.indexOf(A), O = u ? D.indexOf(u) : -1, W = c.layersWithOutsidePointerEventsDisabled.size > 0, L = O >= N, _ = G((o) => {
|
|
31
|
+
const v = o.target, w = [...c.branches].some((y) => y.contains(v));
|
|
32
|
+
!L || w || (s?.(o), d?.(o), o.defaultPrevented || l?.());
|
|
33
|
+
}, f), C = J((o) => {
|
|
34
|
+
const v = o.target;
|
|
35
|
+
[...c.branches].some((y) => y.contains(v)) || (a?.(o), d?.(o), o.defaultPrevented || l?.());
|
|
36
|
+
}, f);
|
|
37
|
+
return z((o) => {
|
|
38
|
+
O === c.layers.size - 1 && (i?.(o), !o.defaultPrevented && l && (o.preventDefault(), l()));
|
|
39
|
+
}, f), r.useEffect(() => {
|
|
40
|
+
if (u)
|
|
41
|
+
return t && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (R = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), g(), () => {
|
|
42
|
+
t && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = R);
|
|
43
|
+
};
|
|
44
|
+
}, [u, f, t, c]), r.useEffect(() => () => {
|
|
45
|
+
u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), g());
|
|
46
|
+
}, [u, c]), r.useEffect(() => {
|
|
47
|
+
const o = () => I({});
|
|
48
|
+
return document.addEventListener(p, o), () => document.removeEventListener(p, o);
|
|
49
|
+
}, []), /* @__PURE__ */ P(
|
|
50
|
+
m.div,
|
|
51
|
+
{
|
|
52
|
+
...E,
|
|
53
|
+
ref: S,
|
|
54
|
+
style: {
|
|
55
|
+
pointerEvents: W ? L ? "auto" : "none" : void 0,
|
|
56
|
+
...n.style
|
|
57
|
+
},
|
|
58
|
+
onFocusCapture: h(n.onFocusCapture, C.onFocusCapture),
|
|
59
|
+
onBlurCapture: h(n.onBlurCapture, C.onBlurCapture),
|
|
60
|
+
onPointerDownCapture: h(
|
|
61
|
+
n.onPointerDownCapture,
|
|
62
|
+
_.onPointerDownCapture
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
X.displayName = H;
|
|
69
|
+
var Y = "DismissableLayerBranch", q = r.forwardRef((n, e) => {
|
|
70
|
+
const t = r.useContext(B), i = r.useRef(null), s = T(e, i);
|
|
71
|
+
return r.useEffect(() => {
|
|
72
|
+
const a = i.current;
|
|
73
|
+
if (a)
|
|
74
|
+
return t.branches.add(a), () => {
|
|
75
|
+
t.branches.delete(a);
|
|
76
|
+
};
|
|
77
|
+
}, [t.branches]), /* @__PURE__ */ P(m.div, { ...n, ref: s });
|
|
78
|
+
});
|
|
79
|
+
q.displayName = Y;
|
|
80
|
+
function G(n, e = globalThis?.document) {
|
|
81
|
+
const t = b(n), i = r.useRef(!1), s = r.useRef(() => {
|
|
82
|
+
});
|
|
83
|
+
return r.useEffect(() => {
|
|
84
|
+
const a = (l) => {
|
|
85
|
+
if (l.target && !i.current) {
|
|
86
|
+
let E = function() {
|
|
87
|
+
x(
|
|
88
|
+
K,
|
|
89
|
+
t,
|
|
90
|
+
c,
|
|
91
|
+
{ discrete: !0 }
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
const c = { originalEvent: l };
|
|
95
|
+
l.pointerType === "touch" ? (e.removeEventListener("click", s.current), s.current = E, e.addEventListener("click", s.current, { once: !0 })) : E();
|
|
96
|
+
} else
|
|
97
|
+
e.removeEventListener("click", s.current);
|
|
98
|
+
i.current = !1;
|
|
99
|
+
}, d = window.setTimeout(() => {
|
|
100
|
+
e.addEventListener("pointerdown", a);
|
|
101
|
+
}, 0);
|
|
102
|
+
return () => {
|
|
103
|
+
window.clearTimeout(d), e.removeEventListener("pointerdown", a), e.removeEventListener("click", s.current);
|
|
104
|
+
};
|
|
105
|
+
}, [e, t]), {
|
|
106
|
+
// ensures we check React component tree (not just DOM tree)
|
|
107
|
+
onPointerDownCapture: () => i.current = !0
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function J(n, e = globalThis?.document) {
|
|
111
|
+
const t = b(n), i = r.useRef(!1);
|
|
112
|
+
return r.useEffect(() => {
|
|
113
|
+
const s = (a) => {
|
|
114
|
+
a.target && !i.current && x(j, t, { originalEvent: a }, {
|
|
115
|
+
discrete: !1
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
return e.addEventListener("focusin", s), () => e.removeEventListener("focusin", s);
|
|
119
|
+
}, [e, t]), {
|
|
120
|
+
onFocusCapture: () => i.current = !0,
|
|
121
|
+
onBlurCapture: () => i.current = !1
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function g() {
|
|
125
|
+
const n = new CustomEvent(p);
|
|
126
|
+
document.dispatchEvent(n);
|
|
127
|
+
}
|
|
128
|
+
function x(n, e, t, { discrete: i }) {
|
|
129
|
+
const s = t.originalEvent.target, a = new CustomEvent(n, { bubbles: !1, cancelable: !0, detail: t });
|
|
130
|
+
e && s.addEventListener(n, e, { once: !0 }), i ? k(s, a) : s.dispatchEvent(a);
|
|
131
|
+
}
|
|
132
|
+
var Q = "Portal", V = r.forwardRef((n, e) => {
|
|
133
|
+
const { container: t, ...i } = n, [s, a] = r.useState(!1);
|
|
134
|
+
M(() => a(!0), []);
|
|
135
|
+
const d = t || s && globalThis?.document?.body;
|
|
136
|
+
return d ? U.createPortal(/* @__PURE__ */ P(m.div, { ...i, ref: e }), d) : null;
|
|
137
|
+
});
|
|
138
|
+
V.displayName = Q;
|
|
139
|
+
export {
|
|
140
|
+
X as D,
|
|
141
|
+
V as P
|
|
142
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import { jsx as w, Fragment as N } from "react/jsx-runtime";
|
|
3
|
+
import * as v from "react";
|
|
4
|
+
import { useId as T, useRef as P, useContext as D, useInsertionEffect as S, useMemo as $, Children as U, isValidElement as V, useState as z } from "react";
|
|
5
|
+
import { M as X, i as _, u as W, P as B, a as F, b as G, L as O } from "./proxy-C9AqCss6.js";
|
|
6
|
+
function A(e, s) {
|
|
7
|
+
if (typeof e == "function")
|
|
8
|
+
return e(s);
|
|
9
|
+
e != null && (e.current = s);
|
|
10
|
+
}
|
|
11
|
+
function Y(...e) {
|
|
12
|
+
return (s) => {
|
|
13
|
+
let t = !1;
|
|
14
|
+
const o = e.map((r) => {
|
|
15
|
+
const n = A(r, s);
|
|
16
|
+
return !t && typeof n == "function" && (t = !0), n;
|
|
17
|
+
});
|
|
18
|
+
if (t)
|
|
19
|
+
return () => {
|
|
20
|
+
for (let r = 0; r < o.length; r++) {
|
|
21
|
+
const n = o[r];
|
|
22
|
+
typeof n == "function" ? n() : A(e[r], null);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function q(...e) {
|
|
28
|
+
return v.useCallback(Y(...e), e);
|
|
29
|
+
}
|
|
30
|
+
class J extends v.Component {
|
|
31
|
+
getSnapshotBeforeUpdate(s) {
|
|
32
|
+
const t = this.props.childRef.current;
|
|
33
|
+
if (t && s.isPresent && !this.props.isPresent) {
|
|
34
|
+
const o = t.offsetParent, r = _(o) && o.offsetWidth || 0, n = this.props.sizeRef.current;
|
|
35
|
+
n.height = t.offsetHeight || 0, n.width = t.offsetWidth || 0, n.top = t.offsetTop, n.left = t.offsetLeft, n.right = r - n.width - n.left;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Required with getSnapshotBeforeUpdate to stop React complaining.
|
|
41
|
+
*/
|
|
42
|
+
componentDidUpdate() {
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return this.props.children;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function Q({ children: e, isPresent: s, anchorX: t, root: o }) {
|
|
49
|
+
const r = T(), n = P(null), p = P({
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0,
|
|
52
|
+
top: 0,
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0
|
|
55
|
+
}), { nonce: C } = D(X), x = q(n, e?.ref);
|
|
56
|
+
return S(() => {
|
|
57
|
+
const { width: i, height: g, top: c, left: u, right: a } = p.current;
|
|
58
|
+
if (s || !n.current || !i || !g)
|
|
59
|
+
return;
|
|
60
|
+
const h = t === "left" ? `left: ${u}` : `right: ${a}`;
|
|
61
|
+
n.current.dataset.motionPopId = r;
|
|
62
|
+
const l = document.createElement("style");
|
|
63
|
+
C && (l.nonce = C);
|
|
64
|
+
const R = o ?? document.head;
|
|
65
|
+
return R.appendChild(l), l.sheet && l.sheet.insertRule(`
|
|
66
|
+
[data-motion-pop-id="${r}"] {
|
|
67
|
+
position: absolute !important;
|
|
68
|
+
width: ${i}px !important;
|
|
69
|
+
height: ${g}px !important;
|
|
70
|
+
${h}px !important;
|
|
71
|
+
top: ${c}px !important;
|
|
72
|
+
}
|
|
73
|
+
`), () => {
|
|
74
|
+
R.contains(l) && R.removeChild(l);
|
|
75
|
+
};
|
|
76
|
+
}, [s]), w(J, { isPresent: s, childRef: n, sizeRef: p, children: v.cloneElement(e, { ref: x }) });
|
|
77
|
+
}
|
|
78
|
+
const Z = ({ children: e, initial: s, isPresent: t, onExitComplete: o, custom: r, presenceAffectsLayout: n, mode: p, anchorX: C, root: x }) => {
|
|
79
|
+
const i = W(ee), g = T();
|
|
80
|
+
let c = !0, u = $(() => (c = !1, {
|
|
81
|
+
id: g,
|
|
82
|
+
initial: s,
|
|
83
|
+
isPresent: t,
|
|
84
|
+
custom: r,
|
|
85
|
+
onExitComplete: (a) => {
|
|
86
|
+
i.set(a, !0);
|
|
87
|
+
for (const h of i.values())
|
|
88
|
+
if (!h)
|
|
89
|
+
return;
|
|
90
|
+
o && o();
|
|
91
|
+
},
|
|
92
|
+
register: (a) => (i.set(a, !1), () => i.delete(a))
|
|
93
|
+
}), [t, i, o]);
|
|
94
|
+
return n && c && (u = { ...u }), $(() => {
|
|
95
|
+
i.forEach((a, h) => i.set(h, !1));
|
|
96
|
+
}, [t]), v.useEffect(() => {
|
|
97
|
+
!t && !i.size && o && o();
|
|
98
|
+
}, [t]), p === "popLayout" && (e = w(Q, { isPresent: t, anchorX: C, root: x, children: e })), w(B.Provider, { value: u, children: e });
|
|
99
|
+
};
|
|
100
|
+
function ee() {
|
|
101
|
+
return /* @__PURE__ */ new Map();
|
|
102
|
+
}
|
|
103
|
+
const E = (e) => e.key || "";
|
|
104
|
+
function I(e) {
|
|
105
|
+
const s = [];
|
|
106
|
+
return U.forEach(e, (t) => {
|
|
107
|
+
V(t) && s.push(t);
|
|
108
|
+
}), s;
|
|
109
|
+
}
|
|
110
|
+
const oe = ({ children: e, custom: s, initial: t = !0, onExitComplete: o, presenceAffectsLayout: r = !0, mode: n = "sync", propagate: p = !1, anchorX: C = "left", root: x }) => {
|
|
111
|
+
const [i, g] = F(p), c = $(() => I(e), [e]), u = p && !i ? [] : c.map(E), a = P(!0), h = P(c), l = W(() => /* @__PURE__ */ new Map()), [R, j] = z(c), [m, b] = z(c);
|
|
112
|
+
G(() => {
|
|
113
|
+
a.current = !1, h.current = c;
|
|
114
|
+
for (let d = 0; d < m.length; d++) {
|
|
115
|
+
const f = E(m[d]);
|
|
116
|
+
u.includes(f) ? l.delete(f) : l.get(f) !== !0 && l.set(f, !1);
|
|
117
|
+
}
|
|
118
|
+
}, [m, u.length, u.join("-")]);
|
|
119
|
+
const M = [];
|
|
120
|
+
if (c !== R) {
|
|
121
|
+
let d = [...c];
|
|
122
|
+
for (let f = 0; f < m.length; f++) {
|
|
123
|
+
const y = m[f], L = E(y);
|
|
124
|
+
u.includes(L) || (d.splice(f, 0, y), M.push(y));
|
|
125
|
+
}
|
|
126
|
+
return n === "wait" && M.length && (d = M), b(I(d)), j(c), null;
|
|
127
|
+
}
|
|
128
|
+
process.env.NODE_ENV !== "production" && n === "wait" && m.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
129
|
+
const { forceRender: H } = D(O);
|
|
130
|
+
return w(N, { children: m.map((d) => {
|
|
131
|
+
const f = E(d), y = p && !i ? !1 : c === m || u.includes(f), L = () => {
|
|
132
|
+
if (l.has(f))
|
|
133
|
+
l.set(f, !0);
|
|
134
|
+
else
|
|
135
|
+
return;
|
|
136
|
+
let k = !0;
|
|
137
|
+
l.forEach((K) => {
|
|
138
|
+
K || (k = !1);
|
|
139
|
+
}), k && (H?.(), b(h.current), p && g?.(), o && o());
|
|
140
|
+
};
|
|
141
|
+
return w(Z, { isPresent: y, initial: !a.current || t ? void 0 : !1, custom: s, presenceAffectsLayout: r, mode: n, root: x, onExitComplete: y ? void 0 : L, anchorX: C, children: d }, f);
|
|
142
|
+
}) });
|
|
143
|
+
};
|
|
144
|
+
export {
|
|
145
|
+
oe as A
|
|
146
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { jsx as p, Fragment as x } from "react/jsx-runtime";
|
|
4
|
+
import * as g from "react-dom";
|
|
5
|
+
function W(e, t) {
|
|
6
|
+
const n = s.createContext(t), c = (r) => {
|
|
7
|
+
const { children: u, ...i } = r, l = s.useMemo(() => i, Object.values(i));
|
|
8
|
+
return /* @__PURE__ */ p(n.Provider, { value: l, children: u });
|
|
9
|
+
};
|
|
10
|
+
c.displayName = e + "Provider";
|
|
11
|
+
function o(r) {
|
|
12
|
+
const u = s.useContext(n);
|
|
13
|
+
if (u) return u;
|
|
14
|
+
if (t !== void 0) return t;
|
|
15
|
+
throw new Error(`\`${r}\` must be used within \`${e}\``);
|
|
16
|
+
}
|
|
17
|
+
return [c, o];
|
|
18
|
+
}
|
|
19
|
+
function A(e, t = []) {
|
|
20
|
+
let n = [];
|
|
21
|
+
function c(r, u) {
|
|
22
|
+
const i = s.createContext(u), l = n.length;
|
|
23
|
+
n = [...n, u];
|
|
24
|
+
const f = (a) => {
|
|
25
|
+
const { scope: v, children: C, ...m } = a, E = v?.[e]?.[l] || i, b = s.useMemo(() => m, Object.values(m));
|
|
26
|
+
return /* @__PURE__ */ p(E.Provider, { value: b, children: C });
|
|
27
|
+
};
|
|
28
|
+
f.displayName = r + "Provider";
|
|
29
|
+
function d(a, v) {
|
|
30
|
+
const C = v?.[e]?.[l] || i, m = s.useContext(C);
|
|
31
|
+
if (m) return m;
|
|
32
|
+
if (u !== void 0) return u;
|
|
33
|
+
throw new Error(`\`${a}\` must be used within \`${r}\``);
|
|
34
|
+
}
|
|
35
|
+
return [f, d];
|
|
36
|
+
}
|
|
37
|
+
const o = () => {
|
|
38
|
+
const r = n.map((u) => s.createContext(u));
|
|
39
|
+
return function(i) {
|
|
40
|
+
const l = i?.[e] || r;
|
|
41
|
+
return s.useMemo(
|
|
42
|
+
() => ({ [`__scope${e}`]: { ...i, [e]: l } }),
|
|
43
|
+
[i, l]
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
return o.scopeName = e, [c, P(o, ...t)];
|
|
48
|
+
}
|
|
49
|
+
function P(...e) {
|
|
50
|
+
const t = e[0];
|
|
51
|
+
if (e.length === 1) return t;
|
|
52
|
+
const n = () => {
|
|
53
|
+
const c = e.map((o) => ({
|
|
54
|
+
useScope: o(),
|
|
55
|
+
scopeName: o.scopeName
|
|
56
|
+
}));
|
|
57
|
+
return function(r) {
|
|
58
|
+
const u = c.reduce((i, { useScope: l, scopeName: f }) => {
|
|
59
|
+
const a = l(r)[`__scope${f}`];
|
|
60
|
+
return { ...i, ...a };
|
|
61
|
+
}, {});
|
|
62
|
+
return s.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
return n.scopeName = t.scopeName, n;
|
|
66
|
+
}
|
|
67
|
+
function h(e, t) {
|
|
68
|
+
if (typeof e == "function")
|
|
69
|
+
return e(t);
|
|
70
|
+
e != null && (e.current = t);
|
|
71
|
+
}
|
|
72
|
+
function S(...e) {
|
|
73
|
+
return (t) => {
|
|
74
|
+
let n = !1;
|
|
75
|
+
const c = e.map((o) => {
|
|
76
|
+
const r = h(o, t);
|
|
77
|
+
return !n && typeof r == "function" && (n = !0), r;
|
|
78
|
+
});
|
|
79
|
+
if (n)
|
|
80
|
+
return () => {
|
|
81
|
+
for (let o = 0; o < c.length; o++) {
|
|
82
|
+
const r = c[o];
|
|
83
|
+
typeof r == "function" ? r() : h(e[o], null);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function F(...e) {
|
|
89
|
+
return s.useCallback(S(...e), e);
|
|
90
|
+
}
|
|
91
|
+
// @__NO_SIDE_EFFECTS__
|
|
92
|
+
function R(e) {
|
|
93
|
+
const t = /* @__PURE__ */ w(e), n = s.forwardRef((c, o) => {
|
|
94
|
+
const { children: r, ...u } = c, i = s.Children.toArray(r), l = i.find($);
|
|
95
|
+
if (l) {
|
|
96
|
+
const f = l.props.children, d = i.map((a) => a === l ? s.Children.count(f) > 1 ? s.Children.only(null) : s.isValidElement(f) ? f.props.children : null : a);
|
|
97
|
+
return /* @__PURE__ */ p(t, { ...u, ref: o, children: s.isValidElement(f) ? s.cloneElement(f, void 0, d) : null });
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ p(t, { ...u, ref: o, children: r });
|
|
100
|
+
});
|
|
101
|
+
return n.displayName = `${e}.Slot`, n;
|
|
102
|
+
}
|
|
103
|
+
// @__NO_SIDE_EFFECTS__
|
|
104
|
+
function w(e) {
|
|
105
|
+
const t = s.forwardRef((n, c) => {
|
|
106
|
+
const { children: o, ...r } = n;
|
|
107
|
+
if (s.isValidElement(o)) {
|
|
108
|
+
const u = N(o), i = _(r, o.props);
|
|
109
|
+
return o.type !== s.Fragment && (i.ref = c ? S(c, u) : u), s.cloneElement(o, i);
|
|
110
|
+
}
|
|
111
|
+
return s.Children.count(o) > 1 ? s.Children.only(null) : null;
|
|
112
|
+
});
|
|
113
|
+
return t.displayName = `${e}.SlotClone`, t;
|
|
114
|
+
}
|
|
115
|
+
var y = Symbol("radix.slottable");
|
|
116
|
+
// @__NO_SIDE_EFFECTS__
|
|
117
|
+
function H(e) {
|
|
118
|
+
const t = ({ children: n }) => /* @__PURE__ */ p(x, { children: n });
|
|
119
|
+
return t.displayName = `${e}.Slottable`, t.__radixId = y, t;
|
|
120
|
+
}
|
|
121
|
+
function $(e) {
|
|
122
|
+
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === y;
|
|
123
|
+
}
|
|
124
|
+
function _(e, t) {
|
|
125
|
+
const n = { ...t };
|
|
126
|
+
for (const c in t) {
|
|
127
|
+
const o = e[c], r = t[c];
|
|
128
|
+
/^on[A-Z]/.test(c) ? o && r ? n[c] = (...i) => {
|
|
129
|
+
const l = r(...i);
|
|
130
|
+
return o(...i), l;
|
|
131
|
+
} : o && (n[c] = o) : c === "style" ? n[c] = { ...o, ...r } : c === "className" && (n[c] = [o, r].filter(Boolean).join(" "));
|
|
132
|
+
}
|
|
133
|
+
return { ...e, ...n };
|
|
134
|
+
}
|
|
135
|
+
function N(e) {
|
|
136
|
+
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
137
|
+
return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
138
|
+
}
|
|
139
|
+
function L(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
140
|
+
return function(o) {
|
|
141
|
+
if (e?.(o), n === !1 || !o.defaultPrevented)
|
|
142
|
+
return t?.(o);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
var O = globalThis?.document ? s.useLayoutEffect : () => {
|
|
146
|
+
}, I = s[" useInsertionEffect ".trim().toString()] || O;
|
|
147
|
+
function T({
|
|
148
|
+
prop: e,
|
|
149
|
+
defaultProp: t,
|
|
150
|
+
onChange: n = () => {
|
|
151
|
+
},
|
|
152
|
+
caller: c
|
|
153
|
+
}) {
|
|
154
|
+
const [o, r, u] = D({
|
|
155
|
+
defaultProp: t,
|
|
156
|
+
onChange: n
|
|
157
|
+
}), i = e !== void 0, l = i ? e : o;
|
|
158
|
+
{
|
|
159
|
+
const d = s.useRef(e !== void 0);
|
|
160
|
+
s.useEffect(() => {
|
|
161
|
+
const a = d.current;
|
|
162
|
+
a !== i && console.warn(
|
|
163
|
+
`${c} is changing from ${a ? "controlled" : "uncontrolled"} to ${i ? "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.`
|
|
164
|
+
), d.current = i;
|
|
165
|
+
}, [i, c]);
|
|
166
|
+
}
|
|
167
|
+
const f = s.useCallback(
|
|
168
|
+
(d) => {
|
|
169
|
+
if (i) {
|
|
170
|
+
const a = j(d) ? d(e) : d;
|
|
171
|
+
a !== e && u.current?.(a);
|
|
172
|
+
} else
|
|
173
|
+
r(d);
|
|
174
|
+
},
|
|
175
|
+
[i, e, r, u]
|
|
176
|
+
);
|
|
177
|
+
return [l, f];
|
|
178
|
+
}
|
|
179
|
+
function D({
|
|
180
|
+
defaultProp: e,
|
|
181
|
+
onChange: t
|
|
182
|
+
}) {
|
|
183
|
+
const [n, c] = s.useState(e), o = s.useRef(n), r = s.useRef(t);
|
|
184
|
+
return I(() => {
|
|
185
|
+
r.current = t;
|
|
186
|
+
}, [t]), s.useEffect(() => {
|
|
187
|
+
o.current !== n && (r.current?.(n), o.current = n);
|
|
188
|
+
}, [n, o]), [n, c, r];
|
|
189
|
+
}
|
|
190
|
+
function j(e) {
|
|
191
|
+
return typeof e == "function";
|
|
192
|
+
}
|
|
193
|
+
var V = [
|
|
194
|
+
"a",
|
|
195
|
+
"button",
|
|
196
|
+
"div",
|
|
197
|
+
"form",
|
|
198
|
+
"h2",
|
|
199
|
+
"h3",
|
|
200
|
+
"img",
|
|
201
|
+
"input",
|
|
202
|
+
"label",
|
|
203
|
+
"li",
|
|
204
|
+
"nav",
|
|
205
|
+
"ol",
|
|
206
|
+
"p",
|
|
207
|
+
"select",
|
|
208
|
+
"span",
|
|
209
|
+
"svg",
|
|
210
|
+
"ul"
|
|
211
|
+
], k = V.reduce((e, t) => {
|
|
212
|
+
const n = /* @__PURE__ */ R(`Primitive.${t}`), c = s.forwardRef((o, r) => {
|
|
213
|
+
const { asChild: u, ...i } = o, l = u ? n : t;
|
|
214
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ p(l, { ...i, ref: r });
|
|
215
|
+
});
|
|
216
|
+
return c.displayName = `Primitive.${t}`, { ...e, [t]: c };
|
|
217
|
+
}, {});
|
|
218
|
+
function B(e, t) {
|
|
219
|
+
e && g.flushSync(() => e.dispatchEvent(t));
|
|
220
|
+
}
|
|
221
|
+
export {
|
|
222
|
+
k as P,
|
|
223
|
+
F as a,
|
|
224
|
+
L as b,
|
|
225
|
+
A as c,
|
|
226
|
+
O as d,
|
|
227
|
+
R as e,
|
|
228
|
+
H as f,
|
|
229
|
+
W as g,
|
|
230
|
+
B as h,
|
|
231
|
+
T as u
|
|
232
|
+
};
|