@rinzai/zen 0.6.1 → 0.7.1
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/LICENSE +27 -0
- package/README.md +3 -3
- package/dist/alert/index.d.ts +21 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/alert/index.js +49 -0
- package/dist/avatar/index.d.ts.map +1 -1
- package/dist/avatar/index.js +25 -22
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +43 -12
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +86 -85
- package/dist/chart/donut.d.ts +4 -1
- package/dist/chart/donut.d.ts.map +1 -1
- package/dist/chart/donut.js +76 -66
- package/dist/chart/index.d.ts +8 -2
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.js +192 -182
- package/dist/chart/palette.d.ts +14 -0
- package/dist/chart/palette.d.ts.map +1 -0
- package/dist/chart/palette.js +9 -0
- package/dist/chart/tooltip.d.ts +6 -2
- package/dist/chart/tooltip.d.ts.map +1 -1
- package/dist/chart/tooltip.js +6 -6
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +28 -44
- package/dist/chip/index.js +1 -1
- package/dist/code-block/index.js +1 -1
- package/dist/date-picker/index.d.ts.map +1 -1
- package/dist/date-picker/index.js +24 -38
- package/dist/disclosure/index.js +1 -1
- package/dist/editable-cell/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +33 -32
- package/dist/header/index.d.ts +9 -1
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +17 -9
- package/dist/icons/arrow-left.d.ts +3 -0
- package/dist/icons/arrow-left.d.ts.map +1 -0
- package/dist/icons/arrow-right.d.ts +3 -0
- package/dist/icons/arrow-right.d.ts.map +1 -0
- package/dist/icons/bars.d.ts +3 -0
- package/dist/icons/bars.d.ts.map +1 -0
- package/dist/icons/calendar.d.ts +3 -0
- package/dist/icons/calendar.d.ts.map +1 -0
- package/dist/icons/chart-bar.d.ts +3 -0
- package/dist/icons/chart-bar.d.ts.map +1 -0
- package/dist/icons/chevron-down.d.ts.map +1 -1
- package/dist/icons/chevron-down.js +4 -2
- package/dist/icons/chevron-left.d.ts.map +1 -1
- package/dist/icons/chevron-left.js +4 -2
- package/dist/icons/chevron-right.d.ts.map +1 -1
- package/dist/icons/chevron-right.js +4 -2
- package/dist/icons/chevron-up.d.ts.map +1 -1
- package/dist/icons/chevron-up.js +4 -2
- package/dist/icons/ellipsis.d.ts +0 -1
- package/dist/icons/ellipsis.d.ts.map +1 -1
- package/dist/icons/flag.d.ts +3 -0
- package/dist/icons/flag.d.ts.map +1 -0
- package/dist/icons/list-bullet.d.ts +3 -0
- package/dist/icons/list-bullet.d.ts.map +1 -0
- package/dist/icons/lock.d.ts +3 -0
- package/dist/icons/lock.d.ts.map +1 -0
- package/dist/icons/logout.d.ts +3 -0
- package/dist/icons/logout.d.ts.map +1 -0
- package/dist/icons/micro/calendar.d.ts +3 -0
- package/dist/icons/micro/calendar.d.ts.map +1 -0
- package/dist/icons/micro/calendar.js +21 -0
- package/dist/icons/micro/check.d.ts +3 -0
- package/dist/icons/micro/check.d.ts.map +1 -0
- package/dist/icons/micro/check.js +21 -0
- package/dist/icons/micro/chevron-down.d.ts +3 -0
- package/dist/icons/micro/chevron-down.d.ts.map +1 -0
- package/dist/icons/micro/chevron-down.js +21 -0
- package/dist/icons/micro/chevron-right.d.ts +3 -0
- package/dist/icons/micro/chevron-right.d.ts.map +1 -0
- package/dist/icons/micro/chevron-right.js +21 -0
- package/dist/icons/micro/exclamation-triangle.d.ts +3 -0
- package/dist/icons/micro/exclamation-triangle.d.ts.map +1 -0
- package/dist/icons/micro/exclamation-triangle.js +21 -0
- package/dist/icons/micro/information-circle.d.ts +3 -0
- package/dist/icons/micro/information-circle.d.ts.map +1 -0
- package/dist/icons/micro/information-circle.js +21 -0
- package/dist/icons/micro/minus.d.ts +3 -0
- package/dist/icons/micro/minus.d.ts.map +1 -0
- package/dist/icons/micro/minus.js +17 -0
- package/dist/icons/micro/moon.d.ts +3 -0
- package/dist/icons/micro/moon.d.ts.map +1 -0
- package/dist/icons/micro/moon.js +17 -0
- package/dist/icons/micro/sun.d.ts +3 -0
- package/dist/icons/micro/sun.d.ts.map +1 -0
- package/dist/icons/micro/sun.js +17 -0
- package/dist/icons/micro/x-mark.d.ts +3 -0
- package/dist/icons/micro/x-mark.d.ts.map +1 -0
- package/dist/icons/micro/x-mark.js +17 -0
- package/dist/icons/search.d.ts.map +1 -1
- package/dist/icons/search.js +4 -2
- package/dist/icons/settings.d.ts +3 -0
- package/dist/icons/settings.d.ts.map +1 -0
- package/dist/icons/squares.d.ts +3 -0
- package/dist/icons/squares.d.ts.map +1 -0
- package/dist/icons/table.d.ts +3 -0
- package/dist/icons/table.d.ts.map +1 -0
- package/dist/icons/x-mark.d.ts.map +1 -1
- package/dist/icons/x-mark.js +4 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/lib.js +57 -61
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +67 -60
- package/dist/month-picker/index.d.ts.map +1 -1
- package/dist/month-picker/index.js +55 -55
- package/dist/pills/index.d.ts +1 -1
- package/dist/pills/index.d.ts.map +1 -1
- package/dist/pills/index.js +6 -2
- package/dist/popover/index.js +12 -11
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +96 -102
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +1 -1
- package/dist/status-pill/index.d.ts +18 -0
- package/dist/status-pill/index.d.ts.map +1 -0
- package/dist/status-pill/index.js +25 -0
- package/dist/tab-bar/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +9 -5
- package/dist/theme-toggle/index.d.ts +26 -4
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +42 -35
- package/dist/theme.css +67 -1
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +119 -106
- package/dist/tree/index.d.ts +22 -3
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +76 -56
- package/dist/utils/date.d.ts +6 -4
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +18 -16
- package/dist/utils/field-chevron.d.ts.map +1 -1
- package/dist/utils/field-chevron.js +5 -14
- package/dist/utils/status-icons.d.ts +1 -1
- package/dist/utils/status-icons.d.ts.map +1 -1
- package/dist/utils/status-icons.js +11 -41
- package/dist/utils/styles.d.ts +9 -3
- package/dist/utils/styles.d.ts.map +1 -1
- package/dist/utils/styles.js +2 -2
- package/dist/utils/theme-wave.d.ts +26 -0
- package/dist/utils/theme-wave.d.ts.map +1 -0
- package/dist/utils/theme-wave.js +239 -0
- package/dist/utils/typeahead.d.ts +12 -0
- package/dist/utils/typeahead.d.ts.map +1 -0
- package/dist/utils/typeahead.js +19 -0
- package/dist/zen.css +1 -1
- package/package.json +2 -1
- package/dist/icons/ellipsis.js +0 -31
- package/dist/icons/index.d.ts +0 -9
- package/dist/icons/index.d.ts.map +0 -1
- package/dist/icons/status.d.ts +0 -2
- package/dist/icons/status.d.ts.map +0 -1
package/dist/select/index.js
CHANGED
|
@@ -1,150 +1,144 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Fragment as
|
|
3
|
+
import { useTypeahead as t } from "../utils/typeahead.js";
|
|
4
|
+
import { useAnchoredPopup as n } from "../utils/useAnchoredPopup.js";
|
|
5
|
+
import { POPUP as r, TRIGGER as i } from "../utils/styles.js";
|
|
6
|
+
import { CheckIcon as a } from "../utils/status-icons.js";
|
|
7
|
+
import { useFieldProps as o } from "../field/index.js";
|
|
8
|
+
import { FieldChevron as s } from "../utils/field-chevron.js";
|
|
9
|
+
import { Children as c, Fragment as l, createContext as u, isValidElement as d, useCallback as f, useContext as p, useEffect as m, useId as h, useLayoutEffect as g, useRef as _, useState as v } from "react";
|
|
10
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
10
11
|
//#region packages/select/index.tsx
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
...
|
|
15
|
-
id:
|
|
16
|
-
}), [
|
|
17
|
-
text: "",
|
|
18
|
-
at: 0
|
|
19
|
-
}), [F, I] = _(/* @__PURE__ */ new Map()), L = () => Array.from(O.current?.querySelectorAll("[role=\"option\"]") ?? []).map((e) => ({
|
|
12
|
+
var S = u(null);
|
|
13
|
+
function C({ value: a, onChange: c, placeholder: l = "Select…", disabled: u = !1, name: d, id: p, className: g, listClassName: C, children: T, style: E, onKeyDown: D, ...O }) {
|
|
14
|
+
let k = _(null), A = h(), j = p ?? A, M = o({
|
|
15
|
+
...O,
|
|
16
|
+
id: p
|
|
17
|
+
}), [N, P] = v(null), F = t(), [I, L] = v(/* @__PURE__ */ new Map()), R = () => Array.from(k.current?.querySelectorAll("[role=\"option\"]") ?? []).map((e) => ({
|
|
20
18
|
value: e.dataset.value,
|
|
21
19
|
label: e.dataset.label ?? "",
|
|
22
20
|
disabled: e.getAttribute("aria-disabled") === "true"
|
|
23
|
-
})),
|
|
21
|
+
})), z = n({
|
|
24
22
|
matchWidth: !0,
|
|
25
23
|
onOpenChange: (e) => {
|
|
26
24
|
if (!e) return;
|
|
27
|
-
let t =
|
|
28
|
-
|
|
25
|
+
let t = R();
|
|
26
|
+
P(t.find((e) => e.value === a)?.value ?? t.find((e) => !e.disabled)?.value ?? null);
|
|
29
27
|
}
|
|
30
28
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
},
|
|
29
|
+
m(() => {
|
|
30
|
+
z.open && k.current?.focus();
|
|
31
|
+
}, [z.open]);
|
|
32
|
+
let B = (e) => {
|
|
33
|
+
R().find((t) => t.value === e)?.disabled || (c(e), z.setOpen(!1));
|
|
34
|
+
}, V = f((e, t) => (L((n) => n.get(e) === t ? n : new Map(n).set(e, t)), () => L((t) => {
|
|
37
35
|
let n = new Map(t);
|
|
38
36
|
return n.delete(e), n;
|
|
39
|
-
})), []),
|
|
40
|
-
|
|
41
|
-
let
|
|
37
|
+
})), []), H = new Map(I);
|
|
38
|
+
w(T, H);
|
|
39
|
+
let U = a === null ? void 0 : H.get(a), W = (e, t, n = R()) => {
|
|
42
40
|
let r = e === null ? t === 1 ? -1 : n.length : n.findIndex((t) => t.value === e);
|
|
43
41
|
for (let e = 1; e <= n.length; e++) {
|
|
44
42
|
let i = (r + t * e + n.length * 2) % n.length;
|
|
45
43
|
if (!n[i].disabled) return n[i].value;
|
|
46
44
|
}
|
|
47
45
|
return e;
|
|
48
|
-
},
|
|
46
|
+
}, G = (e) => {
|
|
49
47
|
let t = {
|
|
50
|
-
ArrowDown: () =>
|
|
51
|
-
ArrowUp: () =>
|
|
52
|
-
Home: () =>
|
|
53
|
-
End: () =>
|
|
54
|
-
Enter: () =>
|
|
55
|
-
" ": () =>
|
|
56
|
-
Tab: () =>
|
|
48
|
+
ArrowDown: () => P((e) => W(e, 1)),
|
|
49
|
+
ArrowUp: () => P((e) => W(e, -1)),
|
|
50
|
+
Home: () => P(W(null, 1)),
|
|
51
|
+
End: () => P(W(null, -1)),
|
|
52
|
+
Enter: () => N !== null && B(N),
|
|
53
|
+
" ": () => N !== null && B(N),
|
|
54
|
+
Tab: () => z.setOpen(!1)
|
|
57
55
|
};
|
|
58
56
|
if (t[e.key]) {
|
|
59
57
|
e.key !== "Tab" && e.preventDefault(), t[e.key]();
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
at: t
|
|
67
|
-
};
|
|
68
|
-
let r = L().find((e) => !e.disabled && e.label.toLowerCase().startsWith(n));
|
|
69
|
-
r && N(r.value);
|
|
60
|
+
let n = F(e);
|
|
61
|
+
if (n) {
|
|
62
|
+
let e = R().find((e) => !e.disabled && e.label.toLowerCase().startsWith(n));
|
|
63
|
+
e && P(e.value);
|
|
70
64
|
}
|
|
71
|
-
},
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
65
|
+
}, K = (e) => `${z.id}-option-${e}`;
|
|
66
|
+
return /* @__PURE__ */ x(y, { children: [
|
|
67
|
+
/* @__PURE__ */ x("button", {
|
|
74
68
|
type: "button",
|
|
75
|
-
...
|
|
76
|
-
...
|
|
77
|
-
id:
|
|
78
|
-
disabled:
|
|
69
|
+
...O,
|
|
70
|
+
...M,
|
|
71
|
+
id: j,
|
|
72
|
+
disabled: u,
|
|
79
73
|
"aria-haspopup": "listbox",
|
|
80
|
-
...
|
|
74
|
+
...z.triggerProps,
|
|
81
75
|
style: {
|
|
82
|
-
...
|
|
83
|
-
...
|
|
76
|
+
...z.triggerProps.style,
|
|
77
|
+
...E
|
|
84
78
|
},
|
|
85
79
|
onKeyDown: (e) => {
|
|
86
|
-
|
|
80
|
+
D?.(e), ["ArrowDown", "ArrowUp"].includes(e.key) && !z.open && (e.preventDefault(), z.setOpen(!0));
|
|
87
81
|
},
|
|
88
|
-
className: e("zen__select group",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
90
|
-
className: e("truncate",
|
|
91
|
-
children:
|
|
92
|
-
}), /* @__PURE__ */
|
|
82
|
+
className: e("zen__select group", i, "w-full", z.open && "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", g),
|
|
83
|
+
children: [/* @__PURE__ */ b("span", {
|
|
84
|
+
className: e("truncate", U === void 0 && "text-muted-foreground"),
|
|
85
|
+
children: U ?? l
|
|
86
|
+
}), /* @__PURE__ */ b(s, { open: z.open })]
|
|
93
87
|
}),
|
|
94
|
-
|
|
88
|
+
d && /* @__PURE__ */ b("input", {
|
|
95
89
|
type: "hidden",
|
|
96
|
-
name:
|
|
97
|
-
value:
|
|
90
|
+
name: d,
|
|
91
|
+
value: a ?? ""
|
|
98
92
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
...
|
|
101
|
-
className: e("zen__popover",
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
-
ref:
|
|
93
|
+
/* @__PURE__ */ b("div", {
|
|
94
|
+
...z.popupProps,
|
|
95
|
+
className: e("zen__popover", r, "overflow-visible py-1", C),
|
|
96
|
+
children: /* @__PURE__ */ b("div", {
|
|
97
|
+
ref: k,
|
|
104
98
|
role: "listbox",
|
|
105
99
|
tabIndex: -1,
|
|
106
|
-
"aria-label":
|
|
107
|
-
"aria-labelledby":
|
|
108
|
-
"aria-activedescendant":
|
|
109
|
-
onKeyDown:
|
|
100
|
+
"aria-label": O["aria-label"],
|
|
101
|
+
"aria-labelledby": O["aria-label"] ? void 0 : j,
|
|
102
|
+
"aria-activedescendant": N === null ? void 0 : K(N),
|
|
103
|
+
onKeyDown: G,
|
|
110
104
|
className: "max-h-72 overflow-y-auto outline-hidden",
|
|
111
|
-
children: /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ b(S.Provider, {
|
|
112
106
|
value: {
|
|
113
|
-
value:
|
|
114
|
-
active:
|
|
115
|
-
setActive:
|
|
116
|
-
choose:
|
|
117
|
-
optionId:
|
|
118
|
-
register:
|
|
107
|
+
value: a,
|
|
108
|
+
active: N,
|
|
109
|
+
setActive: P,
|
|
110
|
+
choose: B,
|
|
111
|
+
optionId: K,
|
|
112
|
+
register: V
|
|
119
113
|
},
|
|
120
|
-
children:
|
|
114
|
+
children: T
|
|
121
115
|
})
|
|
122
116
|
})
|
|
123
117
|
})
|
|
124
118
|
] });
|
|
125
119
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
if (!
|
|
120
|
+
function w(e, t) {
|
|
121
|
+
c.forEach(e, (e) => {
|
|
122
|
+
if (!d(e)) return;
|
|
129
123
|
let n = e;
|
|
130
|
-
if (n.type ===
|
|
131
|
-
let e = n.props.label ??
|
|
124
|
+
if (n.type === E && n.props.value !== void 0) {
|
|
125
|
+
let e = n.props.label ?? T(n.props.children);
|
|
132
126
|
e && t.set(n.props.value, e);
|
|
133
|
-
} else (n.type ===
|
|
127
|
+
} else (n.type === D || n.type === l) && w(n.props.children, t);
|
|
134
128
|
});
|
|
135
129
|
}
|
|
136
|
-
var
|
|
137
|
-
function
|
|
138
|
-
let s =
|
|
130
|
+
var T = (e) => typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(T).join("") : "";
|
|
131
|
+
function E({ value: t, label: n, disabled: r, className: i, children: o }) {
|
|
132
|
+
let s = p(S);
|
|
139
133
|
if (!s) throw Error("SelectItem must be inside a Select");
|
|
140
|
-
let c =
|
|
141
|
-
|
|
134
|
+
let c = _(null), l = n ?? T(o), u = s.register;
|
|
135
|
+
g(() => u(t, l || c.current?.textContent?.trim() || ""), [
|
|
142
136
|
u,
|
|
143
137
|
t,
|
|
144
138
|
l
|
|
145
139
|
]);
|
|
146
140
|
let d = s.value === t;
|
|
147
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ x("div", {
|
|
148
142
|
ref: c,
|
|
149
143
|
id: s.optionId(t),
|
|
150
144
|
role: "option",
|
|
@@ -155,33 +149,33 @@ function T({ value: t, label: n, disabled: r, className: a, children: o }) {
|
|
|
155
149
|
"data-highlighted": s.active === t || void 0,
|
|
156
150
|
onMouseMove: () => !r && s.setActive(t),
|
|
157
151
|
onClick: () => s.choose(t),
|
|
158
|
-
className: e("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",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
152
|
+
className: e("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", i),
|
|
153
|
+
children: [/* @__PURE__ */ b("span", {
|
|
160
154
|
className: "text-primary col-start-1",
|
|
161
155
|
"aria-hidden": !0,
|
|
162
|
-
children: d && /* @__PURE__ */
|
|
163
|
-
}), /* @__PURE__ */
|
|
156
|
+
children: d && /* @__PURE__ */ b(a, {})
|
|
157
|
+
}), /* @__PURE__ */ b("span", {
|
|
164
158
|
className: "col-start-2 truncate",
|
|
165
159
|
children: o
|
|
166
160
|
})]
|
|
167
161
|
});
|
|
168
162
|
}
|
|
169
|
-
function
|
|
170
|
-
return /* @__PURE__ */
|
|
163
|
+
function D({ label: e, children: t }) {
|
|
164
|
+
return /* @__PURE__ */ x("div", {
|
|
171
165
|
role: "group",
|
|
172
166
|
"aria-label": typeof e == "string" ? e : void 0,
|
|
173
|
-
children: [/* @__PURE__ */
|
|
167
|
+
children: [/* @__PURE__ */ b("div", {
|
|
174
168
|
"aria-hidden": !0,
|
|
175
169
|
className: "text-muted-foreground px-3 pt-2 pb-1 text-xs font-medium",
|
|
176
170
|
children: e
|
|
177
171
|
}), t]
|
|
178
172
|
});
|
|
179
173
|
}
|
|
180
|
-
function
|
|
181
|
-
return /* @__PURE__ */
|
|
174
|
+
function O() {
|
|
175
|
+
return /* @__PURE__ */ b("div", {
|
|
182
176
|
role: "separator",
|
|
183
177
|
className: "bg-tint/[0.07] mx-2 my-1 h-px"
|
|
184
178
|
});
|
|
185
179
|
}
|
|
186
180
|
//#endregion
|
|
187
|
-
export {
|
|
181
|
+
export { D as SelectGroup, E as SelectItem, O as SelectSeparator, C as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/slider/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoC,MAAM,OAAO,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,KAAK,EACL,GAAO,EACP,GAAS,EACT,IAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACV,EAAE,WAAW,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/slider/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoC,MAAM,OAAO,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,KAAK,EACL,GAAO,EACP,GAAS,EACT,IAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACV,EAAE,WAAW,+BAkDb;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI,CACrC,cAAc,CAAC,OAAO,CAAC,EACvB,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,cAAc,CAC1E;IACG,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iDAAiD;IACjD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC"}
|
package/dist/slider/index.js
CHANGED
|
@@ -26,7 +26,7 @@ function i({ value: i, min: a = 0, max: o = 100, step: s = 1, onValueChange: c,
|
|
|
26
26
|
"--zen-track": y,
|
|
27
27
|
"--zen-thumb": d ?? "oklch(var(--primary))"
|
|
28
28
|
},
|
|
29
|
-
className: e("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", p),
|
|
29
|
+
className: e("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", "focus-visible:[&::-moz-range-thumb]:ring-ring/40 focus-visible:[&::-moz-range-thumb]:ring-4", p),
|
|
30
30
|
...h
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A small rounded status that changes in place, e.g. an app's "Saving…",
|
|
4
|
+
* "Saved", "Not saved · Retry": an icon (a Spinner, a Check) and a few words.
|
|
5
|
+
* `quiet` fades it back once the news is old (a save a few seconds ago).
|
|
6
|
+
* Changes are read out politely (role="status"). For an action inside it,
|
|
7
|
+
* such as Retry, use StatusPillAction. For a fixed label or count, use Badge.
|
|
8
|
+
*/
|
|
9
|
+
export default function StatusPill({ tone, quiet, className, ...rest }: StatusPillProps): import('react').JSX.Element;
|
|
10
|
+
/** A text button inside a StatusPill, e.g. Retry, in the pill's colour. */
|
|
11
|
+
export declare function StatusPillAction({ className, type, ...rest }: ComponentProps<'button'>): import('react').JSX.Element;
|
|
12
|
+
export interface StatusPillProps extends ComponentProps<'span'> {
|
|
13
|
+
/** `positive` in the accent colour (done), `negative` in red (failed); `default` is muted (in progress). */
|
|
14
|
+
tone?: 'default' | 'positive' | 'negative';
|
|
15
|
+
/** Faded back into the page: the news is old. */
|
|
16
|
+
quiet?: boolean;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/status-pill/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAQvC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,IAAgB,EAAE,KAAa,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,eAAe,+BAa1G;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,IAAe,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,+BAWjG;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAC3D,4GAA4G;IAC5G,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC3C,iDAAiD;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region packages/status-pill/index.tsx
|
|
5
|
+
var n = {
|
|
6
|
+
default: "border-tint/10 bg-tint/[0.05] text-muted-foreground",
|
|
7
|
+
positive: "border-primary/35 bg-primary/12 text-primary",
|
|
8
|
+
negative: "border-destructive/40 bg-destructive/15 text-destructive"
|
|
9
|
+
};
|
|
10
|
+
function r({ tone: r = "default", quiet: i = !1, className: a, ...o }) {
|
|
11
|
+
return /* @__PURE__ */ t("span", {
|
|
12
|
+
role: "status",
|
|
13
|
+
...o,
|
|
14
|
+
className: e("zen__status-pill inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium whitespace-nowrap [&_svg]:size-3.5 [&_svg]:shrink-0", "transition-[color,background-color,border-color,opacity] duration-300", i ? "text-muted-foreground border-transparent bg-transparent opacity-80" : n[r], a)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function i({ className: n, type: r = "button", ...i }) {
|
|
18
|
+
return /* @__PURE__ */ t("button", {
|
|
19
|
+
type: r,
|
|
20
|
+
...i,
|
|
21
|
+
className: e("ml-0.5 cursor-pointer rounded-full underline underline-offset-2 outline-hidden focus-visible:ring-2 focus-visible:ring-current/50", n)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { i as StatusPillAction, r as default };
|
package/dist/tab-bar/index.js
CHANGED
|
@@ -15,7 +15,7 @@ function a({ hideFrom: t = "md", className: i, children: a, ...o }) {
|
|
|
15
15
|
})
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
var o = e("flex flex-col items-center gap-1 py-2.5 text-[0.7rem] outline-hidden transition-colors duration-200 focus-visible:
|
|
18
|
+
var o = e("flex flex-col items-center gap-1 py-2.5 text-[0.7rem] outline-hidden transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset", "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)]");
|
|
19
19
|
function s({ icon: n, active: a, asChild: s, className: c, children: l, ...u }) {
|
|
20
20
|
let d = {
|
|
21
21
|
...u,
|
package/dist/table/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function g({ numeric: r, sticky: i, sortDirection: a, onSort: o, scope: s = "col
|
|
|
71
71
|
children: o ? /* @__PURE__ */ l("button", {
|
|
72
72
|
type: "button",
|
|
73
73
|
onClick: o,
|
|
74
|
-
className: e("hover:text-foreground inline-flex items-center gap-1 align-middle leading-5 tracking-wider uppercase", r && "flex-row-reverse"),
|
|
74
|
+
className: e("hover:text-foreground inline-flex cursor-pointer items-center gap-1 align-middle leading-5 tracking-wider uppercase", r && "flex-row-reverse"),
|
|
75
75
|
children: [d, /* @__PURE__ */ c("span", {
|
|
76
76
|
"aria-hidden": !0,
|
|
77
77
|
className: "inline-flex w-3",
|
package/dist/tabs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tabs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAqE,MAAM,OAAO,CAAC;AAgB1G,6GAA6G;AAC7G,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,YAAiB,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,+BAetG;AAID;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,OAAqB,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,+BAiC5F;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/tabs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAqE,MAAM,OAAO,CAAC;AAgB1G,6GAA6G;AAC7G,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,YAAiB,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,+BAetG;AAID;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,OAAqB,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,+BAiC5F;AAiCD,wBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,+BA0BnE;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,sCAgBpE;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,KAAK,CAAC;IACvD,OAAO,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACrE,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,KAAK,CAAC;IACxD,KAAK,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/tabs/index.js
CHANGED
|
@@ -72,14 +72,18 @@ function _({ ref: t, className: r, children: i, ...a }) {
|
|
|
72
72
|
},
|
|
73
73
|
className: e("border-border relative flex gap-1 border-b", r),
|
|
74
74
|
...a,
|
|
75
|
-
children: [i, s
|
|
75
|
+
children: [i, s ? /* @__PURE__ */ u("span", {
|
|
76
76
|
"aria-hidden": !0,
|
|
77
|
-
className: "bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
|
|
77
|
+
className: "zen__tab-bar bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
|
|
78
78
|
style: {
|
|
79
79
|
width: s.w,
|
|
80
80
|
translate: `${s.x}px 0`
|
|
81
81
|
}
|
|
82
|
-
})
|
|
82
|
+
}, "measured") : /* @__PURE__ */ u("span", {
|
|
83
|
+
"aria-hidden": !0,
|
|
84
|
+
"data-pending": !0,
|
|
85
|
+
className: "zen__tab-bar hidden"
|
|
86
|
+
}, "pending")]
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
89
|
function v({ value: n, className: r, onClick: i, ...a }) {
|
|
@@ -95,7 +99,7 @@ function v({ value: n, className: r, onClick: i, ...a }) {
|
|
|
95
99
|
onClick: (e) => {
|
|
96
100
|
c(n), i?.(e);
|
|
97
101
|
},
|
|
98
|
-
className: e(d === "pills" ? t : "focus-visible:ring-ring text-muted-foreground hover:text-foreground data-active:text-foreground px-3 py-2 text-sm whitespace-nowrap outline-hidden select-none focus-visible:ring-1", r),
|
|
102
|
+
className: e(d === "pills" ? t : "focus-visible:ring-ring text-muted-foreground hover:text-foreground data-active:text-foreground cursor-pointer px-3 py-2 text-sm whitespace-nowrap outline-hidden select-none focus-visible:ring-1 disabled:cursor-not-allowed", r),
|
|
99
103
|
...a
|
|
100
104
|
});
|
|
101
105
|
}
|
|
@@ -106,7 +110,7 @@ function y({ value: t, className: n, ...r }) {
|
|
|
106
110
|
id: a("panel", t),
|
|
107
111
|
"aria-labelledby": a("tab", t),
|
|
108
112
|
tabIndex: 0,
|
|
109
|
-
className: e("outline-hidden", n),
|
|
113
|
+
className: e("focus-visible:outline-ring/50 outline-hidden focus-visible:outline-2 focus-visible:outline-offset-4", n),
|
|
110
114
|
...r
|
|
111
115
|
}) : null;
|
|
112
116
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Appearance } from '../utils/theme';
|
|
2
|
+
import { RefObject } from 'react';
|
|
1
3
|
/** The inline script ThemeScript renders (for frameworks that take a raw string). */
|
|
2
4
|
export declare const themeScript: (storageKey?: string) => string;
|
|
3
5
|
/**
|
|
@@ -8,12 +10,32 @@ export declare function ThemeScript({ storageKey }: {
|
|
|
8
10
|
storageKey?: string;
|
|
9
11
|
}): import('react').JSX.Element;
|
|
10
12
|
/**
|
|
11
|
-
* Switches
|
|
12
|
-
*
|
|
13
|
+
* Switches between the dark and light themes; the new theme spreads from the
|
|
14
|
+
* button like a drop of water (themeWave).
|
|
15
|
+
*
|
|
16
|
+
* On its own, it switches <html>'s class and remembers the choice (localStorage):
|
|
17
|
+
* add ThemeScript to <head> to apply it on the next visit. Give it `value` and
|
|
18
|
+
* `onChange` and the theme is yours: it shows `value` and leaves applying and
|
|
19
|
+
* storing the choice to `onChange` (in your state, a database, a cookie…).
|
|
20
|
+
* With `target` too, it switches the theme of one element (a panel, a preview),
|
|
21
|
+
* and the water stays inside it.
|
|
13
22
|
*/
|
|
14
|
-
export default function ThemeToggle({ storageKey, className }: ThemeToggleProps): import('react').JSX.Element;
|
|
23
|
+
export default function ThemeToggle({ value, onChange, target, storageKey, className }: ThemeToggleProps): import('react').JSX.Element;
|
|
15
24
|
export interface ThemeToggleProps {
|
|
16
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The theme, when you keep it: the toggle shows it, and `onChange` must apply
|
|
27
|
+
* the new one (by the end of a synchronous render and its effects). Without it,
|
|
28
|
+
* the toggle switches <html>'s class itself.
|
|
29
|
+
*/
|
|
30
|
+
value?: Appearance;
|
|
31
|
+
/** Called with the theme switched to. */
|
|
32
|
+
onChange?: (theme: Appearance) => void;
|
|
33
|
+
/**
|
|
34
|
+
* The element whose theme `onChange` switches, when it's not the page (a panel
|
|
35
|
+
* with its own .dark or .light): the wave plays inside it. Needs `value`.
|
|
36
|
+
*/
|
|
37
|
+
target?: RefObject<HTMLElement | null>;
|
|
38
|
+
/** localStorage key for the choice, when the toggle keeps it. Use the same one in ThemeScript. */
|
|
17
39
|
storageKey?: string;
|
|
18
40
|
className?: string;
|
|
19
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/theme-toggle/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/theme-toggle/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAG7D,qFAAqF;AACrF,eAAO,MAAM,WAAW,GAAI,mBAAoB,WAC4I,CAAC;AAE7L;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,UAAoB,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE5E;AAiBD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAoB,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BA4CjH;AAED,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACvC,kGAAkG;IAClG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1,43 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import t from "../icons/micro/moon.js";
|
|
4
|
+
import n from "../icons/micro/sun.js";
|
|
5
|
+
import { prepareThemeWave as r, themeWave as i } from "../utils/theme-wave.js";
|
|
6
|
+
import { useSyncExternalStore as a } from "react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
import { flushSync as s } from "react-dom";
|
|
5
9
|
//#region packages/theme-toggle/index.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
return /* @__PURE__ */
|
|
10
|
+
var c = (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){}`;
|
|
11
|
+
function l({ storageKey: e = "theme" }) {
|
|
12
|
+
return /* @__PURE__ */ o("script", { dangerouslySetInnerHTML: { __html: c(e) } });
|
|
9
13
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
return
|
|
14
|
+
var u = /* @__PURE__ */ new Set();
|
|
15
|
+
function d(e) {
|
|
16
|
+
u.add(e);
|
|
17
|
+
let t = new MutationObserver(e);
|
|
18
|
+
return t.observe(document.documentElement, {
|
|
19
|
+
attributes: !0,
|
|
20
|
+
attributeFilter: ["class"]
|
|
21
|
+
}), () => {
|
|
22
|
+
u.delete(e), t.disconnect();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
var f = () => document.documentElement.classList.contains("light") ? "light" : "dark";
|
|
26
|
+
function p({ value: c, onChange: l, target: p, storageKey: m = "theme", className: h }) {
|
|
27
|
+
let g = a(d, f, () => "dark"), _ = c ?? g, v = _ === "dark" ? "light" : "dark";
|
|
28
|
+
return /* @__PURE__ */ o("button", {
|
|
15
29
|
type: "button",
|
|
16
|
-
"aria-label": `Switch to ${
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"aria-hidden": !0,
|
|
34
|
-
children: c === "dark" ? /* @__PURE__ */ i("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__ */ a(r, { children: [/* @__PURE__ */ i("circle", {
|
|
35
|
-
cx: "8",
|
|
36
|
-
cy: "8",
|
|
37
|
-
r: "3"
|
|
38
|
-
}), /* @__PURE__ */ i("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" })] })
|
|
39
|
-
})
|
|
30
|
+
"aria-label": `Switch to ${v} theme`,
|
|
31
|
+
onPointerEnter: r,
|
|
32
|
+
onFocus: r,
|
|
33
|
+
onClick: (e) => i(() => {
|
|
34
|
+
if (c === void 0) {
|
|
35
|
+
let e = document.documentElement;
|
|
36
|
+
e.classList.remove("dark", "light"), e.classList.add(v);
|
|
37
|
+
try {
|
|
38
|
+
localStorage.setItem(m, v);
|
|
39
|
+
} catch {}
|
|
40
|
+
}
|
|
41
|
+
s(() => {
|
|
42
|
+
l?.(v), u.forEach((e) => e());
|
|
43
|
+
});
|
|
44
|
+
}, e.currentTarget, p?.current),
|
|
45
|
+
className: e("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground focus-visible:ring-ring/50 grid size-9 cursor-pointer place-items-center rounded-lg outline-hidden focus-visible:ring-2", h),
|
|
46
|
+
children: o(_ === "dark" ? t : n, { className: "size-4" })
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
49
|
//#endregion
|
|
43
|
-
export {
|
|
50
|
+
export { l as ThemeScript, p as default, c as themeScript };
|