@rinzai/zen 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions-menu/index.d.ts.map +1 -1
- package/dist/animated-number/index.d.ts +25 -0
- package/dist/animated-number/index.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +24 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/backdrop/index.d.ts.map +1 -1
- package/dist/badge/index.d.ts +1 -1
- package/dist/base.css +100 -0
- package/dist/button/index.d.ts +2 -2
- package/dist/button/index.d.ts.map +1 -1
- package/dist/code-block/index.d.ts +19 -0
- package/dist/code-block/index.d.ts.map +1 -0
- package/dist/collapse/index.d.ts.map +1 -1
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dropdown/index.d.ts.map +1 -1
- package/dist/editable-cell/index.d.ts +24 -0
- package/dist/editable-cell/index.d.ts.map +1 -0
- package/dist/field/index.d.ts +25 -0
- package/dist/field/index.d.ts.map +1 -0
- package/dist/header/index.d.ts +8 -0
- package/dist/header/index.d.ts.map +1 -0
- package/dist/icons/chevron-left.d.ts +3 -0
- package/dist/icons/chevron-left.d.ts.map +1 -0
- package/dist/icons/chevron-right.d.ts +3 -0
- package/dist/icons/chevron-right.d.ts.map +1 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/status.d.ts +2 -0
- package/dist/icons/status.d.ts.map +1 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/input-group/index.d.ts +17 -0
- package/dist/input-group/index.d.ts.map +1 -0
- package/dist/lib.d.ts +2 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/meter/index.d.ts +25 -0
- package/dist/meter/index.d.ts.map +1 -0
- package/dist/money-input/index.d.ts +70 -0
- package/dist/money-input/index.d.ts.map +1 -0
- package/dist/month-picker/index.d.ts +28 -0
- package/dist/month-picker/index.d.ts.map +1 -0
- 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/popover/index.d.ts.map +1 -1
- package/dist/segmented/index.d.ts +2 -1
- package/dist/segmented/index.d.ts.map +1 -1
- package/dist/select/index.d.ts +32 -0
- package/dist/select/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/slider/index.d.ts +25 -0
- package/dist/slider/index.d.ts.map +1 -0
- package/dist/tab-bar/index.d.ts +23 -0
- package/dist/tab-bar/index.d.ts.map +1 -0
- package/dist/table/index.d.ts +80 -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/tailwind.css +7 -0
- package/dist/theme-toggle/index.d.ts +20 -0
- package/dist/theme-toggle/index.d.ts.map +1 -0
- package/dist/theme.css +888 -0
- package/dist/toast/index.d.ts +11 -3
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/tree/index.d.ts +79 -0
- package/dist/tree/index.d.ts.map +1 -0
- package/dist/utils/cx.d.ts +5 -0
- package/dist/utils/cx.d.ts.map +1 -1
- package/dist/utils/field-chevron.d.ts +6 -0
- package/dist/utils/field-chevron.d.ts.map +1 -0
- package/dist/utils/graphics.d.ts +20 -0
- package/dist/utils/graphics.d.ts.map +1 -0
- package/dist/utils/merge.d.ts +12 -0
- package/dist/utils/merge.d.ts.map +1 -0
- package/dist/utils/money.d.ts +30 -0
- package/dist/utils/money.d.ts.map +1 -0
- package/dist/utils/month.d.ts +16 -0
- package/dist/utils/month.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/status-icons.d.ts +11 -0
- package/dist/utils/status-icons.d.ts.map +1 -0
- package/dist/utils/styles.d.ts +6 -0
- package/dist/utils/styles.d.ts.map +1 -1
- package/dist/utils/theme.d.ts +92 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/useAnchoredPopup.d.ts +36 -0
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -0
- package/dist/utils/useHydrated.d.ts +3 -0
- package/dist/utils/useHydrated.d.ts.map +1 -0
- package/dist/utils/useVirtualList.d.ts +30 -0
- package/dist/utils/useVirtualList.d.ts.map +1 -0
- package/dist/variables.css +90 -0
- package/dist/zen.css +1 -1
- package/dist/zen.js +2222 -1217
- package/package.json +10 -4
package/dist/zen.js
CHANGED
|
@@ -1,129 +1,677 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
|
|
2
|
+
import { Children as e, cloneElement as t, createContext as n, isValidElement as r, useCallback as i, useContext as a, useEffect as o, useId as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
|
|
3
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as g } from "react-dom";
|
|
5
|
+
//#region packages/utils/merge.ts
|
|
6
|
+
function _(e) {
|
|
7
|
+
let t = v.get(e);
|
|
8
|
+
if (t !== void 0) return t;
|
|
9
|
+
let n = e.split(/\s+/).filter(Boolean), r = /* @__PURE__ */ new Set(), i = [];
|
|
10
|
+
for (let e = n.length - 1; e >= 0; e--) {
|
|
11
|
+
let t = n[e], a = y(t);
|
|
12
|
+
if (!a) {
|
|
13
|
+
i.push(t);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
let o = a.scope;
|
|
17
|
+
if (!r.has(o + a.group)) {
|
|
18
|
+
r.add(o + a.group);
|
|
19
|
+
for (let e of ae[a.group] ?? []) r.add(o + e);
|
|
20
|
+
i.push(t);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let a = i.reverse().join(" ");
|
|
24
|
+
return v.size >= 1e3 && v.clear(), v.set(e, a), a;
|
|
25
|
+
}
|
|
26
|
+
var v = /* @__PURE__ */ new Map();
|
|
27
|
+
function y(e) {
|
|
28
|
+
let t = b(e), n = t.pop(), r = !1;
|
|
29
|
+
n.startsWith("!") ? [r, n] = [!0, n.slice(1)] : n.endsWith("!") && ([r, n] = [!0, n.slice(0, -1)]), n.startsWith("-") && (n = n.slice(1));
|
|
30
|
+
let i = ie(n);
|
|
31
|
+
return i ? {
|
|
32
|
+
group: i,
|
|
33
|
+
scope: t.sort().join(":") + (r ? "!" : "") + "|"
|
|
34
|
+
} : null;
|
|
35
|
+
}
|
|
36
|
+
function b(e) {
|
|
37
|
+
let t = [], n = 0, r = 0;
|
|
38
|
+
for (let i = 0; i < e.length; i++) {
|
|
39
|
+
let a = e[i];
|
|
40
|
+
a === "[" || a === "(" ? n++ : a === "]" || a === ")" ? n-- : a === ":" && n === 0 && (t.push(e.slice(r, i)), r = i + 1);
|
|
41
|
+
}
|
|
42
|
+
return t.push(e.slice(r)), t;
|
|
43
|
+
}
|
|
44
|
+
var x = /^\d+(\.\d+)?$/, S = /^(\d?xs|sm|md|lg|\d?xl|base|none|full)$/, C = /^[[(](length:|size:|percentage:|number:)?(-?[\d.]+[a-z%]*|calc\(|min\(|max\(|clamp\(|var\(--[\w-]*(size|width|radius|spacing|length)[\w-]*\))/, w = (e) => e.replace(/\/[^/[\]()]*$/, ""), T = (e) => e === "" || x.test(e) || C.test(e), E = [
|
|
45
|
+
"x",
|
|
46
|
+
"y",
|
|
47
|
+
"t",
|
|
48
|
+
"r",
|
|
49
|
+
"b",
|
|
50
|
+
"l",
|
|
51
|
+
"s",
|
|
52
|
+
"e"
|
|
53
|
+
], ee = [
|
|
54
|
+
"t",
|
|
55
|
+
"r",
|
|
56
|
+
"b",
|
|
57
|
+
"l",
|
|
58
|
+
"s",
|
|
59
|
+
"e",
|
|
60
|
+
"tl",
|
|
61
|
+
"tr",
|
|
62
|
+
"br",
|
|
63
|
+
"bl",
|
|
64
|
+
"ss",
|
|
65
|
+
"se",
|
|
66
|
+
"es",
|
|
67
|
+
"ee"
|
|
68
|
+
], te = {}, D = (e, t) => t.split(" ").forEach((t) => te[t] = e);
|
|
69
|
+
D("display", "block inline-block inline flex inline-flex grid inline-grid contents hidden flow-root list-item table inline-table table-row table-cell table-caption table-column table-row-group table-header-group table-footer-group"), D("position", "static fixed absolute relative sticky"), D("visibility", "visible invisible collapse"), D("isolation", "isolate isolation-auto"), D("text-overflow", "truncate text-ellipsis text-clip"), D("text-transform", "uppercase lowercase capitalize normal-case"), D("font-style", "italic not-italic"), D("text-decoration-line", "underline overline line-through no-underline"), D("font-smoothing", "antialiased subpixel-antialiased"), D("sr", "sr-only not-sr-only"), D("flex-direction", "flex-row flex-row-reverse flex-col flex-col-reverse"), D("flex-wrap", "flex-wrap flex-wrap-reverse flex-nowrap"), D("border-style", "border-solid border-dashed border-dotted border-double border-hidden border-none"), D("border-collapse", "border-collapse border-separate"), D("table-layout", "table-auto table-fixed"), D("box-sizing", "box-border box-content"), D("grow", "grow"), D("shrink", "shrink"), D("transition", "transition"), D("shadow", "shadow"), D("ring-w", "ring"), D("ring-inset", "ring-inset"), D("outline-w", "outline"), D("border-w", "border"), D("rounded", "rounded");
|
|
70
|
+
for (let e of E) D(`border-w-${e}`, `border-${e}`);
|
|
71
|
+
for (let e of ee) D(`rounded-${e}`, `rounded-${e}`);
|
|
72
|
+
var O = {
|
|
73
|
+
inset: "inset",
|
|
74
|
+
"inset-x": "inset-x",
|
|
75
|
+
"inset-y": "inset-y",
|
|
76
|
+
top: "top",
|
|
77
|
+
right: "right",
|
|
78
|
+
bottom: "bottom",
|
|
79
|
+
left: "left",
|
|
80
|
+
start: "start",
|
|
81
|
+
end: "end",
|
|
82
|
+
z: "z",
|
|
83
|
+
order: "order",
|
|
84
|
+
basis: "basis",
|
|
85
|
+
grow: "grow",
|
|
86
|
+
shrink: "shrink",
|
|
87
|
+
flex: "flex",
|
|
88
|
+
"grid-cols": "grid-cols",
|
|
89
|
+
"grid-rows": "grid-rows",
|
|
90
|
+
"grid-flow": "grid-flow",
|
|
91
|
+
"auto-cols": "auto-cols",
|
|
92
|
+
"auto-rows": "auto-rows",
|
|
93
|
+
col: "col",
|
|
94
|
+
"col-span": "col-span",
|
|
95
|
+
"col-start": "col-start",
|
|
96
|
+
"col-end": "col-end",
|
|
97
|
+
row: "row",
|
|
98
|
+
"row-span": "row-span",
|
|
99
|
+
"row-start": "row-start",
|
|
100
|
+
"row-end": "row-end",
|
|
101
|
+
gap: "gap",
|
|
102
|
+
"gap-x": "gap-x",
|
|
103
|
+
"gap-y": "gap-y",
|
|
104
|
+
"space-x": "space-x",
|
|
105
|
+
"space-y": "space-y",
|
|
106
|
+
w: "w",
|
|
107
|
+
"min-w": "min-w",
|
|
108
|
+
"max-w": "max-w",
|
|
109
|
+
h: "h",
|
|
110
|
+
"min-h": "min-h",
|
|
111
|
+
"max-h": "max-h",
|
|
112
|
+
size: "size",
|
|
113
|
+
justify: "justify-content",
|
|
114
|
+
"justify-items": "justify-items",
|
|
115
|
+
"justify-self": "justify-self",
|
|
116
|
+
items: "align-items",
|
|
117
|
+
self: "align-self",
|
|
118
|
+
content: (e) => e === "none" || e.startsWith("[") || e.startsWith("(") ? "content" : "align-content",
|
|
119
|
+
"place-content": "place-content",
|
|
120
|
+
"place-items": "place-items",
|
|
121
|
+
"place-self": "place-self",
|
|
122
|
+
overflow: "overflow",
|
|
123
|
+
"overflow-x": "overflow-x",
|
|
124
|
+
"overflow-y": "overflow-y",
|
|
125
|
+
"border-spacing": "border-spacing",
|
|
126
|
+
"border-spacing-x": "border-spacing-x",
|
|
127
|
+
"border-spacing-y": "border-spacing-y",
|
|
128
|
+
bg: (e) => {
|
|
129
|
+
let t = w(e);
|
|
130
|
+
return [
|
|
131
|
+
"fixed",
|
|
132
|
+
"local",
|
|
133
|
+
"scroll"
|
|
134
|
+
].includes(t) ? "bg-attachment" : /^(clip|origin)-/.test(t) ? "bg-" + t.split("-")[0] : /^(repeat|no-repeat)/.test(t) ? "bg-repeat" : [
|
|
135
|
+
"auto",
|
|
136
|
+
"cover",
|
|
137
|
+
"contain"
|
|
138
|
+
].includes(t) ? "bg-size" : /^(top|bottom|left|right|center)/.test(t) ? "bg-position" : t === "none" || /^(linear|radial|conic|gradient)-/.test(t) || /^\[(url|image:|(repeating-)?(linear|radial|conic)-gradient)/.test(t) ? "bg-image" : "bg-color";
|
|
139
|
+
},
|
|
140
|
+
text: (e) => {
|
|
141
|
+
let t = w(e);
|
|
142
|
+
return [
|
|
143
|
+
"left",
|
|
144
|
+
"center",
|
|
145
|
+
"right",
|
|
146
|
+
"justify",
|
|
147
|
+
"start",
|
|
148
|
+
"end"
|
|
149
|
+
].includes(t) ? "text-align" : [
|
|
150
|
+
"wrap",
|
|
151
|
+
"nowrap",
|
|
152
|
+
"balance",
|
|
153
|
+
"pretty"
|
|
154
|
+
].includes(t) ? "text-wrap" : S.test(t) || C.test(t) ? "font-size" : "text-color";
|
|
155
|
+
},
|
|
156
|
+
font: (e) => /^(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/.test(e) || /^[[(](number:|\d)/.test(e) ? "font-weight" : "font-family",
|
|
157
|
+
leading: "leading",
|
|
158
|
+
tracking: "tracking",
|
|
159
|
+
whitespace: "whitespace",
|
|
160
|
+
break: (e) => [
|
|
161
|
+
"normal",
|
|
162
|
+
"words",
|
|
163
|
+
"all",
|
|
164
|
+
"keep"
|
|
165
|
+
].includes(e) ? "word-break" : null,
|
|
166
|
+
"line-clamp": "line-clamp",
|
|
167
|
+
align: "vertical-align",
|
|
168
|
+
opacity: "opacity",
|
|
169
|
+
shadow: (e) => e === "" || S.test(w(e)) || e === "inner" || /^\[(?!color:)/.test(e) ? "shadow" : "shadow-color",
|
|
170
|
+
ring: (e) => T(e) ? "ring-w" : "ring-color",
|
|
171
|
+
"ring-offset": (e) => T(e) ? "ring-offset-w" : "ring-offset-color",
|
|
172
|
+
outline: (e) => [
|
|
173
|
+
"none",
|
|
174
|
+
"hidden",
|
|
175
|
+
"solid",
|
|
176
|
+
"dashed",
|
|
177
|
+
"dotted",
|
|
178
|
+
"double"
|
|
179
|
+
].includes(e) ? "outline-style" : T(e) ? "outline-w" : "outline-color",
|
|
180
|
+
"outline-offset": "outline-offset",
|
|
181
|
+
cursor: "cursor",
|
|
182
|
+
"pointer-events": "pointer-events",
|
|
183
|
+
select: "user-select",
|
|
184
|
+
resize: "resize",
|
|
185
|
+
transition: "transition",
|
|
186
|
+
duration: "duration",
|
|
187
|
+
ease: "ease",
|
|
188
|
+
delay: "delay",
|
|
189
|
+
animate: "animate",
|
|
190
|
+
scale: "scale",
|
|
191
|
+
"scale-x": "scale-x",
|
|
192
|
+
"scale-y": "scale-y",
|
|
193
|
+
rotate: "rotate",
|
|
194
|
+
translate: "translate",
|
|
195
|
+
"translate-x": "translate-x",
|
|
196
|
+
"translate-y": "translate-y",
|
|
197
|
+
origin: "transform-origin",
|
|
198
|
+
fill: "fill",
|
|
199
|
+
stroke: (e) => x.test(e) ? "stroke-w" : "stroke-color",
|
|
200
|
+
aspect: "aspect",
|
|
201
|
+
object: (e) => [
|
|
202
|
+
"contain",
|
|
203
|
+
"cover",
|
|
204
|
+
"fill",
|
|
205
|
+
"none",
|
|
206
|
+
"scale-down"
|
|
207
|
+
].includes(e) ? "object-fit" : "object-position",
|
|
208
|
+
blur: "blur",
|
|
209
|
+
"backdrop-blur": "backdrop-blur",
|
|
210
|
+
"mix-blend": "mix-blend",
|
|
211
|
+
appearance: "appearance",
|
|
212
|
+
"will-change": "will-change",
|
|
213
|
+
"underline-offset": "underline-offset",
|
|
214
|
+
accent: "accent-color",
|
|
215
|
+
caret: "caret-color",
|
|
216
|
+
float: "float",
|
|
217
|
+
clear: "clear",
|
|
218
|
+
columns: "columns",
|
|
219
|
+
rounded: "rounded",
|
|
220
|
+
border: (e) => T(e) ? "border-w" : "border-color"
|
|
221
|
+
};
|
|
222
|
+
for (let e of ["p", "m"]) {
|
|
223
|
+
O[e] = e;
|
|
224
|
+
for (let t of E) O[e + t] = e + t;
|
|
225
|
+
}
|
|
226
|
+
for (let e of E) O[`border-${e}`] = (t) => T(t) ? `border-w-${e}` : `border-color-${e}`;
|
|
227
|
+
for (let e of ee) O[`rounded-${e}`] = `rounded-${e}`;
|
|
228
|
+
var ne = /* @__PURE__ */ new Set(["text-glow", "text-aurora"]), re = Object.keys(O).sort((e, t) => t.length - e.length);
|
|
229
|
+
function ie(e) {
|
|
230
|
+
if (ne.has(e)) return null;
|
|
231
|
+
if (te[e]) return te[e];
|
|
232
|
+
if (e.startsWith("[")) {
|
|
233
|
+
let t = e.indexOf(":");
|
|
234
|
+
return t > 1 ? "prop:" + e.slice(1, t) : null;
|
|
235
|
+
}
|
|
236
|
+
for (let t of re) {
|
|
237
|
+
if (!e.startsWith(t + "-")) continue;
|
|
238
|
+
let n = O[t];
|
|
239
|
+
return typeof n == "string" ? n : n(e.slice(t.length + 1));
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
var ae = {
|
|
244
|
+
p: E.map((e) => "p" + e),
|
|
245
|
+
m: E.map((e) => "m" + e),
|
|
246
|
+
px: [
|
|
247
|
+
"pl",
|
|
248
|
+
"pr",
|
|
249
|
+
"ps",
|
|
250
|
+
"pe"
|
|
251
|
+
],
|
|
252
|
+
py: ["pt", "pb"],
|
|
253
|
+
mx: [
|
|
254
|
+
"ml",
|
|
255
|
+
"mr",
|
|
256
|
+
"ms",
|
|
257
|
+
"me"
|
|
258
|
+
],
|
|
259
|
+
my: ["mt", "mb"],
|
|
260
|
+
inset: [
|
|
261
|
+
"inset-x",
|
|
262
|
+
"inset-y",
|
|
263
|
+
"top",
|
|
264
|
+
"right",
|
|
265
|
+
"bottom",
|
|
266
|
+
"left",
|
|
267
|
+
"start",
|
|
268
|
+
"end"
|
|
269
|
+
],
|
|
270
|
+
"inset-x": ["left", "right"],
|
|
271
|
+
"inset-y": ["top", "bottom"],
|
|
272
|
+
size: ["w", "h"],
|
|
273
|
+
gap: ["gap-x", "gap-y"],
|
|
274
|
+
overflow: ["overflow-x", "overflow-y"],
|
|
275
|
+
"border-spacing": ["border-spacing-x", "border-spacing-y"],
|
|
276
|
+
"border-w": E.map((e) => "border-w-" + e),
|
|
277
|
+
"border-w-x": [
|
|
278
|
+
"border-w-l",
|
|
279
|
+
"border-w-r",
|
|
280
|
+
"border-w-s",
|
|
281
|
+
"border-w-e"
|
|
282
|
+
],
|
|
283
|
+
"border-w-y": ["border-w-t", "border-w-b"],
|
|
284
|
+
"border-color": E.map((e) => "border-color-" + e),
|
|
285
|
+
"border-color-x": [
|
|
286
|
+
"border-color-l",
|
|
287
|
+
"border-color-r",
|
|
288
|
+
"border-color-s",
|
|
289
|
+
"border-color-e"
|
|
290
|
+
],
|
|
291
|
+
"border-color-y": ["border-color-t", "border-color-b"],
|
|
292
|
+
rounded: ee.map((e) => "rounded-" + e),
|
|
293
|
+
"rounded-t": ["rounded-tl", "rounded-tr"],
|
|
294
|
+
"rounded-r": ["rounded-tr", "rounded-br"],
|
|
295
|
+
"rounded-b": ["rounded-br", "rounded-bl"],
|
|
296
|
+
"rounded-l": ["rounded-tl", "rounded-bl"],
|
|
297
|
+
"rounded-s": ["rounded-ss", "rounded-es"],
|
|
298
|
+
"rounded-e": ["rounded-se", "rounded-ee"],
|
|
299
|
+
translate: ["translate-x", "translate-y"],
|
|
300
|
+
scale: ["scale-x", "scale-y"],
|
|
301
|
+
flex: [
|
|
302
|
+
"grow",
|
|
303
|
+
"shrink",
|
|
304
|
+
"basis"
|
|
305
|
+
]
|
|
306
|
+
}, k = (...e) => _(oe(e)), oe = (e) => e.reduce((e, t) => t == null || t === !1 ? e : typeof t == "string" || typeof t == "number" ? e + " " + t : Array.isArray(t) ? e + " " + oe(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, ""), se = "data-zen-graphics", ce = /swiftshader|llvmpipe|softpipe|software|basic render driver|mesa offscreen/i, A;
|
|
307
|
+
function le() {
|
|
308
|
+
if (A) return A;
|
|
309
|
+
if (typeof document > "u") return "full";
|
|
310
|
+
try {
|
|
311
|
+
let e = document.createElement("canvas"), t = e.getContext("webgl", { failIfMajorPerformanceCaveat: !0 }) ?? e.getContext("experimental-webgl", { failIfMajorPerformanceCaveat: !0 });
|
|
312
|
+
if (!t) A = "lite";
|
|
313
|
+
else {
|
|
314
|
+
let e = t.getExtension("WEBGL_debug_renderer_info"), n = String(t.getParameter(e ? e.UNMASKED_RENDERER_WEBGL : t.RENDERER) ?? "");
|
|
315
|
+
A = ce.test(n) ? "lite" : "full", t.getExtension("WEBGL_lose_context")?.loseContext();
|
|
316
|
+
}
|
|
317
|
+
} catch {
|
|
318
|
+
A = "lite";
|
|
319
|
+
}
|
|
320
|
+
return A;
|
|
321
|
+
}
|
|
322
|
+
function j() {
|
|
323
|
+
if (typeof document > "u") return "full";
|
|
324
|
+
let e = document.documentElement, t = e.getAttribute(se);
|
|
325
|
+
if (t === "full" || t === "lite") return t;
|
|
326
|
+
let n = le();
|
|
327
|
+
return e.setAttribute(se, n), n;
|
|
328
|
+
}
|
|
329
|
+
function M() {
|
|
330
|
+
o(() => {
|
|
331
|
+
j();
|
|
332
|
+
}, []);
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region packages/utils/useAnchoredPopup.ts
|
|
336
|
+
function N({ align: e = "start", offset: t = 4, matchWidth: n = !1, onOpenChange: r } = {}) {
|
|
337
|
+
let a = `zen__popup-${s().replace(/[^\w-]/g, "")}`, c = u(null), [l, f] = d(!1), p = u(r);
|
|
338
|
+
p.current = r;
|
|
339
|
+
let m = u(!1), h = i((e) => {
|
|
340
|
+
f(e), m.current !== e && (m.current = e, p.current?.(e));
|
|
341
|
+
}, []), g = i((e) => {
|
|
342
|
+
let t = c.current;
|
|
343
|
+
if (t) {
|
|
344
|
+
try {
|
|
345
|
+
e ? t.showPopover?.() : t.hidePopover?.();
|
|
346
|
+
} catch {}
|
|
347
|
+
h(e);
|
|
348
|
+
}
|
|
349
|
+
}, [h]);
|
|
350
|
+
return o(() => {
|
|
351
|
+
let e = c.current;
|
|
352
|
+
if (!e) return;
|
|
353
|
+
let t = (e) => h(e.newState === "open");
|
|
354
|
+
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
355
|
+
}, [h]), {
|
|
356
|
+
id: a,
|
|
357
|
+
open: l,
|
|
358
|
+
setOpen: g,
|
|
359
|
+
triggerProps: {
|
|
360
|
+
popoverTarget: a,
|
|
361
|
+
"aria-expanded": l,
|
|
362
|
+
"aria-controls": a,
|
|
363
|
+
"data-popup-open": l || void 0,
|
|
364
|
+
style: { anchorName: `--${a}` }
|
|
365
|
+
},
|
|
366
|
+
popupProps: {
|
|
367
|
+
ref: c,
|
|
368
|
+
id: a,
|
|
369
|
+
popover: "auto",
|
|
370
|
+
style: {
|
|
371
|
+
positionAnchor: `--${a}`,
|
|
372
|
+
positionArea: e === "start" ? "block-end span-inline-end" : "block-end span-inline-start",
|
|
373
|
+
positionTryFallbacks: "flip-block",
|
|
374
|
+
inset: "auto",
|
|
375
|
+
margin: `${t}px 0`,
|
|
376
|
+
...n && { minWidth: "anchor-size(width)" }
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
popupRef: c
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region packages/actions-menu/index.tsx
|
|
384
|
+
var ue = "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]";
|
|
385
|
+
function de({ label: e, actions: t, className: n }) {
|
|
386
|
+
M();
|
|
387
|
+
let r = N({
|
|
388
|
+
align: "end",
|
|
389
|
+
offset: 6,
|
|
390
|
+
onOpenChange: (e) => e && r.popupRef.current?.focus()
|
|
391
|
+
}), i = r.popupRef, a = t.filter((e) => !!e), o = (e) => {
|
|
392
|
+
let t = Array.from(i.current?.querySelectorAll("[role=\"menuitem\"]") ?? []), n = t.indexOf(document.activeElement), r = t.length - 1, a = {
|
|
393
|
+
ArrowDown: n + 1,
|
|
394
|
+
ArrowUp: n === -1 ? r : n - 1,
|
|
395
|
+
Home: 0,
|
|
396
|
+
End: r
|
|
397
|
+
}[e.key];
|
|
398
|
+
a !== void 0 && (e.preventDefault(), t[(a + t.length) % t.length]?.focus());
|
|
399
|
+
};
|
|
400
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("button", {
|
|
11
401
|
type: "button",
|
|
12
402
|
"aria-label": e,
|
|
13
403
|
"aria-haspopup": "menu",
|
|
14
|
-
|
|
15
|
-
className:
|
|
16
|
-
|
|
17
|
-
children: /* @__PURE__ */ m("svg", {
|
|
404
|
+
...r.triggerProps,
|
|
405
|
+
className: k("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", "data-popup-open:bg-tint/[0.06]", n),
|
|
406
|
+
children: /* @__PURE__ */ h("svg", {
|
|
18
407
|
viewBox: "0 0 16 16",
|
|
19
408
|
fill: "currentColor",
|
|
20
409
|
className: "size-4",
|
|
21
410
|
"aria-hidden": !0,
|
|
22
411
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ m("circle", {
|
|
24
413
|
cx: "3",
|
|
25
414
|
cy: "8",
|
|
26
415
|
r: "1.4"
|
|
27
416
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ m("circle", {
|
|
29
418
|
cx: "8",
|
|
30
419
|
cy: "8",
|
|
31
420
|
r: "1.4"
|
|
32
421
|
}),
|
|
33
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ m("circle", {
|
|
34
423
|
cx: "13",
|
|
35
424
|
cy: "8",
|
|
36
425
|
r: "1.4"
|
|
37
426
|
})
|
|
38
427
|
]
|
|
39
428
|
})
|
|
40
|
-
}), /* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
id: r,
|
|
43
|
-
popover: "auto",
|
|
429
|
+
}), /* @__PURE__ */ m("div", {
|
|
430
|
+
...r.popupProps,
|
|
44
431
|
role: "menu",
|
|
45
432
|
"aria-label": e,
|
|
46
433
|
tabIndex: -1,
|
|
47
|
-
onKeyDown:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ArrowUp: n === -1 ? r : n - 1,
|
|
51
|
-
Home: 0,
|
|
52
|
-
End: r
|
|
53
|
-
}[e.key];
|
|
54
|
-
a !== void 0 && (e.preventDefault(), t[(a + t.length) % t.length]?.focus());
|
|
55
|
-
},
|
|
56
|
-
onToggle: (e) => {
|
|
57
|
-
e.nativeEvent.newState === "open" && i.current?.focus();
|
|
58
|
-
},
|
|
59
|
-
className: _("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
|
-
style: {
|
|
61
|
-
positionAnchor: `--${r}`,
|
|
62
|
-
inset: "auto",
|
|
63
|
-
margin: "6px 0"
|
|
64
|
-
},
|
|
65
|
-
children: a.map((e) => /* @__PURE__ */ p("button", {
|
|
434
|
+
onKeyDown: o,
|
|
435
|
+
className: "zen__popover glass glass-blur text-foreground min-w-44 rounded-xl p-1.5 outline-hidden",
|
|
436
|
+
children: a.map((e) => /* @__PURE__ */ m("button", {
|
|
66
437
|
type: "button",
|
|
67
438
|
role: "menuitem",
|
|
68
439
|
tabIndex: -1,
|
|
69
|
-
className:
|
|
440
|
+
className: k(ue, e.destructive && "text-destructive hover:bg-destructive/10 focus:bg-destructive/10"),
|
|
70
441
|
onClick: () => {
|
|
71
|
-
|
|
442
|
+
r.setOpen(!1), e.onClick();
|
|
72
443
|
},
|
|
73
444
|
children: e.label
|
|
74
445
|
}, e.label))
|
|
75
446
|
})] });
|
|
76
447
|
}
|
|
77
448
|
//#endregion
|
|
449
|
+
//#region packages/utils/money.ts
|
|
450
|
+
function P(e) {
|
|
451
|
+
return new Intl.NumberFormat("en", {
|
|
452
|
+
style: "currency",
|
|
453
|
+
currency: e
|
|
454
|
+
}).resolvedOptions().maximumFractionDigits ?? 2;
|
|
455
|
+
}
|
|
456
|
+
function F(e, t, n, { showDecimals: r = !0 } = {}) {
|
|
457
|
+
let i = P(t);
|
|
458
|
+
return new Intl.NumberFormat(n, {
|
|
459
|
+
style: "currency",
|
|
460
|
+
currency: t,
|
|
461
|
+
minimumFractionDigits: r ? i : 0,
|
|
462
|
+
maximumFractionDigits: r ? i : 0
|
|
463
|
+
}).format(e / 10 ** i);
|
|
464
|
+
}
|
|
465
|
+
function I(e, t, n) {
|
|
466
|
+
let r = P(t), i = e % 10 ** r != 0;
|
|
467
|
+
return new Intl.NumberFormat(n, {
|
|
468
|
+
minimumFractionDigits: i ? r : 0,
|
|
469
|
+
maximumFractionDigits: r
|
|
470
|
+
}).format(e / 10 ** r);
|
|
471
|
+
}
|
|
472
|
+
function fe(e, t) {
|
|
473
|
+
return new Intl.NumberFormat(t, {
|
|
474
|
+
style: "currency",
|
|
475
|
+
currency: e
|
|
476
|
+
}).formatToParts(0).find((e) => e.type === "currency")?.value ?? e;
|
|
477
|
+
}
|
|
478
|
+
var L = class extends Error {
|
|
479
|
+
constructor(e) {
|
|
480
|
+
super(`Not an amount: ${e}`), this.name = "MoneyParseError";
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
function pe(e, t) {
|
|
484
|
+
let n = P(t), r = e.trim().replace(/[\s,_]/g, "").replace(/^([+-]?)[^\d.+-]+/, "$1"), i = /^([+-]?)(\d*)(?:\.(\d*))?$/.exec(r);
|
|
485
|
+
if (!i || i[2] === "" && (i[3] ?? "") === "") throw new L(e);
|
|
486
|
+
let [, a, o, s = ""] = i;
|
|
487
|
+
if (s.length > n) throw new L(e);
|
|
488
|
+
let c = Number((o || "0") + s.padEnd(n, "0"));
|
|
489
|
+
if (!Number.isSafeInteger(c)) throw new L(e);
|
|
490
|
+
return a === "-" ? -c : c;
|
|
491
|
+
}
|
|
492
|
+
var me = {
|
|
493
|
+
k: 3,
|
|
494
|
+
thousand: 3,
|
|
495
|
+
l: 5,
|
|
496
|
+
lac: 5,
|
|
497
|
+
lakh: 5,
|
|
498
|
+
lakhs: 5,
|
|
499
|
+
cr: 7,
|
|
500
|
+
crore: 7,
|
|
501
|
+
crores: 7,
|
|
502
|
+
m: 6,
|
|
503
|
+
mn: 6,
|
|
504
|
+
million: 6
|
|
505
|
+
};
|
|
506
|
+
function he(e, t) {
|
|
507
|
+
let n = /^\s*(.*?)\s*([a-z]+)\s*$/i.exec(e), r = me[n ? n[2].toLowerCase() : ""];
|
|
508
|
+
if (!n || r === void 0) return pe(e, t);
|
|
509
|
+
let i = P(t), a = /^([+-]?)[^\d.+-]*([\d,\s_]*)(?:\.(\d*))?$/.exec(n[1]);
|
|
510
|
+
if (!a) throw new L(e);
|
|
511
|
+
let o = a[2].replace(/[,\s_]/g, ""), s = a[3] ?? "";
|
|
512
|
+
if (o === "" && s === "") throw new L(e);
|
|
513
|
+
let c = r + i;
|
|
514
|
+
if (s.length > c) throw new L(e);
|
|
515
|
+
let l = Number((o || "0") + s.padEnd(c, "0"));
|
|
516
|
+
if (!Number.isSafeInteger(l)) throw new L(e);
|
|
517
|
+
return a[1] === "-" ? -l : l;
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region packages/animated-number/index.tsx
|
|
521
|
+
var ge = typeof window > "u" ? o : c, _e = (e) => 1 - (1 - e) ** 3;
|
|
522
|
+
function ve({ value: e, format: t = String, duration: n = 650, fromZero: r = !0, className: i }) {
|
|
523
|
+
let [a, o] = d(r ? 0 : e), s = u(r ? 0 : e);
|
|
524
|
+
return ge(() => {
|
|
525
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion") || n <= 0) {
|
|
526
|
+
s.current = e, o(e);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
let t = s.current, r = performance.now(), i = requestAnimationFrame(function a(c) {
|
|
530
|
+
let l = Math.min(1, (c - r) / n), u = Math.round(t + (e - t) * _e(l));
|
|
531
|
+
s.current = u, o(u), l < 1 && (i = requestAnimationFrame(a));
|
|
532
|
+
});
|
|
533
|
+
return () => cancelAnimationFrame(i);
|
|
534
|
+
}, [e, n]), /* @__PURE__ */ m("span", {
|
|
535
|
+
className: k("zen__animated-number tabular-nums", i),
|
|
536
|
+
children: t(a)
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
function ye({ value: e, currency: t, locale: n, showDecimals: r = !1, ...i }) {
|
|
540
|
+
return /* @__PURE__ */ m(ve, {
|
|
541
|
+
value: e,
|
|
542
|
+
format: (e) => F(e, t, n, { showDecimals: r }),
|
|
543
|
+
...i
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region packages/avatar/index.tsx
|
|
548
|
+
function be({ src: e, name: t, alt: n, className: r }) {
|
|
549
|
+
let i = (t.trim()[0] ?? "?").toUpperCase();
|
|
550
|
+
return /* @__PURE__ */ m("span", {
|
|
551
|
+
role: n ? "img" : void 0,
|
|
552
|
+
"aria-label": n,
|
|
553
|
+
"aria-hidden": !n || void 0,
|
|
554
|
+
className: k("zen__avatar relative inline-grid shrink-0 place-items-center overflow-hidden rounded-full font-semibold select-none", "size-9 text-sm", "text-primary-foreground bg-[radial-gradient(circle_at_30%_25%,oklch(var(--glow)/0.9),oklch(var(--primary)/0.55))]", "shadow-[0_0_0_1px_oklch(var(--tint)/0.12),0_0_18px_-6px_oklch(var(--glow)/calc(0.9*var(--glow-strength)))]", r),
|
|
555
|
+
children: e ? /* @__PURE__ */ m("img", {
|
|
556
|
+
src: e,
|
|
557
|
+
alt: "",
|
|
558
|
+
className: "size-full object-cover",
|
|
559
|
+
draggable: !1
|
|
560
|
+
}) : i
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
var R = class extends Error {};
|
|
564
|
+
async function xe(e, t = 160, n = .85) {
|
|
565
|
+
if (!e.type.startsWith("image/")) throw new R("Choose an image file.");
|
|
566
|
+
if (e.size > 20971520) throw new R("That image is too large (over 20 MB).");
|
|
567
|
+
let r;
|
|
568
|
+
try {
|
|
569
|
+
r = await createImageBitmap(e);
|
|
570
|
+
} catch {
|
|
571
|
+
throw new R("That image couldn't be read.");
|
|
572
|
+
}
|
|
573
|
+
let i = Math.min(r.width, r.height), a = document.createElement("canvas");
|
|
574
|
+
a.width = a.height = t;
|
|
575
|
+
let o = a.getContext("2d");
|
|
576
|
+
o.imageSmoothingQuality = "high", o.drawImage(r, (r.width - i) / 2, (r.height - i) / 2, i, i, 0, 0, t, t), r.close();
|
|
577
|
+
let s = a.toDataURL("image/webp", n);
|
|
578
|
+
return s.startsWith("data:image/webp") ? s : a.toDataURL("image/jpeg", n);
|
|
579
|
+
}
|
|
580
|
+
//#endregion
|
|
78
581
|
//#region packages/backdrop/index.tsx
|
|
79
|
-
function
|
|
80
|
-
let n = e ?? (t ? "contours" : "dots");
|
|
582
|
+
function Se({ pattern: e, topoSrc: t }) {
|
|
583
|
+
let n = e ?? (t ? "contours" : "dots"), r = u(null);
|
|
81
584
|
return o(() => {
|
|
82
|
-
let e = document.documentElement, t =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
585
|
+
let e = document.documentElement, t = r.current, n = 0, i = -9999, a = -9999, o = /* @__PURE__ */ new WeakSet(), s = !0, c = /* @__PURE__ */ new WeakMap(), l = (e, t, n, r = "--gx", i = "--gy") => {
|
|
586
|
+
let a = t + " " + n;
|
|
587
|
+
c.get(e) !== a && (c.set(e, a), e.style.setProperty(r, t), e.style.setProperty(i, n));
|
|
588
|
+
}, u = () => {
|
|
589
|
+
if (n = 0, t) {
|
|
590
|
+
let e = s ? "out" : "in";
|
|
591
|
+
t.dataset.pointer !== e && (t.dataset.pointer = e);
|
|
592
|
+
let n = t.querySelector(".zen-light");
|
|
593
|
+
n && !s && l(n, `${i}px`, `${a}px`, "left", "top");
|
|
594
|
+
}
|
|
595
|
+
let e = Array.from(document.querySelectorAll(".glow-edge")), r = e.map((e) => e.getBoundingClientRect());
|
|
596
|
+
e.forEach((e, t) => {
|
|
597
|
+
let n = r[t];
|
|
598
|
+
i > n.left - 400 && i < n.right + 400 && a > n.top - 400 && a < n.bottom + 400 ? (l(e, `${Math.round(i - n.left)}px`, `${Math.round(a - n.top)}px`), o.delete(e)) : o.has(e) || (l(e, "-9999px", "-9999px"), o.add(e));
|
|
88
599
|
});
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
|
|
600
|
+
}, d = () => {
|
|
601
|
+
n ||= requestAnimationFrame(u);
|
|
602
|
+
}, f = (e) => {
|
|
603
|
+
i = e.clientX, a = e.clientY, s = !1, d();
|
|
604
|
+
}, p = () => {
|
|
605
|
+
i = a = -9999, s = !0, d();
|
|
95
606
|
};
|
|
96
|
-
if (
|
|
607
|
+
if (window.matchMedia?.("(hover: none), (pointer: coarse)").matches || j() === "lite") return;
|
|
608
|
+
window.addEventListener("pointermove", f, { passive: !0 }), e.addEventListener("pointerleave", p);
|
|
609
|
+
let m = 0, h = () => {
|
|
610
|
+
clearTimeout(m), m = window.setTimeout(d, 120);
|
|
611
|
+
};
|
|
612
|
+
return window.addEventListener("scroll", h, {
|
|
97
613
|
passive: !0,
|
|
98
614
|
capture: !0
|
|
99
|
-
}), window.addEventListener("resize",
|
|
100
|
-
window.removeEventListener("pointermove",
|
|
615
|
+
}), window.addEventListener("resize", d, { passive: !0 }), () => {
|
|
616
|
+
window.removeEventListener("pointermove", f), e.removeEventListener("pointerleave", p), window.removeEventListener("scroll", h, { capture: !0 }), clearTimeout(m), window.removeEventListener("resize", d), cancelAnimationFrame(n);
|
|
617
|
+
};
|
|
618
|
+
}, []), o(() => {
|
|
619
|
+
let e = r.current;
|
|
620
|
+
if (!t || !e || typeof document > "u") return;
|
|
621
|
+
let n = "", i = !1, a = 0, o = new Image();
|
|
622
|
+
o.src = t;
|
|
623
|
+
let s = async () => {
|
|
624
|
+
try {
|
|
625
|
+
await o.decode();
|
|
626
|
+
let t = window.devicePixelRatio || 1, r = Math.round(e.clientWidth * t), a = Math.round(e.clientHeight * t);
|
|
627
|
+
if (!r || !a) return;
|
|
628
|
+
let s = document.createElement("canvas");
|
|
629
|
+
s.width = r, s.height = a;
|
|
630
|
+
let c = o.naturalWidth || r, l = o.naturalHeight || a, u = Math.max(r / c, a / l);
|
|
631
|
+
s.getContext("2d")?.drawImage(o, (r - c * u) / 2, (a - l * u) / 2, c * u, l * u);
|
|
632
|
+
let d = await new Promise((e) => s.toBlob(e));
|
|
633
|
+
if (i || !d) return;
|
|
634
|
+
let f = URL.createObjectURL(d);
|
|
635
|
+
e.style.setProperty("--zen-topo", `url("${f}")`), n && URL.revokeObjectURL(n), n = f;
|
|
636
|
+
} catch {}
|
|
637
|
+
};
|
|
638
|
+
s();
|
|
639
|
+
let c = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
|
|
640
|
+
clearTimeout(a), a = window.setTimeout(s, 200);
|
|
641
|
+
});
|
|
642
|
+
return c?.observe(e), () => {
|
|
643
|
+
i = !0, clearTimeout(a), c?.disconnect(), n && URL.revokeObjectURL(n), e.style.setProperty("--zen-topo", `url("${t}")`);
|
|
101
644
|
};
|
|
102
|
-
}, []), /* @__PURE__ */
|
|
645
|
+
}, [t]), /* @__PURE__ */ h("div", {
|
|
646
|
+
ref: r,
|
|
103
647
|
className: "zen-backdrop",
|
|
104
648
|
"aria-hidden": !0,
|
|
105
649
|
style: t ? { "--zen-topo": `url("${t}")` } : void 0,
|
|
106
650
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */ p("div", { className: "zen-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
651
|
+
/* @__PURE__ */ m("div", { className: "zen-aurora" }),
|
|
652
|
+
n === "contours" ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", { className: "zen-topo" }), /* @__PURE__ */ m("div", {
|
|
653
|
+
className: "zen-topo zen-topo--lit",
|
|
654
|
+
children: /* @__PURE__ */ m("div", { className: "zen-light" })
|
|
655
|
+
})] }) : /* @__PURE__ */ h(p, { children: [
|
|
656
|
+
/* @__PURE__ */ m("div", { className: "zen-dots" }),
|
|
657
|
+
/* @__PURE__ */ m("div", { className: "zen-dots zen-dots--ambient" }),
|
|
658
|
+
/* @__PURE__ */ m("div", {
|
|
659
|
+
className: "zen-dots zen-dots--lit",
|
|
660
|
+
children: /* @__PURE__ */ m("div", { className: "zen-light" })
|
|
661
|
+
})
|
|
114
662
|
] }),
|
|
115
|
-
/* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ m("div", { className: "zen-vignette" })
|
|
116
664
|
]
|
|
117
665
|
});
|
|
118
666
|
}
|
|
119
667
|
//#endregion
|
|
120
668
|
//#region packages/utils/cva.ts
|
|
121
|
-
var
|
|
122
|
-
if (t?.variants == null) return
|
|
669
|
+
var Ce = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, we = (e, t) => (n) => {
|
|
670
|
+
if (t?.variants == null) return k(e, n?.class, n?.className);
|
|
123
671
|
let { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((e) => {
|
|
124
672
|
let t = n?.[e], a = i?.[e];
|
|
125
673
|
if (t === null) return null;
|
|
126
|
-
let o =
|
|
674
|
+
let o = Ce(t) || Ce(a);
|
|
127
675
|
return r[e][o];
|
|
128
676
|
}), 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
677
|
...i,
|
|
@@ -136,20 +684,20 @@ var x = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, S = (e, t) =>
|
|
|
136
684
|
t,
|
|
137
685
|
n
|
|
138
686
|
] : e, []);
|
|
139
|
-
return
|
|
687
|
+
return k(e, a, s, n?.class, n?.className);
|
|
140
688
|
};
|
|
141
689
|
//#endregion
|
|
142
690
|
//#region packages/badge/index.tsx
|
|
143
|
-
function
|
|
144
|
-
return /* @__PURE__ */
|
|
691
|
+
function z({ variant: e, className: t, ...n }) {
|
|
692
|
+
return /* @__PURE__ */ m("span", {
|
|
145
693
|
...n,
|
|
146
|
-
className:
|
|
694
|
+
className: Te({
|
|
147
695
|
variant: e,
|
|
148
696
|
className: t
|
|
149
697
|
})
|
|
150
698
|
});
|
|
151
699
|
}
|
|
152
|
-
var
|
|
700
|
+
var Te = we("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
701
|
variants: { variant: {
|
|
154
702
|
default: "border-glow/30 bg-glow/10 text-primary",
|
|
155
703
|
secondary: "border-tint/10 bg-tint/[0.06] text-foreground",
|
|
@@ -160,28 +708,29 @@ var w = S("zen__badge inline-flex items-center rounded-md border px-1.5 py-0.5 t
|
|
|
160
708
|
});
|
|
161
709
|
//#endregion
|
|
162
710
|
//#region packages/spinner/index.tsx
|
|
163
|
-
function
|
|
164
|
-
return /* @__PURE__ */
|
|
711
|
+
function Ee({ className: e }) {
|
|
712
|
+
return /* @__PURE__ */ m("span", {
|
|
165
713
|
"aria-hidden": !0,
|
|
166
|
-
className:
|
|
714
|
+
className: k("zen__spinner inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent", e)
|
|
167
715
|
});
|
|
168
716
|
}
|
|
169
717
|
//#endregion
|
|
170
718
|
//#region packages/button/index.tsx
|
|
171
|
-
function
|
|
172
|
-
return /* @__PURE__ */
|
|
719
|
+
function B({ className: e, variant: t, size: n, loading: r = !1, disabled: i, type: a = "button", children: o, ...s }) {
|
|
720
|
+
return /* @__PURE__ */ h("button", {
|
|
721
|
+
type: a,
|
|
173
722
|
disabled: i || r,
|
|
174
723
|
"aria-busy": r || void 0,
|
|
175
|
-
className:
|
|
724
|
+
className: De({
|
|
176
725
|
variant: t,
|
|
177
726
|
size: n,
|
|
178
727
|
className: e
|
|
179
728
|
}),
|
|
180
|
-
...
|
|
181
|
-
children: [r && /* @__PURE__ */
|
|
729
|
+
...s,
|
|
730
|
+
children: [r && /* @__PURE__ */ m(Ee, {}), o]
|
|
182
731
|
});
|
|
183
732
|
}
|
|
184
|
-
var
|
|
733
|
+
var De = we("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
734
|
variants: {
|
|
186
735
|
variant: {
|
|
187
736
|
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)]",
|
|
@@ -206,182 +755,219 @@ var D = S("zen__button inline-flex items-center justify-center gap-2 rounded-lg
|
|
|
206
755
|
});
|
|
207
756
|
//#endregion
|
|
208
757
|
//#region packages/card/index.tsx
|
|
209
|
-
function
|
|
210
|
-
return /* @__PURE__ */
|
|
211
|
-
className:
|
|
758
|
+
function Oe({ title: e, action: t, children: n, className: r, ...i }) {
|
|
759
|
+
return /* @__PURE__ */ h("section", {
|
|
760
|
+
className: k("zen__card glass glow-edge text-card-foreground rounded-xl p-4 md:p-5", r),
|
|
212
761
|
...i,
|
|
213
|
-
children: [(e || t) && /* @__PURE__ */
|
|
762
|
+
children: [(e || t) && /* @__PURE__ */ h("header", {
|
|
214
763
|
className: "mb-4 flex items-center justify-between gap-4",
|
|
215
|
-
children: [e && /* @__PURE__ */
|
|
216
|
-
className: "text-base tracking-tight",
|
|
764
|
+
children: [e && /* @__PURE__ */ m("h4", {
|
|
765
|
+
className: "text-base font-semibold tracking-tight",
|
|
217
766
|
children: e
|
|
218
767
|
}), t]
|
|
219
768
|
}), n]
|
|
220
769
|
});
|
|
221
770
|
}
|
|
222
|
-
function
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
className:
|
|
771
|
+
function ke({ label: e, value: t, hint: n, tone: r = "default", className: i }) {
|
|
772
|
+
return /* @__PURE__ */ h("div", {
|
|
773
|
+
className: k("zen__stat glass glow-edge flex flex-col gap-1 rounded-xl p-3.5 md:p-4", i),
|
|
225
774
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
775
|
+
/* @__PURE__ */ m("span", {
|
|
227
776
|
className: "text-muted-foreground truncate text-[0.68rem] tracking-[0.1em] uppercase sm:text-xs",
|
|
228
777
|
children: e
|
|
229
778
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
className:
|
|
779
|
+
/* @__PURE__ */ m("span", {
|
|
780
|
+
className: k("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
781
|
children: t
|
|
233
782
|
}),
|
|
234
|
-
n && /* @__PURE__ */
|
|
783
|
+
n && /* @__PURE__ */ m("span", {
|
|
235
784
|
className: "text-muted-foreground text-xs",
|
|
236
785
|
children: n
|
|
237
786
|
})
|
|
238
787
|
]
|
|
239
788
|
});
|
|
240
789
|
}
|
|
241
|
-
function
|
|
242
|
-
return /* @__PURE__ */
|
|
243
|
-
className:
|
|
790
|
+
function Ae({ children: e, className: t }) {
|
|
791
|
+
return /* @__PURE__ */ m("div", {
|
|
792
|
+
className: k("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
793
|
children: e
|
|
245
794
|
});
|
|
246
795
|
}
|
|
247
796
|
//#endregion
|
|
797
|
+
//#region packages/code-block/index.tsx
|
|
798
|
+
function je({ code: e, language: t, highlight: n, copyable: r = !0, variant: i = "glass", className: a, ...s }) {
|
|
799
|
+
let c = e.trim(), [l, u] = d(!1);
|
|
800
|
+
return o(() => {
|
|
801
|
+
if (!l) return;
|
|
802
|
+
let e = setTimeout(() => u(!1), 1500);
|
|
803
|
+
return () => clearTimeout(e);
|
|
804
|
+
}, [l]), /* @__PURE__ */ h("div", {
|
|
805
|
+
className: k("zen__code-block group relative", i === "glass" && "glass glow-edge overflow-hidden rounded-xl", a),
|
|
806
|
+
"data-language": t,
|
|
807
|
+
...s,
|
|
808
|
+
children: [/* @__PURE__ */ m("pre", {
|
|
809
|
+
className: "text-foreground m-0! overflow-x-auto rounded-none! bg-transparent! p-5! font-mono text-[13px]! leading-6 font-normal!",
|
|
810
|
+
children: n ? /* @__PURE__ */ m("code", {
|
|
811
|
+
className: "bg-transparent! p-0! text-inherit!",
|
|
812
|
+
dangerouslySetInnerHTML: { __html: n(c, t) }
|
|
813
|
+
}) : /* @__PURE__ */ m("code", {
|
|
814
|
+
className: "bg-transparent! p-0! text-inherit!",
|
|
815
|
+
children: c
|
|
816
|
+
})
|
|
817
|
+
}), r && /* @__PURE__ */ m("button", {
|
|
818
|
+
type: "button",
|
|
819
|
+
onClick: async () => {
|
|
820
|
+
await navigator.clipboard?.writeText(c), u(!0);
|
|
821
|
+
},
|
|
822
|
+
className: k("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"),
|
|
823
|
+
children: l ? "Copied" : "Copy"
|
|
824
|
+
})]
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
//#endregion
|
|
248
828
|
//#region packages/utils/styles.ts
|
|
249
|
-
var
|
|
829
|
+
var V = "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", H = k(V, "inline-flex items-center justify-between gap-2 whitespace-nowrap"), U = "glass glass-blur rounded-xl text-foreground shadow-[var(--popup-shadow),0_0_40px_-20px_oklch(var(--glow)/0.5)] outline-hidden", Me = "relative flex w-fit items-center gap-1 rounded-full border border-tint/5 bg-tint/[0.03] p-1", Ne = "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)]", Pe = "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", Fe = "flex w-full items-center gap-1.5 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-within:border-glow/60 focus-within:bg-tint/[0.05] focus-within:shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)] focus-within:outline-hidden disabled:cursor-not-allowed disabled:opacity-50";
|
|
250
830
|
//#endregion
|
|
251
831
|
//#region packages/popover/index.tsx
|
|
252
|
-
function
|
|
253
|
-
let { className: t, content: n, children: r, role: i = "tooltip", triggerType: a = "auto", trigger: c = "click", gap: l = "5px", triggerClassName: f, show:
|
|
832
|
+
function W(e) {
|
|
833
|
+
let { className: t, content: n, children: r, role: i = "tooltip", triggerType: a = "auto", trigger: c = "click", gap: l = "5px", triggerClassName: f, show: p, setShow: g, style: _, onOpen: v, onClose: y, ...b } = e, x = s().replace(/[^\w-]/g, "");
|
|
834
|
+
M();
|
|
835
|
+
let [S, C] = d(!1), w = u(null);
|
|
254
836
|
return o(() => {
|
|
255
|
-
let e =
|
|
837
|
+
let e = w.current;
|
|
256
838
|
if (!e) return;
|
|
257
|
-
let t = () => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
w(!1), b?.();
|
|
261
|
-
};
|
|
262
|
-
return e.addEventListener("popover:open", t), e.addEventListener("popover:close", n), () => {
|
|
263
|
-
e.removeEventListener("popover:open", t), e.removeEventListener("popover:close", n);
|
|
839
|
+
let t = (e) => {
|
|
840
|
+
let t = e.newState === "open";
|
|
841
|
+
C(t), t ? v?.() : y?.();
|
|
264
842
|
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
843
|
+
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
844
|
+
}, [v, y]), o(() => {
|
|
845
|
+
a === "manual" && (p ? w.current?.showPopover?.() : w.current?.hidePopover?.());
|
|
846
|
+
}, [p, a]), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
847
|
+
"aria-expanded": S,
|
|
848
|
+
className: k("max-w-fit min-w-fit", f),
|
|
849
|
+
style: { anchorName: `--zen-popover-anchor-${x}` },
|
|
850
|
+
popoverTarget: `zen__popover-${x}`,
|
|
272
851
|
popoverTargetAction: "toggle",
|
|
273
852
|
onClick: c === "click" ? (e) => {
|
|
274
853
|
switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(), a) {
|
|
275
854
|
case "auto":
|
|
276
|
-
|
|
855
|
+
w.current?.togglePopover?.();
|
|
277
856
|
break;
|
|
278
|
-
case "manual": g?.(!
|
|
857
|
+
case "manual": g?.(!p);
|
|
279
858
|
}
|
|
280
859
|
} : void 0,
|
|
281
860
|
onMouseEnter: c === "hover" ? (e) => {
|
|
282
|
-
e.stopPropagation(),
|
|
861
|
+
e.stopPropagation(), w.current?.showPopover?.();
|
|
283
862
|
} : void 0,
|
|
284
863
|
onMouseLeave: c === "hover" ? (e) => {
|
|
285
|
-
e.stopPropagation(),
|
|
864
|
+
e.stopPropagation(), w.current?.hidePopover?.();
|
|
286
865
|
} : void 0,
|
|
287
866
|
children: r
|
|
288
|
-
}), /* @__PURE__ */
|
|
289
|
-
...
|
|
290
|
-
ref:
|
|
867
|
+
}), /* @__PURE__ */ m("div", {
|
|
868
|
+
...b,
|
|
869
|
+
ref: w,
|
|
291
870
|
role: i,
|
|
292
871
|
popover: a,
|
|
293
|
-
id: `zen__popover-${
|
|
294
|
-
className:
|
|
872
|
+
id: `zen__popover-${x}`,
|
|
873
|
+
className: k("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]", U, t),
|
|
295
874
|
style: {
|
|
296
|
-
...
|
|
875
|
+
..._,
|
|
297
876
|
"--gap": l,
|
|
298
877
|
top: "calc(anchor(bottom) + var(--gap))",
|
|
299
878
|
left: "calc(anchor(center) - 50%)",
|
|
300
|
-
positionAnchor: `--zen-popover-anchor-${
|
|
879
|
+
positionAnchor: `--zen-popover-anchor-${x}`
|
|
301
880
|
},
|
|
302
881
|
children: n
|
|
303
882
|
})] });
|
|
304
883
|
}
|
|
305
884
|
//#endregion
|
|
306
885
|
//#region packages/collapse/index.tsx
|
|
307
|
-
function
|
|
308
|
-
let { items: t = [], children: n, moreItemsLabel: r = "", parentRef: i, data: a, estimator: s = (e, t) => t + 30, font: c = "12px Inter", badgeVariant: u = "secondary", badgeStyles:
|
|
886
|
+
function Ie(e) {
|
|
887
|
+
let { items: t = [], children: n, moreItemsLabel: r = "", parentRef: i, data: a, estimator: s = (e, t) => t + 30, font: c = "12px Inter", badgeVariant: u = "secondary", badgeStyles: f } = e, [g, _] = d({
|
|
309
888
|
visible: t,
|
|
310
889
|
hidden: []
|
|
311
|
-
}),
|
|
890
|
+
}), v = l(() => {
|
|
312
891
|
if (typeof document > "u") return null;
|
|
313
892
|
let e = document.createElement("canvas").getContext("2d");
|
|
314
893
|
return e && (e.font = c), e;
|
|
315
|
-
}, []),
|
|
894
|
+
}, []), y = () => {
|
|
316
895
|
let e = i?.current;
|
|
317
896
|
if (!e) return;
|
|
318
897
|
let n = e.offsetWidth;
|
|
319
|
-
if (
|
|
320
|
-
|
|
898
|
+
if (b.reduce((e, t) => e + t, 0) <= n - 20) {
|
|
899
|
+
_({
|
|
321
900
|
visible: t,
|
|
322
901
|
hidden: []
|
|
323
902
|
});
|
|
324
903
|
return;
|
|
325
904
|
}
|
|
326
|
-
let a = [], o = [], c = s(r, (
|
|
327
|
-
|
|
905
|
+
let a = [], o = [], c = s(r, (v?.measureText(r).width ?? 0) + 10);
|
|
906
|
+
b?.reduce((e, r, i) => (e + r + c > n - 20 ? o.push(t[i]) : a.push(t[i]), e + r), 0), _({
|
|
328
907
|
visible: a,
|
|
329
908
|
hidden: o
|
|
330
909
|
});
|
|
331
|
-
},
|
|
910
|
+
}, b = l(() => t?.map((e) => s(e, v?.measureText(e).width ?? 0)) ?? [], [t]);
|
|
332
911
|
return o(() => {
|
|
333
|
-
|
|
912
|
+
y();
|
|
334
913
|
}, [t]), o(() => {
|
|
335
914
|
if (!i?.current) return;
|
|
336
915
|
let e = new ResizeObserver(() => {
|
|
337
|
-
|
|
916
|
+
y();
|
|
338
917
|
});
|
|
339
918
|
return e.observe(i.current), () => {
|
|
340
919
|
e.disconnect();
|
|
341
920
|
};
|
|
342
|
-
}, [t]), /* @__PURE__ */
|
|
921
|
+
}, [t]), /* @__PURE__ */ h(p, { children: [g.visible?.map((e, t) => n(e, t, a?.[t])), g.hidden?.length > 0 && /* @__PURE__ */ m(W, {
|
|
343
922
|
trigger: "click",
|
|
344
|
-
|
|
923
|
+
triggerClassName: "flex rounded-md",
|
|
924
|
+
content: /* @__PURE__ */ m("div", {
|
|
345
925
|
className: "grid max-h-60 grid-flow-row grid-cols-2 gap-3 overflow-auto p-2",
|
|
346
926
|
children: g.hidden.map((e, t) => n(e, g.visible.length + t, a?.[g.visible.length + t]))
|
|
347
927
|
}),
|
|
348
|
-
children: /* @__PURE__ */
|
|
349
|
-
className:
|
|
928
|
+
children: /* @__PURE__ */ m(z, {
|
|
929
|
+
className: k("cursor-pointer", f),
|
|
350
930
|
variant: u,
|
|
351
931
|
"aria-label": `Show ${g.hidden.length} more ${r}`,
|
|
352
|
-
children: /* @__PURE__ */
|
|
932
|
+
children: /* @__PURE__ */ m("span", { children: `+${g.hidden.length} ${r}` })
|
|
353
933
|
}, "more_items_button")
|
|
354
934
|
})] });
|
|
355
935
|
}
|
|
356
936
|
//#endregion
|
|
357
937
|
//#region packages/dialog/index.tsx
|
|
358
|
-
function
|
|
359
|
-
|
|
938
|
+
function Le({ open: e, onOpenChange: t, title: n, description: r, children: i, dismissible: a = !0, initialFocus: c, size: l = "md", className: d, role: f }) {
|
|
939
|
+
M();
|
|
940
|
+
let p = u(null), g = s(), _ = s();
|
|
360
941
|
return o(() => {
|
|
361
|
-
let t =
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
942
|
+
let t = p.current;
|
|
943
|
+
if (t) {
|
|
944
|
+
if (e && !t.open) {
|
|
945
|
+
let e = document.documentElement;
|
|
946
|
+
e.toggleAttribute("data-zen-scrollbar", window.innerWidth > e.clientWidth), t.showModal(), c?.current?.focus();
|
|
947
|
+
} else !e && t.open && t.close();
|
|
948
|
+
}
|
|
949
|
+
}, [e, c]), /* @__PURE__ */ m("dialog", {
|
|
950
|
+
ref: p,
|
|
365
951
|
role: f,
|
|
366
952
|
"aria-labelledby": g,
|
|
367
|
-
"aria-describedby": r ?
|
|
368
|
-
className:
|
|
953
|
+
"aria-describedby": r ? _ : void 0,
|
|
954
|
+
className: k("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", l === "lg" ? "w-[60rem]" : "w-[28rem]", "backdrop:bg-black/50 backdrop:backdrop-blur-sm pointer-coarse:backdrop:backdrop-blur-none", d),
|
|
369
955
|
onCancel: (e) => {
|
|
370
956
|
e.preventDefault(), a && t?.(!1);
|
|
371
957
|
},
|
|
372
958
|
onClick: (e) => {
|
|
373
959
|
e.target === e.currentTarget && a && t?.(!1);
|
|
374
960
|
},
|
|
375
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ h("div", {
|
|
376
962
|
className: "flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-x-hidden overflow-y-auto p-6",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
963
|
+
children: [/* @__PURE__ */ h("div", {
|
|
378
964
|
className: "flex flex-col gap-2",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
965
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
380
966
|
id: g,
|
|
381
|
-
className: "text-lg font-semibold",
|
|
967
|
+
className: "text-lg font-semibold tracking-tight",
|
|
382
968
|
children: n
|
|
383
|
-
}), r && /* @__PURE__ */
|
|
384
|
-
id:
|
|
969
|
+
}), r && /* @__PURE__ */ m("p", {
|
|
970
|
+
id: _,
|
|
385
971
|
className: "text-muted-foreground mt-0! text-sm leading-5",
|
|
386
972
|
children: r
|
|
387
973
|
})]
|
|
@@ -391,22 +977,22 @@ function N({ open: e, onOpenChange: t, title: n, description: r, children: i, di
|
|
|
391
977
|
}
|
|
392
978
|
//#endregion
|
|
393
979
|
//#region packages/confirm-dialog/index.tsx
|
|
394
|
-
function
|
|
395
|
-
return /* @__PURE__ */
|
|
980
|
+
function Re({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, cancelLabel: a = "Cancel", destructive: o = !1, onConfirm: s }) {
|
|
981
|
+
return /* @__PURE__ */ m(Le, {
|
|
396
982
|
role: "alertdialog",
|
|
397
983
|
open: e,
|
|
398
984
|
onOpenChange: t,
|
|
399
985
|
title: n,
|
|
400
986
|
description: r,
|
|
401
987
|
className: "w-[26rem]",
|
|
402
|
-
children: /* @__PURE__ */
|
|
988
|
+
children: /* @__PURE__ */ h("div", {
|
|
403
989
|
className: "flex justify-end gap-2",
|
|
404
|
-
children: [/* @__PURE__ */
|
|
990
|
+
children: [/* @__PURE__ */ m(B, {
|
|
405
991
|
variant: "outline",
|
|
406
992
|
autoFocus: !0,
|
|
407
993
|
onClick: () => t(!1),
|
|
408
994
|
children: a
|
|
409
|
-
}), /* @__PURE__ */
|
|
995
|
+
}), /* @__PURE__ */ m(B, {
|
|
410
996
|
variant: o ? "destructive" : "default",
|
|
411
997
|
onClick: () => {
|
|
412
998
|
s(), t(!1);
|
|
@@ -417,828 +1003,111 @@ function P({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i
|
|
|
417
1003
|
});
|
|
418
1004
|
}
|
|
419
1005
|
//#endregion
|
|
420
|
-
//#region
|
|
421
|
-
function
|
|
422
|
-
|
|
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
|
|
1006
|
+
//#region packages/editable-cell/index.tsx
|
|
1007
|
+
function ze({ children: e, editor: t, label: n, readOnly: r = !1, editing: i, onEditingChange: a, title: o, className: s }) {
|
|
1008
|
+
let [c, l] = d(!1), u = i ?? c, f = (e) => {
|
|
1009
|
+
i === void 0 && l(e), a?.(e);
|
|
501
1010
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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();
|
|
1011
|
+
return r ? /* @__PURE__ */ m("span", {
|
|
1012
|
+
title: o,
|
|
1013
|
+
className: k("zen__editable-cell block px-1 text-right tabular-nums", s),
|
|
1014
|
+
children: e
|
|
1015
|
+
}) : u ? /* @__PURE__ */ m(p, { children: t(() => f(!1)) }) : /* @__PURE__ */ m("button", {
|
|
1016
|
+
type: "button",
|
|
1017
|
+
title: o,
|
|
1018
|
+
"aria-label": n ? `${n}. Edit` : void 0,
|
|
1019
|
+
onClick: () => f(!0),
|
|
1020
|
+
className: k("zen__editable-cell hover:bg-primary/10 focus-visible:ring-ring/50 w-full rounded-md px-1.5 py-0.5 text-right tabular-nums transition-colors focus-visible:ring-2 focus-visible:outline-hidden", s),
|
|
1021
|
+
children: e
|
|
535
1022
|
});
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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
|
|
1023
|
+
}
|
|
1024
|
+
//#endregion
|
|
1025
|
+
//#region packages/utils/status-icons.tsx
|
|
1026
|
+
function G({ className: e }) {
|
|
1027
|
+
return /* @__PURE__ */ m("svg", {
|
|
1028
|
+
viewBox: "0 0 16 16",
|
|
1029
|
+
fill: "none",
|
|
1030
|
+
stroke: "currentColor",
|
|
1031
|
+
strokeWidth: "2",
|
|
1032
|
+
strokeLinecap: "round",
|
|
1033
|
+
strokeLinejoin: "round",
|
|
1034
|
+
className: k("size-3.5", e),
|
|
1035
|
+
"aria-hidden": !0,
|
|
1036
|
+
children: /* @__PURE__ */ m("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
572
1037
|
});
|
|
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
1038
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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;
|
|
1039
|
+
function K({ className: e }) {
|
|
1040
|
+
return /* @__PURE__ */ h("svg", {
|
|
1041
|
+
viewBox: "0 0 16 16",
|
|
1042
|
+
fill: "none",
|
|
1043
|
+
stroke: "currentColor",
|
|
1044
|
+
strokeWidth: "1.8",
|
|
1045
|
+
strokeLinecap: "round",
|
|
1046
|
+
strokeLinejoin: "round",
|
|
1047
|
+
className: k("size-3.5", e),
|
|
1048
|
+
"aria-hidden": !0,
|
|
1049
|
+
children: [/* @__PURE__ */ m("path", { d: "M8 2.2 1.6 13.3h12.8L8 2.2Z" }), /* @__PURE__ */ m("path", { d: "M8 6.5v3M8 11.6v.1" })]
|
|
1050
|
+
});
|
|
1125
1051
|
}
|
|
1126
|
-
function
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
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
|
-
};
|
|
1052
|
+
function q({ className: e }) {
|
|
1053
|
+
return /* @__PURE__ */ h("svg", {
|
|
1054
|
+
viewBox: "0 0 16 16",
|
|
1055
|
+
fill: "none",
|
|
1056
|
+
stroke: "currentColor",
|
|
1057
|
+
strokeWidth: "1.8",
|
|
1058
|
+
strokeLinecap: "round",
|
|
1059
|
+
className: k("size-3.5", e),
|
|
1060
|
+
"aria-hidden": !0,
|
|
1061
|
+
children: [/* @__PURE__ */ m("circle", {
|
|
1062
|
+
cx: "8",
|
|
1063
|
+
cy: "8",
|
|
1064
|
+
r: "6.3"
|
|
1065
|
+
}), /* @__PURE__ */ m("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
|
|
1066
|
+
});
|
|
1159
1067
|
}
|
|
1160
1068
|
//#endregion
|
|
1161
|
-
//#region
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
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
|
-
} });
|
|
1069
|
+
//#region packages/field/index.tsx
|
|
1070
|
+
function Be({ label: e, hint: n, error: i, children: a, className: o }) {
|
|
1071
|
+
let c = s(), l = r(a) ? a : null, u = l?.props.id ?? `${c}-control`, d = n ? `${c}-hint` : void 0, f = i ? `${c}-error` : void 0, p = k(l?.props["aria-describedby"], d, f).trim() || void 0;
|
|
1072
|
+
return /* @__PURE__ */ h("div", {
|
|
1073
|
+
className: k("zen__field flex flex-col gap-2", o),
|
|
1074
|
+
children: [
|
|
1075
|
+
/* @__PURE__ */ m("label", {
|
|
1076
|
+
htmlFor: u,
|
|
1077
|
+
className: "text-sm leading-none font-medium",
|
|
1078
|
+
children: e
|
|
1079
|
+
}),
|
|
1080
|
+
l ? t(l, {
|
|
1081
|
+
id: u,
|
|
1082
|
+
"aria-describedby": p,
|
|
1083
|
+
"aria-invalid": i ? !0 : l.props["aria-invalid"]
|
|
1084
|
+
}) : a,
|
|
1085
|
+
n && /* @__PURE__ */ m("p", {
|
|
1086
|
+
id: d,
|
|
1087
|
+
className: "text-muted-foreground mt-0! text-xs",
|
|
1088
|
+
children: n
|
|
1089
|
+
}),
|
|
1090
|
+
i && /* @__PURE__ */ h("p", {
|
|
1091
|
+
id: f,
|
|
1092
|
+
role: "alert",
|
|
1093
|
+
className: "text-destructive mt-0! flex items-center gap-1.5 text-xs font-medium",
|
|
1094
|
+
children: [/* @__PURE__ */ m(K, { className: "shrink-0" }), i]
|
|
1095
|
+
})
|
|
1096
|
+
]
|
|
1225
1097
|
});
|
|
1226
|
-
return d.setOptions(u), W(() => d._didMount(), []), W(() => (c(d), d._willUpdate())), W(() => {
|
|
1227
|
-
l(d);
|
|
1228
|
-
}), d;
|
|
1229
1098
|
}
|
|
1230
|
-
function
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1099
|
+
function Ve({ tone: e = "info", children: t, className: n }) {
|
|
1100
|
+
let r = e === "error" ? K : e === "success" ? G : q;
|
|
1101
|
+
return /* @__PURE__ */ h("p", {
|
|
1102
|
+
role: e === "error" ? "alert" : "status",
|
|
1103
|
+
className: k("mt-0! flex items-start gap-2 text-sm", e === "error" && "border-destructive/35 bg-destructive/10 text-destructive rounded-lg border px-3 py-2", e === "success" && "border-primary/30 bg-primary/10 text-primary rounded-lg border px-3 py-2", e === "info" && "text-muted-foreground", n),
|
|
1104
|
+
children: [/* @__PURE__ */ m(r, { className: "mt-0.5 shrink-0" }), /* @__PURE__ */ m("span", { children: t })]
|
|
1236
1105
|
});
|
|
1237
1106
|
}
|
|
1238
1107
|
//#endregion
|
|
1239
1108
|
//#region packages/icons/search.tsx
|
|
1240
|
-
function
|
|
1241
|
-
return /* @__PURE__ */
|
|
1109
|
+
function He(e) {
|
|
1110
|
+
return /* @__PURE__ */ m("svg", {
|
|
1242
1111
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1243
1112
|
fill: "none",
|
|
1244
1113
|
viewBox: "0 0 24 24",
|
|
@@ -1246,7 +1115,7 @@ function G(e) {
|
|
|
1246
1115
|
stroke: "currentColor",
|
|
1247
1116
|
className: "h-6 w-6",
|
|
1248
1117
|
...e,
|
|
1249
|
-
children: /* @__PURE__ */
|
|
1118
|
+
children: /* @__PURE__ */ m("path", {
|
|
1250
1119
|
strokeLinecap: "round",
|
|
1251
1120
|
strokeLinejoin: "round",
|
|
1252
1121
|
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 +1124,8 @@ function G(e) {
|
|
|
1255
1124
|
}
|
|
1256
1125
|
//#endregion
|
|
1257
1126
|
//#region packages/icons/x-mark.tsx
|
|
1258
|
-
function
|
|
1259
|
-
return /* @__PURE__ */
|
|
1127
|
+
function Ue(e) {
|
|
1128
|
+
return /* @__PURE__ */ m("svg", {
|
|
1260
1129
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1261
1130
|
fill: "none",
|
|
1262
1131
|
viewBox: "0 0 24 24",
|
|
@@ -1264,7 +1133,7 @@ function Se(e) {
|
|
|
1264
1133
|
stroke: "currentColor",
|
|
1265
1134
|
className: "h-6 w-6",
|
|
1266
1135
|
...e,
|
|
1267
|
-
children: /* @__PURE__ */
|
|
1136
|
+
children: /* @__PURE__ */ m("path", {
|
|
1268
1137
|
strokeLinecap: "round",
|
|
1269
1138
|
strokeLinejoin: "round",
|
|
1270
1139
|
d: "M6 18 18 6M6 6l12 12"
|
|
@@ -1272,12 +1141,98 @@ function Se(e) {
|
|
|
1272
1141
|
});
|
|
1273
1142
|
}
|
|
1274
1143
|
//#endregion
|
|
1144
|
+
//#region packages/input-group/index.tsx
|
|
1145
|
+
function We({ invalid: e, className: t, onMouseDown: n, ...r }) {
|
|
1146
|
+
return /* @__PURE__ */ m("div", {
|
|
1147
|
+
"data-invalid": e || void 0,
|
|
1148
|
+
className: k("zen__input-group cursor-text", Fe, "has-disabled:bg-muted! has-disabled:text-muted-foreground has-disabled:cursor-not-allowed", e && "border-destructive! focus-within:shadow-[0_0_0_3px_oklch(var(--destructive)/0.16)]!", t),
|
|
1149
|
+
onMouseDown: (e) => {
|
|
1150
|
+
n?.(e);
|
|
1151
|
+
let t = e.target;
|
|
1152
|
+
if (e.defaultPrevented || t.closest("input, textarea, button, a, select, [tabindex]")) return;
|
|
1153
|
+
let r = e.currentTarget.querySelector("input:not(:disabled)");
|
|
1154
|
+
r && (e.preventDefault(), r.focus());
|
|
1155
|
+
},
|
|
1156
|
+
...r
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
function J({ className: e, ...t }) {
|
|
1160
|
+
return /* @__PURE__ */ m("input", {
|
|
1161
|
+
className: k("placeholder:text-muted-foreground h-full w-full min-w-0 flex-1 bg-transparent text-sm outline-hidden disabled:cursor-not-allowed", e),
|
|
1162
|
+
...t
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
function Y({ className: e, ...t }) {
|
|
1166
|
+
return /* @__PURE__ */ m("span", {
|
|
1167
|
+
className: k("text-muted-foreground flex shrink-0 items-center gap-1 text-sm select-none [&_svg]:size-4", e),
|
|
1168
|
+
...t
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
//#endregion
|
|
1172
|
+
//#region packages/utils/field-chevron.tsx
|
|
1173
|
+
function X({ open: e, className: t }) {
|
|
1174
|
+
return /* @__PURE__ */ m("svg", {
|
|
1175
|
+
viewBox: "0 0 16 16",
|
|
1176
|
+
fill: "none",
|
|
1177
|
+
stroke: "currentColor",
|
|
1178
|
+
strokeWidth: "1.6",
|
|
1179
|
+
strokeLinecap: "round",
|
|
1180
|
+
strokeLinejoin: "round",
|
|
1181
|
+
"aria-hidden": !0,
|
|
1182
|
+
className: k("text-muted-foreground size-4 shrink-0 transition-transform duration-300", e && "rotate-180", t),
|
|
1183
|
+
children: /* @__PURE__ */ m("path", { d: "m4 6 4 4 4-4" })
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region packages/utils/useVirtualList.ts
|
|
1188
|
+
function Ge({ count: e, itemHeight: t, scrollRef: n, overscan: r = 6 }) {
|
|
1189
|
+
let i = (n, i) => {
|
|
1190
|
+
let a = i || t * 10;
|
|
1191
|
+
return {
|
|
1192
|
+
first: Math.max(0, Math.floor(n / t) - r),
|
|
1193
|
+
last: Math.min(e, Math.ceil((n + a) / t) + r)
|
|
1194
|
+
};
|
|
1195
|
+
}, [a, o] = d(() => i(0, 0));
|
|
1196
|
+
c(() => {
|
|
1197
|
+
let e = n.current;
|
|
1198
|
+
if (!e) return;
|
|
1199
|
+
let t = () => {
|
|
1200
|
+
let t = i(e.scrollTop, e.clientHeight);
|
|
1201
|
+
o((e) => e.first === t.first && e.last === t.last ? e : t);
|
|
1202
|
+
};
|
|
1203
|
+
t(), e.addEventListener("scroll", t, { passive: !0 });
|
|
1204
|
+
let r = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
1205
|
+
return r?.observe(e), () => {
|
|
1206
|
+
e.removeEventListener("scroll", t), r?.disconnect();
|
|
1207
|
+
};
|
|
1208
|
+
}, [
|
|
1209
|
+
n,
|
|
1210
|
+
e,
|
|
1211
|
+
t,
|
|
1212
|
+
r
|
|
1213
|
+
]);
|
|
1214
|
+
let s = Math.min(a.first, e), l = Math.min(a.last, e), u = [];
|
|
1215
|
+
for (let e = s; e < l; e++) u.push({
|
|
1216
|
+
index: e,
|
|
1217
|
+
start: e * t,
|
|
1218
|
+
size: t
|
|
1219
|
+
});
|
|
1220
|
+
let f = e * t;
|
|
1221
|
+
return {
|
|
1222
|
+
items: u,
|
|
1223
|
+
totalSize: f,
|
|
1224
|
+
paddingTop: u.length ? u[0].start : 0,
|
|
1225
|
+
paddingBottom: u.length ? f - (u[u.length - 1].start + t) : 0
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
//#endregion
|
|
1275
1229
|
//#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: l } = e, f = u(null), [
|
|
1278
|
-
return /* @__PURE__ */
|
|
1279
|
-
triggerClassName:
|
|
1280
|
-
|
|
1230
|
+
function Ke(e) {
|
|
1231
|
+
let { items: t, selected: n, className: r, onChange: i, disabled: a, placeholder: o = "Select an Item", multiple: s, mutable: c, onAdd: l } = e, f = u(null), [p, g] = d(!1), _ = !!r && /(^|\s)w-full(\s|$)/.test(r);
|
|
1232
|
+
return /* @__PURE__ */ m(W, {
|
|
1233
|
+
triggerClassName: _ ? "w-full max-w-none" : void 0,
|
|
1234
|
+
className: "min-w-0",
|
|
1235
|
+
content: /* @__PURE__ */ m(qe, {
|
|
1281
1236
|
...c ? {
|
|
1282
1237
|
mutable: c,
|
|
1283
1238
|
onAdd: l
|
|
@@ -1295,122 +1250,129 @@ function Ce(e) {
|
|
|
1295
1250
|
}),
|
|
1296
1251
|
onOpen: () => g(!0),
|
|
1297
1252
|
onClose: () => g(!1),
|
|
1298
|
-
children: /* @__PURE__ */
|
|
1253
|
+
children: /* @__PURE__ */ h("div", {
|
|
1299
1254
|
role: "combobox",
|
|
1300
|
-
"aria-expanded":
|
|
1255
|
+
"aria-expanded": p,
|
|
1301
1256
|
"aria-haspopup": "listbox",
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1257
|
+
onClick: (e) => e.preventDefault(),
|
|
1258
|
+
className: k(H, "w-56", "grow", a ? "cursor-not-allowed opacity-50" : "cursor-pointer", p && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", r),
|
|
1259
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1260
|
+
className: k("flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm", a ? "text-muted-foreground" : "text-foreground"),
|
|
1305
1261
|
ref: f,
|
|
1306
|
-
children: s && !n.length ? /* @__PURE__ */
|
|
1262
|
+
children: s && !n.length ? /* @__PURE__ */ m("span", {
|
|
1307
1263
|
className: "text-muted-foreground",
|
|
1308
1264
|
children: o
|
|
1309
|
-
}) : s ? /* @__PURE__ */
|
|
1265
|
+
}) : s ? /* @__PURE__ */ m(Ie, {
|
|
1310
1266
|
items: n.map((e) => e.text),
|
|
1311
1267
|
data: n,
|
|
1312
1268
|
parentRef: f,
|
|
1313
1269
|
estimator: (e, t) => t + 40,
|
|
1314
1270
|
badgeVariant: "secondary",
|
|
1315
1271
|
badgeStyles: "h-6 min-w-min gap-2",
|
|
1316
|
-
children: (e, t, r) => /* @__PURE__ */
|
|
1272
|
+
children: (e, t, r) => /* @__PURE__ */ h(z, {
|
|
1317
1273
|
className: "flex h-6 min-w-min gap-2 pr-1",
|
|
1318
1274
|
variant: "secondary",
|
|
1319
|
-
children: [e, /* @__PURE__ */
|
|
1275
|
+
children: [e, /* @__PURE__ */ m(B, {
|
|
1320
1276
|
onClick: () => {
|
|
1321
1277
|
i(n.filter((e) => e.key !== r?.key));
|
|
1322
1278
|
},
|
|
1323
1279
|
variant: "icon",
|
|
1324
1280
|
size: "icon",
|
|
1325
|
-
className: "group size-4 rounded-sm p-0.5",
|
|
1326
|
-
children: /* @__PURE__ */
|
|
1281
|
+
className: "group relative -top-px size-4 rounded-sm p-0.5",
|
|
1282
|
+
children: /* @__PURE__ */ m(Ue, { className: "size-3 transition duration-300 group-hover:rotate-90" })
|
|
1327
1283
|
})]
|
|
1328
1284
|
}, `collapsed_item_${r?.key ?? t}`)
|
|
1329
1285
|
}) : n.text ?? o
|
|
1330
|
-
}), /* @__PURE__ */
|
|
1331
|
-
viewBox: "0 0 16 16",
|
|
1332
|
-
fill: "none",
|
|
1333
|
-
stroke: "currentColor",
|
|
1334
|
-
strokeWidth: "1.6",
|
|
1335
|
-
strokeLinecap: "round",
|
|
1336
|
-
strokeLinejoin: "round",
|
|
1337
|
-
"aria-hidden": !0,
|
|
1338
|
-
className: _("text-muted-foreground size-4 shrink-0 transition-transform duration-300", h && "rotate-180"),
|
|
1339
|
-
children: /* @__PURE__ */ p("path", { d: "m4 6 4 4 4-4" })
|
|
1340
|
-
})]
|
|
1286
|
+
}), /* @__PURE__ */ m(X, { open: p })]
|
|
1341
1287
|
})
|
|
1342
1288
|
});
|
|
1343
1289
|
}
|
|
1344
|
-
function
|
|
1345
|
-
let { items: t, multiple: n, selected: r, onChange: i, mutable: a, onAdd:
|
|
1346
|
-
count:
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
})
|
|
1350
|
-
|
|
1290
|
+
function qe(e) {
|
|
1291
|
+
let { items: t, multiple: n, selected: r, onChange: i, mutable: a, onAdd: s } = e, [c, f] = d(""), p = u(null), g = l(() => t.reduce((e, t) => ((!c.length || t.text.toLowerCase().includes(c.toLowerCase())) && e.push(t), e), []), [t, c]), _ = Ge({
|
|
1292
|
+
count: g.length,
|
|
1293
|
+
itemHeight: 35,
|
|
1294
|
+
scrollRef: p
|
|
1295
|
+
});
|
|
1296
|
+
o(() => {
|
|
1297
|
+
p.current && (p.current.scrollTop = 0);
|
|
1298
|
+
}, [c]);
|
|
1299
|
+
let v = r instanceof Array ? r.map((e) => e.key) : [r.key];
|
|
1300
|
+
return /* @__PURE__ */ h("div", {
|
|
1351
1301
|
className: "divide-tint/10 flex w-full flex-col divide-y overflow-hidden rounded-xl",
|
|
1352
|
-
children: [/* @__PURE__ */
|
|
1353
|
-
className:
|
|
1354
|
-
children: [/* @__PURE__ */
|
|
1355
|
-
className: "text-foreground inline-flex grow bg-transparent text-sm outline-hidden",
|
|
1302
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1303
|
+
className: "flex h-10 grow items-center gap-2 px-3",
|
|
1304
|
+
children: [/* @__PURE__ */ m(Y, { children: /* @__PURE__ */ m(He, {}) }), /* @__PURE__ */ m(J, {
|
|
1356
1305
|
placeholder: "Search",
|
|
1357
|
-
|
|
1358
|
-
|
|
1306
|
+
"aria-label": "Search options",
|
|
1307
|
+
value: c,
|
|
1308
|
+
onChange: (e) => f(e.target.value)
|
|
1359
1309
|
})]
|
|
1360
|
-
}), /* @__PURE__ */
|
|
1310
|
+
}), /* @__PURE__ */ h("ul", {
|
|
1361
1311
|
role: "listbox",
|
|
1362
|
-
className:
|
|
1363
|
-
ref:
|
|
1364
|
-
children: [/* @__PURE__ */
|
|
1312
|
+
className: k("max-h-72 grow overflow-y-auto py-1", "focus:ring-0 focus:outline-hidden"),
|
|
1313
|
+
ref: p,
|
|
1314
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1365
1315
|
style: {
|
|
1366
|
-
height: `${
|
|
1316
|
+
height: `${_.totalSize}px`,
|
|
1367
1317
|
width: "100%",
|
|
1368
1318
|
position: "relative"
|
|
1369
1319
|
},
|
|
1370
|
-
children:
|
|
1320
|
+
children: _.items.map((e) => /* @__PURE__ */ h("li", {
|
|
1371
1321
|
role: "option",
|
|
1372
|
-
"aria-selected": v.includes(
|
|
1322
|
+
"aria-selected": v.includes(g[e.index].key),
|
|
1373
1323
|
style: {
|
|
1374
1324
|
height: `${e.size}px`,
|
|
1375
1325
|
transform: `translateY(${e.start}px)`
|
|
1376
1326
|
},
|
|
1377
|
-
className:
|
|
1327
|
+
className: k("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
1328
|
onClick: () => {
|
|
1379
|
-
n ? v.includes(
|
|
1329
|
+
n ? v.includes(g[e.index].key) ? i(structuredClone(r.filter((t) => t.key !== g[e.index].key))) : i(structuredClone([...r, g[e.index]])) : i(g[e.index]);
|
|
1380
1330
|
},
|
|
1381
|
-
children: [/* @__PURE__ */
|
|
1331
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1382
1332
|
className: "text-primary col-start-1",
|
|
1383
1333
|
"aria-hidden": !0,
|
|
1384
|
-
children: v.includes(
|
|
1385
|
-
}), /* @__PURE__ */
|
|
1334
|
+
children: v.includes(g[e.index].key) && /* @__PURE__ */ m(G, {})
|
|
1335
|
+
}), /* @__PURE__ */ m("span", {
|
|
1386
1336
|
className: "col-start-2 truncate",
|
|
1387
|
-
children:
|
|
1337
|
+
children: g[e.index].text
|
|
1388
1338
|
})]
|
|
1389
|
-
}, e.
|
|
1390
|
-
}),
|
|
1339
|
+
}, e.index))
|
|
1340
|
+
}), c.length > 0 && g.length === 0 && (a ? /* @__PURE__ */ h("li", {
|
|
1391
1341
|
role: "option",
|
|
1392
1342
|
"aria-selected": !1,
|
|
1393
|
-
className:
|
|
1343
|
+
className: k("hover:bg-muted cursor-pointer px-3 py-2 text-sm select-none"),
|
|
1394
1344
|
onClick: () => {
|
|
1395
|
-
|
|
1396
|
-
text:
|
|
1397
|
-
key:
|
|
1398
|
-
}),
|
|
1345
|
+
s({
|
|
1346
|
+
text: c,
|
|
1347
|
+
key: c
|
|
1348
|
+
}), f("");
|
|
1399
1349
|
},
|
|
1400
|
-
children: ["Add ",
|
|
1401
|
-
}) : /* @__PURE__ */
|
|
1350
|
+
children: ["Add ", c]
|
|
1351
|
+
}) : /* @__PURE__ */ m("li", {
|
|
1402
1352
|
role: "option",
|
|
1403
1353
|
"aria-selected": !1,
|
|
1404
|
-
className:
|
|
1354
|
+
className: k("text-muted-foreground cursor-not-allowed px-3 py-2 text-sm"),
|
|
1405
1355
|
children: "No results found"
|
|
1406
1356
|
}))]
|
|
1407
1357
|
})]
|
|
1408
1358
|
});
|
|
1409
1359
|
}
|
|
1410
1360
|
//#endregion
|
|
1361
|
+
//#region packages/header/index.tsx
|
|
1362
|
+
function Je({ className: e, children: t, ...n }) {
|
|
1363
|
+
return M(), /* @__PURE__ */ m("header", {
|
|
1364
|
+
className: k("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),
|
|
1365
|
+
...n,
|
|
1366
|
+
children: /* @__PURE__ */ m("div", {
|
|
1367
|
+
className: "flex items-center justify-between gap-4 px-4 py-2.5 md:gap-6 md:px-6 md:py-3",
|
|
1368
|
+
children: t
|
|
1369
|
+
})
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
//#endregion
|
|
1411
1373
|
//#region packages/icons/chevron-down.tsx
|
|
1412
|
-
function
|
|
1413
|
-
return /* @__PURE__ */
|
|
1374
|
+
function Ye(e) {
|
|
1375
|
+
return /* @__PURE__ */ m("svg", {
|
|
1414
1376
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1415
1377
|
fill: "none",
|
|
1416
1378
|
viewBox: "0 0 24 24",
|
|
@@ -1418,7 +1380,7 @@ function Te(e) {
|
|
|
1418
1380
|
stroke: "currentColor",
|
|
1419
1381
|
className: "h-6 w-6",
|
|
1420
1382
|
...e,
|
|
1421
|
-
children: /* @__PURE__ */
|
|
1383
|
+
children: /* @__PURE__ */ m("path", {
|
|
1422
1384
|
strokeLinecap: "round",
|
|
1423
1385
|
strokeLinejoin: "round",
|
|
1424
1386
|
d: "m19.5 8.25-7.5 7.5-7.5-7.5"
|
|
@@ -1426,9 +1388,45 @@ function Te(e) {
|
|
|
1426
1388
|
});
|
|
1427
1389
|
}
|
|
1428
1390
|
//#endregion
|
|
1391
|
+
//#region packages/icons/chevron-left.tsx
|
|
1392
|
+
function Xe(e) {
|
|
1393
|
+
return /* @__PURE__ */ m("svg", {
|
|
1394
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1395
|
+
fill: "none",
|
|
1396
|
+
viewBox: "0 0 24 24",
|
|
1397
|
+
strokeWidth: 1.5,
|
|
1398
|
+
stroke: "currentColor",
|
|
1399
|
+
className: "h-6 w-6",
|
|
1400
|
+
...e,
|
|
1401
|
+
children: /* @__PURE__ */ m("path", {
|
|
1402
|
+
strokeLinecap: "round",
|
|
1403
|
+
strokeLinejoin: "round",
|
|
1404
|
+
d: "M15.75 19.5 8.25 12l7.5-7.5"
|
|
1405
|
+
})
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
//#endregion
|
|
1409
|
+
//#region packages/icons/chevron-right.tsx
|
|
1410
|
+
function Ze(e) {
|
|
1411
|
+
return /* @__PURE__ */ m("svg", {
|
|
1412
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1413
|
+
fill: "none",
|
|
1414
|
+
viewBox: "0 0 24 24",
|
|
1415
|
+
strokeWidth: 1.5,
|
|
1416
|
+
stroke: "currentColor",
|
|
1417
|
+
className: "h-6 w-6",
|
|
1418
|
+
...e,
|
|
1419
|
+
children: /* @__PURE__ */ m("path", {
|
|
1420
|
+
strokeLinecap: "round",
|
|
1421
|
+
strokeLinejoin: "round",
|
|
1422
|
+
d: "m8.25 4.5 7.5 7.5-7.5 7.5"
|
|
1423
|
+
})
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
//#endregion
|
|
1429
1427
|
//#region packages/icons/chevron-up.tsx
|
|
1430
|
-
function
|
|
1431
|
-
return /* @__PURE__ */
|
|
1428
|
+
function Qe(e) {
|
|
1429
|
+
return /* @__PURE__ */ m("svg", {
|
|
1432
1430
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1433
1431
|
fill: "none",
|
|
1434
1432
|
viewBox: "0 0 24 24",
|
|
@@ -1436,7 +1434,7 @@ function Ee(e) {
|
|
|
1436
1434
|
stroke: "currentColor",
|
|
1437
1435
|
className: "h-6 w-6",
|
|
1438
1436
|
...e,
|
|
1439
|
-
children: /* @__PURE__ */
|
|
1437
|
+
children: /* @__PURE__ */ m("path", {
|
|
1440
1438
|
strokeLinecap: "round",
|
|
1441
1439
|
strokeLinejoin: "round",
|
|
1442
1440
|
d: "m4.5 15.75 7.5-7.5 7.5 7.5"
|
|
@@ -1444,18 +1442,289 @@ function Ee(e) {
|
|
|
1444
1442
|
});
|
|
1445
1443
|
}
|
|
1446
1444
|
//#endregion
|
|
1447
|
-
//#region packages/input/index.tsx
|
|
1448
|
-
function
|
|
1449
|
-
let { className: t, ...n } = e;
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
className:
|
|
1452
|
-
...n
|
|
1445
|
+
//#region packages/input/index.tsx
|
|
1446
|
+
function $e(e) {
|
|
1447
|
+
let { className: t, ...n } = e;
|
|
1448
|
+
return /* @__PURE__ */ m("input", {
|
|
1449
|
+
className: k(V, "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),
|
|
1450
|
+
...n
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
//#endregion
|
|
1454
|
+
//#region packages/meter/index.tsx
|
|
1455
|
+
function et({ value: e, max: t = 100, label: n, detail: r, hint: i, valueText: a, tone: o = "auto", warnAt: c = .85, className: l }) {
|
|
1456
|
+
let u = s(), d = e > t, f = t > 0 ? e / t : +(e > 0), p = Math.min(100, Math.max(0, Math.round(f * 100))), g = o === "auto" ? d ? "danger" : f >= c ? "warning" : "default" : o;
|
|
1457
|
+
return /* @__PURE__ */ h("div", {
|
|
1458
|
+
role: "meter",
|
|
1459
|
+
"aria-labelledby": n ? u : void 0,
|
|
1460
|
+
"aria-valuemin": 0,
|
|
1461
|
+
"aria-valuemax": t,
|
|
1462
|
+
"aria-valuenow": Math.min(e, t),
|
|
1463
|
+
"aria-valuetext": a,
|
|
1464
|
+
className: k("zen__meter grid grid-cols-2 gap-y-1.5", l),
|
|
1465
|
+
children: [
|
|
1466
|
+
n && /* @__PURE__ */ m("span", {
|
|
1467
|
+
id: u,
|
|
1468
|
+
className: "text-sm font-medium",
|
|
1469
|
+
children: n
|
|
1470
|
+
}),
|
|
1471
|
+
r && /* @__PURE__ */ m("span", {
|
|
1472
|
+
className: k("col-start-2 text-right text-sm tabular-nums", g === "danger" ? "text-destructive" : "text-muted-foreground"),
|
|
1473
|
+
children: r
|
|
1474
|
+
}),
|
|
1475
|
+
/* @__PURE__ */ m("div", {
|
|
1476
|
+
className: "bg-muted col-span-2 h-2 overflow-hidden rounded-full",
|
|
1477
|
+
children: /* @__PURE__ */ m("div", {
|
|
1478
|
+
className: k("h-full rounded-full transition-[width] duration-700 ease-[cubic-bezier(0.2,0.8,0.2,1)]", g === "danger" ? "bg-destructive shadow-[0_0_12px_oklch(var(--destructive)/0.7)]" : g === "warning" ? "bg-accent-foreground shadow-[0_0_12px_oklch(var(--accent-foreground)/0.6)]" : "from-primary to-glow-2 bg-gradient-to-r shadow-[0_0_12px_oklch(var(--glow)/0.6)]"),
|
|
1479
|
+
style: { width: `${p}%` }
|
|
1480
|
+
})
|
|
1481
|
+
}),
|
|
1482
|
+
i && /* @__PURE__ */ m("span", {
|
|
1483
|
+
className: k("col-span-2 text-xs", g === "danger" ? "text-destructive" : "text-muted-foreground"),
|
|
1484
|
+
children: i
|
|
1485
|
+
})
|
|
1486
|
+
]
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
//#endregion
|
|
1490
|
+
//#region packages/utils/month.ts
|
|
1491
|
+
var tt = /^(\d{4})-(0[1-9]|1[0-2])$/;
|
|
1492
|
+
function nt(e) {
|
|
1493
|
+
return typeof e == "string" && tt.test(e);
|
|
1494
|
+
}
|
|
1495
|
+
function Z(e) {
|
|
1496
|
+
let t = tt.exec(e);
|
|
1497
|
+
if (!t) throw Error(`Invalid month: ${e}`);
|
|
1498
|
+
return Number(t[1]) * 12 + Number(t[2]) - 1;
|
|
1499
|
+
}
|
|
1500
|
+
function rt(e) {
|
|
1501
|
+
let t = Math.floor(e / 12);
|
|
1502
|
+
return `${String(t).padStart(4, "0")}-${String(e % 12 + 1).padStart(2, "0")}`;
|
|
1503
|
+
}
|
|
1504
|
+
function it(e, t) {
|
|
1505
|
+
return rt(Z(e) + t);
|
|
1506
|
+
}
|
|
1507
|
+
function at(e, t) {
|
|
1508
|
+
let n = [];
|
|
1509
|
+
for (let r = Z(e); r <= Z(t); r++) n.push(rt(r));
|
|
1510
|
+
return n;
|
|
1511
|
+
}
|
|
1512
|
+
function ot(e, t) {
|
|
1513
|
+
return Z(t) - Z(e);
|
|
1514
|
+
}
|
|
1515
|
+
function st(e = /* @__PURE__ */ new Date()) {
|
|
1516
|
+
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
|
|
1517
|
+
}
|
|
1518
|
+
function ct(e, t, n = "short") {
|
|
1519
|
+
let [r, i] = e.split("-").map(Number);
|
|
1520
|
+
return new Intl.DateTimeFormat(t, {
|
|
1521
|
+
month: n,
|
|
1522
|
+
year: "numeric",
|
|
1523
|
+
timeZone: "UTC"
|
|
1524
|
+
}).format(Date.UTC(r, i - 1, 1));
|
|
1525
|
+
}
|
|
1526
|
+
function lt(e) {
|
|
1527
|
+
let t = new Intl.DateTimeFormat(e, {
|
|
1528
|
+
month: "short",
|
|
1529
|
+
timeZone: "UTC"
|
|
1530
|
+
});
|
|
1531
|
+
return Array.from({ length: 12 }, (e, n) => t.format(Date.UTC(2e3, n, 1)));
|
|
1532
|
+
}
|
|
1533
|
+
//#endregion
|
|
1534
|
+
//#region packages/month-picker/index.tsx
|
|
1535
|
+
function ut({ value: e, onChange: t, locale: n, min: r, max: i, id: a, className: o, disabled: s = !1, placeholder: c = "Pick a month", onClear: l, clearLabel: u = "Clear", "aria-label": f }) {
|
|
1536
|
+
let [g, _] = d(() => Number((e ?? (/* @__PURE__ */ new Date()).toISOString()).slice(0, 4))), v = N({ onOpenChange: (t) => t && e && _(Number(e.slice(0, 4))) }), y = lt(n), b = (e) => (!r || e >= r) && (!i || e <= i);
|
|
1537
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("button", {
|
|
1538
|
+
type: "button",
|
|
1539
|
+
id: a,
|
|
1540
|
+
disabled: s,
|
|
1541
|
+
"aria-label": f,
|
|
1542
|
+
...v.triggerProps,
|
|
1543
|
+
className: k("zen__month-picker group", H, "w-full", v.open && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", o),
|
|
1544
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1545
|
+
className: e ? void 0 : "text-muted-foreground",
|
|
1546
|
+
children: e ? ct(e, n) : c
|
|
1547
|
+
}), /* @__PURE__ */ m(X, { open: v.open })]
|
|
1548
|
+
}), /* @__PURE__ */ h("div", {
|
|
1549
|
+
...v.popupProps,
|
|
1550
|
+
role: "dialog",
|
|
1551
|
+
"aria-label": "Choose month",
|
|
1552
|
+
className: k("zen__popover", U, "w-64 p-3"),
|
|
1553
|
+
children: [
|
|
1554
|
+
/* @__PURE__ */ h("div", {
|
|
1555
|
+
className: "mb-2 flex items-center justify-between",
|
|
1556
|
+
children: [
|
|
1557
|
+
/* @__PURE__ */ m("button", {
|
|
1558
|
+
type: "button",
|
|
1559
|
+
"aria-label": "Previous year",
|
|
1560
|
+
onClick: () => _((e) => e - 1),
|
|
1561
|
+
className: "hover:bg-muted rounded p-1.5",
|
|
1562
|
+
children: /* @__PURE__ */ m(Xe, { className: "size-4" })
|
|
1563
|
+
}),
|
|
1564
|
+
/* @__PURE__ */ m("span", {
|
|
1565
|
+
className: "text-sm font-semibold tabular-nums",
|
|
1566
|
+
"aria-live": "polite",
|
|
1567
|
+
children: g
|
|
1568
|
+
}),
|
|
1569
|
+
/* @__PURE__ */ m("button", {
|
|
1570
|
+
type: "button",
|
|
1571
|
+
"aria-label": "Next year",
|
|
1572
|
+
onClick: () => _((e) => e + 1),
|
|
1573
|
+
className: "hover:bg-muted rounded p-1.5",
|
|
1574
|
+
children: /* @__PURE__ */ m(Ze, { className: "size-4" })
|
|
1575
|
+
})
|
|
1576
|
+
]
|
|
1577
|
+
}),
|
|
1578
|
+
/* @__PURE__ */ m("div", {
|
|
1579
|
+
className: "grid grid-cols-3 gap-1",
|
|
1580
|
+
children: y.map((r, i) => {
|
|
1581
|
+
let a = `${g}-${String(i + 1).padStart(2, "0")}`, o = a === e;
|
|
1582
|
+
return /* @__PURE__ */ m("button", {
|
|
1583
|
+
type: "button",
|
|
1584
|
+
disabled: !b(a),
|
|
1585
|
+
"aria-pressed": o,
|
|
1586
|
+
"aria-label": ct(a, n, "long"),
|
|
1587
|
+
onClick: () => {
|
|
1588
|
+
t(a), v.setOpen(!1);
|
|
1589
|
+
},
|
|
1590
|
+
className: k("rounded-sm py-2 text-sm disabled:cursor-not-allowed disabled:opacity-40", o ? "bg-primary text-primary-foreground" : "hover:bg-muted"),
|
|
1591
|
+
children: r
|
|
1592
|
+
}, a);
|
|
1593
|
+
})
|
|
1594
|
+
}),
|
|
1595
|
+
l && e && /* @__PURE__ */ m("button", {
|
|
1596
|
+
type: "button",
|
|
1597
|
+
onClick: () => {
|
|
1598
|
+
l(), v.setOpen(!1);
|
|
1599
|
+
},
|
|
1600
|
+
className: "border-tint/[0.06] text-muted-foreground hover:text-foreground focus-visible:ring-ring/40 mt-2 w-full rounded-lg border-t px-2 pt-2.5 pb-1.5 text-sm outline-hidden focus-visible:ring-2",
|
|
1601
|
+
children: u
|
|
1602
|
+
})
|
|
1603
|
+
]
|
|
1604
|
+
})] });
|
|
1605
|
+
}
|
|
1606
|
+
//#endregion
|
|
1607
|
+
//#region packages/money-input/index.tsx
|
|
1608
|
+
function dt({ start: e, end: t, compact: n = !1, disabled: r = !1, id: i, autoFocus: a, className: o, "aria-label": s, ...c }) {
|
|
1609
|
+
let l = ft(c);
|
|
1610
|
+
return /* @__PURE__ */ h("div", {
|
|
1611
|
+
className: k("zen__money-input flex flex-col gap-1", o),
|
|
1612
|
+
children: [/* @__PURE__ */ h(We, {
|
|
1613
|
+
invalid: !!l.error,
|
|
1614
|
+
className: k(n && "h-7! border!"),
|
|
1615
|
+
children: [
|
|
1616
|
+
e ?? /* @__PURE__ */ m(Y, {
|
|
1617
|
+
"aria-hidden": !0,
|
|
1618
|
+
"data-slot": "symbol",
|
|
1619
|
+
children: l.symbol
|
|
1620
|
+
}),
|
|
1621
|
+
/* @__PURE__ */ m(J, {
|
|
1622
|
+
...l.inputProps,
|
|
1623
|
+
id: i,
|
|
1624
|
+
autoFocus: a,
|
|
1625
|
+
disabled: r,
|
|
1626
|
+
"aria-label": s,
|
|
1627
|
+
className: k("tabular-nums", n ? "text-right" : "text-left")
|
|
1628
|
+
}),
|
|
1629
|
+
t
|
|
1630
|
+
]
|
|
1631
|
+
}), l.error && /* @__PURE__ */ h("p", {
|
|
1632
|
+
id: l.errorId,
|
|
1633
|
+
role: "alert",
|
|
1634
|
+
className: "text-destructive mt-0! flex items-center gap-1.5 text-xs font-medium",
|
|
1635
|
+
children: [/* @__PURE__ */ m(K, { className: "shrink-0" }), l.error]
|
|
1636
|
+
})]
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
function ft({ value: e, onChange: t, currency: n, locale: r, allowNegative: i = !1, allowEmpty: a = !1, live: c = !1, onCancel: l }) {
|
|
1640
|
+
let u = (e) => e === null ? "" : I(e, n, r), [f, p] = d(() => u(e)), [m, h] = d(null), [g, _] = d(!1), [v, y] = d(!1), b = s();
|
|
1641
|
+
o(() => {
|
|
1642
|
+
!g && !(c && v) && p(u(e));
|
|
1643
|
+
}, [
|
|
1644
|
+
e,
|
|
1645
|
+
n,
|
|
1646
|
+
r
|
|
1647
|
+
]);
|
|
1648
|
+
let x = `Not an amount. Try ${I(3274e3, n, r)} or ${r.endsWith("-IN") ? "1.5L" : "10k"}.`;
|
|
1649
|
+
function S(e) {
|
|
1650
|
+
let t = e.trim();
|
|
1651
|
+
if (t === "") {
|
|
1652
|
+
if (a) return null;
|
|
1653
|
+
h("Enter an amount.");
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
let r;
|
|
1657
|
+
try {
|
|
1658
|
+
r = he(t, n);
|
|
1659
|
+
} catch {
|
|
1660
|
+
h(x);
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
if (!i && r < 0) {
|
|
1664
|
+
h("Amount can't be negative.");
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
return h(null), r;
|
|
1668
|
+
}
|
|
1669
|
+
function C() {
|
|
1670
|
+
let e = S(f);
|
|
1671
|
+
return e !== void 0 && (p(u(e)), t(e), !0);
|
|
1672
|
+
}
|
|
1673
|
+
function w() {
|
|
1674
|
+
let e = S(f);
|
|
1675
|
+
e !== void 0 && p(u(e));
|
|
1676
|
+
}
|
|
1677
|
+
return {
|
|
1678
|
+
inputProps: {
|
|
1679
|
+
type: "text",
|
|
1680
|
+
inputMode: "decimal",
|
|
1681
|
+
autoComplete: "off",
|
|
1682
|
+
spellCheck: !1,
|
|
1683
|
+
value: f,
|
|
1684
|
+
"aria-invalid": m ? !0 : void 0,
|
|
1685
|
+
"aria-describedby": m ? b : void 0,
|
|
1686
|
+
onChange: (e) => {
|
|
1687
|
+
if (p(e.target.value), c) {
|
|
1688
|
+
y(!0);
|
|
1689
|
+
try {
|
|
1690
|
+
let r = e.target.value.trim();
|
|
1691
|
+
t(r === "" ? null : he(r, n));
|
|
1692
|
+
} catch {
|
|
1693
|
+
t(null);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
onFocus: () => _(!0),
|
|
1698
|
+
onBlur: () => {
|
|
1699
|
+
_(!1), c ? w() : C();
|
|
1700
|
+
},
|
|
1701
|
+
onKeyDown: (t) => {
|
|
1702
|
+
t.key === "Enter" ? (t.preventDefault(), c ? w() : C()) : t.key === "Escape" && (t.preventDefault(), p(u(e)), h(null), l?.());
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
symbol: fe(n, r),
|
|
1706
|
+
error: m,
|
|
1707
|
+
errorId: b,
|
|
1708
|
+
text: f,
|
|
1709
|
+
setText: p,
|
|
1710
|
+
commit: C,
|
|
1711
|
+
formatted: e === null ? "" : F(e, n, r)
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
//#endregion
|
|
1715
|
+
//#region packages/utils/slot.tsx
|
|
1716
|
+
function pt({ children: e, className: n, ...i }) {
|
|
1717
|
+
if (!r(e)) return null;
|
|
1718
|
+
let a = e;
|
|
1719
|
+
return t(a, {
|
|
1720
|
+
...i,
|
|
1721
|
+
className: k(n, a.props.className)
|
|
1453
1722
|
});
|
|
1454
1723
|
}
|
|
1455
1724
|
//#endregion
|
|
1456
1725
|
//#region packages/nav-pills/index.tsx
|
|
1457
|
-
var
|
|
1458
|
-
function
|
|
1726
|
+
var mt = n(null);
|
|
1727
|
+
function ht({ className: e, children: t, ...n }) {
|
|
1459
1728
|
let r = u(null), [i, a] = d(null);
|
|
1460
1729
|
return c(() => {
|
|
1461
1730
|
let e = r.current;
|
|
@@ -1479,77 +1748,96 @@ function Oe({ className: e, children: t, ...n }) {
|
|
|
1479
1748
|
return i?.observe(e), () => {
|
|
1480
1749
|
n.disconnect(), i?.disconnect();
|
|
1481
1750
|
};
|
|
1482
|
-
}, []), /* @__PURE__ */
|
|
1483
|
-
className:
|
|
1751
|
+
}, []), /* @__PURE__ */ m("nav", {
|
|
1752
|
+
className: k("zen__nav-pills", e),
|
|
1484
1753
|
...n,
|
|
1485
|
-
children: /* @__PURE__ */
|
|
1754
|
+
children: /* @__PURE__ */ m("div", {
|
|
1486
1755
|
ref: r,
|
|
1487
|
-
className:
|
|
1488
|
-
children: /* @__PURE__ */
|
|
1756
|
+
className: Me,
|
|
1757
|
+
children: /* @__PURE__ */ m(mt.Provider, {
|
|
1489
1758
|
value: i,
|
|
1490
1759
|
children: t
|
|
1491
1760
|
})
|
|
1492
1761
|
})
|
|
1493
1762
|
});
|
|
1494
1763
|
}
|
|
1495
|
-
function
|
|
1496
|
-
let t = a(
|
|
1497
|
-
return t ? /* @__PURE__ */
|
|
1764
|
+
function gt({ className: e }) {
|
|
1765
|
+
let t = a(mt);
|
|
1766
|
+
return t ? /* @__PURE__ */ m("span", {
|
|
1498
1767
|
"aria-hidden": !0,
|
|
1499
|
-
className:
|
|
1768
|
+
className: k(Ne, e),
|
|
1500
1769
|
style: {
|
|
1501
1770
|
translate: `${t.x}px 0`,
|
|
1502
1771
|
width: t.w
|
|
1503
1772
|
}
|
|
1504
1773
|
}) : null;
|
|
1505
1774
|
}
|
|
1506
|
-
var
|
|
1507
|
-
function
|
|
1508
|
-
let
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1775
|
+
var _t = k(Pe, "text-muted-foreground hover:text-foreground aria-[current=page]:text-foreground aria-[current=page]:hover:text-foreground");
|
|
1776
|
+
function vt({ active: e, asChild: t, className: n, children: r, ...i }) {
|
|
1777
|
+
let a = {
|
|
1778
|
+
...i,
|
|
1779
|
+
"aria-current": e ? "page" : void 0,
|
|
1780
|
+
className: k(_t, n)
|
|
1781
|
+
};
|
|
1782
|
+
return t ? (e || delete a["aria-current"], /* @__PURE__ */ m(pt, {
|
|
1783
|
+
...a,
|
|
1784
|
+
children: r
|
|
1785
|
+
})) : /* @__PURE__ */ m("a", {
|
|
1786
|
+
...a,
|
|
1787
|
+
children: r
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region packages/page-header/index.tsx
|
|
1792
|
+
function yt({ eyebrow: e, title: t, lead: n, children: r, className: i }) {
|
|
1793
|
+
return /* @__PURE__ */ h("header", {
|
|
1794
|
+
className: k("zen__page-header flex flex-col gap-3", i),
|
|
1795
|
+
children: [
|
|
1796
|
+
e && /* @__PURE__ */ m("p", {
|
|
1797
|
+
className: "text-muted-foreground mt-0! text-xs tracking-[0.1em] uppercase",
|
|
1798
|
+
children: e
|
|
1799
|
+
}),
|
|
1800
|
+
/* @__PURE__ */ m("h1", {
|
|
1801
|
+
className: "text-aurora text-4xl font-semibold tracking-tight lg:text-5xl",
|
|
1802
|
+
children: t
|
|
1803
|
+
}),
|
|
1804
|
+
n && /* @__PURE__ */ m("p", {
|
|
1805
|
+
className: "text-muted-foreground mt-0! max-w-2xl text-lg leading-relaxed",
|
|
1806
|
+
children: n
|
|
1807
|
+
}),
|
|
1808
|
+
r
|
|
1809
|
+
]
|
|
1522
1810
|
});
|
|
1523
1811
|
}
|
|
1524
1812
|
//#endregion
|
|
1525
1813
|
//#region packages/progress-ring/index.tsx
|
|
1526
|
-
function
|
|
1814
|
+
function bt({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, className: a }) {
|
|
1527
1815
|
let o = (t - n) / 2, s = 2 * Math.PI * o, c = Math.min(Math.max(e, 0), 1);
|
|
1528
|
-
return /* @__PURE__ */
|
|
1816
|
+
return /* @__PURE__ */ h("div", {
|
|
1529
1817
|
role: "progressbar",
|
|
1530
1818
|
"aria-label": r,
|
|
1531
1819
|
"aria-valuemin": 0,
|
|
1532
1820
|
"aria-valuemax": 100,
|
|
1533
1821
|
"aria-valuenow": Math.round(c * 100),
|
|
1534
|
-
className:
|
|
1822
|
+
className: k("zen__progress-ring relative grid shrink-0 place-items-center", a),
|
|
1535
1823
|
style: {
|
|
1536
1824
|
width: t,
|
|
1537
1825
|
height: t
|
|
1538
1826
|
},
|
|
1539
|
-
children: [/* @__PURE__ */
|
|
1827
|
+
children: [/* @__PURE__ */ h("svg", {
|
|
1540
1828
|
width: t,
|
|
1541
1829
|
height: t,
|
|
1542
1830
|
viewBox: `0 0 ${t} ${t}`,
|
|
1543
1831
|
className: "-rotate-90",
|
|
1544
1832
|
"aria-hidden": !0,
|
|
1545
|
-
children: [/* @__PURE__ */
|
|
1833
|
+
children: [/* @__PURE__ */ m("circle", {
|
|
1546
1834
|
cx: t / 2,
|
|
1547
1835
|
cy: t / 2,
|
|
1548
1836
|
r: o,
|
|
1549
1837
|
fill: "none",
|
|
1550
1838
|
strokeWidth: n,
|
|
1551
1839
|
className: "stroke-tint/[0.07]"
|
|
1552
|
-
}), /* @__PURE__ */
|
|
1840
|
+
}), /* @__PURE__ */ m("circle", {
|
|
1553
1841
|
cx: t / 2,
|
|
1554
1842
|
cy: t / 2,
|
|
1555
1843
|
r: o,
|
|
@@ -1560,7 +1848,7 @@ function je({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, clas
|
|
|
1560
1848
|
strokeDashoffset: s * (1 - c),
|
|
1561
1849
|
className: "stroke-primary [filter:drop-shadow(0_0_6px_oklch(var(--glow)/0.45))] transition-[stroke-dashoffset] duration-700 ease-out"
|
|
1562
1850
|
})]
|
|
1563
|
-
}), /* @__PURE__ */
|
|
1851
|
+
}), /* @__PURE__ */ m("div", {
|
|
1564
1852
|
className: "absolute inset-0 grid place-items-center text-center",
|
|
1565
1853
|
children: i
|
|
1566
1854
|
})]
|
|
@@ -1568,21 +1856,45 @@ function je({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, clas
|
|
|
1568
1856
|
}
|
|
1569
1857
|
//#endregion
|
|
1570
1858
|
//#region packages/segmented/index.tsx
|
|
1571
|
-
function
|
|
1572
|
-
let o = s();
|
|
1573
|
-
return
|
|
1574
|
-
|
|
1575
|
-
|
|
1859
|
+
function xt({ label: e, value: t, options: n, onChange: r, name: i, className: a }) {
|
|
1860
|
+
let o = s(), l = u(null), [f, p] = d(null);
|
|
1861
|
+
return c(() => {
|
|
1862
|
+
let e = l.current;
|
|
1863
|
+
if (!e) return;
|
|
1864
|
+
let t = () => {
|
|
1865
|
+
let t = e.querySelector("label:has(input:checked)");
|
|
1866
|
+
p(t ? {
|
|
1867
|
+
x: t.offsetLeft,
|
|
1868
|
+
y: t.offsetTop,
|
|
1869
|
+
w: t.offsetWidth,
|
|
1870
|
+
h: t.offsetHeight
|
|
1871
|
+
} : null);
|
|
1872
|
+
};
|
|
1873
|
+
t();
|
|
1874
|
+
let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
1875
|
+
return n?.observe(e), () => n?.disconnect();
|
|
1876
|
+
}, [t, n]), /* @__PURE__ */ h("div", {
|
|
1877
|
+
className: k("zen__segmented flex flex-col gap-2", a),
|
|
1878
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1576
1879
|
id: o,
|
|
1577
1880
|
className: "text-sm font-medium",
|
|
1578
1881
|
children: e
|
|
1579
|
-
}), /* @__PURE__ */
|
|
1882
|
+
}), /* @__PURE__ */ h("div", {
|
|
1883
|
+
ref: l,
|
|
1580
1884
|
role: "radiogroup",
|
|
1581
1885
|
"aria-labelledby": o,
|
|
1582
|
-
className: "border-tint/10 bg-tint/[0.03] inline-flex w-fit flex-wrap gap-1 rounded-xl border p-1",
|
|
1583
|
-
children:
|
|
1584
|
-
|
|
1585
|
-
|
|
1886
|
+
className: "border-tint/10 bg-tint/[0.03] relative inline-flex w-fit flex-wrap gap-1 rounded-xl border p-1",
|
|
1887
|
+
children: [f && /* @__PURE__ */ m("span", {
|
|
1888
|
+
"aria-hidden": !0,
|
|
1889
|
+
className: "bg-primary/15 absolute top-0 left-0 rounded-lg shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.4)] transition-[translate,width,height] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
|
|
1890
|
+
style: {
|
|
1891
|
+
translate: `${f.x}px ${f.y}px`,
|
|
1892
|
+
width: f.w,
|
|
1893
|
+
height: f.h
|
|
1894
|
+
}
|
|
1895
|
+
}), n.map((e) => /* @__PURE__ */ h("label", {
|
|
1896
|
+
className: k("text-muted-foreground relative cursor-pointer rounded-lg px-3 py-1.5 text-sm transition-colors duration-300", "hover:text-foreground has-checked:text-foreground has-focus-visible:ring-ring/50 has-focus-visible:ring-2", !f && "has-checked:bg-primary/15 has-checked:shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.4)]"),
|
|
1897
|
+
children: [/* @__PURE__ */ m("input", {
|
|
1586
1898
|
type: "radio",
|
|
1587
1899
|
className: "sr-only",
|
|
1588
1900
|
name: i ?? o,
|
|
@@ -1590,29 +1902,394 @@ function Me({ label: e, value: t, options: n, onChange: r, name: i, className: a
|
|
|
1590
1902
|
checked: t === e.value,
|
|
1591
1903
|
onChange: () => r(e.value)
|
|
1592
1904
|
}), e.label]
|
|
1593
|
-
}, e.value))
|
|
1905
|
+
}, e.value))]
|
|
1594
1906
|
})]
|
|
1595
1907
|
});
|
|
1596
1908
|
}
|
|
1597
1909
|
//#endregion
|
|
1910
|
+
//#region packages/select/index.tsx
|
|
1911
|
+
function St({ value: e, options: t, onChange: n, placeholder: r = "Select…", disabled: i = !1, renderOption: a, name: s, id: c, className: l, listClassName: f, "aria-label": g }) {
|
|
1912
|
+
let _ = u(null), [v, y] = d(-1), b = u({
|
|
1913
|
+
text: "",
|
|
1914
|
+
at: 0
|
|
1915
|
+
}), x = N({
|
|
1916
|
+
matchWidth: !0,
|
|
1917
|
+
onOpenChange: (n) => {
|
|
1918
|
+
n && y(Math.max(0, t.findIndex((t) => t.value === e)));
|
|
1919
|
+
}
|
|
1920
|
+
});
|
|
1921
|
+
o(() => {
|
|
1922
|
+
x.open && _.current?.focus();
|
|
1923
|
+
}, [x.open]);
|
|
1924
|
+
let S = t.find((t) => t.value === e), C = (e) => `${x.id}-option-${e}`, w = (e) => {
|
|
1925
|
+
let r = t[e];
|
|
1926
|
+
r && !r.disabled && (n(r.value), x.setOpen(!1));
|
|
1927
|
+
}, T = (e, n) => {
|
|
1928
|
+
for (let r = 1; r <= t.length; r++) {
|
|
1929
|
+
let i = (e + n * r + t.length * 2) % t.length;
|
|
1930
|
+
if (!t[i].disabled) return i;
|
|
1931
|
+
}
|
|
1932
|
+
return e;
|
|
1933
|
+
}, E = (e) => {
|
|
1934
|
+
let n = {
|
|
1935
|
+
ArrowDown: () => y((e) => T(e, 1)),
|
|
1936
|
+
ArrowUp: () => y((e) => T(e, -1)),
|
|
1937
|
+
Home: () => y(T(-1, 1)),
|
|
1938
|
+
End: () => y(T(t.length, -1)),
|
|
1939
|
+
Enter: () => w(v),
|
|
1940
|
+
" ": () => w(v),
|
|
1941
|
+
Tab: () => x.setOpen(!1)
|
|
1942
|
+
};
|
|
1943
|
+
if (n[e.key]) {
|
|
1944
|
+
e.key !== "Tab" && e.preventDefault(), n[e.key]();
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
1948
|
+
let n = Date.now(), r = (n - b.current.at < 700 ? b.current.text : "") + e.key.toLowerCase();
|
|
1949
|
+
b.current = {
|
|
1950
|
+
text: r,
|
|
1951
|
+
at: n
|
|
1952
|
+
};
|
|
1953
|
+
let i = t.findIndex((e) => !e.disabled && e.label.toLowerCase().startsWith(r));
|
|
1954
|
+
i >= 0 && y(i);
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
return /* @__PURE__ */ h(p, { children: [
|
|
1958
|
+
/* @__PURE__ */ h("button", {
|
|
1959
|
+
type: "button",
|
|
1960
|
+
id: c,
|
|
1961
|
+
disabled: i,
|
|
1962
|
+
"aria-haspopup": "listbox",
|
|
1963
|
+
"aria-label": g,
|
|
1964
|
+
...x.triggerProps,
|
|
1965
|
+
onKeyDown: (e) => {
|
|
1966
|
+
["ArrowDown", "ArrowUp"].includes(e.key) && !x.open && (e.preventDefault(), x.setOpen(!0));
|
|
1967
|
+
},
|
|
1968
|
+
className: k("zen__select group", H, "w-full", x.open && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", l),
|
|
1969
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1970
|
+
className: k("truncate", !S && "text-muted-foreground"),
|
|
1971
|
+
children: S ? S.label : r
|
|
1972
|
+
}), /* @__PURE__ */ m(X, { open: x.open })]
|
|
1973
|
+
}),
|
|
1974
|
+
s && /* @__PURE__ */ m("input", {
|
|
1975
|
+
type: "hidden",
|
|
1976
|
+
name: s,
|
|
1977
|
+
value: e ?? ""
|
|
1978
|
+
}),
|
|
1979
|
+
/* @__PURE__ */ m("div", {
|
|
1980
|
+
...x.popupProps,
|
|
1981
|
+
className: k("zen__popover", U, "overflow-visible py-1", f),
|
|
1982
|
+
children: /* @__PURE__ */ m("div", {
|
|
1983
|
+
ref: _,
|
|
1984
|
+
role: "listbox",
|
|
1985
|
+
tabIndex: -1,
|
|
1986
|
+
"aria-label": g,
|
|
1987
|
+
"aria-activedescendant": v >= 0 ? C(v) : void 0,
|
|
1988
|
+
onKeyDown: E,
|
|
1989
|
+
className: "max-h-72 overflow-y-auto outline-hidden",
|
|
1990
|
+
children: t.map((t, n) => /* @__PURE__ */ h("div", {
|
|
1991
|
+
id: C(n),
|
|
1992
|
+
role: "option",
|
|
1993
|
+
"aria-selected": t.value === e,
|
|
1994
|
+
"aria-disabled": t.disabled || void 0,
|
|
1995
|
+
"data-highlighted": n === v || void 0,
|
|
1996
|
+
onMouseMove: () => !t.disabled && y(n),
|
|
1997
|
+
onClick: () => w(n),
|
|
1998
|
+
className: k("grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", "data-highlighted:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50"),
|
|
1999
|
+
children: [/* @__PURE__ */ m("span", {
|
|
2000
|
+
className: "text-primary col-start-1",
|
|
2001
|
+
"aria-hidden": !0,
|
|
2002
|
+
children: t.value === e && /* @__PURE__ */ m(G, {})
|
|
2003
|
+
}), /* @__PURE__ */ m("span", {
|
|
2004
|
+
className: "col-start-2 truncate",
|
|
2005
|
+
children: a ? a(t) : t.label
|
|
2006
|
+
})]
|
|
2007
|
+
}, t.value))
|
|
2008
|
+
})
|
|
2009
|
+
})
|
|
2010
|
+
] });
|
|
2011
|
+
}
|
|
2012
|
+
//#endregion
|
|
2013
|
+
//#region packages/side-nav/index.tsx
|
|
2014
|
+
function Ct({ className: e, ...t }) {
|
|
2015
|
+
return /* @__PURE__ */ m("nav", {
|
|
2016
|
+
className: k("zen__side-nav flex flex-col gap-6", e),
|
|
2017
|
+
...t
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
function wt({ title: e, children: t, className: n }) {
|
|
2021
|
+
return /* @__PURE__ */ h("div", {
|
|
2022
|
+
className: k("flex flex-col gap-1", n),
|
|
2023
|
+
children: [e && /* @__PURE__ */ m("span", {
|
|
2024
|
+
className: "text-muted-foreground px-3 pb-1 text-[0.68rem] tracking-[0.1em] uppercase",
|
|
2025
|
+
children: e
|
|
2026
|
+
}), t]
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
var Tt = k("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)]");
|
|
2030
|
+
function Et({ active: e, asChild: t, className: n, children: r, ...i }) {
|
|
2031
|
+
let a = {
|
|
2032
|
+
...i,
|
|
2033
|
+
"aria-current": e ? "page" : void 0,
|
|
2034
|
+
className: k(Tt, n)
|
|
2035
|
+
};
|
|
2036
|
+
return t ? (e || delete a["aria-current"], /* @__PURE__ */ m(pt, {
|
|
2037
|
+
...a,
|
|
2038
|
+
children: r
|
|
2039
|
+
})) : /* @__PURE__ */ m("a", {
|
|
2040
|
+
...a,
|
|
2041
|
+
children: r
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
//#endregion
|
|
1598
2045
|
//#region packages/skeleton/index.tsx
|
|
1599
|
-
function
|
|
1600
|
-
return /* @__PURE__ */
|
|
2046
|
+
function Dt({ className: e }) {
|
|
2047
|
+
return /* @__PURE__ */ m("span", {
|
|
2048
|
+
"aria-hidden": !0,
|
|
2049
|
+
className: k("zen__skeleton block rounded-md", e)
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
//#endregion
|
|
2053
|
+
//#region packages/slider/index.tsx
|
|
2054
|
+
function Ot({ value: e, min: t = 0, max: n = 100, step: r = 1, onValueChange: i, onValueCommit: a, trackBackground: s, thumbColor: c, valueText: l, className: d, style: f, ...p }) {
|
|
2055
|
+
let h = u(null), g = u(a);
|
|
2056
|
+
g.current = a, o(() => {
|
|
2057
|
+
let e = h.current;
|
|
2058
|
+
if (!e) return;
|
|
2059
|
+
let t = () => g.current?.(Number(e.value));
|
|
2060
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
2061
|
+
}, []);
|
|
2062
|
+
let _ = n > t ? (e - t) / (n - t) * 100 : 0, v = s ?? `linear-gradient(to right, oklch(var(--primary)) ${_}%, oklch(var(--muted)) ${_}%)`;
|
|
2063
|
+
return /* @__PURE__ */ m("input", {
|
|
2064
|
+
ref: h,
|
|
2065
|
+
type: "range",
|
|
2066
|
+
min: t,
|
|
2067
|
+
max: n,
|
|
2068
|
+
step: r,
|
|
2069
|
+
value: e,
|
|
2070
|
+
"aria-valuetext": l?.(e),
|
|
2071
|
+
onChange: (e) => i?.(Number(e.target.value)),
|
|
2072
|
+
style: {
|
|
2073
|
+
...f,
|
|
2074
|
+
"--zen-track": v,
|
|
2075
|
+
"--zen-thumb": c ?? "oklch(var(--primary))"
|
|
2076
|
+
},
|
|
2077
|
+
className: k("zen__slider h-5 w-full cursor-pointer appearance-none bg-transparent outline-hidden disabled:cursor-not-allowed disabled:opacity-50", "[&::-webkit-slider-runnable-track]:h-2.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:[background:var(--zen-track)]", "[&::-moz-range-track]:h-2.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:[background:var(--zen-track)]", "[&::-webkit-slider-thumb]:-mt-[5px] [&::-webkit-slider-thumb]:size-5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:shadow-[0_0_0_1px_oklch(0_0_0/0.3),0_0_16px_oklch(var(--glow)/0.8)] [&::-webkit-slider-thumb]:[background:var(--zen-thumb)]", "[&::-moz-range-thumb]:size-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-white [&::-moz-range-thumb]:shadow-[0_0_0_1px_oklch(0_0_0/0.3),0_0_16px_oklch(var(--glow)/0.8)] [&::-moz-range-thumb]:[background:var(--zen-thumb)]", "focus-visible:[&::-webkit-slider-thumb]:ring-ring/40 focus-visible:[&::-webkit-slider-thumb]:ring-4", d),
|
|
2078
|
+
...p
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
//#endregion
|
|
2082
|
+
//#region packages/tab-bar/index.tsx
|
|
2083
|
+
function kt({ hideFrom: t = "md", className: n, children: r, ...i }) {
|
|
2084
|
+
return /* @__PURE__ */ m("nav", {
|
|
2085
|
+
className: k("zen__tab-bar glass glass-blur fixed inset-x-0 bottom-0 z-40 rounded-none! border-x-0! border-b-0! pb-[env(safe-area-inset-bottom)]", t === "sm" && "sm:hidden", t === "md" && "md:hidden", t === "lg" && "lg:hidden", n),
|
|
2086
|
+
...i,
|
|
2087
|
+
children: /* @__PURE__ */ m("div", {
|
|
2088
|
+
className: "grid",
|
|
2089
|
+
style: { gridTemplateColumns: `repeat(${e.count(r)}, 1fr)` },
|
|
2090
|
+
children: r
|
|
2091
|
+
})
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
var At = k("flex flex-col items-center gap-1 py-2.5 text-[0.7rem] outline-hidden transition-colors duration-200 focus-visible:bg-tint/5", "text-muted-foreground aria-[current=page]:text-primary [&_svg]:size-5 aria-[current=page]:[&_svg]:drop-shadow-[0_0_8px_oklch(var(--glow)/0.8)]");
|
|
2095
|
+
function jt({ icon: e, active: t, asChild: n, className: r, children: i, ...a }) {
|
|
2096
|
+
let o = {
|
|
2097
|
+
...a,
|
|
2098
|
+
"aria-current": t ? "page" : void 0,
|
|
2099
|
+
className: k(At, r)
|
|
2100
|
+
};
|
|
2101
|
+
return n ? (t || delete o["aria-current"], /* @__PURE__ */ m(pt, {
|
|
2102
|
+
...o,
|
|
2103
|
+
children: i
|
|
2104
|
+
})) : /* @__PURE__ */ h("a", {
|
|
2105
|
+
...o,
|
|
2106
|
+
children: [e, i]
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region packages/table/index.tsx
|
|
2111
|
+
function Mt({ label: e, className: t, ref: n, onScroll: r, ...a }) {
|
|
2112
|
+
let s = u(null), c = i(() => {
|
|
2113
|
+
let e = s.current;
|
|
2114
|
+
if (!e) return;
|
|
2115
|
+
let t = (t, n) => n !== e.hasAttribute(t) && e.toggleAttribute(t, n);
|
|
2116
|
+
t("data-under-top", e.scrollTop > 0), t("data-under-left", e.scrollLeft > 0), t("data-under-bottom", e.scrollTop + e.clientHeight < e.scrollHeight - 1);
|
|
2117
|
+
}, []);
|
|
2118
|
+
return o(() => {
|
|
2119
|
+
let e = s.current;
|
|
2120
|
+
if (!e) return;
|
|
2121
|
+
c();
|
|
2122
|
+
let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
|
|
2123
|
+
return t?.observe(e), e.firstElementChild && t?.observe(e.firstElementChild), () => t?.disconnect();
|
|
2124
|
+
}, [c]), /* @__PURE__ */ m("div", {
|
|
2125
|
+
className: k("zen__table-panel glass glow-edge isolate flex flex-col overflow-hidden rounded-xl", t),
|
|
2126
|
+
children: /* @__PURE__ */ m("div", {
|
|
2127
|
+
ref: (e) => {
|
|
2128
|
+
s.current = e, typeof n == "function" ? n(e) : n && (n.current = e);
|
|
2129
|
+
},
|
|
2130
|
+
onScroll: (e) => {
|
|
2131
|
+
c(), r?.(e);
|
|
2132
|
+
},
|
|
2133
|
+
role: e ? "region" : void 0,
|
|
2134
|
+
"aria-label": e,
|
|
2135
|
+
tabIndex: e ? 0 : void 0,
|
|
2136
|
+
className: "zen__table-container focus-visible:ring-ring/30 min-h-0 overflow-auto rounded-[inherit] outline-hidden will-change-scroll focus-visible:ring-2 focus-visible:ring-inset",
|
|
2137
|
+
...a
|
|
2138
|
+
})
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
function Nt({ className: e, ...t }) {
|
|
2142
|
+
return /* @__PURE__ */ m("table", {
|
|
2143
|
+
className: k("zen__table w-full border-separate border-spacing-0 text-sm", e),
|
|
2144
|
+
...t
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
function Pt({ className: e, ...t }) {
|
|
2148
|
+
return /* @__PURE__ */ m("thead", {
|
|
2149
|
+
className: k("zen__sticky-top sticky top-0 z-20", e),
|
|
2150
|
+
...t
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
function Ft(e) {
|
|
2154
|
+
return /* @__PURE__ */ m("tbody", { ...e });
|
|
2155
|
+
}
|
|
2156
|
+
function It({ className: e, ...t }) {
|
|
2157
|
+
return /* @__PURE__ */ m("tfoot", {
|
|
2158
|
+
className: k("zen__sticky-bottom sticky bottom-0 z-20", e),
|
|
2159
|
+
...t
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
function Lt({ className: e, ...t }) {
|
|
2163
|
+
return /* @__PURE__ */ m("tr", {
|
|
2164
|
+
className: k("group", e),
|
|
2165
|
+
...t
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
function Rt({ numeric: e, sticky: t, sortDirection: n, onSort: r, scope: i = "col", className: a, children: o, ...s }) {
|
|
2169
|
+
return /* @__PURE__ */ m("th", {
|
|
2170
|
+
scope: i,
|
|
2171
|
+
"aria-sort": n === "asc" ? "ascending" : n === "desc" ? "descending" : void 0,
|
|
2172
|
+
className: k("border-tint/[0.07] text-muted-foreground border-b px-3 py-2.5 align-middle text-xs leading-5 font-medium tracking-wider whitespace-nowrap uppercase", t === "left" && "zen__sticky-left sticky left-0 z-10", e ? "text-right" : "text-left", a),
|
|
2173
|
+
...s,
|
|
2174
|
+
children: r ? /* @__PURE__ */ h("button", {
|
|
2175
|
+
type: "button",
|
|
2176
|
+
onClick: r,
|
|
2177
|
+
className: k("hover:text-foreground inline-flex items-center gap-1 align-middle leading-5 tracking-wider uppercase", e && "flex-row-reverse"),
|
|
2178
|
+
children: [o, /* @__PURE__ */ m("span", {
|
|
2179
|
+
"aria-hidden": !0,
|
|
2180
|
+
className: "inline-flex w-3",
|
|
2181
|
+
children: n === "asc" ? /* @__PURE__ */ m(Qe, {
|
|
2182
|
+
className: "size-3",
|
|
2183
|
+
strokeWidth: 2.5
|
|
2184
|
+
}) : n === "desc" ? /* @__PURE__ */ m(Ye, {
|
|
2185
|
+
className: "size-3",
|
|
2186
|
+
strokeWidth: 2.5
|
|
2187
|
+
}) : null
|
|
2188
|
+
})]
|
|
2189
|
+
}) : o
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
function zt({ numeric: e, sticky: t, className: n, ...r }) {
|
|
2193
|
+
return /* @__PURE__ */ m("td", {
|
|
2194
|
+
className: k("border-tint/[0.045] border-b px-3 py-2.5 transition-colors duration-150", "group-hover:[background-image:linear-gradient(oklch(var(--tint)/0.035),oklch(var(--tint)/0.035))]", t === "left" && "zen__sticky-left sticky left-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)]", e && "text-right tabular-nums", n),
|
|
2195
|
+
...r
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
function Bt({ numeric: e, sticky: t, className: n, ...r }) {
|
|
2199
|
+
return /* @__PURE__ */ m("td", {
|
|
2200
|
+
className: k("border-tint/[0.07] h-9 border-t px-3 font-medium whitespace-nowrap", t === "left" && "zen__sticky-left sticky left-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)]", e && "text-right tabular-nums", n),
|
|
2201
|
+
...r
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
function Vt({ height: e, colSpan: t }) {
|
|
2205
|
+
return e <= 0 ? null : /* @__PURE__ */ m("tr", {
|
|
1601
2206
|
"aria-hidden": !0,
|
|
1602
|
-
|
|
2207
|
+
children: /* @__PURE__ */ m("td", {
|
|
2208
|
+
colSpan: t,
|
|
2209
|
+
style: {
|
|
2210
|
+
height: e,
|
|
2211
|
+
padding: 0,
|
|
2212
|
+
border: 0
|
|
2213
|
+
}
|
|
2214
|
+
})
|
|
1603
2215
|
});
|
|
1604
2216
|
}
|
|
2217
|
+
function Ht({ colSpan: e, children: t = "Nothing here yet." }) {
|
|
2218
|
+
return /* @__PURE__ */ m("tr", { children: /* @__PURE__ */ m("td", {
|
|
2219
|
+
colSpan: e,
|
|
2220
|
+
className: "text-muted-foreground px-3 py-8 text-center",
|
|
2221
|
+
children: t
|
|
2222
|
+
}) });
|
|
2223
|
+
}
|
|
2224
|
+
function Ut(e, t, n) {
|
|
2225
|
+
let [r, i] = d(n ?? null);
|
|
2226
|
+
return {
|
|
2227
|
+
rows: l(() => {
|
|
2228
|
+
if (!r) return e;
|
|
2229
|
+
let n = t[r.key], i = [...e].sort(n);
|
|
2230
|
+
return r.direction === "desc" ? i.reverse() : i;
|
|
2231
|
+
}, [
|
|
2232
|
+
e,
|
|
2233
|
+
r,
|
|
2234
|
+
t
|
|
2235
|
+
]),
|
|
2236
|
+
sort: r,
|
|
2237
|
+
setSort: i,
|
|
2238
|
+
headProps: (e) => ({
|
|
2239
|
+
sortDirection: r?.key === e ? r.direction : void 0,
|
|
2240
|
+
onSort: () => i((t) => t?.key === e ? t.direction === "asc" ? {
|
|
2241
|
+
key: e,
|
|
2242
|
+
direction: "desc"
|
|
2243
|
+
} : null : {
|
|
2244
|
+
key: e,
|
|
2245
|
+
direction: "asc"
|
|
2246
|
+
})
|
|
2247
|
+
})
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
//#endregion
|
|
2251
|
+
//#region packages/table-of-contents/index.tsx
|
|
2252
|
+
function Wt({ items: e, title: t = "On this page", className: n }) {
|
|
2253
|
+
let [r, i] = d();
|
|
2254
|
+
return o(() => {
|
|
2255
|
+
if (typeof IntersectionObserver > "u") return;
|
|
2256
|
+
let t = e.map((e) => document.getElementById(e.id)).filter((e) => !!e), n = /* @__PURE__ */ new Set(), r = new IntersectionObserver((t) => {
|
|
2257
|
+
for (let e of t) e.isIntersecting ? n.add(e.target.id) : n.delete(e.target.id);
|
|
2258
|
+
let r = e.find((e) => n.has(e.id));
|
|
2259
|
+
r && i(r.id);
|
|
2260
|
+
}, { rootMargin: "0px 0px -65% 0px" });
|
|
2261
|
+
return t.forEach((e) => r.observe(e)), () => r.disconnect();
|
|
2262
|
+
}, [e]), e.length ? /* @__PURE__ */ h("nav", {
|
|
2263
|
+
"aria-label": t,
|
|
2264
|
+
className: k("zen__toc flex flex-col gap-3", n),
|
|
2265
|
+
children: [/* @__PURE__ */ m("p", {
|
|
2266
|
+
className: "text-muted-foreground mt-0! text-[0.68rem] tracking-[0.1em] uppercase",
|
|
2267
|
+
children: t
|
|
2268
|
+
}), /* @__PURE__ */ m("ul", {
|
|
2269
|
+
className: "border-tint/[0.07] flex flex-col gap-2 border-l text-sm",
|
|
2270
|
+
children: e.map((e) => /* @__PURE__ */ m("li", {
|
|
2271
|
+
className: k("-ml-px", e.depth === 2 && "pl-3"),
|
|
2272
|
+
children: /* @__PURE__ */ m("a", {
|
|
2273
|
+
href: `#${e.id}`,
|
|
2274
|
+
"aria-current": e.id === r ? "location" : void 0,
|
|
2275
|
+
className: k("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"),
|
|
2276
|
+
children: e.label
|
|
2277
|
+
})
|
|
2278
|
+
}, e.id))
|
|
2279
|
+
})]
|
|
2280
|
+
}) : null;
|
|
2281
|
+
}
|
|
1605
2282
|
//#endregion
|
|
1606
2283
|
//#region packages/tabs/index.tsx
|
|
1607
|
-
var
|
|
1608
|
-
function
|
|
1609
|
-
let t = a(
|
|
2284
|
+
var Gt = n(null);
|
|
2285
|
+
function Kt(e) {
|
|
2286
|
+
let t = a(Gt);
|
|
1610
2287
|
if (!t) throw Error(`<${e}> must be inside <Tabs>`);
|
|
1611
2288
|
return t;
|
|
1612
2289
|
}
|
|
1613
|
-
function
|
|
2290
|
+
function qt({ value: e, defaultValue: t = "", onValueChange: n, className: r, ...i }) {
|
|
1614
2291
|
let [a, o] = d(t), c = e ?? a, l = s();
|
|
1615
|
-
return /* @__PURE__ */
|
|
2292
|
+
return /* @__PURE__ */ m(Gt.Provider, {
|
|
1616
2293
|
value: {
|
|
1617
2294
|
value: c,
|
|
1618
2295
|
select: (t) => {
|
|
@@ -1620,15 +2297,15 @@ function Pe({ value: e, defaultValue: t = "", onValueChange: n, className: r, ..
|
|
|
1620
2297
|
},
|
|
1621
2298
|
idFor: (e, t) => `${l}-${e}-${t.replace(/\s+/g, "-")}`
|
|
1622
2299
|
},
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1624
|
-
className:
|
|
2300
|
+
children: /* @__PURE__ */ m("div", {
|
|
2301
|
+
className: k("zen__tabs flex flex-col gap-4", r),
|
|
1625
2302
|
...i
|
|
1626
2303
|
})
|
|
1627
2304
|
});
|
|
1628
2305
|
}
|
|
1629
|
-
var
|
|
1630
|
-
function
|
|
1631
|
-
let { value: i } =
|
|
2306
|
+
var Jt = n("underline");
|
|
2307
|
+
function Yt({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
2308
|
+
let { value: i } = Kt("TabList"), a = e === "pills", o = u(null), [s, l] = d({
|
|
1632
2309
|
left: 0,
|
|
1633
2310
|
width: 0
|
|
1634
2311
|
});
|
|
@@ -1648,7 +2325,7 @@ function Fe({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
|
1648
2325
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1649
2326
|
let n = new ResizeObserver(t);
|
|
1650
2327
|
return n.observe(e), () => n.disconnect();
|
|
1651
|
-
}, [i]), /* @__PURE__ */
|
|
2328
|
+
}, [i]), /* @__PURE__ */ h("div", {
|
|
1652
2329
|
ref: o,
|
|
1653
2330
|
role: "tablist",
|
|
1654
2331
|
onKeyDown: (e) => {
|
|
@@ -1665,19 +2342,19 @@ function Fe({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
|
1665
2342
|
let i = t[(r + t.length) % t.length];
|
|
1666
2343
|
i.focus(), i.click();
|
|
1667
2344
|
},
|
|
1668
|
-
className:
|
|
2345
|
+
className: k(a ? Me : "border-border relative flex gap-1 border-b", t),
|
|
1669
2346
|
...r,
|
|
1670
|
-
children: [/* @__PURE__ */
|
|
2347
|
+
children: [/* @__PURE__ */ m(Jt.Provider, {
|
|
1671
2348
|
value: e,
|
|
1672
2349
|
children: n
|
|
1673
|
-
}), a ? s.width > 0 && /* @__PURE__ */
|
|
2350
|
+
}), a ? s.width > 0 && /* @__PURE__ */ m("span", {
|
|
1674
2351
|
"aria-hidden": !0,
|
|
1675
2352
|
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
2353
|
style: {
|
|
1677
2354
|
width: s.width,
|
|
1678
2355
|
translate: `${s.left}px 0`
|
|
1679
2356
|
}
|
|
1680
|
-
}) : /* @__PURE__ */
|
|
2357
|
+
}) : /* @__PURE__ */ m("span", {
|
|
1681
2358
|
"aria-hidden": !0,
|
|
1682
2359
|
className: "bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
|
|
1683
2360
|
style: {
|
|
@@ -1687,9 +2364,9 @@ function Fe({ variant: e = "underline", className: t, children: n, ...r }) {
|
|
|
1687
2364
|
})]
|
|
1688
2365
|
});
|
|
1689
2366
|
}
|
|
1690
|
-
function
|
|
1691
|
-
let { value: i, select: o, idFor: s } =
|
|
1692
|
-
return /* @__PURE__ */
|
|
2367
|
+
function Xt({ value: e, className: t, onClick: n, ...r }) {
|
|
2368
|
+
let { value: i, select: o, idFor: s } = Kt("Tab"), c = a(Jt), l = i === e;
|
|
2369
|
+
return /* @__PURE__ */ m("button", {
|
|
1693
2370
|
type: "button",
|
|
1694
2371
|
role: "tab",
|
|
1695
2372
|
id: s("tab", e),
|
|
@@ -1700,94 +2377,222 @@ function Ie({ value: e, className: t, onClick: n, ...r }) {
|
|
|
1700
2377
|
onClick: (t) => {
|
|
1701
2378
|
o(e), n?.(t);
|
|
1702
2379
|
},
|
|
1703
|
-
className:
|
|
2380
|
+
className: k(c === "pills" ? Pe : "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
2381
|
...r
|
|
1705
2382
|
});
|
|
1706
2383
|
}
|
|
1707
|
-
function
|
|
1708
|
-
let { value: r, idFor: i } =
|
|
1709
|
-
return r === e ? /* @__PURE__ */
|
|
2384
|
+
function Zt({ value: e, className: t, ...n }) {
|
|
2385
|
+
let { value: r, idFor: i } = Kt("TabPanel");
|
|
2386
|
+
return r === e ? /* @__PURE__ */ m("div", {
|
|
1710
2387
|
role: "tabpanel",
|
|
1711
2388
|
id: i("panel", e),
|
|
1712
2389
|
"aria-labelledby": i("tab", e),
|
|
1713
2390
|
tabIndex: 0,
|
|
1714
|
-
className:
|
|
2391
|
+
className: k("outline-hidden", t),
|
|
1715
2392
|
...n
|
|
1716
2393
|
}) : null;
|
|
1717
2394
|
}
|
|
1718
2395
|
//#endregion
|
|
2396
|
+
//#region packages/tree/index.tsx
|
|
2397
|
+
function Qt({ items: e, getKey: t, getChildren: n, defaultExpanded: r = !0, rowHeight: a = 36 }) {
|
|
2398
|
+
let [o, s] = d(() => /* @__PURE__ */ new Set()), [c, f] = d(null), [p, m] = d(null), h = u(null), g = i((e) => o.has(e) !== r, [o, r]), _ = l(() => {
|
|
2399
|
+
let r = [], i = (e, a, o) => {
|
|
2400
|
+
for (let s of e) {
|
|
2401
|
+
let e = t(s), c = n(s), l = !!c?.length, u = l && g(e);
|
|
2402
|
+
r.push({
|
|
2403
|
+
item: s,
|
|
2404
|
+
key: e,
|
|
2405
|
+
depth: a,
|
|
2406
|
+
parentKey: o,
|
|
2407
|
+
hasChildren: l,
|
|
2408
|
+
expanded: u
|
|
2409
|
+
}), u && i(c, a + 1, e);
|
|
2410
|
+
}
|
|
2411
|
+
};
|
|
2412
|
+
return i(e, 0, null), r;
|
|
2413
|
+
}, [
|
|
2414
|
+
e,
|
|
2415
|
+
t,
|
|
2416
|
+
n,
|
|
2417
|
+
g
|
|
2418
|
+
]), v = () => {
|
|
2419
|
+
let r = [], i = (e) => {
|
|
2420
|
+
for (let a of e) {
|
|
2421
|
+
let e = n(a);
|
|
2422
|
+
e?.length && (r.push(t(a)), i(e));
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
return i(e), r;
|
|
2426
|
+
}, y = i((e, t) => s((n) => {
|
|
2427
|
+
let i = new Set(n);
|
|
2428
|
+
return t === r ? i.delete(e) : i.add(e), i;
|
|
2429
|
+
}), [r]), b = () => typeof window < "u" && (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion")), x = (e) => {
|
|
2430
|
+
if (!g(e)) {
|
|
2431
|
+
let t = Date.now();
|
|
2432
|
+
f({
|
|
2433
|
+
key: e,
|
|
2434
|
+
at: t
|
|
2435
|
+
}), y(e, !0), setTimeout(() => f((e) => e?.at === t ? null : e), 320);
|
|
2436
|
+
} else if (b()) y(e, !1);
|
|
2437
|
+
else {
|
|
2438
|
+
m(e);
|
|
2439
|
+
let t = () => {
|
|
2440
|
+
y(e, !1), m((t) => t === e ? null : t), h.current = null;
|
|
2441
|
+
};
|
|
2442
|
+
h.current = t, setTimeout(t, 500);
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
return {
|
|
2446
|
+
rows: _,
|
|
2447
|
+
toggle: x,
|
|
2448
|
+
isExpanded: g,
|
|
2449
|
+
expand: (e) => y(e, !0),
|
|
2450
|
+
collapse: (e) => y(e, !1),
|
|
2451
|
+
expandAll: () => s(r ? /* @__PURE__ */ new Set() : new Set(v())),
|
|
2452
|
+
collapseAll: () => s(r ? new Set(v()) : /* @__PURE__ */ new Set()),
|
|
2453
|
+
rowProps: (e) => ({
|
|
2454
|
+
"aria-level": e.depth + 1,
|
|
2455
|
+
"aria-expanded": e.hasChildren ? e.expanded : void 0,
|
|
2456
|
+
"data-depth": e.depth,
|
|
2457
|
+
className: k(c && e.parentKey === c.key && "zen__tree-row-enter", p && e.parentKey === p && "zen__tree-row-exit"),
|
|
2458
|
+
style: { "--row-h": `${a - 1}px` },
|
|
2459
|
+
onAnimationEnd: (t) => {
|
|
2460
|
+
t.animationName === "zen-row-close" && p && e.parentKey === p && h.current?.();
|
|
2461
|
+
}
|
|
2462
|
+
}),
|
|
2463
|
+
toggleProps: (e) => ({
|
|
2464
|
+
expanded: e.expanded && p !== e.key,
|
|
2465
|
+
onToggle: () => x(e.key)
|
|
2466
|
+
}),
|
|
2467
|
+
rowHeight: a
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2470
|
+
function $t({ row: e, tree: t, className: n, style: r, ...i }) {
|
|
2471
|
+
let a = t.rowProps(e);
|
|
2472
|
+
return /* @__PURE__ */ m(Lt, {
|
|
2473
|
+
...i,
|
|
2474
|
+
...a,
|
|
2475
|
+
className: k(a.className, n),
|
|
2476
|
+
style: {
|
|
2477
|
+
...a.style,
|
|
2478
|
+
...r
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
function en({ numeric: e, className: t, children: n, ...r }) {
|
|
2483
|
+
return /* @__PURE__ */ m(zt, {
|
|
2484
|
+
numeric: e,
|
|
2485
|
+
className: k("py-0 whitespace-nowrap", t),
|
|
2486
|
+
...r,
|
|
2487
|
+
children: /* @__PURE__ */ m("div", {
|
|
2488
|
+
className: k("zen__tree-cell flex h-[var(--row-h)] items-center", e && "justify-end"),
|
|
2489
|
+
children: n
|
|
2490
|
+
})
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
function tn({ row: e, tree: t, indent: n = 20, children: r, className: i }) {
|
|
2494
|
+
return /* @__PURE__ */ h("div", {
|
|
2495
|
+
className: k("flex min-w-0 flex-1 items-center gap-1", i),
|
|
2496
|
+
style: { paddingLeft: e.depth * n },
|
|
2497
|
+
children: [e.hasChildren ? /* @__PURE__ */ m(nn, { ...t.toggleProps(e) }) : /* @__PURE__ */ m("span", { className: "-ml-1 w-6 shrink-0" }), r]
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
function nn({ expanded: e, onToggle: t, className: n, ...r }) {
|
|
2501
|
+
return /* @__PURE__ */ m("button", {
|
|
2502
|
+
type: "button",
|
|
2503
|
+
onClick: t,
|
|
2504
|
+
"aria-label": e ? "Collapse" : "Expand",
|
|
2505
|
+
"aria-expanded": e,
|
|
2506
|
+
className: k("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground focus-visible:ring-ring/50 -ml-1 grid size-6 shrink-0 place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2", n),
|
|
2507
|
+
...r,
|
|
2508
|
+
children: /* @__PURE__ */ m("svg", {
|
|
2509
|
+
viewBox: "0 0 16 16",
|
|
2510
|
+
fill: "none",
|
|
2511
|
+
stroke: "currentColor",
|
|
2512
|
+
strokeWidth: "2",
|
|
2513
|
+
strokeLinecap: "round",
|
|
2514
|
+
strokeLinejoin: "round",
|
|
2515
|
+
"aria-hidden": !0,
|
|
2516
|
+
className: k("size-4 transition-transform duration-200 ease-out", e && "rotate-90"),
|
|
2517
|
+
children: /* @__PURE__ */ m("path", { d: "m6 3.5 4.5 4.5L6 12.5" })
|
|
2518
|
+
})
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
//#endregion
|
|
1719
2522
|
//#region packages/textarea/index.tsx
|
|
1720
|
-
function
|
|
2523
|
+
function rn(e) {
|
|
1721
2524
|
let { className: t, ...n } = e;
|
|
1722
|
-
return /* @__PURE__ */
|
|
1723
|
-
className:
|
|
2525
|
+
return /* @__PURE__ */ m("textarea", {
|
|
2526
|
+
className: k(V.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
2527
|
...n
|
|
1725
2528
|
});
|
|
1726
2529
|
}
|
|
1727
2530
|
//#endregion
|
|
1728
2531
|
//#region packages/toast/index.tsx
|
|
1729
|
-
var
|
|
1730
|
-
function
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
2532
|
+
var an = 5e3, on = 300, sn = n(null);
|
|
2533
|
+
function cn({ children: e, offset: t, viewportClassName: n }) {
|
|
2534
|
+
M();
|
|
2535
|
+
let [r, a] = d([]), [s, c] = d(!1), l = u(0);
|
|
2536
|
+
o(() => c(!0), []);
|
|
2537
|
+
let f = i((e) => {
|
|
2538
|
+
a((t) => t.map((t) => t.id === e ? {
|
|
1735
2539
|
...t,
|
|
1736
2540
|
leaving: !0
|
|
1737
|
-
} : t)), setTimeout(() =>
|
|
1738
|
-
}, []),
|
|
1739
|
-
let o =
|
|
2541
|
+
} : t)), setTimeout(() => a((t) => t.filter((t) => t.id !== e)), on);
|
|
2542
|
+
}, []), p = i((e, { description: t, tone: n = "info", action: r, timeout: i } = {}) => {
|
|
2543
|
+
let o = l.current++, s = {
|
|
1740
2544
|
id: o,
|
|
1741
2545
|
title: e,
|
|
1742
2546
|
description: t,
|
|
1743
|
-
tone:
|
|
1744
|
-
action:
|
|
1745
|
-
timeout:
|
|
2547
|
+
tone: n,
|
|
2548
|
+
action: r,
|
|
2549
|
+
timeout: i ?? (r ? 1e4 : an)
|
|
1746
2550
|
};
|
|
1747
|
-
return
|
|
1748
|
-
}, []),
|
|
1749
|
-
return /* @__PURE__ */
|
|
1750
|
-
value:
|
|
1751
|
-
children: [e,
|
|
2551
|
+
return a((e) => [...e, s]), o;
|
|
2552
|
+
}, []), _ = r.slice(-3);
|
|
2553
|
+
return /* @__PURE__ */ h(sn.Provider, {
|
|
2554
|
+
value: p,
|
|
2555
|
+
children: [e, s && g(/* @__PURE__ */ m("section", {
|
|
1752
2556
|
"aria-label": "Notifications",
|
|
1753
|
-
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
|
-
|
|
2557
|
+
className: k("zen__toast-viewport fixed right-4 bottom-[calc(var(--zen-toast-offset,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]", n),
|
|
2558
|
+
style: t ? { "--zen-toast-offset": t } : void 0,
|
|
2559
|
+
children: _.map((e) => /* @__PURE__ */ m(dn, {
|
|
1755
2560
|
toast: e,
|
|
1756
|
-
onDismiss: () =>
|
|
2561
|
+
onDismiss: () => f(e.id)
|
|
1757
2562
|
}, e.id))
|
|
1758
2563
|
}), document.body)]
|
|
1759
2564
|
});
|
|
1760
2565
|
}
|
|
1761
|
-
function
|
|
1762
|
-
let e = a(
|
|
2566
|
+
function ln() {
|
|
2567
|
+
let e = a(sn);
|
|
1763
2568
|
if (!e) throw Error("useToast() needs a <ToastProvider> above it");
|
|
1764
2569
|
return e;
|
|
1765
2570
|
}
|
|
1766
|
-
var
|
|
2571
|
+
var un = {
|
|
1767
2572
|
success: {
|
|
1768
|
-
icon:
|
|
2573
|
+
icon: G,
|
|
1769
2574
|
ring: "border-primary/30",
|
|
1770
2575
|
badge: "bg-primary/15 text-primary",
|
|
1771
2576
|
bar: "bg-primary",
|
|
1772
2577
|
glow: "shadow-[0_18px_50px_-18px_oklch(var(--glow)/0.55)]"
|
|
1773
2578
|
},
|
|
1774
2579
|
error: {
|
|
1775
|
-
icon:
|
|
2580
|
+
icon: K,
|
|
1776
2581
|
ring: "border-destructive/40",
|
|
1777
2582
|
badge: "bg-destructive/15 text-destructive",
|
|
1778
2583
|
bar: "bg-destructive",
|
|
1779
2584
|
glow: "shadow-[0_18px_50px_-18px_oklch(var(--destructive)/0.55)]"
|
|
1780
2585
|
},
|
|
1781
2586
|
info: {
|
|
1782
|
-
icon:
|
|
2587
|
+
icon: q,
|
|
1783
2588
|
ring: "border-tint/10",
|
|
1784
2589
|
badge: "bg-tint/[0.08] text-foreground",
|
|
1785
2590
|
bar: "bg-muted-foreground",
|
|
1786
2591
|
glow: "shadow-[var(--toast-shadow)]"
|
|
1787
2592
|
}
|
|
1788
2593
|
};
|
|
1789
|
-
function
|
|
1790
|
-
let n =
|
|
2594
|
+
function dn({ toast: e, onDismiss: t }) {
|
|
2595
|
+
let n = un[e.tone] ?? un.info, r = n.icon, [i, a] = d(!1), s = u(e.timeout);
|
|
1791
2596
|
return o(() => {
|
|
1792
2597
|
if (!e.timeout || i || e.leaving) return;
|
|
1793
2598
|
let n = Date.now(), r = setTimeout(t, s.current);
|
|
@@ -1799,30 +2604,30 @@ function He({ toast: e, onDismiss: t }) {
|
|
|
1799
2604
|
e.timeout,
|
|
1800
2605
|
e.leaving,
|
|
1801
2606
|
t
|
|
1802
|
-
]), /* @__PURE__ */
|
|
2607
|
+
]), /* @__PURE__ */ h("div", {
|
|
1803
2608
|
role: e.tone === "error" ? "alert" : "status",
|
|
1804
2609
|
"aria-atomic": "true",
|
|
1805
2610
|
onMouseEnter: () => a(!0),
|
|
1806
2611
|
onMouseLeave: () => a(!1),
|
|
1807
|
-
className:
|
|
2612
|
+
className: k("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
2613
|
children: [
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
className:
|
|
2614
|
+
/* @__PURE__ */ m("span", {
|
|
2615
|
+
className: k("mt-0.5 grid size-8 shrink-0 place-items-center rounded-full", n.badge),
|
|
1811
2616
|
"aria-hidden": !0,
|
|
1812
|
-
children: /* @__PURE__ */
|
|
2617
|
+
children: /* @__PURE__ */ m(r, { className: "size-4" })
|
|
1813
2618
|
}),
|
|
1814
|
-
/* @__PURE__ */
|
|
2619
|
+
/* @__PURE__ */ h("div", {
|
|
1815
2620
|
className: "flex min-w-0 flex-1 flex-col gap-0.5 pt-0.5",
|
|
1816
2621
|
children: [
|
|
1817
|
-
/* @__PURE__ */
|
|
2622
|
+
/* @__PURE__ */ m("div", {
|
|
1818
2623
|
className: "text-sm font-semibold",
|
|
1819
2624
|
children: e.title
|
|
1820
2625
|
}),
|
|
1821
|
-
e.description && /* @__PURE__ */
|
|
2626
|
+
e.description && /* @__PURE__ */ m("div", {
|
|
1822
2627
|
className: "text-muted-foreground text-sm leading-5",
|
|
1823
2628
|
children: e.description
|
|
1824
2629
|
}),
|
|
1825
|
-
e.action && /* @__PURE__ */
|
|
2630
|
+
e.action && /* @__PURE__ */ m("button", {
|
|
1826
2631
|
type: "button",
|
|
1827
2632
|
onClick: () => {
|
|
1828
2633
|
e.action?.onClick(), t();
|
|
@@ -1832,12 +2637,12 @@ function He({ toast: e, onDismiss: t }) {
|
|
|
1832
2637
|
})
|
|
1833
2638
|
]
|
|
1834
2639
|
}),
|
|
1835
|
-
/* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ m("button", {
|
|
1836
2641
|
type: "button",
|
|
1837
2642
|
"aria-label": "Dismiss",
|
|
1838
2643
|
onClick: t,
|
|
1839
2644
|
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__ */
|
|
2645
|
+
children: /* @__PURE__ */ m("svg", {
|
|
1841
2646
|
viewBox: "0 0 16 16",
|
|
1842
2647
|
fill: "none",
|
|
1843
2648
|
stroke: "currentColor",
|
|
@@ -1845,77 +2650,277 @@ function He({ toast: e, onDismiss: t }) {
|
|
|
1845
2650
|
strokeLinecap: "round",
|
|
1846
2651
|
className: "size-3.5",
|
|
1847
2652
|
"aria-hidden": !0,
|
|
1848
|
-
children: /* @__PURE__ */
|
|
2653
|
+
children: /* @__PURE__ */ m("path", { d: "m4 4 8 8M12 4l-8 8" })
|
|
1849
2654
|
})
|
|
1850
2655
|
}),
|
|
1851
|
-
e.timeout > 0 && /* @__PURE__ */
|
|
2656
|
+
e.timeout > 0 && /* @__PURE__ */ m("span", {
|
|
1852
2657
|
"aria-hidden": !0,
|
|
1853
|
-
className:
|
|
2658
|
+
className: k("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
2659
|
style: { animationDuration: `${e.timeout}ms` }
|
|
1855
2660
|
})
|
|
1856
2661
|
]
|
|
1857
2662
|
});
|
|
1858
2663
|
}
|
|
1859
|
-
function Ue({ className: e }) {
|
|
1860
|
-
return /* @__PURE__ */ p("svg", {
|
|
1861
|
-
viewBox: "0 0 16 16",
|
|
1862
|
-
fill: "none",
|
|
1863
|
-
stroke: "currentColor",
|
|
1864
|
-
strokeWidth: "2",
|
|
1865
|
-
strokeLinecap: "round",
|
|
1866
|
-
strokeLinejoin: "round",
|
|
1867
|
-
className: _("size-3.5", e),
|
|
1868
|
-
"aria-hidden": !0,
|
|
1869
|
-
children: /* @__PURE__ */ p("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
1870
|
-
});
|
|
1871
|
-
}
|
|
1872
|
-
function We({ className: e }) {
|
|
1873
|
-
return /* @__PURE__ */ m("svg", {
|
|
1874
|
-
viewBox: "0 0 16 16",
|
|
1875
|
-
fill: "none",
|
|
1876
|
-
stroke: "currentColor",
|
|
1877
|
-
strokeWidth: "1.8",
|
|
1878
|
-
strokeLinecap: "round",
|
|
1879
|
-
strokeLinejoin: "round",
|
|
1880
|
-
className: _("size-3.5", e),
|
|
1881
|
-
"aria-hidden": !0,
|
|
1882
|
-
children: [/* @__PURE__ */ p("path", { d: "M8 2.2 1.6 13.3h12.8L8 2.2Z" }), /* @__PURE__ */ p("path", { d: "M8 6.5v3M8 11.6v.1" })]
|
|
1883
|
-
});
|
|
1884
|
-
}
|
|
1885
|
-
function Ge({ className: e }) {
|
|
1886
|
-
return /* @__PURE__ */ m("svg", {
|
|
1887
|
-
viewBox: "0 0 16 16",
|
|
1888
|
-
fill: "none",
|
|
1889
|
-
stroke: "currentColor",
|
|
1890
|
-
strokeWidth: "1.8",
|
|
1891
|
-
strokeLinecap: "round",
|
|
1892
|
-
className: _("size-3.5", e),
|
|
1893
|
-
"aria-hidden": !0,
|
|
1894
|
-
children: [/* @__PURE__ */ p("circle", {
|
|
1895
|
-
cx: "8",
|
|
1896
|
-
cy: "8",
|
|
1897
|
-
r: "6.3"
|
|
1898
|
-
}), /* @__PURE__ */ p("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
2664
|
//#endregion
|
|
1902
2665
|
//#region packages/toggle/index.tsx
|
|
1903
|
-
function
|
|
2666
|
+
function fn(e) {
|
|
1904
2667
|
let { className: t, onChange: n, disabled: r, ...i } = e;
|
|
1905
|
-
return /* @__PURE__ */
|
|
1906
|
-
className:
|
|
1907
|
-
children: [/* @__PURE__ */
|
|
2668
|
+
return /* @__PURE__ */ h("label", {
|
|
2669
|
+
className: k("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),
|
|
2670
|
+
children: [/* @__PURE__ */ m("input", {
|
|
1908
2671
|
type: "checkbox",
|
|
1909
2672
|
role: "switch",
|
|
1910
2673
|
className: "peer sr-only",
|
|
1911
2674
|
disabled: r,
|
|
1912
2675
|
onChange: (e) => n?.(e.target.checked),
|
|
1913
2676
|
...i
|
|
1914
|
-
}), /* @__PURE__ */
|
|
2677
|
+
}), /* @__PURE__ */ m("span", {
|
|
1915
2678
|
"aria-hidden": !0,
|
|
1916
|
-
className:
|
|
2679
|
+
className: k("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
2680
|
})]
|
|
1918
2681
|
});
|
|
1919
2682
|
}
|
|
1920
2683
|
//#endregion
|
|
1921
|
-
|
|
2684
|
+
//#region packages/theme-toggle/index.tsx
|
|
2685
|
+
var pn = (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){}`;
|
|
2686
|
+
function mn({ storageKey: e = "theme" }) {
|
|
2687
|
+
return /* @__PURE__ */ m("script", { dangerouslySetInnerHTML: { __html: pn(e) } });
|
|
2688
|
+
}
|
|
2689
|
+
function hn({ storageKey: e = "theme", className: t }) {
|
|
2690
|
+
let [n, r] = d("dark");
|
|
2691
|
+
o(() => r(document.documentElement.classList.contains("light") ? "light" : "dark"), []);
|
|
2692
|
+
let i = n === "dark" ? "light" : "dark";
|
|
2693
|
+
return /* @__PURE__ */ m("button", {
|
|
2694
|
+
type: "button",
|
|
2695
|
+
"aria-label": `Switch to ${i} theme`,
|
|
2696
|
+
onClick: () => {
|
|
2697
|
+
let t = document.documentElement;
|
|
2698
|
+
t.classList.remove("dark", "light"), t.classList.add(i);
|
|
2699
|
+
try {
|
|
2700
|
+
localStorage.setItem(e, i);
|
|
2701
|
+
} catch {}
|
|
2702
|
+
r(i);
|
|
2703
|
+
},
|
|
2704
|
+
className: k("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),
|
|
2705
|
+
children: /* @__PURE__ */ m("svg", {
|
|
2706
|
+
viewBox: "0 0 16 16",
|
|
2707
|
+
fill: "none",
|
|
2708
|
+
stroke: "currentColor",
|
|
2709
|
+
strokeWidth: "1.5",
|
|
2710
|
+
strokeLinecap: "round",
|
|
2711
|
+
className: "size-4",
|
|
2712
|
+
"aria-hidden": !0,
|
|
2713
|
+
children: n === "dark" ? /* @__PURE__ */ m("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__ */ h(p, { children: [/* @__PURE__ */ m("circle", {
|
|
2714
|
+
cx: "8",
|
|
2715
|
+
cy: "8",
|
|
2716
|
+
r: "3"
|
|
2717
|
+
}), /* @__PURE__ */ m("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" })] })
|
|
2718
|
+
})
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
//#endregion
|
|
2722
|
+
//#region packages/utils/theme.ts
|
|
2723
|
+
var gn = [
|
|
2724
|
+
"mono",
|
|
2725
|
+
"muted",
|
|
2726
|
+
"balanced",
|
|
2727
|
+
"vivid"
|
|
2728
|
+
], Q = [
|
|
2729
|
+
{
|
|
2730
|
+
id: "violet",
|
|
2731
|
+
label: "Violet",
|
|
2732
|
+
hue: 295,
|
|
2733
|
+
intensity: "balanced",
|
|
2734
|
+
tint: "tinted"
|
|
2735
|
+
},
|
|
2736
|
+
{
|
|
2737
|
+
id: "ocean",
|
|
2738
|
+
label: "Ocean",
|
|
2739
|
+
hue: 250,
|
|
2740
|
+
intensity: "balanced",
|
|
2741
|
+
tint: "tinted"
|
|
2742
|
+
},
|
|
2743
|
+
{
|
|
2744
|
+
id: "teal",
|
|
2745
|
+
label: "Teal",
|
|
2746
|
+
hue: 195,
|
|
2747
|
+
intensity: "balanced",
|
|
2748
|
+
tint: "tinted"
|
|
2749
|
+
},
|
|
2750
|
+
{
|
|
2751
|
+
id: "forest",
|
|
2752
|
+
label: "Forest",
|
|
2753
|
+
hue: 150,
|
|
2754
|
+
intensity: "muted",
|
|
2755
|
+
tint: "tinted"
|
|
2756
|
+
},
|
|
2757
|
+
{
|
|
2758
|
+
id: "amber",
|
|
2759
|
+
label: "Amber",
|
|
2760
|
+
hue: 75,
|
|
2761
|
+
intensity: "balanced",
|
|
2762
|
+
tint: "neutral"
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
id: "rose",
|
|
2766
|
+
label: "Rose",
|
|
2767
|
+
hue: 15,
|
|
2768
|
+
intensity: "muted",
|
|
2769
|
+
tint: "neutral"
|
|
2770
|
+
},
|
|
2771
|
+
{
|
|
2772
|
+
id: "graphite",
|
|
2773
|
+
label: "Graphite",
|
|
2774
|
+
hue: 270,
|
|
2775
|
+
intensity: "mono",
|
|
2776
|
+
tint: "neutral"
|
|
2777
|
+
}
|
|
2778
|
+
], _n = {
|
|
2779
|
+
preset: "violet",
|
|
2780
|
+
hue: 295,
|
|
2781
|
+
intensity: "balanced",
|
|
2782
|
+
tint: "tinted",
|
|
2783
|
+
contrast: "standard",
|
|
2784
|
+
glow: "soft",
|
|
2785
|
+
topography: "subtle"
|
|
2786
|
+
};
|
|
2787
|
+
function vn(e, t) {
|
|
2788
|
+
let n = Q.find((e) => e.id === t);
|
|
2789
|
+
return {
|
|
2790
|
+
...e,
|
|
2791
|
+
preset: n.id,
|
|
2792
|
+
hue: n.hue,
|
|
2793
|
+
intensity: n.intensity,
|
|
2794
|
+
tint: n.tint
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2797
|
+
function yn(e, t) {
|
|
2798
|
+
return {
|
|
2799
|
+
...e,
|
|
2800
|
+
...t,
|
|
2801
|
+
preset: "custom"
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
var bn = {
|
|
2805
|
+
mono: .012,
|
|
2806
|
+
muted: .07,
|
|
2807
|
+
balanced: .13,
|
|
2808
|
+
vivid: .19
|
|
2809
|
+
}, $ = (e, t, n) => `${xn(e, 3)} ${xn(t, 3)} ${xn((n % 360 + 360) % 360, 1)}`, xn = (e, t) => Math.round(e * 10 ** t) / 10 ** t;
|
|
2810
|
+
function Sn(e, t = "dark") {
|
|
2811
|
+
let n = e.hue, r = bn[e.intensity], i = e.contrast === "high", a = e.tint === "tinted" ? Math.min(.014, r * .12) : .003, o = e.intensity === "mono", s = (e, t = 1) => $(e, a * t, n), c = { "topo-strength": String({
|
|
2812
|
+
off: 0,
|
|
2813
|
+
subtle: .55,
|
|
2814
|
+
visible: 1
|
|
2815
|
+
}[e.topography]) };
|
|
2816
|
+
return t === "light" ? {
|
|
2817
|
+
background: s(i ? .995 : .985, .4),
|
|
2818
|
+
foreground: $(i ? .16 : .21, .02, n),
|
|
2819
|
+
card: $(1, 0, 0),
|
|
2820
|
+
"card-foreground": $(i ? .16 : .21, .02, n),
|
|
2821
|
+
popover: $(1, 0, 0),
|
|
2822
|
+
"popover-foreground": $(i ? .16 : .21, .02, n),
|
|
2823
|
+
secondary: s(.955, .6),
|
|
2824
|
+
"secondary-foreground": $(.21, .02, n),
|
|
2825
|
+
muted: s(.96, .5),
|
|
2826
|
+
"muted-foreground": s(i ? .42 : .5, 1.5),
|
|
2827
|
+
border: s(i ? .78 : .91, .8),
|
|
2828
|
+
input: s(i ? .78 : .91, .8),
|
|
2829
|
+
primary: $(o ? .3 : .48, o ? .02 : Math.min(.22, r * 1.5), n),
|
|
2830
|
+
"primary-foreground": $(.985, 0, 0),
|
|
2831
|
+
accent: $(.95, o ? .005 : r * .25, n),
|
|
2832
|
+
"accent-foreground": $(.42, o ? .02 : Math.min(.16, r * .9), n),
|
|
2833
|
+
ring: $(o ? .3 : .48, o ? .02 : Math.min(.22, r * 1.5), n),
|
|
2834
|
+
destructive: $(.55, .22, 25),
|
|
2835
|
+
"destructive-foreground": $(.985, 0, 0),
|
|
2836
|
+
glow: $(.62, o ? .02 : Math.min(.2, r * 1.4), n),
|
|
2837
|
+
"glow-2": $(.65, o ? .02 : r * 1.05, n + 30),
|
|
2838
|
+
tint: $(.21, .02, n),
|
|
2839
|
+
"glow-strength": String({
|
|
2840
|
+
off: 0,
|
|
2841
|
+
soft: .4,
|
|
2842
|
+
bright: .8
|
|
2843
|
+
}[e.glow]),
|
|
2844
|
+
...c
|
|
2845
|
+
} : {
|
|
2846
|
+
background: s(i ? .13 : .155),
|
|
2847
|
+
foreground: $(.97, .004, n),
|
|
2848
|
+
card: s(i ? .17 : .195),
|
|
2849
|
+
"card-foreground": $(.97, .004, n),
|
|
2850
|
+
popover: s(i ? .18 : .21),
|
|
2851
|
+
"popover-foreground": $(.97, .004, n),
|
|
2852
|
+
secondary: s(.25),
|
|
2853
|
+
"secondary-foreground": $(.97, .004, n),
|
|
2854
|
+
muted: s(.235),
|
|
2855
|
+
"muted-foreground": s(i ? .84 : .72, 1.5),
|
|
2856
|
+
border: s(i ? .4 : .28, 1.5),
|
|
2857
|
+
input: s(i ? .4 : .28, 1.5),
|
|
2858
|
+
primary: $(o ? .88 : .72, r, n),
|
|
2859
|
+
"primary-foreground": $(o ? .2 : .17, o ? .01 : .03, n),
|
|
2860
|
+
accent: $(.3, r * .35, n),
|
|
2861
|
+
"accent-foreground": $(.88, r * .5, n),
|
|
2862
|
+
ring: $(.72, r, n),
|
|
2863
|
+
destructive: $(.64, .2, 25),
|
|
2864
|
+
"destructive-foreground": $(.985, 0, 0),
|
|
2865
|
+
glow: $(.7, o ? .02 : r, n),
|
|
2866
|
+
"glow-2": $(.72, o ? .02 : r * .75, n + 30),
|
|
2867
|
+
tint: $(1, 0, 0),
|
|
2868
|
+
"glow-strength": String({
|
|
2869
|
+
off: 0,
|
|
2870
|
+
soft: .55,
|
|
2871
|
+
bright: 1
|
|
2872
|
+
}[e.glow]),
|
|
2873
|
+
...c
|
|
2874
|
+
};
|
|
2875
|
+
}
|
|
2876
|
+
function Cn(e, { appearance: t = "dark", target: n } = {}) {
|
|
2877
|
+
let r = n ?? document.documentElement;
|
|
2878
|
+
for (let [n, i] of Object.entries(Sn(e, t))) r.style.setProperty(`--${n}`, i);
|
|
2879
|
+
}
|
|
2880
|
+
function wn(e) {
|
|
2881
|
+
let t = e ?? document.documentElement;
|
|
2882
|
+
for (let e of Object.keys(Sn(_n))) t.style.removeProperty(`--${e}`);
|
|
2883
|
+
}
|
|
2884
|
+
function Tn(e) {
|
|
2885
|
+
let t = typeof e == "object" && e ? e : {}, n = (e, t, n) => t.includes(e) ? e : n, r = _n, i = Q.map((e) => e.id);
|
|
2886
|
+
return {
|
|
2887
|
+
preset: typeof t.preset == "string" && (t.preset === "custom" || i.includes(t.preset)) ? t.preset : r.preset,
|
|
2888
|
+
hue: typeof t.hue == "number" && Number.isFinite(t.hue) ? (Math.round(t.hue) % 360 + 360) % 360 : r.hue,
|
|
2889
|
+
intensity: n(t.intensity, gn, r.intensity),
|
|
2890
|
+
tint: n(t.tint, ["neutral", "tinted"], r.tint),
|
|
2891
|
+
contrast: n(t.contrast, ["standard", "high"], r.contrast),
|
|
2892
|
+
glow: n(t.glow, [
|
|
2893
|
+
"off",
|
|
2894
|
+
"soft",
|
|
2895
|
+
"bright"
|
|
2896
|
+
], r.glow),
|
|
2897
|
+
topography: n(t.topography, [
|
|
2898
|
+
"off",
|
|
2899
|
+
"subtle",
|
|
2900
|
+
"visible"
|
|
2901
|
+
], r.topography)
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
function En(e) {
|
|
2905
|
+
let [t, n, r] = e.split(" ").map(Number), i = n * Math.cos(r * Math.PI / 180), a = n * Math.sin(r * Math.PI / 180), o = (t + .3963377774 * i + .2158037573 * a) ** 3, s = (t - .1055613458 * i - .0638541728 * a) ** 3, c = (t - .0894841775 * i - 1.291485548 * a) ** 3, l = (e) => Math.min(1, Math.max(0, e));
|
|
2906
|
+
return [
|
|
2907
|
+
l(4.0767416621 * o - 3.3077115913 * s + .2309699292 * c),
|
|
2908
|
+
l(-1.2684380046 * o + 2.6097574011 * s - .3413193965 * c),
|
|
2909
|
+
l(-.0041960863 * o - .7034186147 * s + 1.707614701 * c)
|
|
2910
|
+
];
|
|
2911
|
+
}
|
|
2912
|
+
function Dn(e, t) {
|
|
2913
|
+
let n = (e) => {
|
|
2914
|
+
let [t, n, r] = En(e);
|
|
2915
|
+
return .2126 * t + .7152 * n + .0722 * r;
|
|
2916
|
+
}, [r, i] = [n(e), n(t)].sort((e, t) => t - e);
|
|
2917
|
+
return (r + .05) / (i + .05);
|
|
2918
|
+
}
|
|
2919
|
+
//#endregion
|
|
2920
|
+
//#region packages/utils/useHydrated.ts
|
|
2921
|
+
var On = () => () => {};
|
|
2922
|
+
function kn() {
|
|
2923
|
+
return f(On, () => !0, () => !1);
|
|
2924
|
+
}
|
|
2925
|
+
//#endregion
|
|
2926
|
+
export { de as ActionsMenu, K as AlertTriangle, ye as AnimatedMoney, ve as AnimatedNumber, be as Avatar, Se as Backdrop, z as Badge, B as Button, Oe as Card, G as Check, Ye as ChevronDown, Xe as ChevronLeft, Ze as ChevronRight, Qe as ChevronUp, je as CodeBlock, Ie as Collapse, Re as ConfirmDialog, _n as DEFAULT_THEME, Le as Dialog, Ke as Dropdown, ze as EditableCell, Be as Field, Ve as FormMessage, Je as Header, gn as INTENSITIES, R as ImageCropError, q as InfoCircle, $e as Input, We as InputGroup, Y as InputGroupAddon, J as InputGroupInput, et as Meter, dt as MoneyInput, L as MoneyParseError, ut as MonthPicker, vt as NavPill, gt as NavPillIndicator, ht as NavPills, Q as PRESETS, yt as PageHeader, W as Popover, bt as ProgressRing, He as Search, xt as Segmented, St as Select, Ct as SideNav, wt as SideNavGroup, Et as SideNavLink, Dt as Skeleton, Ot as Slider, Ee as Spinner, ke as Stat, Ae as StatRow, Xt as Tab, kt as TabBar, jt as TabBarItem, Yt as TabList, Zt as TabPanel, Nt as Table, Ft as TableBody, zt as TableCell, Mt as TableContainer, Ht as TableEmpty, It as TableFooter, Bt as TableFooterCell, Rt as TableHead, Pt as TableHeader, Wt as TableOfContents, Lt as TableRow, Vt as TableSpacerRow, qt as Tabs, rn as TextArea, mn as ThemeScript, hn as ThemeToggle, cn as ToastProvider, fn as Toggle, en as TreeCell, tn as TreeLabel, $t as TreeRow, nn as TreeToggle, Ue as XMark, it as addMonths, j as applyGraphicsMode, vn as applyPreset, Cn as applyTheme, De as buttonVariants, Dn as contrastRatio, xe as cropImageToSquare, fe as currencySymbol, st as currentMonth, yn as customize, we as cva, k as cx, le as detectGraphicsMode, I as formatAmount, F as formatMoney, ct as formatMonth, rt as fromMonthIndex, nt as isMonth, P as minorDigits, Z as monthIndex, lt as monthNames, at as monthRange, ot as monthsBetween, Tn as normalizeTheme, En as oklchToLinearRgb, pe as parseMoney, he as parseMoneyInput, wn as resetTheme, pn as themeScript, Sn as themeVars, N as useAnchoredPopup, kn as useHydrated, ft as useMoneyInput, Ut as useSort, ln as useToast, Qt as useTree, Ge as useVirtualList };
|