@minimalstuff/ui 1.2.0 → 1.2.3
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 +8 -12
- package/dist/minimalstuff-ui.css +1 -1
- package/dist/minimalstuff-ui.js +473 -430
- package/package.json +53 -74
package/dist/minimalstuff-ui.js
CHANGED
|
@@ -1,113 +1,116 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import r, { Fragment as i, createElement as a, useCallback as o, useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { createPortal as d } from "react-dom";
|
|
4
|
+
//#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
5
|
+
function f(e) {
|
|
6
|
+
var t, n, r = "";
|
|
7
|
+
if (typeof e == "string" || typeof e == "number") r += e;
|
|
8
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
9
|
+
var i = e.length;
|
|
10
|
+
for (t = 0; t < i; t++) e[t] && (n = f(e[t])) && (r && (r += " "), r += n);
|
|
11
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
12
|
+
return r;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
for (var
|
|
15
|
-
return
|
|
14
|
+
function p() {
|
|
15
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = f(e)) && (r && (r += " "), r += t);
|
|
16
|
+
return r;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/button/button.tsx
|
|
20
|
+
var m = {
|
|
18
21
|
primary: "bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 border-transparent",
|
|
19
22
|
secondary: "bg-gray-200 text-gray-900 hover:bg-gray-300 dark:bg-gray-600 dark:text-gray-100 dark:hover:bg-gray-500 border-transparent",
|
|
20
23
|
ghost: "bg-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700/50 border-transparent",
|
|
21
24
|
outline: "bg-transparent border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800/50",
|
|
22
25
|
subtle: "bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-700/50 dark:text-gray-300 dark:hover:bg-gray-600/50 border-transparent",
|
|
23
26
|
danger: "bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 border-transparent"
|
|
24
|
-
},
|
|
27
|
+
}, h = {
|
|
25
28
|
xs: "px-2 py-1 text-xs",
|
|
26
29
|
sm: "px-3 py-1.5 text-sm",
|
|
27
30
|
md: "px-4 py-2 text-sm",
|
|
28
31
|
lg: "px-4 py-3 text-base"
|
|
29
|
-
}
|
|
30
|
-
const Button = ({ variant: i = "primary", size: P = "md", children: F, className: I, fullWidth: L = !1, loading: R = !1, disabled: z, ...B }) => /* @__PURE__ */ jsxs("button", {
|
|
32
|
+
}, g = ({ variant: e = "primary", size: r = "md", children: i, className: a, fullWidth: o = !1, loading: s = !1, disabled: c, ...l }) => /* @__PURE__ */ n("button", {
|
|
31
33
|
type: "button",
|
|
32
|
-
className:
|
|
33
|
-
disabled:
|
|
34
|
-
...
|
|
35
|
-
children: [
|
|
34
|
+
className: p("cursor-pointer inline-flex items-center justify-center gap-2 rounded-md font-medium transition-all duration-200 border focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 disabled:opacity-50 disabled:cursor-not-allowed", m[e], h[r], o && "w-full", a),
|
|
35
|
+
disabled: c ?? s,
|
|
36
|
+
...l,
|
|
37
|
+
children: [s && /* @__PURE__ */ t("span", {
|
|
36
38
|
className: "i-svg-spinners-3-dots-fade w-4 h-4",
|
|
37
39
|
"aria-hidden": "true"
|
|
38
|
-
}),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className: CHARACTER_COUNT_STYLES,
|
|
40
|
+
}), i]
|
|
41
|
+
}), _ = "text-xs text-gray-500 dark:text-gray-400 mt-1 text-right";
|
|
42
|
+
function v({ current: e, min: t, max: r, showMin: i, showMax: a }) {
|
|
43
|
+
let o = t !== void 0 && e <= t, s = r !== void 0 && e >= r, c = r !== void 0 && e > r;
|
|
44
|
+
return /* @__PURE__ */ n("div", {
|
|
45
|
+
className: _,
|
|
45
46
|
children: [
|
|
46
|
-
|
|
47
|
-
className:
|
|
47
|
+
i && t !== void 0 && /* @__PURE__ */ n("span", {
|
|
48
|
+
className: o ? "text-amber-600 dark:text-amber-400" : "",
|
|
48
49
|
children: [
|
|
49
|
-
|
|
50
|
+
e,
|
|
50
51
|
"/",
|
|
51
|
-
|
|
52
|
+
t,
|
|
52
53
|
" min"
|
|
53
54
|
]
|
|
54
55
|
}),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className:
|
|
56
|
+
i && a && " · ",
|
|
57
|
+
a && r !== void 0 && /* @__PURE__ */ n("span", {
|
|
58
|
+
className: c ? "text-red-600 dark:text-red-400" : s ? "text-amber-600 dark:text-amber-400" : "",
|
|
58
59
|
children: [
|
|
59
|
-
|
|
60
|
+
e,
|
|
60
61
|
"/",
|
|
61
|
-
|
|
62
|
+
r,
|
|
62
63
|
" max"
|
|
63
64
|
]
|
|
64
65
|
}),
|
|
65
|
-
!
|
|
66
|
-
className:
|
|
66
|
+
!i && !a && r !== void 0 && /* @__PURE__ */ n("span", {
|
|
67
|
+
className: c ? "text-red-600 dark:text-red-400" : s ? "text-amber-600 dark:text-amber-400" : "",
|
|
67
68
|
children: [
|
|
68
|
-
|
|
69
|
+
e,
|
|
69
70
|
"/",
|
|
70
|
-
|
|
71
|
+
r
|
|
71
72
|
]
|
|
72
73
|
}),
|
|
73
|
-
!
|
|
74
|
-
className:
|
|
74
|
+
!i && !a && t !== void 0 && r === void 0 && /* @__PURE__ */ n("span", {
|
|
75
|
+
className: o ? "text-amber-600 dark:text-amber-400" : "",
|
|
75
76
|
children: [
|
|
76
|
-
|
|
77
|
+
e,
|
|
77
78
|
" (min ",
|
|
78
|
-
|
|
79
|
+
t,
|
|
79
80
|
")"
|
|
80
81
|
]
|
|
81
82
|
})
|
|
82
83
|
]
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/checkbox/checkbox.tsx
|
|
88
|
+
function y({ label: e, description: r, error: i, className: a, wrapperClassName: o, checked: s, defaultChecked: l = !1, onChange: d, id: f = "checkbox", ...m }) {
|
|
89
|
+
let h = `${f}-${c()}`, [g, _] = u(l), v = s !== void 0, y = v ? s : g, b = [r && `${h}-description`, i && `${h}-error`].filter(Boolean).join(" ") || void 0;
|
|
90
|
+
return /* @__PURE__ */ n("div", {
|
|
91
|
+
className: p("w-full", o),
|
|
89
92
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
htmlFor:
|
|
92
|
-
className:
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
-
className:
|
|
95
|
-
children: [/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ n("label", {
|
|
94
|
+
htmlFor: h,
|
|
95
|
+
className: p("flex items-start gap-3 cursor-pointer", m.disabled && "cursor-not-allowed opacity-50"),
|
|
96
|
+
children: [/* @__PURE__ */ n("span", {
|
|
97
|
+
className: p("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"),
|
|
98
|
+
children: [/* @__PURE__ */ t("input", {
|
|
96
99
|
type: "checkbox",
|
|
97
|
-
id:
|
|
100
|
+
id: h,
|
|
98
101
|
className: "sr-only",
|
|
99
|
-
checked:
|
|
100
|
-
defaultChecked:
|
|
101
|
-
onChange: (
|
|
102
|
-
|
|
102
|
+
checked: s,
|
|
103
|
+
defaultChecked: l,
|
|
104
|
+
onChange: (e) => {
|
|
105
|
+
v || _(e.target.checked), d?.(e);
|
|
103
106
|
},
|
|
104
|
-
"aria-invalid": !!
|
|
105
|
-
"aria-describedby":
|
|
106
|
-
...
|
|
107
|
-
}), /* @__PURE__ */
|
|
108
|
-
className:
|
|
107
|
+
"aria-invalid": !!i,
|
|
108
|
+
"aria-describedby": b,
|
|
109
|
+
...m
|
|
110
|
+
}), /* @__PURE__ */ t("span", {
|
|
111
|
+
className: p("flex h-5 w-5 items-center justify-center rounded border-2 transition-all duration-200", y ? "border-blue-600 bg-blue-600 dark:border-blue-500 dark:bg-blue-500" : "border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800", i && "border-red-500 dark:border-red-400", a),
|
|
109
112
|
"aria-hidden": !0,
|
|
110
|
-
children:
|
|
113
|
+
children: y && /* @__PURE__ */ t("svg", {
|
|
111
114
|
className: "h-3 w-3 text-white",
|
|
112
115
|
viewBox: "0 0 12 12",
|
|
113
116
|
fill: "none",
|
|
@@ -115,563 +118,602 @@ function Checkbox({ label: i, description: P, error: F, className: I, wrapperCla
|
|
|
115
118
|
strokeWidth: "2.5",
|
|
116
119
|
strokeLinecap: "round",
|
|
117
120
|
strokeLinejoin: "round",
|
|
118
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ t("polyline", { points: "2 6 5 9 10 3" })
|
|
119
122
|
})
|
|
120
123
|
})]
|
|
121
|
-
}), typeof
|
|
124
|
+
}), typeof e == "string" ? /* @__PURE__ */ n("span", {
|
|
122
125
|
className: "text-sm font-medium text-gray-700 dark:text-gray-300 select-none",
|
|
123
|
-
children: [
|
|
126
|
+
children: [e, m.required && /* @__PURE__ */ t("span", {
|
|
124
127
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
125
128
|
children: "*"
|
|
126
129
|
})]
|
|
127
|
-
}) :
|
|
130
|
+
}) : e]
|
|
128
131
|
}),
|
|
129
|
-
|
|
130
|
-
id: `${
|
|
132
|
+
r && (typeof r == "string" ? /* @__PURE__ */ t("p", {
|
|
133
|
+
id: `${h}-description`,
|
|
131
134
|
className: "text-xs text-gray-500 dark:text-gray-400 mt-1 ml-8",
|
|
132
|
-
children:
|
|
133
|
-
}) : /* @__PURE__ */
|
|
134
|
-
id: `${
|
|
135
|
+
children: r
|
|
136
|
+
}) : /* @__PURE__ */ t("span", {
|
|
137
|
+
id: `${h}-description`,
|
|
135
138
|
className: "block text-xs text-gray-500 dark:text-gray-400 mt-1 ml-8",
|
|
136
|
-
children:
|
|
139
|
+
children: r
|
|
137
140
|
})),
|
|
138
|
-
|
|
139
|
-
id: `${
|
|
141
|
+
i && /* @__PURE__ */ t("p", {
|
|
142
|
+
id: `${h}-error`,
|
|
140
143
|
className: "text-xs text-red-600 dark:text-red-400 mt-1 ml-8",
|
|
141
144
|
role: "alert",
|
|
142
|
-
children:
|
|
145
|
+
children: i
|
|
143
146
|
})
|
|
144
147
|
]
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/hooks/use_client_only/use_client_only.tsx
|
|
152
|
+
var b = () => {
|
|
153
|
+
let [e, t] = u(!1);
|
|
154
|
+
return s(() => {
|
|
150
155
|
requestAnimationFrame(() => {
|
|
151
|
-
|
|
156
|
+
t(!0);
|
|
152
157
|
});
|
|
153
|
-
}, []),
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
}, []), e;
|
|
159
|
+
}, x = (e) => (n) => b() ? /* @__PURE__ */ t(e, { ...n }) : null;
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/components/client_only/client_only.tsx
|
|
162
|
+
function S({ children: e, fallback: t }) {
|
|
163
|
+
return b() ? a(i, { children: e }) : t ?? null;
|
|
157
164
|
}
|
|
158
|
-
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/components/icon_button/icon_button.tsx
|
|
167
|
+
var C = {
|
|
159
168
|
default: "text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
160
169
|
ghost: "text-gray-600 dark:text-gray-400 hover:bg-white/50 dark:hover:bg-gray-800/50",
|
|
161
170
|
danger: "text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",
|
|
162
171
|
outline: "text-gray-600 dark:text-gray-400 border border-gray-300 dark:border-gray-600 hover:bg-white/50 dark:hover:bg-gray-800/50",
|
|
163
172
|
subtle: "text-gray-500 dark:text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-50/50 dark:hover:bg-gray-800/30"
|
|
164
|
-
},
|
|
173
|
+
}, w = {
|
|
165
174
|
sm: "p-1",
|
|
166
175
|
md: "p-2",
|
|
167
176
|
lg: "p-3"
|
|
168
|
-
},
|
|
177
|
+
}, T = {
|
|
169
178
|
sm: "w-4 h-4",
|
|
170
179
|
md: "w-5 h-5",
|
|
171
180
|
lg: "w-6 h-6"
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
ref: z,
|
|
181
|
+
}, E = ({ icon: e, "aria-label": r, variant: i = "default", size: a = "md", className: o, children: s, ref: c, ...l }) => /* @__PURE__ */ n("button", {
|
|
182
|
+
ref: c,
|
|
175
183
|
type: "button",
|
|
176
|
-
"aria-label":
|
|
177
|
-
className:
|
|
178
|
-
...
|
|
179
|
-
children: [/* @__PURE__ */
|
|
180
|
-
}),
|
|
181
|
-
function
|
|
182
|
-
let
|
|
183
|
-
return /* @__PURE__ */
|
|
184
|
-
className:
|
|
184
|
+
"aria-label": r,
|
|
185
|
+
className: p("cursor-pointer inline-flex items-center justify-center rounded transition-colors", "focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500", C[i], w[a], o),
|
|
186
|
+
...l,
|
|
187
|
+
children: [/* @__PURE__ */ t("div", { className: p(e, T[a], s && "mr-1") }), s]
|
|
188
|
+
}), D = "w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 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";
|
|
189
|
+
function O({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength: o, className: s, wrapperClassName: l, value: d, defaultValue: f, onChange: m, id: h = "input", ...g }) {
|
|
190
|
+
let _ = `${h}-${c()}`, [y, b] = u(typeof f == "string" ? f.length : 0), x = typeof d == "string" ? d.length : d === void 0 ? y : 0, S = i && (a !== void 0 || o !== void 0);
|
|
191
|
+
return /* @__PURE__ */ n("div", {
|
|
192
|
+
className: p("w-full", l),
|
|
185
193
|
children: [
|
|
186
|
-
typeof
|
|
194
|
+
typeof e == "string" ? /* @__PURE__ */ n("label", {
|
|
187
195
|
className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",
|
|
188
|
-
htmlFor:
|
|
189
|
-
children: [
|
|
196
|
+
htmlFor: _,
|
|
197
|
+
children: [e, g.required && /* @__PURE__ */ t("span", {
|
|
190
198
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
191
199
|
children: "*"
|
|
192
200
|
})]
|
|
193
|
-
}) :
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
id:
|
|
196
|
-
className:
|
|
197
|
-
value:
|
|
198
|
-
defaultValue:
|
|
199
|
-
minLength:
|
|
200
|
-
maxLength:
|
|
201
|
-
onChange: (
|
|
202
|
-
|
|
201
|
+
}) : e,
|
|
202
|
+
/* @__PURE__ */ t("input", {
|
|
203
|
+
id: _,
|
|
204
|
+
className: p(D, "px-3 py-2 text-sm", r && "border-red-500 dark:border-red-400 focus:ring-red-500", s),
|
|
205
|
+
value: d,
|
|
206
|
+
defaultValue: f,
|
|
207
|
+
minLength: a,
|
|
208
|
+
maxLength: o,
|
|
209
|
+
onChange: (e) => {
|
|
210
|
+
d === void 0 && b(e.target.value.length), m?.(e);
|
|
203
211
|
},
|
|
204
|
-
...
|
|
212
|
+
...g
|
|
205
213
|
}),
|
|
206
|
-
|
|
207
|
-
current:
|
|
208
|
-
min:
|
|
209
|
-
max:
|
|
210
|
-
showMin:
|
|
211
|
-
showMax:
|
|
214
|
+
S && /* @__PURE__ */ t(v, {
|
|
215
|
+
current: x,
|
|
216
|
+
min: a,
|
|
217
|
+
max: o,
|
|
218
|
+
showMin: a !== void 0,
|
|
219
|
+
showMax: o !== void 0
|
|
212
220
|
}),
|
|
213
|
-
|
|
221
|
+
r && /* @__PURE__ */ t("p", {
|
|
214
222
|
className: "text-xs text-red-600 dark:text-red-400 mt-1",
|
|
215
|
-
children:
|
|
223
|
+
children: r
|
|
216
224
|
})
|
|
217
225
|
]
|
|
218
226
|
});
|
|
219
227
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/hooks/use_run_after_animation/use_run_after_animation.ts
|
|
230
|
+
function k(e) {
|
|
231
|
+
return o((t) => {
|
|
232
|
+
let n = setTimeout(t, e);
|
|
233
|
+
return () => clearTimeout(n);
|
|
234
|
+
}, [e]);
|
|
225
235
|
}
|
|
226
|
-
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/components/modal/modal.tsx
|
|
238
|
+
var A = 200, j = {
|
|
227
239
|
sm: "max-w-md",
|
|
228
240
|
md: "max-w-lg",
|
|
229
241
|
lg: "max-w-2xl",
|
|
230
242
|
xl: "max-w-4xl"
|
|
231
243
|
};
|
|
232
|
-
function
|
|
233
|
-
let [
|
|
234
|
-
|
|
235
|
-
if (
|
|
244
|
+
function M({ isOpen: e = !1, onClose: r, title: i, children: a, footer: o, size: c = "md", className: l }) {
|
|
245
|
+
let [f, m] = u(!1), [h, g] = u(!1), [_, v] = u(!1), y = k(A);
|
|
246
|
+
s(() => {
|
|
247
|
+
if (e && !h) {
|
|
236
248
|
document.body.style.overflow = "hidden";
|
|
237
|
-
let
|
|
238
|
-
|
|
239
|
-
requestAnimationFrame(() =>
|
|
249
|
+
let e = setTimeout(() => {
|
|
250
|
+
g(!0), m(!1), requestAnimationFrame(() => {
|
|
251
|
+
requestAnimationFrame(() => v(!0));
|
|
240
252
|
});
|
|
241
253
|
}, 0);
|
|
242
|
-
return () => clearTimeout(
|
|
254
|
+
return () => clearTimeout(e);
|
|
243
255
|
}
|
|
244
|
-
if (!
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
}, 0),
|
|
248
|
-
|
|
256
|
+
if (!e && h) {
|
|
257
|
+
let e = setTimeout(() => {
|
|
258
|
+
m(!0), v(!1);
|
|
259
|
+
}, 0), t = y(() => {
|
|
260
|
+
g(!1), m(!1), document.body.style.overflow = "";
|
|
249
261
|
});
|
|
250
262
|
return () => {
|
|
251
|
-
clearTimeout(
|
|
263
|
+
clearTimeout(e), t();
|
|
252
264
|
};
|
|
253
265
|
}
|
|
254
266
|
}, [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
]),
|
|
259
|
-
if (!
|
|
260
|
-
let
|
|
261
|
-
|
|
267
|
+
e,
|
|
268
|
+
h,
|
|
269
|
+
y
|
|
270
|
+
]), s(() => {
|
|
271
|
+
if (!e || f) return;
|
|
272
|
+
let t = (e) => {
|
|
273
|
+
e.key === "Escape" && r?.();
|
|
262
274
|
};
|
|
263
|
-
return document.addEventListener("keydown",
|
|
275
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
264
276
|
}, [
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
277
|
+
e,
|
|
278
|
+
f,
|
|
279
|
+
r
|
|
268
280
|
]);
|
|
269
|
-
let
|
|
270
|
-
|
|
281
|
+
let b = () => {
|
|
282
|
+
f || r?.();
|
|
271
283
|
};
|
|
272
|
-
if (!
|
|
273
|
-
let
|
|
274
|
-
return
|
|
275
|
-
className:
|
|
276
|
-
onClick:
|
|
277
|
-
children: [/* @__PURE__ */
|
|
278
|
-
className:
|
|
284
|
+
if (!h) return null;
|
|
285
|
+
let x = _ && !f;
|
|
286
|
+
return d(/* @__PURE__ */ n("div", {
|
|
287
|
+
className: p("fixed inset-0 z-50 flex items-start justify-center", "p-2 sm:py-[3rem] lg:py-[5rem]", "transition-all duration-200", x ? "opacity-100" : "opacity-0"),
|
|
288
|
+
onClick: b,
|
|
289
|
+
children: [/* @__PURE__ */ t("div", {
|
|
290
|
+
className: p("fixed inset-0 bg-black/50 backdrop-blur-sm", "transition-opacity duration-200", x ? "opacity-100" : "opacity-0"),
|
|
279
291
|
"aria-hidden": "true"
|
|
280
|
-
}), /* @__PURE__ */
|
|
281
|
-
className:
|
|
282
|
-
onClick: (
|
|
292
|
+
}), /* @__PURE__ */ n("div", {
|
|
293
|
+
className: p("relative w-full", j[c], "bg-white dark:bg-gray-800 rounded-lg shadow-xl", "max-h-[calc(100vh-4rem)] sm:max-h-[calc(100vh-10rem)] overflow-hidden flex flex-col", "transition-all duration-200", x ? "opacity-100 scale-100 translate-y-0" : "opacity-0 scale-95 translate-y-2"),
|
|
294
|
+
onClick: (e) => e.stopPropagation(),
|
|
283
295
|
children: [
|
|
284
|
-
|
|
296
|
+
i && /* @__PURE__ */ n("div", {
|
|
285
297
|
className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
298
|
+
children: [/* @__PURE__ */ t("h2", {
|
|
287
299
|
className: "text-lg font-semibold text-gray-900 dark:text-gray-100",
|
|
288
|
-
children:
|
|
289
|
-
}), /* @__PURE__ */
|
|
300
|
+
children: i
|
|
301
|
+
}), /* @__PURE__ */ t(E, {
|
|
290
302
|
icon: "i-mdi-close",
|
|
291
|
-
onClick:
|
|
303
|
+
onClick: r?.bind(null),
|
|
292
304
|
"aria-label": "Close",
|
|
293
305
|
variant: "ghost",
|
|
294
306
|
className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"
|
|
295
307
|
})]
|
|
296
308
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
className:
|
|
299
|
-
children:
|
|
309
|
+
/* @__PURE__ */ t("div", {
|
|
310
|
+
className: p("flex-1 overflow-y-auto px-6 py-4 text-gray-600 dark:text-gray-400 min-h-0", l),
|
|
311
|
+
children: a
|
|
300
312
|
}),
|
|
301
|
-
|
|
313
|
+
o && /* @__PURE__ */ t("div", {
|
|
302
314
|
className: "flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",
|
|
303
|
-
children:
|
|
315
|
+
children: o
|
|
304
316
|
})
|
|
305
317
|
]
|
|
306
318
|
})]
|
|
307
319
|
}), document.body);
|
|
308
320
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/components/modal/confirm_modal.tsx
|
|
323
|
+
function N({ isOpen: r, onClose: i, onConfirm: a, title: o, children: s, confirmLabel: c, cancelLabel: l, confirmColor: d, loading: f = !1 }) {
|
|
324
|
+
let [p, m] = u(!1), h = async () => {
|
|
325
|
+
m(!0);
|
|
312
326
|
try {
|
|
313
|
-
await
|
|
327
|
+
await a();
|
|
314
328
|
} finally {
|
|
315
|
-
|
|
329
|
+
m(!1);
|
|
316
330
|
}
|
|
317
|
-
},
|
|
318
|
-
return /* @__PURE__ */
|
|
319
|
-
isOpen:
|
|
320
|
-
onClose:
|
|
321
|
-
title:
|
|
331
|
+
}, _ = f || p;
|
|
332
|
+
return /* @__PURE__ */ t(M, {
|
|
333
|
+
isOpen: r,
|
|
334
|
+
onClose: i,
|
|
335
|
+
title: o,
|
|
322
336
|
size: "sm",
|
|
323
|
-
footer: /* @__PURE__ */
|
|
337
|
+
footer: /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(g, {
|
|
324
338
|
variant: "secondary",
|
|
325
|
-
onClick:
|
|
326
|
-
disabled:
|
|
339
|
+
onClick: i,
|
|
340
|
+
disabled: _,
|
|
327
341
|
size: "sm",
|
|
328
|
-
children:
|
|
329
|
-
}), /* @__PURE__ */
|
|
330
|
-
variant: (
|
|
331
|
-
onClick:
|
|
332
|
-
|
|
333
|
-
|
|
342
|
+
children: l ?? "Cancel"
|
|
343
|
+
}), /* @__PURE__ */ t(g, {
|
|
344
|
+
variant: (d ?? "blue") === "red" ? "danger" : "primary",
|
|
345
|
+
onClick: () => {
|
|
346
|
+
h();
|
|
347
|
+
},
|
|
348
|
+
loading: _,
|
|
349
|
+
disabled: _,
|
|
334
350
|
size: "sm",
|
|
335
|
-
children:
|
|
351
|
+
children: c ?? "Confirm"
|
|
336
352
|
})] }),
|
|
337
|
-
children:
|
|
353
|
+
children: s && /* @__PURE__ */ t("div", {
|
|
338
354
|
className: "text-sm text-gray-600 dark:text-gray-300",
|
|
339
|
-
children:
|
|
355
|
+
children: s
|
|
340
356
|
})
|
|
341
357
|
});
|
|
342
358
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region node_modules/.pnpm/zustand@5.0.12_@types+react@19.2.14_react@19.2.5_use-sync-external-store@1.6.0_react@19.2.5_/node_modules/zustand/esm/vanilla.mjs
|
|
361
|
+
var P = (e) => {
|
|
362
|
+
let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
|
|
363
|
+
let i = typeof e == "function" ? e(t) : e;
|
|
364
|
+
if (!Object.is(i, t)) {
|
|
365
|
+
let e = t;
|
|
366
|
+
t = r ?? (typeof i != "object" || !i) ? i : Object.assign({}, t, i), n.forEach((n) => n(t, e));
|
|
349
367
|
}
|
|
350
|
-
},
|
|
351
|
-
setState:
|
|
352
|
-
getState:
|
|
353
|
-
getInitialState: () =>
|
|
354
|
-
subscribe: (
|
|
355
|
-
},
|
|
356
|
-
return
|
|
357
|
-
},
|
|
358
|
-
function
|
|
359
|
-
let
|
|
360
|
-
return
|
|
368
|
+
}, i = () => t, a = {
|
|
369
|
+
setState: r,
|
|
370
|
+
getState: i,
|
|
371
|
+
getInitialState: () => o,
|
|
372
|
+
subscribe: (e) => (n.add(e), () => n.delete(e))
|
|
373
|
+
}, o = t = e(r, i, a);
|
|
374
|
+
return a;
|
|
375
|
+
}, F = ((e) => e ? P(e) : P), I = (e) => e;
|
|
376
|
+
function L(e, t = I) {
|
|
377
|
+
let n = r.useSyncExternalStore(e.subscribe, r.useCallback(() => t(e.getState()), [e, t]), r.useCallback(() => t(e.getInitialState()), [e, t]));
|
|
378
|
+
return r.useDebugValue(n), n;
|
|
361
379
|
}
|
|
362
|
-
var
|
|
363
|
-
let
|
|
364
|
-
return Object.assign(
|
|
365
|
-
},
|
|
366
|
-
const useGlobalHotkeysStore = create((i) => ({
|
|
380
|
+
var R = (e) => {
|
|
381
|
+
let t = F(e), n = (e) => L(t, e);
|
|
382
|
+
return Object.assign(n, t), n;
|
|
383
|
+
}, z = ((e) => e ? R(e) : R), B = z((e) => ({
|
|
367
384
|
globalHotkeysEnabled: !0,
|
|
368
|
-
setGlobalHotkeysEnabled: (
|
|
369
|
-
}))
|
|
370
|
-
var ANIMATION_DURATION_MS = 200, generateId = () => Math.random().toString(36).substring(7);
|
|
371
|
-
const useModalStore = create((i, M) => ({
|
|
385
|
+
setGlobalHotkeysEnabled: (t) => e({ globalHotkeysEnabled: t })
|
|
386
|
+
})), V = 200, H = () => Math.random().toString(36).substring(7), U = z((e, t) => ({
|
|
372
387
|
modals: [],
|
|
373
388
|
closingIds: /* @__PURE__ */ new Set(),
|
|
374
|
-
open: (
|
|
375
|
-
let
|
|
376
|
-
return
|
|
377
|
-
...
|
|
378
|
-
id:
|
|
389
|
+
open: (n) => {
|
|
390
|
+
let r = H(), i = t(), a = i.modals.length === 0;
|
|
391
|
+
return e({ modals: [...i.modals, {
|
|
392
|
+
...n,
|
|
393
|
+
id: r,
|
|
379
394
|
type: "standard"
|
|
380
|
-
}] }),
|
|
395
|
+
}] }), a && B.getState().setGlobalHotkeysEnabled(!1), r;
|
|
381
396
|
},
|
|
382
|
-
openConfirm: (
|
|
383
|
-
let
|
|
384
|
-
return
|
|
385
|
-
...
|
|
386
|
-
id:
|
|
397
|
+
openConfirm: (n) => {
|
|
398
|
+
let r = H(), i = t(), a = i.modals.length === 0;
|
|
399
|
+
return e({ modals: [...i.modals, {
|
|
400
|
+
...n,
|
|
401
|
+
id: r,
|
|
387
402
|
type: "confirm"
|
|
388
|
-
}] }),
|
|
403
|
+
}] }), a && B.getState().setGlobalHotkeysEnabled(!1), r;
|
|
389
404
|
},
|
|
390
|
-
close: (
|
|
391
|
-
if (!
|
|
392
|
-
let
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
let
|
|
396
|
-
|
|
397
|
-
let
|
|
398
|
-
return
|
|
399
|
-
modals:
|
|
400
|
-
closingIds:
|
|
405
|
+
close: (n) => {
|
|
406
|
+
if (!t().modals.find((e) => e.id === n)) return;
|
|
407
|
+
let r = t().modals.length === 1;
|
|
408
|
+
e((e) => ({ closingIds: new Set(e.closingIds).add(n) })), setTimeout(() => {
|
|
409
|
+
e((e) => {
|
|
410
|
+
let t = new Set(e.closingIds);
|
|
411
|
+
t.delete(n);
|
|
412
|
+
let i = e.modals.filter((e) => e.id !== n);
|
|
413
|
+
return r && i.length === 0 && B.getState().setGlobalHotkeysEnabled(!0), {
|
|
414
|
+
modals: i,
|
|
415
|
+
closingIds: t
|
|
401
416
|
};
|
|
402
417
|
});
|
|
403
|
-
},
|
|
418
|
+
}, V);
|
|
404
419
|
},
|
|
405
420
|
closeAll: () => {
|
|
406
|
-
let
|
|
407
|
-
|
|
408
|
-
|
|
421
|
+
let n = t().modals;
|
|
422
|
+
n.length !== 0 && (e({ closingIds: new Set(n.map((e) => e.id)) }), setTimeout(() => {
|
|
423
|
+
e({
|
|
409
424
|
modals: [],
|
|
410
425
|
closingIds: /* @__PURE__ */ new Set()
|
|
411
|
-
}),
|
|
412
|
-
},
|
|
426
|
+
}), B.getState().setGlobalHotkeysEnabled(!0);
|
|
427
|
+
}, V));
|
|
413
428
|
},
|
|
414
|
-
isOpen: (
|
|
429
|
+
isOpen: (e) => t().modals.some((t) => t.id === e)
|
|
415
430
|
}));
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/components/modal_provider/modal_provider.tsx
|
|
433
|
+
function W() {
|
|
434
|
+
let n = U((e) => e.modals), r = U((e) => e.closingIds), i = U((e) => e.isOpen), a = U((e) => e.close);
|
|
435
|
+
return /* @__PURE__ */ t(e, { children: n.map((e) => {
|
|
436
|
+
let n = i(e.id) && !r.has(e.id);
|
|
437
|
+
return e.type === "confirm" ? /* @__PURE__ */ t(N, {
|
|
438
|
+
isOpen: n,
|
|
439
|
+
onClose: () => a(e.id),
|
|
423
440
|
onConfirm: async () => {
|
|
424
|
-
await
|
|
441
|
+
await e.onConfirm(), a(e.id);
|
|
425
442
|
},
|
|
426
|
-
title:
|
|
427
|
-
confirmLabel:
|
|
428
|
-
cancelLabel:
|
|
429
|
-
confirmColor:
|
|
430
|
-
children:
|
|
431
|
-
},
|
|
432
|
-
isOpen:
|
|
433
|
-
onClose: () =>
|
|
434
|
-
title:
|
|
435
|
-
size:
|
|
436
|
-
children:
|
|
437
|
-
},
|
|
443
|
+
title: e.title,
|
|
444
|
+
confirmLabel: e.confirmLabel,
|
|
445
|
+
cancelLabel: e.cancelLabel,
|
|
446
|
+
confirmColor: e.confirmColor,
|
|
447
|
+
children: e.children
|
|
448
|
+
}, e.id) : /* @__PURE__ */ t(M, {
|
|
449
|
+
isOpen: n,
|
|
450
|
+
onClose: () => a(e.id),
|
|
451
|
+
title: e.title,
|
|
452
|
+
size: e.size,
|
|
453
|
+
children: e.children
|
|
454
|
+
}, e.id);
|
|
438
455
|
}) });
|
|
439
456
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/components/select/select.tsx
|
|
459
|
+
function G({ options: e, label: r, error: i, placeholder: a, className: o, wrapperClassName: s, value: l, defaultValue: u, onChange: d, id: f = "select", ...m }) {
|
|
460
|
+
let h = `${f}-${c()}`;
|
|
461
|
+
return /* @__PURE__ */ n("div", {
|
|
462
|
+
className: p("w-full", s),
|
|
444
463
|
children: [
|
|
445
|
-
typeof
|
|
464
|
+
typeof r == "string" ? /* @__PURE__ */ n("label", {
|
|
446
465
|
className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",
|
|
447
|
-
htmlFor:
|
|
448
|
-
children: [
|
|
466
|
+
htmlFor: h,
|
|
467
|
+
children: [r, m.required && /* @__PURE__ */ t("span", {
|
|
449
468
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
450
469
|
children: "*"
|
|
451
470
|
})]
|
|
452
|
-
}) :
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
id:
|
|
455
|
-
className:
|
|
456
|
-
value:
|
|
457
|
-
defaultValue:
|
|
458
|
-
onChange:
|
|
459
|
-
"aria-invalid": !!
|
|
460
|
-
"aria-describedby":
|
|
461
|
-
...
|
|
462
|
-
children: [
|
|
471
|
+
}) : r,
|
|
472
|
+
/* @__PURE__ */ n("select", {
|
|
473
|
+
id: h,
|
|
474
|
+
className: p(D, "pl-3 pr-8 py-2 text-sm appearance-none bg-[length:1rem_1rem] bg-[position:right_0.5rem_center] bg-no-repeat", "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\")]", i && "border-red-500 dark:border-red-400 focus:ring-red-500", o),
|
|
475
|
+
value: l,
|
|
476
|
+
defaultValue: u,
|
|
477
|
+
onChange: d,
|
|
478
|
+
"aria-invalid": !!i,
|
|
479
|
+
"aria-describedby": i ? `${h}-error` : void 0,
|
|
480
|
+
...m,
|
|
481
|
+
children: [a !== void 0 && /* @__PURE__ */ t("option", {
|
|
463
482
|
value: "",
|
|
464
|
-
children:
|
|
465
|
-
}),
|
|
466
|
-
value:
|
|
467
|
-
children:
|
|
468
|
-
},
|
|
483
|
+
children: a
|
|
484
|
+
}), e.map((e) => /* @__PURE__ */ t("option", {
|
|
485
|
+
value: e.value,
|
|
486
|
+
children: e.label
|
|
487
|
+
}, e.value))]
|
|
469
488
|
}),
|
|
470
|
-
|
|
471
|
-
id: `${
|
|
489
|
+
i && /* @__PURE__ */ t("p", {
|
|
490
|
+
id: `${h}-error`,
|
|
472
491
|
className: "text-xs text-red-600 dark:text-red-400 mt-1",
|
|
473
492
|
role: "alert",
|
|
474
|
-
children:
|
|
493
|
+
children: i
|
|
475
494
|
})
|
|
476
495
|
]
|
|
477
496
|
});
|
|
478
497
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/components/switch/switch.tsx
|
|
500
|
+
function K({ label: r, description: i, error: a, className: o, wrapperClassName: s, checked: l, defaultChecked: d = !1, onChange: f, id: m = "switch", ...h }) {
|
|
501
|
+
let g = `${m}-${c()}`, [_, v] = u(d), y = l !== void 0, b = y ? l : _, x = [i && `${g}-description`, a && `${g}-error`].filter(Boolean).join(" ") || void 0;
|
|
502
|
+
return /* @__PURE__ */ n("div", {
|
|
503
|
+
className: p("w-full", s),
|
|
483
504
|
children: [
|
|
484
|
-
/* @__PURE__ */
|
|
485
|
-
htmlFor:
|
|
486
|
-
className:
|
|
487
|
-
children: [/* @__PURE__ */
|
|
488
|
-
className:
|
|
489
|
-
children: [/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ n("label", {
|
|
506
|
+
htmlFor: g,
|
|
507
|
+
className: p("flex items-center gap-3 cursor-pointer", h.disabled && "cursor-not-allowed opacity-50"),
|
|
508
|
+
children: [/* @__PURE__ */ n("span", {
|
|
509
|
+
className: p("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 ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-200 dark:bg-gray-600", a && "ring-2 ring-red-500 dark:ring-red-400", o),
|
|
510
|
+
children: [/* @__PURE__ */ t("input", {
|
|
490
511
|
type: "checkbox",
|
|
491
512
|
role: "switch",
|
|
492
|
-
id:
|
|
513
|
+
id: g,
|
|
493
514
|
className: "sr-only",
|
|
494
|
-
checked:
|
|
495
|
-
defaultChecked:
|
|
496
|
-
onChange: (
|
|
497
|
-
|
|
515
|
+
checked: l,
|
|
516
|
+
defaultChecked: d,
|
|
517
|
+
onChange: (e) => {
|
|
518
|
+
y || v(e.target.checked), f?.(e);
|
|
498
519
|
},
|
|
499
|
-
"aria-invalid": !!
|
|
500
|
-
"aria-describedby":
|
|
501
|
-
...
|
|
502
|
-
}), /* @__PURE__ */
|
|
503
|
-
className:
|
|
520
|
+
"aria-invalid": !!a,
|
|
521
|
+
"aria-describedby": x,
|
|
522
|
+
...h
|
|
523
|
+
}), /* @__PURE__ */ t("span", {
|
|
524
|
+
className: p("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"),
|
|
504
525
|
"aria-hidden": !0
|
|
505
526
|
})]
|
|
506
|
-
}),
|
|
527
|
+
}), r && /* @__PURE__ */ t(e, { children: typeof r == "string" ? /* @__PURE__ */ n("span", {
|
|
507
528
|
className: "text-sm font-medium text-gray-700 dark:text-gray-300 select-none",
|
|
508
|
-
children: [
|
|
529
|
+
children: [r, h.required && /* @__PURE__ */ t("span", {
|
|
509
530
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
510
531
|
children: "*"
|
|
511
532
|
})]
|
|
512
|
-
}) : /* @__PURE__ */
|
|
533
|
+
}) : /* @__PURE__ */ n(e, { children: [r, h.required && /* @__PURE__ */ t("span", {
|
|
513
534
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
514
535
|
children: "*"
|
|
515
536
|
})] }) })]
|
|
516
537
|
}),
|
|
517
|
-
|
|
518
|
-
id: `${
|
|
538
|
+
i && (typeof i == "string" ? /* @__PURE__ */ t("p", {
|
|
539
|
+
id: `${g}-description`,
|
|
519
540
|
className: "text-xs text-gray-500 dark:text-gray-400 mt-1 ml-14",
|
|
520
|
-
children:
|
|
521
|
-
}) : /* @__PURE__ */
|
|
522
|
-
id: `${
|
|
541
|
+
children: i
|
|
542
|
+
}) : /* @__PURE__ */ t("span", {
|
|
543
|
+
id: `${g}-description`,
|
|
523
544
|
className: "block text-xs text-gray-500 dark:text-gray-400 mt-1 ml-14",
|
|
524
|
-
children:
|
|
545
|
+
children: i
|
|
525
546
|
})),
|
|
526
|
-
|
|
527
|
-
id: `${
|
|
547
|
+
a && /* @__PURE__ */ t("p", {
|
|
548
|
+
id: `${g}-error`,
|
|
528
549
|
className: "text-xs text-red-600 dark:text-red-400 mt-1 ml-14",
|
|
529
550
|
role: "alert",
|
|
530
|
-
children:
|
|
551
|
+
children: a
|
|
531
552
|
})
|
|
532
553
|
]
|
|
533
554
|
});
|
|
534
555
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/components/tabs/tabs.tsx
|
|
558
|
+
function q({ items: e, defaultIndex: r = 0, className: i, tabListClassName: a, panelClassName: o, onChange: s }) {
|
|
559
|
+
let [c, l] = u(r), d = (t) => {
|
|
560
|
+
e[t]?.disabled || (l(t), s?.(t));
|
|
561
|
+
}, f = e[c];
|
|
562
|
+
return /* @__PURE__ */ n("div", {
|
|
563
|
+
className: p("w-full", i),
|
|
564
|
+
children: [/* @__PURE__ */ t("div", {
|
|
542
565
|
role: "tablist",
|
|
543
|
-
className:
|
|
544
|
-
children:
|
|
566
|
+
className: p("flex gap-1 p-1 rounded-md bg-gray-100 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700", a),
|
|
567
|
+
children: e.map((e, r) => /* @__PURE__ */ n("button", {
|
|
545
568
|
role: "tab",
|
|
546
569
|
type: "button",
|
|
547
|
-
"aria-selected":
|
|
548
|
-
"aria-disabled":
|
|
549
|
-
disabled:
|
|
550
|
-
onClick: () =>
|
|
551
|
-
className:
|
|
552
|
-
children: [
|
|
553
|
-
},
|
|
554
|
-
}), /* @__PURE__ */
|
|
570
|
+
"aria-selected": c === r,
|
|
571
|
+
"aria-disabled": e.disabled,
|
|
572
|
+
disabled: e.disabled,
|
|
573
|
+
onClick: () => d(r),
|
|
574
|
+
className: p("flex items-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium", c === r ? "bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400 shadow-sm border border-gray-200 dark:border-gray-600" : p("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")),
|
|
575
|
+
children: [e.icon && /* @__PURE__ */ t("span", { className: p("w-4 h-4 block shrink-0", e.icon, c === r ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400") }), e.title]
|
|
576
|
+
}, r))
|
|
577
|
+
}), /* @__PURE__ */ t("div", {
|
|
555
578
|
role: "tabpanel",
|
|
556
|
-
className:
|
|
557
|
-
children: /* @__PURE__ */
|
|
579
|
+
className: p("mt-3 rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800/50 p-4 overflow-hidden", o),
|
|
580
|
+
children: /* @__PURE__ */ t("div", {
|
|
558
581
|
className: "tabs-panel-inner",
|
|
559
|
-
children:
|
|
560
|
-
},
|
|
582
|
+
children: f?.content
|
|
583
|
+
}, c)
|
|
561
584
|
})]
|
|
562
585
|
});
|
|
563
586
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/components/textarea/textarea.tsx
|
|
589
|
+
function J({ label: e, error: r, showCharCount: i = !1, minLength: a, maxLength: o, className: s, wrapperClassName: l, value: d, defaultValue: f, onChange: m, id: h = "textarea", ...g }) {
|
|
590
|
+
let _ = `${h}-${c()}`, [y, b] = u(typeof f == "string" ? f.length : 0), x = typeof d == "string" ? d.length : d === void 0 ? y : 0, S = i && (a !== void 0 || o !== void 0);
|
|
591
|
+
return /* @__PURE__ */ n("div", {
|
|
592
|
+
className: p("w-full", l),
|
|
568
593
|
children: [
|
|
569
|
-
typeof
|
|
594
|
+
typeof e == "string" ? /* @__PURE__ */ n("label", {
|
|
570
595
|
className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",
|
|
571
|
-
htmlFor:
|
|
572
|
-
children: [
|
|
596
|
+
htmlFor: _,
|
|
597
|
+
children: [e, g.required && /* @__PURE__ */ t("span", {
|
|
573
598
|
className: "text-red-500 dark:text-red-400 ml-1",
|
|
574
599
|
children: "*"
|
|
575
600
|
})]
|
|
576
|
-
}) :
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
id:
|
|
579
|
-
className:
|
|
580
|
-
value:
|
|
581
|
-
defaultValue:
|
|
582
|
-
minLength:
|
|
583
|
-
maxLength:
|
|
584
|
-
onChange: (
|
|
585
|
-
|
|
601
|
+
}) : e,
|
|
602
|
+
/* @__PURE__ */ t("textarea", {
|
|
603
|
+
id: _,
|
|
604
|
+
className: p(D, "px-3 py-2 text-sm min-h-[80px] resize-y", r && "border-red-500 dark:border-red-400 focus:ring-red-500", s),
|
|
605
|
+
value: d,
|
|
606
|
+
defaultValue: f,
|
|
607
|
+
minLength: a,
|
|
608
|
+
maxLength: o,
|
|
609
|
+
onChange: (e) => {
|
|
610
|
+
d === void 0 && b(e.target.value.length), m?.(e);
|
|
586
611
|
},
|
|
587
|
-
...
|
|
612
|
+
...g
|
|
588
613
|
}),
|
|
589
|
-
|
|
590
|
-
current:
|
|
591
|
-
min:
|
|
592
|
-
max:
|
|
593
|
-
showMin:
|
|
594
|
-
showMax:
|
|
614
|
+
S && /* @__PURE__ */ t(v, {
|
|
615
|
+
current: x,
|
|
616
|
+
min: a,
|
|
617
|
+
max: o,
|
|
618
|
+
showMin: a !== void 0,
|
|
619
|
+
showMax: o !== void 0
|
|
595
620
|
}),
|
|
596
|
-
|
|
621
|
+
r && /* @__PURE__ */ t("p", {
|
|
597
622
|
className: "text-xs text-red-600 dark:text-red-400 mt-1",
|
|
598
|
-
children:
|
|
623
|
+
children: r
|
|
599
624
|
})
|
|
600
625
|
]
|
|
601
626
|
});
|
|
602
627
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/hooks/use_is_client/use_is_client.tsx
|
|
630
|
+
var Y = () => {
|
|
631
|
+
let [e, t] = u(!1);
|
|
632
|
+
return s(() => {
|
|
606
633
|
requestAnimationFrame(() => {
|
|
607
|
-
|
|
634
|
+
t(!0);
|
|
608
635
|
});
|
|
609
|
-
}, []),
|
|
636
|
+
}, []), e;
|
|
610
637
|
};
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/utils/theme.ts
|
|
640
|
+
function X(e) {
|
|
641
|
+
let t = document.documentElement;
|
|
642
|
+
e === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? t.classList.add("dark") : t.classList.remove("dark") : e === "dark" ? t.classList.add("dark") : t.classList.remove("dark");
|
|
614
643
|
}
|
|
615
|
-
|
|
616
|
-
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/lib/theme_transition.ts
|
|
646
|
+
var Z = 750, Q = "ease-in-out";
|
|
647
|
+
async function $({ theme: e, element: t, transitionDuration: n = Z, transitionEasing: r = Q, applyThemeCallback: i }) {
|
|
617
648
|
if (!document.startViewTransition || globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
618
|
-
|
|
649
|
+
i(e);
|
|
619
650
|
return;
|
|
620
651
|
}
|
|
621
|
-
let { top:
|
|
652
|
+
let { top: a, left: o, width: s, height: c } = t.getBoundingClientRect(), l = o + s / 2, u = a + c / 2, d = globalThis.innerWidth - l, f = globalThis.innerHeight - u, p = Math.hypot(Math.max(l, d), Math.max(u, f));
|
|
622
653
|
await document.startViewTransition(() => {
|
|
623
|
-
|
|
624
|
-
}).ready, document.documentElement.animate({ clipPath: [`circle(0px at ${
|
|
625
|
-
duration:
|
|
626
|
-
easing:
|
|
654
|
+
i(e);
|
|
655
|
+
}).ready, document.documentElement.animate({ clipPath: [`circle(0px at ${l}px ${u}px)`, `circle(${p}px at ${l}px ${u}px)`] }, {
|
|
656
|
+
duration: n,
|
|
657
|
+
easing: r,
|
|
627
658
|
pseudoElement: "::view-transition-new(root)"
|
|
628
659
|
});
|
|
629
660
|
}
|
|
630
|
-
function
|
|
631
|
-
return
|
|
661
|
+
function ee(e) {
|
|
662
|
+
return e === "light" ? "dark" : e === "dark" ? "system" : "light";
|
|
632
663
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/components/theme_toggle/theme_toggle.tsx
|
|
666
|
+
function te(e) {
|
|
667
|
+
return /* @__PURE__ */ t("div", {
|
|
668
|
+
className: p({
|
|
636
669
|
light: "i-tabler-sun text-yellow-500",
|
|
637
670
|
dark: "i-tabler-moon-stars text-gray-700 dark:text-yellow-500",
|
|
638
671
|
system: "i-tabler-device-desktop text-blue-500"
|
|
639
|
-
}[
|
|
672
|
+
}[e], "w-5 h-5"),
|
|
640
673
|
style: {
|
|
641
674
|
width: 20,
|
|
642
675
|
height: 20
|
|
643
676
|
}
|
|
644
677
|
});
|
|
645
678
|
}
|
|
646
|
-
function
|
|
647
|
-
let [
|
|
648
|
-
|
|
649
|
-
let
|
|
650
|
-
|
|
679
|
+
function ne({ isTransitionEnabled: e = !0, transitionDuration: n, transitionEasing: r }) {
|
|
680
|
+
let [i, a] = u("system"), c = Y(), d = l(null);
|
|
681
|
+
s(() => {
|
|
682
|
+
let e = localStorage.getItem("theme");
|
|
683
|
+
requestAnimationFrame(() => {
|
|
684
|
+
e ? (a(e), X(e)) : (a("system"), X("system"));
|
|
685
|
+
});
|
|
686
|
+
}, []), s(() => {
|
|
687
|
+
let e = globalThis.matchMedia("(prefers-color-scheme: dark)"), t = () => {
|
|
688
|
+
i === "system" && X("system");
|
|
651
689
|
};
|
|
652
|
-
return
|
|
653
|
-
|
|
690
|
+
return e.addEventListener("change", t), () => {
|
|
691
|
+
e.removeEventListener("change", t);
|
|
654
692
|
};
|
|
655
|
-
}, [
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
693
|
+
}, [i]);
|
|
694
|
+
let f = o(async () => {
|
|
695
|
+
let t = ee(i), o = d.current;
|
|
696
|
+
o && e ? await $({
|
|
697
|
+
theme: t,
|
|
698
|
+
element: o,
|
|
699
|
+
transitionDuration: n,
|
|
700
|
+
transitionEasing: r,
|
|
701
|
+
applyThemeCallback: X
|
|
702
|
+
}) : X(t), a(t), localStorage.setItem("theme", t);
|
|
703
|
+
}, [
|
|
704
|
+
i,
|
|
705
|
+
e,
|
|
706
|
+
n,
|
|
707
|
+
r
|
|
708
|
+
]);
|
|
709
|
+
return /* @__PURE__ */ t("button", {
|
|
710
|
+
ref: d,
|
|
711
|
+
onClick: () => {
|
|
712
|
+
f();
|
|
713
|
+
},
|
|
672
714
|
className: "p-2.5 rounded-lg bg-gray-100 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600 transition-all duration-200 cursor-pointer",
|
|
673
|
-
"aria-label": `Thème actuel: ${
|
|
674
|
-
children:
|
|
715
|
+
"aria-label": `Thème actuel: ${i}`,
|
|
716
|
+
children: c ? te(i) : /* @__PURE__ */ t("div", {
|
|
675
717
|
className: "i-tabler-device-desktop w-5 h-5 text-gray-400",
|
|
676
718
|
style: {
|
|
677
719
|
width: "20px",
|
|
@@ -680,4 +722,5 @@ function ThemeToggle({ isTransitionEnabled: i = !0, transitionDuration: N, trans
|
|
|
680
722
|
})
|
|
681
723
|
});
|
|
682
724
|
}
|
|
683
|
-
|
|
725
|
+
//#endregion
|
|
726
|
+
export { D as BASE_INPUT_STYLES, g as Button, v as CharacterCount, y as Checkbox, S as ClientOnly, N as ConfirmModal, E as IconButton, O as Input, M as Modal, W as ModalProvider, G as Select, K as Switch, q as Tabs, J as Textarea, ne as ThemeToggle, X as applyTheme, b as useClientOnly, B as useGlobalHotkeysStore, Y as useIsClient, U as useModalStore, k as useRunAfterAnimation, x as withClientOnly };
|