@minimalstuff/ui 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +30 -2
- package/dist/minimalstuff-ui.css +1 -1
- package/dist/minimalstuff-ui.js +399 -257
- 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
|
+
}, ee = (e) => {
|
|
275
|
+
j(e.target.value), N(!0), I(!0), R(0);
|
|
276
|
+
}, te = (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
|
+
}, G = (e) => {
|
|
282
|
+
if (e.key === "ArrowDown") {
|
|
283
|
+
e.preventDefault(), P ? te(1) : V();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (e.key === "ArrowUp") {
|
|
287
|
+
e.preventDefault(), P ? te(-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
|
+
}, K = 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: ee,
|
|
329
|
+
onFocus: V,
|
|
330
|
+
onBlur: H,
|
|
331
|
+
onKeyDown: G,
|
|
332
|
+
"aria-expanded": P,
|
|
333
|
+
"aria-controls": C,
|
|
334
|
+
"aria-autocomplete": "list",
|
|
335
|
+
"aria-activedescendant": K,
|
|
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,70 @@ function L(e, t = 0) {
|
|
|
408
537
|
}
|
|
409
538
|
//#endregion
|
|
410
539
|
//#region src/components/modal/modal_shell.tsx
|
|
411
|
-
var
|
|
540
|
+
var ee = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", te = {
|
|
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 G({ 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 = s();
|
|
419
548
|
o(() => {
|
|
420
|
-
document.body.style.overflow = "hidden",
|
|
549
|
+
document.body.style.overflow = "hidden", x.current = document.activeElement, b.current?.focus();
|
|
421
550
|
let e = requestAnimationFrame(() => {
|
|
422
|
-
requestAnimationFrame(() =>
|
|
551
|
+
requestAnimationFrame(() => y(!0));
|
|
423
552
|
});
|
|
424
553
|
return () => {
|
|
425
554
|
cancelAnimationFrame(e), document.body.style.overflow = "";
|
|
426
555
|
};
|
|
427
556
|
}, []), o(() => {
|
|
428
|
-
e &&
|
|
557
|
+
e && x.current?.focus();
|
|
429
558
|
}, [e]), o(() => {
|
|
430
559
|
if (e) return;
|
|
431
560
|
let t = (e) => {
|
|
432
561
|
if (e.key === "Escape") {
|
|
433
|
-
r();
|
|
562
|
+
_ && r();
|
|
434
563
|
return;
|
|
435
564
|
}
|
|
436
565
|
if (e.key !== "Tab") return;
|
|
437
|
-
let t =
|
|
566
|
+
let t = b.current;
|
|
438
567
|
if (!t) return;
|
|
439
|
-
let n = Array.from(t.querySelectorAll(
|
|
568
|
+
let n = Array.from(t.querySelectorAll(ee));
|
|
440
569
|
if (n.length === 0) return;
|
|
441
570
|
let i = n[0], a = n[n.length - 1];
|
|
442
571
|
e.shiftKey && document.activeElement === i ? (e.preventDefault(), a.focus()) : !e.shiftKey && document.activeElement === a && (e.preventDefault(), i.focus());
|
|
443
572
|
};
|
|
444
573
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
445
|
-
}, [
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
574
|
+
}, [
|
|
575
|
+
e,
|
|
576
|
+
r,
|
|
577
|
+
_
|
|
578
|
+
]);
|
|
579
|
+
let C = () => {
|
|
580
|
+
!e && _ && r();
|
|
581
|
+
}, w = v && !e;
|
|
582
|
+
return f(/* @__PURE__ */ n("div", {
|
|
583
|
+
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", w ? "opacity-100" : "opacity-0"),
|
|
584
|
+
onClick: C,
|
|
452
585
|
children: [/* @__PURE__ */ t("div", {
|
|
453
|
-
className:
|
|
586
|
+
className: m("fixed inset-0 bg-black/60 backdrop-blur-md", "transition-opacity duration-200 ease-out", w ? "opacity-100" : "opacity-0"),
|
|
454
587
|
"aria-hidden": "true"
|
|
455
588
|
}), /* @__PURE__ */ n("div", {
|
|
456
|
-
ref:
|
|
589
|
+
ref: b,
|
|
457
590
|
role: "dialog",
|
|
458
591
|
"aria-modal": "true",
|
|
459
|
-
"aria-labelledby": i ?
|
|
592
|
+
"aria-labelledby": i ? S : void 0,
|
|
460
593
|
tabIndex: -1,
|
|
461
|
-
className:
|
|
594
|
+
className: m("relative w-full", te[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", w ? "opacity-100 scale-100 translate-y-0" : "opacity-0 scale-95 translate-y-1"),
|
|
462
595
|
onClick: (e) => e.stopPropagation(),
|
|
463
596
|
children: [
|
|
464
597
|
i && /* @__PURE__ */ n("div", {
|
|
465
598
|
className: "flex items-center justify-between gap-4 px-6 pt-5 pb-4 flex-shrink-0",
|
|
466
599
|
children: [/* @__PURE__ */ t("h2", {
|
|
467
|
-
id:
|
|
600
|
+
id: S,
|
|
468
601
|
className: "text-base font-medium tracking-tight text-gray-900 dark:text-gray-100",
|
|
469
602
|
children: i
|
|
470
|
-
}), /* @__PURE__ */ t(
|
|
603
|
+
}), _ && /* @__PURE__ */ t(B, {
|
|
471
604
|
icon: "i-mdi-close",
|
|
472
605
|
onClick: r,
|
|
473
606
|
"aria-label": "Close",
|
|
@@ -478,12 +611,12 @@ function R({ isEnded: e, onDismiss: r, title: i, children: a, footer: u, size: f
|
|
|
478
611
|
})]
|
|
479
612
|
}),
|
|
480
613
|
/* @__PURE__ */ t("div", {
|
|
481
|
-
className:
|
|
614
|
+
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
615
|
children: a
|
|
483
616
|
}),
|
|
484
|
-
|
|
485
|
-
className:
|
|
486
|
-
children:
|
|
617
|
+
c && /* @__PURE__ */ t("div", {
|
|
618
|
+
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"),
|
|
619
|
+
children: c
|
|
487
620
|
})
|
|
488
621
|
]
|
|
489
622
|
})]
|
|
@@ -491,7 +624,7 @@ function R({ isEnded: e, onDismiss: r, title: i, children: a, footer: u, size: f
|
|
|
491
624
|
}
|
|
492
625
|
//#endregion
|
|
493
626
|
//#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
|
|
627
|
+
var K = (e) => {
|
|
495
628
|
let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
|
|
496
629
|
let i = typeof e == "function" ? e(t) : e;
|
|
497
630
|
if (!Object.is(i, t)) {
|
|
@@ -505,51 +638,51 @@ var z = (e) => {
|
|
|
505
638
|
subscribe: (e) => (n.add(e), () => n.delete(e))
|
|
506
639
|
}, o = t = e(r, i, a);
|
|
507
640
|
return a;
|
|
508
|
-
},
|
|
509
|
-
function
|
|
641
|
+
}, ne = ((e) => e ? K(e) : K), re = (e) => e;
|
|
642
|
+
function ie(e, t = re) {
|
|
510
643
|
let n = r.useSyncExternalStore(e.subscribe, r.useCallback(() => t(e.getState()), [e, t]), r.useCallback(() => t(e.getInitialState()), [e, t]));
|
|
511
644
|
return r.useDebugValue(n), n;
|
|
512
645
|
}
|
|
513
|
-
var
|
|
514
|
-
let t =
|
|
646
|
+
var ae = (e) => {
|
|
647
|
+
let t = ne(e), n = (e) => ie(t, e);
|
|
515
648
|
return Object.assign(n, t), n;
|
|
516
|
-
},
|
|
649
|
+
}, oe = ((e) => e ? ae(e) : ae), q = oe((e) => ({
|
|
517
650
|
globalHotkeysEnabled: !0,
|
|
518
651
|
setGlobalHotkeysEnabled: (t) => e({ globalHotkeysEnabled: t })
|
|
519
|
-
})),
|
|
520
|
-
function
|
|
521
|
-
o(() => (
|
|
522
|
-
--
|
|
652
|
+
})), J = 0;
|
|
653
|
+
function Y() {
|
|
654
|
+
o(() => (J += 1, J === 1 && q.getState().setGlobalHotkeysEnabled(!1), () => {
|
|
655
|
+
--J, J === 0 && q.getState().setGlobalHotkeysEnabled(!0);
|
|
523
656
|
}), []);
|
|
524
657
|
}
|
|
525
658
|
//#endregion
|
|
526
659
|
//#region src/components/modal/confirm_modal.tsx
|
|
527
|
-
var
|
|
660
|
+
var se = {
|
|
528
661
|
red: "danger",
|
|
529
662
|
blue: "primary",
|
|
530
663
|
green: "success"
|
|
531
|
-
},
|
|
664
|
+
}, ce = {
|
|
532
665
|
red: "i-mdi-alert-circle",
|
|
533
666
|
blue: "i-mdi-help-circle",
|
|
534
667
|
green: "i-mdi-check-circle"
|
|
535
|
-
},
|
|
668
|
+
}, le = {
|
|
536
669
|
red: "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400",
|
|
537
670
|
blue: "bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-400",
|
|
538
671
|
green: "bg-green-50 text-green-600 dark:bg-green-500/10 dark:text-green-400"
|
|
539
672
|
};
|
|
540
|
-
function
|
|
673
|
+
function ue({ title: e, color: r }) {
|
|
541
674
|
return /* @__PURE__ */ n("div", {
|
|
542
675
|
className: "flex items-center gap-3",
|
|
543
676
|
children: [/* @__PURE__ */ t("span", {
|
|
544
|
-
className:
|
|
677
|
+
className: m("flex h-9 w-9 shrink-0 items-center justify-center rounded-full", le[r]),
|
|
545
678
|
"aria-hidden": "true",
|
|
546
|
-
children: /* @__PURE__ */ t("span", { className:
|
|
679
|
+
children: /* @__PURE__ */ t("span", { className: m(ce[r], "h-5 w-5") })
|
|
547
680
|
}), e]
|
|
548
681
|
});
|
|
549
682
|
}
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
let [f, p] =
|
|
683
|
+
var de = W(({ call: r, title: i, children: a, confirmLabel: o, cancelLabel: s, confirmColor: c, radius: l, onConfirm: d }) => {
|
|
684
|
+
Y();
|
|
685
|
+
let [f, p] = u(!1), m = () => r.end(!1), h = async () => {
|
|
553
686
|
if (!d) {
|
|
554
687
|
r.end(!0);
|
|
555
688
|
return;
|
|
@@ -560,25 +693,25 @@ var G = L(({ call: r, title: i, children: a, confirmLabel: o, cancelLabel: s, co
|
|
|
560
693
|
} finally {
|
|
561
694
|
p(!1);
|
|
562
695
|
}
|
|
563
|
-
}, g = f, _ = o ?? "Confirm", v = s ?? "Cancel",
|
|
564
|
-
return /* @__PURE__ */ t(
|
|
696
|
+
}, g = f, _ = o ?? "Confirm", v = s ?? "Cancel", y = c ?? "blue";
|
|
697
|
+
return /* @__PURE__ */ t(G, {
|
|
565
698
|
isEnded: r.ended,
|
|
566
699
|
onDismiss: m,
|
|
567
|
-
title: /* @__PURE__ */ t(
|
|
700
|
+
title: /* @__PURE__ */ t(ue, {
|
|
568
701
|
title: i,
|
|
569
|
-
color:
|
|
702
|
+
color: y
|
|
570
703
|
}),
|
|
571
704
|
size: "sm",
|
|
572
|
-
radius:
|
|
573
|
-
footer: /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(
|
|
705
|
+
radius: l,
|
|
706
|
+
footer: /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(b, {
|
|
574
707
|
variant: "outline",
|
|
575
708
|
color: "neutral",
|
|
576
709
|
onClick: m,
|
|
577
710
|
disabled: g,
|
|
578
711
|
size: "sm",
|
|
579
712
|
children: v
|
|
580
|
-
}), /* @__PURE__ */ t(
|
|
581
|
-
color:
|
|
713
|
+
}), /* @__PURE__ */ t(b, {
|
|
714
|
+
color: se[y],
|
|
582
715
|
onClick: () => {
|
|
583
716
|
h();
|
|
584
717
|
},
|
|
@@ -589,63 +722,72 @@ var G = L(({ call: r, title: i, children: a, confirmLabel: o, cancelLabel: s, co
|
|
|
589
722
|
})] }),
|
|
590
723
|
children: a
|
|
591
724
|
});
|
|
592
|
-
}, 200),
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
725
|
+
}, 200), fe = 200;
|
|
726
|
+
function pe(e, t) {
|
|
727
|
+
return typeof e == "function" ? e(t) : e;
|
|
728
|
+
}
|
|
729
|
+
var me = W(({ call: e, title: n, children: r, footer: i, size: a, radius: o, className: s, dismissible: c }) => {
|
|
730
|
+
Y();
|
|
731
|
+
let l = () => e.end();
|
|
732
|
+
return /* @__PURE__ */ t(G, {
|
|
733
|
+
isEnded: e.ended,
|
|
734
|
+
onDismiss: l,
|
|
735
|
+
title: n,
|
|
736
|
+
footer: pe(i, l),
|
|
737
|
+
size: a,
|
|
738
|
+
radius: o,
|
|
739
|
+
className: s,
|
|
740
|
+
dismissible: c,
|
|
741
|
+
children: pe(r, l)
|
|
742
|
+
});
|
|
743
|
+
}, fe);
|
|
602
744
|
//#endregion
|
|
603
745
|
//#region src/components/modal_provider/modal_provider.tsx
|
|
604
|
-
function
|
|
605
|
-
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(
|
|
746
|
+
function he() {
|
|
747
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(me, {}), /* @__PURE__ */ t(de, {})] });
|
|
606
748
|
}
|
|
607
749
|
//#endregion
|
|
608
750
|
//#region src/components/radio_options/radio_options.tsx
|
|
609
|
-
function
|
|
610
|
-
let S = `${b}-${s()}`,
|
|
751
|
+
function ge({ 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 }) {
|
|
752
|
+
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
753
|
value: e,
|
|
612
754
|
label: e
|
|
613
|
-
} : e),
|
|
755
|
+
} : e), j = `${S}-error`, M = (e) => {
|
|
614
756
|
D || E(e), o?.(e);
|
|
615
757
|
};
|
|
616
758
|
return /* @__PURE__ */ n("fieldset", {
|
|
617
|
-
className:
|
|
618
|
-
disabled:
|
|
619
|
-
"aria-describedby": d ?
|
|
759
|
+
className: m("m-0 border-0 p-0", y),
|
|
760
|
+
disabled: p,
|
|
761
|
+
"aria-describedby": d ? j : void 0,
|
|
620
762
|
"aria-required": f,
|
|
621
763
|
...x,
|
|
622
764
|
children: [
|
|
623
|
-
|
|
624
|
-
className:
|
|
625
|
-
children: [
|
|
765
|
+
l && /* @__PURE__ */ n("legend", {
|
|
766
|
+
className: m("text-sm font-medium text-gray-700 dark:text-gray-300", "mb-2", v),
|
|
767
|
+
children: [l, f && /* @__PURE__ */ t("span", {
|
|
626
768
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
627
769
|
children: "*"
|
|
628
770
|
})]
|
|
629
771
|
}),
|
|
630
772
|
/* @__PURE__ */ t("div", {
|
|
631
|
-
className:
|
|
773
|
+
className: m(r === "horizontal" ? "flex flex-row gap-2" : "flex flex-col gap-2"),
|
|
632
774
|
children: k.map((e, i) => {
|
|
633
|
-
let a = `${S}-${i}`, o = `${S}-${i}-desc`, s = O === e.value, c =
|
|
775
|
+
let a = `${S}-${i}`, o = `${S}-${i}-desc`, s = O === e.value, c = p ?? e.disabled;
|
|
634
776
|
return /* @__PURE__ */ n("label", {
|
|
635
777
|
htmlFor: a,
|
|
636
|
-
className:
|
|
637
|
-
|
|
778
|
+
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", !_ && [
|
|
779
|
+
h[g],
|
|
638
780
|
"border px-3 py-2.5",
|
|
639
|
-
s ? d ?
|
|
781
|
+
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
782
|
], c && "cursor-not-allowed opacity-50"),
|
|
641
783
|
children: [
|
|
642
784
|
/* @__PURE__ */ t("input", {
|
|
643
785
|
type: "radio",
|
|
644
786
|
id: a,
|
|
645
|
-
name:
|
|
787
|
+
name: C,
|
|
646
788
|
value: e.value,
|
|
647
789
|
checked: s,
|
|
648
|
-
onChange: () =>
|
|
790
|
+
onChange: () => M(e.value),
|
|
649
791
|
disabled: c,
|
|
650
792
|
required: f && i === 0,
|
|
651
793
|
"aria-invalid": d ? !0 : void 0,
|
|
@@ -653,24 +795,24 @@ function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a
|
|
|
653
795
|
className: "sr-only"
|
|
654
796
|
}),
|
|
655
797
|
/* @__PURE__ */ t("span", {
|
|
656
|
-
className:
|
|
798
|
+
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
799
|
"aria-hidden": !0,
|
|
658
|
-
children: s && /* @__PURE__ */ t("span", { className:
|
|
800
|
+
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
801
|
}),
|
|
660
802
|
/* @__PURE__ */ n("span", {
|
|
661
803
|
className: "flex min-w-0 flex-col",
|
|
662
804
|
children: [/* @__PURE__ */ n("span", {
|
|
663
805
|
className: "flex items-center gap-1.5",
|
|
664
806
|
children: [e.icon && /* @__PURE__ */ t("span", {
|
|
665
|
-
className:
|
|
807
|
+
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
808
|
"aria-hidden": !0
|
|
667
809
|
}), /* @__PURE__ */ t("span", {
|
|
668
|
-
className:
|
|
810
|
+
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
811
|
children: e.label
|
|
670
812
|
})]
|
|
671
813
|
}), e.description && /* @__PURE__ */ t("span", {
|
|
672
814
|
id: o,
|
|
673
|
-
className:
|
|
815
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "mt-0.5"),
|
|
674
816
|
children: e.description
|
|
675
817
|
})]
|
|
676
818
|
})
|
|
@@ -679,8 +821,8 @@ function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a
|
|
|
679
821
|
})
|
|
680
822
|
}),
|
|
681
823
|
d && /* @__PURE__ */ t("p", {
|
|
682
|
-
id:
|
|
683
|
-
className:
|
|
824
|
+
id: j,
|
|
825
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-2"),
|
|
684
826
|
role: "alert",
|
|
685
827
|
children: d
|
|
686
828
|
})
|
|
@@ -689,13 +831,13 @@ function he({ options: e, orientation: r = "vertical", value: i, defaultValue: a
|
|
|
689
831
|
}
|
|
690
832
|
//#endregion
|
|
691
833
|
//#region src/components/select/select.tsx
|
|
692
|
-
function
|
|
834
|
+
function _e({ 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
835
|
let v = `${g}-${s()}`;
|
|
694
836
|
return /* @__PURE__ */ n("div", {
|
|
695
|
-
className:
|
|
837
|
+
className: m("w-full", u),
|
|
696
838
|
children: [
|
|
697
839
|
typeof r == "string" ? /* @__PURE__ */ n("label", {
|
|
698
|
-
className:
|
|
840
|
+
className: m(k, "block mb-1"),
|
|
699
841
|
htmlFor: v,
|
|
700
842
|
children: [r, _.required && /* @__PURE__ */ t("span", {
|
|
701
843
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
@@ -704,14 +846,14 @@ function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md",
|
|
|
704
846
|
}) : r,
|
|
705
847
|
/* @__PURE__ */ n("select", {
|
|
706
848
|
id: v,
|
|
707
|
-
className:
|
|
708
|
-
|
|
709
|
-
|
|
849
|
+
className: m("w-full disabled:opacity-50 disabled:cursor-not-allowed", !c && [
|
|
850
|
+
F,
|
|
851
|
+
h[o],
|
|
710
852
|
"pl-3 pr-8 py-2 text-sm appearance-none bg-[length:1rem_1rem] bg-[position:right_0.5rem_center] bg-no-repeat",
|
|
711
853
|
"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 &&
|
|
854
|
+
], !c && i && m("border-red-500 dark:border-red-400", "focus:ring-red-500"), l),
|
|
713
855
|
...d === void 0 ? { defaultValue: f } : { value: d },
|
|
714
|
-
onChange:
|
|
856
|
+
onChange: p,
|
|
715
857
|
"aria-invalid": !!i,
|
|
716
858
|
"aria-describedby": i ? `${v}-error` : void 0,
|
|
717
859
|
..._,
|
|
@@ -725,7 +867,7 @@ function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md",
|
|
|
725
867
|
}),
|
|
726
868
|
i && /* @__PURE__ */ t("p", {
|
|
727
869
|
id: `${v}-error`,
|
|
728
|
-
className:
|
|
870
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1"),
|
|
729
871
|
role: "alert",
|
|
730
872
|
children: i
|
|
731
873
|
})
|
|
@@ -734,16 +876,16 @@ function ge({ options: e, label: r, error: i, placeholder: a, radius: o = "md",
|
|
|
734
876
|
}
|
|
735
877
|
//#endregion
|
|
736
878
|
//#region src/components/switch/switch.tsx
|
|
737
|
-
function
|
|
738
|
-
let g = `${
|
|
879
|
+
function ve({ label: r, description: i, error: a, className: o, wrapperClassName: c, checked: l, defaultChecked: d = !1, onChange: f, id: p = "switch", ...h }) {
|
|
880
|
+
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
881
|
return /* @__PURE__ */ n("div", {
|
|
740
|
-
className:
|
|
882
|
+
className: m("w-full", c),
|
|
741
883
|
children: [
|
|
742
884
|
/* @__PURE__ */ n("label", {
|
|
743
885
|
htmlFor: g,
|
|
744
|
-
className:
|
|
886
|
+
className: m("flex items-center gap-3 cursor-pointer", h.disabled && "cursor-not-allowed opacity-50"),
|
|
745
887
|
children: [/* @__PURE__ */ n("span", {
|
|
746
|
-
className:
|
|
888
|
+
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
889
|
children: [/* @__PURE__ */ t("input", {
|
|
748
890
|
type: "checkbox",
|
|
749
891
|
role: "switch",
|
|
@@ -757,11 +899,11 @@ function _e({ label: r, description: i, error: a, className: o, wrapperClassName
|
|
|
757
899
|
"aria-describedby": x,
|
|
758
900
|
...h
|
|
759
901
|
}), /* @__PURE__ */ t("span", {
|
|
760
|
-
className:
|
|
902
|
+
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
903
|
"aria-hidden": !0
|
|
762
904
|
})]
|
|
763
905
|
}), r && /* @__PURE__ */ t(e, { children: typeof r == "string" ? /* @__PURE__ */ n("span", {
|
|
764
|
-
className:
|
|
906
|
+
className: m("text-sm font-medium text-gray-700 dark:text-gray-300", "select-none"),
|
|
765
907
|
children: [r, h.required && /* @__PURE__ */ t("span", {
|
|
766
908
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
767
909
|
children: "*"
|
|
@@ -773,16 +915,16 @@ function _e({ label: r, description: i, error: a, className: o, wrapperClassName
|
|
|
773
915
|
}),
|
|
774
916
|
i && (typeof i == "string" ? /* @__PURE__ */ t("p", {
|
|
775
917
|
id: `${g}-description`,
|
|
776
|
-
className:
|
|
918
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "mt-1 ml-14"),
|
|
777
919
|
children: i
|
|
778
920
|
}) : /* @__PURE__ */ t("span", {
|
|
779
921
|
id: `${g}-description`,
|
|
780
|
-
className:
|
|
922
|
+
className: m("text-xs text-gray-500 dark:text-gray-400", "block mt-1 ml-14"),
|
|
781
923
|
children: i
|
|
782
924
|
})),
|
|
783
925
|
a && /* @__PURE__ */ t("p", {
|
|
784
926
|
id: `${g}-error`,
|
|
785
|
-
className:
|
|
927
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1 ml-14"),
|
|
786
928
|
role: "alert",
|
|
787
929
|
children: a
|
|
788
930
|
})
|
|
@@ -791,9 +933,9 @@ function _e({ label: r, description: i, error: a, className: o, wrapperClassName
|
|
|
791
933
|
}
|
|
792
934
|
//#endregion
|
|
793
935
|
//#region src/components/tabs/tabs.tsx
|
|
794
|
-
function
|
|
795
|
-
let [f,
|
|
796
|
-
e[t]?.disabled || (
|
|
936
|
+
function ye({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tabListClassName: o, panelClassName: c, onChange: d }) {
|
|
937
|
+
let [f, p] = u(r), g = s(), _ = l([]), v = (t) => {
|
|
938
|
+
e[t]?.disabled || (p(t), d?.(t));
|
|
797
939
|
}, y = (e) => {
|
|
798
940
|
_.current[e]?.focus(), v(e);
|
|
799
941
|
}, b = (t) => {
|
|
@@ -803,10 +945,10 @@ function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tab
|
|
|
803
945
|
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
946
|
}, x = e[f];
|
|
805
947
|
return /* @__PURE__ */ n("div", {
|
|
806
|
-
className:
|
|
948
|
+
className: m("w-full", a),
|
|
807
949
|
children: [/* @__PURE__ */ t("div", {
|
|
808
950
|
role: "tablist",
|
|
809
|
-
className:
|
|
951
|
+
className: m("flex gap-1 p-1 bg-gray-100 dark:bg-gray-800/50 border", E, h[i], o),
|
|
810
952
|
children: e.map((e, r) => /* @__PURE__ */ n("button", {
|
|
811
953
|
ref: (e) => {
|
|
812
954
|
_.current[r] = e;
|
|
@@ -821,15 +963,15 @@ function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tab
|
|
|
821
963
|
disabled: e.disabled,
|
|
822
964
|
onClick: () => v(r),
|
|
823
965
|
onKeyDown: b,
|
|
824
|
-
className:
|
|
825
|
-
children: [e.icon && /* @__PURE__ */ t("span", { className:
|
|
966
|
+
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")),
|
|
967
|
+
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
968
|
}, r))
|
|
827
969
|
}), /* @__PURE__ */ t("div", {
|
|
828
970
|
role: "tabpanel",
|
|
829
971
|
id: `${g}-panel-${f}`,
|
|
830
972
|
"aria-labelledby": `${g}-tab-${f}`,
|
|
831
973
|
tabIndex: 0,
|
|
832
|
-
className:
|
|
974
|
+
className: m("mt-3 border bg-white dark:bg-gray-800/50 p-4 overflow-hidden focus:outline-none", E, h[i], c),
|
|
833
975
|
children: /* @__PURE__ */ t("div", {
|
|
834
976
|
className: "tabs-panel-inner",
|
|
835
977
|
children: x?.content
|
|
@@ -839,15 +981,15 @@ function ve({ items: e, defaultIndex: r = 0, radius: i = "md", className: a, tab
|
|
|
839
981
|
}
|
|
840
982
|
//#endregion
|
|
841
983
|
//#region src/components/textarea/textarea.tsx
|
|
842
|
-
function
|
|
843
|
-
let b = `${v}-${s()}`, [x,
|
|
844
|
-
|
|
984
|
+
function be({ 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 }) {
|
|
985
|
+
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) => {
|
|
986
|
+
p === void 0 && S(e.target.value.length), _?.(e);
|
|
845
987
|
};
|
|
846
988
|
return /* @__PURE__ */ n("div", {
|
|
847
|
-
className:
|
|
989
|
+
className: m("w-full", f),
|
|
848
990
|
children: [
|
|
849
991
|
typeof e == "string" ? /* @__PURE__ */ n("label", {
|
|
850
|
-
className:
|
|
992
|
+
className: m(k, "block mb-1"),
|
|
851
993
|
htmlFor: b,
|
|
852
994
|
children: [e, y.required && /* @__PURE__ */ t("span", {
|
|
853
995
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
@@ -856,12 +998,12 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
856
998
|
}) : e,
|
|
857
999
|
/* @__PURE__ */ t("textarea", {
|
|
858
1000
|
id: b,
|
|
859
|
-
className:
|
|
860
|
-
|
|
861
|
-
|
|
1001
|
+
className: m("w-full min-h-[80px] resize-y disabled:opacity-50 disabled:cursor-not-allowed", !l && [
|
|
1002
|
+
F,
|
|
1003
|
+
h[c],
|
|
862
1004
|
"px-3 py-2 text-sm"
|
|
863
|
-
], !
|
|
864
|
-
...
|
|
1005
|
+
], !l && r && m("border-red-500 dark:border-red-400", "focus:ring-red-500"), d),
|
|
1006
|
+
...p === void 0 ? { defaultValue: g } : { value: p },
|
|
865
1007
|
minLength: a,
|
|
866
1008
|
maxLength: o,
|
|
867
1009
|
onChange: E,
|
|
@@ -869,7 +1011,7 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
869
1011
|
"aria-describedby": r ? `${b}-error` : void 0,
|
|
870
1012
|
...y
|
|
871
1013
|
}),
|
|
872
|
-
T && /* @__PURE__ */ t(
|
|
1014
|
+
T && /* @__PURE__ */ t(C, {
|
|
873
1015
|
current: w,
|
|
874
1016
|
min: a,
|
|
875
1017
|
max: o,
|
|
@@ -878,7 +1020,7 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
878
1020
|
}),
|
|
879
1021
|
r && /* @__PURE__ */ t("p", {
|
|
880
1022
|
id: `${b}-error`,
|
|
881
|
-
className:
|
|
1023
|
+
className: m("text-xs text-red-600 dark:text-red-400", "mt-1"),
|
|
882
1024
|
role: "alert",
|
|
883
1025
|
children: r
|
|
884
1026
|
})
|
|
@@ -887,46 +1029,46 @@ function ye({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength
|
|
|
887
1029
|
}
|
|
888
1030
|
//#endregion
|
|
889
1031
|
//#region src/stores/theme_store/theme_store.ts
|
|
890
|
-
var
|
|
891
|
-
function
|
|
1032
|
+
var X = "theme";
|
|
1033
|
+
function xe(e) {
|
|
892
1034
|
return e === "light" || e === "dark" || e === "system";
|
|
893
1035
|
}
|
|
894
|
-
function
|
|
1036
|
+
function Z() {
|
|
895
1037
|
return globalThis.window !== void 0 && globalThis.document !== void 0;
|
|
896
1038
|
}
|
|
897
|
-
function
|
|
1039
|
+
function Q(e) {
|
|
898
1040
|
let t = window.matchMedia("(prefers-color-scheme: dark)").matches, n = e === "dark" || e === "system" && t;
|
|
899
1041
|
document.documentElement.classList.toggle("dark", n);
|
|
900
1042
|
}
|
|
901
|
-
function
|
|
902
|
-
if (!
|
|
903
|
-
let e = globalThis.localStorage.getItem(
|
|
904
|
-
return
|
|
1043
|
+
function Se() {
|
|
1044
|
+
if (!Z()) return "system";
|
|
1045
|
+
let e = globalThis.localStorage.getItem(X);
|
|
1046
|
+
return xe(e) ? e : "system";
|
|
905
1047
|
}
|
|
906
|
-
var
|
|
907
|
-
theme:
|
|
1048
|
+
var $ = oe((e) => ({
|
|
1049
|
+
theme: Se(),
|
|
908
1050
|
setTheme: (t) => {
|
|
909
|
-
|
|
1051
|
+
Q(t), Z() && globalThis.localStorage.setItem(X, t), e({ theme: t });
|
|
910
1052
|
}
|
|
911
1053
|
}));
|
|
912
|
-
|
|
913
|
-
if (e.key !==
|
|
914
|
-
let t =
|
|
915
|
-
|
|
1054
|
+
Z() && (globalThis.addEventListener("storage", (e) => {
|
|
1055
|
+
if (e.key !== X) return;
|
|
1056
|
+
let t = xe(e.newValue) ? e.newValue : "system";
|
|
1057
|
+
Q(t), $.setState({ theme: t });
|
|
916
1058
|
}), globalThis.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
917
|
-
|
|
1059
|
+
$.getState().theme === "system" && Q("system");
|
|
918
1060
|
}));
|
|
919
1061
|
//#endregion
|
|
920
1062
|
//#region src/hooks/use_is_client/use_is_client.tsx
|
|
921
|
-
var
|
|
922
|
-
let [e, t] =
|
|
1063
|
+
var Ce = () => {
|
|
1064
|
+
let [e, t] = u(!1);
|
|
923
1065
|
return o(() => {
|
|
924
1066
|
requestAnimationFrame(() => {
|
|
925
1067
|
t(!0);
|
|
926
1068
|
});
|
|
927
1069
|
}, []), e;
|
|
928
|
-
},
|
|
929
|
-
async function
|
|
1070
|
+
}, we = 750, Te = "ease-in-out";
|
|
1071
|
+
async function Ee({ theme: e, element: t, transitionDuration: n = we, transitionEasing: r = Te, applyThemeCallback: i }) {
|
|
930
1072
|
if (!document.startViewTransition || globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
931
1073
|
i(e);
|
|
932
1074
|
return;
|
|
@@ -940,24 +1082,24 @@ async function Ce({ theme: e, element: t, transitionDuration: n = xe, transition
|
|
|
940
1082
|
pseudoElement: "::view-transition-new(root)"
|
|
941
1083
|
});
|
|
942
1084
|
}
|
|
943
|
-
function
|
|
1085
|
+
function De(e) {
|
|
944
1086
|
return e === "light" ? "dark" : e === "dark" ? "system" : "light";
|
|
945
1087
|
}
|
|
946
1088
|
//#endregion
|
|
947
1089
|
//#region src/components/theme_toggle/theme_toggle.tsx
|
|
948
|
-
var
|
|
1090
|
+
var Oe = {
|
|
949
1091
|
light: "i-tabler-sun text-yellow-500",
|
|
950
1092
|
dark: "i-tabler-moon-stars text-gray-700 dark:text-yellow-500",
|
|
951
1093
|
system: "i-tabler-device-desktop text-blue-500"
|
|
952
|
-
},
|
|
953
|
-
function
|
|
954
|
-
let
|
|
1094
|
+
}, ke = "i-tabler-device-desktop text-gray-400";
|
|
1095
|
+
function Ae({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasing: r, size: i = "md", radius: s }) {
|
|
1096
|
+
let c = $((e) => e.theme), u = $((e) => e.setTheme), d = Ce(), f = l(null);
|
|
955
1097
|
o(() => {
|
|
956
|
-
u(
|
|
1098
|
+
u($.getState().theme);
|
|
957
1099
|
}, [u]);
|
|
958
1100
|
let p = a(async () => {
|
|
959
|
-
let t =
|
|
960
|
-
i && e ? await
|
|
1101
|
+
let t = De(c), i = f.current;
|
|
1102
|
+
i && e ? await Ee({
|
|
961
1103
|
theme: t,
|
|
962
1104
|
element: i,
|
|
963
1105
|
transitionDuration: n,
|
|
@@ -965,16 +1107,16 @@ function Ee({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasi
|
|
|
965
1107
|
applyThemeCallback: u
|
|
966
1108
|
}) : u(t);
|
|
967
1109
|
}, [
|
|
968
|
-
|
|
1110
|
+
c,
|
|
969
1111
|
e,
|
|
970
1112
|
n,
|
|
971
1113
|
r,
|
|
972
1114
|
u
|
|
973
1115
|
]);
|
|
974
|
-
return /* @__PURE__ */ t(
|
|
1116
|
+
return /* @__PURE__ */ t(B, {
|
|
975
1117
|
ref: f,
|
|
976
|
-
icon: d ?
|
|
977
|
-
"aria-label": `Thème actuel: ${
|
|
1118
|
+
icon: d ? Oe[c] : ke,
|
|
1119
|
+
"aria-label": `Thème actuel: ${c}`,
|
|
978
1120
|
size: i,
|
|
979
1121
|
radius: s,
|
|
980
1122
|
onClick: () => {
|
|
@@ -984,11 +1126,11 @@ function Ee({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasi
|
|
|
984
1126
|
}
|
|
985
1127
|
//#endregion
|
|
986
1128
|
//#region src/hooks/use_run_after_animation/use_run_after_animation.ts
|
|
987
|
-
function
|
|
1129
|
+
function je(e) {
|
|
988
1130
|
return a((t) => {
|
|
989
1131
|
let n = setTimeout(t, e);
|
|
990
1132
|
return () => clearTimeout(n);
|
|
991
1133
|
}, [e]);
|
|
992
1134
|
}
|
|
993
1135
|
//#endregion
|
|
994
|
-
export {
|
|
1136
|
+
export { F as BASE_INPUT_STYLES, b as Button, C as CharacterCount, j as Checkbox, P as ClientOnly, L as Combobox, de as ConfirmModal, B as IconButton, I as Input, me as Modal, he as ModalProvider, ge as RadioOptions, _e as Select, ve as Switch, ye as Tabs, be as Textarea, Ae as ThemeToggle, M as useClientOnly, Y as useDisableHotkeysWhileMounted, q as useGlobalHotkeysStore, Ce as useIsClient, je as useRunAfterAnimation, $ as useThemeStore, N as withClientOnly };
|