@rinzai/zen 0.2.2 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions-menu/index.d.ts +18 -0
- package/dist/actions-menu/index.d.ts.map +1 -0
- package/dist/backdrop/index.d.ts +14 -0
- package/dist/backdrop/index.d.ts.map +1 -0
- package/dist/{packages/badge → badge}/index.d.ts +1 -1
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/{packages/button → button}/index.d.ts +5 -4
- package/dist/button/index.d.ts.map +1 -0
- package/dist/card/index.d.ts +23 -0
- package/dist/card/index.d.ts.map +1 -0
- package/dist/code-block/index.d.ts +19 -0
- package/dist/code-block/index.d.ts.map +1 -0
- package/dist/{packages/collapse → collapse}/index.d.ts +1 -1
- package/dist/collapse/index.d.ts.map +1 -0
- package/dist/confirm-dialog/index.d.ts +14 -0
- package/dist/confirm-dialog/index.d.ts.map +1 -0
- package/dist/dialog/index.d.ts +22 -0
- package/dist/dialog/index.d.ts.map +1 -0
- package/dist/{packages/dropdown → dropdown}/index.d.ts +1 -1
- package/dist/dropdown/index.d.ts.map +1 -0
- package/dist/header/index.d.ts +8 -0
- package/dist/header/index.d.ts.map +1 -0
- package/dist/icons/chevron-down.d.ts +3 -0
- package/dist/icons/chevron-down.d.ts.map +1 -0
- package/dist/icons/chevron-up.d.ts +3 -0
- package/dist/icons/chevron-up.d.ts.map +1 -0
- package/dist/icons/icon.types.d.ts.map +1 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/search.d.ts +3 -0
- package/dist/icons/search.d.ts.map +1 -0
- package/dist/icons/x-mark.d.ts +3 -0
- package/dist/icons/x-mark.d.ts.map +1 -0
- package/dist/index.d.ts +36 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/nav-pills/index.d.ts +31 -0
- package/dist/nav-pills/index.d.ts.map +1 -0
- package/dist/page-header/index.d.ts +12 -0
- package/dist/page-header/index.d.ts.map +1 -0
- package/dist/{packages/popover → popover}/index.d.ts +3 -1
- package/dist/popover/index.d.ts.map +1 -0
- package/dist/progress-ring/index.d.ts +14 -0
- package/dist/progress-ring/index.d.ts.map +1 -0
- package/dist/segmented/index.d.ts +18 -0
- package/dist/segmented/index.d.ts.map +1 -0
- package/dist/side-nav/index.d.ts +22 -0
- package/dist/side-nav/index.d.ts.map +1 -0
- package/dist/skeleton/index.d.ts +6 -0
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/spinner/index.d.ts +6 -0
- package/dist/spinner/index.d.ts.map +1 -0
- package/dist/table/index.d.ts +11 -0
- package/dist/table/index.d.ts.map +1 -0
- package/dist/table-of-contents/index.d.ts +18 -0
- package/dist/table-of-contents/index.d.ts.map +1 -0
- package/dist/tabs/index.d.ts +26 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/textarea/index.d.ts +4 -0
- package/dist/textarea/index.d.ts.map +1 -0
- package/dist/theme-toggle/index.d.ts +20 -0
- package/dist/theme-toggle/index.d.ts.map +1 -0
- package/dist/toast/index.d.ts +20 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toggle/index.d.ts +10 -0
- package/dist/toggle/index.d.ts.map +1 -0
- package/dist/utils/cva.d.ts.map +1 -0
- package/dist/utils/cx.d.ts.map +1 -0
- package/dist/utils/slot.d.ts +10 -0
- package/dist/utils/slot.d.ts.map +1 -0
- package/dist/utils/styles.d.ts +15 -0
- package/dist/utils/styles.d.ts.map +1 -0
- package/dist/utils/useClickOutside.d.ts.map +1 -0
- package/dist/utils/useVirtualList.d.ts +26 -0
- package/dist/utils/useVirtualList.d.ts.map +1 -0
- package/dist/zen.css +2 -2
- package/dist/zen.js +1145 -722
- package/package.json +42 -39
- package/dist/packages/badge/index.d.ts.map +0 -1
- package/dist/packages/button/index.d.ts.map +0 -1
- package/dist/packages/collapse/index.d.ts.map +0 -1
- package/dist/packages/dropdown/index.d.ts.map +0 -1
- package/dist/packages/icons/chevron-down.d.ts +0 -3
- package/dist/packages/icons/chevron-down.d.ts.map +0 -1
- package/dist/packages/icons/chevron-up.d.ts +0 -3
- package/dist/packages/icons/chevron-up.d.ts.map +0 -1
- package/dist/packages/icons/icon.types.d.ts.map +0 -1
- package/dist/packages/icons/index.d.ts.map +0 -1
- package/dist/packages/icons/search.d.ts +0 -3
- package/dist/packages/icons/search.d.ts.map +0 -1
- package/dist/packages/icons/x-mark.d.ts +0 -3
- package/dist/packages/icons/x-mark.d.ts.map +0 -1
- package/dist/packages/index.d.ts +0 -17
- package/dist/packages/index.d.ts.map +0 -1
- package/dist/packages/input/index.d.ts +0 -4
- package/dist/packages/input/index.d.ts.map +0 -1
- package/dist/packages/popover/index.d.ts.map +0 -1
- package/dist/packages/textarea/index.d.ts +0 -4
- package/dist/packages/textarea/index.d.ts.map +0 -1
- package/dist/packages/toggle/index.d.ts +0 -6
- package/dist/packages/toggle/index.d.ts.map +0 -1
- package/dist/packages/utils/cva.d.ts.map +0 -1
- package/dist/packages/utils/cx.d.ts.map +0 -1
- package/dist/packages/utils/useClickOutside.d.ts.map +0 -1
- /package/dist/{packages/icons → icons}/icon.types.d.ts +0 -0
- /package/dist/{packages/icons → icons}/index.d.ts +0 -0
- /package/dist/{packages/utils → utils}/cva.d.ts +0 -0
- /package/dist/{packages/utils → utils}/cx.d.ts +0 -0
- /package/dist/{packages/utils → utils}/useClickOutside.d.ts +0 -0
package/dist/zen.js
CHANGED
|
@@ -1,14 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { cloneElement as e, createContext as t, isValidElement as n, useCallback as r, useContext as i, useEffect as a, useId as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as m } from "react-dom";
|
|
5
5
|
//#region packages/utils/cx.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
6
|
+
var h = (...e) => e.reduce((e, t) => t == null || t === !1 ? e : typeof t == "string" || typeof t == "number" ? e + " " + t : Array.isArray(t) ? e + " " + h(...t) : typeof t == "object" ? e + " " + Object.entries(t).reduce((e, [t, n]) => n == null || n === !1 ? e : typeof n == "string" || typeof n == "number" ? e + " " + t + "-" + n : typeof n == "boolean" && n ? e + " " + t : e, "") : e, ""), g = "flex w-full cursor-default items-center rounded-lg px-3 py-2 text-sm outline-hidden select-none hover:bg-tint/[0.07] focus:bg-tint/[0.07]";
|
|
7
|
+
function _({ label: e, actions: t, className: n }) {
|
|
8
|
+
let r = `zen__menu-${o().replace(/[^\w-]/g, "")}`, i = l(null), a = t.filter((e) => !!e);
|
|
9
|
+
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("button", {
|
|
10
|
+
type: "button",
|
|
11
|
+
"aria-label": e,
|
|
12
|
+
"aria-haspopup": "menu",
|
|
13
|
+
popoverTarget: r,
|
|
14
|
+
className: h("text-muted-foreground grid size-9 shrink-0 place-items-center rounded-lg outline-hidden", "hover:bg-tint/[0.06] hover:text-foreground focus-visible:ring-ring/50 focus-visible:ring-2", "[&:has(+:popover-open)]:bg-tint/[0.06]", n),
|
|
15
|
+
style: { anchorName: `--${r}` },
|
|
16
|
+
children: /* @__PURE__ */ p("svg", {
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
className: "size-4",
|
|
20
|
+
"aria-hidden": !0,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ f("circle", {
|
|
23
|
+
cx: "3",
|
|
24
|
+
cy: "8",
|
|
25
|
+
r: "1.4"
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ f("circle", {
|
|
28
|
+
cx: "8",
|
|
29
|
+
cy: "8",
|
|
30
|
+
r: "1.4"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ f("circle", {
|
|
33
|
+
cx: "13",
|
|
34
|
+
cy: "8",
|
|
35
|
+
r: "1.4"
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
}), /* @__PURE__ */ f("div", {
|
|
40
|
+
ref: i,
|
|
41
|
+
id: r,
|
|
42
|
+
popover: "auto",
|
|
43
|
+
role: "menu",
|
|
44
|
+
"aria-label": e,
|
|
45
|
+
tabIndex: -1,
|
|
46
|
+
onKeyDown: (e) => {
|
|
47
|
+
let t = Array.from(i.current?.querySelectorAll("[role=\"menuitem\"]") ?? []), n = t.indexOf(document.activeElement), r = t.length - 1, a = {
|
|
48
|
+
ArrowDown: n + 1,
|
|
49
|
+
ArrowUp: n === -1 ? r : n - 1,
|
|
50
|
+
Home: 0,
|
|
51
|
+
End: r
|
|
52
|
+
}[e.key];
|
|
53
|
+
a !== void 0 && (e.preventDefault(), t[(a + t.length) % t.length]?.focus());
|
|
54
|
+
},
|
|
55
|
+
onToggle: (e) => {
|
|
56
|
+
e.nativeEvent.newState === "open" && i.current?.focus();
|
|
57
|
+
},
|
|
58
|
+
className: h("zen__popover glass glass-blur text-foreground min-w-44 rounded-xl p-1.5 outline-hidden", "[position-area:block-end_span-inline-start] [position-try-fallbacks:flip-block]"),
|
|
59
|
+
style: {
|
|
60
|
+
positionAnchor: `--${r}`,
|
|
61
|
+
inset: "auto",
|
|
62
|
+
margin: "6px 0"
|
|
63
|
+
},
|
|
64
|
+
children: a.map((e) => /* @__PURE__ */ f("button", {
|
|
65
|
+
type: "button",
|
|
66
|
+
role: "menuitem",
|
|
67
|
+
tabIndex: -1,
|
|
68
|
+
className: h(g, e.destructive && "text-destructive hover:bg-destructive/10 focus:bg-destructive/10"),
|
|
69
|
+
onClick: () => {
|
|
70
|
+
i.current?.hidePopover?.(), e.onClick();
|
|
71
|
+
},
|
|
72
|
+
children: e.label
|
|
73
|
+
}, e.label))
|
|
74
|
+
})] });
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region packages/backdrop/index.tsx
|
|
78
|
+
function v({ pattern: e, topoSrc: t }) {
|
|
79
|
+
let n = e ?? (t ? "contours" : "dots");
|
|
80
|
+
return a(() => {
|
|
81
|
+
let e = document.documentElement, t = 0, n = -9999, r = -9999, i = /* @__PURE__ */ new WeakSet(), a = !0, o = () => {
|
|
82
|
+
t = 0, e.dataset.pointer = a ? "out" : "in", a || (e.style.setProperty("--mx", `${n}px`), e.style.setProperty("--my", `${r}px`));
|
|
83
|
+
let o = Array.from(document.querySelectorAll(".glow-edge")), s = o.map((e) => e.getBoundingClientRect());
|
|
84
|
+
o.forEach((e, t) => {
|
|
85
|
+
let a = s[t];
|
|
86
|
+
n > a.left - 400 && n < a.right + 400 && r > a.top - 400 && r < a.bottom + 400 ? (e.style.setProperty("--gx", `${n - a.left}px`), e.style.setProperty("--gy", `${r - a.top}px`), i.delete(e)) : i.has(e) || (e.style.setProperty("--gx", "-9999px"), e.style.setProperty("--gy", "-9999px"), i.add(e));
|
|
87
|
+
});
|
|
88
|
+
}, s = () => {
|
|
89
|
+
t ||= requestAnimationFrame(o);
|
|
90
|
+
}, c = (e) => {
|
|
91
|
+
n = e.clientX, r = e.clientY, a = !1, s();
|
|
92
|
+
}, l = () => {
|
|
93
|
+
n = r = -9999, a = !0, s();
|
|
94
|
+
};
|
|
95
|
+
if (!window.matchMedia?.("(hover: none), (pointer: coarse)").matches) return window.addEventListener("pointermove", c, { passive: !0 }), e.addEventListener("pointerleave", l), window.addEventListener("scroll", s, {
|
|
96
|
+
passive: !0,
|
|
97
|
+
capture: !0
|
|
98
|
+
}), window.addEventListener("resize", s, { passive: !0 }), () => {
|
|
99
|
+
window.removeEventListener("pointermove", c), e.removeEventListener("pointerleave", l), window.removeEventListener("scroll", s, { capture: !0 }), window.removeEventListener("resize", s), cancelAnimationFrame(t);
|
|
100
|
+
};
|
|
101
|
+
}, []), /* @__PURE__ */ p("div", {
|
|
102
|
+
className: "zen-backdrop",
|
|
103
|
+
"aria-hidden": !0,
|
|
104
|
+
style: t ? { "--zen-topo": `url("${t}")` } : void 0,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ f("div", { className: "zen-aurora zen-aurora--a" }),
|
|
107
|
+
/* @__PURE__ */ f("div", { className: "zen-aurora zen-aurora--b" }),
|
|
108
|
+
/* @__PURE__ */ f("div", { className: "zen-aurora zen-aurora--c" }),
|
|
109
|
+
n === "contours" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", { className: "zen-topo" }), /* @__PURE__ */ f("div", { className: "zen-topo zen-topo--lit" })] }) : /* @__PURE__ */ p(d, { children: [
|
|
110
|
+
/* @__PURE__ */ f("div", { className: "zen-dots" }),
|
|
111
|
+
/* @__PURE__ */ f("div", { className: "zen-dots zen-dots--ambient" }),
|
|
112
|
+
/* @__PURE__ */ f("div", { className: "zen-dots zen-dots--lit" })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ f("div", { className: "zen-vignette" })
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region packages/utils/cva.ts
|
|
120
|
+
var y = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, b = (e, t) => (n) => {
|
|
121
|
+
if (t?.variants == null) return h(e, n?.class, n?.className);
|
|
8
122
|
let { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((e) => {
|
|
9
123
|
let t = n?.[e], a = i?.[e];
|
|
10
124
|
if (t === null) return null;
|
|
11
|
-
let o =
|
|
125
|
+
let o = y(t) || y(a);
|
|
12
126
|
return r[e][o];
|
|
13
127
|
}), o = n && Object.entries(n).reduce((e, [t, n]) => (n === void 0 || (e[t] = n), e), {}), s = t?.compoundVariants?.reduce((e, { class: t, className: n, ...r }) => Object.entries(r).every(([e, t]) => Array.isArray(t) ? t.includes({
|
|
14
128
|
...i,
|
|
@@ -21,56 +135,67 @@ var u = (...e) => e.reduce((e, t) => t == null || t === !1 ? e : typeof t == "st
|
|
|
21
135
|
t,
|
|
22
136
|
n
|
|
23
137
|
] : e, []);
|
|
24
|
-
return
|
|
138
|
+
return h(e, a, s, n?.class, n?.className);
|
|
25
139
|
};
|
|
26
140
|
//#endregion
|
|
27
141
|
//#region packages/badge/index.tsx
|
|
28
|
-
function
|
|
29
|
-
return /* @__PURE__ */
|
|
142
|
+
function x({ variant: e, className: t, ...n }) {
|
|
143
|
+
return /* @__PURE__ */ f("span", {
|
|
30
144
|
...n,
|
|
31
|
-
className:
|
|
145
|
+
className: S({
|
|
32
146
|
variant: e,
|
|
33
147
|
className: t
|
|
34
148
|
})
|
|
35
149
|
});
|
|
36
150
|
}
|
|
37
|
-
var
|
|
151
|
+
var S = b("zen__badge inline-flex items-center rounded-md border px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wider uppercase whitespace-nowrap focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-glow/50", {
|
|
38
152
|
variants: { variant: {
|
|
39
|
-
default: "border-
|
|
40
|
-
secondary: "border-
|
|
41
|
-
destructive: "border-
|
|
42
|
-
outline: "border-
|
|
153
|
+
default: "border-glow/30 bg-glow/10 text-primary",
|
|
154
|
+
secondary: "border-tint/10 bg-tint/[0.06] text-foreground",
|
|
155
|
+
destructive: "border-destructive/40 bg-destructive/15 text-destructive",
|
|
156
|
+
outline: "border-tint/10 text-foreground"
|
|
43
157
|
} },
|
|
44
158
|
defaultVariants: { variant: "default" }
|
|
45
159
|
});
|
|
46
160
|
//#endregion
|
|
161
|
+
//#region packages/spinner/index.tsx
|
|
162
|
+
function C({ className: e }) {
|
|
163
|
+
return /* @__PURE__ */ f("span", {
|
|
164
|
+
"aria-hidden": !0,
|
|
165
|
+
className: h("zen__spinner inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent", e)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
47
169
|
//#region packages/button/index.tsx
|
|
48
|
-
function
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
170
|
+
function w({ className: e, variant: t, size: n, loading: r = !1, disabled: i, children: a, ...o }) {
|
|
171
|
+
return /* @__PURE__ */ p("button", {
|
|
172
|
+
disabled: i || r,
|
|
173
|
+
"aria-busy": r || void 0,
|
|
174
|
+
className: T({
|
|
51
175
|
variant: t,
|
|
52
176
|
size: n,
|
|
53
177
|
className: e
|
|
54
178
|
}),
|
|
55
|
-
...
|
|
179
|
+
...o,
|
|
180
|
+
children: [r && /* @__PURE__ */ f(C, {}), a]
|
|
56
181
|
});
|
|
57
182
|
}
|
|
58
|
-
var
|
|
183
|
+
var T = b("zen__button inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-hidden select-none transition-[background-color,border-color,box-shadow,color,transform] duration-200 ease-out active:scale-[0.97] focus-visible:ring-2 focus-visible:ring-glow/50 disabled:pointer-events-none disabled:opacity-50", {
|
|
59
184
|
variants: {
|
|
60
185
|
variant: {
|
|
61
|
-
default: "bg-primary text-primary-foreground shadow-
|
|
62
|
-
|
|
63
|
-
outline: "border border-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
link: "text-primary underline-offset-4 hover:underline
|
|
67
|
-
icon: "text-foreground hover:bg-
|
|
186
|
+
default: "bg-primary bg-[linear-gradient(to_bottom,oklch(1_0_0/0.16),transparent)] text-primary-foreground shadow-[0_0_0_1px_oklch(var(--glow)/0.55),0_0_22px_-6px_oklch(var(--glow)/0.7),inset_0_1px_0_hsl(0_0%_100%/0.3)] hover:shadow-[0_0_0_1px_oklch(var(--glow)/0.8),0_0_28px_-4px_oklch(var(--glow)/0.85),inset_0_1px_0_hsl(0_0%_100%/0.35)]",
|
|
187
|
+
secondary: "bg-primary/15 text-foreground shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.25)] hover:bg-primary/25",
|
|
188
|
+
outline: "glow-edge border border-tint/10 bg-tint/[0.03] text-foreground hover:border-tint/20 hover:bg-tint/[0.07]",
|
|
189
|
+
ghost: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground",
|
|
190
|
+
destructive: "bg-destructive/90 text-destructive-foreground shadow-[0_0_0_1px_oklch(var(--destructive)/0.6),0_0_22px_-8px_oklch(var(--destructive)/0.7)] hover:bg-destructive",
|
|
191
|
+
link: "h-auto! px-0! text-primary underline-offset-4 hover:underline",
|
|
192
|
+
icon: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground"
|
|
68
193
|
},
|
|
69
194
|
size: {
|
|
70
|
-
default: "h-
|
|
195
|
+
default: "h-10 px-4",
|
|
71
196
|
sm: "h-8 px-3 text-xs",
|
|
72
|
-
lg: "h-
|
|
73
|
-
icon: "
|
|
197
|
+
lg: "h-11 px-6",
|
|
198
|
+
icon: "size-9"
|
|
74
199
|
}
|
|
75
200
|
},
|
|
76
201
|
defaultVariants: {
|
|
@@ -79,643 +204,252 @@ var g = f("zen__button inline-flex items-center justify-center whitespace-nowrap
|
|
|
79
204
|
}
|
|
80
205
|
});
|
|
81
206
|
//#endregion
|
|
207
|
+
//#region packages/card/index.tsx
|
|
208
|
+
function ee({ title: e, action: t, children: n, className: r, ...i }) {
|
|
209
|
+
return /* @__PURE__ */ p("section", {
|
|
210
|
+
className: h("zen__card glass glow-edge text-card-foreground rounded-xl p-4 md:p-5", r),
|
|
211
|
+
...i,
|
|
212
|
+
children: [(e || t) && /* @__PURE__ */ p("header", {
|
|
213
|
+
className: "mb-4 flex items-center justify-between gap-4",
|
|
214
|
+
children: [e && /* @__PURE__ */ f("h4", {
|
|
215
|
+
className: "text-base tracking-tight",
|
|
216
|
+
children: e
|
|
217
|
+
}), t]
|
|
218
|
+
}), n]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function E({ label: e, value: t, hint: n, tone: r = "default", className: i }) {
|
|
222
|
+
return /* @__PURE__ */ p("div", {
|
|
223
|
+
className: h("zen__stat glass glow-edge flex flex-col gap-1 rounded-xl p-3.5 md:p-4", i),
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ f("span", {
|
|
226
|
+
className: "text-muted-foreground truncate text-[0.68rem] tracking-[0.1em] uppercase sm:text-xs",
|
|
227
|
+
children: e
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ f("span", {
|
|
230
|
+
className: h("truncate text-lg font-semibold tracking-tight tabular-nums sm:text-xl md:text-2xl", r === "positive" && "text-primary text-glow", r === "negative" && "text-destructive"),
|
|
231
|
+
children: t
|
|
232
|
+
}),
|
|
233
|
+
n && /* @__PURE__ */ f("span", {
|
|
234
|
+
className: "text-muted-foreground text-xs",
|
|
235
|
+
children: n
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function te({ children: e, className: t }) {
|
|
241
|
+
return /* @__PURE__ */ f("div", {
|
|
242
|
+
className: h("grid grid-cols-2 gap-3 sm:grid-cols-3 md:gap-4 [&>*]:min-w-0", "[&>*:last-child:nth-child(odd)]:col-span-2 sm:[&>*:last-child:nth-child(odd)]:col-span-1", t),
|
|
243
|
+
children: e
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region packages/code-block/index.tsx
|
|
248
|
+
function ne({ code: e, language: t, highlight: n, copyable: r = !0, variant: i = "glass", className: o, ...s }) {
|
|
249
|
+
let c = e.trim(), [l, d] = u(!1);
|
|
250
|
+
return a(() => {
|
|
251
|
+
if (!l) return;
|
|
252
|
+
let e = setTimeout(() => d(!1), 1500);
|
|
253
|
+
return () => clearTimeout(e);
|
|
254
|
+
}, [l]), /* @__PURE__ */ p("div", {
|
|
255
|
+
className: h("zen__code-block group relative", i === "glass" && "glass glow-edge overflow-hidden rounded-xl", o),
|
|
256
|
+
"data-language": t,
|
|
257
|
+
...s,
|
|
258
|
+
children: [/* @__PURE__ */ f("pre", {
|
|
259
|
+
className: "text-foreground m-0! overflow-x-auto rounded-none! bg-transparent! p-5! font-mono text-[13px]! leading-6 font-normal!",
|
|
260
|
+
children: n ? /* @__PURE__ */ f("code", {
|
|
261
|
+
className: "bg-transparent! p-0! text-inherit!",
|
|
262
|
+
dangerouslySetInnerHTML: { __html: n(c, t) }
|
|
263
|
+
}) : /* @__PURE__ */ f("code", {
|
|
264
|
+
className: "bg-transparent! p-0! text-inherit!",
|
|
265
|
+
children: c
|
|
266
|
+
})
|
|
267
|
+
}), r && /* @__PURE__ */ f("button", {
|
|
268
|
+
type: "button",
|
|
269
|
+
onClick: async () => {
|
|
270
|
+
await navigator.clipboard?.writeText(c), d(!0);
|
|
271
|
+
},
|
|
272
|
+
className: h("text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 rounded-lg px-2.5 py-1 text-xs font-medium outline-hidden transition-[opacity,background-color,color] focus-visible:ring-2", "opacity-0 group-hover:opacity-100 focus-visible:opacity-100", l && "text-primary opacity-100"),
|
|
273
|
+
children: l ? "Copied" : "Copy"
|
|
274
|
+
})]
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region packages/utils/styles.ts
|
|
279
|
+
var D = "h-10 rounded-lg border border-tint/10 bg-tint/[0.035] px-3 text-sm text-foreground shadow-[inset_0_1px_0_hsl(0_0%_100%/0.04)] transition-[border-color,background-color,box-shadow] duration-200 placeholder:text-muted-foreground hover:border-tint/20 focus-visible:border-glow/60 focus-visible:bg-tint/[0.05] focus-visible:shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)] focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", re = h(D, "inline-flex items-center justify-between gap-2 whitespace-nowrap"), ie = "glass glass-blur rounded-xl text-foreground shadow-[var(--popup-shadow),0_0_40px_-20px_oklch(var(--glow)/0.5)] outline-hidden", O = "relative flex w-fit items-center gap-1 rounded-full border border-tint/5 bg-tint/[0.03] p-1", k = "absolute top-1 bottom-1 left-0 rounded-full bg-primary/15 shadow-[inset_0_0_0_1px_oklch(var(--glow)/0.35),0_0_24px_-4px_oklch(var(--glow)/0.6)] transition-[translate,width] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]", A = "relative z-10 rounded-full px-3.5 py-1.5 text-sm whitespace-nowrap outline-hidden transition-colors duration-300 select-none focus-visible:ring-2 focus-visible:ring-ring/40";
|
|
280
|
+
//#endregion
|
|
82
281
|
//#region packages/popover/index.tsx
|
|
83
|
-
function
|
|
84
|
-
let { className:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
let t =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}, r = () => {
|
|
93
|
-
x(!1), e.onClose?.();
|
|
282
|
+
function j(e) {
|
|
283
|
+
let { className: t, content: n, children: r, role: i = "tooltip", triggerType: s = "auto", trigger: c = "click", gap: d = "5px", triggerClassName: m, show: g, setShow: _, style: v, onOpen: y, onClose: b, ...x } = e, S = o().replace(/[^\w-]/g, ""), [C, w] = u(!1), T = l(null);
|
|
284
|
+
return a(() => {
|
|
285
|
+
let e = T.current;
|
|
286
|
+
if (!e) return;
|
|
287
|
+
let t = () => {
|
|
288
|
+
w(!0), y?.();
|
|
289
|
+
}, n = () => {
|
|
290
|
+
w(!1), b?.();
|
|
94
291
|
};
|
|
95
|
-
return
|
|
96
|
-
|
|
292
|
+
return e.addEventListener("popover:open", t), e.addEventListener("popover:close", n), () => {
|
|
293
|
+
e.removeEventListener("popover:open", t), e.removeEventListener("popover:close", n);
|
|
97
294
|
};
|
|
98
|
-
}, [
|
|
99
|
-
|
|
100
|
-
}, [
|
|
101
|
-
"aria-expanded":
|
|
102
|
-
className: "max-w-fit min-w-fit",
|
|
103
|
-
style: {
|
|
104
|
-
popoverTarget: `zen__popover-${
|
|
295
|
+
}, [y, b]), a(() => {
|
|
296
|
+
s === "manual" && (g ? T.current?.showPopover?.() : T.current?.hidePopover?.());
|
|
297
|
+
}, [g, s]), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("div", {
|
|
298
|
+
"aria-expanded": C,
|
|
299
|
+
className: h("max-w-fit min-w-fit", m),
|
|
300
|
+
style: { anchorName: `--zen-popover-anchor-${S}` },
|
|
301
|
+
popoverTarget: `zen__popover-${S}`,
|
|
105
302
|
popoverTargetAction: "toggle",
|
|
106
|
-
onClick:
|
|
107
|
-
switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(),
|
|
303
|
+
onClick: c === "click" ? (e) => {
|
|
304
|
+
switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(), s) {
|
|
108
305
|
case "auto":
|
|
109
|
-
|
|
110
|
-
break;
|
|
111
|
-
case "manual":
|
|
112
|
-
h?.(!m);
|
|
306
|
+
T.current?.togglePopover?.();
|
|
113
307
|
break;
|
|
308
|
+
case "manual": _?.(!g);
|
|
114
309
|
}
|
|
115
310
|
} : void 0,
|
|
116
|
-
onMouseEnter:
|
|
117
|
-
e.stopPropagation(),
|
|
311
|
+
onMouseEnter: c === "hover" ? (e) => {
|
|
312
|
+
e.stopPropagation(), T.current?.showPopover?.();
|
|
118
313
|
} : void 0,
|
|
119
|
-
onMouseLeave:
|
|
120
|
-
e.stopPropagation(),
|
|
314
|
+
onMouseLeave: c === "hover" ? (e) => {
|
|
315
|
+
e.stopPropagation(), T.current?.hidePopover?.();
|
|
121
316
|
} : void 0,
|
|
122
|
-
children:
|
|
123
|
-
}), /* @__PURE__ */
|
|
124
|
-
...
|
|
125
|
-
ref:
|
|
126
|
-
role:
|
|
127
|
-
popover:
|
|
128
|
-
id: `zen__popover-${
|
|
129
|
-
className:
|
|
317
|
+
children: r
|
|
318
|
+
}), /* @__PURE__ */ f("div", {
|
|
319
|
+
...x,
|
|
320
|
+
ref: T,
|
|
321
|
+
role: i,
|
|
322
|
+
popover: s,
|
|
323
|
+
id: `zen__popover-${S}`,
|
|
324
|
+
className: h("zen__popover fixed z-50 w-[anchor-size(width)] min-w-max [justify-self:anchor-center] overflow-visible p-0 [position-area:block-end_center]", ie, t),
|
|
130
325
|
style: {
|
|
131
|
-
...
|
|
132
|
-
"--gap":
|
|
326
|
+
...v,
|
|
327
|
+
"--gap": d,
|
|
133
328
|
top: "calc(anchor(bottom) + var(--gap))",
|
|
134
329
|
left: "calc(anchor(center) - 50%)",
|
|
135
|
-
|
|
330
|
+
positionAnchor: `--zen-popover-anchor-${S}`
|
|
136
331
|
},
|
|
137
|
-
children:
|
|
332
|
+
children: n
|
|
138
333
|
})] });
|
|
139
334
|
}
|
|
140
335
|
//#endregion
|
|
141
336
|
//#region packages/collapse/index.tsx
|
|
142
|
-
function
|
|
143
|
-
let { items:
|
|
144
|
-
visible:
|
|
337
|
+
function M(e) {
|
|
338
|
+
let { items: t = [], children: n, moreItemsLabel: r = "", parentRef: i, data: o, estimator: s = (e, t) => t + 30, font: l = "12px Inter", badgeVariant: m = "secondary", badgeStyles: g } = e, [_, v] = u({
|
|
339
|
+
visible: t,
|
|
145
340
|
hidden: []
|
|
146
|
-
}),
|
|
341
|
+
}), y = c(() => {
|
|
147
342
|
if (typeof document > "u") return null;
|
|
148
343
|
let e = document.createElement("canvas").getContext("2d");
|
|
149
|
-
return e && (e.font =
|
|
150
|
-
}, []),
|
|
151
|
-
let e =
|
|
344
|
+
return e && (e.font = l), e;
|
|
345
|
+
}, []), b = () => {
|
|
346
|
+
let e = i?.current;
|
|
152
347
|
if (!e) return;
|
|
153
|
-
let
|
|
154
|
-
S
|
|
155
|
-
|
|
156
|
-
|
|
348
|
+
let n = e.offsetWidth;
|
|
349
|
+
if (S.reduce((e, t) => e + t, 0) <= n - 20) {
|
|
350
|
+
v({
|
|
351
|
+
visible: t,
|
|
352
|
+
hidden: []
|
|
353
|
+
});
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
let a = [], o = [], c = s(r, (y?.measureText(r).width ?? 0) + 10);
|
|
357
|
+
S?.reduce((e, r, i) => (e + r + c > n - 20 ? o.push(t[i]) : a.push(t[i]), e + r), 0), v({
|
|
358
|
+
visible: a,
|
|
359
|
+
hidden: o
|
|
157
360
|
});
|
|
158
|
-
}, S =
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
}, [
|
|
162
|
-
if (!
|
|
361
|
+
}, S = c(() => t?.map((e) => s(e, y?.measureText(e).width ?? 0)) ?? [], [t]);
|
|
362
|
+
return a(() => {
|
|
363
|
+
b();
|
|
364
|
+
}, [t]), a(() => {
|
|
365
|
+
if (!i?.current) return;
|
|
163
366
|
let e = new ResizeObserver(() => {
|
|
164
|
-
|
|
367
|
+
b();
|
|
165
368
|
});
|
|
166
|
-
return e.observe(
|
|
369
|
+
return e.observe(i.current), () => {
|
|
167
370
|
e.disconnect();
|
|
168
371
|
};
|
|
169
|
-
}, [
|
|
372
|
+
}, [t]), /* @__PURE__ */ p(d, { children: [_.visible?.map((e, t) => n(e, t, o?.[t])), _.hidden?.length > 0 && /* @__PURE__ */ f(j, {
|
|
170
373
|
trigger: "click",
|
|
171
|
-
content: /* @__PURE__ */
|
|
374
|
+
content: /* @__PURE__ */ f("div", {
|
|
172
375
|
className: "grid max-h-60 grid-flow-row grid-cols-2 gap-3 overflow-auto p-2",
|
|
173
|
-
children:
|
|
376
|
+
children: _.hidden.map((e, t) => n(e, _.visible.length + t, o?.[_.visible.length + t]))
|
|
174
377
|
}),
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
-
className: g,
|
|
177
|
-
variant:
|
|
178
|
-
"aria-label": `Show ${
|
|
179
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ f(x, {
|
|
379
|
+
className: h("cursor-pointer", g),
|
|
380
|
+
variant: m,
|
|
381
|
+
"aria-label": `Show ${_.hidden.length} more ${r}`,
|
|
382
|
+
children: /* @__PURE__ */ f("span", { children: `+${_.hidden.length} ${r}` })
|
|
180
383
|
}, "more_items_button")
|
|
181
384
|
})] });
|
|
182
385
|
}
|
|
183
386
|
//#endregion
|
|
184
|
-
//#region
|
|
185
|
-
function
|
|
186
|
-
let
|
|
187
|
-
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
|
|
218
|
-
};
|
|
219
|
-
}, C = (e) => {
|
|
220
|
-
let { offsetWidth: t, offsetHeight: n } = e;
|
|
221
|
-
return {
|
|
222
|
-
width: t,
|
|
223
|
-
height: n
|
|
224
|
-
};
|
|
225
|
-
}, w = (e) => e, T = (e) => {
|
|
226
|
-
let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
|
|
227
|
-
for (let e = t; e <= n; e++) r.push(e);
|
|
228
|
-
return r;
|
|
229
|
-
}, E = (e, t) => {
|
|
230
|
-
let n = e.scrollElement;
|
|
231
|
-
if (!n) return;
|
|
232
|
-
let r = e.targetWindow;
|
|
233
|
-
if (!r) return;
|
|
234
|
-
let i = (e) => {
|
|
235
|
-
let { width: n, height: r } = e;
|
|
236
|
-
t({
|
|
237
|
-
width: Math.round(n),
|
|
238
|
-
height: Math.round(r)
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
if (i(C(n)), !r.ResizeObserver) return () => {};
|
|
242
|
-
let a = new r.ResizeObserver((t) => {
|
|
243
|
-
let r = () => {
|
|
244
|
-
let e = t[0];
|
|
245
|
-
if (e?.borderBoxSize) {
|
|
246
|
-
let t = e.borderBoxSize[0];
|
|
247
|
-
if (t) {
|
|
248
|
-
i({
|
|
249
|
-
width: t.inlineSize,
|
|
250
|
-
height: t.blockSize
|
|
251
|
-
});
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
i(C(n));
|
|
256
|
-
};
|
|
257
|
-
e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
258
|
-
});
|
|
259
|
-
return a.observe(n, { box: "border-box" }), () => {
|
|
260
|
-
a.unobserve(n);
|
|
261
|
-
};
|
|
262
|
-
}, D = { passive: !0 }, O = typeof window > "u" ? !0 : "onscrollend" in window, k = (e, t) => {
|
|
263
|
-
let n = e.scrollElement;
|
|
264
|
-
if (!n) return;
|
|
265
|
-
let r = e.targetWindow;
|
|
266
|
-
if (!r) return;
|
|
267
|
-
let i = 0, a = e.options.useScrollendEvent && O ? () => void 0 : S(r, () => {
|
|
268
|
-
t(i, !1);
|
|
269
|
-
}, e.options.isScrollingResetDelay), o = (r) => () => {
|
|
270
|
-
let { horizontal: o, isRtl: s } = e.options;
|
|
271
|
-
i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
|
|
272
|
-
}, s = o(!0), c = o(!1);
|
|
273
|
-
n.addEventListener("scroll", s, D);
|
|
274
|
-
let l = e.options.useScrollendEvent && O;
|
|
275
|
-
return l && n.addEventListener("scrollend", c, D), () => {
|
|
276
|
-
n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
|
|
277
|
-
};
|
|
278
|
-
}, A = (e, t, n) => {
|
|
279
|
-
if (t?.borderBoxSize) {
|
|
280
|
-
let e = t.borderBoxSize[0];
|
|
281
|
-
if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
|
|
282
|
-
}
|
|
283
|
-
return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
284
|
-
}, j = (e, { adjustments: t = 0, behavior: n }, r) => {
|
|
285
|
-
var i, a;
|
|
286
|
-
let o = e + t;
|
|
287
|
-
(a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
|
|
288
|
-
[r.options.horizontal ? "left" : "top"]: o,
|
|
289
|
-
behavior: n
|
|
290
|
-
});
|
|
291
|
-
}, M = class {
|
|
292
|
-
constructor(e) {
|
|
293
|
-
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
|
|
294
|
-
var e;
|
|
295
|
-
return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now();
|
|
296
|
-
}, this.observer = /* @__PURE__ */ (() => {
|
|
297
|
-
let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
|
|
298
|
-
e.forEach((e) => {
|
|
299
|
-
let t = () => {
|
|
300
|
-
let t = e.target, n = this.indexFromElement(t);
|
|
301
|
-
if (!t.isConnected) {
|
|
302
|
-
this.observer.unobserve(t);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this));
|
|
306
|
-
};
|
|
307
|
-
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
|
|
308
|
-
});
|
|
309
|
-
}));
|
|
310
|
-
return {
|
|
311
|
-
disconnect: () => {
|
|
312
|
-
var n;
|
|
313
|
-
(n = t()) == null || n.disconnect(), e = null;
|
|
314
|
-
},
|
|
315
|
-
observe: (e) => t()?.observe(e, { box: "border-box" }),
|
|
316
|
-
unobserve: (e) => t()?.unobserve(e)
|
|
317
|
-
};
|
|
318
|
-
})(), this.range = null, this.setOptions = (e) => {
|
|
319
|
-
Object.entries(e).forEach(([t, n]) => {
|
|
320
|
-
n === void 0 && delete e[t];
|
|
321
|
-
}), this.options = {
|
|
322
|
-
debug: !1,
|
|
323
|
-
initialOffset: 0,
|
|
324
|
-
overscan: 1,
|
|
325
|
-
paddingStart: 0,
|
|
326
|
-
paddingEnd: 0,
|
|
327
|
-
scrollPaddingStart: 0,
|
|
328
|
-
scrollPaddingEnd: 0,
|
|
329
|
-
horizontal: !1,
|
|
330
|
-
getItemKey: w,
|
|
331
|
-
rangeExtractor: T,
|
|
332
|
-
onChange: () => {},
|
|
333
|
-
measureElement: A,
|
|
334
|
-
initialRect: {
|
|
335
|
-
width: 0,
|
|
336
|
-
height: 0
|
|
337
|
-
},
|
|
338
|
-
scrollMargin: 0,
|
|
339
|
-
gap: 0,
|
|
340
|
-
indexAttribute: "data-index",
|
|
341
|
-
initialMeasurementsCache: [],
|
|
342
|
-
lanes: 1,
|
|
343
|
-
isScrollingResetDelay: 150,
|
|
344
|
-
enabled: !0,
|
|
345
|
-
isRtl: !1,
|
|
346
|
-
useScrollendEvent: !1,
|
|
347
|
-
useAnimationFrameWithResizeObserver: !1,
|
|
348
|
-
laneAssignmentMode: "estimate",
|
|
349
|
-
...e
|
|
350
|
-
};
|
|
351
|
-
}, this.notify = (e) => {
|
|
352
|
-
var t, n;
|
|
353
|
-
(n = (t = this.options).onChange) == null || n.call(t, this, e);
|
|
354
|
-
}, this.maybeNotify = y(() => (this.calculateRange(), [
|
|
355
|
-
this.isScrolling,
|
|
356
|
-
this.range ? this.range.startIndex : null,
|
|
357
|
-
this.range ? this.range.endIndex : null
|
|
358
|
-
]), (e) => {
|
|
359
|
-
this.notify(e);
|
|
360
|
-
}, {
|
|
361
|
-
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
362
|
-
debug: () => this.options.debug,
|
|
363
|
-
initialDeps: [
|
|
364
|
-
this.isScrolling,
|
|
365
|
-
this.range ? this.range.startIndex : null,
|
|
366
|
-
this.range ? this.range.endIndex : null
|
|
367
|
-
]
|
|
368
|
-
}), this.cleanup = () => {
|
|
369
|
-
this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.scrollElement = null, this.targetWindow = null;
|
|
370
|
-
}, this._didMount = () => () => {
|
|
371
|
-
this.cleanup();
|
|
372
|
-
}, this._willUpdate = () => {
|
|
373
|
-
let e = this.options.enabled ? this.options.getScrollElement() : null;
|
|
374
|
-
if (this.scrollElement !== e) {
|
|
375
|
-
if (this.cleanup(), !e) {
|
|
376
|
-
this.maybeNotify();
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
|
|
380
|
-
this.observer.observe(e);
|
|
381
|
-
}), this.unsubs.push(this.options.observeElementRect(this, (e) => {
|
|
382
|
-
this.scrollRect = e, this.maybeNotify();
|
|
383
|
-
})), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
|
|
384
|
-
this.scrollAdjustments = 0, this.scrollDirection = t ? this.getScrollOffset() < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
|
|
385
|
-
})), this._scrollToOffset(this.getScrollOffset(), {
|
|
386
|
-
adjustments: void 0,
|
|
387
|
-
behavior: void 0
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
|
|
391
|
-
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
392
|
-
for (let i = t - 1; i >= 0; i--) {
|
|
393
|
-
let t = e[i];
|
|
394
|
-
if (n.has(t.lane)) continue;
|
|
395
|
-
let a = r.get(t.lane);
|
|
396
|
-
if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
|
|
397
|
-
}
|
|
398
|
-
return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
|
|
399
|
-
}, this.getMeasurementOptions = y(() => [
|
|
400
|
-
this.options.count,
|
|
401
|
-
this.options.paddingStart,
|
|
402
|
-
this.options.scrollMargin,
|
|
403
|
-
this.options.getItemKey,
|
|
404
|
-
this.options.enabled,
|
|
405
|
-
this.options.lanes,
|
|
406
|
-
this.options.laneAssignmentMode
|
|
407
|
-
], (e, t, n, r, i, a, o) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMeasuredCacheIndexes = [], {
|
|
408
|
-
count: e,
|
|
409
|
-
paddingStart: t,
|
|
410
|
-
scrollMargin: n,
|
|
411
|
-
getItemKey: r,
|
|
412
|
-
enabled: i,
|
|
413
|
-
lanes: a,
|
|
414
|
-
laneAssignmentMode: o
|
|
415
|
-
}), { key: !1 }), this.getMeasurements = y(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o }, s) => {
|
|
416
|
-
if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
|
|
417
|
-
if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
|
|
418
|
-
this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
|
|
419
|
-
this.itemSizeCache.set(e.key, e.size);
|
|
420
|
-
}));
|
|
421
|
-
let c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
422
|
-
this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
|
|
423
|
-
let l = this.measurementsCache.slice(0, c), u = Array(a).fill(void 0);
|
|
424
|
-
for (let e = 0; e < c; e++) {
|
|
425
|
-
let t = l[e];
|
|
426
|
-
t && (u[t.lane] = e);
|
|
427
|
-
}
|
|
428
|
-
for (let i = c; i < e; i++) {
|
|
429
|
-
let e = r(i), a = this.laneAssignments.get(i), c, d, f = o === "estimate" || s.has(e);
|
|
430
|
-
if (a !== void 0 && this.options.lanes > 1) {
|
|
431
|
-
c = a;
|
|
432
|
-
let e = u[c], r = e === void 0 ? void 0 : l[e];
|
|
433
|
-
d = r ? r.end + this.options.gap : t + n;
|
|
434
|
-
} else {
|
|
435
|
-
let e = this.options.lanes === 1 ? l[i - 1] : this.getFurthestMeasurement(l, i);
|
|
436
|
-
d = e ? e.end + this.options.gap : t + n, c = e ? e.lane : i % this.options.lanes, this.options.lanes > 1 && f && this.laneAssignments.set(i, c);
|
|
437
|
-
}
|
|
438
|
-
let p = s.get(e), m = typeof p == "number" ? p : this.options.estimateSize(i), h = d + m;
|
|
439
|
-
l[i] = {
|
|
440
|
-
index: i,
|
|
441
|
-
start: d,
|
|
442
|
-
size: m,
|
|
443
|
-
end: h,
|
|
444
|
-
key: e,
|
|
445
|
-
lane: c
|
|
446
|
-
}, u[c] = i;
|
|
447
|
-
}
|
|
448
|
-
return this.measurementsCache = l, l;
|
|
449
|
-
}, {
|
|
450
|
-
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
451
|
-
debug: () => this.options.debug
|
|
452
|
-
}), this.calculateRange = y(() => [
|
|
453
|
-
this.getMeasurements(),
|
|
454
|
-
this.getSize(),
|
|
455
|
-
this.getScrollOffset(),
|
|
456
|
-
this.options.lanes
|
|
457
|
-
], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? P({
|
|
458
|
-
measurements: e,
|
|
459
|
-
outerSize: t,
|
|
460
|
-
scrollOffset: n,
|
|
461
|
-
lanes: r
|
|
462
|
-
}) : null, {
|
|
463
|
-
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
464
|
-
debug: () => this.options.debug
|
|
465
|
-
}), this.getVirtualIndexes = y(() => {
|
|
466
|
-
let e = null, t = null, n = this.calculateRange();
|
|
467
|
-
return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
|
|
468
|
-
this.isScrolling,
|
|
469
|
-
e,
|
|
470
|
-
t
|
|
471
|
-
]), [
|
|
472
|
-
this.options.rangeExtractor,
|
|
473
|
-
this.options.overscan,
|
|
474
|
-
this.options.count,
|
|
475
|
-
e,
|
|
476
|
-
t
|
|
477
|
-
];
|
|
478
|
-
}, (e, t, n, r, i) => r === null || i === null ? [] : e({
|
|
479
|
-
startIndex: r,
|
|
480
|
-
endIndex: i,
|
|
481
|
-
overscan: t,
|
|
482
|
-
count: n
|
|
483
|
-
}), {
|
|
484
|
-
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
485
|
-
debug: () => this.options.debug
|
|
486
|
-
}), this.indexFromElement = (e) => {
|
|
487
|
-
let t = this.options.indexAttribute, n = e.getAttribute(t);
|
|
488
|
-
return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
|
|
489
|
-
}, this.shouldMeasureDuringScroll = (e) => {
|
|
490
|
-
if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
|
|
491
|
-
let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
|
|
492
|
-
if (t !== void 0 && this.range) {
|
|
493
|
-
let n = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), r = Math.max(0, t - n), i = Math.min(this.options.count - 1, t + n);
|
|
494
|
-
return e >= r && e <= i;
|
|
495
|
-
}
|
|
496
|
-
return !0;
|
|
497
|
-
}, this.measureElement = (e) => {
|
|
498
|
-
if (!e) {
|
|
499
|
-
this.elementsCache.forEach((e, t) => {
|
|
500
|
-
e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
|
|
501
|
-
});
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
let t = this.indexFromElement(e), n = this.options.getItemKey(t), r = this.elementsCache.get(n);
|
|
505
|
-
r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this));
|
|
506
|
-
}, this.resizeItem = (e, t) => {
|
|
507
|
-
let n = this.measurementsCache[e];
|
|
508
|
-
if (!n) return;
|
|
509
|
-
let r = t - (this.itemSizeCache.get(n.key) ?? n.size);
|
|
510
|
-
r !== 0 && (this.scrollState?.behavior !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? n.start < this.getScrollOffset() + this.scrollAdjustments : this.shouldAdjustScrollPositionOnItemSizeChange(n, r, this)) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", r), this._scrollToOffset(this.getScrollOffset(), {
|
|
511
|
-
adjustments: this.scrollAdjustments += r,
|
|
512
|
-
behavior: void 0
|
|
513
|
-
})), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
|
|
514
|
-
}, this.getVirtualItems = y(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
|
|
515
|
-
let n = [];
|
|
516
|
-
for (let r = 0, i = e.length; r < i; r++) {
|
|
517
|
-
let i = t[e[r]];
|
|
518
|
-
n.push(i);
|
|
519
|
-
}
|
|
520
|
-
return n;
|
|
521
|
-
}, {
|
|
522
|
-
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
523
|
-
debug: () => this.options.debug
|
|
524
|
-
}), this.getVirtualItemForOffset = (e) => {
|
|
525
|
-
let t = this.getMeasurements();
|
|
526
|
-
if (t.length !== 0) return b(t[N(0, t.length - 1, (e) => b(t[e]).start, e)]);
|
|
527
|
-
}, this.getMaxScrollOffset = () => {
|
|
528
|
-
if (!this.scrollElement) return 0;
|
|
529
|
-
if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
530
|
-
{
|
|
531
|
-
let e = this.scrollElement.document.documentElement;
|
|
532
|
-
return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
|
|
533
|
-
}
|
|
534
|
-
}, this.getOffsetForAlignment = (e, t, n = 0) => {
|
|
535
|
-
if (!this.scrollElement) return 0;
|
|
536
|
-
let r = this.getSize(), i = this.getScrollOffset();
|
|
537
|
-
t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
|
|
538
|
-
let a = this.getMaxScrollOffset();
|
|
539
|
-
return Math.max(Math.min(a, e), 0);
|
|
540
|
-
}, this.getOffsetForIndex = (e, t = "auto") => {
|
|
541
|
-
e = Math.max(0, Math.min(e, this.options.count - 1));
|
|
542
|
-
let n = this.getSize(), r = this.getScrollOffset(), i = this.measurementsCache[e];
|
|
543
|
-
if (!i) return;
|
|
544
|
-
if (t === "auto") if (i.end >= r + n - this.options.scrollPaddingEnd) t = "end";
|
|
545
|
-
else if (i.start <= r + this.options.scrollPaddingStart) t = "start";
|
|
546
|
-
else return [r, t];
|
|
547
|
-
if (t === "end" && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
|
|
548
|
-
let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
|
|
549
|
-
return [this.getOffsetForAlignment(a, t, i.size), t];
|
|
550
|
-
}, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
|
|
551
|
-
let r = this.getOffsetForAlignment(e, t), i = this.now();
|
|
552
|
-
this.scrollState = {
|
|
553
|
-
index: null,
|
|
554
|
-
align: t,
|
|
555
|
-
behavior: n,
|
|
556
|
-
startedAt: i,
|
|
557
|
-
lastTargetOffset: r,
|
|
558
|
-
stableFrames: 0
|
|
559
|
-
}, this._scrollToOffset(r, {
|
|
560
|
-
adjustments: void 0,
|
|
561
|
-
behavior: n
|
|
562
|
-
}), this.scheduleScrollReconcile();
|
|
563
|
-
}, this.scrollToIndex = (e, { align: t = "auto", behavior: n = "auto" } = {}) => {
|
|
564
|
-
e = Math.max(0, Math.min(e, this.options.count - 1));
|
|
565
|
-
let r = this.getOffsetForIndex(e, t);
|
|
566
|
-
if (!r) return;
|
|
567
|
-
let [i, a] = r, o = this.now();
|
|
568
|
-
this.scrollState = {
|
|
569
|
-
index: e,
|
|
570
|
-
align: a,
|
|
571
|
-
behavior: n,
|
|
572
|
-
startedAt: o,
|
|
573
|
-
lastTargetOffset: i,
|
|
574
|
-
stableFrames: 0
|
|
575
|
-
}, this._scrollToOffset(i, {
|
|
576
|
-
adjustments: void 0,
|
|
577
|
-
behavior: n
|
|
578
|
-
}), this.scheduleScrollReconcile();
|
|
579
|
-
}, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
|
|
580
|
-
let n = this.getScrollOffset() + e, r = this.now();
|
|
581
|
-
this.scrollState = {
|
|
582
|
-
index: null,
|
|
583
|
-
align: "start",
|
|
584
|
-
behavior: t,
|
|
585
|
-
startedAt: r,
|
|
586
|
-
lastTargetOffset: n,
|
|
587
|
-
stableFrames: 0
|
|
588
|
-
}, this._scrollToOffset(n, {
|
|
589
|
-
adjustments: void 0,
|
|
590
|
-
behavior: t
|
|
591
|
-
}), this.scheduleScrollReconcile();
|
|
592
|
-
}, this.getTotalSize = () => {
|
|
593
|
-
let e = this.getMeasurements(), t;
|
|
594
|
-
if (e.length === 0) t = this.options.paddingStart;
|
|
595
|
-
else if (this.options.lanes === 1) t = e[e.length - 1]?.end ?? 0;
|
|
596
|
-
else {
|
|
597
|
-
let n = Array(this.options.lanes).fill(null), r = e.length - 1;
|
|
598
|
-
for (; r >= 0 && n.some((e) => e === null);) {
|
|
599
|
-
let t = e[r];
|
|
600
|
-
n[t.lane] === null && (n[t.lane] = t.end), r--;
|
|
601
|
-
}
|
|
602
|
-
t = Math.max(...n.filter((e) => e !== null));
|
|
603
|
-
}
|
|
604
|
-
return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
|
|
605
|
-
}, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
|
|
606
|
-
this.options.scrollToFn(e, {
|
|
607
|
-
behavior: n,
|
|
608
|
-
adjustments: t
|
|
609
|
-
}, this);
|
|
610
|
-
}, this.measure = () => {
|
|
611
|
-
this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
|
|
612
|
-
}, this.setOptions(e);
|
|
613
|
-
}
|
|
614
|
-
scheduleScrollReconcile() {
|
|
615
|
-
if (!this.targetWindow) {
|
|
616
|
-
this.scrollState = null;
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
this.rafId ??= this.targetWindow.requestAnimationFrame(() => {
|
|
620
|
-
this.rafId = null, this.reconcileScroll();
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
reconcileScroll() {
|
|
624
|
-
if (!this.scrollState || !this.scrollElement) return;
|
|
625
|
-
if (this.now() - this.scrollState.startedAt > 5e3) {
|
|
626
|
-
this.scrollState = null;
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), t = e ? e[0] : this.scrollState.lastTargetOffset, n = t !== this.scrollState.lastTargetOffset;
|
|
630
|
-
if (!n && x(t, this.getScrollOffset())) {
|
|
631
|
-
if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
|
|
632
|
-
this.scrollState = null;
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
} else this.scrollState.stableFrames = 0, n && (this.scrollState.lastTargetOffset = t, this.scrollState.behavior = "auto", this._scrollToOffset(t, {
|
|
636
|
-
adjustments: void 0,
|
|
637
|
-
behavior: "auto"
|
|
638
|
-
}));
|
|
639
|
-
this.scheduleScrollReconcile();
|
|
640
|
-
}
|
|
641
|
-
}, N = (e, t, n, r) => {
|
|
642
|
-
for (; e <= t;) {
|
|
643
|
-
let i = (e + t) / 2 | 0, a = n(i);
|
|
644
|
-
if (a < r) e = i + 1;
|
|
645
|
-
else if (a > r) t = i - 1;
|
|
646
|
-
else return i;
|
|
647
|
-
}
|
|
648
|
-
return e > 0 ? e - 1 : 0;
|
|
649
|
-
};
|
|
650
|
-
function P({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
|
|
651
|
-
let i = e.length - 1, a = (t) => e[t].start;
|
|
652
|
-
if (e.length <= r) return {
|
|
653
|
-
startIndex: 0,
|
|
654
|
-
endIndex: i
|
|
655
|
-
};
|
|
656
|
-
let o = N(0, i, a, n), s = o;
|
|
657
|
-
if (r === 1) for (; s < i && e[s].end < n + t;) s++;
|
|
658
|
-
else if (r > 1) {
|
|
659
|
-
let a = Array(r).fill(0);
|
|
660
|
-
for (; s < i && a.some((e) => e < n + t);) {
|
|
661
|
-
let t = e[s];
|
|
662
|
-
a[t.lane] = t.end, s++;
|
|
663
|
-
}
|
|
664
|
-
let c = Array(r).fill(n + t);
|
|
665
|
-
for (; o >= 0 && c.some((e) => e >= n);) {
|
|
666
|
-
let t = e[o];
|
|
667
|
-
c[t.lane] = t.start, o--;
|
|
668
|
-
}
|
|
669
|
-
o = Math.max(0, o - o % r), s = Math.min(i, s + (r - 1 - s % r));
|
|
670
|
-
}
|
|
671
|
-
return {
|
|
672
|
-
startIndex: o,
|
|
673
|
-
endIndex: s
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region node_modules/.pnpm/@tanstack+react-virtual@3.13.24_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/@tanstack/react-virtual/dist/esm/index.js
|
|
678
|
-
var F = typeof document < "u" ? e.useLayoutEffect : e.useEffect;
|
|
679
|
-
function I({ useFlushSync: t = !0, ...n }) {
|
|
680
|
-
let r = e.useReducer(() => ({}), {})[1], i = {
|
|
681
|
-
...n,
|
|
682
|
-
onChange: (e, i) => {
|
|
683
|
-
var a;
|
|
684
|
-
t && i ? l(r) : r(), (a = n.onChange) == null || a.call(n, e, i);
|
|
685
|
-
}
|
|
686
|
-
}, [a] = e.useState(() => new M(i));
|
|
687
|
-
return a.setOptions(i), F(() => a._didMount(), []), F(() => a._willUpdate()), a;
|
|
688
|
-
}
|
|
689
|
-
function L(e) {
|
|
690
|
-
return I({
|
|
691
|
-
observeElementRect: E,
|
|
692
|
-
observeElementOffset: k,
|
|
693
|
-
scrollToFn: j,
|
|
694
|
-
...e
|
|
387
|
+
//#region packages/dialog/index.tsx
|
|
388
|
+
function N({ open: e, onOpenChange: t, title: n, description: r, children: i, dismissible: s = !0, initialFocus: c, size: u = "md", className: d, role: m }) {
|
|
389
|
+
let g = l(null), _ = o(), v = o();
|
|
390
|
+
return a(() => {
|
|
391
|
+
let t = g.current;
|
|
392
|
+
t && (e && !t.open ? (t.showModal(), c?.current?.focus()) : !e && t.open && t.close());
|
|
393
|
+
}, [e, c]), /* @__PURE__ */ f("dialog", {
|
|
394
|
+
ref: g,
|
|
395
|
+
role: m,
|
|
396
|
+
"aria-labelledby": _,
|
|
397
|
+
"aria-describedby": r ? v : void 0,
|
|
398
|
+
className: h("zen__dialog glass glass-blur glow-edge text-card-foreground", "bg-card/90! m-auto max-h-[calc(100dvh-2rem)] max-w-[calc(100vw-2rem)] overflow-visible rounded-xl p-0", u === "lg" ? "w-[60rem]" : "w-[28rem]", "backdrop:bg-black/50 backdrop:backdrop-blur-sm pointer-coarse:backdrop:backdrop-blur-none", d),
|
|
399
|
+
onCancel: (e) => {
|
|
400
|
+
e.preventDefault(), s && t?.(!1);
|
|
401
|
+
},
|
|
402
|
+
onClick: (e) => {
|
|
403
|
+
e.target === e.currentTarget && s && t?.(!1);
|
|
404
|
+
},
|
|
405
|
+
children: /* @__PURE__ */ p("div", {
|
|
406
|
+
className: "flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-x-hidden overflow-y-auto p-6",
|
|
407
|
+
children: [/* @__PURE__ */ p("div", {
|
|
408
|
+
className: "flex flex-col gap-2",
|
|
409
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
410
|
+
id: _,
|
|
411
|
+
className: "text-lg font-semibold",
|
|
412
|
+
children: n
|
|
413
|
+
}), r && /* @__PURE__ */ f("p", {
|
|
414
|
+
id: v,
|
|
415
|
+
className: "text-muted-foreground mt-0! text-sm leading-5",
|
|
416
|
+
children: r
|
|
417
|
+
})]
|
|
418
|
+
}), i]
|
|
419
|
+
})
|
|
695
420
|
});
|
|
696
421
|
}
|
|
697
422
|
//#endregion
|
|
698
|
-
//#region packages/
|
|
699
|
-
function
|
|
700
|
-
return /* @__PURE__ */
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
className: "
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
423
|
+
//#region packages/confirm-dialog/index.tsx
|
|
424
|
+
function ae({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, cancelLabel: a = "Cancel", destructive: o = !1, onConfirm: s }) {
|
|
425
|
+
return /* @__PURE__ */ f(N, {
|
|
426
|
+
role: "alertdialog",
|
|
427
|
+
open: e,
|
|
428
|
+
onOpenChange: t,
|
|
429
|
+
title: n,
|
|
430
|
+
description: r,
|
|
431
|
+
className: "w-[26rem]",
|
|
432
|
+
children: /* @__PURE__ */ p("div", {
|
|
433
|
+
className: "flex justify-end gap-2",
|
|
434
|
+
children: [/* @__PURE__ */ f(w, {
|
|
435
|
+
variant: "outline",
|
|
436
|
+
autoFocus: !0,
|
|
437
|
+
onClick: () => t(!1),
|
|
438
|
+
children: a
|
|
439
|
+
}), /* @__PURE__ */ f(w, {
|
|
440
|
+
variant: o ? "destructive" : "default",
|
|
441
|
+
onClick: () => {
|
|
442
|
+
s(), t(!1);
|
|
443
|
+
},
|
|
444
|
+
children: i
|
|
445
|
+
})]
|
|
712
446
|
})
|
|
713
447
|
});
|
|
714
448
|
}
|
|
715
449
|
//#endregion
|
|
716
450
|
//#region packages/icons/search.tsx
|
|
717
|
-
function
|
|
718
|
-
return /* @__PURE__ */
|
|
451
|
+
function P(e) {
|
|
452
|
+
return /* @__PURE__ */ f("svg", {
|
|
719
453
|
xmlns: "http://www.w3.org/2000/svg",
|
|
720
454
|
fill: "none",
|
|
721
455
|
viewBox: "0 0 24 24",
|
|
@@ -723,7 +457,7 @@ function z(e) {
|
|
|
723
457
|
stroke: "currentColor",
|
|
724
458
|
className: "h-6 w-6",
|
|
725
459
|
...e,
|
|
726
|
-
children: /* @__PURE__ */
|
|
460
|
+
children: /* @__PURE__ */ f("path", {
|
|
727
461
|
strokeLinecap: "round",
|
|
728
462
|
strokeLinejoin: "round",
|
|
729
463
|
d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
|
|
@@ -732,8 +466,8 @@ function z(e) {
|
|
|
732
466
|
}
|
|
733
467
|
//#endregion
|
|
734
468
|
//#region packages/icons/x-mark.tsx
|
|
735
|
-
function
|
|
736
|
-
return /* @__PURE__ */
|
|
469
|
+
function oe(e) {
|
|
470
|
+
return /* @__PURE__ */ f("svg", {
|
|
737
471
|
xmlns: "http://www.w3.org/2000/svg",
|
|
738
472
|
fill: "none",
|
|
739
473
|
viewBox: "0 0 24 24",
|
|
@@ -741,7 +475,7 @@ function B(e) {
|
|
|
741
475
|
stroke: "currentColor",
|
|
742
476
|
className: "h-6 w-6",
|
|
743
477
|
...e,
|
|
744
|
-
children: /* @__PURE__ */
|
|
478
|
+
children: /* @__PURE__ */ f("path", {
|
|
745
479
|
strokeLinecap: "round",
|
|
746
480
|
strokeLinejoin: "round",
|
|
747
481
|
d: "M6 18 18 6M6 6l12 12"
|
|
@@ -749,124 +483,192 @@ function B(e) {
|
|
|
749
483
|
});
|
|
750
484
|
}
|
|
751
485
|
//#endregion
|
|
486
|
+
//#region packages/utils/useVirtualList.ts
|
|
487
|
+
function se({ count: e, itemHeight: t, scrollRef: n, overscan: r = 6 }) {
|
|
488
|
+
let [i, a] = u({
|
|
489
|
+
scrollTop: 0,
|
|
490
|
+
height: 0
|
|
491
|
+
});
|
|
492
|
+
s(() => {
|
|
493
|
+
let e = n.current;
|
|
494
|
+
if (!e) return;
|
|
495
|
+
let t = () => a({
|
|
496
|
+
scrollTop: e.scrollTop,
|
|
497
|
+
height: e.clientHeight
|
|
498
|
+
});
|
|
499
|
+
t(), e.addEventListener("scroll", t, { passive: !0 });
|
|
500
|
+
let r = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
501
|
+
return r?.observe(e), () => {
|
|
502
|
+
e.removeEventListener("scroll", t), r?.disconnect();
|
|
503
|
+
};
|
|
504
|
+
}, [n, e]);
|
|
505
|
+
let o = i.height || t * 10, c = Math.max(0, Math.floor(i.scrollTop / t) - r), l = Math.min(e, Math.ceil((i.scrollTop + o) / t) + r), d = [];
|
|
506
|
+
for (let e = c; e < l; e++) d.push({
|
|
507
|
+
index: e,
|
|
508
|
+
start: e * t,
|
|
509
|
+
size: t
|
|
510
|
+
});
|
|
511
|
+
return {
|
|
512
|
+
items: d,
|
|
513
|
+
totalSize: e * t
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
752
517
|
//#region packages/dropdown/index.tsx
|
|
753
|
-
function
|
|
754
|
-
let { items: t, selected: n, className: r, onChange:
|
|
755
|
-
return /* @__PURE__ */
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
518
|
+
function F(e) {
|
|
519
|
+
let { items: t, selected: n, className: r, onChange: i, disabled: a, placeholder: o = "Select an Item", multiple: s, mutable: c, onAdd: d } = e, m = l(null), [g, _] = u(!1), v = !!r && /(^|\s)(w-|min-w-|max-w-)/.test(r), y = !!r && /(^|\s)w-full(\s|$)/.test(r);
|
|
520
|
+
return /* @__PURE__ */ f(j, {
|
|
521
|
+
triggerClassName: y ? "w-full max-w-none" : void 0,
|
|
522
|
+
content: /* @__PURE__ */ f(I, {
|
|
523
|
+
...c ? {
|
|
524
|
+
mutable: c,
|
|
525
|
+
onAdd: d
|
|
526
|
+
} : { mutable: c },
|
|
527
|
+
...s ? {
|
|
528
|
+
multiple: s,
|
|
763
529
|
items: t,
|
|
764
|
-
onChange:
|
|
530
|
+
onChange: i,
|
|
765
531
|
selected: n
|
|
766
532
|
} : {
|
|
767
533
|
items: t,
|
|
768
|
-
onChange:
|
|
534
|
+
onChange: i,
|
|
769
535
|
selected: n
|
|
770
536
|
}
|
|
771
537
|
}),
|
|
772
|
-
onOpen: () =>
|
|
773
|
-
onClose: () =>
|
|
774
|
-
children: /* @__PURE__ */
|
|
538
|
+
onOpen: () => _(!0),
|
|
539
|
+
onClose: () => _(!1),
|
|
540
|
+
children: /* @__PURE__ */ p("div", {
|
|
775
541
|
role: "combobox",
|
|
776
|
-
"aria-expanded":
|
|
542
|
+
"aria-expanded": g,
|
|
777
543
|
"aria-haspopup": "listbox",
|
|
778
|
-
className:
|
|
779
|
-
children: [/* @__PURE__ */
|
|
780
|
-
className:
|
|
781
|
-
ref:
|
|
782
|
-
children:
|
|
544
|
+
className: h(re, !v && "w-56", "grow", a ? "cursor-not-allowed opacity-50" : "cursor-pointer", g && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", r),
|
|
545
|
+
children: [/* @__PURE__ */ f("div", {
|
|
546
|
+
className: h("flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm", a ? "text-muted-foreground" : "text-foreground"),
|
|
547
|
+
ref: m,
|
|
548
|
+
children: s && !n.length ? /* @__PURE__ */ f("span", {
|
|
549
|
+
className: "text-muted-foreground",
|
|
550
|
+
children: o
|
|
551
|
+
}) : s ? /* @__PURE__ */ f(M, {
|
|
783
552
|
items: n.map((e) => e.text),
|
|
784
553
|
data: n,
|
|
785
|
-
parentRef:
|
|
554
|
+
parentRef: m,
|
|
786
555
|
estimator: (e, t) => t + 40,
|
|
787
556
|
badgeVariant: "secondary",
|
|
788
|
-
badgeStyles: "
|
|
789
|
-
children: (e, t, r) => /* @__PURE__ */
|
|
790
|
-
className: "
|
|
557
|
+
badgeStyles: "h-6 min-w-min gap-2",
|
|
558
|
+
children: (e, t, r) => /* @__PURE__ */ p(x, {
|
|
559
|
+
className: "flex h-6 min-w-min gap-2 pr-1",
|
|
791
560
|
variant: "secondary",
|
|
792
|
-
children: [e, /* @__PURE__ */
|
|
561
|
+
children: [e, /* @__PURE__ */ f(w, {
|
|
793
562
|
onClick: () => {
|
|
794
|
-
|
|
563
|
+
i(n.filter((e) => e.key !== r?.key));
|
|
795
564
|
},
|
|
796
565
|
variant: "icon",
|
|
797
566
|
size: "icon",
|
|
798
|
-
className: "group
|
|
799
|
-
children: /* @__PURE__ */
|
|
567
|
+
className: "group size-4 rounded-sm p-0.5",
|
|
568
|
+
children: /* @__PURE__ */ f(oe, { className: "size-3 transition duration-300 group-hover:rotate-90" })
|
|
800
569
|
})]
|
|
801
570
|
}, `collapsed_item_${r?.key ?? t}`)
|
|
802
|
-
}) : n.text ??
|
|
803
|
-
}), /* @__PURE__ */
|
|
571
|
+
}) : n.text ?? o
|
|
572
|
+
}), /* @__PURE__ */ f("svg", {
|
|
573
|
+
viewBox: "0 0 16 16",
|
|
574
|
+
fill: "none",
|
|
575
|
+
stroke: "currentColor",
|
|
576
|
+
strokeWidth: "1.6",
|
|
577
|
+
strokeLinecap: "round",
|
|
578
|
+
strokeLinejoin: "round",
|
|
579
|
+
"aria-hidden": !0,
|
|
580
|
+
className: h("text-muted-foreground size-4 shrink-0 transition-transform duration-300", g && "rotate-180"),
|
|
581
|
+
children: /* @__PURE__ */ f("path", { d: "m4 6 4 4 4-4" })
|
|
582
|
+
})]
|
|
804
583
|
})
|
|
805
584
|
});
|
|
806
585
|
}
|
|
807
|
-
function
|
|
808
|
-
let { items: t, multiple: n, selected:
|
|
809
|
-
count:
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
})
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
586
|
+
function I(e) {
|
|
587
|
+
let { items: t, multiple: n, selected: r, onChange: i, mutable: o, onAdd: s } = e, [d, m] = u(""), g = l(null), _ = c(() => t.reduce((e, t) => ((!d.length || t.text.toLowerCase().includes(d.toLowerCase())) && e.push(t), e), []), [t, d]), v = se({
|
|
588
|
+
count: _.length,
|
|
589
|
+
itemHeight: 35,
|
|
590
|
+
scrollRef: g
|
|
591
|
+
});
|
|
592
|
+
a(() => {
|
|
593
|
+
g.current && (g.current.scrollTop = 0);
|
|
594
|
+
}, [d]);
|
|
595
|
+
let y = r instanceof Array ? r.map((e) => e.key) : [r.key];
|
|
596
|
+
return /* @__PURE__ */ p("div", {
|
|
597
|
+
className: "divide-tint/10 flex w-full flex-col divide-y overflow-hidden rounded-xl",
|
|
598
|
+
children: [/* @__PURE__ */ p("div", {
|
|
599
|
+
className: h("flex grow items-center rounded px-3 py-2"),
|
|
600
|
+
children: [/* @__PURE__ */ f(P, { className: "text-muted-foreground mr-2 size-4" }), /* @__PURE__ */ f("input", {
|
|
818
601
|
className: "text-foreground inline-flex grow bg-transparent text-sm outline-hidden",
|
|
819
602
|
placeholder: "Search",
|
|
820
|
-
value:
|
|
603
|
+
value: d,
|
|
821
604
|
onChange: (e) => m(e.target.value)
|
|
822
605
|
})]
|
|
823
|
-
}), /* @__PURE__ */
|
|
606
|
+
}), /* @__PURE__ */ p("ul", {
|
|
824
607
|
role: "listbox",
|
|
825
|
-
className:
|
|
826
|
-
ref:
|
|
827
|
-
children: [/* @__PURE__ */
|
|
608
|
+
className: h("max-h-72 grow overflow-y-auto py-1", "focus:ring-0 focus:outline-hidden"),
|
|
609
|
+
ref: g,
|
|
610
|
+
children: [/* @__PURE__ */ f("div", {
|
|
828
611
|
style: {
|
|
829
|
-
height: `${
|
|
612
|
+
height: `${v.totalSize}px`,
|
|
830
613
|
width: "100%",
|
|
831
614
|
position: "relative"
|
|
832
615
|
},
|
|
833
|
-
children:
|
|
616
|
+
children: v.items.map((e) => /* @__PURE__ */ p("li", {
|
|
834
617
|
role: "option",
|
|
835
|
-
"aria-selected":
|
|
618
|
+
"aria-selected": y.includes(_[e.index].key),
|
|
836
619
|
style: {
|
|
837
620
|
height: `${e.size}px`,
|
|
838
621
|
transform: `translateY(${e.start}px)`
|
|
839
622
|
},
|
|
840
|
-
className:
|
|
623
|
+
className: h("hover:bg-muted absolute top-0 left-0 grid w-full cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none"),
|
|
841
624
|
onClick: () => {
|
|
842
|
-
n ?
|
|
625
|
+
n ? y.includes(_[e.index].key) ? i(structuredClone(r.filter((t) => t.key !== _[e.index].key))) : i(structuredClone([...r, _[e.index]])) : i(_[e.index]);
|
|
843
626
|
},
|
|
844
|
-
children:
|
|
845
|
-
|
|
846
|
-
|
|
627
|
+
children: [/* @__PURE__ */ f("span", {
|
|
628
|
+
className: "text-primary col-start-1",
|
|
629
|
+
"aria-hidden": !0,
|
|
630
|
+
children: y.includes(_[e.index].key) && "✓"
|
|
631
|
+
}), /* @__PURE__ */ f("span", {
|
|
632
|
+
className: "col-start-2 truncate",
|
|
633
|
+
children: _[e.index].text
|
|
634
|
+
})]
|
|
635
|
+
}, e.index))
|
|
636
|
+
}), d.length > 0 && _.length === 0 && (o ? /* @__PURE__ */ p("li", {
|
|
847
637
|
role: "option",
|
|
848
638
|
"aria-selected": !1,
|
|
849
|
-
className:
|
|
639
|
+
className: h("hover:bg-muted cursor-pointer px-3 py-2 text-sm select-none"),
|
|
850
640
|
onClick: () => {
|
|
851
|
-
|
|
852
|
-
text:
|
|
853
|
-
key:
|
|
641
|
+
s({
|
|
642
|
+
text: d,
|
|
643
|
+
key: d
|
|
854
644
|
}), m("");
|
|
855
645
|
},
|
|
856
|
-
children: ["Add ",
|
|
857
|
-
}) : /* @__PURE__ */
|
|
646
|
+
children: ["Add ", d]
|
|
647
|
+
}) : /* @__PURE__ */ f("li", {
|
|
858
648
|
role: "option",
|
|
859
649
|
"aria-selected": !1,
|
|
860
|
-
className:
|
|
650
|
+
className: h("text-muted-foreground cursor-not-allowed px-3 py-2 text-sm"),
|
|
861
651
|
children: "No results found"
|
|
862
652
|
}))]
|
|
863
653
|
})]
|
|
864
654
|
});
|
|
865
655
|
}
|
|
866
656
|
//#endregion
|
|
657
|
+
//#region packages/header/index.tsx
|
|
658
|
+
function L({ className: e, children: t, ...n }) {
|
|
659
|
+
return /* @__PURE__ */ f("header", {
|
|
660
|
+
className: h("zen__header border-tint/5 bg-background/60 sticky top-0 z-40 border-b pt-[env(safe-area-inset-top)] backdrop-blur-xl", "pointer-coarse:bg-background/95 pointer-coarse:backdrop-blur-none", e),
|
|
661
|
+
...n,
|
|
662
|
+
children: /* @__PURE__ */ f("div", {
|
|
663
|
+
className: "flex items-center justify-between gap-4 px-4 py-2.5 md:gap-6 md:px-6 md:py-3",
|
|
664
|
+
children: t
|
|
665
|
+
})
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
//#endregion
|
|
867
669
|
//#region packages/icons/chevron-down.tsx
|
|
868
|
-
function
|
|
869
|
-
return /* @__PURE__ */
|
|
670
|
+
function R(e) {
|
|
671
|
+
return /* @__PURE__ */ f("svg", {
|
|
870
672
|
xmlns: "http://www.w3.org/2000/svg",
|
|
871
673
|
fill: "none",
|
|
872
674
|
viewBox: "0 0 24 24",
|
|
@@ -874,7 +676,25 @@ function U(e) {
|
|
|
874
676
|
stroke: "currentColor",
|
|
875
677
|
className: "h-6 w-6",
|
|
876
678
|
...e,
|
|
877
|
-
children: /* @__PURE__ */
|
|
679
|
+
children: /* @__PURE__ */ f("path", {
|
|
680
|
+
strokeLinecap: "round",
|
|
681
|
+
strokeLinejoin: "round",
|
|
682
|
+
d: "m19.5 8.25-7.5 7.5-7.5-7.5"
|
|
683
|
+
})
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region packages/icons/chevron-up.tsx
|
|
688
|
+
function z(e) {
|
|
689
|
+
return /* @__PURE__ */ f("svg", {
|
|
690
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
691
|
+
fill: "none",
|
|
692
|
+
viewBox: "0 0 24 24",
|
|
693
|
+
strokeWidth: 1.5,
|
|
694
|
+
stroke: "currentColor",
|
|
695
|
+
className: "h-6 w-6",
|
|
696
|
+
...e,
|
|
697
|
+
children: /* @__PURE__ */ f("path", {
|
|
878
698
|
strokeLinecap: "round",
|
|
879
699
|
strokeLinejoin: "round",
|
|
880
700
|
d: "m4.5 15.75 7.5-7.5 7.5 7.5"
|
|
@@ -883,46 +703,649 @@ function U(e) {
|
|
|
883
703
|
}
|
|
884
704
|
//#endregion
|
|
885
705
|
//#region packages/input/index.tsx
|
|
886
|
-
function
|
|
706
|
+
function B(e) {
|
|
887
707
|
let { className: t, ...n } = e;
|
|
888
|
-
return /* @__PURE__ */
|
|
889
|
-
className:
|
|
708
|
+
return /* @__PURE__ */ f("input", {
|
|
709
|
+
className: h(D, "w-full", "read-only:text-foreground read-only:cursor-default read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", "file:text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium", "[[type=\"checkbox\"]]:accent-primary [[type=\"checkbox\"]]:h-4 [[type=\"checkbox\"]]:w-4 [[type=\"checkbox\"]]:rounded-sm", "[[type=\"radio\"]]:accent-primary [[type=\"radio\"]]:h-4 [[type=\"radio\"]]:w-4", t),
|
|
890
710
|
...n
|
|
891
711
|
});
|
|
892
712
|
}
|
|
893
713
|
//#endregion
|
|
714
|
+
//#region packages/utils/slot.tsx
|
|
715
|
+
function V({ children: t, className: r, ...i }) {
|
|
716
|
+
if (!n(t)) return null;
|
|
717
|
+
let a = t;
|
|
718
|
+
return e(a, {
|
|
719
|
+
...i,
|
|
720
|
+
className: h(r, a.props.className)
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region packages/nav-pills/index.tsx
|
|
725
|
+
var H = t(null);
|
|
726
|
+
function U({ className: e, children: t, ...n }) {
|
|
727
|
+
let r = l(null), [i, a] = u(null);
|
|
728
|
+
return s(() => {
|
|
729
|
+
let e = r.current;
|
|
730
|
+
if (!e) return;
|
|
731
|
+
let t = () => {
|
|
732
|
+
let t = e.querySelector("[aria-current=\"page\"]");
|
|
733
|
+
a(t ? {
|
|
734
|
+
x: t.offsetLeft,
|
|
735
|
+
w: t.offsetWidth
|
|
736
|
+
} : null);
|
|
737
|
+
};
|
|
738
|
+
t();
|
|
739
|
+
let n = new MutationObserver(t);
|
|
740
|
+
n.observe(e, {
|
|
741
|
+
subtree: !0,
|
|
742
|
+
childList: !0,
|
|
743
|
+
attributes: !0,
|
|
744
|
+
attributeFilter: ["aria-current"]
|
|
745
|
+
});
|
|
746
|
+
let i = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
747
|
+
return i?.observe(e), () => {
|
|
748
|
+
n.disconnect(), i?.disconnect();
|
|
749
|
+
};
|
|
750
|
+
}, []), /* @__PURE__ */ f("nav", {
|
|
751
|
+
className: h("zen__nav-pills", e),
|
|
752
|
+
...n,
|
|
753
|
+
children: /* @__PURE__ */ f("div", {
|
|
754
|
+
ref: r,
|
|
755
|
+
className: O,
|
|
756
|
+
children: /* @__PURE__ */ f(H.Provider, {
|
|
757
|
+
value: i,
|
|
758
|
+
children: t
|
|
759
|
+
})
|
|
760
|
+
})
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
function W({ className: e }) {
|
|
764
|
+
let t = i(H);
|
|
765
|
+
return t ? /* @__PURE__ */ f("span", {
|
|
766
|
+
"aria-hidden": !0,
|
|
767
|
+
className: h(k, e),
|
|
768
|
+
style: {
|
|
769
|
+
translate: `${t.x}px 0`,
|
|
770
|
+
width: t.w
|
|
771
|
+
}
|
|
772
|
+
}) : null;
|
|
773
|
+
}
|
|
774
|
+
var G = h(A, "text-muted-foreground hover:text-foreground aria-[current=page]:text-foreground aria-[current=page]:hover:text-foreground");
|
|
775
|
+
function K({ active: e, asChild: t, className: n, children: r, ...i }) {
|
|
776
|
+
let a = {
|
|
777
|
+
...i,
|
|
778
|
+
"aria-current": e ? "page" : void 0,
|
|
779
|
+
className: h(G, n)
|
|
780
|
+
};
|
|
781
|
+
return t ? (e || delete a["aria-current"], /* @__PURE__ */ f(V, {
|
|
782
|
+
...a,
|
|
783
|
+
children: r
|
|
784
|
+
})) : /* @__PURE__ */ f("a", {
|
|
785
|
+
...a,
|
|
786
|
+
children: r
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region packages/page-header/index.tsx
|
|
791
|
+
function ce({ eyebrow: e, title: t, lead: n, children: r, className: i }) {
|
|
792
|
+
return /* @__PURE__ */ p("header", {
|
|
793
|
+
className: h("zen__page-header flex flex-col gap-3", i),
|
|
794
|
+
children: [
|
|
795
|
+
e && /* @__PURE__ */ f("p", {
|
|
796
|
+
className: "text-muted-foreground mt-0! text-xs tracking-[0.1em] uppercase",
|
|
797
|
+
children: e
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ f("h1", {
|
|
800
|
+
className: "text-aurora",
|
|
801
|
+
children: t
|
|
802
|
+
}),
|
|
803
|
+
n && /* @__PURE__ */ f("p", {
|
|
804
|
+
className: "text-muted-foreground mt-0! max-w-2xl text-lg leading-relaxed",
|
|
805
|
+
children: n
|
|
806
|
+
}),
|
|
807
|
+
r
|
|
808
|
+
]
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
//#endregion
|
|
812
|
+
//#region packages/progress-ring/index.tsx
|
|
813
|
+
function le({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, className: a }) {
|
|
814
|
+
let o = (t - n) / 2, s = 2 * Math.PI * o, c = Math.min(Math.max(e, 0), 1);
|
|
815
|
+
return /* @__PURE__ */ p("div", {
|
|
816
|
+
role: "progressbar",
|
|
817
|
+
"aria-label": r,
|
|
818
|
+
"aria-valuemin": 0,
|
|
819
|
+
"aria-valuemax": 100,
|
|
820
|
+
"aria-valuenow": Math.round(c * 100),
|
|
821
|
+
className: h("zen__progress-ring relative grid shrink-0 place-items-center", a),
|
|
822
|
+
style: {
|
|
823
|
+
width: t,
|
|
824
|
+
height: t
|
|
825
|
+
},
|
|
826
|
+
children: [/* @__PURE__ */ p("svg", {
|
|
827
|
+
width: t,
|
|
828
|
+
height: t,
|
|
829
|
+
viewBox: `0 0 ${t} ${t}`,
|
|
830
|
+
className: "-rotate-90",
|
|
831
|
+
"aria-hidden": !0,
|
|
832
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
833
|
+
cx: t / 2,
|
|
834
|
+
cy: t / 2,
|
|
835
|
+
r: o,
|
|
836
|
+
fill: "none",
|
|
837
|
+
strokeWidth: n,
|
|
838
|
+
className: "stroke-tint/[0.07]"
|
|
839
|
+
}), /* @__PURE__ */ f("circle", {
|
|
840
|
+
cx: t / 2,
|
|
841
|
+
cy: t / 2,
|
|
842
|
+
r: o,
|
|
843
|
+
fill: "none",
|
|
844
|
+
strokeWidth: n,
|
|
845
|
+
strokeLinecap: "round",
|
|
846
|
+
strokeDasharray: s,
|
|
847
|
+
strokeDashoffset: s * (1 - c),
|
|
848
|
+
className: "stroke-primary [filter:drop-shadow(0_0_6px_oklch(var(--glow)/0.45))] transition-[stroke-dashoffset] duration-700 ease-out"
|
|
849
|
+
})]
|
|
850
|
+
}), /* @__PURE__ */ f("div", {
|
|
851
|
+
className: "absolute inset-0 grid place-items-center text-center",
|
|
852
|
+
children: i
|
|
853
|
+
})]
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region packages/segmented/index.tsx
|
|
858
|
+
function ue({ label: e, value: t, options: n, onChange: r, name: i, className: a }) {
|
|
859
|
+
let s = o();
|
|
860
|
+
return /* @__PURE__ */ p("div", {
|
|
861
|
+
className: h("zen__segmented flex flex-col gap-2", a),
|
|
862
|
+
children: [/* @__PURE__ */ f("span", {
|
|
863
|
+
id: s,
|
|
864
|
+
className: "text-sm font-medium",
|
|
865
|
+
children: e
|
|
866
|
+
}), /* @__PURE__ */ f("div", {
|
|
867
|
+
role: "radiogroup",
|
|
868
|
+
"aria-labelledby": s,
|
|
869
|
+
className: "border-tint/10 bg-tint/[0.03] inline-flex w-fit flex-wrap gap-1 rounded-xl border p-1",
|
|
870
|
+
children: n.map((e) => /* @__PURE__ */ p("label", {
|
|
871
|
+
className: h("text-muted-foreground cursor-pointer rounded-lg px-3 py-1.5 text-sm transition-[background-color,color,box-shadow] duration-200", "hover:text-foreground has-focus-visible:ring-ring/50 has-focus-visible:ring-2", "has-checked:bg-primary/15 has-checked:text-foreground has-checked:shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.4)]"),
|
|
872
|
+
children: [/* @__PURE__ */ f("input", {
|
|
873
|
+
type: "radio",
|
|
874
|
+
className: "sr-only",
|
|
875
|
+
name: i ?? s,
|
|
876
|
+
value: e.value,
|
|
877
|
+
checked: t === e.value,
|
|
878
|
+
onChange: () => r(e.value)
|
|
879
|
+
}), e.label]
|
|
880
|
+
}, e.value))
|
|
881
|
+
})]
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region packages/side-nav/index.tsx
|
|
886
|
+
function de({ className: e, ...t }) {
|
|
887
|
+
return /* @__PURE__ */ f("nav", {
|
|
888
|
+
className: h("zen__side-nav flex flex-col gap-6", e),
|
|
889
|
+
...t
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
function fe({ title: e, children: t, className: n }) {
|
|
893
|
+
return /* @__PURE__ */ p("div", {
|
|
894
|
+
className: h("flex flex-col gap-1", n),
|
|
895
|
+
children: [e && /* @__PURE__ */ f("span", {
|
|
896
|
+
className: "text-muted-foreground px-3 pb-1 text-[0.68rem] tracking-[0.1em] uppercase",
|
|
897
|
+
children: e
|
|
898
|
+
}), t]
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
var pe = h("rounded-lg px-3 py-1.5 text-sm outline-hidden transition-[background-color,color,box-shadow] duration-200", "text-muted-foreground hover:bg-tint/[0.05] hover:text-foreground focus-visible:ring-ring/50 focus-visible:ring-2", "aria-[current=page]:bg-primary/15 aria-[current=page]:text-foreground aria-[current=page]:shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.25)]");
|
|
902
|
+
function me({ active: e, asChild: t, className: n, children: r, ...i }) {
|
|
903
|
+
let a = {
|
|
904
|
+
...i,
|
|
905
|
+
"aria-current": e ? "page" : void 0,
|
|
906
|
+
className: h(pe, n)
|
|
907
|
+
};
|
|
908
|
+
return t ? (e || delete a["aria-current"], /* @__PURE__ */ f(V, {
|
|
909
|
+
...a,
|
|
910
|
+
children: r
|
|
911
|
+
})) : /* @__PURE__ */ f("a", {
|
|
912
|
+
...a,
|
|
913
|
+
children: r
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
//#endregion
|
|
917
|
+
//#region packages/skeleton/index.tsx
|
|
918
|
+
function he({ className: e }) {
|
|
919
|
+
return /* @__PURE__ */ f("span", {
|
|
920
|
+
"aria-hidden": !0,
|
|
921
|
+
className: h("zen__skeleton block rounded-md", e)
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
//#endregion
|
|
925
|
+
//#region packages/table/index.tsx
|
|
926
|
+
function ge({ className: e, ...t }) {
|
|
927
|
+
return /* @__PURE__ */ f("div", {
|
|
928
|
+
className: "zen__table glass glow-edge overflow-x-auto rounded-xl",
|
|
929
|
+
children: /* @__PURE__ */ f("table", {
|
|
930
|
+
className: h("w-full text-left text-sm", e),
|
|
931
|
+
...t
|
|
932
|
+
})
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
function _e({ className: e, ...t }) {
|
|
936
|
+
return /* @__PURE__ */ f("thead", {
|
|
937
|
+
className: h("border-tint/[0.07] text-muted-foreground border-b text-[0.68rem] tracking-[0.1em] uppercase", e),
|
|
938
|
+
...t
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
function ve({ className: e, ...t }) {
|
|
942
|
+
return /* @__PURE__ */ f("tbody", {
|
|
943
|
+
className: h("divide-tint/[0.07] divide-y", e),
|
|
944
|
+
...t
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
function ye({ className: e, ...t }) {
|
|
948
|
+
return /* @__PURE__ */ f("tr", {
|
|
949
|
+
className: h("hover:bg-tint/[0.02] align-top transition-colors", e),
|
|
950
|
+
...t
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
function be({ className: e, ...t }) {
|
|
954
|
+
return /* @__PURE__ */ f("th", {
|
|
955
|
+
className: h("px-4 py-3 font-medium", e),
|
|
956
|
+
...t
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
function xe({ className: e, ...t }) {
|
|
960
|
+
return /* @__PURE__ */ f("td", {
|
|
961
|
+
className: h("px-4 py-3", e),
|
|
962
|
+
...t
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region packages/table-of-contents/index.tsx
|
|
967
|
+
function Se({ items: e, title: t = "On this page", className: n }) {
|
|
968
|
+
let [r, i] = u();
|
|
969
|
+
return a(() => {
|
|
970
|
+
if (typeof IntersectionObserver > "u") return;
|
|
971
|
+
let t = e.map((e) => document.getElementById(e.id)).filter((e) => !!e), n = /* @__PURE__ */ new Set(), r = new IntersectionObserver((t) => {
|
|
972
|
+
for (let e of t) e.isIntersecting ? n.add(e.target.id) : n.delete(e.target.id);
|
|
973
|
+
let r = e.find((e) => n.has(e.id));
|
|
974
|
+
r && i(r.id);
|
|
975
|
+
}, { rootMargin: "0px 0px -65% 0px" });
|
|
976
|
+
return t.forEach((e) => r.observe(e)), () => r.disconnect();
|
|
977
|
+
}, [e]), e.length ? /* @__PURE__ */ p("nav", {
|
|
978
|
+
"aria-label": t,
|
|
979
|
+
className: h("zen__toc flex flex-col gap-3", n),
|
|
980
|
+
children: [/* @__PURE__ */ f("p", {
|
|
981
|
+
className: "text-muted-foreground mt-0! text-[0.68rem] tracking-[0.1em] uppercase",
|
|
982
|
+
children: t
|
|
983
|
+
}), /* @__PURE__ */ f("ul", {
|
|
984
|
+
className: "border-tint/[0.07] flex flex-col gap-2 border-l text-sm",
|
|
985
|
+
children: e.map((e) => /* @__PURE__ */ f("li", {
|
|
986
|
+
className: h("-ml-px", e.depth === 2 && "pl-3"),
|
|
987
|
+
children: /* @__PURE__ */ f("a", {
|
|
988
|
+
href: `#${e.id}`,
|
|
989
|
+
"aria-current": e.id === r ? "location" : void 0,
|
|
990
|
+
className: h("text-muted-foreground hover:text-foreground block border-l border-transparent pl-3 transition-colors", "aria-[current=location]:border-primary aria-[current=location]:text-foreground"),
|
|
991
|
+
children: e.label
|
|
992
|
+
})
|
|
993
|
+
}, e.id))
|
|
994
|
+
})]
|
|
995
|
+
}) : null;
|
|
996
|
+
}
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region packages/tabs/index.tsx
|
|
999
|
+
var q = t(null);
|
|
1000
|
+
function J(e) {
|
|
1001
|
+
let t = i(q);
|
|
1002
|
+
if (!t) throw Error(`<${e}> must be inside <Tabs>`);
|
|
1003
|
+
return t;
|
|
1004
|
+
}
|
|
1005
|
+
function Ce({ value: e, defaultValue: t = "", onValueChange: n, className: r, ...i }) {
|
|
1006
|
+
let [a, s] = u(t), c = e ?? a, l = o();
|
|
1007
|
+
return /* @__PURE__ */ f(q.Provider, {
|
|
1008
|
+
value: {
|
|
1009
|
+
value: c,
|
|
1010
|
+
select: (t) => {
|
|
1011
|
+
e === void 0 && s(t), n?.(t);
|
|
1012
|
+
},
|
|
1013
|
+
idFor: (e, t) => `${l}-${e}-${t.replace(/\s+/g, "-")}`
|
|
1014
|
+
},
|
|
1015
|
+
children: /* @__PURE__ */ f("div", {
|
|
1016
|
+
className: h("zen__tabs flex flex-col gap-4", r),
|
|
1017
|
+
...i
|
|
1018
|
+
})
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
var Y = t("underline");
|
|
1022
|
+
function we({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
1023
|
+
let { value: i } = J("TabList"), a = e === "pills", o = l(null), [c, d] = u({
|
|
1024
|
+
left: 0,
|
|
1025
|
+
width: 0
|
|
1026
|
+
});
|
|
1027
|
+
return s(() => {
|
|
1028
|
+
let e = o.current;
|
|
1029
|
+
if (!e) return;
|
|
1030
|
+
let t = () => {
|
|
1031
|
+
let t = e.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
|
|
1032
|
+
d(t ? {
|
|
1033
|
+
left: t.offsetLeft,
|
|
1034
|
+
width: t.offsetWidth
|
|
1035
|
+
} : {
|
|
1036
|
+
left: 0,
|
|
1037
|
+
width: 0
|
|
1038
|
+
});
|
|
1039
|
+
};
|
|
1040
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
1041
|
+
let n = new ResizeObserver(t);
|
|
1042
|
+
return n.observe(e), () => n.disconnect();
|
|
1043
|
+
}, [i]), /* @__PURE__ */ p("div", {
|
|
1044
|
+
ref: o,
|
|
1045
|
+
role: "tablist",
|
|
1046
|
+
onKeyDown: (e) => {
|
|
1047
|
+
let t = Array.from(o.current?.querySelectorAll("[role=\"tab\"]:not(:disabled)") ?? []), n = t.indexOf(document.activeElement);
|
|
1048
|
+
if (n === -1) return;
|
|
1049
|
+
let r = {
|
|
1050
|
+
ArrowRight: n + 1,
|
|
1051
|
+
ArrowLeft: n - 1,
|
|
1052
|
+
Home: 0,
|
|
1053
|
+
End: t.length - 1
|
|
1054
|
+
}[e.key];
|
|
1055
|
+
if (r === void 0) return;
|
|
1056
|
+
e.preventDefault();
|
|
1057
|
+
let i = t[(r + t.length) % t.length];
|
|
1058
|
+
i.focus(), i.click();
|
|
1059
|
+
},
|
|
1060
|
+
className: h(a ? O : "border-border relative flex gap-1 border-b", t),
|
|
1061
|
+
...r,
|
|
1062
|
+
children: [/* @__PURE__ */ f(Y.Provider, {
|
|
1063
|
+
value: e,
|
|
1064
|
+
children: n
|
|
1065
|
+
}), a ? c.width > 0 && /* @__PURE__ */ f("span", {
|
|
1066
|
+
"aria-hidden": !0,
|
|
1067
|
+
className: "absolute top-1 bottom-1 left-0 rounded-full bg-primary/15 shadow-[inset_0_0_0_1px_oklch(var(--glow)/0.35),0_0_24px_-4px_oklch(var(--glow)/0.6)] transition-[translate,width] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
|
|
1068
|
+
style: {
|
|
1069
|
+
width: c.width,
|
|
1070
|
+
translate: `${c.left}px 0`
|
|
1071
|
+
}
|
|
1072
|
+
}) : /* @__PURE__ */ f("span", {
|
|
1073
|
+
"aria-hidden": !0,
|
|
1074
|
+
className: "bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
|
|
1075
|
+
style: {
|
|
1076
|
+
width: c.width,
|
|
1077
|
+
translate: `${c.left}px 0`
|
|
1078
|
+
}
|
|
1079
|
+
})]
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
function Te({ value: e, className: t, onClick: n, ...r }) {
|
|
1083
|
+
let { value: a, select: o, idFor: s } = J("Tab"), c = i(Y), l = a === e;
|
|
1084
|
+
return /* @__PURE__ */ f("button", {
|
|
1085
|
+
type: "button",
|
|
1086
|
+
role: "tab",
|
|
1087
|
+
id: s("tab", e),
|
|
1088
|
+
"aria-selected": l,
|
|
1089
|
+
"aria-controls": s("panel", e),
|
|
1090
|
+
tabIndex: l ? 0 : -1,
|
|
1091
|
+
"data-active": l || void 0,
|
|
1092
|
+
onClick: (t) => {
|
|
1093
|
+
o(e), n?.(t);
|
|
1094
|
+
},
|
|
1095
|
+
className: h(c === "pills" ? A : "focus-visible:ring-ring px-3 py-2 text-sm whitespace-nowrap outline-hidden select-none focus-visible:ring-1", "text-muted-foreground hover:text-foreground data-active:text-foreground", t),
|
|
1096
|
+
...r
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
function Ee({ value: e, className: t, ...n }) {
|
|
1100
|
+
let { value: r, idFor: i } = J("TabPanel");
|
|
1101
|
+
return r === e ? /* @__PURE__ */ f("div", {
|
|
1102
|
+
role: "tabpanel",
|
|
1103
|
+
id: i("panel", e),
|
|
1104
|
+
"aria-labelledby": i("tab", e),
|
|
1105
|
+
tabIndex: 0,
|
|
1106
|
+
className: h("outline-hidden", t),
|
|
1107
|
+
...n
|
|
1108
|
+
}) : null;
|
|
1109
|
+
}
|
|
1110
|
+
//#endregion
|
|
894
1111
|
//#region packages/textarea/index.tsx
|
|
895
|
-
function
|
|
1112
|
+
function De(e) {
|
|
896
1113
|
let { className: t, ...n } = e;
|
|
897
|
-
return /* @__PURE__ */
|
|
898
|
-
className:
|
|
1114
|
+
return /* @__PURE__ */ f("textarea", {
|
|
1115
|
+
className: h(D.replace("h-10", ""), "h-32 w-full resize-y py-2", "read-only:text-foreground read-only:cursor-default read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", t),
|
|
899
1116
|
...n
|
|
900
1117
|
});
|
|
901
1118
|
}
|
|
902
1119
|
//#endregion
|
|
1120
|
+
//#region packages/toast/index.tsx
|
|
1121
|
+
var Oe = 5e3, ke = 300, X = t(null);
|
|
1122
|
+
function Z({ children: e }) {
|
|
1123
|
+
let [t, n] = u([]), [i, o] = u(!1), s = l(0);
|
|
1124
|
+
a(() => o(!0), []);
|
|
1125
|
+
let c = r((e) => {
|
|
1126
|
+
n((t) => t.map((t) => t.id === e ? {
|
|
1127
|
+
...t,
|
|
1128
|
+
leaving: !0
|
|
1129
|
+
} : t)), setTimeout(() => n((t) => t.filter((t) => t.id !== e)), ke);
|
|
1130
|
+
}, []), d = r((e, { description: t, tone: r = "info", action: i, timeout: a } = {}) => {
|
|
1131
|
+
let o = s.current++, c = {
|
|
1132
|
+
id: o,
|
|
1133
|
+
title: e,
|
|
1134
|
+
description: t,
|
|
1135
|
+
tone: r,
|
|
1136
|
+
action: i,
|
|
1137
|
+
timeout: a ?? (i ? 1e4 : Oe)
|
|
1138
|
+
};
|
|
1139
|
+
return n((e) => [...e, c]), o;
|
|
1140
|
+
}, []), h = t.slice(-3);
|
|
1141
|
+
return /* @__PURE__ */ p(X.Provider, {
|
|
1142
|
+
value: d,
|
|
1143
|
+
children: [e, i && m(/* @__PURE__ */ f("section", {
|
|
1144
|
+
"aria-label": "Notifications",
|
|
1145
|
+
className: "zen__toast-viewport fixed right-4 bottom-[calc(1rem+env(safe-area-inset-bottom))] z-50 flex w-[calc(100vw-2rem)] flex-col-reverse gap-2.5 md:bottom-5 md:w-[24rem]",
|
|
1146
|
+
children: h.map((e) => /* @__PURE__ */ f(je, {
|
|
1147
|
+
toast: e,
|
|
1148
|
+
onDismiss: () => c(e.id)
|
|
1149
|
+
}, e.id))
|
|
1150
|
+
}), document.body)]
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
function Ae() {
|
|
1154
|
+
let e = i(X);
|
|
1155
|
+
if (!e) throw Error("useToast() needs a <ToastProvider> above it");
|
|
1156
|
+
return e;
|
|
1157
|
+
}
|
|
1158
|
+
var Q = {
|
|
1159
|
+
success: {
|
|
1160
|
+
icon: Me,
|
|
1161
|
+
ring: "border-primary/30",
|
|
1162
|
+
badge: "bg-primary/15 text-primary",
|
|
1163
|
+
bar: "bg-primary",
|
|
1164
|
+
glow: "shadow-[0_18px_50px_-18px_oklch(var(--glow)/0.55)]"
|
|
1165
|
+
},
|
|
1166
|
+
error: {
|
|
1167
|
+
icon: Ne,
|
|
1168
|
+
ring: "border-destructive/40",
|
|
1169
|
+
badge: "bg-destructive/15 text-destructive",
|
|
1170
|
+
bar: "bg-destructive",
|
|
1171
|
+
glow: "shadow-[0_18px_50px_-18px_oklch(var(--destructive)/0.55)]"
|
|
1172
|
+
},
|
|
1173
|
+
info: {
|
|
1174
|
+
icon: Pe,
|
|
1175
|
+
ring: "border-tint/10",
|
|
1176
|
+
badge: "bg-tint/[0.08] text-foreground",
|
|
1177
|
+
bar: "bg-muted-foreground",
|
|
1178
|
+
glow: "shadow-[var(--toast-shadow)]"
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
function je({ toast: e, onDismiss: t }) {
|
|
1182
|
+
let n = Q[e.tone] ?? Q.info, r = n.icon, [i, o] = u(!1), s = l(e.timeout);
|
|
1183
|
+
return a(() => {
|
|
1184
|
+
if (!e.timeout || i || e.leaving) return;
|
|
1185
|
+
let n = Date.now(), r = setTimeout(t, s.current);
|
|
1186
|
+
return () => {
|
|
1187
|
+
clearTimeout(r), s.current -= Date.now() - n;
|
|
1188
|
+
};
|
|
1189
|
+
}, [
|
|
1190
|
+
i,
|
|
1191
|
+
e.timeout,
|
|
1192
|
+
e.leaving,
|
|
1193
|
+
t
|
|
1194
|
+
]), /* @__PURE__ */ p("div", {
|
|
1195
|
+
role: e.tone === "error" ? "alert" : "status",
|
|
1196
|
+
"aria-atomic": "true",
|
|
1197
|
+
onMouseEnter: () => o(!0),
|
|
1198
|
+
onMouseLeave: () => o(!1),
|
|
1199
|
+
className: h("zen__toast group glass glass-blur text-card-foreground relative flex items-start gap-3 overflow-hidden rounded-2xl border p-3.5 pr-10 select-none", "transition-[transform,opacity] duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]", "starting:translate-y-3 starting:scale-[0.97] starting:opacity-0", e.leaving && "translate-x-6 opacity-0", n.ring, n.glow),
|
|
1200
|
+
children: [
|
|
1201
|
+
/* @__PURE__ */ f("span", {
|
|
1202
|
+
className: h("mt-0.5 grid size-8 shrink-0 place-items-center rounded-full", n.badge),
|
|
1203
|
+
"aria-hidden": !0,
|
|
1204
|
+
children: /* @__PURE__ */ f(r, { className: "size-4" })
|
|
1205
|
+
}),
|
|
1206
|
+
/* @__PURE__ */ p("div", {
|
|
1207
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5 pt-0.5",
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ f("div", {
|
|
1210
|
+
className: "text-sm font-semibold",
|
|
1211
|
+
children: e.title
|
|
1212
|
+
}),
|
|
1213
|
+
e.description && /* @__PURE__ */ f("div", {
|
|
1214
|
+
className: "text-muted-foreground text-sm leading-5",
|
|
1215
|
+
children: e.description
|
|
1216
|
+
}),
|
|
1217
|
+
e.action && /* @__PURE__ */ f("button", {
|
|
1218
|
+
type: "button",
|
|
1219
|
+
onClick: () => {
|
|
1220
|
+
e.action?.onClick(), t();
|
|
1221
|
+
},
|
|
1222
|
+
className: "border-tint/10 bg-tint/[0.06] hover:bg-tint/[0.12] focus-visible:ring-ring/50 mt-2 self-start rounded-lg border px-3 py-1 text-xs font-medium outline-hidden transition-colors focus-visible:ring-2",
|
|
1223
|
+
children: e.action.label
|
|
1224
|
+
})
|
|
1225
|
+
]
|
|
1226
|
+
}),
|
|
1227
|
+
/* @__PURE__ */ f("button", {
|
|
1228
|
+
type: "button",
|
|
1229
|
+
"aria-label": "Dismiss",
|
|
1230
|
+
onClick: t,
|
|
1231
|
+
className: "text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 grid size-7 place-items-center rounded-lg outline-hidden transition-colors focus-visible:ring-2",
|
|
1232
|
+
children: /* @__PURE__ */ f("svg", {
|
|
1233
|
+
viewBox: "0 0 16 16",
|
|
1234
|
+
fill: "none",
|
|
1235
|
+
stroke: "currentColor",
|
|
1236
|
+
strokeWidth: "1.8",
|
|
1237
|
+
strokeLinecap: "round",
|
|
1238
|
+
className: "size-3.5",
|
|
1239
|
+
"aria-hidden": !0,
|
|
1240
|
+
children: /* @__PURE__ */ f("path", { d: "m4 4 8 8M12 4l-8 8" })
|
|
1241
|
+
})
|
|
1242
|
+
}),
|
|
1243
|
+
e.timeout > 0 && /* @__PURE__ */ f("span", {
|
|
1244
|
+
"aria-hidden": !0,
|
|
1245
|
+
className: h("zen__toast-timer absolute bottom-0 left-0 h-0.5 w-full origin-left opacity-60 group-hover:[animation-play-state:paused]", n.bar),
|
|
1246
|
+
style: { animationDuration: `${e.timeout}ms` }
|
|
1247
|
+
})
|
|
1248
|
+
]
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
function Me({ className: e }) {
|
|
1252
|
+
return /* @__PURE__ */ f("svg", {
|
|
1253
|
+
viewBox: "0 0 16 16",
|
|
1254
|
+
fill: "none",
|
|
1255
|
+
stroke: "currentColor",
|
|
1256
|
+
strokeWidth: "2",
|
|
1257
|
+
strokeLinecap: "round",
|
|
1258
|
+
strokeLinejoin: "round",
|
|
1259
|
+
className: h("size-3.5", e),
|
|
1260
|
+
"aria-hidden": !0,
|
|
1261
|
+
children: /* @__PURE__ */ f("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
function Ne({ className: e }) {
|
|
1265
|
+
return /* @__PURE__ */ p("svg", {
|
|
1266
|
+
viewBox: "0 0 16 16",
|
|
1267
|
+
fill: "none",
|
|
1268
|
+
stroke: "currentColor",
|
|
1269
|
+
strokeWidth: "1.8",
|
|
1270
|
+
strokeLinecap: "round",
|
|
1271
|
+
strokeLinejoin: "round",
|
|
1272
|
+
className: h("size-3.5", e),
|
|
1273
|
+
"aria-hidden": !0,
|
|
1274
|
+
children: [/* @__PURE__ */ f("path", { d: "M8 2.2 1.6 13.3h12.8L8 2.2Z" }), /* @__PURE__ */ f("path", { d: "M8 6.5v3M8 11.6v.1" })]
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
function Pe({ className: e }) {
|
|
1278
|
+
return /* @__PURE__ */ p("svg", {
|
|
1279
|
+
viewBox: "0 0 16 16",
|
|
1280
|
+
fill: "none",
|
|
1281
|
+
stroke: "currentColor",
|
|
1282
|
+
strokeWidth: "1.8",
|
|
1283
|
+
strokeLinecap: "round",
|
|
1284
|
+
className: h("size-3.5", e),
|
|
1285
|
+
"aria-hidden": !0,
|
|
1286
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
1287
|
+
cx: "8",
|
|
1288
|
+
cy: "8",
|
|
1289
|
+
r: "6.3"
|
|
1290
|
+
}), /* @__PURE__ */ f("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
//#endregion
|
|
903
1294
|
//#region packages/toggle/index.tsx
|
|
904
|
-
function
|
|
905
|
-
let { className: t,
|
|
906
|
-
return /* @__PURE__ */
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
tabIndex: 0,
|
|
910
|
-
className: u("relative inline-flex h-5 w-10 shrink-0 cursor-pointer items-center rounded-full", "border-primary bg-secondary dark:bg-muted border", "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", "transition-colors duration-300 ease-in-out", t),
|
|
911
|
-
onClick: () => i?.(!r),
|
|
912
|
-
onKeyDown: (e) => {
|
|
913
|
-
(e.key === " " || e.key === "Enter") && (e.preventDefault(), i?.(!r));
|
|
914
|
-
},
|
|
915
|
-
children: [/* @__PURE__ */ s("input", {
|
|
1295
|
+
function Fe(e) {
|
|
1296
|
+
let { className: t, onChange: n, disabled: r, ...i } = e;
|
|
1297
|
+
return /* @__PURE__ */ p("label", {
|
|
1298
|
+
className: h("zen__toggle border-tint/10 bg-tint/[0.06] relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border p-0.5", "has-focus-visible:ring-glow/50 transition-[background-color,box-shadow,border-color] duration-300 has-focus-visible:ring-2", "has-checked:border-glow/60 has-checked:bg-glow/40 has-checked:shadow-[0_0_18px_-2px_oklch(var(--glow)/0.8)]", "has-disabled:cursor-not-allowed has-disabled:opacity-50", t),
|
|
1299
|
+
children: [/* @__PURE__ */ f("input", {
|
|
916
1300
|
type: "checkbox",
|
|
917
|
-
|
|
918
|
-
className: "sr-only",
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1301
|
+
role: "switch",
|
|
1302
|
+
className: "peer sr-only",
|
|
1303
|
+
disabled: r,
|
|
1304
|
+
onChange: (e) => n?.(e.target.checked),
|
|
1305
|
+
...i
|
|
1306
|
+
}), /* @__PURE__ */ f("span", {
|
|
1307
|
+
"aria-hidden": !0,
|
|
1308
|
+
className: h("size-[1.125rem] rounded-full bg-white/70 shadow-md", "transition-[translate,background-color] duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]", "peer-checked:translate-x-5 peer-checked:bg-white")
|
|
1309
|
+
})]
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
//#endregion
|
|
1313
|
+
//#region packages/theme-toggle/index.tsx
|
|
1314
|
+
var $ = (e = "theme") => `try{var t=localStorage.getItem(${JSON.stringify(e)}),r=document.documentElement;if(t==='light'||t==='dark'){r.classList.remove('light','dark');r.classList.add(t)}}catch(e){}`;
|
|
1315
|
+
function Ie({ storageKey: e = "theme" }) {
|
|
1316
|
+
return /* @__PURE__ */ f("script", { dangerouslySetInnerHTML: { __html: $(e) } });
|
|
1317
|
+
}
|
|
1318
|
+
function Le({ storageKey: e = "theme", className: t }) {
|
|
1319
|
+
let [n, r] = u("dark");
|
|
1320
|
+
a(() => r(document.documentElement.classList.contains("light") ? "light" : "dark"), []);
|
|
1321
|
+
let i = n === "dark" ? "light" : "dark";
|
|
1322
|
+
return /* @__PURE__ */ f("button", {
|
|
1323
|
+
type: "button",
|
|
1324
|
+
"aria-label": `Switch to ${i} theme`,
|
|
1325
|
+
onClick: () => {
|
|
1326
|
+
let t = document.documentElement;
|
|
1327
|
+
t.classList.remove("dark", "light"), t.classList.add(i);
|
|
1328
|
+
try {
|
|
1329
|
+
localStorage.setItem(e, i);
|
|
1330
|
+
} catch {}
|
|
1331
|
+
r(i);
|
|
1332
|
+
},
|
|
1333
|
+
className: h("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground focus-visible:ring-ring/50 grid size-9 place-items-center rounded-lg outline-hidden focus-visible:ring-2", t),
|
|
1334
|
+
children: /* @__PURE__ */ f("svg", {
|
|
1335
|
+
viewBox: "0 0 16 16",
|
|
1336
|
+
fill: "none",
|
|
1337
|
+
stroke: "currentColor",
|
|
1338
|
+
strokeWidth: "1.5",
|
|
1339
|
+
strokeLinecap: "round",
|
|
1340
|
+
className: "size-4",
|
|
1341
|
+
"aria-hidden": !0,
|
|
1342
|
+
children: n === "dark" ? /* @__PURE__ */ f("path", { d: "M13.5 9.5A5.5 5.5 0 0 1 6.5 2.5a5.5 5.5 0 1 0 7 7Z" }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("circle", {
|
|
1343
|
+
cx: "8",
|
|
1344
|
+
cy: "8",
|
|
1345
|
+
r: "3"
|
|
1346
|
+
}), /* @__PURE__ */ f("path", { d: "M8 1v1.5M8 13.5V15M1 8h1.5M13.5 8H15M3.05 3.05l1.06 1.06M11.89 11.89l1.06 1.06M3.05 12.95l1.06-1.06M11.89 4.11l1.06-1.06" })] })
|
|
1347
|
+
})
|
|
925
1348
|
});
|
|
926
1349
|
}
|
|
927
1350
|
//#endregion
|
|
928
|
-
export {
|
|
1351
|
+
export { _ as ActionsMenu, v as Backdrop, x as Badge, w as Button, ee as Card, R as ChevronDown, z as ChevronUp, ne as CodeBlock, M as Collapse, ae as ConfirmDialog, N as Dialog, F as Dropdown, L as Header, B as Input, K as NavPill, W as NavPillIndicator, U as NavPills, ce as PageHeader, j as Popover, le as ProgressRing, P as Search, ue as Segmented, de as SideNav, fe as SideNavGroup, me as SideNavLink, he as Skeleton, C as Spinner, E as Stat, te as StatRow, Te as Tab, we as TabList, Ee as TabPanel, ge as Table, ve as TableBody, xe as TableCell, be as TableHead, _e as TableHeader, Se as TableOfContents, ye as TableRow, Ce as Tabs, De as TextArea, Ie as ThemeScript, Le as ThemeToggle, Z as ToastProvider, Fe as Toggle, T as buttonVariants, b as cva, h as cx, $ as themeScript, Ae as useToast };
|