@minimalstuff/ui 0.0.31 → 1.0.0-4
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/README.md +70 -0
- package/dist/index.d.ts +78 -311
- package/dist/minimalstuff-ui.css +2 -0
- package/dist/minimalstuff-ui.js +355 -0
- package/dist/vite.svg +1 -0
- package/package.json +82 -94
- package/dist/index.es.js +0 -2656
- package/dist/index.umd.js +0 -55
- package/dist/style.css +0 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, createElement, useCallback, useEffect, useId, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
function r(e) {
|
|
5
|
+
var g, _, v = "";
|
|
6
|
+
if (typeof e == "string" || typeof e == "number") v += e;
|
|
7
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
8
|
+
var y = e.length;
|
|
9
|
+
for (g = 0; g < y; g++) e[g] && (_ = r(e[g])) && (v && (v += " "), v += _);
|
|
10
|
+
} else for (_ in e) e[_] && (v && (v += " "), v += _);
|
|
11
|
+
return v;
|
|
12
|
+
}
|
|
13
|
+
function clsx() {
|
|
14
|
+
for (var e, g, _ = 0, v = "", y = arguments.length; _ < y; _++) (e = arguments[_]) && (g = r(e)) && (v && (v += " "), v += g);
|
|
15
|
+
return v;
|
|
16
|
+
}
|
|
17
|
+
var clsx_default = clsx, VARIANT_CLASSES$1 = {
|
|
18
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 border-transparent",
|
|
19
|
+
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
|
+
ghost: "bg-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700/50 border-transparent",
|
|
21
|
+
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
|
+
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
|
+
danger: "bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 border-transparent"
|
|
24
|
+
}, SIZE_CLASSES$2 = {
|
|
25
|
+
xs: "px-2 py-1 text-xs",
|
|
26
|
+
sm: "px-3 py-1.5 text-sm",
|
|
27
|
+
md: "px-4 py-2 text-sm",
|
|
28
|
+
lg: "px-4 py-3 text-base"
|
|
29
|
+
};
|
|
30
|
+
const Button = ({ variant: g = "primary", size: _ = "md", children: v, className: y, fullWidth: b = !1, disabled: x, ...S }) => /* @__PURE__ */ jsx("button", {
|
|
31
|
+
type: "button",
|
|
32
|
+
className: clsx_default("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", VARIANT_CLASSES$1[g], SIZE_CLASSES$2[_], b && "w-full", y),
|
|
33
|
+
disabled: x,
|
|
34
|
+
...S,
|
|
35
|
+
children: v
|
|
36
|
+
});
|
|
37
|
+
var CHARACTER_COUNT_STYLES = "text-xs text-gray-500 dark:text-gray-400 mt-1 text-right";
|
|
38
|
+
function CharacterCount({ current: e, min: _, max: v, showMin: y, showMax: b }) {
|
|
39
|
+
let x = _ !== void 0 && e <= _, S = v !== void 0 && e >= v, C = v !== void 0 && e > v;
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
className: CHARACTER_COUNT_STYLES,
|
|
42
|
+
children: [
|
|
43
|
+
y && _ !== void 0 && /* @__PURE__ */ jsxs("span", {
|
|
44
|
+
className: x ? "text-amber-600 dark:text-amber-400" : "",
|
|
45
|
+
children: [
|
|
46
|
+
e,
|
|
47
|
+
"/",
|
|
48
|
+
_,
|
|
49
|
+
" min"
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
y && b && " · ",
|
|
53
|
+
b && v !== void 0 && /* @__PURE__ */ jsxs("span", {
|
|
54
|
+
className: C ? "text-red-600 dark:text-red-400" : S ? "text-amber-600 dark:text-amber-400" : "",
|
|
55
|
+
children: [
|
|
56
|
+
e,
|
|
57
|
+
"/",
|
|
58
|
+
v,
|
|
59
|
+
" max"
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
!y && !b && v !== void 0 && /* @__PURE__ */ jsxs("span", {
|
|
63
|
+
className: C ? "text-red-600 dark:text-red-400" : S ? "text-amber-600 dark:text-amber-400" : "",
|
|
64
|
+
children: [
|
|
65
|
+
e,
|
|
66
|
+
"/",
|
|
67
|
+
v
|
|
68
|
+
]
|
|
69
|
+
}),
|
|
70
|
+
!y && !b && _ !== void 0 && v === void 0 && /* @__PURE__ */ jsxs("span", {
|
|
71
|
+
className: x ? "text-amber-600 dark:text-amber-400" : "",
|
|
72
|
+
children: [
|
|
73
|
+
e,
|
|
74
|
+
" (min ",
|
|
75
|
+
_,
|
|
76
|
+
")"
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const useClientOnly = () => {
|
|
83
|
+
let [e, g] = useState(!1);
|
|
84
|
+
return useEffect(() => {
|
|
85
|
+
requestAnimationFrame(() => {
|
|
86
|
+
g(!0);
|
|
87
|
+
});
|
|
88
|
+
}, []), e;
|
|
89
|
+
}, withClientOnly = (g) => (_) => useClientOnly() ? /* @__PURE__ */ jsx(g, { ..._ }) : null;
|
|
90
|
+
function ClientOnly({ children: e, fallback: g }) {
|
|
91
|
+
return useClientOnly() ? createElement(Fragment, { children: e }) : g ?? null;
|
|
92
|
+
}
|
|
93
|
+
var VARIANT_CLASSES = {
|
|
94
|
+
default: "text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
95
|
+
ghost: "text-gray-600 dark:text-gray-400 hover:bg-white/50 dark:hover:bg-gray-800/50",
|
|
96
|
+
danger: "text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",
|
|
97
|
+
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"
|
|
98
|
+
}, SIZE_CLASSES$1 = {
|
|
99
|
+
sm: "p-1",
|
|
100
|
+
md: "p-2",
|
|
101
|
+
lg: "p-3"
|
|
102
|
+
}, ICON_SIZE_CLASSES = {
|
|
103
|
+
sm: "w-4 h-4",
|
|
104
|
+
md: "w-5 h-5",
|
|
105
|
+
lg: "w-6 h-6"
|
|
106
|
+
};
|
|
107
|
+
const IconButton = ({ icon: _, "aria-label": v, variant: y = "default", size: b = "md", className: x, children: S, ref: C, ...w }) => /* @__PURE__ */ jsxs("button", {
|
|
108
|
+
ref: C,
|
|
109
|
+
type: "button",
|
|
110
|
+
"aria-label": v,
|
|
111
|
+
className: clsx_default("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", VARIANT_CLASSES[y], SIZE_CLASSES$1[b], x),
|
|
112
|
+
...w,
|
|
113
|
+
children: [/* @__PURE__ */ jsx("div", { className: clsx_default(_, ICON_SIZE_CLASSES[b], S && "mr-1") }), S]
|
|
114
|
+
}), BASE_INPUT_STYLES = "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";
|
|
115
|
+
function Input({ label: _, error: v, showCharCount: y = !1, minLength: b, maxLength: C, className: w, wrapperClassName: T, value: E, defaultValue: D, onChange: O, id: k = "input", ...j }) {
|
|
116
|
+
let M = `${k}-${useId()}`, [N, P] = useState(typeof D == "string" ? D.length : 0), F = typeof E == "string" ? E.length : E === void 0 ? N : 0, I = y && (b !== void 0 || C !== void 0);
|
|
117
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
118
|
+
className: clsx_default("w-full", T),
|
|
119
|
+
children: [
|
|
120
|
+
_ && /* @__PURE__ */ jsx("label", {
|
|
121
|
+
className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",
|
|
122
|
+
htmlFor: M,
|
|
123
|
+
children: _
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ jsx("input", {
|
|
126
|
+
id: M,
|
|
127
|
+
className: clsx_default(BASE_INPUT_STYLES, "px-3 py-2 text-sm", v && "border-red-500 dark:border-red-400 focus:ring-red-500", w),
|
|
128
|
+
value: E,
|
|
129
|
+
defaultValue: D,
|
|
130
|
+
minLength: b,
|
|
131
|
+
maxLength: C,
|
|
132
|
+
onChange: (e) => {
|
|
133
|
+
E === void 0 && P(e.target.value.length), O?.(e);
|
|
134
|
+
},
|
|
135
|
+
...j
|
|
136
|
+
}),
|
|
137
|
+
I && /* @__PURE__ */ jsx(CharacterCount, {
|
|
138
|
+
current: F,
|
|
139
|
+
min: b,
|
|
140
|
+
max: C,
|
|
141
|
+
showMin: b !== void 0,
|
|
142
|
+
showMax: C !== void 0
|
|
143
|
+
}),
|
|
144
|
+
v && /* @__PURE__ */ jsx("p", {
|
|
145
|
+
className: "text-xs text-red-600 dark:text-red-400 mt-1",
|
|
146
|
+
children: v
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function useRunAfterAnimation(e) {
|
|
152
|
+
return useCallback((g) => {
|
|
153
|
+
let _ = setTimeout(g, e);
|
|
154
|
+
return () => clearTimeout(_);
|
|
155
|
+
}, [e]);
|
|
156
|
+
}
|
|
157
|
+
var ANIMATION_DURATION_MS = 200, SIZE_CLASSES = {
|
|
158
|
+
sm: "max-w-md",
|
|
159
|
+
md: "max-w-lg",
|
|
160
|
+
lg: "max-w-2xl",
|
|
161
|
+
xl: "max-w-4xl"
|
|
162
|
+
};
|
|
163
|
+
function Modal({ isOpen: _ = !1, onClose: v, title: y, children: x, size: w = "md", className: T }) {
|
|
164
|
+
let [E, D] = useState(!1), [O, k] = useState(!1), [A, j] = useState(!1), M = useRunAfterAnimation(ANIMATION_DURATION_MS);
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (_ && !O) {
|
|
167
|
+
document.body.style.overflow = "hidden";
|
|
168
|
+
let e = setTimeout(() => {
|
|
169
|
+
k(!0), D(!1), requestAnimationFrame(() => {
|
|
170
|
+
requestAnimationFrame(() => j(!0));
|
|
171
|
+
});
|
|
172
|
+
}, 0);
|
|
173
|
+
return () => clearTimeout(e);
|
|
174
|
+
}
|
|
175
|
+
if (!_ && O) {
|
|
176
|
+
let e = setTimeout(() => {
|
|
177
|
+
D(!0), j(!1);
|
|
178
|
+
}, 0), g = M(() => {
|
|
179
|
+
k(!1), D(!1), document.body.style.overflow = "";
|
|
180
|
+
});
|
|
181
|
+
return () => {
|
|
182
|
+
clearTimeout(e), g();
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}, [
|
|
186
|
+
_,
|
|
187
|
+
O,
|
|
188
|
+
M
|
|
189
|
+
]), useEffect(() => {
|
|
190
|
+
if (!_ || E) return;
|
|
191
|
+
let e = (e) => {
|
|
192
|
+
e.key === "Escape" && v?.();
|
|
193
|
+
};
|
|
194
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
195
|
+
}, [
|
|
196
|
+
_,
|
|
197
|
+
E,
|
|
198
|
+
v
|
|
199
|
+
]);
|
|
200
|
+
let N = () => {
|
|
201
|
+
E || v?.();
|
|
202
|
+
};
|
|
203
|
+
if (!O) return null;
|
|
204
|
+
let P = A && !E;
|
|
205
|
+
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
206
|
+
className: clsx_default("fixed inset-0 z-50 h-fit flex justify-center p-4 mt-32", "transition-opacity duration-200", P ? "opacity-100" : "opacity-0"),
|
|
207
|
+
onClick: N,
|
|
208
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
209
|
+
className: clsx_default("fixed inset-0 bg-black/50 backdrop-blur-sm", "transition-opacity duration-200", P ? "opacity-100" : "opacity-0"),
|
|
210
|
+
"aria-hidden": "true"
|
|
211
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
212
|
+
className: clsx_default("relative w-full", SIZE_CLASSES[w], "bg-white dark:bg-gray-800 rounded-lg shadow-xl", "max-h-[90vh] overflow-hidden flex flex-col", "transition-all duration-200", P ? "opacity-100 scale-100 translate-y-0" : "opacity-0 scale-95 translate-y-2"),
|
|
213
|
+
onClick: (e) => e.stopPropagation(),
|
|
214
|
+
children: [y && /* @__PURE__ */ jsxs("div", {
|
|
215
|
+
className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",
|
|
216
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
217
|
+
className: "text-lg font-semibold text-gray-900 dark:text-gray-100",
|
|
218
|
+
children: y
|
|
219
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
220
|
+
icon: "i-mdi-close",
|
|
221
|
+
onClick: v?.bind(null),
|
|
222
|
+
"aria-label": "Close",
|
|
223
|
+
variant: "ghost",
|
|
224
|
+
className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"
|
|
225
|
+
})]
|
|
226
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
227
|
+
className: clsx_default("flex-1 overflow-y-auto px-6 py-4 text-gray-600 dark:text-gray-400", T),
|
|
228
|
+
children: x
|
|
229
|
+
})]
|
|
230
|
+
})]
|
|
231
|
+
}), document.body);
|
|
232
|
+
}
|
|
233
|
+
function Tabs({ items: _, defaultIndex: v = 0, className: y, tabListClassName: b, panelClassName: x, onChange: C }) {
|
|
234
|
+
let [w, T] = useState(v), E = (e) => {
|
|
235
|
+
_[e]?.disabled || (T(e), C?.(e));
|
|
236
|
+
}, D = _[w];
|
|
237
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
238
|
+
className: clsx_default("w-full", y),
|
|
239
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
240
|
+
role: "tablist",
|
|
241
|
+
className: clsx_default("flex gap-1 p-1 rounded-md bg-gray-100 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700", b),
|
|
242
|
+
children: _.map((_, v) => /* @__PURE__ */ jsxs("button", {
|
|
243
|
+
role: "tab",
|
|
244
|
+
type: "button",
|
|
245
|
+
"aria-selected": w === v,
|
|
246
|
+
"aria-disabled": _.disabled,
|
|
247
|
+
disabled: _.disabled,
|
|
248
|
+
onClick: () => E(v),
|
|
249
|
+
className: clsx_default("flex items-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium", w === v ? "bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400 shadow-sm border border-gray-200 dark:border-gray-600" : clsx_default("text-gray-600 dark:text-gray-400 border border-transparent", _.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")),
|
|
250
|
+
children: [_.icon && /* @__PURE__ */ jsx("span", { className: clsx_default("w-4 h-4 block shrink-0", _.icon, w === v ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400") }), _.title]
|
|
251
|
+
}, v))
|
|
252
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
253
|
+
role: "tabpanel",
|
|
254
|
+
className: clsx_default("mt-3 rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800/50 p-4 overflow-hidden", x),
|
|
255
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
256
|
+
className: "tabs-panel-inner",
|
|
257
|
+
children: D?.content
|
|
258
|
+
}, w)
|
|
259
|
+
})]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function Textarea({ label: _, error: v, showCharCount: y = !1, minLength: b, maxLength: C, className: w, wrapperClassName: T, value: E, defaultValue: D, onChange: O, id: k = "textarea", ...j }) {
|
|
263
|
+
let M = `${k}-${useId()}`, [N, P] = useState(typeof D == "string" ? D.length : 0), F = typeof E == "string" ? E.length : E === void 0 ? N : 0, I = y && (b !== void 0 || C !== void 0);
|
|
264
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
265
|
+
className: clsx_default("w-full", T),
|
|
266
|
+
children: [
|
|
267
|
+
_ && /* @__PURE__ */ jsx("label", {
|
|
268
|
+
className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",
|
|
269
|
+
htmlFor: M,
|
|
270
|
+
children: _
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
273
|
+
id: M,
|
|
274
|
+
className: clsx_default(BASE_INPUT_STYLES, "px-3 py-2 text-sm min-h-[80px] resize-y", v && "border-red-500 dark:border-red-400 focus:ring-red-500", w),
|
|
275
|
+
value: E,
|
|
276
|
+
defaultValue: D,
|
|
277
|
+
minLength: b,
|
|
278
|
+
maxLength: C,
|
|
279
|
+
onChange: (e) => {
|
|
280
|
+
E === void 0 && P(e.target.value.length), O?.(e);
|
|
281
|
+
},
|
|
282
|
+
...j
|
|
283
|
+
}),
|
|
284
|
+
I && /* @__PURE__ */ jsx(CharacterCount, {
|
|
285
|
+
current: F,
|
|
286
|
+
min: b,
|
|
287
|
+
max: C,
|
|
288
|
+
showMin: b !== void 0,
|
|
289
|
+
showMax: C !== void 0
|
|
290
|
+
}),
|
|
291
|
+
v && /* @__PURE__ */ jsx("p", {
|
|
292
|
+
className: "text-xs text-red-600 dark:text-red-400 mt-1",
|
|
293
|
+
children: v
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const useIsClient = () => {
|
|
299
|
+
let [e, g] = useState(!1);
|
|
300
|
+
return useEffect(() => {
|
|
301
|
+
requestAnimationFrame(() => {
|
|
302
|
+
g(!0);
|
|
303
|
+
});
|
|
304
|
+
}, []), e;
|
|
305
|
+
};
|
|
306
|
+
function applyTheme(e) {
|
|
307
|
+
let g = document.documentElement;
|
|
308
|
+
e === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? g.classList.add("dark") : g.classList.remove("dark") : e === "dark" ? g.classList.add("dark") : g.classList.remove("dark");
|
|
309
|
+
}
|
|
310
|
+
function getIcon(g) {
|
|
311
|
+
return /* @__PURE__ */ jsx("div", {
|
|
312
|
+
className: clsx_default({
|
|
313
|
+
light: "i-tabler-sun text-yellow-500",
|
|
314
|
+
dark: "i-tabler-moon-stars text-gray-700 dark:text-yellow-500",
|
|
315
|
+
system: "i-tabler-device-desktop text-blue-500"
|
|
316
|
+
}[g], "w-5 h-5"),
|
|
317
|
+
style: {
|
|
318
|
+
width: 20,
|
|
319
|
+
height: 20
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function ThemeToggle() {
|
|
324
|
+
let [g, _] = useState("system"), v = useIsClient();
|
|
325
|
+
return useEffect(() => {
|
|
326
|
+
let e = localStorage.getItem("theme");
|
|
327
|
+
requestAnimationFrame(() => {
|
|
328
|
+
e ? (_(e), applyTheme(e)) : (_("system"), applyTheme("system"));
|
|
329
|
+
});
|
|
330
|
+
}, []), useEffect(() => {
|
|
331
|
+
let e = window.matchMedia("(prefers-color-scheme: dark)"), _ = () => {
|
|
332
|
+
g === "system" && applyTheme("system");
|
|
333
|
+
};
|
|
334
|
+
return e.addEventListener("change", _), () => {
|
|
335
|
+
e.removeEventListener("change", _);
|
|
336
|
+
};
|
|
337
|
+
}, [g]), /* @__PURE__ */ jsx("button", {
|
|
338
|
+
onClick: useCallback(() => {
|
|
339
|
+
_((e) => {
|
|
340
|
+
let g;
|
|
341
|
+
return g = e === "light" ? "dark" : e === "dark" ? "system" : "light", applyTheme(g), localStorage.setItem("theme", g), g;
|
|
342
|
+
});
|
|
343
|
+
}, []),
|
|
344
|
+
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",
|
|
345
|
+
"aria-label": `Thème actuel: ${g}`,
|
|
346
|
+
children: v ? getIcon(g) : /* @__PURE__ */ jsx("div", {
|
|
347
|
+
className: "i-tabler-device-desktop w-5 h-5 text-gray-400",
|
|
348
|
+
style: {
|
|
349
|
+
width: "20px",
|
|
350
|
+
height: "20px"
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
export { BASE_INPUT_STYLES, Button, CharacterCount, ClientOnly, IconButton, Input, Modal, Tabs, Textarea, ThemeToggle, applyTheme, useClientOnly, useIsClient, useRunAfterAnimation, withClientOnly };
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
CHANGED
|
@@ -1,109 +1,97 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minimalstuff/ui",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Minimal UI lib for React built on top of Emotion",
|
|
3
|
+
"version": "1.0.0-4",
|
|
5
4
|
"type": "module",
|
|
6
|
-
"main": "./dist/
|
|
7
|
-
"module": "./dist/
|
|
5
|
+
"main": "./dist/minimalstuff-ui.js",
|
|
6
|
+
"module": "./dist/minimalstuff-ui.js",
|
|
8
7
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
8
|
"exports": {
|
|
13
9
|
".": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
}
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/minimalstuff-ui.js",
|
|
12
|
+
"default": "./dist/minimalstuff-ui.js"
|
|
13
|
+
},
|
|
14
|
+
"./style.css": "./dist/minimalstuff-ui.css"
|
|
18
15
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
22
21
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"dev": "vite",
|
|
29
|
-
"preview": "vite preview",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test-watch": "vitest",
|
|
32
|
-
"test:ui": "vitest --ui",
|
|
33
|
-
"test:staged": "vitest related --run",
|
|
34
|
-
"release": "release-it --only-version",
|
|
35
|
-
"storybook": "storybook dev -p 6006",
|
|
36
|
-
"build-storybook": "storybook build"
|
|
22
|
+
"imports": {
|
|
23
|
+
"#components/*": "./src/components/*.js",
|
|
24
|
+
"#hooks/*": "./src/hooks/*.js",
|
|
25
|
+
"#types/*": "./src/types/*.js",
|
|
26
|
+
"#utils/*": "./src/utils/*.js"
|
|
37
27
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@emotion/babel-plugin": "^11.11.0",
|
|
43
|
-
"@storybook/addon-essentials": "^8.1.11",
|
|
44
|
-
"@storybook/addon-themes": "^8.1.11",
|
|
45
|
-
"@storybook/blocks": "^8.1.11",
|
|
46
|
-
"@storybook/react": "^8.1.11",
|
|
47
|
-
"@storybook/react-vite": "^8.1.11",
|
|
48
|
-
"@storybook/test": "^8.1.11",
|
|
49
|
-
"@testing-library/jest-dom": "^6.4.6",
|
|
50
|
-
"@testing-library/react": "^16.0.0",
|
|
51
|
-
"@types/js-cookie": "^3.0.6",
|
|
52
|
-
"@types/node": "^20.14.9",
|
|
53
|
-
"@types/react": "^18.3.3",
|
|
54
|
-
"@types/react-dom": "^18.3.0",
|
|
55
|
-
"@types/react-toggle": "^4.0.5",
|
|
56
|
-
"@types/tinycolor2": "^1.4.6",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
58
|
-
"@typescript-eslint/parser": "^7.14.1",
|
|
59
|
-
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
60
|
-
"eslint": "^8.57.0",
|
|
61
|
-
"eslint-config-prettier": "^9.1.0",
|
|
62
|
-
"eslint-import-resolver-typescript": "^3.6.1",
|
|
63
|
-
"eslint-plugin-import": "^2.29.1",
|
|
64
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
65
|
-
"eslint-plugin-react": "^7.34.3",
|
|
66
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
67
|
-
"eslint-plugin-storybook": "^0.8.0",
|
|
68
|
-
"husky": "^9.0.11",
|
|
69
|
-
"jsdom": "^24.1.0",
|
|
70
|
-
"lint-staged": "^15.2.7",
|
|
71
|
-
"prettier": "^3.3.2",
|
|
72
|
-
"release-it": "^17.4.0",
|
|
73
|
-
"storybook": "^8.1.11",
|
|
74
|
-
"typescript": "^5.4.5",
|
|
75
|
-
"vite": "^5.3.2",
|
|
76
|
-
"vite-plugin-dts": "^3.9.1",
|
|
77
|
-
"vite-tsconfig-paths": "^4.3.2",
|
|
78
|
-
"vitest": "^1.6.0"
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
30
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
79
31
|
},
|
|
80
32
|
"dependencies": {
|
|
81
|
-
"
|
|
82
|
-
"@emotion/styled": "^11.11.5",
|
|
83
|
-
"hex-rgb": "^5.0.0",
|
|
84
|
-
"js-cookie": "^3.0.5",
|
|
85
|
-
"react": "^18.3.1",
|
|
86
|
-
"react-dom": "^18.3.1",
|
|
87
|
-
"react-hotkeys-hook": "^4.5.0",
|
|
88
|
-
"react-icons": "^5.2.1",
|
|
89
|
-
"react-select": "^5.8.0",
|
|
90
|
-
"react-toggle": "^4.1.3",
|
|
91
|
-
"tinycolor2": "^1.6.0"
|
|
33
|
+
"clsx": "^2.1.1"
|
|
92
34
|
},
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@chromatic-com/storybook": "^5.0.0",
|
|
37
|
+
"@eslint/js": "^9.39.1",
|
|
38
|
+
"@storybook/addon-a11y": "^10.2.3",
|
|
39
|
+
"@storybook/addon-docs": "^10.2.3",
|
|
40
|
+
"@storybook/addon-onboarding": "^10.2.3",
|
|
41
|
+
"@storybook/addon-vitest": "^10.2.3",
|
|
42
|
+
"@storybook/react-vite": "^10.2.3",
|
|
43
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
44
|
+
"@testing-library/react": "^16.3.2",
|
|
45
|
+
"@types/node": "^24.10.1",
|
|
46
|
+
"@types/react": "^19.2.5",
|
|
47
|
+
"@types/react-dom": "^19.2.3",
|
|
48
|
+
"@unocss/preset-icons": "^66.6.0",
|
|
49
|
+
"@unocss/preset-web-fonts": "^66.6.0",
|
|
50
|
+
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
51
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
52
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
53
|
+
"eslint": "^9.39.1",
|
|
54
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
55
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
56
|
+
"eslint-plugin-storybook": "^10.2.3",
|
|
57
|
+
"globals": "^16.5.0",
|
|
58
|
+
"happy-dom": "^20.4.0",
|
|
59
|
+
"playwright": "^1.58.0",
|
|
60
|
+
"prettier": "3.8.1",
|
|
61
|
+
"react": "^19.2.0",
|
|
62
|
+
"react-dom": "^19.2.0",
|
|
63
|
+
"release-it": "^19.2.4",
|
|
64
|
+
"storybook": "^10.2.3",
|
|
65
|
+
"typescript": "~5.9.3",
|
|
66
|
+
"typescript-eslint": "^8.46.4",
|
|
67
|
+
"unocss": "^66.6.0",
|
|
68
|
+
"vite": "npm:rolldown-vite@7.2.5",
|
|
69
|
+
"vite-plugin-dts": "^4.5.4",
|
|
70
|
+
"vitest": "^4.0.18"
|
|
99
71
|
},
|
|
100
|
-
"
|
|
101
|
-
"
|
|
72
|
+
"prettier": {
|
|
73
|
+
"trailingComma": "es5",
|
|
74
|
+
"semi": true,
|
|
75
|
+
"singleQuote": true,
|
|
76
|
+
"useTabs": true,
|
|
77
|
+
"quoteProps": "as-needed",
|
|
78
|
+
"bracketSpacing": true,
|
|
79
|
+
"arrowParens": "always",
|
|
80
|
+
"printWidth": 80
|
|
102
81
|
},
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"plugin:storybook/recommended"
|
|
106
|
-
]
|
|
82
|
+
"volta": {
|
|
83
|
+
"node": "24.13.0"
|
|
107
84
|
},
|
|
108
|
-
"
|
|
109
|
-
|
|
85
|
+
"scripts": {
|
|
86
|
+
"dev": "storybook dev -p 6006 --ci",
|
|
87
|
+
"build": "tsc -b && vite build",
|
|
88
|
+
"lint": "eslint .",
|
|
89
|
+
"test": "vitest run --config vitest.ci.config.ts",
|
|
90
|
+
"test:stories": "vitest run",
|
|
91
|
+
"preview": "vite preview",
|
|
92
|
+
"format": "prettier --write --parser typescript '**/*.{ts,tsx}'",
|
|
93
|
+
"storybook": "storybook dev -p 6006 ",
|
|
94
|
+
"build-storybook": "storybook build",
|
|
95
|
+
"release": "release-it"
|
|
96
|
+
}
|
|
97
|
+
}
|