@minimalstuff/ui 2.0.0 → 2.1.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/dist/index.d.ts +30 -2
- package/dist/minimalstuff-ui.css +1 -1
- package/dist/minimalstuff-ui.js +403 -258
- package/package.json +1 -1
package/dist/minimalstuff-ui.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import r, { createElement as i, useCallback as a, useEffect as o, useId as s,
|
|
3
|
-
import { createPortal as
|
|
2
|
+
import r, { createElement as i, useCallback as a, useEffect as o, useId as s, useMemo as c, useRef as l, useState as u, useSyncExternalStore as d } from "react";
|
|
3
|
+
import { createPortal as f } from "react-dom";
|
|
4
4
|
//#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
5
|
-
function
|
|
5
|
+
function p(e) {
|
|
6
6
|
var t, n, r = "";
|
|
7
7
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
8
8
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
9
9
|
var i = e.length;
|
|
10
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
10
|
+
for (t = 0; t < i; t++) e[t] && (n = p(e[t])) && (r && (r += " "), r += n);
|
|
11
11
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
12
12
|
return r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
14
|
+
function m() {
|
|
15
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = p(e)) && (r && (r += " "), r += t);
|
|
16
16
|
return r;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/components/shared/radius.ts
|
|
20
|
-
var
|
|
20
|
+
var h = {
|
|
21
21
|
none: "rounded-none",
|
|
22
22
|
sm: "rounded-sm",
|
|
23
23
|
md: "rounded-md",
|
|
24
24
|
lg: "rounded-lg",
|
|
25
25
|
xl: "rounded-xl",
|
|
26
26
|
full: "rounded-full"
|
|
27
|
-
},
|
|
27
|
+
}, g = {
|
|
28
28
|
primary: {
|
|
29
29
|
solid: "border-transparent bg-blue-600 text-white enabled:hover:bg-blue-700 enabled:active:bg-blue-800 dark:bg-blue-500 dark:enabled:hover:bg-blue-600 dark:enabled:active:bg-blue-700",
|
|
30
30
|
outline: "border-blue-300 bg-transparent text-blue-700 enabled:hover:bg-blue-50 enabled:active:bg-blue-100 dark:border-blue-800 dark:text-blue-400 dark:enabled:hover:bg-blue-950/40 dark:enabled:active:bg-blue-950/60",
|
|
@@ -53,69 +53,69 @@ var m = {
|
|
|
53
53
|
subtle: "border-transparent bg-green-50 text-green-700 enabled:hover:bg-green-100 enabled:active:bg-green-200 dark:bg-green-500/10 dark:text-green-400 dark:enabled:hover:bg-green-500/20 dark:enabled:active:bg-green-500/30",
|
|
54
54
|
focusOutline: "focus-visible:outline-green-500"
|
|
55
55
|
}
|
|
56
|
-
},
|
|
56
|
+
}, _ = "cursor-pointer inline-flex items-center justify-center transition-[color,background-color,border-color,transform] duration-200 enabled:active:duration-75 enabled:active:scale-[0.95] outline-hidden focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed", v = {
|
|
57
57
|
xs: "px-2 py-1 text-xs",
|
|
58
58
|
sm: "px-3 py-1.5 text-sm",
|
|
59
59
|
md: "px-4 py-2 text-sm",
|
|
60
60
|
lg: "px-4 py-3 text-base"
|
|
61
|
-
},
|
|
61
|
+
}, y = {
|
|
62
62
|
xs: "w-3.5 h-3.5",
|
|
63
63
|
sm: "w-4 h-4",
|
|
64
64
|
md: "w-4 h-4",
|
|
65
65
|
lg: "w-5 h-5"
|
|
66
|
-
},
|
|
67
|
-
let b =
|
|
66
|
+
}, b = ({ variant: e = "solid", color: r = "primary", size: i = "md", radius: a = "md", children: o, className: s, fullWidth: c = !1, loading: l = !1, startIcon: u, endIcon: d, disabled: f, ...p }) => {
|
|
67
|
+
let b = g[r], x = y[i];
|
|
68
68
|
return /* @__PURE__ */ n("button", {
|
|
69
69
|
type: "button",
|
|
70
|
-
className:
|
|
70
|
+
className: m(_, "gap-2 font-medium", e !== "unstyled" && [
|
|
71
71
|
"border",
|
|
72
|
-
|
|
72
|
+
h[a],
|
|
73
73
|
b[e],
|
|
74
74
|
b.focusOutline
|
|
75
|
-
],
|
|
75
|
+
], v[i], c && "w-full", s),
|
|
76
76
|
disabled: f ?? l,
|
|
77
77
|
"aria-busy": l || void 0,
|
|
78
|
-
...
|
|
78
|
+
...p,
|
|
79
79
|
children: [
|
|
80
80
|
l && /* @__PURE__ */ t("span", {
|
|
81
|
-
className:
|
|
81
|
+
className: m("i-svg-spinners-3-dots-fade", x),
|
|
82
82
|
"aria-hidden": "true"
|
|
83
83
|
}),
|
|
84
84
|
!l && u && /* @__PURE__ */ t("span", {
|
|
85
|
-
className:
|
|
85
|
+
className: m(u, x),
|
|
86
86
|
"aria-hidden": "true"
|
|
87
87
|
}),
|
|
88
88
|
o,
|
|
89
89
|
!l && d && /* @__PURE__ */ t("span", {
|
|
90
|
-
className:
|
|
90
|
+
className: m(d, x),
|
|
91
91
|
"aria-hidden": "true"
|
|
92
92
|
})
|
|
93
93
|
]
|
|
94
94
|
});
|
|
95
|
-
},
|
|
96
|
-
function
|
|
95
|
+
}, x = "text-xs text-gray-500 dark:text-gray-400 mt-1 text-right";
|
|
96
|
+
function S(e) {
|
|
97
97
|
return e === "overLimit" ? "text-red-600 dark:text-red-400" : e === "atLimit" ? "text-amber-600 dark:text-amber-400" : "";
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function C({ current: e, min: r, max: i, showMin: a, showMax: o }) {
|
|
100
100
|
let s = a === !0 || o === !0, c = r !== void 0 && e <= r ? "atLimit" : "ok", l = i !== void 0 && e > i ? "overLimit" : i !== void 0 && e >= i ? "atLimit" : "ok", u = s ? `${e}/${r} min` : `${e} (min ${r})`, d = s ? `${e}/${i} max` : `${e}/${i}`;
|
|
101
101
|
return /* @__PURE__ */ n("div", {
|
|
102
|
-
className:
|
|
102
|
+
className: x,
|
|
103
103
|
children: [
|
|
104
104
|
a && r !== void 0 && /* @__PURE__ */ t("span", {
|
|
105
|
-
className:
|
|
105
|
+
className: S(c),
|
|
106
106
|
children: u
|
|
107
107
|
}),
|
|
108
108
|
a && o && " · ",
|
|
109
109
|
o && i !== void 0 && /* @__PURE__ */ t("span", {
|
|
110
|
-
className:
|
|
110
|
+
className: S(l),
|
|
111
111
|
children: d
|
|
112
112
|
}),
|
|
113
113
|
!a && !o && i !== void 0 && /* @__PURE__ */ t("span", {
|
|
114
|
-
className:
|
|
114
|
+
className: S(l),
|
|
115
115
|
children: d
|
|
116
116
|
}),
|
|
117
117
|
!a && !o && r !== void 0 && i === void 0 && /* @__PURE__ */ t("span", {
|
|
118
|
-
className:
|
|
118
|
+
className: S(c),
|
|
119
119
|
children: u
|
|
120
120
|
})
|
|
121
121
|
]
|
|
@@ -123,35 +123,35 @@ function S({ current: e, min: r, max: i, showMin: a, showMax: o }) {
|
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/components/shared/surface_tokens.ts
|
|
126
|
-
var
|
|
126
|
+
var w = "border-gray-300 dark:border-gray-600", T = "bg-white dark:bg-gray-800", E = "border-gray-200 dark:border-gray-700", D = "bg-white dark:bg-gray-900", O = "bg-blue-600 dark:bg-blue-500", k = "text-sm font-medium text-gray-700 dark:text-gray-300", A = "border-red-500 dark:border-red-400";
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/components/checkbox/checkbox.tsx
|
|
129
|
-
function
|
|
130
|
-
let v = `${g}-${s()}`, [y, b] =
|
|
129
|
+
function j({ label: e, description: r, error: i, radius: a = "sm", unstyled: o = !1, className: c, wrapperClassName: l, checked: d, defaultChecked: f = !1, onChange: p, id: g = "checkbox", ..._ }) {
|
|
130
|
+
let v = `${g}-${s()}`, [y, b] = u(f), x = d !== void 0, S = x ? d : y, C = [r && `${v}-description`, i && `${v}-error`].filter(Boolean).join(" ") || void 0;
|
|
131
131
|
return /* @__PURE__ */ n("div", {
|
|
132
|
-
className:
|
|
132
|
+
className: m("w-full", l),
|
|
133
133
|
children: [
|
|
134
134
|
/* @__PURE__ */ n("label", {
|
|
135
135
|
htmlFor: v,
|
|
136
|
-
className:
|
|
136
|
+
className: m("flex items-start gap-3 cursor-pointer", _.disabled && "cursor-not-allowed opacity-50"),
|
|
137
137
|
children: [/* @__PURE__ */ n("span", {
|
|
138
|
-
className:
|
|
138
|
+
className: m("relative shrink-0 rounded", "focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-offset-white dark:focus-within:ring-offset-gray-900", i ? "focus-within:ring-red-500" : "focus-within:ring-blue-500"),
|
|
139
139
|
children: [/* @__PURE__ */ t("input", {
|
|
140
140
|
type: "checkbox",
|
|
141
141
|
id: v,
|
|
142
142
|
className: "sr-only",
|
|
143
143
|
checked: S,
|
|
144
144
|
onChange: (e) => {
|
|
145
|
-
x || b(e.target.checked),
|
|
145
|
+
x || b(e.target.checked), p?.(e);
|
|
146
146
|
},
|
|
147
147
|
"aria-invalid": !!i,
|
|
148
148
|
"aria-describedby": C,
|
|
149
149
|
..._
|
|
150
150
|
}), /* @__PURE__ */ t("span", {
|
|
151
|
-
className:
|
|
152
|
-
|
|
151
|
+
className: m("flex h-5 w-5 items-center justify-center transition-all duration-200", !o && [
|
|
152
|
+
h[a],
|
|
153
153
|
"border-2",
|
|
154
|
-
S ?
|
|
154
|
+
S ? m("border-blue-600 dark:border-blue-500", "bg-blue-600 dark:bg-blue-500") : m("border-gray-300 dark:border-gray-600", "bg-white dark:bg-gray-800"),
|
|
155
155
|
i && "border-red-500 dark:border-red-400"
|
|
156
156
|
], c),
|
|
157
157
|
"aria-hidden": !0,
|
|
@@ -167,7 +167,7 @@ function k({ label: e, description: r, error: i, radius: a = "sm", unstyled: o =
|
|
|
167
167
|
})
|
|
168
168
|
})]
|
|
169
169
|
}), typeof e == "string" ? /* @__PURE__ */ n("span", {
|
|
170
|
-
className:
|
|
170
|
+
className: m(k, "select-none"),
|
|
171
171
|
children: [e, _.required && /* @__PURE__ */ t("span", {
|
|
172
172
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
173
173
|
children: "*"
|
|
@@ -176,16 +176,16 @@ function k({ label: e, description: r, error: i, radius: a = "sm", unstyled: o =
|
|
|
176
176
|
}),
|
|
177
177
|
r && (typeof r == "string" ? /* @__PURE__ */ t("p", {
|
|
178
178
|
id: `${v}-description`,
|
|
179
|
-
className:
|
|
179
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "mt-1 ml-8"),
|
|
180
180
|
children: r
|
|
181
181
|
}) : /* @__PURE__ */ t("span", {
|
|
182
182
|
id: `${v}-description`,
|
|
183
|
-
className:
|
|
183
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "block mt-1 ml-8"),
|
|
184
184
|
children: r
|
|
185
185
|
})),
|
|
186
186
|
i && /* @__PURE__ */ t("p", {
|
|
187
187
|
id: `${v}-error`,
|
|
188
|
-
className:
|
|
188
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1 ml-8"),
|
|
189
189
|
role: "alert",
|
|
190
190
|
children: i
|
|
191
191
|
})
|
|
@@ -194,54 +194,31 @@ function k({ label: e, description: r, error: i, radius: a = "sm", unstyled: o =
|
|
|
194
194
|
}
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/hooks/use_client_only/use_client_only.tsx
|
|
197
|
-
var
|
|
198
|
-
let [e, t] =
|
|
197
|
+
var M = () => {
|
|
198
|
+
let [e, t] = u(!1);
|
|
199
199
|
return o(() => {
|
|
200
200
|
requestAnimationFrame(() => {
|
|
201
201
|
t(!0);
|
|
202
202
|
});
|
|
203
203
|
}, []), e;
|
|
204
|
-
},
|
|
204
|
+
}, N = (e) => (n) => M() ? /* @__PURE__ */ t(e, { ...n }) : null;
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/components/client_only/client_only.tsx
|
|
207
|
-
function
|
|
208
|
-
return
|
|
207
|
+
function P({ children: n, fallback: r }) {
|
|
208
|
+
return M() ? /* @__PURE__ */ t(e, { children: n }) : r ?? null;
|
|
209
209
|
}
|
|
210
210
|
//#endregion
|
|
211
|
-
//#region src/components/
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}, ne = {
|
|
217
|
-
sm: "w-4 h-4",
|
|
218
|
-
md: "w-5 h-5",
|
|
219
|
-
lg: "w-6 h-6"
|
|
220
|
-
}, N = ({ icon: e, "aria-label": r, variant: i = "outline", color: a = "neutral", size: o = "md", radius: s = "md", className: c, children: l, ref: u, ...d }) => {
|
|
221
|
-
let f = h[a];
|
|
222
|
-
return /* @__PURE__ */ n("button", {
|
|
223
|
-
ref: u,
|
|
224
|
-
type: "button",
|
|
225
|
-
"aria-label": r,
|
|
226
|
-
className: p(g, i !== "unstyled" && [
|
|
227
|
-
"border",
|
|
228
|
-
m[s],
|
|
229
|
-
f[i],
|
|
230
|
-
f.focusOutline
|
|
231
|
-
], M[o], c),
|
|
232
|
-
...d,
|
|
233
|
-
children: [/* @__PURE__ */ t("div", { className: p(e, ne[o], l && "mr-1") }), l]
|
|
234
|
-
});
|
|
235
|
-
}, P = `w-full border ${C} ${w} text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed`;
|
|
236
|
-
function re({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength: o, radius: c = "md", unstyled: u = !1, className: d, wrapperClassName: f, value: h, defaultValue: g, onChange: _, id: v = "input", ...y }) {
|
|
237
|
-
let b = `${v}-${s()}`, [x, C] = l(typeof g == "string" ? g.length : 0), w = typeof h == "string" ? h.length : h === void 0 ? x : 0, T = i && (a !== void 0 || o !== void 0), E = (e) => {
|
|
238
|
-
h === void 0 && C(e.target.value.length), _?.(e);
|
|
211
|
+
//#region src/components/input/input.tsx
|
|
212
|
+
var F = `w-full border ${w} ${T} text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed`;
|
|
213
|
+
function I({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength: o, radius: c = "md", unstyled: l = !1, className: d, wrapperClassName: f, value: p, defaultValue: g, onChange: _, id: v = "input", ...y }) {
|
|
214
|
+
let b = `${v}-${s()}`, [x, S] = u(typeof g == "string" ? g.length : 0), w = typeof p == "string" ? p.length : p === void 0 ? x : 0, T = i && (a !== void 0 || o !== void 0), E = (e) => {
|
|
215
|
+
p === void 0 && S(e.target.value.length), _?.(e);
|
|
239
216
|
};
|
|
240
217
|
return /* @__PURE__ */ n("div", {
|
|
241
|
-
className:
|
|
218
|
+
className: m("w-full", f),
|
|
242
219
|
children: [
|
|
243
220
|
typeof e == "string" ? /* @__PURE__ */ n("label", {
|
|
244
|
-
className:
|
|
221
|
+
className: m(k, "block mb-1"),
|
|
245
222
|
htmlFor: b,
|
|
246
223
|
children: [e, y.required && /* @__PURE__ */ t("span", {
|
|
247
224
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
@@ -250,12 +227,12 @@ function re({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
250
227
|
}) : e,
|
|
251
228
|
/* @__PURE__ */ t("input", {
|
|
252
229
|
id: b,
|
|
253
|
-
className:
|
|
254
|
-
|
|
255
|
-
|
|
230
|
+
className: m("w-full disabled:opacity-50 disabled:cursor-not-allowed", !l && [
|
|
231
|
+
F,
|
|
232
|
+
h[c],
|
|
256
233
|
"px-3 py-2 text-sm"
|
|
257
|
-
], !
|
|
258
|
-
...
|
|
234
|
+
], !l && r && m("border-red-500 dark:border-red-400", "focus:ring-red-500"), d),
|
|
235
|
+
...p === void 0 ? { defaultValue: g } : { value: p },
|
|
259
236
|
minLength: a,
|
|
260
237
|
maxLength: o,
|
|
261
238
|
onChange: E,
|
|
@@ -263,7 +240,7 @@ function re({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
263
240
|
"aria-describedby": r ? `${b}-error` : void 0,
|
|
264
241
|
...y
|
|
265
242
|
}),
|
|
266
|
-
T && /* @__PURE__ */ t(
|
|
243
|
+
T && /* @__PURE__ */ t(C, {
|
|
267
244
|
current: w,
|
|
268
245
|
min: a,
|
|
269
246
|
max: o,
|
|
@@ -272,7 +249,7 @@ function re({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
272
249
|
}),
|
|
273
250
|
r && /* @__PURE__ */ t("p", {
|
|
274
251
|
id: `${b}-error`,
|
|
275
|
-
className:
|
|
252
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1"),
|
|
276
253
|
role: "alert",
|
|
277
254
|
children: r
|
|
278
255
|
})
|
|
@@ -280,9 +257,161 @@ function re({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
280
257
|
});
|
|
281
258
|
}
|
|
282
259
|
//#endregion
|
|
283
|
-
//#region
|
|
284
|
-
|
|
285
|
-
|
|
260
|
+
//#region src/components/combobox/combobox.tsx
|
|
261
|
+
function L({ options: e, label: r, error: i, placeholder: a, noResultsText: o = "No results found", radius: l = "md", unstyled: d = !1, disabled: f = !1, required: p = !1, className: g, wrapperClassName: _, value: v, defaultValue: y = "", onChange: b, id: x = "combobox" }) {
|
|
262
|
+
let S = `${x}-${s()}`, C = `${S}-listbox`, [w, T] = u(y), E = v !== void 0, D = E ? v : w, O = e.find((e) => e.value === D), [A, j] = u(""), [M, N] = u(!1), [P, I] = u(!1), [L, R] = u(-1), z = c(() => M ? e.filter((e) => e.label.toLowerCase().includes(A.toLowerCase())) : e, [
|
|
263
|
+
e,
|
|
264
|
+
M,
|
|
265
|
+
A
|
|
266
|
+
]), B = P ? A : O?.label ?? "", V = () => {
|
|
267
|
+
f || (j(O?.label ?? ""), N(!1), I(!0), R(-1));
|
|
268
|
+
}, H = () => {
|
|
269
|
+
I(!1), N(!1), R(-1);
|
|
270
|
+
}, U = (e) => {
|
|
271
|
+
E || T(e.value), b?.(e.value), H();
|
|
272
|
+
}, W = () => {
|
|
273
|
+
E || T(""), b?.(""), j("");
|
|
274
|
+
}, G = (e) => {
|
|
275
|
+
j(e.target.value), N(!0), I(!0), R(0);
|
|
276
|
+
}, K = (e) => {
|
|
277
|
+
z.length !== 0 && R((t) => {
|
|
278
|
+
let n = t + e;
|
|
279
|
+
return n < 0 ? z.length - 1 : n >= z.length ? 0 : n;
|
|
280
|
+
});
|
|
281
|
+
}, q = (e) => {
|
|
282
|
+
if (e.key === "ArrowDown") {
|
|
283
|
+
e.preventDefault(), P ? K(1) : V();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (e.key === "ArrowUp") {
|
|
287
|
+
e.preventDefault(), P ? K(-1) : V();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (e.key === "Enter") {
|
|
291
|
+
if (!P) return;
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
let t = z[L];
|
|
294
|
+
t && U(t);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (e.key === "Escape") {
|
|
298
|
+
if (!P) return;
|
|
299
|
+
e.preventDefault(), H();
|
|
300
|
+
}
|
|
301
|
+
}, ee = P && L >= 0 ? `${C}-option-${L}` : void 0;
|
|
302
|
+
return /* @__PURE__ */ n("div", {
|
|
303
|
+
className: m("w-full", _),
|
|
304
|
+
children: [
|
|
305
|
+
typeof r == "string" ? /* @__PURE__ */ n("label", {
|
|
306
|
+
className: m(k, "block mb-1"),
|
|
307
|
+
htmlFor: S,
|
|
308
|
+
children: [r, p && /* @__PURE__ */ t("span", {
|
|
309
|
+
className: "text-red-500 dark:text-red-400 ml-1",
|
|
310
|
+
children: "*"
|
|
311
|
+
})]
|
|
312
|
+
}) : r,
|
|
313
|
+
/* @__PURE__ */ n("div", {
|
|
314
|
+
className: "relative",
|
|
315
|
+
children: [
|
|
316
|
+
!d && /* @__PURE__ */ t("span", {
|
|
317
|
+
className: "i-mdi-magnify absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none",
|
|
318
|
+
"aria-hidden": !0
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ t("input", {
|
|
321
|
+
id: S,
|
|
322
|
+
role: "combobox",
|
|
323
|
+
type: "text",
|
|
324
|
+
autoComplete: "off",
|
|
325
|
+
disabled: f,
|
|
326
|
+
placeholder: a,
|
|
327
|
+
value: B,
|
|
328
|
+
onChange: G,
|
|
329
|
+
onFocus: V,
|
|
330
|
+
onBlur: H,
|
|
331
|
+
onKeyDown: q,
|
|
332
|
+
"aria-expanded": P,
|
|
333
|
+
"aria-controls": C,
|
|
334
|
+
"aria-autocomplete": "list",
|
|
335
|
+
"aria-activedescendant": ee,
|
|
336
|
+
"aria-invalid": !!i,
|
|
337
|
+
"aria-describedby": i ? `${S}-error` : void 0,
|
|
338
|
+
className: m("w-full disabled:opacity-50 disabled:cursor-not-allowed", !d && [
|
|
339
|
+
F,
|
|
340
|
+
h[l],
|
|
341
|
+
"pl-9 pr-8 py-2 text-sm"
|
|
342
|
+
], !d && i && m("border-red-500 dark:border-red-400", "focus:ring-red-500"), g)
|
|
343
|
+
}),
|
|
344
|
+
!d && O && !f && /* @__PURE__ */ t("button", {
|
|
345
|
+
type: "button",
|
|
346
|
+
"aria-label": "Clear selection",
|
|
347
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
348
|
+
onClick: W,
|
|
349
|
+
className: "absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",
|
|
350
|
+
children: /* @__PURE__ */ t("span", {
|
|
351
|
+
className: "i-mdi-close block w-4 h-4",
|
|
352
|
+
"aria-hidden": !0
|
|
353
|
+
})
|
|
354
|
+
}),
|
|
355
|
+
P && /* @__PURE__ */ t("ul", {
|
|
356
|
+
id: C,
|
|
357
|
+
role: "listbox",
|
|
358
|
+
className: m("absolute z-10 mt-1 w-full max-h-60 overflow-auto py-1 text-sm shadow-lg", !d && [
|
|
359
|
+
"border",
|
|
360
|
+
"bg-white dark:bg-gray-900",
|
|
361
|
+
"border-gray-100 dark:border-gray-800",
|
|
362
|
+
h[l]
|
|
363
|
+
]),
|
|
364
|
+
children: z.length === 0 ? /* @__PURE__ */ t("li", {
|
|
365
|
+
className: "px-3 py-2 text-gray-500 dark:text-gray-400",
|
|
366
|
+
children: o
|
|
367
|
+
}) : z.map((e, n) => /* @__PURE__ */ t("li", {
|
|
368
|
+
id: `${C}-option-${n}`,
|
|
369
|
+
role: "option",
|
|
370
|
+
"aria-selected": e.value === D,
|
|
371
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
372
|
+
onClick: () => U(e),
|
|
373
|
+
className: m("px-3 py-2 cursor-pointer text-gray-900 dark:text-gray-100", n === L ? "bg-blue-50 dark:bg-blue-900/40" : "hover:bg-gray-50 dark:hover:bg-gray-800/60", e.value === D && "font-medium"),
|
|
374
|
+
children: e.label
|
|
375
|
+
}, e.value))
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
}),
|
|
379
|
+
i && /* @__PURE__ */ t("p", {
|
|
380
|
+
id: `${S}-error`,
|
|
381
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1"),
|
|
382
|
+
role: "alert",
|
|
383
|
+
children: i
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/components/icon_button/icon_button.tsx
|
|
390
|
+
var R = {
|
|
391
|
+
sm: "p-1",
|
|
392
|
+
md: "p-2",
|
|
393
|
+
lg: "p-3"
|
|
394
|
+
}, z = {
|
|
395
|
+
sm: "w-4 h-4",
|
|
396
|
+
md: "w-5 h-5",
|
|
397
|
+
lg: "w-6 h-6"
|
|
398
|
+
}, B = ({ icon: e, "aria-label": r, variant: i = "outline", color: a = "neutral", size: o = "md", radius: s = "md", className: c, children: l, ref: u, ...d }) => {
|
|
399
|
+
let f = g[a];
|
|
400
|
+
return /* @__PURE__ */ n("button", {
|
|
401
|
+
ref: u,
|
|
402
|
+
type: "button",
|
|
403
|
+
"aria-label": r,
|
|
404
|
+
className: m(_, i !== "unstyled" && [
|
|
405
|
+
"border",
|
|
406
|
+
h[s],
|
|
407
|
+
f[i],
|
|
408
|
+
f.focusOutline
|
|
409
|
+
], R[o], c),
|
|
410
|
+
...d,
|
|
411
|
+
children: [/* @__PURE__ */ t("div", { className: m(e, z[o], l && "mr-1") }), l]
|
|
412
|
+
});
|
|
413
|
+
}, V = [];
|
|
414
|
+
function H() {
|
|
286
415
|
let e = 0, t = [], n = null, r = /* @__PURE__ */ new Set(), i = () => {
|
|
287
416
|
for (let e of r) e(t);
|
|
288
417
|
};
|
|
@@ -303,7 +432,7 @@ function F() {
|
|
|
303
432
|
r.delete(i), r.size || (e = 0, t = [], n = null);
|
|
304
433
|
}),
|
|
305
434
|
getSnapshot: () => t,
|
|
306
|
-
getServerSnapshot: () =>
|
|
435
|
+
getServerSnapshot: () => V,
|
|
307
436
|
getListenersSize: () => r.size,
|
|
308
437
|
getUpsertPromise: () => n,
|
|
309
438
|
setUpsertPromise: (e) => {
|
|
@@ -311,9 +440,9 @@ function F() {
|
|
|
311
440
|
}
|
|
312
441
|
};
|
|
313
442
|
}
|
|
314
|
-
var
|
|
315
|
-
function
|
|
316
|
-
let n = { current:
|
|
443
|
+
var U = /* @__PURE__ */ new Map();
|
|
444
|
+
function W(e, t = 0) {
|
|
445
|
+
let n = { current: H() }, r = (e) => (r) => {
|
|
317
446
|
let i = /* @__PURE__ */ new Set();
|
|
318
447
|
n.current.set(e, (e) => (e.resolve(r), i.add(e.promise), {
|
|
319
448
|
...e,
|
|
@@ -366,8 +495,8 @@ function L(e, t = 0) {
|
|
|
366
495
|
...t ? e[1] : e[0]
|
|
367
496
|
}
|
|
368
497
|
}));
|
|
369
|
-
},
|
|
370
|
-
return
|
|
498
|
+
}, u = function(t) {
|
|
499
|
+
return d(n.current.subscribe, n.current.getSnapshot, n.current.getServerSnapshot).map(({ props: n, key: r, end: a, ended: o }, s, c) => /* @__PURE__ */ i(e, {
|
|
371
500
|
...n,
|
|
372
501
|
key: r,
|
|
373
502
|
call: {
|
|
@@ -379,8 +508,8 @@ function L(e, t = 0) {
|
|
|
379
508
|
stackSize: c.length
|
|
380
509
|
}
|
|
381
510
|
}));
|
|
382
|
-
}, f = Object.assign(
|
|
383
|
-
Root:
|
|
511
|
+
}, f = Object.assign(u, {
|
|
512
|
+
Root: u,
|
|
384
513
|
call: o,
|
|
385
514
|
upsert: s,
|
|
386
515
|
end: c,
|
|
@@ -399,8 +528,8 @@ function L(e, t = 0) {
|
|
|
399
528
|
set: (r) => {
|
|
400
529
|
if (t || (e = r, !r)) return;
|
|
401
530
|
t = !0;
|
|
402
|
-
let i =
|
|
403
|
-
i ? n.current = i :
|
|
531
|
+
let i = U.get(r);
|
|
532
|
+
i ? n.current = i : U.set(r, n.current);
|
|
404
533
|
}
|
|
405
534
|
});
|
|
406
535
|
}
|
|
@@ -408,66 +537,72 @@ function L(e, t = 0) {
|
|
|
408
537
|
}
|
|
409
538
|
//#endregion
|
|
410
539
|
//#region src/components/modal/modal_shell.tsx
|
|
411
|
-
var
|
|
540
|
+
var G = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", K = {
|
|
412
541
|
sm: "max-w-md",
|
|
413
542
|
md: "max-w-lg",
|
|
414
543
|
lg: "max-w-2xl",
|
|
415
544
|
xl: "max-w-4xl"
|
|
416
545
|
};
|
|
417
|
-
function
|
|
418
|
-
let [
|
|
546
|
+
function q({ isEnded: e, onDismiss: r, title: i, children: a, footer: c, size: d = "md", radius: p = "xl", className: g, dismissible: _ = !0 }) {
|
|
547
|
+
let [v, y] = u(!1), b = l(null), x = l(null), S = l(null), C = s();
|
|
419
548
|
o(() => {
|
|
420
|
-
document.body.style.overflow = "hidden",
|
|
421
|
-
let e =
|
|
422
|
-
|
|
549
|
+
document.body.style.overflow = "hidden", S.current = document.activeElement;
|
|
550
|
+
let e = b.current;
|
|
551
|
+
(x.current?.querySelector(G) ?? e?.querySelector(G) ?? e)?.focus();
|
|
552
|
+
let t = requestAnimationFrame(() => {
|
|
553
|
+
requestAnimationFrame(() => y(!0));
|
|
423
554
|
});
|
|
424
555
|
return () => {
|
|
425
|
-
cancelAnimationFrame(
|
|
556
|
+
cancelAnimationFrame(t), document.body.style.overflow = "";
|
|
426
557
|
};
|
|
427
558
|
}, []), o(() => {
|
|
428
|
-
e &&
|
|
559
|
+
e && S.current?.focus();
|
|
429
560
|
}, [e]), o(() => {
|
|
430
561
|
if (e) return;
|
|
431
562
|
let t = (e) => {
|
|
432
563
|
if (e.key === "Escape") {
|
|
433
|
-
r();
|
|
564
|
+
_ && r();
|
|
434
565
|
return;
|
|
435
566
|
}
|
|
436
567
|
if (e.key !== "Tab") return;
|
|
437
|
-
let t =
|
|
568
|
+
let t = b.current;
|
|
438
569
|
if (!t) return;
|
|
439
|
-
let n = Array.from(t.querySelectorAll(
|
|
570
|
+
let n = Array.from(t.querySelectorAll(G));
|
|
440
571
|
if (n.length === 0) return;
|
|
441
572
|
let i = n[0], a = n[n.length - 1];
|
|
442
573
|
e.shiftKey && document.activeElement === i ? (e.preventDefault(), a.focus()) : !e.shiftKey && document.activeElement === a && (e.preventDefault(), i.focus());
|
|
443
574
|
};
|
|
444
575
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
445
|
-
}, [
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
576
|
+
}, [
|
|
577
|
+
e,
|
|
578
|
+
r,
|
|
579
|
+
_
|
|
580
|
+
]);
|
|
581
|
+
let w = () => {
|
|
582
|
+
!e && _ && r();
|
|
583
|
+
}, T = v && !e;
|
|
584
|
+
return f(/* @__PURE__ */ n("div", {
|
|
585
|
+
className: m("fixed inset-0 z-50 flex items-start justify-center", "p-2 sm:py-[3rem] lg:py-[5rem]", "transition-opacity duration-200 ease-out", T ? "opacity-100" : "opacity-0"),
|
|
586
|
+
onClick: w,
|
|
452
587
|
children: [/* @__PURE__ */ t("div", {
|
|
453
|
-
className:
|
|
588
|
+
className: m("fixed inset-0 bg-black/60 backdrop-blur-md", "transition-opacity duration-200 ease-out", T ? "opacity-100" : "opacity-0"),
|
|
454
589
|
"aria-hidden": "true"
|
|
455
590
|
}), /* @__PURE__ */ n("div", {
|
|
456
|
-
ref:
|
|
591
|
+
ref: b,
|
|
457
592
|
role: "dialog",
|
|
458
593
|
"aria-modal": "true",
|
|
459
|
-
"aria-labelledby": i ?
|
|
594
|
+
"aria-labelledby": i ? C : void 0,
|
|
460
595
|
tabIndex: -1,
|
|
461
|
-
className:
|
|
596
|
+
className: m("relative w-full", K[d], D, "shadow-2xl", h[p], "max-h-[calc(100vh-4rem)] sm:max-h-[calc(100vh-10rem)] overflow-hidden flex flex-col", "transition-all duration-200 ease-out", "focus:outline-none", T ? "opacity-100 scale-100 translate-y-0" : "opacity-0 scale-95 translate-y-1"),
|
|
462
597
|
onClick: (e) => e.stopPropagation(),
|
|
463
598
|
children: [
|
|
464
599
|
i && /* @__PURE__ */ n("div", {
|
|
465
600
|
className: "flex items-center justify-between gap-4 px-6 pt-5 pb-4 flex-shrink-0",
|
|
466
601
|
children: [/* @__PURE__ */ t("h2", {
|
|
467
|
-
id:
|
|
602
|
+
id: C,
|
|
468
603
|
className: "text-base font-medium tracking-tight text-gray-900 dark:text-gray-100",
|
|
469
604
|
children: i
|
|
470
|
-
}), /* @__PURE__ */ t(
|
|
605
|
+
}), _ && /* @__PURE__ */ t(B, {
|
|
471
606
|
icon: "i-mdi-close",
|
|
472
607
|
onClick: r,
|
|
473
608
|
"aria-label": "Close",
|
|
@@ -478,12 +613,13 @@ function R({ isEnded: e, onDismiss: r, title: i, children: a, footer: u, size: f
|
|
|
478
613
|
})]
|
|
479
614
|
}),
|
|
480
615
|
/* @__PURE__ */ t("div", {
|
|
481
|
-
|
|
616
|
+
ref: x,
|
|
617
|
+
className: m("flex-1 overflow-y-auto px-6 pb-6 text-sm leading-relaxed text-gray-600 dark:text-gray-400 min-h-0", !i && "pt-6", g),
|
|
482
618
|
children: a
|
|
483
619
|
}),
|
|
484
|
-
|
|
485
|
-
className:
|
|
486
|
-
children:
|
|
620
|
+
c && /* @__PURE__ */ t("div", {
|
|
621
|
+
className: m("flex items-center justify-end gap-3 px-6 py-4 border-t flex-shrink-0", "border-gray-100 dark:border-gray-800"),
|
|
622
|
+
children: c
|
|
487
623
|
})
|
|
488
624
|
]
|
|
489
625
|
})]
|
|
@@ -491,7 +627,7 @@ function R({ isEnded: e, onDismiss: r, title: i, children: a, footer: u, size: f
|
|
|
491
627
|
}
|
|
492
628
|
//#endregion
|
|
493
629
|
//#region node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7_use-sync-external-store@1.6.0_react@19.2.7_/node_modules/zustand/esm/vanilla.mjs
|
|
494
|
-
var
|
|
630
|
+
var ee = (e) => {
|
|
495
631
|
let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
|
|
496
632
|
let i = typeof e == "function" ? e(t) : e;
|
|
497
633
|
if (!Object.is(i, t)) {
|
|
@@ -505,51 +641,51 @@ var z = (e) => {
|
|
|
505
641
|
subscribe: (e) => (n.add(e), () => n.delete(e))
|
|
506
642
|
}, o = t = e(r, i, a);
|
|
507
643
|
return a;
|
|
508
|
-
},
|
|
509
|
-
function
|
|
644
|
+
}, te = ((e) => e ? ee(e) : ee), ne = (e) => e;
|
|
645
|
+
function re(e, t = ne) {
|
|
510
646
|
let n = r.useSyncExternalStore(e.subscribe, r.useCallback(() => t(e.getState()), [e, t]), r.useCallback(() => t(e.getInitialState()), [e, t]));
|
|
511
647
|
return r.useDebugValue(n), n;
|
|
512
648
|
}
|
|
513
|
-
var
|
|
514
|
-
let t =
|
|
649
|
+
var ie = (e) => {
|
|
650
|
+
let t = te(e), n = (e) => re(t, e);
|
|
515
651
|
return Object.assign(n, t), n;
|
|
516
|
-
},
|
|
652
|
+
}, ae = ((e) => e ? ie(e) : ie), J = ae((e) => ({
|
|
517
653
|
globalHotkeysEnabled: !0,
|
|
518
654
|
setGlobalHotkeysEnabled: (t) => e({ globalHotkeysEnabled: t })
|
|
519
|
-
})),
|
|
520
|
-
function
|
|
521
|
-
o(() => (
|
|
522
|
-
--
|
|
655
|
+
})), Y = 0;
|
|
656
|
+
function X() {
|
|
657
|
+
o(() => (Y += 1, Y === 1 && J.getState().setGlobalHotkeysEnabled(!1), () => {
|
|
658
|
+
--Y, Y === 0 && J.getState().setGlobalHotkeysEnabled(!0);
|
|
523
659
|
}), []);
|
|
524
660
|
}
|
|
525
661
|
//#endregion
|
|
526
662
|
//#region src/components/modal/confirm_modal.tsx
|
|
527
|
-
var
|
|
663
|
+
var oe = {
|
|
528
664
|
red: "danger",
|
|
529
665
|
blue: "primary",
|
|
530
666
|
green: "success"
|
|
531
|
-
},
|
|
667
|
+
}, se = {
|
|
532
668
|
red: "i-mdi-alert-circle",
|
|
533
669
|
blue: "i-mdi-help-circle",
|
|
534
670
|
green: "i-mdi-check-circle"
|
|
535
|
-
},
|
|
671
|
+
}, ce = {
|
|
536
672
|
red: "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400",
|
|
537
673
|
blue: "bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-400",
|
|
538
674
|
green: "bg-green-50 text-green-600 dark:bg-green-500/10 dark:text-green-400"
|
|
539
675
|
};
|
|
540
|
-
function
|
|
676
|
+
function le({ title: e, color: r }) {
|
|
541
677
|
return /* @__PURE__ */ n("div", {
|
|
542
678
|
className: "flex items-center gap-3",
|
|
543
679
|
children: [/* @__PURE__ */ t("span", {
|
|
544
|
-
className:
|
|
680
|
+
className: m("flex h-9 w-9 shrink-0 items-center justify-center rounded-full", ce[r]),
|
|
545
681
|
"aria-hidden": "true",
|
|
546
|
-
children: /* @__PURE__ */ t("span", { className:
|
|
682
|
+
children: /* @__PURE__ */ t("span", { className: m(se[r], "h-5 w-5") })
|
|
547
683
|
}), e]
|
|
548
684
|
});
|
|
549
685
|
}
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
let [f, p] =
|
|
686
|
+
var ue = W(({ call: r, title: i, children: a, confirmLabel: o, cancelLabel: s, confirmColor: c, radius: l, onConfirm: d }) => {
|
|
687
|
+
X();
|
|
688
|
+
let [f, p] = u(!1), m = () => r.end(!1), h = async () => {
|
|
553
689
|
if (!d) {
|
|
554
690
|
r.end(!0);
|
|
555
691
|
return;
|
|
@@ -560,25 +696,25 @@ var G = L(({ call: r, title: i, children: a, confirmLabel: o, cancelLabel: s, co
|
|
|
560
696
|
} finally {
|
|
561
697
|
p(!1);
|
|
562
698
|
}
|
|
563
|
-
}, g = f, _ = o ?? "Confirm", v = s ?? "Cancel",
|
|
564
|
-
return /* @__PURE__ */ t(
|
|
699
|
+
}, g = f, _ = o ?? "Confirm", v = s ?? "Cancel", y = c ?? "blue";
|
|
700
|
+
return /* @__PURE__ */ t(q, {
|
|
565
701
|
isEnded: r.ended,
|
|
566
702
|
onDismiss: m,
|
|
567
|
-
title: /* @__PURE__ */ t(
|
|
703
|
+
title: /* @__PURE__ */ t(le, {
|
|
568
704
|
title: i,
|
|
569
|
-
color:
|
|
705
|
+
color: y
|
|
570
706
|
}),
|
|
571
707
|
size: "sm",
|
|
572
|
-
radius:
|
|
573
|
-
footer: /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(
|
|
708
|
+
radius: l,
|
|
709
|
+
footer: /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(b, {
|
|
574
710
|
variant: "outline",
|
|
575
711
|
color: "neutral",
|
|
576
712
|
onClick: m,
|
|
577
713
|
disabled: g,
|
|
578
714
|
size: "sm",
|
|
579
715
|
children: v
|
|
580
|
-
}), /* @__PURE__ */ t(
|
|
581
|
-
color:
|
|
716
|
+
}), /* @__PURE__ */ t(b, {
|
|
717
|
+
color: oe[y],
|
|
582
718
|
onClick: () => {
|
|
583
719
|
h();
|
|
584
720
|
},
|
|
@@ -589,63 +725,72 @@ var G = L(({ call: r, title: i, children: a, confirmLabel: o, cancelLabel: s, co
|
|
|
589
725
|
})] }),
|
|
590
726
|
children: a
|
|
591
727
|
});
|
|
592
|
-
}, 200),
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
728
|
+
}, 200), de = 200;
|
|
729
|
+
function fe(e, t) {
|
|
730
|
+
return typeof e == "function" ? e(t) : e;
|
|
731
|
+
}
|
|
732
|
+
var pe = W(({ call: e, title: n, children: r, footer: i, size: a, radius: o, className: s, dismissible: c }) => {
|
|
733
|
+
X();
|
|
734
|
+
let l = () => e.end();
|
|
735
|
+
return /* @__PURE__ */ t(q, {
|
|
736
|
+
isEnded: e.ended,
|
|
737
|
+
onDismiss: l,
|
|
738
|
+
title: n,
|
|
739
|
+
footer: fe(i, l),
|
|
740
|
+
size: a,
|
|
741
|
+
radius: o,
|
|
742
|
+
className: s,
|
|
743
|
+
dismissible: c,
|
|
744
|
+
children: fe(r, l)
|
|
745
|
+
});
|
|
746
|
+
}, de);
|
|
602
747
|
//#endregion
|
|
603
748
|
//#region src/components/modal_provider/modal_provider.tsx
|
|
604
749
|
function me() {
|
|
605
|
-
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(
|
|
750
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(pe, {}), /* @__PURE__ */ t(ue, {})] });
|
|
606
751
|
}
|
|
607
752
|
//#endregion
|
|
608
753
|
//#region src/components/radio_options/radio_options.tsx
|
|
609
|
-
function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a, onChange: o, name: c, label:
|
|
610
|
-
let S = `${b}-${s()}`,
|
|
754
|
+
function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a, onChange: o, name: c, label: l, error: d, required: f, disabled: p, radius: g = "lg", unstyled: _ = !1, className: v, wrapperClassName: y, id: b = "radio", ...x }) {
|
|
755
|
+
let S = `${b}-${s()}`, C = c ?? S, [T, E] = u(a ?? ""), D = i !== void 0, O = D ? i : T, k = e.map((e) => typeof e == "string" ? {
|
|
611
756
|
value: e,
|
|
612
757
|
label: e
|
|
613
|
-
} : e),
|
|
758
|
+
} : e), j = `${S}-error`, M = (e) => {
|
|
614
759
|
D || E(e), o?.(e);
|
|
615
760
|
};
|
|
616
761
|
return /* @__PURE__ */ n("fieldset", {
|
|
617
|
-
className:
|
|
618
|
-
disabled:
|
|
619
|
-
"aria-describedby": d ?
|
|
762
|
+
className: m("m-0 border-0 p-0", y),
|
|
763
|
+
disabled: p,
|
|
764
|
+
"aria-describedby": d ? j : void 0,
|
|
620
765
|
"aria-required": f,
|
|
621
766
|
...x,
|
|
622
767
|
children: [
|
|
623
|
-
|
|
624
|
-
className:
|
|
625
|
-
children: [
|
|
768
|
+
l && /* @__PURE__ */ n("legend", {
|
|
769
|
+
className: m("text-sm font-medium text-gray-700 dark:text-gray-300", "mb-2", v),
|
|
770
|
+
children: [l, f && /* @__PURE__ */ t("span", {
|
|
626
771
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
627
772
|
children: "*"
|
|
628
773
|
})]
|
|
629
774
|
}),
|
|
630
775
|
/* @__PURE__ */ t("div", {
|
|
631
|
-
className:
|
|
776
|
+
className: m(r === "horizontal" ? "flex flex-row gap-2" : "flex flex-col gap-2"),
|
|
632
777
|
children: k.map((e, i) => {
|
|
633
|
-
let a = `${S}-${i}`, o = `${S}-${i}-desc`, s = O === e.value, c =
|
|
778
|
+
let a = `${S}-${i}`, o = `${S}-${i}-desc`, s = O === e.value, c = p ?? e.disabled;
|
|
634
779
|
return /* @__PURE__ */ n("label", {
|
|
635
780
|
htmlFor: a,
|
|
636
|
-
className:
|
|
637
|
-
|
|
781
|
+
className: m("flex cursor-pointer items-start gap-3 transition-colors duration-150", r === "horizontal" && "flex-1", "focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2", "focus-within:ring-offset-white dark:focus-within:ring-offset-gray-900", d ? "focus-within:ring-red-500" : "focus-within:ring-blue-500", !_ && [
|
|
782
|
+
h[g],
|
|
638
783
|
"border px-3 py-2.5",
|
|
639
|
-
s ? d ?
|
|
784
|
+
s ? d ? m("border-red-500 dark:border-red-400", "bg-red-50 dark:bg-red-950/20") : "border-blue-500 bg-blue-50 dark:border-blue-500 dark:bg-blue-950/25" : d ? "border-red-300 bg-white dark:border-red-800/50 dark:bg-gray-800/50" : m("border-gray-200 dark:border-gray-700", "bg-gray-50 hover:border-gray-300 hover:bg-white dark:bg-gray-800/50 dark:hover:border-gray-600 dark:hover:bg-gray-800")
|
|
640
785
|
], c && "cursor-not-allowed opacity-50"),
|
|
641
786
|
children: [
|
|
642
787
|
/* @__PURE__ */ t("input", {
|
|
643
788
|
type: "radio",
|
|
644
789
|
id: a,
|
|
645
|
-
name:
|
|
790
|
+
name: C,
|
|
646
791
|
value: e.value,
|
|
647
792
|
checked: s,
|
|
648
|
-
onChange: () =>
|
|
793
|
+
onChange: () => M(e.value),
|
|
649
794
|
disabled: c,
|
|
650
795
|
required: f && i === 0,
|
|
651
796
|
"aria-invalid": d ? !0 : void 0,
|
|
@@ -653,24 +798,24 @@ function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a
|
|
|
653
798
|
className: "sr-only"
|
|
654
799
|
}),
|
|
655
800
|
/* @__PURE__ */ t("span", {
|
|
656
|
-
className:
|
|
801
|
+
className: m("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-150", s ? d ? A : "border-blue-600 dark:border-blue-500" : d ? "border-red-400 dark:border-red-600" : w),
|
|
657
802
|
"aria-hidden": !0,
|
|
658
|
-
children: s && /* @__PURE__ */ t("span", { className:
|
|
803
|
+
children: s && /* @__PURE__ */ t("span", { className: m("h-2 w-2 rounded-full", d ? "bg-red-500 dark:bg-red-400" : "bg-blue-600 dark:bg-blue-500") })
|
|
659
804
|
}),
|
|
660
805
|
/* @__PURE__ */ n("span", {
|
|
661
806
|
className: "flex min-w-0 flex-col",
|
|
662
807
|
children: [/* @__PURE__ */ n("span", {
|
|
663
808
|
className: "flex items-center gap-1.5",
|
|
664
809
|
children: [e.icon && /* @__PURE__ */ t("span", {
|
|
665
|
-
className:
|
|
810
|
+
className: m(e.icon, "h-4 w-4 shrink-0", s ? d ? "text-red-600 dark:text-red-400" : "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400"),
|
|
666
811
|
"aria-hidden": !0
|
|
667
812
|
}), /* @__PURE__ */ t("span", {
|
|
668
|
-
className:
|
|
813
|
+
className: m("select-none text-sm font-medium", s ? d ? "text-red-700 dark:text-red-300" : "text-blue-700 dark:text-blue-300" : "text-gray-700 dark:text-gray-300"),
|
|
669
814
|
children: e.label
|
|
670
815
|
})]
|
|
671
816
|
}), e.description && /* @__PURE__ */ t("span", {
|
|
672
817
|
id: o,
|
|
673
|
-
className:
|
|
818
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "mt-0.5"),
|
|
674
819
|
children: e.description
|
|
675
820
|
})]
|
|
676
821
|
})
|
|
@@ -679,8 +824,8 @@ function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a
|
|
|
679
824
|
})
|
|
680
825
|
}),
|
|
681
826
|
d && /* @__PURE__ */ t("p", {
|
|
682
|
-
id:
|
|
683
|
-
className:
|
|
827
|
+
id: j,
|
|
828
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-2"),
|
|
684
829
|
role: "alert",
|
|
685
830
|
children: d
|
|
686
831
|
})
|
|
@@ -689,13 +834,13 @@ function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a
|
|
|
689
834
|
}
|
|
690
835
|
//#endregion
|
|
691
836
|
//#region src/components/select/select.tsx
|
|
692
|
-
function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md", unstyled: c = !1, className: l, wrapperClassName: u, value: d, defaultValue: f, onChange:
|
|
837
|
+
function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md", unstyled: c = !1, className: l, wrapperClassName: u, value: d, defaultValue: f, onChange: p, id: g = "select", ..._ }) {
|
|
693
838
|
let v = `${g}-${s()}`;
|
|
694
839
|
return /* @__PURE__ */ n("div", {
|
|
695
|
-
className:
|
|
840
|
+
className: m("w-full", u),
|
|
696
841
|
children: [
|
|
697
842
|
typeof r == "string" ? /* @__PURE__ */ n("label", {
|
|
698
|
-
className:
|
|
843
|
+
className: m(k, "block mb-1"),
|
|
699
844
|
htmlFor: v,
|
|
700
845
|
children: [r, _.required && /* @__PURE__ */ t("span", {
|
|
701
846
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
@@ -704,14 +849,14 @@ function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md",
|
|
|
704
849
|
}) : r,
|
|
705
850
|
/* @__PURE__ */ n("select", {
|
|
706
851
|
id: v,
|
|
707
|
-
className:
|
|
708
|
-
|
|
709
|
-
|
|
852
|
+
className: m("w-full disabled:opacity-50 disabled:cursor-not-allowed", !c && [
|
|
853
|
+
F,
|
|
854
|
+
h[o],
|
|
710
855
|
"pl-3 pr-8 py-2 text-sm appearance-none bg-[length:1rem_1rem] bg-[position:right_0.5rem_center] bg-no-repeat",
|
|
711
856
|
"bg-[url(\"data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 20 20%27%3e%3cpath stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%271.5%27 d=%27M6 8l4 4 4-4%27/%3e%3c/svg%3e\")]"
|
|
712
|
-
], !c && i &&
|
|
857
|
+
], !c && i && m("border-red-500 dark:border-red-400", "focus:ring-red-500"), l),
|
|
713
858
|
...d === void 0 ? { defaultValue: f } : { value: d },
|
|
714
|
-
onChange:
|
|
859
|
+
onChange: p,
|
|
715
860
|
"aria-invalid": !!i,
|
|
716
861
|
"aria-describedby": i ? `${v}-error` : void 0,
|
|
717
862
|
..._,
|
|
@@ -725,7 +870,7 @@ function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md",
|
|
|
725
870
|
}),
|
|
726
871
|
i && /* @__PURE__ */ t("p", {
|
|
727
872
|
id: `${v}-error`,
|
|
728
|
-
className:
|
|
873
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1"),
|
|
729
874
|
role: "alert",
|
|
730
875
|
children: i
|
|
731
876
|
})
|
|
@@ -734,16 +879,16 @@ function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md",
|
|
|
734
879
|
}
|
|
735
880
|
//#endregion
|
|
736
881
|
//#region src/components/switch/switch.tsx
|
|
737
|
-
function _e({ label: r, description: i, error: a, className: o, wrapperClassName: c, checked:
|
|
738
|
-
let g = `${
|
|
882
|
+
function _e({ label: r, description: i, error: a, className: o, wrapperClassName: c, checked: l, defaultChecked: d = !1, onChange: f, id: p = "switch", ...h }) {
|
|
883
|
+
let g = `${p}-${s()}`, [_, v] = u(d), y = l !== void 0, b = y ? l : _, x = [i && `${g}-description`, a && `${g}-error`].filter(Boolean).join(" ") || void 0;
|
|
739
884
|
return /* @__PURE__ */ n("div", {
|
|
740
|
-
className:
|
|
885
|
+
className: m("w-full", c),
|
|
741
886
|
children: [
|
|
742
887
|
/* @__PURE__ */ n("label", {
|
|
743
888
|
htmlFor: g,
|
|
744
|
-
className:
|
|
889
|
+
className: m("flex items-center gap-3 cursor-pointer", h.disabled && "cursor-not-allowed opacity-50"),
|
|
745
890
|
children: [/* @__PURE__ */ n("span", {
|
|
746
|
-
className:
|
|
891
|
+
className: m("relative inline-flex w-11 shrink-0 rounded-full border-2 border-transparent", "transition-colors duration-200 ease-in-out", "focus-within:outline-none focus-within:ring-2 focus-within:ring-blue-500 focus-within:ring-offset-2", "disabled:opacity-50", b ? O : "bg-gray-200 dark:bg-gray-600", a && "ring-2 ring-red-500 dark:ring-red-400", o),
|
|
747
892
|
children: [/* @__PURE__ */ t("input", {
|
|
748
893
|
type: "checkbox",
|
|
749
894
|
role: "switch",
|
|
@@ -757,11 +902,11 @@ function _e({ label: r, description: i, error: a, className: o, wrapperClassName
|
|
|
757
902
|
"aria-describedby": x,
|
|
758
903
|
...h
|
|
759
904
|
}), /* @__PURE__ */ t("span", {
|
|
760
|
-
className:
|
|
905
|
+
className: m("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0", "transition duration-200 ease-in-out", b ? "translate-x-5.25" : "translate-x-0"),
|
|
761
906
|
"aria-hidden": !0
|
|
762
907
|
})]
|
|
763
908
|
}), r && /* @__PURE__ */ t(e, { children: typeof r == "string" ? /* @__PURE__ */ n("span", {
|
|
764
|
-
className:
|
|
909
|
+
className: m("text-sm font-medium text-gray-700 dark:text-gray-300", "select-none"),
|
|
765
910
|
children: [r, h.required && /* @__PURE__ */ t("span", {
|
|
766
911
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
767
912
|
children: "*"
|
|
@@ -773,16 +918,16 @@ function _e({ label: r, description: i, error: a, className: o, wrapperClassName
|
|
|
773
918
|
}),
|
|
774
919
|
i && (typeof i == "string" ? /* @__PURE__ */ t("p", {
|
|
775
920
|
id: `${g}-description`,
|
|
776
|
-
className:
|
|
921
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "mt-1 ml-14"),
|
|
777
922
|
children: i
|
|
778
923
|
}) : /* @__PURE__ */ t("span", {
|
|
779
924
|
id: `${g}-description`,
|
|
780
|
-
className:
|
|
925
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "block mt-1 ml-14"),
|
|
781
926
|
children: i
|
|
782
927
|
})),
|
|
783
928
|
a && /* @__PURE__ */ t("p", {
|
|
784
929
|
id: `${g}-error`,
|
|
785
|
-
className:
|
|
930
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1 ml-14"),
|
|
786
931
|
role: "alert",
|
|
787
932
|
children: a
|
|
788
933
|
})
|
|
@@ -791,9 +936,9 @@ function _e({ label: r, description: i, error: a, className: o, wrapperClassName
|
|
|
791
936
|
}
|
|
792
937
|
//#endregion
|
|
793
938
|
//#region src/components/tabs/tabs.tsx
|
|
794
|
-
function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tabListClassName: o, panelClassName:
|
|
795
|
-
let [f,
|
|
796
|
-
e[t]?.disabled || (
|
|
939
|
+
function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tabListClassName: o, panelClassName: c, onChange: d }) {
|
|
940
|
+
let [f, p] = u(r), g = s(), _ = l([]), v = (t) => {
|
|
941
|
+
e[t]?.disabled || (p(t), d?.(t));
|
|
797
942
|
}, y = (e) => {
|
|
798
943
|
_.current[e]?.focus(), v(e);
|
|
799
944
|
}, b = (t) => {
|
|
@@ -803,10 +948,10 @@ function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tab
|
|
|
803
948
|
t.key === "ArrowRight" ? (t.preventDefault(), y(n[(r + 1) % n.length])) : t.key === "ArrowLeft" ? (t.preventDefault(), y(n[(r - 1 + n.length) % n.length])) : t.key === "Home" ? (t.preventDefault(), y(n[0])) : t.key === "End" && (t.preventDefault(), y(n[n.length - 1]));
|
|
804
949
|
}, x = e[f];
|
|
805
950
|
return /* @__PURE__ */ n("div", {
|
|
806
|
-
className:
|
|
951
|
+
className: m("w-full", a),
|
|
807
952
|
children: [/* @__PURE__ */ t("div", {
|
|
808
953
|
role: "tablist",
|
|
809
|
-
className:
|
|
954
|
+
className: m("flex gap-1 p-1 bg-gray-100 dark:bg-gray-800/50 border", E, h[i], o),
|
|
810
955
|
children: e.map((e, r) => /* @__PURE__ */ n("button", {
|
|
811
956
|
ref: (e) => {
|
|
812
957
|
_.current[r] = e;
|
|
@@ -821,15 +966,15 @@ function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tab
|
|
|
821
966
|
disabled: e.disabled,
|
|
822
967
|
onClick: () => v(r),
|
|
823
968
|
onKeyDown: b,
|
|
824
|
-
className:
|
|
825
|
-
children: [e.icon && /* @__PURE__ */ t("span", { className:
|
|
969
|
+
className: m("flex items-center gap-2 px-4 py-2.5 text-sm font-medium", h[i], f === r ? m("bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400 shadow-sm border", E) : m("text-gray-600 dark:text-gray-400 border border-transparent", e.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-200/50 dark:hover:bg-gray-700/50")),
|
|
970
|
+
children: [e.icon && /* @__PURE__ */ t("span", { className: m("w-4 h-4 block shrink-0", e.icon, f === r ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400") }), e.title]
|
|
826
971
|
}, r))
|
|
827
972
|
}), /* @__PURE__ */ t("div", {
|
|
828
973
|
role: "tabpanel",
|
|
829
974
|
id: `${g}-panel-${f}`,
|
|
830
975
|
"aria-labelledby": `${g}-tab-${f}`,
|
|
831
976
|
tabIndex: 0,
|
|
832
|
-
className:
|
|
977
|
+
className: m("mt-3 border bg-white dark:bg-gray-800/50 p-4 overflow-hidden focus:outline-none", E, h[i], c),
|
|
833
978
|
children: /* @__PURE__ */ t("div", {
|
|
834
979
|
className: "tabs-panel-inner",
|
|
835
980
|
children: x?.content
|
|
@@ -839,15 +984,15 @@ function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tab
|
|
|
839
984
|
}
|
|
840
985
|
//#endregion
|
|
841
986
|
//#region src/components/textarea/textarea.tsx
|
|
842
|
-
function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength: o, radius: c = "md", unstyled:
|
|
843
|
-
let b = `${v}-${s()}`, [x,
|
|
844
|
-
|
|
987
|
+
function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength: o, radius: c = "md", unstyled: l = !1, className: d, wrapperClassName: f, value: p, defaultValue: g, onChange: _, id: v = "textarea", ...y }) {
|
|
988
|
+
let b = `${v}-${s()}`, [x, S] = u(typeof g == "string" ? g.length : 0), w = typeof p == "string" ? p.length : p === void 0 ? x : 0, T = i && (a !== void 0 || o !== void 0), E = (e) => {
|
|
989
|
+
p === void 0 && S(e.target.value.length), _?.(e);
|
|
845
990
|
};
|
|
846
991
|
return /* @__PURE__ */ n("div", {
|
|
847
|
-
className:
|
|
992
|
+
className: m("w-full", f),
|
|
848
993
|
children: [
|
|
849
994
|
typeof e == "string" ? /* @__PURE__ */ n("label", {
|
|
850
|
-
className:
|
|
995
|
+
className: m(k, "block mb-1"),
|
|
851
996
|
htmlFor: b,
|
|
852
997
|
children: [e, y.required && /* @__PURE__ */ t("span", {
|
|
853
998
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
@@ -856,12 +1001,12 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
856
1001
|
}) : e,
|
|
857
1002
|
/* @__PURE__ */ t("textarea", {
|
|
858
1003
|
id: b,
|
|
859
|
-
className:
|
|
860
|
-
|
|
861
|
-
|
|
1004
|
+
className: m("w-full min-h-[80px] resize-y disabled:opacity-50 disabled:cursor-not-allowed", !l && [
|
|
1005
|
+
F,
|
|
1006
|
+
h[c],
|
|
862
1007
|
"px-3 py-2 text-sm"
|
|
863
|
-
], !
|
|
864
|
-
...
|
|
1008
|
+
], !l && r && m("border-red-500 dark:border-red-400", "focus:ring-red-500"), d),
|
|
1009
|
+
...p === void 0 ? { defaultValue: g } : { value: p },
|
|
865
1010
|
minLength: a,
|
|
866
1011
|
maxLength: o,
|
|
867
1012
|
onChange: E,
|
|
@@ -869,7 +1014,7 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
869
1014
|
"aria-describedby": r ? `${b}-error` : void 0,
|
|
870
1015
|
...y
|
|
871
1016
|
}),
|
|
872
|
-
T && /* @__PURE__ */ t(
|
|
1017
|
+
T && /* @__PURE__ */ t(C, {
|
|
873
1018
|
current: w,
|
|
874
1019
|
min: a,
|
|
875
1020
|
max: o,
|
|
@@ -878,7 +1023,7 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
878
1023
|
}),
|
|
879
1024
|
r && /* @__PURE__ */ t("p", {
|
|
880
1025
|
id: `${b}-error`,
|
|
881
|
-
className:
|
|
1026
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1"),
|
|
882
1027
|
role: "alert",
|
|
883
1028
|
children: r
|
|
884
1029
|
})
|
|
@@ -887,46 +1032,46 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
887
1032
|
}
|
|
888
1033
|
//#endregion
|
|
889
1034
|
//#region src/stores/theme_store/theme_store.ts
|
|
890
|
-
var
|
|
891
|
-
function
|
|
1035
|
+
var Z = "theme";
|
|
1036
|
+
function be(e) {
|
|
892
1037
|
return e === "light" || e === "dark" || e === "system";
|
|
893
1038
|
}
|
|
894
|
-
function
|
|
1039
|
+
function Q() {
|
|
895
1040
|
return globalThis.window !== void 0 && globalThis.document !== void 0;
|
|
896
1041
|
}
|
|
897
|
-
function
|
|
1042
|
+
function xe(e) {
|
|
898
1043
|
let t = window.matchMedia("(prefers-color-scheme: dark)").matches, n = e === "dark" || e === "system" && t;
|
|
899
1044
|
document.documentElement.classList.toggle("dark", n);
|
|
900
1045
|
}
|
|
901
|
-
function
|
|
902
|
-
if (!
|
|
903
|
-
let e = globalThis.localStorage.getItem(
|
|
904
|
-
return
|
|
1046
|
+
function Se() {
|
|
1047
|
+
if (!Q()) return "system";
|
|
1048
|
+
let e = globalThis.localStorage.getItem(Z);
|
|
1049
|
+
return be(e) ? e : "system";
|
|
905
1050
|
}
|
|
906
|
-
var
|
|
907
|
-
theme:
|
|
1051
|
+
var $ = ae((e) => ({
|
|
1052
|
+
theme: Se(),
|
|
908
1053
|
setTheme: (t) => {
|
|
909
|
-
|
|
1054
|
+
xe(t), Q() && globalThis.localStorage.setItem(Z, t), e({ theme: t });
|
|
910
1055
|
}
|
|
911
1056
|
}));
|
|
912
|
-
|
|
913
|
-
if (e.key !==
|
|
914
|
-
let t =
|
|
915
|
-
|
|
1057
|
+
Q() && (globalThis.addEventListener("storage", (e) => {
|
|
1058
|
+
if (e.key !== Z) return;
|
|
1059
|
+
let t = be(e.newValue) ? e.newValue : "system";
|
|
1060
|
+
xe(t), $.setState({ theme: t });
|
|
916
1061
|
}), globalThis.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
917
|
-
|
|
1062
|
+
$.getState().theme === "system" && xe("system");
|
|
918
1063
|
}));
|
|
919
1064
|
//#endregion
|
|
920
1065
|
//#region src/hooks/use_is_client/use_is_client.tsx
|
|
921
|
-
var
|
|
922
|
-
let [e, t] =
|
|
1066
|
+
var Ce = () => {
|
|
1067
|
+
let [e, t] = u(!1);
|
|
923
1068
|
return o(() => {
|
|
924
1069
|
requestAnimationFrame(() => {
|
|
925
1070
|
t(!0);
|
|
926
1071
|
});
|
|
927
1072
|
}, []), e;
|
|
928
|
-
},
|
|
929
|
-
async function
|
|
1073
|
+
}, we = 750, Te = "ease-in-out";
|
|
1074
|
+
async function Ee({ theme: e, element: t, transitionDuration: n = we, transitionEasing: r = Te, applyThemeCallback: i }) {
|
|
930
1075
|
if (!document.startViewTransition || globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
931
1076
|
i(e);
|
|
932
1077
|
return;
|
|
@@ -940,24 +1085,24 @@ async function Ce({ theme: e, element: t, transitionDuration: n = xe, transition
|
|
|
940
1085
|
pseudoElement: "::view-transition-new(root)"
|
|
941
1086
|
});
|
|
942
1087
|
}
|
|
943
|
-
function
|
|
1088
|
+
function De(e) {
|
|
944
1089
|
return e === "light" ? "dark" : e === "dark" ? "system" : "light";
|
|
945
1090
|
}
|
|
946
1091
|
//#endregion
|
|
947
1092
|
//#region src/components/theme_toggle/theme_toggle.tsx
|
|
948
|
-
var
|
|
1093
|
+
var Oe = {
|
|
949
1094
|
light: "i-tabler-sun text-yellow-500",
|
|
950
1095
|
dark: "i-tabler-moon-stars text-gray-700 dark:text-yellow-500",
|
|
951
1096
|
system: "i-tabler-device-desktop text-blue-500"
|
|
952
|
-
},
|
|
953
|
-
function
|
|
954
|
-
let
|
|
1097
|
+
}, ke = "i-tabler-device-desktop text-gray-400";
|
|
1098
|
+
function Ae({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasing: r, size: i = "md", radius: s }) {
|
|
1099
|
+
let c = $((e) => e.theme), u = $((e) => e.setTheme), d = Ce(), f = l(null);
|
|
955
1100
|
o(() => {
|
|
956
|
-
u(
|
|
1101
|
+
u($.getState().theme);
|
|
957
1102
|
}, [u]);
|
|
958
1103
|
let p = a(async () => {
|
|
959
|
-
let t =
|
|
960
|
-
i && e ? await
|
|
1104
|
+
let t = De(c), i = f.current;
|
|
1105
|
+
i && e ? await Ee({
|
|
961
1106
|
theme: t,
|
|
962
1107
|
element: i,
|
|
963
1108
|
transitionDuration: n,
|
|
@@ -965,16 +1110,16 @@ function Ee({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasi
|
|
|
965
1110
|
applyThemeCallback: u
|
|
966
1111
|
}) : u(t);
|
|
967
1112
|
}, [
|
|
968
|
-
|
|
1113
|
+
c,
|
|
969
1114
|
e,
|
|
970
1115
|
n,
|
|
971
1116
|
r,
|
|
972
1117
|
u
|
|
973
1118
|
]);
|
|
974
|
-
return /* @__PURE__ */ t(
|
|
1119
|
+
return /* @__PURE__ */ t(B, {
|
|
975
1120
|
ref: f,
|
|
976
|
-
icon: d ?
|
|
977
|
-
"aria-label": `Thème actuel: ${
|
|
1121
|
+
icon: d ? Oe[c] : ke,
|
|
1122
|
+
"aria-label": `Thème actuel: ${c}`,
|
|
978
1123
|
size: i,
|
|
979
1124
|
radius: s,
|
|
980
1125
|
onClick: () => {
|
|
@@ -984,11 +1129,11 @@ function Ee({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasi
|
|
|
984
1129
|
}
|
|
985
1130
|
//#endregion
|
|
986
1131
|
//#region src/hooks/use_run_after_animation/use_run_after_animation.ts
|
|
987
|
-
function
|
|
1132
|
+
function je(e) {
|
|
988
1133
|
return a((t) => {
|
|
989
1134
|
let n = setTimeout(t, e);
|
|
990
1135
|
return () => clearTimeout(n);
|
|
991
1136
|
}, [e]);
|
|
992
1137
|
}
|
|
993
1138
|
//#endregion
|
|
994
|
-
export {
|
|
1139
|
+
export { F as BASE_INPUT_STYLES, b as Button, C as CharacterCount, j as Checkbox, P as ClientOnly, L as Combobox, ue as ConfirmModal, B as IconButton, I as Input, pe as Modal, me as ModalProvider, he as RadioOptions, ge as Select, _e as Switch, ve as Tabs, ye as Textarea, Ae as ThemeToggle, M as useClientOnly, X as useDisableHotkeysWhileMounted, J as useGlobalHotkeysStore, Ce as useIsClient, je as useRunAfterAnimation, $ as useThemeStore, N as withClientOnly };
|