@rinzai/zen 0.3.0 → 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/code-block/index.d.ts +19 -0
- package/dist/code-block/index.d.ts.map +1 -0
- package/dist/dropdown/index.d.ts.map +1 -1
- package/dist/header/index.d.ts +8 -0
- package/dist/header/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/nav-pills/index.d.ts.map +1 -1
- package/dist/page-header/index.d.ts +12 -0
- package/dist/page-header/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/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/theme-toggle/index.d.ts +20 -0
- package/dist/theme-toggle/index.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/useVirtualList.d.ts +26 -0
- package/dist/utils/useVirtualList.d.ts.map +1 -0
- package/dist/zen.css +1 -1
- package/dist/zen.js +572 -1142
- package/package.json +2 -4
package/dist/zen.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createPortal as h, flushSync as g } from "react-dom";
|
|
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";
|
|
6
5
|
//#region packages/utils/cx.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let r = `zen__menu-${
|
|
10
|
-
return /* @__PURE__ */
|
|
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", {
|
|
11
10
|
type: "button",
|
|
12
11
|
"aria-label": e,
|
|
13
12
|
"aria-haspopup": "menu",
|
|
14
13
|
popoverTarget: r,
|
|
15
|
-
className:
|
|
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),
|
|
16
15
|
style: { anchorName: `--${r}` },
|
|
17
|
-
children: /* @__PURE__ */
|
|
16
|
+
children: /* @__PURE__ */ p("svg", {
|
|
18
17
|
viewBox: "0 0 16 16",
|
|
19
18
|
fill: "currentColor",
|
|
20
19
|
className: "size-4",
|
|
21
20
|
"aria-hidden": !0,
|
|
22
21
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ f("circle", {
|
|
24
23
|
cx: "3",
|
|
25
24
|
cy: "8",
|
|
26
25
|
r: "1.4"
|
|
27
26
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ f("circle", {
|
|
29
28
|
cx: "8",
|
|
30
29
|
cy: "8",
|
|
31
30
|
r: "1.4"
|
|
32
31
|
}),
|
|
33
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ f("circle", {
|
|
34
33
|
cx: "13",
|
|
35
34
|
cy: "8",
|
|
36
35
|
r: "1.4"
|
|
37
36
|
})
|
|
38
37
|
]
|
|
39
38
|
})
|
|
40
|
-
}), /* @__PURE__ */
|
|
39
|
+
}), /* @__PURE__ */ f("div", {
|
|
41
40
|
ref: i,
|
|
42
41
|
id: r,
|
|
43
42
|
popover: "auto",
|
|
@@ -56,17 +55,17 @@ function y({ label: e, actions: t, className: n }) {
|
|
|
56
55
|
onToggle: (e) => {
|
|
57
56
|
e.nativeEvent.newState === "open" && i.current?.focus();
|
|
58
57
|
},
|
|
59
|
-
className:
|
|
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]"),
|
|
60
59
|
style: {
|
|
61
60
|
positionAnchor: `--${r}`,
|
|
62
61
|
inset: "auto",
|
|
63
62
|
margin: "6px 0"
|
|
64
63
|
},
|
|
65
|
-
children: a.map((e) => /* @__PURE__ */
|
|
64
|
+
children: a.map((e) => /* @__PURE__ */ f("button", {
|
|
66
65
|
type: "button",
|
|
67
66
|
role: "menuitem",
|
|
68
67
|
tabIndex: -1,
|
|
69
|
-
className:
|
|
68
|
+
className: h(g, e.destructive && "text-destructive hover:bg-destructive/10 focus:bg-destructive/10"),
|
|
70
69
|
onClick: () => {
|
|
71
70
|
i.current?.hidePopover?.(), e.onClick();
|
|
72
71
|
},
|
|
@@ -76,9 +75,9 @@ function y({ label: e, actions: t, className: n }) {
|
|
|
76
75
|
}
|
|
77
76
|
//#endregion
|
|
78
77
|
//#region packages/backdrop/index.tsx
|
|
79
|
-
function
|
|
78
|
+
function v({ pattern: e, topoSrc: t }) {
|
|
80
79
|
let n = e ?? (t ? "contours" : "dots");
|
|
81
|
-
return
|
|
80
|
+
return a(() => {
|
|
82
81
|
let e = document.documentElement, t = 0, n = -9999, r = -9999, i = /* @__PURE__ */ new WeakSet(), a = !0, o = () => {
|
|
83
82
|
t = 0, e.dataset.pointer = a ? "out" : "in", a || (e.style.setProperty("--mx", `${n}px`), e.style.setProperty("--my", `${r}px`));
|
|
84
83
|
let o = Array.from(document.querySelectorAll(".glow-edge")), s = o.map((e) => e.getBoundingClientRect());
|
|
@@ -99,31 +98,31 @@ function b({ pattern: e, topoSrc: t }) {
|
|
|
99
98
|
}), window.addEventListener("resize", s, { passive: !0 }), () => {
|
|
100
99
|
window.removeEventListener("pointermove", c), e.removeEventListener("pointerleave", l), window.removeEventListener("scroll", s, { capture: !0 }), window.removeEventListener("resize", s), cancelAnimationFrame(t);
|
|
101
100
|
};
|
|
102
|
-
}, []), /* @__PURE__ */
|
|
101
|
+
}, []), /* @__PURE__ */ p("div", {
|
|
103
102
|
className: "zen-backdrop",
|
|
104
103
|
"aria-hidden": !0,
|
|
105
104
|
style: t ? { "--zen-topo": `url("${t}")` } : void 0,
|
|
106
105
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
n === "contours" ? /* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
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" })
|
|
114
113
|
] }),
|
|
115
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ f("div", { className: "zen-vignette" })
|
|
116
115
|
]
|
|
117
116
|
});
|
|
118
117
|
}
|
|
119
118
|
//#endregion
|
|
120
119
|
//#region packages/utils/cva.ts
|
|
121
|
-
var
|
|
122
|
-
if (t?.variants == null) return
|
|
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);
|
|
123
122
|
let { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((e) => {
|
|
124
123
|
let t = n?.[e], a = i?.[e];
|
|
125
124
|
if (t === null) return null;
|
|
126
|
-
let o =
|
|
125
|
+
let o = y(t) || y(a);
|
|
127
126
|
return r[e][o];
|
|
128
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({
|
|
129
128
|
...i,
|
|
@@ -136,20 +135,20 @@ var x = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, S = (e, t) =>
|
|
|
136
135
|
t,
|
|
137
136
|
n
|
|
138
137
|
] : e, []);
|
|
139
|
-
return
|
|
138
|
+
return h(e, a, s, n?.class, n?.className);
|
|
140
139
|
};
|
|
141
140
|
//#endregion
|
|
142
141
|
//#region packages/badge/index.tsx
|
|
143
|
-
function
|
|
144
|
-
return /* @__PURE__ */
|
|
142
|
+
function x({ variant: e, className: t, ...n }) {
|
|
143
|
+
return /* @__PURE__ */ f("span", {
|
|
145
144
|
...n,
|
|
146
|
-
className:
|
|
145
|
+
className: S({
|
|
147
146
|
variant: e,
|
|
148
147
|
className: t
|
|
149
148
|
})
|
|
150
149
|
});
|
|
151
150
|
}
|
|
152
|
-
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", {
|
|
153
152
|
variants: { variant: {
|
|
154
153
|
default: "border-glow/30 bg-glow/10 text-primary",
|
|
155
154
|
secondary: "border-tint/10 bg-tint/[0.06] text-foreground",
|
|
@@ -160,28 +159,28 @@ var w = S("zen__badge inline-flex items-center rounded-md border px-1.5 py-0.5 t
|
|
|
160
159
|
});
|
|
161
160
|
//#endregion
|
|
162
161
|
//#region packages/spinner/index.tsx
|
|
163
|
-
function
|
|
164
|
-
return /* @__PURE__ */
|
|
162
|
+
function C({ className: e }) {
|
|
163
|
+
return /* @__PURE__ */ f("span", {
|
|
165
164
|
"aria-hidden": !0,
|
|
166
|
-
className:
|
|
165
|
+
className: h("zen__spinner inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent", e)
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
168
|
//#endregion
|
|
170
169
|
//#region packages/button/index.tsx
|
|
171
|
-
function
|
|
172
|
-
return /* @__PURE__ */
|
|
170
|
+
function w({ className: e, variant: t, size: n, loading: r = !1, disabled: i, children: a, ...o }) {
|
|
171
|
+
return /* @__PURE__ */ p("button", {
|
|
173
172
|
disabled: i || r,
|
|
174
173
|
"aria-busy": r || void 0,
|
|
175
|
-
className:
|
|
174
|
+
className: T({
|
|
176
175
|
variant: t,
|
|
177
176
|
size: n,
|
|
178
177
|
className: e
|
|
179
178
|
}),
|
|
180
179
|
...o,
|
|
181
|
-
children: [r && /* @__PURE__ */
|
|
180
|
+
children: [r && /* @__PURE__ */ f(C, {}), a]
|
|
182
181
|
});
|
|
183
182
|
}
|
|
184
|
-
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", {
|
|
185
184
|
variants: {
|
|
186
185
|
variant: {
|
|
187
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)]",
|
|
@@ -207,51 +206,82 @@ var D = S("zen__button inline-flex items-center justify-center gap-2 rounded-lg
|
|
|
207
206
|
//#endregion
|
|
208
207
|
//#region packages/card/index.tsx
|
|
209
208
|
function ee({ title: e, action: t, children: n, className: r, ...i }) {
|
|
210
|
-
return /* @__PURE__ */
|
|
211
|
-
className:
|
|
209
|
+
return /* @__PURE__ */ p("section", {
|
|
210
|
+
className: h("zen__card glass glow-edge text-card-foreground rounded-xl p-4 md:p-5", r),
|
|
212
211
|
...i,
|
|
213
|
-
children: [(e || t) && /* @__PURE__ */
|
|
212
|
+
children: [(e || t) && /* @__PURE__ */ p("header", {
|
|
214
213
|
className: "mb-4 flex items-center justify-between gap-4",
|
|
215
|
-
children: [e && /* @__PURE__ */
|
|
214
|
+
children: [e && /* @__PURE__ */ f("h4", {
|
|
216
215
|
className: "text-base tracking-tight",
|
|
217
216
|
children: e
|
|
218
217
|
}), t]
|
|
219
218
|
}), n]
|
|
220
219
|
});
|
|
221
220
|
}
|
|
222
|
-
function
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
className:
|
|
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),
|
|
225
224
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ f("span", {
|
|
227
226
|
className: "text-muted-foreground truncate text-[0.68rem] tracking-[0.1em] uppercase sm:text-xs",
|
|
228
227
|
children: e
|
|
229
228
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
className:
|
|
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"),
|
|
232
231
|
children: t
|
|
233
232
|
}),
|
|
234
|
-
n && /* @__PURE__ */
|
|
233
|
+
n && /* @__PURE__ */ f("span", {
|
|
235
234
|
className: "text-muted-foreground text-xs",
|
|
236
235
|
children: n
|
|
237
236
|
})
|
|
238
237
|
]
|
|
239
238
|
});
|
|
240
239
|
}
|
|
241
|
-
function
|
|
242
|
-
return /* @__PURE__ */
|
|
243
|
-
className:
|
|
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),
|
|
244
243
|
children: e
|
|
245
244
|
});
|
|
246
245
|
}
|
|
247
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
|
|
248
278
|
//#region packages/utils/styles.ts
|
|
249
|
-
var
|
|
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";
|
|
250
280
|
//#endregion
|
|
251
281
|
//#region packages/popover/index.tsx
|
|
252
282
|
function j(e) {
|
|
253
|
-
let { className: t, content: n, children: r, role: i = "tooltip", triggerType:
|
|
254
|
-
return
|
|
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(() => {
|
|
255
285
|
let e = T.current;
|
|
256
286
|
if (!e) return;
|
|
257
287
|
let t = () => {
|
|
@@ -262,20 +292,20 @@ function j(e) {
|
|
|
262
292
|
return e.addEventListener("popover:open", t), e.addEventListener("popover:close", n), () => {
|
|
263
293
|
e.removeEventListener("popover:open", t), e.removeEventListener("popover:close", n);
|
|
264
294
|
};
|
|
265
|
-
}, [y, b]),
|
|
266
|
-
|
|
267
|
-
}, [
|
|
295
|
+
}, [y, b]), a(() => {
|
|
296
|
+
s === "manual" && (g ? T.current?.showPopover?.() : T.current?.hidePopover?.());
|
|
297
|
+
}, [g, s]), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("div", {
|
|
268
298
|
"aria-expanded": C,
|
|
269
|
-
className:
|
|
299
|
+
className: h("max-w-fit min-w-fit", m),
|
|
270
300
|
style: { anchorName: `--zen-popover-anchor-${S}` },
|
|
271
301
|
popoverTarget: `zen__popover-${S}`,
|
|
272
302
|
popoverTargetAction: "toggle",
|
|
273
303
|
onClick: c === "click" ? (e) => {
|
|
274
|
-
switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(),
|
|
304
|
+
switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(), s) {
|
|
275
305
|
case "auto":
|
|
276
306
|
T.current?.togglePopover?.();
|
|
277
307
|
break;
|
|
278
|
-
case "manual":
|
|
308
|
+
case "manual": _?.(!g);
|
|
279
309
|
}
|
|
280
310
|
} : void 0,
|
|
281
311
|
onMouseEnter: c === "hover" ? (e) => {
|
|
@@ -285,16 +315,16 @@ function j(e) {
|
|
|
285
315
|
e.stopPropagation(), T.current?.hidePopover?.();
|
|
286
316
|
} : void 0,
|
|
287
317
|
children: r
|
|
288
|
-
}), /* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ f("div", {
|
|
289
319
|
...x,
|
|
290
320
|
ref: T,
|
|
291
321
|
role: i,
|
|
292
|
-
popover:
|
|
322
|
+
popover: s,
|
|
293
323
|
id: `zen__popover-${S}`,
|
|
294
|
-
className:
|
|
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),
|
|
295
325
|
style: {
|
|
296
326
|
...v,
|
|
297
|
-
"--gap":
|
|
327
|
+
"--gap": d,
|
|
298
328
|
top: "calc(anchor(bottom) + var(--gap))",
|
|
299
329
|
left: "calc(anchor(center) - 50%)",
|
|
300
330
|
positionAnchor: `--zen-popover-anchor-${S}`
|
|
@@ -305,18 +335,18 @@ function j(e) {
|
|
|
305
335
|
//#endregion
|
|
306
336
|
//#region packages/collapse/index.tsx
|
|
307
337
|
function M(e) {
|
|
308
|
-
let { items: t = [], children: n, moreItemsLabel: r = "", parentRef: i, data:
|
|
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({
|
|
309
339
|
visible: t,
|
|
310
340
|
hidden: []
|
|
311
|
-
}), y =
|
|
341
|
+
}), y = c(() => {
|
|
312
342
|
if (typeof document > "u") return null;
|
|
313
343
|
let e = document.createElement("canvas").getContext("2d");
|
|
314
|
-
return e && (e.font =
|
|
344
|
+
return e && (e.font = l), e;
|
|
315
345
|
}, []), b = () => {
|
|
316
346
|
let e = i?.current;
|
|
317
347
|
if (!e) return;
|
|
318
348
|
let n = e.offsetWidth;
|
|
319
|
-
if (
|
|
349
|
+
if (S.reduce((e, t) => e + t, 0) <= n - 20) {
|
|
320
350
|
v({
|
|
321
351
|
visible: t,
|
|
322
352
|
hidden: []
|
|
@@ -324,14 +354,14 @@ function M(e) {
|
|
|
324
354
|
return;
|
|
325
355
|
}
|
|
326
356
|
let a = [], o = [], c = s(r, (y?.measureText(r).width ?? 0) + 10);
|
|
327
|
-
|
|
357
|
+
S?.reduce((e, r, i) => (e + r + c > n - 20 ? o.push(t[i]) : a.push(t[i]), e + r), 0), v({
|
|
328
358
|
visible: a,
|
|
329
359
|
hidden: o
|
|
330
360
|
});
|
|
331
|
-
},
|
|
332
|
-
return
|
|
361
|
+
}, S = c(() => t?.map((e) => s(e, y?.measureText(e).width ?? 0)) ?? [], [t]);
|
|
362
|
+
return a(() => {
|
|
333
363
|
b();
|
|
334
|
-
}, [t]),
|
|
364
|
+
}, [t]), a(() => {
|
|
335
365
|
if (!i?.current) return;
|
|
336
366
|
let e = new ResizeObserver(() => {
|
|
337
367
|
b();
|
|
@@ -339,48 +369,48 @@ function M(e) {
|
|
|
339
369
|
return e.observe(i.current), () => {
|
|
340
370
|
e.disconnect();
|
|
341
371
|
};
|
|
342
|
-
}, [t]), /* @__PURE__ */
|
|
372
|
+
}, [t]), /* @__PURE__ */ p(d, { children: [_.visible?.map((e, t) => n(e, t, o?.[t])), _.hidden?.length > 0 && /* @__PURE__ */ f(j, {
|
|
343
373
|
trigger: "click",
|
|
344
|
-
content: /* @__PURE__ */
|
|
374
|
+
content: /* @__PURE__ */ f("div", {
|
|
345
375
|
className: "grid max-h-60 grid-flow-row grid-cols-2 gap-3 overflow-auto p-2",
|
|
346
|
-
children:
|
|
376
|
+
children: _.hidden.map((e, t) => n(e, _.visible.length + t, o?.[_.visible.length + t]))
|
|
347
377
|
}),
|
|
348
|
-
children: /* @__PURE__ */
|
|
349
|
-
className:
|
|
350
|
-
variant:
|
|
351
|
-
"aria-label": `Show ${
|
|
352
|
-
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}` })
|
|
353
383
|
}, "more_items_button")
|
|
354
384
|
})] });
|
|
355
385
|
}
|
|
356
386
|
//#endregion
|
|
357
387
|
//#region packages/dialog/index.tsx
|
|
358
|
-
function N({ open: e, onOpenChange: t, title: n, description: r, children: i, dismissible:
|
|
359
|
-
let
|
|
360
|
-
return
|
|
361
|
-
let t =
|
|
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;
|
|
362
392
|
t && (e && !t.open ? (t.showModal(), c?.current?.focus()) : !e && t.open && t.close());
|
|
363
|
-
}, [e, c]), /* @__PURE__ */
|
|
364
|
-
ref:
|
|
365
|
-
role:
|
|
366
|
-
"aria-labelledby":
|
|
393
|
+
}, [e, c]), /* @__PURE__ */ f("dialog", {
|
|
394
|
+
ref: g,
|
|
395
|
+
role: m,
|
|
396
|
+
"aria-labelledby": _,
|
|
367
397
|
"aria-describedby": r ? v : void 0,
|
|
368
|
-
className:
|
|
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),
|
|
369
399
|
onCancel: (e) => {
|
|
370
|
-
e.preventDefault(),
|
|
400
|
+
e.preventDefault(), s && t?.(!1);
|
|
371
401
|
},
|
|
372
402
|
onClick: (e) => {
|
|
373
|
-
e.target === e.currentTarget &&
|
|
403
|
+
e.target === e.currentTarget && s && t?.(!1);
|
|
374
404
|
},
|
|
375
|
-
children: /* @__PURE__ */
|
|
405
|
+
children: /* @__PURE__ */ p("div", {
|
|
376
406
|
className: "flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-x-hidden overflow-y-auto p-6",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
407
|
+
children: [/* @__PURE__ */ p("div", {
|
|
378
408
|
className: "flex flex-col gap-2",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
380
|
-
id:
|
|
409
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
410
|
+
id: _,
|
|
381
411
|
className: "text-lg font-semibold",
|
|
382
412
|
children: n
|
|
383
|
-
}), r && /* @__PURE__ */
|
|
413
|
+
}), r && /* @__PURE__ */ f("p", {
|
|
384
414
|
id: v,
|
|
385
415
|
className: "text-muted-foreground mt-0! text-sm leading-5",
|
|
386
416
|
children: r
|
|
@@ -391,22 +421,22 @@ function N({ open: e, onOpenChange: t, title: n, description: r, children: i, di
|
|
|
391
421
|
}
|
|
392
422
|
//#endregion
|
|
393
423
|
//#region packages/confirm-dialog/index.tsx
|
|
394
|
-
function
|
|
395
|
-
return /* @__PURE__ */
|
|
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, {
|
|
396
426
|
role: "alertdialog",
|
|
397
427
|
open: e,
|
|
398
428
|
onOpenChange: t,
|
|
399
429
|
title: n,
|
|
400
430
|
description: r,
|
|
401
431
|
className: "w-[26rem]",
|
|
402
|
-
children: /* @__PURE__ */
|
|
432
|
+
children: /* @__PURE__ */ p("div", {
|
|
403
433
|
className: "flex justify-end gap-2",
|
|
404
|
-
children: [/* @__PURE__ */
|
|
434
|
+
children: [/* @__PURE__ */ f(w, {
|
|
405
435
|
variant: "outline",
|
|
406
436
|
autoFocus: !0,
|
|
407
437
|
onClick: () => t(!1),
|
|
408
438
|
children: a
|
|
409
|
-
}), /* @__PURE__ */
|
|
439
|
+
}), /* @__PURE__ */ f(w, {
|
|
410
440
|
variant: o ? "destructive" : "default",
|
|
411
441
|
onClick: () => {
|
|
412
442
|
s(), t(!1);
|
|
@@ -417,828 +447,9 @@ function P({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i
|
|
|
417
447
|
});
|
|
418
448
|
}
|
|
419
449
|
//#endregion
|
|
420
|
-
//#region node_modules/.pnpm/@tanstack+virtual-core@3.17.11/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js
|
|
421
|
-
function oe(e) {
|
|
422
|
-
return typeof e == "object" ? e.key : e;
|
|
423
|
-
}
|
|
424
|
-
function se(e, t) {
|
|
425
|
-
let n = e.length;
|
|
426
|
-
return new Proxy(e, { get(e, r, i) {
|
|
427
|
-
if (typeof r == "string") {
|
|
428
|
-
let i = r.charCodeAt(0);
|
|
429
|
-
if (i >= 48 && i <= 57) {
|
|
430
|
-
let i = +r;
|
|
431
|
-
if (Number.isInteger(i) && i >= 0 && i < n) {
|
|
432
|
-
let n = e[i];
|
|
433
|
-
if (typeof n != "object") {
|
|
434
|
-
let r = t[i * 2];
|
|
435
|
-
n = e[i] = {
|
|
436
|
-
index: i,
|
|
437
|
-
key: n,
|
|
438
|
-
start: r,
|
|
439
|
-
size: t[i * 2 + 1],
|
|
440
|
-
end: r + t[i * 2 + 1],
|
|
441
|
-
lane: 0
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
return n;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
if (r === "length") return n;
|
|
448
|
-
}
|
|
449
|
-
return Reflect.get(e, r, i);
|
|
450
|
-
} });
|
|
451
|
-
}
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region node_modules/.pnpm/@tanstack+virtual-core@3.17.11/node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
454
|
-
function F(e, t, n) {
|
|
455
|
-
let r = n.initialDeps ?? [], i, a = !0;
|
|
456
|
-
function o() {
|
|
457
|
-
let o = process.env.NODE_ENV !== "production" && !!n.key && !!n.debug?.call(n), s = 0;
|
|
458
|
-
o && (s = Date.now());
|
|
459
|
-
let c = e();
|
|
460
|
-
if (!(c.length !== r.length || c.some((e, t) => r[t] !== e))) return i;
|
|
461
|
-
r = c;
|
|
462
|
-
let l = 0;
|
|
463
|
-
if (o && (l = Date.now()), i = t(...c), o) {
|
|
464
|
-
let e = Math.round((Date.now() - s) * 100) / 100, t = Math.round((Date.now() - l) * 100) / 100, r = t / 16, i = (e, t) => {
|
|
465
|
-
for (e = String(e); e.length < t;) e = " " + e;
|
|
466
|
-
return e;
|
|
467
|
-
};
|
|
468
|
-
console.info(`%c⏱ ${i(t, 5)} /${i(e, 5)} ms`, `
|
|
469
|
-
font-size: .6rem;
|
|
470
|
-
font-weight: bold;
|
|
471
|
-
color: hsl(${Math.max(0, Math.min(120 - 120 * r, 120))}deg 100% 31%);`, n?.key);
|
|
472
|
-
}
|
|
473
|
-
return n?.onChange && !(a && n.skipInitialOnChange) && n.onChange(i), a = !1, i;
|
|
474
|
-
}
|
|
475
|
-
return o.updateDeps = (e) => {
|
|
476
|
-
r = e;
|
|
477
|
-
}, o;
|
|
478
|
-
}
|
|
479
|
-
function I(e, t) {
|
|
480
|
-
if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
|
|
481
|
-
return e;
|
|
482
|
-
}
|
|
483
|
-
var L = (e, t) => Math.abs(e - t) < 1.01, ce = (e, t, n) => {
|
|
484
|
-
let r;
|
|
485
|
-
return Object.assign(function(...i) {
|
|
486
|
-
e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
|
|
487
|
-
}, { cancel: () => {
|
|
488
|
-
e.clearTimeout(r);
|
|
489
|
-
} });
|
|
490
|
-
}, R, z = () => {
|
|
491
|
-
if (R !== void 0) return R;
|
|
492
|
-
if (typeof navigator > "u") return R = !1;
|
|
493
|
-
if (/iP(hone|od|ad)/.test(navigator.userAgent)) return R = !0;
|
|
494
|
-
let e = navigator.maxTouchPoints;
|
|
495
|
-
return R = navigator.platform === "MacIntel" && e !== void 0 && e > 0;
|
|
496
|
-
}, B = (e) => {
|
|
497
|
-
let { offsetWidth: t, offsetHeight: n } = e;
|
|
498
|
-
return {
|
|
499
|
-
width: t,
|
|
500
|
-
height: n
|
|
501
|
-
};
|
|
502
|
-
}, le = (e) => e, ue = (e) => {
|
|
503
|
-
let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1) - t + 1, r = Array(n);
|
|
504
|
-
for (let e = 0; e < n; e++) r[e] = t + e;
|
|
505
|
-
return r;
|
|
506
|
-
}, de = (e, t) => {
|
|
507
|
-
let n = e.scrollElement;
|
|
508
|
-
if (!n) return;
|
|
509
|
-
let r = e.targetWindow;
|
|
510
|
-
if (!r) return;
|
|
511
|
-
let i = (e) => {
|
|
512
|
-
let { width: n, height: r } = e;
|
|
513
|
-
t({
|
|
514
|
-
width: Math.round(n),
|
|
515
|
-
height: Math.round(r)
|
|
516
|
-
});
|
|
517
|
-
};
|
|
518
|
-
if (i(B(n)), !r.ResizeObserver) return () => {};
|
|
519
|
-
let a = new r.ResizeObserver((t) => {
|
|
520
|
-
let r = () => {
|
|
521
|
-
let e = t[0];
|
|
522
|
-
if (e?.borderBoxSize) {
|
|
523
|
-
let t = e.borderBoxSize[0];
|
|
524
|
-
if (t) {
|
|
525
|
-
i({
|
|
526
|
-
width: t.inlineSize,
|
|
527
|
-
height: t.blockSize
|
|
528
|
-
});
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
i(B(n));
|
|
533
|
-
};
|
|
534
|
-
e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
535
|
-
});
|
|
536
|
-
return a.observe(n, { box: "border-box" }), () => {
|
|
537
|
-
a.unobserve(n);
|
|
538
|
-
};
|
|
539
|
-
}, V = { passive: !0 }, H = typeof window > "u" || "onscrollend" in window, fe = (e, t, n) => {
|
|
540
|
-
let r = e.scrollElement;
|
|
541
|
-
if (!r) return;
|
|
542
|
-
let i = e.targetWindow;
|
|
543
|
-
if (!i) return;
|
|
544
|
-
let a = e.options.useScrollendEvent && H, o = 0, s = a ? null : ce(i, () => t(n(r), !1), e.options.isScrollingResetDelay), c = (e) => () => {
|
|
545
|
-
o = n(r), s?.(), t(o, e);
|
|
546
|
-
}, l = c(!0), u = c(!1);
|
|
547
|
-
return r.addEventListener("scroll", l, V), a && r.addEventListener("scrollend", u, V), () => {
|
|
548
|
-
r.removeEventListener("scroll", l), a && r.removeEventListener("scrollend", u), s?.cancel();
|
|
549
|
-
};
|
|
550
|
-
}, pe = (e, t) => fe(e, t, (t) => {
|
|
551
|
-
let { horizontal: n, isRtl: r } = e.options;
|
|
552
|
-
return n ? t.scrollLeft * (r && -1 || 1) : t.scrollTop;
|
|
553
|
-
}), me = (e, t, n) => {
|
|
554
|
-
if (n.options.useCachedMeasurements) {
|
|
555
|
-
let t = n.indexFromElement(e), r = n.options.getItemKey(t);
|
|
556
|
-
return n.itemSizeCache.get(r) ?? n.options.estimateSize(t);
|
|
557
|
-
}
|
|
558
|
-
if (t?.borderBoxSize) {
|
|
559
|
-
let e = t.borderBoxSize[0];
|
|
560
|
-
if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
|
|
561
|
-
}
|
|
562
|
-
if (!t) {
|
|
563
|
-
let t = n.indexFromElement(e), r = n.options.getItemKey(t), i = n.itemSizeCache.get(r);
|
|
564
|
-
if (i !== void 0) return i;
|
|
565
|
-
}
|
|
566
|
-
return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
567
|
-
}, he = (e, { adjustments: t = 0, behavior: n }, r) => {
|
|
568
|
-
var i, a;
|
|
569
|
-
(a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
|
|
570
|
-
[r.options.horizontal ? "left" : "top"]: e + t,
|
|
571
|
-
behavior: n
|
|
572
|
-
});
|
|
573
|
-
};
|
|
574
|
-
function ge(e, t, n, r) {
|
|
575
|
-
if (t === 0) return !1;
|
|
576
|
-
let i = r(0), a = /* @__PURE__ */ new Set(), o = 0;
|
|
577
|
-
for (; o < e;) {
|
|
578
|
-
let e = n(o);
|
|
579
|
-
if (e === i) break;
|
|
580
|
-
a.add(e), o++;
|
|
581
|
-
}
|
|
582
|
-
let s = e - o;
|
|
583
|
-
if (s === 0 || s >= t) return !1;
|
|
584
|
-
for (let e = 0; e < s; e++) if (r(e) !== n(o + e)) return !1;
|
|
585
|
-
for (let e = s; e < t; e++) if (a.has(r(e))) return !1;
|
|
586
|
-
return !0;
|
|
587
|
-
}
|
|
588
|
-
var _e = class {
|
|
589
|
-
constructor(e) {
|
|
590
|
-
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._intendedScrollOffset = null, this._clampedAdjustment = null, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
|
|
591
|
-
var e;
|
|
592
|
-
return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now();
|
|
593
|
-
}, this.observer = /* @__PURE__ */ (() => {
|
|
594
|
-
let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
|
|
595
|
-
e.forEach((e) => {
|
|
596
|
-
let t = () => {
|
|
597
|
-
let t = e.target, n = this.indexFromElement(t);
|
|
598
|
-
if (!t.isConnected) {
|
|
599
|
-
this.observer.unobserve(t);
|
|
600
|
-
for (let [e, n] of this.elementsCache) if (n === t) {
|
|
601
|
-
this.elementsCache.delete(e);
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
this.isIndexInRange(n) && this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this));
|
|
607
|
-
};
|
|
608
|
-
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
|
|
609
|
-
});
|
|
610
|
-
}));
|
|
611
|
-
return {
|
|
612
|
-
disconnect: () => {
|
|
613
|
-
var n;
|
|
614
|
-
(n = t()) == null || n.disconnect(), e = null;
|
|
615
|
-
},
|
|
616
|
-
observe: (e) => t()?.observe(e, { box: "border-box" }),
|
|
617
|
-
unobserve: (e) => t()?.unobserve(e)
|
|
618
|
-
};
|
|
619
|
-
})(), this.range = null, this.setOptions = (e) => {
|
|
620
|
-
let t = {
|
|
621
|
-
debug: !1,
|
|
622
|
-
initialOffset: 0,
|
|
623
|
-
overscan: 1,
|
|
624
|
-
paddingStart: 0,
|
|
625
|
-
paddingEnd: 0,
|
|
626
|
-
scrollPaddingStart: 0,
|
|
627
|
-
scrollPaddingEnd: 0,
|
|
628
|
-
horizontal: !1,
|
|
629
|
-
getItemKey: le,
|
|
630
|
-
rangeExtractor: ue,
|
|
631
|
-
onChange: () => {},
|
|
632
|
-
measureElement: me,
|
|
633
|
-
initialRect: {
|
|
634
|
-
width: 0,
|
|
635
|
-
height: 0
|
|
636
|
-
},
|
|
637
|
-
scrollMargin: 0,
|
|
638
|
-
gap: 0,
|
|
639
|
-
indexAttribute: "data-index",
|
|
640
|
-
initialMeasurementsCache: [],
|
|
641
|
-
lanes: 1,
|
|
642
|
-
anchorTo: "start",
|
|
643
|
-
followOnAppend: !1,
|
|
644
|
-
scrollEndThreshold: 1,
|
|
645
|
-
isScrollingResetDelay: 150,
|
|
646
|
-
enabled: !0,
|
|
647
|
-
isRtl: !1,
|
|
648
|
-
useScrollendEvent: !1,
|
|
649
|
-
useAnimationFrameWithResizeObserver: !1,
|
|
650
|
-
laneAssignmentMode: "estimate",
|
|
651
|
-
useCachedMeasurements: !1
|
|
652
|
-
};
|
|
653
|
-
for (let n in e) {
|
|
654
|
-
let r = e[n];
|
|
655
|
-
r !== void 0 && (t[n] = r);
|
|
656
|
-
}
|
|
657
|
-
let n = this.options, r = null, i = null, a = !1;
|
|
658
|
-
if (n !== void 0 && n.enabled && t.enabled && t.anchorTo === "end" && this.scrollElement !== null) {
|
|
659
|
-
let e = n.count, o = t.count, s = this.getMeasurements(), c = this._singleLaneMeasurements?.items ?? s, l = (e) => oe(c[e]), u = e > 0 ? l(0) : null, d = e > 0 ? l(e - 1) : null;
|
|
660
|
-
if (o !== e || e > 0 && o > 0 && (t.getItemKey(0) !== u || t.getItemKey(o - 1) !== d)) {
|
|
661
|
-
a = !0;
|
|
662
|
-
let c = e > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? s[0] : null;
|
|
663
|
-
c && (r = [c.key, this.getScrollOffset() - c.start]);
|
|
664
|
-
let u = t.followOnAppend === !0 ? "auto" : t.followOnAppend || null;
|
|
665
|
-
u && o > 0 && this.isAtEnd(n.scrollEndThreshold) && (e === 0 || t.getItemKey(o - 1) !== d) && (o > e || ge(e, o, l, t.getItemKey)) && (i = u);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
this.options = t, a && (this.pendingMin = 0, this.itemSizeCacheVersion++);
|
|
669
|
-
let o = !1, s = 0;
|
|
670
|
-
if (r && this.scrollOffset !== null) {
|
|
671
|
-
let [e, t] = r, n = this.getMeasurements(), { count: a, getItemKey: c } = this.options, l = 0;
|
|
672
|
-
for (; l < a && c(l) !== e;) l++;
|
|
673
|
-
if (l < a) {
|
|
674
|
-
let e = n[l];
|
|
675
|
-
if (e) {
|
|
676
|
-
let n = Math.max(0, e.start + t);
|
|
677
|
-
!i && n !== this.scrollOffset && (s = n - this.scrollOffset, this.scrollOffset = n, o = !0);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
(o || i) && (this.pendingScrollAnchor = [
|
|
682
|
-
o ? r[0] : null,
|
|
683
|
-
o ? r[1] : 0,
|
|
684
|
-
i,
|
|
685
|
-
s
|
|
686
|
-
]);
|
|
687
|
-
}, this.notify = (e) => {
|
|
688
|
-
var t, n;
|
|
689
|
-
(n = (t = this.options).onChange) == null || n.call(t, this, e);
|
|
690
|
-
}, this.maybeNotify = F(() => (this.calculateRange(), [
|
|
691
|
-
this.isScrolling,
|
|
692
|
-
this.range ? this.range.startIndex : null,
|
|
693
|
-
this.range ? this.range.endIndex : null
|
|
694
|
-
]), (e) => {
|
|
695
|
-
this.notify(e);
|
|
696
|
-
}, {
|
|
697
|
-
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
698
|
-
debug: () => this.options.debug,
|
|
699
|
-
initialDeps: [
|
|
700
|
-
this.isScrolling,
|
|
701
|
-
this.range ? this.range.startIndex : null,
|
|
702
|
-
this.range ? this.range.endIndex : null
|
|
703
|
-
]
|
|
704
|
-
}), this.cleanup = () => {
|
|
705
|
-
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.isScrolling = !1, this.scrollDirection = null, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._clampedAdjustment = null, this.scrollElement = null, this.targetWindow = null;
|
|
706
|
-
}, this._didMount = () => () => {
|
|
707
|
-
this.cleanup();
|
|
708
|
-
}, this._willUpdate = () => {
|
|
709
|
-
let e = this.options.enabled ? this.options.getScrollElement() : null;
|
|
710
|
-
if (this.scrollElement !== e) {
|
|
711
|
-
if (this.cleanup(), !e) {
|
|
712
|
-
this.maybeNotify();
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
if (this.scrollElement = e, this.targetWindow = this.scrollElement && "ownerDocument" in this.scrollElement ? this.scrollElement.ownerDocument.defaultView : this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
|
|
716
|
-
this.observer.observe(e);
|
|
717
|
-
}), this.unsubs.push(this.options.observeElementRect(this, (e) => {
|
|
718
|
-
this.scrollRect = e, this.maybeNotify();
|
|
719
|
-
})), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
|
|
720
|
-
if (t && this._intendedScrollOffset === null && e === this.scrollOffset) return;
|
|
721
|
-
this._intendedScrollOffset !== null && Math.abs(e - this._intendedScrollOffset) < 1.5 && (e = this._intendedScrollOffset), this._intendedScrollOffset = null, this._clampedAdjustment !== null && Math.abs(e - this._clampedAdjustment.maxAtWrite) >= 1.5 && (this._clampedAdjustment = null), this.scrollAdjustments = 0;
|
|
722
|
-
let n = this.getScrollOffset();
|
|
723
|
-
this.scrollDirection = t ? n === e ? this.scrollDirection : n < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this._flushIosDeferredIfReady(), this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
|
|
724
|
-
})), "addEventListener" in this.scrollElement) {
|
|
725
|
-
let e = this.scrollElement, t = () => {
|
|
726
|
-
this._iosTouching = !0, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
|
|
727
|
-
}, n = () => {
|
|
728
|
-
this._iosTouching = !1, z() && this.targetWindow != null && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
|
|
729
|
-
this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._flushIosDeferredIfReady();
|
|
730
|
-
}, 150));
|
|
731
|
-
};
|
|
732
|
-
e.addEventListener("touchstart", t, V), e.addEventListener("touchend", n, V), this.unsubs.push(() => {
|
|
733
|
-
e.removeEventListener("touchstart", t), e.removeEventListener("touchend", n), this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
737
|
-
adjustments: void 0,
|
|
738
|
-
behavior: void 0
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
let t = this.pendingScrollAnchor;
|
|
742
|
-
if (this.pendingScrollAnchor = null, t && this.scrollElement && this.options.enabled) {
|
|
743
|
-
let [e, n, r, i] = t;
|
|
744
|
-
e !== null && !r && (z() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? i !== 0 && (this._iosDeferredAdjustment += i) : this.scrollState?.behavior === "smooth" && !L(this.getScrollOffset() - i, this.scrollState.lastTargetOffset) || this._scrollToOffset(this.getScrollOffset(), {
|
|
745
|
-
adjustments: void 0,
|
|
746
|
-
behavior: void 0
|
|
747
|
-
})), r && this.scrollToEnd({ behavior: r });
|
|
748
|
-
}
|
|
749
|
-
this._retryClampedAdjustment();
|
|
750
|
-
}, this._retryClampedAdjustment = () => {
|
|
751
|
-
if (this._clampedAdjustment === null || !this.scrollElement || !this.options.enabled) return;
|
|
752
|
-
let { target: e, maxAtWrite: t } = this._clampedAdjustment, n = this.getMaxScrollOffset();
|
|
753
|
-
n > t + .5 && (this._clampedAdjustment = e > n + .5 ? {
|
|
754
|
-
target: e,
|
|
755
|
-
maxAtWrite: n
|
|
756
|
-
} : null, this._scrollToOffset(e, {
|
|
757
|
-
adjustments: void 0,
|
|
758
|
-
behavior: void 0
|
|
759
|
-
}));
|
|
760
|
-
}, this._flushIosDeferredIfReady = () => {
|
|
761
|
-
if (this._iosDeferredAdjustment === 0 || this.isScrolling || this._iosTouching || this._iosJustTouchEnded) return;
|
|
762
|
-
let e = this.getScrollOffset(), t = this.getMaxScrollOffset();
|
|
763
|
-
if (e < 0 || e > t) return;
|
|
764
|
-
if (this._iosDeferredAdjustment < 0 && e >= t - 1) {
|
|
765
|
-
this._iosDeferredAdjustment = 0;
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
let n = this._iosDeferredAdjustment;
|
|
769
|
-
this._iosDeferredAdjustment = 0, this._scrollToOffset(e, {
|
|
770
|
-
adjustments: this.scrollAdjustments += n,
|
|
771
|
-
behavior: void 0
|
|
772
|
-
});
|
|
773
|
-
}, 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.getMeasurementOptions = F(() => [
|
|
774
|
-
this.options.count,
|
|
775
|
-
this.options.paddingStart,
|
|
776
|
-
this.options.scrollMargin,
|
|
777
|
-
this.options.getItemKey,
|
|
778
|
-
this.options.enabled,
|
|
779
|
-
this.options.lanes,
|
|
780
|
-
this.options.laneAssignmentMode,
|
|
781
|
-
this.options.gap
|
|
782
|
-
], (e, t, n, r, i, a, o, s) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMin = null, {
|
|
783
|
-
count: e,
|
|
784
|
-
paddingStart: t,
|
|
785
|
-
scrollMargin: n,
|
|
786
|
-
getItemKey: r,
|
|
787
|
-
enabled: i,
|
|
788
|
-
lanes: a,
|
|
789
|
-
laneAssignmentMode: o,
|
|
790
|
-
gap: s
|
|
791
|
-
}), { key: !1 }), this.isIndexInRange = (e) => e >= 0 && e < this.options.count, this.getMeasurements = F(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o, gap: s }, c) => {
|
|
792
|
-
let l = this.itemSizeCache;
|
|
793
|
-
if (!i) return this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
|
|
794
|
-
if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
|
|
795
|
-
this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
|
|
796
|
-
this.itemSizeCache.set(e.key, e.size);
|
|
797
|
-
}));
|
|
798
|
-
let u = this.lanesSettling ? 0 : this.pendingMin ?? 0;
|
|
799
|
-
if (this.pendingMin = null, this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1), a === 1) {
|
|
800
|
-
let i = e * 2, a = this._singleLaneMeasurements?.flat;
|
|
801
|
-
if (!a || a.length < i) {
|
|
802
|
-
let e = new Float64Array(i);
|
|
803
|
-
a && u > 0 && e.set(a.subarray(0, u * 2)), a = e;
|
|
804
|
-
}
|
|
805
|
-
let o = u === 0 ? Array(e) : this._singleLaneMeasurements.items.slice(), c;
|
|
806
|
-
if (u === 0) c = t + n;
|
|
807
|
-
else {
|
|
808
|
-
let e = u - 1;
|
|
809
|
-
c = a[e * 2] + a[e * 2 + 1] + s;
|
|
810
|
-
}
|
|
811
|
-
for (let t = u; t < e; t++) {
|
|
812
|
-
let e = r(t);
|
|
813
|
-
o[t] = e;
|
|
814
|
-
let n = l.get(e), i = typeof n == "number" ? n : this.options.estimateSize(t);
|
|
815
|
-
a[t * 2] = c, a[t * 2 + 1] = i, c += i + s;
|
|
816
|
-
}
|
|
817
|
-
this._singleLaneMeasurements = {
|
|
818
|
-
flat: a,
|
|
819
|
-
items: o
|
|
820
|
-
};
|
|
821
|
-
let d = se(o, a);
|
|
822
|
-
return this.measurementsCache = d, d;
|
|
823
|
-
}
|
|
824
|
-
let d = this.measurementsCache.slice(0, u), f = Array(a).fill(void 0), p = new Float64Array(a), m = 0;
|
|
825
|
-
for (let e = 0; e < u; e++) {
|
|
826
|
-
let t = d[e];
|
|
827
|
-
t && (f[t.lane] === void 0 && m++, f[t.lane] = e, p[t.lane] = t.end);
|
|
828
|
-
}
|
|
829
|
-
for (let i = u; i < e; i++) {
|
|
830
|
-
let e = r(i), c = this.laneAssignments.get(i), u, h, g = o === "estimate" || l.has(e);
|
|
831
|
-
if (c !== void 0 && this.options.lanes > 1) {
|
|
832
|
-
u = c;
|
|
833
|
-
let e = f[u], r = e === void 0 ? void 0 : d[e];
|
|
834
|
-
h = r ? r.end + s : t + n;
|
|
835
|
-
} else if (m === a) {
|
|
836
|
-
let e = 0, t = p[0], n = f[0];
|
|
837
|
-
for (let r = 1; r < a; r++) {
|
|
838
|
-
let i = p[r];
|
|
839
|
-
(i < t || i === t && f[r] < n) && (e = r, t = i, n = f[r]);
|
|
840
|
-
}
|
|
841
|
-
u = e, h = t + s, g && this.laneAssignments.set(i, u);
|
|
842
|
-
} else u = i % this.options.lanes, h = t + n, g && this.laneAssignments.set(i, u);
|
|
843
|
-
let _ = l.get(e), v = typeof _ == "number" ? _ : this.options.estimateSize(i), y = h + v;
|
|
844
|
-
d[i] = {
|
|
845
|
-
index: i,
|
|
846
|
-
start: h,
|
|
847
|
-
size: v,
|
|
848
|
-
end: y,
|
|
849
|
-
key: e,
|
|
850
|
-
lane: u
|
|
851
|
-
}, f[u] === void 0 && m++, f[u] = i, p[u] = y;
|
|
852
|
-
}
|
|
853
|
-
return this.measurementsCache = d, d;
|
|
854
|
-
}, {
|
|
855
|
-
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
856
|
-
debug: () => this.options.debug
|
|
857
|
-
}), this.calculateRange = F(() => [
|
|
858
|
-
this.getMeasurements(),
|
|
859
|
-
this.getSize(),
|
|
860
|
-
this.getScrollOffset(),
|
|
861
|
-
this.options.lanes
|
|
862
|
-
], (e, t, n, r) => e.length === 0 || t === 0 ? (this.range = null, null) : (this.range = ye(e, t, n, r, r === 1 && this._singleLaneMeasurements !== null ? this._singleLaneMeasurements.flat : null), this.range), {
|
|
863
|
-
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
864
|
-
debug: () => this.options.debug
|
|
865
|
-
}), this.getVirtualIndexes = F(() => {
|
|
866
|
-
let e = null, t = null, n = this.calculateRange();
|
|
867
|
-
return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
|
|
868
|
-
this.isScrolling,
|
|
869
|
-
e,
|
|
870
|
-
t
|
|
871
|
-
]), [
|
|
872
|
-
this.options.rangeExtractor,
|
|
873
|
-
this.options.overscan,
|
|
874
|
-
this.options.count,
|
|
875
|
-
e,
|
|
876
|
-
t
|
|
877
|
-
];
|
|
878
|
-
}, (e, t, n, r, i) => r === null || i === null ? [] : e({
|
|
879
|
-
startIndex: r,
|
|
880
|
-
endIndex: i,
|
|
881
|
-
overscan: t,
|
|
882
|
-
count: n
|
|
883
|
-
}), {
|
|
884
|
-
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
885
|
-
debug: () => this.options.debug
|
|
886
|
-
}), this.indexFromElement = (e) => {
|
|
887
|
-
let t = this.options.indexAttribute, n = e.getAttribute(t);
|
|
888
|
-
return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
|
|
889
|
-
}, this.shouldMeasureDuringScroll = (e) => {
|
|
890
|
-
if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
|
|
891
|
-
let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
|
|
892
|
-
if (t !== void 0 && this.range) {
|
|
893
|
-
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);
|
|
894
|
-
return e >= r && e <= i;
|
|
895
|
-
}
|
|
896
|
-
return !0;
|
|
897
|
-
}, this.measureElement = (e) => {
|
|
898
|
-
if (!e) {
|
|
899
|
-
this.elementsCache.forEach((e, t) => {
|
|
900
|
-
e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
|
|
901
|
-
});
|
|
902
|
-
return;
|
|
903
|
-
}
|
|
904
|
-
let t = this.indexFromElement(e);
|
|
905
|
-
if (!this.isIndexInRange(t)) return;
|
|
906
|
-
let n = this.options.getItemKey(t), r = this.elementsCache.get(n);
|
|
907
|
-
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));
|
|
908
|
-
}, this.resizeItem = (e, t) => {
|
|
909
|
-
if (!this.isIndexInRange(e)) return;
|
|
910
|
-
let n, r, i, a = this._singleLaneMeasurements?.flat;
|
|
911
|
-
if (this.options.lanes === 1 && a != null) i = this.options.getItemKey(e), r = a[e * 2], n = a[e * 2 + 1];
|
|
912
|
-
else {
|
|
913
|
-
let t = this.measurementsCache[e];
|
|
914
|
-
if (!t) return;
|
|
915
|
-
i = t.key, r = t.start, n = t.size;
|
|
916
|
-
}
|
|
917
|
-
let o = this.itemSizeCache.get(i) ?? n, s = t - o;
|
|
918
|
-
if (s !== 0) {
|
|
919
|
-
let a = this.options.anchorTo === "end" && this.scrollState?.behavior !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, c = a ? this.getTotalSize() : 0, l = this.getScrollOffset() + this.scrollAdjustments, u = this.itemSizeCache.has(i) ? r + o <= l && this.scrollDirection !== "backward" : r < l, d = this.scrollState?.behavior !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? u : this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e] ?? {
|
|
920
|
-
index: e,
|
|
921
|
-
key: i,
|
|
922
|
-
start: r,
|
|
923
|
-
size: n,
|
|
924
|
-
end: r + n,
|
|
925
|
-
lane: 0
|
|
926
|
-
}, s, this));
|
|
927
|
-
(this.pendingMin === null || e < this.pendingMin) && (this.pendingMin = e), this.itemSizeCache.set(i, t), this.itemSizeCacheVersion++;
|
|
928
|
-
let f = !1;
|
|
929
|
-
a ? f = this.applyScrollAdjustment(this.getTotalSize() - c) : d && (f = this.applyScrollAdjustment(s)), this.notify(f), this._retryClampedAdjustment();
|
|
930
|
-
}
|
|
931
|
-
}, this.getVirtualItems = F(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
|
|
932
|
-
let n = [];
|
|
933
|
-
for (let r = 0, i = e.length; r < i; r++) {
|
|
934
|
-
let i = t[e[r]];
|
|
935
|
-
n.push(i);
|
|
936
|
-
}
|
|
937
|
-
return n;
|
|
938
|
-
}, {
|
|
939
|
-
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
940
|
-
debug: () => this.options.debug
|
|
941
|
-
}), this.getVirtualItemForOffset = (e) => {
|
|
942
|
-
let t = this.getMeasurements();
|
|
943
|
-
if (t.length === 0) return;
|
|
944
|
-
let n = this._singleLaneMeasurements?.flat, r = this.options.lanes === 1 && n != null;
|
|
945
|
-
return I(t[U(0, t.length - 1, r ? (e) => n[e * 2] : (e) => I(t[e]).start, e)]);
|
|
946
|
-
}, this.getMaxScrollOffset = () => {
|
|
947
|
-
if (!this.scrollElement) return 0;
|
|
948
|
-
if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
949
|
-
{
|
|
950
|
-
let e = this.scrollElement.document.documentElement;
|
|
951
|
-
return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
|
|
952
|
-
}
|
|
953
|
-
}, this.getVirtualDistanceFromEnd = () => Math.max(this.getTotalSize() - this.getSize() - this.getScrollOffset(), 0), this.getDistanceFromEnd = () => Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0), this.isAtEnd = (e = this.options.scrollEndThreshold) => this.getDistanceFromEnd() <= e, this.getOffsetForAlignment = (e, t, n = 0) => {
|
|
954
|
-
if (!this.scrollElement) return 0;
|
|
955
|
-
let r = this.getSize(), i = this.getScrollOffset();
|
|
956
|
-
t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
|
|
957
|
-
let a = this.getMaxScrollOffset();
|
|
958
|
-
return Math.max(Math.min(a, e), 0);
|
|
959
|
-
}, this.getOffsetForIndex = (e, t = "auto") => {
|
|
960
|
-
e = Math.max(0, Math.min(e, this.options.count - 1));
|
|
961
|
-
let n = this.getSize(), r = this.getScrollOffset(), i = this.measurementsCache[e];
|
|
962
|
-
if (!i) return;
|
|
963
|
-
if (t === "auto") {
|
|
964
|
-
if (i.end >= r + n - this.options.scrollPaddingEnd) t = "end";
|
|
965
|
-
else if (i.start <= r + this.options.scrollPaddingStart) t = "start";
|
|
966
|
-
else return [r, t];
|
|
967
|
-
}
|
|
968
|
-
if (t === "end" && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
|
|
969
|
-
let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
|
|
970
|
-
return [this.getOffsetForAlignment(a, t, i.size), t];
|
|
971
|
-
}, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
|
|
972
|
-
this._iosDeferredAdjustment = 0;
|
|
973
|
-
let r = this.getOffsetForAlignment(e, t), i = this.now();
|
|
974
|
-
this.scrollState = {
|
|
975
|
-
index: null,
|
|
976
|
-
align: t,
|
|
977
|
-
behavior: n,
|
|
978
|
-
startedAt: i,
|
|
979
|
-
lastTargetOffset: r,
|
|
980
|
-
stableFrames: 0
|
|
981
|
-
}, this._scrollToOffset(r, {
|
|
982
|
-
adjustments: void 0,
|
|
983
|
-
behavior: n
|
|
984
|
-
}), this.scheduleScrollReconcile();
|
|
985
|
-
}, this.scrollToIndex = (e, { align: t = "auto", behavior: n = "auto" } = {}) => {
|
|
986
|
-
this._iosDeferredAdjustment = 0, e = Math.max(0, Math.min(e, this.options.count - 1));
|
|
987
|
-
let r = this.getOffsetForIndex(e, t);
|
|
988
|
-
if (!r) return;
|
|
989
|
-
let [i, a] = r, o = this.now();
|
|
990
|
-
this.scrollState = {
|
|
991
|
-
index: e,
|
|
992
|
-
align: a,
|
|
993
|
-
behavior: n,
|
|
994
|
-
startedAt: o,
|
|
995
|
-
lastTargetOffset: i,
|
|
996
|
-
stableFrames: 0
|
|
997
|
-
}, this._scrollToOffset(i, {
|
|
998
|
-
adjustments: void 0,
|
|
999
|
-
behavior: n
|
|
1000
|
-
}), this.scheduleScrollReconcile();
|
|
1001
|
-
}, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
|
|
1002
|
-
let n = this.getScrollOffset() + e, r = this.now();
|
|
1003
|
-
this.scrollState = {
|
|
1004
|
-
index: null,
|
|
1005
|
-
align: "start",
|
|
1006
|
-
behavior: t,
|
|
1007
|
-
startedAt: r,
|
|
1008
|
-
lastTargetOffset: n,
|
|
1009
|
-
stableFrames: 0
|
|
1010
|
-
}, this._scrollToOffset(n, {
|
|
1011
|
-
adjustments: void 0,
|
|
1012
|
-
behavior: t
|
|
1013
|
-
}), this.scheduleScrollReconcile();
|
|
1014
|
-
}, this.scrollToEnd = ({ behavior: e = "auto" } = {}) => {
|
|
1015
|
-
if (this.options.count > 0) {
|
|
1016
|
-
this.scrollToIndex(this.options.count - 1, {
|
|
1017
|
-
align: "end",
|
|
1018
|
-
behavior: e
|
|
1019
|
-
});
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), { behavior: e });
|
|
1023
|
-
}, this.getTotalSize = () => {
|
|
1024
|
-
let e = this.getMeasurements(), t;
|
|
1025
|
-
if (e.length === 0) t = this.options.paddingStart;
|
|
1026
|
-
else if (this.options.lanes === 1) {
|
|
1027
|
-
let n = e.length - 1, r = this._singleLaneMeasurements?.flat;
|
|
1028
|
-
t = r == null ? e[n]?.end ?? 0 : r[n * 2] + r[n * 2 + 1];
|
|
1029
|
-
} else {
|
|
1030
|
-
let n = Array(this.options.lanes).fill(null), r = e.length - 1;
|
|
1031
|
-
for (; r >= 0 && n.some((e) => e === null);) {
|
|
1032
|
-
let t = e[r];
|
|
1033
|
-
n[t.lane] === null && (n[t.lane] = t.end), r--;
|
|
1034
|
-
}
|
|
1035
|
-
t = Math.max(...n.filter((e) => e !== null));
|
|
1036
|
-
}
|
|
1037
|
-
return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
|
|
1038
|
-
}, this.takeSnapshot = () => {
|
|
1039
|
-
let e = [];
|
|
1040
|
-
if (this.itemSizeCache.size === 0) return e;
|
|
1041
|
-
let t = this.getMeasurements();
|
|
1042
|
-
for (let n of t) n && this.itemSizeCache.has(n.key) && e.push({
|
|
1043
|
-
index: n.index,
|
|
1044
|
-
key: n.key,
|
|
1045
|
-
start: n.start,
|
|
1046
|
-
size: n.size,
|
|
1047
|
-
end: n.end,
|
|
1048
|
-
lane: n.lane
|
|
1049
|
-
});
|
|
1050
|
-
return e;
|
|
1051
|
-
}, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
|
|
1052
|
-
this._intendedScrollOffset = e + (t ?? 0), this.options.scrollToFn(e, {
|
|
1053
|
-
behavior: n,
|
|
1054
|
-
adjustments: t
|
|
1055
|
-
}, this);
|
|
1056
|
-
}, this.measure = () => {
|
|
1057
|
-
this.pendingMin = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), this.itemSizeCacheVersion++, this.notify(!1);
|
|
1058
|
-
}, this.setOptions(e);
|
|
1059
|
-
}
|
|
1060
|
-
applyScrollAdjustment(e, t) {
|
|
1061
|
-
if (e === 0) return !1;
|
|
1062
|
-
if (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", e), z() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) return this._iosDeferredAdjustment += e, !1;
|
|
1063
|
-
{
|
|
1064
|
-
let n = this.getScrollOffset() + this.scrollAdjustments + e, r = this.scrollElement, i = r !== null && ("scrollHeight" in r || "document" in r) ? this.getMaxScrollOffset() : null;
|
|
1065
|
-
return this._clampedAdjustment = i !== null && n > i + .5 ? {
|
|
1066
|
-
target: n,
|
|
1067
|
-
maxAtWrite: i
|
|
1068
|
-
} : null, this._scrollToOffset(this.getScrollOffset(), {
|
|
1069
|
-
adjustments: this.scrollAdjustments += e,
|
|
1070
|
-
behavior: t
|
|
1071
|
-
}), this.scrollOffset !== null && (this.scrollOffset += this.scrollAdjustments, this.scrollOffset < 0 && (this.scrollOffset = 0), this.scrollAdjustments = 0), !0;
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
scheduleScrollReconcile() {
|
|
1075
|
-
if (!this.targetWindow) {
|
|
1076
|
-
this.scrollState = null;
|
|
1077
|
-
return;
|
|
1078
|
-
}
|
|
1079
|
-
this.rafId ??= this.targetWindow.requestAnimationFrame(() => {
|
|
1080
|
-
this.rafId = null, this.reconcileScroll();
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
reconcileScroll() {
|
|
1084
|
-
if (!this.scrollState || !this.scrollElement) return;
|
|
1085
|
-
if (this.now() - this.scrollState.startedAt > 5e3) {
|
|
1086
|
-
this.scrollState = null;
|
|
1087
|
-
return;
|
|
1088
|
-
}
|
|
1089
|
-
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;
|
|
1090
|
-
if (!n && L(t, this.getScrollOffset())) {
|
|
1091
|
-
if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
|
|
1092
|
-
this.getScrollOffset() !== t && this._scrollToOffset(t, {
|
|
1093
|
-
adjustments: void 0,
|
|
1094
|
-
behavior: "auto"
|
|
1095
|
-
}), this.scrollState = null;
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
} else if (this.scrollState.stableFrames = 0, n) {
|
|
1099
|
-
let e = this.getSize() || 600, n = Math.abs(t - this.getScrollOffset()), r = this.scrollState.behavior === "smooth" && n > e;
|
|
1100
|
-
this.scrollState.lastTargetOffset = t, r || (this.scrollState.behavior = "auto"), this._scrollToOffset(t, {
|
|
1101
|
-
adjustments: void 0,
|
|
1102
|
-
behavior: r ? "smooth" : "auto"
|
|
1103
|
-
});
|
|
1104
|
-
}
|
|
1105
|
-
this.scheduleScrollReconcile();
|
|
1106
|
-
}
|
|
1107
|
-
}, U = (e, t, n, r) => {
|
|
1108
|
-
for (; e <= t;) {
|
|
1109
|
-
let i = (e + t) / 2 | 0, a = n(i);
|
|
1110
|
-
if (a < r) e = i + 1;
|
|
1111
|
-
else if (a > r) t = i - 1;
|
|
1112
|
-
else return i;
|
|
1113
|
-
}
|
|
1114
|
-
return e > 0 ? e - 1 : 0;
|
|
1115
|
-
};
|
|
1116
|
-
function ve(e, t, n) {
|
|
1117
|
-
let r = 0;
|
|
1118
|
-
for (; r <= t;) {
|
|
1119
|
-
let i = (r + t) / 2 | 0, a = e[i * 2];
|
|
1120
|
-
if (a < n) r = i + 1;
|
|
1121
|
-
else if (a > n) t = i - 1;
|
|
1122
|
-
else return i;
|
|
1123
|
-
}
|
|
1124
|
-
return r > 0 ? r - 1 : 0;
|
|
1125
|
-
}
|
|
1126
|
-
function ye(e, t, n, r, i) {
|
|
1127
|
-
let a = e.length - 1;
|
|
1128
|
-
if (e.length <= r) return {
|
|
1129
|
-
startIndex: 0,
|
|
1130
|
-
endIndex: a
|
|
1131
|
-
};
|
|
1132
|
-
if (r === 1 && i !== null) {
|
|
1133
|
-
let e = ve(i, a, n), r = e, o = n + t;
|
|
1134
|
-
for (; r < a && i[r * 2] + i[r * 2 + 1] < o;) r++;
|
|
1135
|
-
return {
|
|
1136
|
-
startIndex: e,
|
|
1137
|
-
endIndex: r
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
let o = U(0, a, (t) => e[t].start, n), s = o;
|
|
1141
|
-
if (r === 1) for (; s < a && e[s].end < n + t;) s++;
|
|
1142
|
-
else if (r > 1) {
|
|
1143
|
-
let i = Array(r).fill(0);
|
|
1144
|
-
for (; s < a && i.some((e) => e < n + t);) {
|
|
1145
|
-
let t = e[s];
|
|
1146
|
-
i[t.lane] = t.end, s++;
|
|
1147
|
-
}
|
|
1148
|
-
let c = Array(r).fill(n + t);
|
|
1149
|
-
for (; o >= 0 && c.some((e) => e >= n);) {
|
|
1150
|
-
let t = e[o];
|
|
1151
|
-
c[t.lane] = t.start, o--;
|
|
1152
|
-
}
|
|
1153
|
-
o = Math.max(0, o - o % r), s = Math.min(a, s + (r - 1 - s % r));
|
|
1154
|
-
}
|
|
1155
|
-
return {
|
|
1156
|
-
startIndex: o,
|
|
1157
|
-
endIndex: s
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
//#endregion
|
|
1161
|
-
//#region node_modules/.pnpm/@tanstack+react-virtual@3.14.13_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@tanstack/react-virtual/dist/esm/index.js
|
|
1162
|
-
var W = typeof document < "u" ? e.useLayoutEffect : e.useEffect;
|
|
1163
|
-
function be({ useFlushSync: t = !0, directDomUpdates: n = !1, directDomUpdatesMode: r = "transform", ...i }) {
|
|
1164
|
-
let a = e.useReducer((e) => e + 1, 0)[1], o = e.useRef({
|
|
1165
|
-
enabled: n,
|
|
1166
|
-
mode: r,
|
|
1167
|
-
container: null,
|
|
1168
|
-
lastSize: null,
|
|
1169
|
-
lastPositions: /* @__PURE__ */ new WeakMap(),
|
|
1170
|
-
prevRange: null
|
|
1171
|
-
});
|
|
1172
|
-
o.current.enabled = n, o.current.mode = r;
|
|
1173
|
-
let s = e.useRef(!1), c = (e) => {
|
|
1174
|
-
let t = o.current;
|
|
1175
|
-
if (!t.enabled || !t.container) return;
|
|
1176
|
-
let n = e.getTotalSize();
|
|
1177
|
-
if (n !== t.lastSize) {
|
|
1178
|
-
t.lastSize = n;
|
|
1179
|
-
let r = e.options.horizontal ? "width" : "height";
|
|
1180
|
-
t.container.style[r] = `${n}px`;
|
|
1181
|
-
}
|
|
1182
|
-
}, l = (e) => {
|
|
1183
|
-
let t = o.current;
|
|
1184
|
-
if (!t.enabled || !t.container) return;
|
|
1185
|
-
c(e);
|
|
1186
|
-
let n = !!e.options.horizontal, r = t.mode === "transform", i = n ? "left" : "top", a = e.options.scrollMargin, s = e.getVirtualItems();
|
|
1187
|
-
for (let o of s) {
|
|
1188
|
-
let s = o.start - a, c = e.elementsCache.get(o.key);
|
|
1189
|
-
c && t.lastPositions.get(c) !== s && (t.lastPositions.set(c, s), r ? c.style.transform = n ? `translate3d(${s}px, 0, 0)` : `translate3d(0, ${s}px, 0)` : c.style[i] = `${s}px`);
|
|
1190
|
-
}
|
|
1191
|
-
}, u = {
|
|
1192
|
-
...i,
|
|
1193
|
-
onChange: (e, n) => {
|
|
1194
|
-
var r;
|
|
1195
|
-
let c = o.current, u = !0;
|
|
1196
|
-
if (c.enabled) {
|
|
1197
|
-
l(e);
|
|
1198
|
-
let t = e.range, n = c.prevRange;
|
|
1199
|
-
u = !n || n.isScrolling !== e.isScrolling || n.startIndex !== t?.startIndex || n.endIndex !== t?.endIndex, u && (c.prevRange = t ? {
|
|
1200
|
-
startIndex: t.startIndex,
|
|
1201
|
-
endIndex: t.endIndex,
|
|
1202
|
-
isScrolling: e.isScrolling
|
|
1203
|
-
} : null);
|
|
1204
|
-
}
|
|
1205
|
-
u && (t && n && !s.current ? g(a) : a()), (r = i.onChange) == null || r.call(i, e, n);
|
|
1206
|
-
}
|
|
1207
|
-
}, [d] = e.useState(() => {
|
|
1208
|
-
let e = new _e(u), t = e.measureElement;
|
|
1209
|
-
return e.measureElement = (e) => {
|
|
1210
|
-
s.current = !0;
|
|
1211
|
-
try {
|
|
1212
|
-
t(e);
|
|
1213
|
-
} finally {
|
|
1214
|
-
s.current = !1;
|
|
1215
|
-
}
|
|
1216
|
-
}, Object.assign(e, { containerRef: (t) => {
|
|
1217
|
-
let n = o.current;
|
|
1218
|
-
if (n.container = t, n.lastSize = null, t && n.enabled) {
|
|
1219
|
-
let r = e.getTotalSize();
|
|
1220
|
-
n.lastSize = r;
|
|
1221
|
-
let i = e.options.horizontal ? "width" : "height";
|
|
1222
|
-
t.style[i] = `${r}px`;
|
|
1223
|
-
}
|
|
1224
|
-
} });
|
|
1225
|
-
});
|
|
1226
|
-
return d.setOptions(u), W(() => d._didMount(), []), W(() => (c(d), d._willUpdate())), W(() => {
|
|
1227
|
-
l(d);
|
|
1228
|
-
}), d;
|
|
1229
|
-
}
|
|
1230
|
-
function xe(e) {
|
|
1231
|
-
return be({
|
|
1232
|
-
observeElementRect: de,
|
|
1233
|
-
observeElementOffset: pe,
|
|
1234
|
-
scrollToFn: he,
|
|
1235
|
-
...e
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
//#endregion
|
|
1239
450
|
//#region packages/icons/search.tsx
|
|
1240
|
-
function
|
|
1241
|
-
return /* @__PURE__ */
|
|
451
|
+
function P(e) {
|
|
452
|
+
return /* @__PURE__ */ f("svg", {
|
|
1242
453
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1243
454
|
fill: "none",
|
|
1244
455
|
viewBox: "0 0 24 24",
|
|
@@ -1246,7 +457,7 @@ function G(e) {
|
|
|
1246
457
|
stroke: "currentColor",
|
|
1247
458
|
className: "h-6 w-6",
|
|
1248
459
|
...e,
|
|
1249
|
-
children: /* @__PURE__ */
|
|
460
|
+
children: /* @__PURE__ */ f("path", {
|
|
1250
461
|
strokeLinecap: "round",
|
|
1251
462
|
strokeLinejoin: "round",
|
|
1252
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"
|
|
@@ -1255,8 +466,8 @@ function G(e) {
|
|
|
1255
466
|
}
|
|
1256
467
|
//#endregion
|
|
1257
468
|
//#region packages/icons/x-mark.tsx
|
|
1258
|
-
function
|
|
1259
|
-
return /* @__PURE__ */
|
|
469
|
+
function oe(e) {
|
|
470
|
+
return /* @__PURE__ */ f("svg", {
|
|
1260
471
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1261
472
|
fill: "none",
|
|
1262
473
|
viewBox: "0 0 24 24",
|
|
@@ -1264,7 +475,7 @@ function Se(e) {
|
|
|
1264
475
|
stroke: "currentColor",
|
|
1265
476
|
className: "h-6 w-6",
|
|
1266
477
|
...e,
|
|
1267
|
-
children: /* @__PURE__ */
|
|
478
|
+
children: /* @__PURE__ */ f("path", {
|
|
1268
479
|
strokeLinecap: "round",
|
|
1269
480
|
strokeLinejoin: "round",
|
|
1270
481
|
d: "M6 18 18 6M6 6l12 12"
|
|
@@ -1272,15 +483,46 @@ function Se(e) {
|
|
|
1272
483
|
});
|
|
1273
484
|
}
|
|
1274
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
|
|
1275
517
|
//#region packages/dropdown/index.tsx
|
|
1276
|
-
function
|
|
1277
|
-
let { items: t, selected: n, className: r, onChange: i, disabled: a, placeholder: o = "Select an Item", multiple: s, mutable: c, onAdd:
|
|
1278
|
-
return /* @__PURE__ */
|
|
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, {
|
|
1279
521
|
triggerClassName: y ? "w-full max-w-none" : void 0,
|
|
1280
|
-
content: /* @__PURE__ */
|
|
522
|
+
content: /* @__PURE__ */ f(I, {
|
|
1281
523
|
...c ? {
|
|
1282
524
|
mutable: c,
|
|
1283
|
-
onAdd:
|
|
525
|
+
onAdd: d
|
|
1284
526
|
} : { mutable: c },
|
|
1285
527
|
...s ? {
|
|
1286
528
|
multiple: s,
|
|
@@ -1293,41 +535,41 @@ function Ce(e) {
|
|
|
1293
535
|
selected: n
|
|
1294
536
|
}
|
|
1295
537
|
}),
|
|
1296
|
-
onOpen: () =>
|
|
1297
|
-
onClose: () =>
|
|
1298
|
-
children: /* @__PURE__ */
|
|
538
|
+
onOpen: () => _(!0),
|
|
539
|
+
onClose: () => _(!1),
|
|
540
|
+
children: /* @__PURE__ */ p("div", {
|
|
1299
541
|
role: "combobox",
|
|
1300
|
-
"aria-expanded":
|
|
542
|
+
"aria-expanded": g,
|
|
1301
543
|
"aria-haspopup": "listbox",
|
|
1302
|
-
className:
|
|
1303
|
-
children: [/* @__PURE__ */
|
|
1304
|
-
className:
|
|
1305
|
-
ref:
|
|
1306
|
-
children: s && !n.length ? /* @__PURE__ */
|
|
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", {
|
|
1307
549
|
className: "text-muted-foreground",
|
|
1308
550
|
children: o
|
|
1309
|
-
}) : s ? /* @__PURE__ */
|
|
551
|
+
}) : s ? /* @__PURE__ */ f(M, {
|
|
1310
552
|
items: n.map((e) => e.text),
|
|
1311
553
|
data: n,
|
|
1312
|
-
parentRef:
|
|
554
|
+
parentRef: m,
|
|
1313
555
|
estimator: (e, t) => t + 40,
|
|
1314
556
|
badgeVariant: "secondary",
|
|
1315
557
|
badgeStyles: "h-6 min-w-min gap-2",
|
|
1316
|
-
children: (e, t, r) => /* @__PURE__ */
|
|
558
|
+
children: (e, t, r) => /* @__PURE__ */ p(x, {
|
|
1317
559
|
className: "flex h-6 min-w-min gap-2 pr-1",
|
|
1318
560
|
variant: "secondary",
|
|
1319
|
-
children: [e, /* @__PURE__ */
|
|
561
|
+
children: [e, /* @__PURE__ */ f(w, {
|
|
1320
562
|
onClick: () => {
|
|
1321
563
|
i(n.filter((e) => e.key !== r?.key));
|
|
1322
564
|
},
|
|
1323
565
|
variant: "icon",
|
|
1324
566
|
size: "icon",
|
|
1325
567
|
className: "group size-4 rounded-sm p-0.5",
|
|
1326
|
-
children: /* @__PURE__ */
|
|
568
|
+
children: /* @__PURE__ */ f(oe, { className: "size-3 transition duration-300 group-hover:rotate-90" })
|
|
1327
569
|
})]
|
|
1328
570
|
}, `collapsed_item_${r?.key ?? t}`)
|
|
1329
571
|
}) : n.text ?? o
|
|
1330
|
-
}), /* @__PURE__ */
|
|
572
|
+
}), /* @__PURE__ */ f("svg", {
|
|
1331
573
|
viewBox: "0 0 16 16",
|
|
1332
574
|
fill: "none",
|
|
1333
575
|
stroke: "currentColor",
|
|
@@ -1335,82 +577,98 @@ function Ce(e) {
|
|
|
1335
577
|
strokeLinecap: "round",
|
|
1336
578
|
strokeLinejoin: "round",
|
|
1337
579
|
"aria-hidden": !0,
|
|
1338
|
-
className:
|
|
1339
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
1340
582
|
})]
|
|
1341
583
|
})
|
|
1342
584
|
});
|
|
1343
585
|
}
|
|
1344
|
-
function
|
|
1345
|
-
let { items: t, multiple: n, selected: r, onChange: i, mutable:
|
|
1346
|
-
count:
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
})
|
|
1350
|
-
|
|
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", {
|
|
1351
597
|
className: "divide-tint/10 flex w-full flex-col divide-y overflow-hidden rounded-xl",
|
|
1352
|
-
children: [/* @__PURE__ */
|
|
1353
|
-
className:
|
|
1354
|
-
children: [/* @__PURE__ */
|
|
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", {
|
|
1355
601
|
className: "text-foreground inline-flex grow bg-transparent text-sm outline-hidden",
|
|
1356
602
|
placeholder: "Search",
|
|
1357
|
-
value:
|
|
1358
|
-
onChange: (e) =>
|
|
603
|
+
value: d,
|
|
604
|
+
onChange: (e) => m(e.target.value)
|
|
1359
605
|
})]
|
|
1360
|
-
}), /* @__PURE__ */
|
|
606
|
+
}), /* @__PURE__ */ p("ul", {
|
|
1361
607
|
role: "listbox",
|
|
1362
|
-
className:
|
|
1363
|
-
ref:
|
|
1364
|
-
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", {
|
|
1365
611
|
style: {
|
|
1366
|
-
height: `${
|
|
612
|
+
height: `${v.totalSize}px`,
|
|
1367
613
|
width: "100%",
|
|
1368
614
|
position: "relative"
|
|
1369
615
|
},
|
|
1370
|
-
children:
|
|
616
|
+
children: v.items.map((e) => /* @__PURE__ */ p("li", {
|
|
1371
617
|
role: "option",
|
|
1372
|
-
"aria-selected":
|
|
618
|
+
"aria-selected": y.includes(_[e.index].key),
|
|
1373
619
|
style: {
|
|
1374
620
|
height: `${e.size}px`,
|
|
1375
621
|
transform: `translateY(${e.start}px)`
|
|
1376
622
|
},
|
|
1377
|
-
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"),
|
|
1378
624
|
onClick: () => {
|
|
1379
|
-
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]);
|
|
1380
626
|
},
|
|
1381
|
-
children: [/* @__PURE__ */
|
|
627
|
+
children: [/* @__PURE__ */ f("span", {
|
|
1382
628
|
className: "text-primary col-start-1",
|
|
1383
629
|
"aria-hidden": !0,
|
|
1384
|
-
children:
|
|
1385
|
-
}), /* @__PURE__ */
|
|
630
|
+
children: y.includes(_[e.index].key) && "✓"
|
|
631
|
+
}), /* @__PURE__ */ f("span", {
|
|
1386
632
|
className: "col-start-2 truncate",
|
|
1387
|
-
children:
|
|
633
|
+
children: _[e.index].text
|
|
1388
634
|
})]
|
|
1389
|
-
}, e.
|
|
1390
|
-
}),
|
|
635
|
+
}, e.index))
|
|
636
|
+
}), d.length > 0 && _.length === 0 && (o ? /* @__PURE__ */ p("li", {
|
|
1391
637
|
role: "option",
|
|
1392
638
|
"aria-selected": !1,
|
|
1393
|
-
className:
|
|
639
|
+
className: h("hover:bg-muted cursor-pointer px-3 py-2 text-sm select-none"),
|
|
1394
640
|
onClick: () => {
|
|
1395
|
-
|
|
1396
|
-
text:
|
|
1397
|
-
key:
|
|
1398
|
-
}),
|
|
641
|
+
s({
|
|
642
|
+
text: d,
|
|
643
|
+
key: d
|
|
644
|
+
}), m("");
|
|
1399
645
|
},
|
|
1400
|
-
children: ["Add ",
|
|
1401
|
-
}) : /* @__PURE__ */
|
|
646
|
+
children: ["Add ", d]
|
|
647
|
+
}) : /* @__PURE__ */ f("li", {
|
|
1402
648
|
role: "option",
|
|
1403
649
|
"aria-selected": !1,
|
|
1404
|
-
className:
|
|
650
|
+
className: h("text-muted-foreground cursor-not-allowed px-3 py-2 text-sm"),
|
|
1405
651
|
children: "No results found"
|
|
1406
652
|
}))]
|
|
1407
653
|
})]
|
|
1408
654
|
});
|
|
1409
655
|
}
|
|
1410
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
|
|
1411
669
|
//#region packages/icons/chevron-down.tsx
|
|
1412
|
-
function
|
|
1413
|
-
return /* @__PURE__ */
|
|
670
|
+
function R(e) {
|
|
671
|
+
return /* @__PURE__ */ f("svg", {
|
|
1414
672
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1415
673
|
fill: "none",
|
|
1416
674
|
viewBox: "0 0 24 24",
|
|
@@ -1418,7 +676,7 @@ function Te(e) {
|
|
|
1418
676
|
stroke: "currentColor",
|
|
1419
677
|
className: "h-6 w-6",
|
|
1420
678
|
...e,
|
|
1421
|
-
children: /* @__PURE__ */
|
|
679
|
+
children: /* @__PURE__ */ f("path", {
|
|
1422
680
|
strokeLinecap: "round",
|
|
1423
681
|
strokeLinejoin: "round",
|
|
1424
682
|
d: "m19.5 8.25-7.5 7.5-7.5-7.5"
|
|
@@ -1427,8 +685,8 @@ function Te(e) {
|
|
|
1427
685
|
}
|
|
1428
686
|
//#endregion
|
|
1429
687
|
//#region packages/icons/chevron-up.tsx
|
|
1430
|
-
function
|
|
1431
|
-
return /* @__PURE__ */
|
|
688
|
+
function z(e) {
|
|
689
|
+
return /* @__PURE__ */ f("svg", {
|
|
1432
690
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1433
691
|
fill: "none",
|
|
1434
692
|
viewBox: "0 0 24 24",
|
|
@@ -1436,7 +694,7 @@ function Ee(e) {
|
|
|
1436
694
|
stroke: "currentColor",
|
|
1437
695
|
className: "h-6 w-6",
|
|
1438
696
|
...e,
|
|
1439
|
-
children: /* @__PURE__ */
|
|
697
|
+
children: /* @__PURE__ */ f("path", {
|
|
1440
698
|
strokeLinecap: "round",
|
|
1441
699
|
strokeLinejoin: "round",
|
|
1442
700
|
d: "m4.5 15.75 7.5-7.5 7.5 7.5"
|
|
@@ -1445,19 +703,29 @@ function Ee(e) {
|
|
|
1445
703
|
}
|
|
1446
704
|
//#endregion
|
|
1447
705
|
//#region packages/input/index.tsx
|
|
1448
|
-
function
|
|
706
|
+
function B(e) {
|
|
1449
707
|
let { className: t, ...n } = e;
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
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),
|
|
1452
710
|
...n
|
|
1453
711
|
});
|
|
1454
712
|
}
|
|
1455
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
|
|
1456
724
|
//#region packages/nav-pills/index.tsx
|
|
1457
|
-
var
|
|
1458
|
-
function
|
|
1459
|
-
let r =
|
|
1460
|
-
return
|
|
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(() => {
|
|
1461
729
|
let e = r.current;
|
|
1462
730
|
if (!e) return;
|
|
1463
731
|
let t = () => {
|
|
@@ -1479,77 +747,96 @@ function Oe({ className: e, children: t, ...n }) {
|
|
|
1479
747
|
return i?.observe(e), () => {
|
|
1480
748
|
n.disconnect(), i?.disconnect();
|
|
1481
749
|
};
|
|
1482
|
-
}, []), /* @__PURE__ */
|
|
1483
|
-
className:
|
|
750
|
+
}, []), /* @__PURE__ */ f("nav", {
|
|
751
|
+
className: h("zen__nav-pills", e),
|
|
1484
752
|
...n,
|
|
1485
|
-
children: /* @__PURE__ */
|
|
753
|
+
children: /* @__PURE__ */ f("div", {
|
|
1486
754
|
ref: r,
|
|
1487
|
-
className:
|
|
1488
|
-
children: /* @__PURE__ */
|
|
755
|
+
className: O,
|
|
756
|
+
children: /* @__PURE__ */ f(H.Provider, {
|
|
1489
757
|
value: i,
|
|
1490
758
|
children: t
|
|
1491
759
|
})
|
|
1492
760
|
})
|
|
1493
761
|
});
|
|
1494
762
|
}
|
|
1495
|
-
function
|
|
1496
|
-
let t =
|
|
1497
|
-
return t ? /* @__PURE__ */
|
|
763
|
+
function W({ className: e }) {
|
|
764
|
+
let t = i(H);
|
|
765
|
+
return t ? /* @__PURE__ */ f("span", {
|
|
1498
766
|
"aria-hidden": !0,
|
|
1499
|
-
className:
|
|
767
|
+
className: h(k, e),
|
|
1500
768
|
style: {
|
|
1501
769
|
translate: `${t.x}px 0`,
|
|
1502
770
|
width: t.w
|
|
1503
771
|
}
|
|
1504
772
|
}) : null;
|
|
1505
773
|
}
|
|
1506
|
-
var
|
|
1507
|
-
function
|
|
1508
|
-
let
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
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
|
+
]
|
|
1522
809
|
});
|
|
1523
810
|
}
|
|
1524
811
|
//#endregion
|
|
1525
812
|
//#region packages/progress-ring/index.tsx
|
|
1526
|
-
function
|
|
813
|
+
function le({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, className: a }) {
|
|
1527
814
|
let o = (t - n) / 2, s = 2 * Math.PI * o, c = Math.min(Math.max(e, 0), 1);
|
|
1528
|
-
return /* @__PURE__ */
|
|
815
|
+
return /* @__PURE__ */ p("div", {
|
|
1529
816
|
role: "progressbar",
|
|
1530
817
|
"aria-label": r,
|
|
1531
818
|
"aria-valuemin": 0,
|
|
1532
819
|
"aria-valuemax": 100,
|
|
1533
820
|
"aria-valuenow": Math.round(c * 100),
|
|
1534
|
-
className:
|
|
821
|
+
className: h("zen__progress-ring relative grid shrink-0 place-items-center", a),
|
|
1535
822
|
style: {
|
|
1536
823
|
width: t,
|
|
1537
824
|
height: t
|
|
1538
825
|
},
|
|
1539
|
-
children: [/* @__PURE__ */
|
|
826
|
+
children: [/* @__PURE__ */ p("svg", {
|
|
1540
827
|
width: t,
|
|
1541
828
|
height: t,
|
|
1542
829
|
viewBox: `0 0 ${t} ${t}`,
|
|
1543
830
|
className: "-rotate-90",
|
|
1544
831
|
"aria-hidden": !0,
|
|
1545
|
-
children: [/* @__PURE__ */
|
|
832
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
1546
833
|
cx: t / 2,
|
|
1547
834
|
cy: t / 2,
|
|
1548
835
|
r: o,
|
|
1549
836
|
fill: "none",
|
|
1550
837
|
strokeWidth: n,
|
|
1551
838
|
className: "stroke-tint/[0.07]"
|
|
1552
|
-
}), /* @__PURE__ */
|
|
839
|
+
}), /* @__PURE__ */ f("circle", {
|
|
1553
840
|
cx: t / 2,
|
|
1554
841
|
cy: t / 2,
|
|
1555
842
|
r: o,
|
|
@@ -1560,7 +847,7 @@ function je({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, clas
|
|
|
1560
847
|
strokeDashoffset: s * (1 - c),
|
|
1561
848
|
className: "stroke-primary [filter:drop-shadow(0_0_6px_oklch(var(--glow)/0.45))] transition-[stroke-dashoffset] duration-700 ease-out"
|
|
1562
849
|
})]
|
|
1563
|
-
}), /* @__PURE__ */
|
|
850
|
+
}), /* @__PURE__ */ f("div", {
|
|
1564
851
|
className: "absolute inset-0 grid place-items-center text-center",
|
|
1565
852
|
children: i
|
|
1566
853
|
})]
|
|
@@ -1568,24 +855,24 @@ function je({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, clas
|
|
|
1568
855
|
}
|
|
1569
856
|
//#endregion
|
|
1570
857
|
//#region packages/segmented/index.tsx
|
|
1571
|
-
function
|
|
1572
|
-
let
|
|
1573
|
-
return /* @__PURE__ */
|
|
1574
|
-
className:
|
|
1575
|
-
children: [/* @__PURE__ */
|
|
1576
|
-
id:
|
|
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,
|
|
1577
864
|
className: "text-sm font-medium",
|
|
1578
865
|
children: e
|
|
1579
|
-
}), /* @__PURE__ */
|
|
866
|
+
}), /* @__PURE__ */ f("div", {
|
|
1580
867
|
role: "radiogroup",
|
|
1581
|
-
"aria-labelledby":
|
|
868
|
+
"aria-labelledby": s,
|
|
1582
869
|
className: "border-tint/10 bg-tint/[0.03] inline-flex w-fit flex-wrap gap-1 rounded-xl border p-1",
|
|
1583
|
-
children: n.map((e) => /* @__PURE__ */
|
|
1584
|
-
className:
|
|
1585
|
-
children: [/* @__PURE__ */
|
|
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", {
|
|
1586
873
|
type: "radio",
|
|
1587
874
|
className: "sr-only",
|
|
1588
|
-
name: i ??
|
|
875
|
+
name: i ?? s,
|
|
1589
876
|
value: e.value,
|
|
1590
877
|
checked: t === e.value,
|
|
1591
878
|
onChange: () => r(e.value)
|
|
@@ -1595,49 +882,154 @@ function Me({ label: e, value: t, options: n, onChange: r, name: i, className: a
|
|
|
1595
882
|
});
|
|
1596
883
|
}
|
|
1597
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
|
|
1598
917
|
//#region packages/skeleton/index.tsx
|
|
1599
|
-
function
|
|
1600
|
-
return /* @__PURE__ */
|
|
918
|
+
function he({ className: e }) {
|
|
919
|
+
return /* @__PURE__ */ f("span", {
|
|
1601
920
|
"aria-hidden": !0,
|
|
1602
|
-
className:
|
|
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
|
|
1603
963
|
});
|
|
1604
964
|
}
|
|
1605
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
|
|
1606
998
|
//#region packages/tabs/index.tsx
|
|
1607
|
-
var
|
|
1608
|
-
function
|
|
1609
|
-
let t =
|
|
999
|
+
var q = t(null);
|
|
1000
|
+
function J(e) {
|
|
1001
|
+
let t = i(q);
|
|
1610
1002
|
if (!t) throw Error(`<${e}> must be inside <Tabs>`);
|
|
1611
1003
|
return t;
|
|
1612
1004
|
}
|
|
1613
|
-
function
|
|
1614
|
-
let [a,
|
|
1615
|
-
return /* @__PURE__ */
|
|
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, {
|
|
1616
1008
|
value: {
|
|
1617
1009
|
value: c,
|
|
1618
1010
|
select: (t) => {
|
|
1619
|
-
e === void 0 &&
|
|
1011
|
+
e === void 0 && s(t), n?.(t);
|
|
1620
1012
|
},
|
|
1621
1013
|
idFor: (e, t) => `${l}-${e}-${t.replace(/\s+/g, "-")}`
|
|
1622
1014
|
},
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1624
|
-
className:
|
|
1015
|
+
children: /* @__PURE__ */ f("div", {
|
|
1016
|
+
className: h("zen__tabs flex flex-col gap-4", r),
|
|
1625
1017
|
...i
|
|
1626
1018
|
})
|
|
1627
1019
|
});
|
|
1628
1020
|
}
|
|
1629
|
-
var
|
|
1630
|
-
function
|
|
1631
|
-
let { value: i } =
|
|
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({
|
|
1632
1024
|
left: 0,
|
|
1633
1025
|
width: 0
|
|
1634
1026
|
});
|
|
1635
|
-
return
|
|
1027
|
+
return s(() => {
|
|
1636
1028
|
let e = o.current;
|
|
1637
1029
|
if (!e) return;
|
|
1638
1030
|
let t = () => {
|
|
1639
1031
|
let t = e.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
|
|
1640
|
-
|
|
1032
|
+
d(t ? {
|
|
1641
1033
|
left: t.offsetLeft,
|
|
1642
1034
|
width: t.offsetWidth
|
|
1643
1035
|
} : {
|
|
@@ -1648,7 +1040,7 @@ function Fe({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
|
1648
1040
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1649
1041
|
let n = new ResizeObserver(t);
|
|
1650
1042
|
return n.observe(e), () => n.disconnect();
|
|
1651
|
-
}, [i]), /* @__PURE__ */
|
|
1043
|
+
}, [i]), /* @__PURE__ */ p("div", {
|
|
1652
1044
|
ref: o,
|
|
1653
1045
|
role: "tablist",
|
|
1654
1046
|
onKeyDown: (e) => {
|
|
@@ -1665,31 +1057,31 @@ function Fe({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
|
1665
1057
|
let i = t[(r + t.length) % t.length];
|
|
1666
1058
|
i.focus(), i.click();
|
|
1667
1059
|
},
|
|
1668
|
-
className:
|
|
1060
|
+
className: h(a ? O : "border-border relative flex gap-1 border-b", t),
|
|
1669
1061
|
...r,
|
|
1670
|
-
children: [/* @__PURE__ */
|
|
1062
|
+
children: [/* @__PURE__ */ f(Y.Provider, {
|
|
1671
1063
|
value: e,
|
|
1672
1064
|
children: n
|
|
1673
|
-
}), a ?
|
|
1065
|
+
}), a ? c.width > 0 && /* @__PURE__ */ f("span", {
|
|
1674
1066
|
"aria-hidden": !0,
|
|
1675
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)]",
|
|
1676
1068
|
style: {
|
|
1677
|
-
width:
|
|
1678
|
-
translate: `${
|
|
1069
|
+
width: c.width,
|
|
1070
|
+
translate: `${c.left}px 0`
|
|
1679
1071
|
}
|
|
1680
|
-
}) : /* @__PURE__ */
|
|
1072
|
+
}) : /* @__PURE__ */ f("span", {
|
|
1681
1073
|
"aria-hidden": !0,
|
|
1682
1074
|
className: "bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
|
|
1683
1075
|
style: {
|
|
1684
|
-
width:
|
|
1685
|
-
translate: `${
|
|
1076
|
+
width: c.width,
|
|
1077
|
+
translate: `${c.left}px 0`
|
|
1686
1078
|
}
|
|
1687
1079
|
})]
|
|
1688
1080
|
});
|
|
1689
1081
|
}
|
|
1690
|
-
function
|
|
1691
|
-
let { value:
|
|
1692
|
-
return /* @__PURE__ */
|
|
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", {
|
|
1693
1085
|
type: "button",
|
|
1694
1086
|
role: "tab",
|
|
1695
1087
|
id: s("tab", e),
|
|
@@ -1700,95 +1092,95 @@ function Ie({ value: e, className: t, onClick: n, ...r }) {
|
|
|
1700
1092
|
onClick: (t) => {
|
|
1701
1093
|
o(e), n?.(t);
|
|
1702
1094
|
},
|
|
1703
|
-
className:
|
|
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),
|
|
1704
1096
|
...r
|
|
1705
1097
|
});
|
|
1706
1098
|
}
|
|
1707
|
-
function
|
|
1708
|
-
let { value: r, idFor: i } =
|
|
1709
|
-
return r === e ? /* @__PURE__ */
|
|
1099
|
+
function Ee({ value: e, className: t, ...n }) {
|
|
1100
|
+
let { value: r, idFor: i } = J("TabPanel");
|
|
1101
|
+
return r === e ? /* @__PURE__ */ f("div", {
|
|
1710
1102
|
role: "tabpanel",
|
|
1711
1103
|
id: i("panel", e),
|
|
1712
1104
|
"aria-labelledby": i("tab", e),
|
|
1713
1105
|
tabIndex: 0,
|
|
1714
|
-
className:
|
|
1106
|
+
className: h("outline-hidden", t),
|
|
1715
1107
|
...n
|
|
1716
1108
|
}) : null;
|
|
1717
1109
|
}
|
|
1718
1110
|
//#endregion
|
|
1719
1111
|
//#region packages/textarea/index.tsx
|
|
1720
|
-
function
|
|
1112
|
+
function De(e) {
|
|
1721
1113
|
let { className: t, ...n } = e;
|
|
1722
|
-
return /* @__PURE__ */
|
|
1723
|
-
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),
|
|
1724
1116
|
...n
|
|
1725
1117
|
});
|
|
1726
1118
|
}
|
|
1727
1119
|
//#endregion
|
|
1728
1120
|
//#region packages/toast/index.tsx
|
|
1729
|
-
var
|
|
1730
|
-
function
|
|
1731
|
-
let [t, n] =
|
|
1732
|
-
|
|
1733
|
-
let c =
|
|
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) => {
|
|
1734
1126
|
n((t) => t.map((t) => t.id === e ? {
|
|
1735
1127
|
...t,
|
|
1736
1128
|
leaving: !0
|
|
1737
|
-
} : t)), setTimeout(() => n((t) => t.filter((t) => t.id !== e)),
|
|
1738
|
-
}, []),
|
|
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 } = {}) => {
|
|
1739
1131
|
let o = s.current++, c = {
|
|
1740
1132
|
id: o,
|
|
1741
1133
|
title: e,
|
|
1742
1134
|
description: t,
|
|
1743
1135
|
tone: r,
|
|
1744
1136
|
action: i,
|
|
1745
|
-
timeout: a ?? (i ? 1e4 :
|
|
1137
|
+
timeout: a ?? (i ? 1e4 : Oe)
|
|
1746
1138
|
};
|
|
1747
1139
|
return n((e) => [...e, c]), o;
|
|
1748
|
-
}, []),
|
|
1749
|
-
return /* @__PURE__ */
|
|
1750
|
-
value:
|
|
1751
|
-
children: [e,
|
|
1140
|
+
}, []), h = t.slice(-3);
|
|
1141
|
+
return /* @__PURE__ */ p(X.Provider, {
|
|
1142
|
+
value: d,
|
|
1143
|
+
children: [e, i && m(/* @__PURE__ */ f("section", {
|
|
1752
1144
|
"aria-label": "Notifications",
|
|
1753
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]",
|
|
1754
|
-
children:
|
|
1146
|
+
children: h.map((e) => /* @__PURE__ */ f(je, {
|
|
1755
1147
|
toast: e,
|
|
1756
1148
|
onDismiss: () => c(e.id)
|
|
1757
1149
|
}, e.id))
|
|
1758
1150
|
}), document.body)]
|
|
1759
1151
|
});
|
|
1760
1152
|
}
|
|
1761
|
-
function
|
|
1762
|
-
let e =
|
|
1153
|
+
function Ae() {
|
|
1154
|
+
let e = i(X);
|
|
1763
1155
|
if (!e) throw Error("useToast() needs a <ToastProvider> above it");
|
|
1764
1156
|
return e;
|
|
1765
1157
|
}
|
|
1766
|
-
var
|
|
1158
|
+
var Q = {
|
|
1767
1159
|
success: {
|
|
1768
|
-
icon:
|
|
1160
|
+
icon: Me,
|
|
1769
1161
|
ring: "border-primary/30",
|
|
1770
1162
|
badge: "bg-primary/15 text-primary",
|
|
1771
1163
|
bar: "bg-primary",
|
|
1772
1164
|
glow: "shadow-[0_18px_50px_-18px_oklch(var(--glow)/0.55)]"
|
|
1773
1165
|
},
|
|
1774
1166
|
error: {
|
|
1775
|
-
icon:
|
|
1167
|
+
icon: Ne,
|
|
1776
1168
|
ring: "border-destructive/40",
|
|
1777
1169
|
badge: "bg-destructive/15 text-destructive",
|
|
1778
1170
|
bar: "bg-destructive",
|
|
1779
1171
|
glow: "shadow-[0_18px_50px_-18px_oklch(var(--destructive)/0.55)]"
|
|
1780
1172
|
},
|
|
1781
1173
|
info: {
|
|
1782
|
-
icon:
|
|
1174
|
+
icon: Pe,
|
|
1783
1175
|
ring: "border-tint/10",
|
|
1784
1176
|
badge: "bg-tint/[0.08] text-foreground",
|
|
1785
1177
|
bar: "bg-muted-foreground",
|
|
1786
1178
|
glow: "shadow-[var(--toast-shadow)]"
|
|
1787
1179
|
}
|
|
1788
1180
|
};
|
|
1789
|
-
function
|
|
1790
|
-
let n =
|
|
1791
|
-
return
|
|
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(() => {
|
|
1792
1184
|
if (!e.timeout || i || e.leaving) return;
|
|
1793
1185
|
let n = Date.now(), r = setTimeout(t, s.current);
|
|
1794
1186
|
return () => {
|
|
@@ -1799,30 +1191,30 @@ function He({ toast: e, onDismiss: t }) {
|
|
|
1799
1191
|
e.timeout,
|
|
1800
1192
|
e.leaving,
|
|
1801
1193
|
t
|
|
1802
|
-
]), /* @__PURE__ */
|
|
1194
|
+
]), /* @__PURE__ */ p("div", {
|
|
1803
1195
|
role: e.tone === "error" ? "alert" : "status",
|
|
1804
1196
|
"aria-atomic": "true",
|
|
1805
|
-
onMouseEnter: () =>
|
|
1806
|
-
onMouseLeave: () =>
|
|
1807
|
-
className:
|
|
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),
|
|
1808
1200
|
children: [
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
className:
|
|
1201
|
+
/* @__PURE__ */ f("span", {
|
|
1202
|
+
className: h("mt-0.5 grid size-8 shrink-0 place-items-center rounded-full", n.badge),
|
|
1811
1203
|
"aria-hidden": !0,
|
|
1812
|
-
children: /* @__PURE__ */
|
|
1204
|
+
children: /* @__PURE__ */ f(r, { className: "size-4" })
|
|
1813
1205
|
}),
|
|
1814
|
-
/* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ p("div", {
|
|
1815
1207
|
className: "flex min-w-0 flex-1 flex-col gap-0.5 pt-0.5",
|
|
1816
1208
|
children: [
|
|
1817
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ f("div", {
|
|
1818
1210
|
className: "text-sm font-semibold",
|
|
1819
1211
|
children: e.title
|
|
1820
1212
|
}),
|
|
1821
|
-
e.description && /* @__PURE__ */
|
|
1213
|
+
e.description && /* @__PURE__ */ f("div", {
|
|
1822
1214
|
className: "text-muted-foreground text-sm leading-5",
|
|
1823
1215
|
children: e.description
|
|
1824
1216
|
}),
|
|
1825
|
-
e.action && /* @__PURE__ */
|
|
1217
|
+
e.action && /* @__PURE__ */ f("button", {
|
|
1826
1218
|
type: "button",
|
|
1827
1219
|
onClick: () => {
|
|
1828
1220
|
e.action?.onClick(), t();
|
|
@@ -1832,12 +1224,12 @@ function He({ toast: e, onDismiss: t }) {
|
|
|
1832
1224
|
})
|
|
1833
1225
|
]
|
|
1834
1226
|
}),
|
|
1835
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ f("button", {
|
|
1836
1228
|
type: "button",
|
|
1837
1229
|
"aria-label": "Dismiss",
|
|
1838
1230
|
onClick: t,
|
|
1839
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",
|
|
1840
|
-
children: /* @__PURE__ */
|
|
1232
|
+
children: /* @__PURE__ */ f("svg", {
|
|
1841
1233
|
viewBox: "0 0 16 16",
|
|
1842
1234
|
fill: "none",
|
|
1843
1235
|
stroke: "currentColor",
|
|
@@ -1845,77 +1237,115 @@ function He({ toast: e, onDismiss: t }) {
|
|
|
1845
1237
|
strokeLinecap: "round",
|
|
1846
1238
|
className: "size-3.5",
|
|
1847
1239
|
"aria-hidden": !0,
|
|
1848
|
-
children: /* @__PURE__ */
|
|
1240
|
+
children: /* @__PURE__ */ f("path", { d: "m4 4 8 8M12 4l-8 8" })
|
|
1849
1241
|
})
|
|
1850
1242
|
}),
|
|
1851
|
-
e.timeout > 0 && /* @__PURE__ */
|
|
1243
|
+
e.timeout > 0 && /* @__PURE__ */ f("span", {
|
|
1852
1244
|
"aria-hidden": !0,
|
|
1853
|
-
className:
|
|
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),
|
|
1854
1246
|
style: { animationDuration: `${e.timeout}ms` }
|
|
1855
1247
|
})
|
|
1856
1248
|
]
|
|
1857
1249
|
});
|
|
1858
1250
|
}
|
|
1859
|
-
function
|
|
1860
|
-
return /* @__PURE__ */
|
|
1251
|
+
function Me({ className: e }) {
|
|
1252
|
+
return /* @__PURE__ */ f("svg", {
|
|
1861
1253
|
viewBox: "0 0 16 16",
|
|
1862
1254
|
fill: "none",
|
|
1863
1255
|
stroke: "currentColor",
|
|
1864
1256
|
strokeWidth: "2",
|
|
1865
1257
|
strokeLinecap: "round",
|
|
1866
1258
|
strokeLinejoin: "round",
|
|
1867
|
-
className:
|
|
1259
|
+
className: h("size-3.5", e),
|
|
1868
1260
|
"aria-hidden": !0,
|
|
1869
|
-
children: /* @__PURE__ */
|
|
1261
|
+
children: /* @__PURE__ */ f("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
1870
1262
|
});
|
|
1871
1263
|
}
|
|
1872
|
-
function
|
|
1873
|
-
return /* @__PURE__ */
|
|
1264
|
+
function Ne({ className: e }) {
|
|
1265
|
+
return /* @__PURE__ */ p("svg", {
|
|
1874
1266
|
viewBox: "0 0 16 16",
|
|
1875
1267
|
fill: "none",
|
|
1876
1268
|
stroke: "currentColor",
|
|
1877
1269
|
strokeWidth: "1.8",
|
|
1878
1270
|
strokeLinecap: "round",
|
|
1879
1271
|
strokeLinejoin: "round",
|
|
1880
|
-
className:
|
|
1272
|
+
className: h("size-3.5", e),
|
|
1881
1273
|
"aria-hidden": !0,
|
|
1882
|
-
children: [/* @__PURE__ */
|
|
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" })]
|
|
1883
1275
|
});
|
|
1884
1276
|
}
|
|
1885
|
-
function
|
|
1886
|
-
return /* @__PURE__ */
|
|
1277
|
+
function Pe({ className: e }) {
|
|
1278
|
+
return /* @__PURE__ */ p("svg", {
|
|
1887
1279
|
viewBox: "0 0 16 16",
|
|
1888
1280
|
fill: "none",
|
|
1889
1281
|
stroke: "currentColor",
|
|
1890
1282
|
strokeWidth: "1.8",
|
|
1891
1283
|
strokeLinecap: "round",
|
|
1892
|
-
className:
|
|
1284
|
+
className: h("size-3.5", e),
|
|
1893
1285
|
"aria-hidden": !0,
|
|
1894
|
-
children: [/* @__PURE__ */
|
|
1286
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
1895
1287
|
cx: "8",
|
|
1896
1288
|
cy: "8",
|
|
1897
1289
|
r: "6.3"
|
|
1898
|
-
}), /* @__PURE__ */
|
|
1290
|
+
}), /* @__PURE__ */ f("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
|
|
1899
1291
|
});
|
|
1900
1292
|
}
|
|
1901
1293
|
//#endregion
|
|
1902
1294
|
//#region packages/toggle/index.tsx
|
|
1903
|
-
function
|
|
1295
|
+
function Fe(e) {
|
|
1904
1296
|
let { className: t, onChange: n, disabled: r, ...i } = e;
|
|
1905
|
-
return /* @__PURE__ */
|
|
1906
|
-
className:
|
|
1907
|
-
children: [/* @__PURE__ */
|
|
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", {
|
|
1908
1300
|
type: "checkbox",
|
|
1909
1301
|
role: "switch",
|
|
1910
1302
|
className: "peer sr-only",
|
|
1911
1303
|
disabled: r,
|
|
1912
1304
|
onChange: (e) => n?.(e.target.checked),
|
|
1913
1305
|
...i
|
|
1914
|
-
}), /* @__PURE__ */
|
|
1306
|
+
}), /* @__PURE__ */ f("span", {
|
|
1915
1307
|
"aria-hidden": !0,
|
|
1916
|
-
className:
|
|
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")
|
|
1917
1309
|
})]
|
|
1918
1310
|
});
|
|
1919
1311
|
}
|
|
1920
1312
|
//#endregion
|
|
1921
|
-
|
|
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
|
+
})
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
//#endregion
|
|
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 };
|