@andreagiugni/tailwind-dashboard-ui 0.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.
Files changed (66) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +282 -0
  3. package/dist/Editor-uOYxR3HX.d.cts +53 -0
  4. package/dist/Editor-uOYxR3HX.d.ts +53 -0
  5. package/dist/chunk-4OETC46A.js +353 -0
  6. package/dist/chunk-4OETC46A.js.map +1 -0
  7. package/dist/chunk-7OWZKV75.js +420 -0
  8. package/dist/chunk-7OWZKV75.js.map +1 -0
  9. package/dist/chunk-BGA7AECV.cjs +152 -0
  10. package/dist/chunk-BGA7AECV.cjs.map +1 -0
  11. package/dist/chunk-HT7SQXRF.cjs +85 -0
  12. package/dist/chunk-HT7SQXRF.cjs.map +1 -0
  13. package/dist/chunk-HZQZC5CK.js +124 -0
  14. package/dist/chunk-HZQZC5CK.js.map +1 -0
  15. package/dist/chunk-MEU4PMP5.js +146 -0
  16. package/dist/chunk-MEU4PMP5.js.map +1 -0
  17. package/dist/chunk-MYOOZFHK.cjs +430 -0
  18. package/dist/chunk-MYOOZFHK.cjs.map +1 -0
  19. package/dist/chunk-OSIOO5AE.cjs +130 -0
  20. package/dist/chunk-OSIOO5AE.cjs.map +1 -0
  21. package/dist/chunk-R66LONPQ.js +83 -0
  22. package/dist/chunk-R66LONPQ.js.map +1 -0
  23. package/dist/chunk-W7SNEBD7.cjs +362 -0
  24. package/dist/chunk-W7SNEBD7.cjs.map +1 -0
  25. package/dist/chunk-YERNSNT4.cjs +13 -0
  26. package/dist/chunk-YERNSNT4.cjs.map +1 -0
  27. package/dist/chunk-ZLIYUUA4.js +11 -0
  28. package/dist/chunk-ZLIYUUA4.js.map +1 -0
  29. package/dist/components/Calendar/Calendar.cjs +14 -0
  30. package/dist/components/Calendar/Calendar.cjs.map +1 -0
  31. package/dist/components/Calendar/Calendar.d.cts +12 -0
  32. package/dist/components/Calendar/Calendar.d.ts +12 -0
  33. package/dist/components/Calendar/Calendar.js +5 -0
  34. package/dist/components/Calendar/Calendar.js.map +1 -0
  35. package/dist/components/Charts/BarChart.cjs +13 -0
  36. package/dist/components/Charts/BarChart.cjs.map +1 -0
  37. package/dist/components/Charts/BarChart.d.cts +13 -0
  38. package/dist/components/Charts/BarChart.d.ts +13 -0
  39. package/dist/components/Charts/BarChart.js +4 -0
  40. package/dist/components/Charts/BarChart.js.map +1 -0
  41. package/dist/components/Charts/LineChart.cjs +13 -0
  42. package/dist/components/Charts/LineChart.cjs.map +1 -0
  43. package/dist/components/Charts/LineChart.d.cts +13 -0
  44. package/dist/components/Charts/LineChart.d.ts +13 -0
  45. package/dist/components/Charts/LineChart.js +4 -0
  46. package/dist/components/Charts/LineChart.js.map +1 -0
  47. package/dist/components/Editor/Editor.cjs +14 -0
  48. package/dist/components/Editor/Editor.cjs.map +1 -0
  49. package/dist/components/Editor/Editor.d.cts +3 -0
  50. package/dist/components/Editor/Editor.d.ts +3 -0
  51. package/dist/components/Editor/Editor.js +5 -0
  52. package/dist/components/Editor/Editor.js.map +1 -0
  53. package/dist/components/Map/CountryMap.cjs +13 -0
  54. package/dist/components/Map/CountryMap.cjs.map +1 -0
  55. package/dist/components/Map/CountryMap.d.cts +13 -0
  56. package/dist/components/Map/CountryMap.d.ts +13 -0
  57. package/dist/components/Map/CountryMap.js +4 -0
  58. package/dist/components/Map/CountryMap.js.map +1 -0
  59. package/dist/index.cjs +2896 -0
  60. package/dist/index.cjs.map +1 -0
  61. package/dist/index.d.cts +573 -0
  62. package/dist/index.d.ts +573 -0
  63. package/dist/index.js +2816 -0
  64. package/dist/index.js.map +1 -0
  65. package/package.json +134 -0
  66. package/src/theme.css +784 -0
package/dist/index.js ADDED
@@ -0,0 +1,2816 @@
1
+ "use client";
2
+ export { BarChart } from './chunk-HZQZC5CK.js';
3
+ export { LineChart } from './chunk-MEU4PMP5.js';
4
+ export { Calendar, Modal } from './chunk-7OWZKV75.js';
5
+ export { CountryMap } from './chunk-R66LONPQ.js';
6
+ export { Editor } from './chunk-4OETC46A.js';
7
+ import { cn } from './chunk-ZLIYUUA4.js';
8
+ export { cn } from './chunk-ZLIYUUA4.js';
9
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
+ import React5, { useRef, useEffect, useState, useMemo, useCallback, useId } from 'react';
11
+ import flatpickr from 'flatpickr';
12
+ import 'flatpickr/dist/flatpickr.css';
13
+
14
+ // src/lib/styleOverride.ts
15
+ function styleOverride({
16
+ bgColor,
17
+ textColor,
18
+ borderColor
19
+ }) {
20
+ const style = {};
21
+ if (bgColor !== void 0) style.backgroundColor = bgColor;
22
+ if (textColor !== void 0) style.color = textColor;
23
+ if (borderColor !== void 0) style.borderColor = borderColor;
24
+ return style;
25
+ }
26
+ var sizeClasses = {
27
+ sm: "px-4 py-3 text-sm",
28
+ md: "px-5 py-3.5 text-sm"
29
+ };
30
+ var variantClasses = {
31
+ primary: "bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600 disabled:bg-brand-300",
32
+ outline: "bg-white text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-400 dark:ring-gray-700 dark:hover:bg-white/[0.03] dark:hover:text-gray-300"
33
+ };
34
+ var Button = ({
35
+ children,
36
+ size = "md",
37
+ variant = "primary",
38
+ startIcon,
39
+ endIcon,
40
+ className,
41
+ disabled = false,
42
+ bgColor,
43
+ textColor,
44
+ borderColor,
45
+ style,
46
+ ...rest
47
+ }) => {
48
+ return /* @__PURE__ */ jsxs(
49
+ "button",
50
+ {
51
+ className: cn(
52
+ "inline-flex items-center justify-center font-medium gap-2 rounded-lg transition",
53
+ sizeClasses[size],
54
+ variantClasses[variant],
55
+ disabled && "cursor-not-allowed opacity-50",
56
+ className
57
+ ),
58
+ disabled,
59
+ style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
60
+ ...rest,
61
+ children: [
62
+ startIcon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: startIcon }),
63
+ children,
64
+ endIcon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: endIcon })
65
+ ]
66
+ }
67
+ );
68
+ };
69
+ var sizeStyles = {
70
+ sm: "text-theme-xs",
71
+ md: "text-sm"
72
+ };
73
+ var variants = {
74
+ light: {
75
+ primary: "bg-brand-50 text-brand-500 dark:bg-brand-500/15 dark:text-brand-400",
76
+ success: "bg-success-50 text-success-600 dark:bg-success-500/15 dark:text-success-500",
77
+ error: "bg-error-50 text-error-600 dark:bg-error-500/15 dark:text-error-500",
78
+ warning: "bg-warning-50 text-warning-600 dark:bg-warning-500/15 dark:text-orange-400",
79
+ info: "bg-blue-light-50 text-blue-light-500 dark:bg-blue-light-500/15 dark:text-blue-light-500",
80
+ light: "bg-gray-100 text-gray-700 dark:bg-white/5 dark:text-white/80",
81
+ dark: "bg-gray-500 text-white dark:bg-white/5 dark:text-white"
82
+ },
83
+ solid: {
84
+ primary: "bg-brand-500 text-white dark:text-white",
85
+ success: "bg-success-500 text-white dark:text-white",
86
+ error: "bg-error-500 text-white dark:text-white",
87
+ warning: "bg-warning-500 text-white dark:text-white",
88
+ info: "bg-blue-light-500 text-white dark:text-white",
89
+ light: "bg-gray-400 dark:bg-white/5 text-white dark:text-white/80",
90
+ dark: "bg-gray-700 text-white dark:text-white"
91
+ }
92
+ };
93
+ var Badge = ({
94
+ variant = "light",
95
+ color = "primary",
96
+ size = "md",
97
+ startIcon,
98
+ endIcon,
99
+ children,
100
+ className,
101
+ bgColor,
102
+ textColor,
103
+ borderColor,
104
+ style,
105
+ ...rest
106
+ }) => {
107
+ return /* @__PURE__ */ jsxs(
108
+ "span",
109
+ {
110
+ className: cn(
111
+ "inline-flex items-center px-2.5 py-0.5 justify-center gap-1 rounded-full font-medium",
112
+ sizeStyles[size],
113
+ variants[variant][color],
114
+ className
115
+ ),
116
+ style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
117
+ ...rest,
118
+ children: [
119
+ startIcon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: startIcon }),
120
+ children,
121
+ endIcon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: endIcon })
122
+ ]
123
+ }
124
+ );
125
+ };
126
+ var colorClasses = {
127
+ primary: "bg-brand-500 text-white",
128
+ success: "bg-success-500 text-white",
129
+ error: "bg-error-500 text-white",
130
+ warning: "bg-warning-500 text-white",
131
+ info: "bg-blue-light-500 text-white",
132
+ dark: "bg-gray-800 text-white dark:bg-gray-700"
133
+ };
134
+ var cornerClasses = {
135
+ "top-left": "left-[-36px] top-[16px] w-[130px] -rotate-45",
136
+ "top-right": "right-[-36px] top-[16px] w-[130px] rotate-45",
137
+ "bottom-left": "bottom-[16px] left-[-36px] w-[130px] rotate-45",
138
+ "bottom-right": "bottom-[16px] right-[-36px] w-[130px] -rotate-45"
139
+ };
140
+ var roundedClasses = {
141
+ "top-left": "left-0 top-0 rounded-tl-xl rounded-br-lg",
142
+ "top-right": "right-0 top-0 rounded-tr-xl rounded-bl-lg",
143
+ "bottom-left": "bottom-0 left-0 rounded-bl-xl rounded-tr-lg",
144
+ "bottom-right": "bottom-0 right-0 rounded-br-xl rounded-tl-lg"
145
+ };
146
+ var flagClasses = {
147
+ "top-left": "left-0 top-4 rounded-r-sm pl-3 pr-5",
148
+ "bottom-left": "bottom-4 left-0 rounded-r-sm pl-3 pr-5",
149
+ "top-right": "right-0 top-4 rounded-l-sm pl-5 pr-3",
150
+ "bottom-right": "bottom-4 right-0 rounded-l-sm pl-5 pr-3"
151
+ };
152
+ var flagClipPath = {
153
+ "top-left": "polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%)",
154
+ "bottom-left": "polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%)",
155
+ "top-right": "polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%)",
156
+ "bottom-right": "polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%)"
157
+ };
158
+ var Ribbon = ({
159
+ variant = "corner",
160
+ color = "primary",
161
+ position = "top-right",
162
+ children,
163
+ className,
164
+ bgColor,
165
+ textColor,
166
+ borderColor,
167
+ style,
168
+ ...rest
169
+ }) => {
170
+ const variantClass = variant === "corner" ? cornerClasses[position] : variant === "rounded" ? roundedClasses[position] : flagClasses[position];
171
+ return /* @__PURE__ */ jsx(
172
+ "span",
173
+ {
174
+ className: cn(
175
+ "absolute z-10 inline-flex items-center justify-center whitespace-nowrap py-1 text-center text-theme-xs font-semibold shadow-theme-xs",
176
+ variant === "corner" && "px-10",
177
+ variant === "rounded" && "px-3",
178
+ colorClasses[color],
179
+ variantClass,
180
+ className
181
+ ),
182
+ style: {
183
+ ...variant === "flag" ? { clipPath: flagClipPath[position] } : void 0,
184
+ ...styleOverride({ bgColor, textColor, borderColor }),
185
+ ...style
186
+ },
187
+ ...rest,
188
+ children
189
+ }
190
+ );
191
+ };
192
+ var alertIcons = {
193
+ success: /* @__PURE__ */ jsx(
194
+ "svg",
195
+ {
196
+ className: "fill-current",
197
+ width: "24",
198
+ height: "24",
199
+ viewBox: "0 0 24 24",
200
+ xmlns: "http://www.w3.org/2000/svg",
201
+ children: /* @__PURE__ */ jsx(
202
+ "path",
203
+ {
204
+ fillRule: "evenodd",
205
+ clipRule: "evenodd",
206
+ d: "M3.70186 12.0001C3.70186 7.41711 7.41711 3.70186 12.0001 3.70186C16.5831 3.70186 20.2984 7.41711 20.2984 12.0001C20.2984 16.5831 16.5831 20.2984 12.0001 20.2984C7.41711 20.2984 3.70186 16.5831 3.70186 12.0001ZM12.0001 1.90186C6.423 1.90186 1.90186 6.423 1.90186 12.0001C1.90186 17.5772 6.423 22.0984 12.0001 22.0984C17.5772 22.0984 22.0984 17.5772 22.0984 12.0001C22.0984 6.423 17.5772 1.90186 12.0001 1.90186ZM15.6197 10.7395C15.9712 10.388 15.9712 9.81819 15.6197 9.46672C15.2683 9.11525 14.6984 9.11525 14.347 9.46672L11.1894 12.6243L9.6533 11.0883C9.30183 10.7368 8.73198 10.7368 8.38051 11.0883C8.02904 11.4397 8.02904 12.0096 8.38051 12.3611L10.553 14.5335C10.7217 14.7023 10.9507 14.7971 11.1894 14.7971C11.428 14.7971 11.657 14.7023 11.8257 14.5335L15.6197 10.7395Z"
207
+ }
208
+ )
209
+ }
210
+ ),
211
+ error: /* @__PURE__ */ jsx(
212
+ "svg",
213
+ {
214
+ className: "fill-current",
215
+ width: "24",
216
+ height: "24",
217
+ viewBox: "0 0 24 24",
218
+ fill: "none",
219
+ xmlns: "http://www.w3.org/2000/svg",
220
+ children: /* @__PURE__ */ jsx(
221
+ "path",
222
+ {
223
+ fillRule: "evenodd",
224
+ clipRule: "evenodd",
225
+ d: "M20.3499 12.0004C20.3499 16.612 16.6115 20.3504 11.9999 20.3504C7.38832 20.3504 3.6499 16.612 3.6499 12.0004C3.6499 7.38881 7.38833 3.65039 11.9999 3.65039C16.6115 3.65039 20.3499 7.38881 20.3499 12.0004ZM11.9999 22.1504C17.6056 22.1504 22.1499 17.6061 22.1499 12.0004C22.1499 6.3947 17.6056 1.85039 11.9999 1.85039C6.39421 1.85039 1.8499 6.3947 1.8499 12.0004C1.8499 17.6061 6.39421 22.1504 11.9999 22.1504ZM13.0008 16.4753C13.0008 15.923 12.5531 15.4753 12.0008 15.4753L11.9998 15.4753C11.4475 15.4753 10.9998 15.923 10.9998 16.4753C10.9998 17.0276 11.4475 17.4753 11.9998 17.4753L12.0008 17.4753C12.5531 17.4753 13.0008 17.0276 13.0008 16.4753ZM11.9998 6.62898C12.414 6.62898 12.7498 6.96476 12.7498 7.37898L12.7498 13.0555C12.7498 13.4697 12.414 13.8055 11.9998 13.8055C11.5856 13.8055 11.2498 13.4697 11.2498 13.0555L11.2498 7.37898C11.2498 6.96476 11.5856 6.62898 11.9998 6.62898Z",
226
+ fill: "#F04438"
227
+ }
228
+ )
229
+ }
230
+ ),
231
+ warning: /* @__PURE__ */ jsx(
232
+ "svg",
233
+ {
234
+ className: "fill-current",
235
+ width: "24",
236
+ height: "24",
237
+ viewBox: "0 0 24 24",
238
+ fill: "none",
239
+ xmlns: "http://www.w3.org/2000/svg",
240
+ children: /* @__PURE__ */ jsx(
241
+ "path",
242
+ {
243
+ fillRule: "evenodd",
244
+ clipRule: "evenodd",
245
+ d: "M3.6501 12.0001C3.6501 7.38852 7.38852 3.6501 12.0001 3.6501C16.6117 3.6501 20.3501 7.38852 20.3501 12.0001C20.3501 16.6117 16.6117 20.3501 12.0001 20.3501C7.38852 20.3501 3.6501 16.6117 3.6501 12.0001ZM12.0001 1.8501C6.39441 1.8501 1.8501 6.39441 1.8501 12.0001C1.8501 17.6058 6.39441 22.1501 12.0001 22.1501C17.6058 22.1501 22.1501 17.6058 22.1501 12.0001C22.1501 6.39441 17.6058 1.8501 12.0001 1.8501ZM10.9992 7.52517C10.9992 8.07746 11.4469 8.52517 11.9992 8.52517H12.0002C12.5525 8.52517 13.0002 8.07746 13.0002 7.52517C13.0002 6.97289 12.5525 6.52517 12.0002 6.52517H11.9992C11.4469 6.52517 10.9992 6.97289 10.9992 7.52517ZM12.0002 17.3715C11.586 17.3715 11.2502 17.0357 11.2502 16.6215V10.945C11.2502 10.5308 11.586 10.195 12.0002 10.195C12.4144 10.195 12.7502 10.5308 12.7502 10.945V16.6215C12.7502 17.0357 12.4144 17.3715 12.0002 17.3715Z",
246
+ fill: ""
247
+ }
248
+ )
249
+ }
250
+ ),
251
+ info: /* @__PURE__ */ jsx(
252
+ "svg",
253
+ {
254
+ className: "fill-current",
255
+ width: "24",
256
+ height: "24",
257
+ viewBox: "0 0 24 24",
258
+ fill: "none",
259
+ xmlns: "http://www.w3.org/2000/svg",
260
+ children: /* @__PURE__ */ jsx(
261
+ "path",
262
+ {
263
+ fillRule: "evenodd",
264
+ clipRule: "evenodd",
265
+ d: "M3.6501 11.9996C3.6501 7.38803 7.38852 3.64961 12.0001 3.64961C16.6117 3.64961 20.3501 7.38803 20.3501 11.9996C20.3501 16.6112 16.6117 20.3496 12.0001 20.3496C7.38852 20.3496 3.6501 16.6112 3.6501 11.9996ZM12.0001 1.84961C6.39441 1.84961 1.8501 6.39392 1.8501 11.9996C1.8501 17.6053 6.39441 22.1496 12.0001 22.1496C17.6058 22.1496 22.1501 17.6053 22.1501 11.9996C22.1501 6.39392 17.6058 1.84961 12.0001 1.84961ZM10.9992 7.52468C10.9992 8.07697 11.4469 8.52468 11.9992 8.52468H12.0002C12.5525 8.52468 13.0002 8.07697 13.0002 7.52468C13.0002 6.9724 12.5525 6.52468 12.0002 6.52468H11.9992C11.4469 6.52468 10.9992 6.9724 10.9992 7.52468ZM12.0002 17.371C11.586 17.371 11.2502 17.0352 11.2502 16.621V10.9445C11.2502 10.5303 11.586 10.1945 12.0002 10.1945C12.4144 10.1945 12.7502 10.5303 12.7502 10.9445V16.621C12.7502 17.0352 12.4144 17.371 12.0002 17.371Z",
266
+ fill: ""
267
+ }
268
+ )
269
+ }
270
+ )
271
+ };
272
+ var variantClasses2 = {
273
+ success: {
274
+ container: "border-success-500 bg-success-50 dark:border-success-500/30 dark:bg-success-500/15",
275
+ icon: "text-success-500"
276
+ },
277
+ error: {
278
+ container: "border-error-500 bg-error-50 dark:border-error-500/30 dark:bg-error-500/15",
279
+ icon: "text-error-500"
280
+ },
281
+ warning: {
282
+ container: "border-warning-500 bg-warning-50 dark:border-warning-500/30 dark:bg-warning-500/15",
283
+ icon: "text-warning-500"
284
+ },
285
+ info: {
286
+ container: "border-blue-light-500 bg-blue-light-50 dark:border-blue-light-500/30 dark:bg-blue-light-500/15",
287
+ icon: "text-blue-light-500"
288
+ }
289
+ };
290
+ var Alert = ({
291
+ variant,
292
+ title,
293
+ message,
294
+ showLink = false,
295
+ linkHref = "#",
296
+ linkText = "Learn more",
297
+ icon,
298
+ className,
299
+ ...rest
300
+ }) => {
301
+ return /* @__PURE__ */ jsx(
302
+ "div",
303
+ {
304
+ className: cn("rounded-xl border p-4", variantClasses2[variant].container, className),
305
+ ...rest,
306
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
307
+ /* @__PURE__ */ jsx("div", { className: cn("-mt-0.5", variantClasses2[variant].icon), children: icon ?? alertIcons[variant] }),
308
+ /* @__PURE__ */ jsxs("div", { children: [
309
+ /* @__PURE__ */ jsx("h4", { className: "mb-1 text-sm font-semibold text-gray-800 dark:text-white/90", children: title }),
310
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: message }),
311
+ showLink && /* @__PURE__ */ jsx(
312
+ "a",
313
+ {
314
+ href: linkHref,
315
+ className: "inline-block mt-3 text-sm font-medium text-gray-500 underline dark:text-gray-400",
316
+ children: linkText
317
+ }
318
+ )
319
+ ] })
320
+ ] })
321
+ }
322
+ );
323
+ };
324
+ var sizeClasses2 = {
325
+ xsmall: "h-6 w-6 max-w-6",
326
+ small: "h-8 w-8 max-w-8",
327
+ medium: "h-10 w-10 max-w-10",
328
+ large: "h-12 w-12 max-w-12",
329
+ xlarge: "h-14 w-14 max-w-14",
330
+ xxlarge: "h-16 w-16 max-w-16"
331
+ };
332
+ var statusSizeClasses = {
333
+ xsmall: "h-1.5 w-1.5 max-w-1.5",
334
+ small: "h-2 w-2 max-w-2",
335
+ medium: "h-2.5 w-2.5 max-w-2.5",
336
+ large: "h-3 w-3 max-w-3",
337
+ xlarge: "h-3.5 w-3.5 max-w-3.5",
338
+ xxlarge: "h-4 w-4 max-w-4"
339
+ };
340
+ var statusColorClasses = {
341
+ online: "bg-success-500",
342
+ offline: "bg-error-400",
343
+ busy: "bg-warning-500"
344
+ };
345
+ var Avatar = ({
346
+ src,
347
+ alt = "User Avatar",
348
+ size = "medium",
349
+ status = "none",
350
+ statusColor,
351
+ className,
352
+ ...rest
353
+ }) => {
354
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative rounded-full", sizeClasses2[size], className), children: [
355
+ /* @__PURE__ */ jsx(
356
+ "img",
357
+ {
358
+ src,
359
+ alt,
360
+ className: "object-cover w-full rounded-full",
361
+ ...rest
362
+ }
363
+ ),
364
+ status !== "none" && /* @__PURE__ */ jsx(
365
+ "span",
366
+ {
367
+ className: cn(
368
+ "absolute bottom-0 right-0 rounded-full border-[1.5px] border-white dark:border-gray-900",
369
+ statusSizeClasses[size],
370
+ !statusColor && statusColorClasses[status]
371
+ ),
372
+ style: statusColor ? { backgroundColor: statusColor } : void 0
373
+ }
374
+ )
375
+ ] });
376
+ };
377
+ var AvatarText = ({
378
+ name,
379
+ className,
380
+ ...rest
381
+ }) => {
382
+ const initials = name.split(" ").map((word) => word[0]).join("").toUpperCase().slice(0, 2);
383
+ const getColorClass = (name2) => {
384
+ const colors = [
385
+ "bg-brand-100 text-brand-600",
386
+ "bg-pink-100 text-pink-600",
387
+ "bg-cyan-100 text-cyan-600",
388
+ "bg-orange-100 text-orange-600",
389
+ "bg-green-100 text-green-600",
390
+ "bg-purple-100 text-purple-600",
391
+ "bg-yellow-100 text-yellow-600",
392
+ "bg-error-100 text-error-600"
393
+ ];
394
+ const index = name2.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
395
+ return colors[index % colors.length];
396
+ };
397
+ return /* @__PURE__ */ jsx(
398
+ "div",
399
+ {
400
+ className: cn(
401
+ "flex h-10 w-10 items-center justify-center rounded-full",
402
+ getColorClass(name),
403
+ className
404
+ ),
405
+ ...rest,
406
+ children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: initials })
407
+ }
408
+ );
409
+ };
410
+ var Dropdown = ({
411
+ isOpen,
412
+ onClose,
413
+ children,
414
+ className,
415
+ ...rest
416
+ }) => {
417
+ const dropdownRef = useRef(null);
418
+ useEffect(() => {
419
+ const handleClickOutside = (event) => {
420
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target) && !event.target.closest(".dropdown-toggle")) {
421
+ onClose();
422
+ }
423
+ };
424
+ document.addEventListener("mousedown", handleClickOutside);
425
+ return () => {
426
+ document.removeEventListener("mousedown", handleClickOutside);
427
+ };
428
+ }, [onClose]);
429
+ if (!isOpen) return null;
430
+ return /* @__PURE__ */ jsx(
431
+ "div",
432
+ {
433
+ ref: dropdownRef,
434
+ className: cn(
435
+ "absolute z-40 right-0 mt-2 rounded-xl border border-gray-200 bg-white shadow-theme-lg dark:border-gray-800 dark:bg-gray-dark",
436
+ className
437
+ ),
438
+ ...rest,
439
+ children
440
+ }
441
+ );
442
+ };
443
+ var variantBase = "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium transition";
444
+ var variantClasses3 = {
445
+ default: "text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-white/5 dark:hover:text-white",
446
+ primary: "bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600",
447
+ outline: "text-gray-700 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:text-gray-400 dark:ring-gray-700 dark:hover:bg-white/[0.03] dark:hover:text-gray-300"
448
+ };
449
+ var DropdownItem = ({
450
+ tag = "button",
451
+ href,
452
+ onClick,
453
+ onItemClick,
454
+ variant = "default",
455
+ baseClassName,
456
+ className,
457
+ bgColor,
458
+ textColor,
459
+ borderColor,
460
+ children
461
+ }) => {
462
+ const combinedClasses = baseClassName != null ? cn(baseClassName, className) : cn(variantBase, variantClasses3[variant], className);
463
+ const style = styleOverride({ bgColor, textColor, borderColor });
464
+ const handleClick = (event) => {
465
+ if (tag === "button") {
466
+ event.preventDefault();
467
+ }
468
+ if (onClick) onClick();
469
+ if (onItemClick) onItemClick();
470
+ };
471
+ if (tag === "a" && href) {
472
+ return /* @__PURE__ */ jsx("a", { href, className: combinedClasses, style, onClick: handleClick, children });
473
+ }
474
+ return /* @__PURE__ */ jsx("button", { onClick: handleClick, className: combinedClasses, style, children });
475
+ };
476
+ var Dropzone = ({
477
+ onDrop,
478
+ accept,
479
+ multiple = true,
480
+ title,
481
+ description = "Drag and drop your PNG, JPG, WebP, SVG images here or browse",
482
+ browseLabel = "Browse File",
483
+ className
484
+ }) => {
485
+ const inputRef = useRef(null);
486
+ const [isDragActive, setIsDragActive] = useState(false);
487
+ const handleFiles = (list) => {
488
+ if (list && list.length) onDrop?.(Array.from(list));
489
+ };
490
+ return /* @__PURE__ */ jsx(
491
+ "div",
492
+ {
493
+ className: cn(
494
+ "cursor-pointer rounded-xl border border-dashed border-gray-300 transition hover:border-brand-500 dark:border-gray-700 dark:hover:border-brand-500",
495
+ className
496
+ ),
497
+ children: /* @__PURE__ */ jsxs(
498
+ "div",
499
+ {
500
+ onClick: () => inputRef.current?.click(),
501
+ onDragOver: (e) => {
502
+ e.preventDefault();
503
+ setIsDragActive(true);
504
+ },
505
+ onDragLeave: (e) => {
506
+ e.preventDefault();
507
+ setIsDragActive(false);
508
+ },
509
+ onDrop: (e) => {
510
+ e.preventDefault();
511
+ setIsDragActive(false);
512
+ handleFiles(e.dataTransfer.files);
513
+ },
514
+ className: cn(
515
+ "rounded-xl border-dashed p-7 lg:p-10",
516
+ isDragActive ? "border-brand-500 bg-gray-100 dark:bg-gray-800" : "border-gray-300 bg-gray-50 dark:border-gray-700 dark:bg-gray-900"
517
+ ),
518
+ children: [
519
+ /* @__PURE__ */ jsx(
520
+ "input",
521
+ {
522
+ ref: inputRef,
523
+ type: "file",
524
+ accept,
525
+ multiple,
526
+ className: "hidden",
527
+ onChange: (e) => handleFiles(e.target.files)
528
+ }
529
+ ),
530
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
531
+ /* @__PURE__ */ jsx("div", { className: "mb-[22px] flex justify-center", children: /* @__PURE__ */ jsx("div", { className: "flex h-[68px] w-[68px] items-center justify-center rounded-full bg-gray-200 text-gray-700 dark:bg-gray-800 dark:text-gray-400", children: /* @__PURE__ */ jsx("svg", { className: "fill-current", width: "29", height: "28", viewBox: "0 0 29 28", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
532
+ "path",
533
+ {
534
+ fillRule: "evenodd",
535
+ clipRule: "evenodd",
536
+ d: "M14.5019 3.91699C14.2852 3.91699 14.0899 4.00891 13.953 4.15589L8.57363 9.53186C8.28065 9.82466 8.2805 10.2995 8.5733 10.5925C8.8661 10.8855 9.34097 10.8857 9.63396 10.5929L13.7519 6.47752V18.667C13.7519 19.0812 14.0877 19.417 14.5019 19.417C14.9161 19.417 15.2519 19.0812 15.2519 18.667V6.48234L19.3653 10.5929C19.6583 10.8857 20.1332 10.8855 20.426 10.5925C20.7188 10.2995 20.7186 9.82463 20.4256 9.53184L15.0838 4.19378C14.9463 4.02488 14.7367 3.91699 14.5019 3.91699ZM5.91626 18.667C5.91626 18.2528 5.58047 17.917 5.16626 17.917C4.75205 17.917 4.41626 18.2528 4.41626 18.667V21.8337C4.41626 23.0763 5.42362 24.0837 6.66626 24.0837H22.3339C23.5766 24.0837 24.5839 23.0763 24.5839 21.8337V18.667C24.5839 18.2528 24.2482 17.917 23.8339 17.917C23.4197 17.917 23.0839 18.2528 23.0839 18.667V21.8337C23.0839 22.2479 22.7482 22.5837 22.3339 22.5837H6.66626C6.25205 22.5837 5.91626 22.2479 5.91626 21.8337V18.667Z"
537
+ }
538
+ ) }) }) }),
539
+ /* @__PURE__ */ jsx("h4", { className: "mb-3 text-theme-xl font-semibold text-gray-800 dark:text-white/90", children: title ?? (isDragActive ? "Drop Files Here" : "Drag & Drop Files Here") }),
540
+ /* @__PURE__ */ jsx("span", { className: "mb-5 block w-full max-w-[290px] text-center text-sm text-gray-700 dark:text-gray-400", children: description }),
541
+ /* @__PURE__ */ jsx("span", { className: "text-theme-sm font-medium text-brand-500 underline", children: browseLabel })
542
+ ] })
543
+ ]
544
+ }
545
+ )
546
+ }
547
+ );
548
+ };
549
+ var Table = ({ children, className, ...rest }) => /* @__PURE__ */ jsx("table", { className: cn("min-w-full", className), ...rest, children });
550
+ var TableHeader = ({ children, className, ...rest }) => /* @__PURE__ */ jsx("thead", { className, ...rest, children });
551
+ var TableBody = ({ children, className, ...rest }) => /* @__PURE__ */ jsx("tbody", { className, ...rest, children });
552
+ var TableRow = ({ children, className, ...rest }) => /* @__PURE__ */ jsx("tr", { className, ...rest, children });
553
+ var TableCell = ({
554
+ children,
555
+ isHeader = false,
556
+ className,
557
+ ...rest
558
+ }) => {
559
+ const Tag = isHeader ? "th" : "td";
560
+ return /* @__PURE__ */ jsx(Tag, { className, ...rest, children });
561
+ };
562
+ var Pagination = ({
563
+ currentPage,
564
+ totalPages,
565
+ onPageChange
566
+ }) => {
567
+ const pagesAroundCurrent = Array.from(
568
+ { length: Math.min(3, totalPages) },
569
+ (_, i) => i + Math.max(currentPage - 1, 1)
570
+ );
571
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center ", children: [
572
+ /* @__PURE__ */ jsx(
573
+ "button",
574
+ {
575
+ onClick: () => onPageChange(currentPage - 1),
576
+ disabled: currentPage === 1,
577
+ "aria-label": "Previous",
578
+ className: cn(
579
+ "mr-2.5 flex items-center h-10 justify-center rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-gray-700 shadow-theme-xs hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03] text-sm"
580
+ ),
581
+ children: "Previous"
582
+ }
583
+ ),
584
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
585
+ currentPage > 3 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." }),
586
+ pagesAroundCurrent.map((page) => /* @__PURE__ */ jsx(
587
+ "button",
588
+ {
589
+ onClick: () => onPageChange(page),
590
+ "aria-current": currentPage === page ? "page" : void 0,
591
+ className: cn(
592
+ "flex w-10 items-center justify-center h-10 rounded-lg text-sm font-medium",
593
+ currentPage === page ? (
594
+ // active page keeps its color on hover (no hover restyle)
595
+ "bg-brand-500 text-white"
596
+ ) : (
597
+ // hover effect applies only to non-active page indices
598
+ "text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
599
+ )
600
+ ),
601
+ children: page
602
+ },
603
+ page
604
+ )),
605
+ currentPage < totalPages - 2 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." })
606
+ ] }),
607
+ /* @__PURE__ */ jsx(
608
+ "button",
609
+ {
610
+ onClick: () => onPageChange(currentPage + 1),
611
+ disabled: currentPage === totalPages,
612
+ "aria-label": "Next",
613
+ className: cn(
614
+ "ml-2.5 flex items-center justify-center rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-gray-700 shadow-theme-xs text-sm hover:bg-gray-50 h-10 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03]"
615
+ ),
616
+ children: "Next"
617
+ }
618
+ )
619
+ ] });
620
+ };
621
+ var Input = ({
622
+ className,
623
+ disabled = false,
624
+ success = false,
625
+ error = false,
626
+ hint,
627
+ bgColor,
628
+ textColor,
629
+ borderColor,
630
+ style,
631
+ ...rest
632
+ }) => {
633
+ const stateClass = disabled ? "text-gray-500 border-gray-300 cursor-not-allowed dark:bg-gray-800 dark:text-gray-400 dark:border-gray-700" : error ? "text-error-800 border-error-500 focus:ring-3 focus:ring-error-500/10 dark:text-error-400 dark:border-error-500" : success ? "text-success-500 border-success-400 focus:ring-success-500/10 focus:border-success-300 dark:text-success-400 dark:border-success-500" : "bg-transparent text-gray-800 border-gray-300 focus:border-brand-300 focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:focus:border-brand-800";
634
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
635
+ /* @__PURE__ */ jsx(
636
+ "input",
637
+ {
638
+ disabled,
639
+ className: cn(
640
+ "h-11 w-full rounded-lg border appearance-none px-4 py-2.5 text-sm shadow-theme-xs placeholder:text-gray-400 focus:outline-hidden focus:ring-3 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800",
641
+ stateClass,
642
+ className
643
+ ),
644
+ style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
645
+ ...rest
646
+ }
647
+ ),
648
+ hint && /* @__PURE__ */ jsx("p", { className: cn("mt-1.5 text-xs", error ? "text-error-500" : success ? "text-success-500" : "text-gray-500"), children: hint })
649
+ ] });
650
+ };
651
+ var alignClass = {
652
+ left: "text-left",
653
+ center: "text-center",
654
+ right: "text-right"
655
+ };
656
+ function SortIcon({
657
+ active,
658
+ direction
659
+ }) {
660
+ const on = "text-brand-500";
661
+ const off = "text-gray-400 dark:text-gray-600";
662
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex flex-col leading-none", children: [
663
+ /* @__PURE__ */ jsx("svg", { width: "10", height: "6", viewBox: "0 0 10 6", fill: "currentColor", "aria-hidden": "true", className: active && direction === "asc" ? on : off, children: /* @__PURE__ */ jsx("path", { d: "M5 0 9 5H1z" }) }),
664
+ /* @__PURE__ */ jsx("svg", { width: "10", height: "6", viewBox: "0 0 10 6", fill: "currentColor", "aria-hidden": "true", className: active && direction === "desc" ? on : off, children: /* @__PURE__ */ jsx("path", { d: "M5 6 1 1h8z" }) })
665
+ ] });
666
+ }
667
+ function DataTable({
668
+ data,
669
+ columns,
670
+ rowsPerPage = 10,
671
+ rowsPerPageOptions = [5, 10, 25, 50],
672
+ pagination = true,
673
+ showSizeSelector = true,
674
+ searchable = true,
675
+ searchPlaceholder = "Search...",
676
+ searchKeys,
677
+ defaultSortKey,
678
+ defaultSortDirection = "asc",
679
+ getRowId,
680
+ onRowClick,
681
+ emptyContent = "No matching records",
682
+ className
683
+ }) {
684
+ const [search, setSearch] = useState("");
685
+ const [pageSize, setPageSize] = useState(rowsPerPage);
686
+ const [sortKey, setSortKey] = useState(defaultSortKey);
687
+ const [sortDir, setSortDir] = useState(defaultSortDirection);
688
+ const [page, setPage] = useState(1);
689
+ const filtered = useMemo(() => {
690
+ const keys = searchKeys ?? columns.map((c) => c.key);
691
+ const q = search.trim().toLowerCase();
692
+ let rows = data;
693
+ if (searchable && q) {
694
+ rows = rows.filter(
695
+ (row) => keys.some((k) => String(row[k] ?? "").toLowerCase().includes(q))
696
+ );
697
+ }
698
+ if (sortKey) {
699
+ rows = [...rows].sort((a, b) => {
700
+ const av = a[sortKey];
701
+ const bv = b[sortKey];
702
+ const cmp = typeof av === "number" && typeof bv === "number" ? av - bv : String(av ?? "").localeCompare(String(bv ?? ""));
703
+ return sortDir === "asc" ? cmp : -cmp;
704
+ });
705
+ }
706
+ return rows;
707
+ }, [data, columns, search, searchable, searchKeys, sortKey, sortDir]);
708
+ const total = filtered.length;
709
+ const totalPages = pagination ? Math.max(1, Math.ceil(total / pageSize)) : 1;
710
+ const current = Math.min(page, totalPages);
711
+ const start = pagination ? (current - 1) * pageSize : 0;
712
+ const pageRows = pagination ? filtered.slice(start, start + pageSize) : filtered;
713
+ const toggleSort = (col) => {
714
+ if (!col.sortable) return;
715
+ if (sortKey === col.key) setSortDir((d) => d === "asc" ? "desc" : "asc");
716
+ else {
717
+ setSortKey(col.key);
718
+ setSortDir("asc");
719
+ }
720
+ setPage(1);
721
+ };
722
+ const sizeOptions = rowsPerPageOptions.length ? rowsPerPageOptions : [];
723
+ const showSelector = pagination && showSizeSelector && sizeOptions.length > 1;
724
+ const showControls = searchable || showSelector;
725
+ return /* @__PURE__ */ jsxs(
726
+ "div",
727
+ {
728
+ className: cn(
729
+ "rounded-xl border border-gray-200 bg-white dark:border-white/[0.05] dark:bg-white/[0.03]",
730
+ className
731
+ ),
732
+ children: [
733
+ showControls && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 p-4", children: [
734
+ showSelector ? /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400", children: [
735
+ "Show",
736
+ /* @__PURE__ */ jsx(
737
+ "select",
738
+ {
739
+ "aria-label": "Rows per page",
740
+ value: pageSize,
741
+ onChange: (e) => {
742
+ setPageSize(Number(e.target.value));
743
+ setPage(1);
744
+ },
745
+ className: "rounded-lg border border-gray-200 bg-transparent px-2 py-1.5 text-sm text-gray-700 dark:border-white/[0.08] dark:text-white/90",
746
+ children: sizeOptions.map((n) => /* @__PURE__ */ jsx("option", { value: n, children: n }, n))
747
+ }
748
+ ),
749
+ "entries"
750
+ ] }) : /* @__PURE__ */ jsx("span", {}),
751
+ searchable && /* @__PURE__ */ jsx(
752
+ Input,
753
+ {
754
+ type: "search",
755
+ "aria-label": "Search",
756
+ placeholder: searchPlaceholder,
757
+ value: search,
758
+ onChange: (e) => {
759
+ setSearch(e.target.value);
760
+ setPage(1);
761
+ },
762
+ className: "max-w-[220px]"
763
+ }
764
+ )
765
+ ] }),
766
+ /* @__PURE__ */ jsx("div", { className: "overflow-x-auto border-y border-gray-100 dark:border-white/[0.05]", children: /* @__PURE__ */ jsxs(Table, { children: [
767
+ /* @__PURE__ */ jsx(TableHeader, { className: "border-b border-gray-100 bg-gray-50 dark:border-white/[0.05] dark:bg-white/[0.06]", children: /* @__PURE__ */ jsx(TableRow, { children: columns.map((col) => {
768
+ const isActive = sortKey === col.key;
769
+ return /* @__PURE__ */ jsx(
770
+ TableCell,
771
+ {
772
+ isHeader: true,
773
+ className: cn(
774
+ "whitespace-nowrap px-5 py-3 text-xs font-semibold text-gray-700 dark:text-gray-300",
775
+ alignClass[col.align ?? "left"],
776
+ col.className
777
+ ),
778
+ children: col.sortable ? /* @__PURE__ */ jsxs(
779
+ "button",
780
+ {
781
+ type: "button",
782
+ onClick: () => toggleSort(col),
783
+ "aria-label": `Sort by ${typeof col.header === "string" ? col.header : col.key}`,
784
+ className: "inline-flex select-none items-center gap-1.5 hover:text-gray-900 dark:hover:text-white",
785
+ children: [
786
+ col.header,
787
+ /* @__PURE__ */ jsx(SortIcon, { active: isActive, direction: isActive ? sortDir : "asc" })
788
+ ]
789
+ }
790
+ ) : col.header
791
+ },
792
+ col.key
793
+ );
794
+ }) }) }),
795
+ /* @__PURE__ */ jsxs(TableBody, { className: "divide-y divide-gray-100 dark:divide-white/[0.05]", children: [
796
+ pageRows.map((row, i) => {
797
+ const index = start + i;
798
+ const id = getRowId ? getRowId(row, index) : index;
799
+ return /* @__PURE__ */ jsx(
800
+ TableRow,
801
+ {
802
+ onClick: onRowClick ? () => onRowClick(row, index) : void 0,
803
+ className: cn(onRowClick && "cursor-pointer hover:bg-gray-50 dark:hover:bg-white/[0.03]"),
804
+ children: columns.map((col) => /* @__PURE__ */ jsx(
805
+ TableCell,
806
+ {
807
+ className: cn(
808
+ "whitespace-nowrap px-5 py-3.5 text-sm text-gray-700 dark:text-gray-300",
809
+ alignClass[col.align ?? "left"],
810
+ col.className
811
+ ),
812
+ children: col.render ? col.render(row, index) : String(row[col.key] ?? "")
813
+ },
814
+ col.key
815
+ ))
816
+ },
817
+ id
818
+ );
819
+ }),
820
+ pageRows.length === 0 && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "px-5 py-6 text-center text-sm text-gray-400", children: emptyContent }) })
821
+ ] })
822
+ ] }) }),
823
+ pagination && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 p-4", children: [
824
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: total === 0 ? "Showing 0 entries" : `Showing ${start + 1} to ${Math.min(start + pageSize, total)} of ${total} entries` }),
825
+ totalPages > 1 && /* @__PURE__ */ jsx(Pagination, { currentPage: current, totalPages, onPageChange: setPage })
826
+ ] })
827
+ ]
828
+ }
829
+ );
830
+ }
831
+ var ChevronIcon = () => /* @__PURE__ */ jsx(
832
+ "svg",
833
+ {
834
+ className: "stroke-current",
835
+ width: "17",
836
+ height: "16",
837
+ viewBox: "0 0 17 16",
838
+ fill: "none",
839
+ xmlns: "http://www.w3.org/2000/svg",
840
+ children: /* @__PURE__ */ jsx(
841
+ "path",
842
+ {
843
+ d: "M6.0765 12.667L10.2432 8.50033L6.0765 4.33366",
844
+ stroke: "",
845
+ strokeWidth: "1.2",
846
+ strokeLinecap: "round",
847
+ strokeLinejoin: "round"
848
+ }
849
+ )
850
+ }
851
+ );
852
+ var Breadcrumb = ({ pageTitle, items }) => {
853
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 mb-6", children: [
854
+ /* @__PURE__ */ jsx(
855
+ "h2",
856
+ {
857
+ className: "text-xl font-semibold text-gray-800 dark:text-white/90",
858
+ "x-text": "pageName",
859
+ children: pageTitle
860
+ }
861
+ ),
862
+ /* @__PURE__ */ jsx("nav", { children: /* @__PURE__ */ jsxs("ol", { className: "flex items-center gap-1.5", children: [
863
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
864
+ "a",
865
+ {
866
+ className: "inline-flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400",
867
+ href: "/",
868
+ children: [
869
+ "Home",
870
+ /* @__PURE__ */ jsx(ChevronIcon, {})
871
+ ]
872
+ }
873
+ ) }),
874
+ items?.map((item, index) => /* @__PURE__ */ jsx("li", { children: item.href ? /* @__PURE__ */ jsxs(
875
+ "a",
876
+ {
877
+ className: "inline-flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400",
878
+ href: item.href,
879
+ children: [
880
+ item.label,
881
+ /* @__PURE__ */ jsx(ChevronIcon, {})
882
+ ]
883
+ }
884
+ ) : /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400", children: [
885
+ item.label,
886
+ /* @__PURE__ */ jsx(ChevronIcon, {})
887
+ ] }) }, index)),
888
+ /* @__PURE__ */ jsx("li", { className: "text-sm text-gray-800 dark:text-white/90", children: pageTitle })
889
+ ] }) })
890
+ ] });
891
+ };
892
+ var ThemeToggleButton = ({
893
+ theme,
894
+ onToggle,
895
+ className,
896
+ onClick,
897
+ ...rest
898
+ }) => {
899
+ const [internalTheme, setInternalTheme] = useState("light");
900
+ const isControlled = theme !== void 0;
901
+ const currentTheme = isControlled ? theme : internalTheme;
902
+ const handleClick = (e) => {
903
+ if (onToggle) {
904
+ onToggle();
905
+ } else if (!isControlled) {
906
+ setInternalTheme((prev) => prev === "light" ? "dark" : "light");
907
+ }
908
+ onClick?.(e);
909
+ };
910
+ return /* @__PURE__ */ jsxs(
911
+ "button",
912
+ {
913
+ onClick: handleClick,
914
+ "data-theme": currentTheme,
915
+ className: cn(
916
+ "relative flex items-center justify-center text-gray-500 transition-colors bg-white border border-gray-200 rounded-full hover:text-dark-900 h-11 w-11 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",
917
+ className
918
+ ),
919
+ ...rest,
920
+ children: [
921
+ /* @__PURE__ */ jsx(
922
+ "svg",
923
+ {
924
+ className: "hidden dark:block",
925
+ width: "20",
926
+ height: "20",
927
+ viewBox: "0 0 20 20",
928
+ fill: "none",
929
+ xmlns: "http://www.w3.org/2000/svg",
930
+ children: /* @__PURE__ */ jsx(
931
+ "path",
932
+ {
933
+ fillRule: "evenodd",
934
+ clipRule: "evenodd",
935
+ d: "M9.99998 1.5415C10.4142 1.5415 10.75 1.87729 10.75 2.2915V3.5415C10.75 3.95572 10.4142 4.2915 9.99998 4.2915C9.58577 4.2915 9.24998 3.95572 9.24998 3.5415V2.2915C9.24998 1.87729 9.58577 1.5415 9.99998 1.5415ZM10.0009 6.79327C8.22978 6.79327 6.79402 8.22904 6.79402 10.0001C6.79402 11.7712 8.22978 13.207 10.0009 13.207C11.772 13.207 13.2078 11.7712 13.2078 10.0001C13.2078 8.22904 11.772 6.79327 10.0009 6.79327ZM5.29402 10.0001C5.29402 7.40061 7.40135 5.29327 10.0009 5.29327C12.6004 5.29327 14.7078 7.40061 14.7078 10.0001C14.7078 12.5997 12.6004 14.707 10.0009 14.707C7.40135 14.707 5.29402 12.5997 5.29402 10.0001ZM15.9813 5.08035C16.2742 4.78746 16.2742 4.31258 15.9813 4.01969C15.6884 3.7268 15.2135 3.7268 14.9207 4.01969L14.0368 4.90357C13.7439 5.19647 13.7439 5.67134 14.0368 5.96423C14.3297 6.25713 14.8045 6.25713 15.0974 5.96423L15.9813 5.08035ZM18.4577 10.0001C18.4577 10.4143 18.1219 10.7501 17.7077 10.7501H16.4577C16.0435 10.7501 15.7077 10.4143 15.7077 10.0001C15.7077 9.58592 16.0435 9.25013 16.4577 9.25013H17.7077C18.1219 9.25013 18.4577 9.58592 18.4577 10.0001ZM14.9207 15.9806C15.2135 16.2735 15.6884 16.2735 15.9813 15.9806C16.2742 15.6877 16.2742 15.2128 15.9813 14.9199L15.0974 14.036C14.8045 13.7431 14.3297 13.7431 14.0368 14.036C13.7439 14.3289 13.7439 14.8038 14.0368 15.0967L14.9207 15.9806ZM9.99998 15.7088C10.4142 15.7088 10.75 16.0445 10.75 16.4588V17.7088C10.75 18.123 10.4142 18.4588 9.99998 18.4588C9.58577 18.4588 9.24998 18.123 9.24998 17.7088V16.4588C9.24998 16.0445 9.58577 15.7088 9.99998 15.7088ZM5.96356 15.0972C6.25646 14.8043 6.25646 14.3295 5.96356 14.0366C5.67067 13.7437 5.1958 13.7437 4.9029 14.0366L4.01902 14.9204C3.72613 15.2133 3.72613 15.6882 4.01902 15.9811C4.31191 16.274 4.78679 16.274 5.07968 15.9811L5.96356 15.0972ZM4.29224 10.0001C4.29224 10.4143 3.95645 10.7501 3.54224 10.7501H2.29224C1.87802 10.7501 1.54224 10.4143 1.54224 10.0001C1.54224 9.58592 1.87802 9.25013 2.29224 9.25013H3.54224C3.95645 9.25013 4.29224 9.58592 4.29224 10.0001ZM4.9029 5.9637C5.1958 6.25659 5.67067 6.25659 5.96356 5.9637C6.25646 5.6708 6.25646 5.19593 5.96356 4.90303L5.07968 4.01915C4.78679 3.72626 4.31191 3.72626 4.01902 4.01915C3.72613 4.31204 3.72613 4.78692 4.01902 5.07981L4.9029 5.9637Z",
936
+ fill: "currentColor"
937
+ }
938
+ )
939
+ }
940
+ ),
941
+ /* @__PURE__ */ jsx(
942
+ "svg",
943
+ {
944
+ className: "dark:hidden",
945
+ width: "20",
946
+ height: "20",
947
+ viewBox: "0 0 20 20",
948
+ fill: "none",
949
+ xmlns: "http://www.w3.org/2000/svg",
950
+ children: /* @__PURE__ */ jsx(
951
+ "path",
952
+ {
953
+ d: "M17.4547 11.97L18.1799 12.1611C18.265 11.8383 18.1265 11.4982 17.8401 11.3266C17.5538 11.1551 17.1885 11.1934 16.944 11.4207L17.4547 11.97ZM8.0306 2.5459L8.57989 3.05657C8.80718 2.81209 8.84554 2.44682 8.67398 2.16046C8.50243 1.8741 8.16227 1.73559 7.83948 1.82066L8.0306 2.5459ZM12.9154 13.0035C9.64678 13.0035 6.99707 10.3538 6.99707 7.08524H5.49707C5.49707 11.1823 8.81835 14.5035 12.9154 14.5035V13.0035ZM16.944 11.4207C15.8869 12.4035 14.4721 13.0035 12.9154 13.0035V14.5035C14.8657 14.5035 16.6418 13.7499 17.9654 12.5193L16.944 11.4207ZM16.7295 11.7789C15.9437 14.7607 13.2277 16.9586 10.0003 16.9586V18.4586C13.9257 18.4586 17.2249 15.7853 18.1799 12.1611L16.7295 11.7789ZM10.0003 16.9586C6.15734 16.9586 3.04199 13.8433 3.04199 10.0003H1.54199C1.54199 14.6717 5.32892 18.4586 10.0003 18.4586V16.9586ZM3.04199 10.0003C3.04199 6.77289 5.23988 4.05695 8.22173 3.27114L7.83948 1.82066C4.21532 2.77574 1.54199 6.07486 1.54199 10.0003H3.04199ZM6.99707 7.08524C6.99707 5.52854 7.5971 4.11366 8.57989 3.05657L7.48132 2.03522C6.25073 3.35885 5.49707 5.13487 5.49707 7.08524H6.99707Z",
954
+ fill: "currentColor"
955
+ }
956
+ )
957
+ }
958
+ )
959
+ ]
960
+ }
961
+ );
962
+ };
963
+ var AccordionContext = React5.createContext(null);
964
+ var ChevronIcon2 = ({ open }) => /* @__PURE__ */ jsx(
965
+ "svg",
966
+ {
967
+ className: cn(
968
+ "h-5 w-5 shrink-0 text-gray-500 transition-transform duration-200 dark:text-gray-400",
969
+ open && "rotate-180"
970
+ ),
971
+ viewBox: "0 0 20 20",
972
+ fill: "none",
973
+ "aria-hidden": "true",
974
+ children: /* @__PURE__ */ jsx(
975
+ "path",
976
+ {
977
+ d: "M5 7.5L10 12.5L15 7.5",
978
+ stroke: "currentColor",
979
+ strokeWidth: "1.5",
980
+ strokeLinecap: "round",
981
+ strokeLinejoin: "round"
982
+ }
983
+ )
984
+ }
985
+ );
986
+ var AccordionItem = ({
987
+ itemKey,
988
+ title,
989
+ startContent,
990
+ disabled = false,
991
+ children,
992
+ className,
993
+ ...rest
994
+ }) => {
995
+ const ctx = React5.useContext(AccordionContext);
996
+ if (!ctx) {
997
+ throw new Error("AccordionItem must be used within an Accordion");
998
+ }
999
+ const open = ctx.expanded.includes(itemKey);
1000
+ const panelId = `accordion-panel-${itemKey}`;
1001
+ const buttonId = `accordion-button-${itemKey}`;
1002
+ return /* @__PURE__ */ jsxs(
1003
+ "div",
1004
+ {
1005
+ className: cn(
1006
+ "border-b border-gray-200 last:border-b-0 dark:border-gray-800",
1007
+ className
1008
+ ),
1009
+ ...rest,
1010
+ children: [
1011
+ /* @__PURE__ */ jsx("h3", { children: /* @__PURE__ */ jsxs(
1012
+ "button",
1013
+ {
1014
+ type: "button",
1015
+ id: buttonId,
1016
+ "aria-expanded": open,
1017
+ "aria-controls": panelId,
1018
+ disabled,
1019
+ onClick: () => !disabled && ctx.toggle(itemKey),
1020
+ className: cn(
1021
+ "flex w-full items-center gap-3 px-4 py-4 text-left text-sm font-medium text-gray-800 transition dark:text-white/90",
1022
+ disabled ? "cursor-not-allowed opacity-50" : "hover:bg-gray-50 dark:hover:bg-white/[0.03]"
1023
+ ),
1024
+ children: [
1025
+ startContent && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: startContent }),
1026
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: title }),
1027
+ /* @__PURE__ */ jsx(ChevronIcon2, { open })
1028
+ ]
1029
+ }
1030
+ ) }),
1031
+ /* @__PURE__ */ jsx(
1032
+ "div",
1033
+ {
1034
+ id: panelId,
1035
+ role: "region",
1036
+ "aria-labelledby": buttonId,
1037
+ hidden: !open,
1038
+ className: cn(
1039
+ "grid transition-all duration-200 ease-in-out",
1040
+ open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
1041
+ ),
1042
+ children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 text-sm text-gray-500 dark:text-gray-400", children }) })
1043
+ }
1044
+ )
1045
+ ]
1046
+ }
1047
+ );
1048
+ };
1049
+ var Accordion = ({
1050
+ selectionMode = "single",
1051
+ defaultExpandedKeys = [],
1052
+ expandedKeys,
1053
+ onExpandedChange,
1054
+ children,
1055
+ className,
1056
+ ...rest
1057
+ }) => {
1058
+ const isControlled = expandedKeys !== void 0;
1059
+ const [internal, setInternal] = useState(defaultExpandedKeys);
1060
+ const expanded = isControlled ? expandedKeys : internal;
1061
+ const toggle = useCallback(
1062
+ (key) => {
1063
+ const isOpen = expanded.includes(key);
1064
+ let next;
1065
+ if (selectionMode === "single") {
1066
+ next = isOpen ? [] : [key];
1067
+ } else {
1068
+ next = isOpen ? expanded.filter((k) => k !== key) : [...expanded, key];
1069
+ }
1070
+ if (!isControlled) setInternal(next);
1071
+ onExpandedChange?.(next);
1072
+ },
1073
+ [expanded, selectionMode, isControlled, onExpandedChange]
1074
+ );
1075
+ return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: { expanded, toggle }, children: /* @__PURE__ */ jsx(
1076
+ "div",
1077
+ {
1078
+ className: cn(
1079
+ "divide-y divide-gray-200 overflow-hidden rounded-xl border border-gray-200 bg-white dark:divide-gray-800 dark:border-gray-800 dark:bg-white/[0.03]",
1080
+ className
1081
+ ),
1082
+ ...rest,
1083
+ children
1084
+ }
1085
+ ) });
1086
+ };
1087
+ var Tab = ({
1088
+ children,
1089
+ tabKey,
1090
+ title,
1091
+ disabled,
1092
+ ...rest
1093
+ }) => {
1094
+ return /* @__PURE__ */ jsx("div", { ...rest, children });
1095
+ };
1096
+ var Tabs = ({
1097
+ variant = "underline",
1098
+ selectedKey,
1099
+ defaultSelectedKey,
1100
+ onSelectionChange,
1101
+ color,
1102
+ children,
1103
+ className,
1104
+ ...rest
1105
+ }) => {
1106
+ const tabs = React5.Children.toArray(children).filter(
1107
+ React5.isValidElement
1108
+ );
1109
+ const firstKey = tabs[0]?.props.tabKey;
1110
+ const isControlled = selectedKey !== void 0;
1111
+ const [internal, setInternal] = useState(
1112
+ defaultSelectedKey ?? firstKey
1113
+ );
1114
+ const active = isControlled ? selectedKey : internal;
1115
+ const tabRefs = useRef({});
1116
+ const select = (key) => {
1117
+ if (!isControlled) setInternal(key);
1118
+ onSelectionChange?.(key);
1119
+ };
1120
+ const onKeyDown = (e, index) => {
1121
+ if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
1122
+ e.preventDefault();
1123
+ const dir = e.key === "ArrowRight" ? 1 : -1;
1124
+ const count = tabs.length;
1125
+ let next = index;
1126
+ for (let i = 0; i < count; i++) {
1127
+ next = (next + dir + count) % count;
1128
+ if (!tabs[next].props.disabled) break;
1129
+ }
1130
+ const nextKey = tabs[next].props.tabKey;
1131
+ tabRefs.current[nextKey]?.focus();
1132
+ select(nextKey);
1133
+ };
1134
+ const listClasses = {
1135
+ underline: "flex gap-2 border-b border-gray-200 dark:border-gray-800",
1136
+ solid: "inline-flex gap-1 rounded-lg bg-gray-100 p-1 dark:bg-white/[0.03]",
1137
+ pill: "inline-flex gap-2"
1138
+ };
1139
+ const tabClasses = (isActive) => {
1140
+ const base = "inline-flex items-center gap-2 text-sm font-medium transition focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50";
1141
+ switch (variant) {
1142
+ case "solid":
1143
+ return cn(
1144
+ base,
1145
+ "rounded-md px-4 py-2",
1146
+ isActive ? "bg-white text-gray-900 shadow-theme-xs dark:bg-gray-800 dark:text-white/90" : "text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white/90"
1147
+ );
1148
+ case "pill":
1149
+ return cn(
1150
+ base,
1151
+ "rounded-full px-4 py-2",
1152
+ isActive ? "bg-brand-500 text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-white/[0.03] dark:text-gray-400 dark:hover:bg-white/[0.06]"
1153
+ );
1154
+ case "underline":
1155
+ default:
1156
+ return cn(
1157
+ base,
1158
+ "border-b-2 px-4 py-3",
1159
+ isActive ? "border-brand-500 text-brand-500" : "border-transparent text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white/90"
1160
+ );
1161
+ }
1162
+ };
1163
+ const activeColorStyle = (isActive) => {
1164
+ if (!color || !isActive) return {};
1165
+ if (variant === "underline") return { borderColor: color, color };
1166
+ if (variant === "pill") return { backgroundColor: color };
1167
+ return { color };
1168
+ };
1169
+ const activePanel = tabs.find((t) => t.props.tabKey === active);
1170
+ return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), ...rest, children: [
1171
+ /* @__PURE__ */ jsx("div", { role: "tablist", className: listClasses[variant], children: tabs.map((tab, index) => {
1172
+ const { tabKey, title, disabled = false } = tab.props;
1173
+ const isActive = tabKey === active;
1174
+ return /* @__PURE__ */ jsx(
1175
+ "button",
1176
+ {
1177
+ ref: (el) => {
1178
+ tabRefs.current[tabKey] = el;
1179
+ },
1180
+ role: "tab",
1181
+ type: "button",
1182
+ id: `tab-${tabKey}`,
1183
+ "aria-selected": isActive,
1184
+ "aria-controls": `tabpanel-${tabKey}`,
1185
+ tabIndex: isActive ? 0 : -1,
1186
+ disabled,
1187
+ onClick: () => !disabled && select(tabKey),
1188
+ onKeyDown: (e) => onKeyDown(e, index),
1189
+ className: tabClasses(isActive),
1190
+ style: activeColorStyle(isActive),
1191
+ children: title
1192
+ },
1193
+ tabKey
1194
+ );
1195
+ }) }),
1196
+ activePanel && /* @__PURE__ */ jsx(
1197
+ "div",
1198
+ {
1199
+ role: "tabpanel",
1200
+ id: `tabpanel-${active}`,
1201
+ "aria-labelledby": `tab-${active}`,
1202
+ className: "pt-4 text-sm text-gray-600 dark:text-gray-300",
1203
+ children: activePanel.props.children
1204
+ }
1205
+ )
1206
+ ] });
1207
+ };
1208
+ var placementClasses = {
1209
+ top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
1210
+ right: "left-full top-1/2 -translate-y-1/2 ml-2",
1211
+ bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
1212
+ left: "right-full top-1/2 -translate-y-1/2 mr-2"
1213
+ };
1214
+ var arrowClasses = {
1215
+ top: "top-full left-1/2 -translate-x-1/2 -mt-1",
1216
+ right: "right-full top-1/2 -translate-y-1/2 -mr-1",
1217
+ bottom: "bottom-full left-1/2 -translate-x-1/2 -mb-1",
1218
+ left: "left-full top-1/2 -translate-y-1/2 -ml-1"
1219
+ };
1220
+ var Tooltip = ({
1221
+ content,
1222
+ placement = "top",
1223
+ delay = 0,
1224
+ disabled = false,
1225
+ children,
1226
+ className,
1227
+ bgColor,
1228
+ textColor,
1229
+ borderColor,
1230
+ style,
1231
+ ...rest
1232
+ }) => {
1233
+ const [visible, setVisible] = useState(false);
1234
+ const tooltipId = useId();
1235
+ const timeoutRef = useRef(null);
1236
+ const show = () => {
1237
+ if (disabled) return;
1238
+ if (delay > 0) {
1239
+ timeoutRef.current = setTimeout(() => setVisible(true), delay);
1240
+ } else {
1241
+ setVisible(true);
1242
+ }
1243
+ };
1244
+ const hide = () => {
1245
+ if (timeoutRef.current) {
1246
+ clearTimeout(timeoutRef.current);
1247
+ timeoutRef.current = null;
1248
+ }
1249
+ setVisible(false);
1250
+ };
1251
+ return /* @__PURE__ */ jsxs(
1252
+ "span",
1253
+ {
1254
+ className: cn("relative inline-flex", className),
1255
+ onMouseEnter: show,
1256
+ onMouseLeave: hide,
1257
+ onFocus: show,
1258
+ onBlur: hide,
1259
+ "aria-describedby": visible ? tooltipId : void 0,
1260
+ ...rest,
1261
+ children: [
1262
+ children,
1263
+ !disabled && visible && /* @__PURE__ */ jsxs(
1264
+ "span",
1265
+ {
1266
+ id: tooltipId,
1267
+ role: "tooltip",
1268
+ className: cn(
1269
+ "pointer-events-none absolute z-50 whitespace-nowrap rounded-lg bg-gray-900 px-3 py-2 text-xs font-medium text-white shadow-theme-lg dark:bg-gray-700 dark:text-white/90",
1270
+ placementClasses[placement]
1271
+ ),
1272
+ style: {
1273
+ ...styleOverride({ bgColor, textColor, borderColor }),
1274
+ ...style
1275
+ },
1276
+ children: [
1277
+ content,
1278
+ /* @__PURE__ */ jsx(
1279
+ "span",
1280
+ {
1281
+ className: cn(
1282
+ "absolute h-2 w-2 rotate-45 bg-gray-900 dark:bg-gray-700",
1283
+ arrowClasses[placement]
1284
+ ),
1285
+ style: bgColor ? { backgroundColor: bgColor } : void 0,
1286
+ "aria-hidden": "true"
1287
+ }
1288
+ )
1289
+ ]
1290
+ }
1291
+ )
1292
+ ]
1293
+ }
1294
+ );
1295
+ };
1296
+ var placementClasses2 = {
1297
+ top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
1298
+ right: "left-full top-1/2 -translate-y-1/2 ml-2",
1299
+ bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
1300
+ left: "right-full top-1/2 -translate-y-1/2 mr-2"
1301
+ };
1302
+ var Popover = ({
1303
+ trigger,
1304
+ placement = "bottom",
1305
+ isOpen: controlledOpen,
1306
+ onOpenChange,
1307
+ defaultOpen = false,
1308
+ closeOnOutsideClick = true,
1309
+ closeOnEsc = true,
1310
+ children,
1311
+ className,
1312
+ ...rest
1313
+ }) => {
1314
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
1315
+ const isControlled = controlledOpen !== void 0;
1316
+ const open = isControlled ? controlledOpen : uncontrolledOpen;
1317
+ const wrapperRef = useRef(null);
1318
+ const setOpen = (next) => {
1319
+ if (!isControlled) setUncontrolledOpen(next);
1320
+ onOpenChange?.(next);
1321
+ };
1322
+ useEffect(() => {
1323
+ if (!open) return;
1324
+ const handleClickOutside = (event) => {
1325
+ if (closeOnOutsideClick && wrapperRef.current && !wrapperRef.current.contains(event.target)) {
1326
+ setOpen(false);
1327
+ }
1328
+ };
1329
+ const handleEscape = (event) => {
1330
+ if (closeOnEsc && event.key === "Escape") {
1331
+ setOpen(false);
1332
+ }
1333
+ };
1334
+ document.addEventListener("mousedown", handleClickOutside);
1335
+ document.addEventListener("keydown", handleEscape);
1336
+ return () => {
1337
+ document.removeEventListener("mousedown", handleClickOutside);
1338
+ document.removeEventListener("keydown", handleEscape);
1339
+ };
1340
+ }, [open, closeOnOutsideClick, closeOnEsc]);
1341
+ return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: "relative inline-block", children: [
1342
+ /* @__PURE__ */ jsx(
1343
+ "span",
1344
+ {
1345
+ className: "inline-flex cursor-pointer",
1346
+ "aria-haspopup": "dialog",
1347
+ "aria-expanded": open,
1348
+ onClick: () => setOpen(!open),
1349
+ children: trigger
1350
+ }
1351
+ ),
1352
+ open && /* @__PURE__ */ jsx(
1353
+ "div",
1354
+ {
1355
+ role: "dialog",
1356
+ className: cn(
1357
+ "absolute z-50 min-w-[12rem] rounded-xl border border-gray-200 bg-white p-4 shadow-theme-lg dark:border-gray-700 dark:bg-gray-900 dark:text-white/90",
1358
+ placementClasses2[placement],
1359
+ className
1360
+ ),
1361
+ ...rest,
1362
+ children
1363
+ }
1364
+ )
1365
+ ] });
1366
+ };
1367
+ var panelBaseByPlacement = {
1368
+ left: "top-0 left-0 h-full",
1369
+ right: "top-0 right-0 h-full",
1370
+ top: "top-0 left-0 w-full",
1371
+ bottom: "bottom-0 left-0 w-full"
1372
+ };
1373
+ var openTransform = {
1374
+ left: "translate-x-0",
1375
+ right: "translate-x-0",
1376
+ top: "translate-y-0",
1377
+ bottom: "translate-y-0"
1378
+ };
1379
+ var closedTransform = {
1380
+ left: "-translate-x-full",
1381
+ right: "translate-x-full",
1382
+ top: "-translate-y-full",
1383
+ bottom: "translate-y-full"
1384
+ };
1385
+ var defaultSize = {
1386
+ left: "w-80 max-w-full",
1387
+ right: "w-80 max-w-full",
1388
+ top: "h-80 max-h-full",
1389
+ bottom: "h-80 max-h-full"
1390
+ };
1391
+ var Drawer = ({
1392
+ isOpen,
1393
+ onClose,
1394
+ children,
1395
+ className,
1396
+ placement = "right",
1397
+ showCloseButton = true,
1398
+ closeOnBackdrop = true,
1399
+ closeOnEsc = true,
1400
+ size,
1401
+ ...rest
1402
+ }) => {
1403
+ useEffect(() => {
1404
+ const handleEscape = (event) => {
1405
+ if (event.key === "Escape") {
1406
+ onClose();
1407
+ }
1408
+ };
1409
+ if (isOpen && closeOnEsc) {
1410
+ document.addEventListener("keydown", handleEscape);
1411
+ }
1412
+ return () => {
1413
+ document.removeEventListener("keydown", handleEscape);
1414
+ };
1415
+ }, [isOpen, onClose, closeOnEsc]);
1416
+ useEffect(() => {
1417
+ if (isOpen) {
1418
+ document.body.style.overflow = "hidden";
1419
+ } else {
1420
+ document.body.style.overflow = "unset";
1421
+ }
1422
+ return () => {
1423
+ document.body.style.overflow = "unset";
1424
+ };
1425
+ }, [isOpen]);
1426
+ if (!isOpen) return null;
1427
+ return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-99999 drawer", children: [
1428
+ /* @__PURE__ */ jsx(
1429
+ "div",
1430
+ {
1431
+ className: "fixed inset-0 h-full w-full bg-black/50 backdrop-blur-sm",
1432
+ onClick: closeOnBackdrop ? onClose : void 0
1433
+ }
1434
+ ),
1435
+ /* @__PURE__ */ jsxs(
1436
+ "div",
1437
+ {
1438
+ role: "dialog",
1439
+ "aria-modal": "true",
1440
+ className: cn(
1441
+ "fixed flex flex-col overflow-y-auto bg-white shadow-theme-lg transition-transform duration-300 ease-in-out dark:bg-gray-900 dark:text-white/90",
1442
+ panelBaseByPlacement[placement],
1443
+ size ?? defaultSize[placement],
1444
+ isOpen ? openTransform[placement] : closedTransform[placement],
1445
+ className
1446
+ ),
1447
+ onClick: (e) => e.stopPropagation(),
1448
+ ...rest,
1449
+ children: [
1450
+ showCloseButton && /* @__PURE__ */ jsx(
1451
+ "button",
1452
+ {
1453
+ onClick: onClose,
1454
+ "aria-label": "Close drawer",
1455
+ className: "absolute right-3 top-3 z-999 flex h-9.5 w-9.5 items-center justify-center rounded-full bg-gray-100 text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white",
1456
+ children: /* @__PURE__ */ jsx(
1457
+ "svg",
1458
+ {
1459
+ width: "24",
1460
+ height: "24",
1461
+ viewBox: "0 0 24 24",
1462
+ fill: "none",
1463
+ xmlns: "http://www.w3.org/2000/svg",
1464
+ children: /* @__PURE__ */ jsx(
1465
+ "path",
1466
+ {
1467
+ fillRule: "evenodd",
1468
+ clipRule: "evenodd",
1469
+ d: "M6.04289 16.5413C5.65237 16.9318 5.65237 17.565 6.04289 17.9555C6.43342 18.346 7.06658 18.346 7.45711 17.9555L11.9987 13.4139L16.5408 17.956C16.9313 18.3466 17.5645 18.3466 17.955 17.956C18.3455 17.5655 18.3455 16.9323 17.955 16.5418L13.4129 11.9997L17.955 7.4576C18.3455 7.06707 18.3455 6.43391 17.955 6.04338C17.5645 5.65286 16.9313 5.65286 16.5408 6.04338L11.9987 10.5855L7.45711 6.0439C7.06658 5.65338 6.43342 5.65338 6.04289 6.0439C5.65237 6.43442 5.65237 7.06759 6.04289 7.45811L10.5845 11.9997L6.04289 16.5413Z",
1470
+ fill: "currentColor"
1471
+ }
1472
+ )
1473
+ }
1474
+ )
1475
+ }
1476
+ ),
1477
+ children
1478
+ ]
1479
+ }
1480
+ )
1481
+ ] });
1482
+ };
1483
+ var sizeStyles2 = {
1484
+ sm: "text-theme-xs",
1485
+ md: "text-sm"
1486
+ };
1487
+ var variants2 = {
1488
+ light: {
1489
+ primary: "bg-brand-50 text-brand-500 dark:bg-brand-500/15 dark:text-brand-400",
1490
+ success: "bg-success-50 text-success-600 dark:bg-success-500/15 dark:text-success-500",
1491
+ error: "bg-error-50 text-error-600 dark:bg-error-500/15 dark:text-error-500",
1492
+ warning: "bg-warning-50 text-warning-600 dark:bg-warning-500/15 dark:text-orange-400",
1493
+ info: "bg-blue-light-50 text-blue-light-500 dark:bg-blue-light-500/15 dark:text-blue-light-500",
1494
+ light: "bg-gray-100 text-gray-700 dark:bg-white/5 dark:text-white/80",
1495
+ dark: "bg-gray-500 text-white dark:bg-white/5 dark:text-white"
1496
+ },
1497
+ solid: {
1498
+ primary: "bg-brand-500 text-white dark:text-white",
1499
+ success: "bg-success-500 text-white dark:text-white",
1500
+ error: "bg-error-500 text-white dark:text-white",
1501
+ warning: "bg-warning-500 text-white dark:text-white",
1502
+ info: "bg-blue-light-500 text-white dark:text-white",
1503
+ light: "bg-gray-400 dark:bg-white/5 text-white dark:text-white/80",
1504
+ dark: "bg-gray-700 text-white dark:text-white"
1505
+ }
1506
+ };
1507
+ var Chip = ({
1508
+ variant = "light",
1509
+ color = "primary",
1510
+ size = "md",
1511
+ startIcon,
1512
+ endIcon,
1513
+ avatar,
1514
+ onClose,
1515
+ children,
1516
+ className,
1517
+ bgColor,
1518
+ textColor,
1519
+ borderColor,
1520
+ style,
1521
+ ...rest
1522
+ }) => {
1523
+ return /* @__PURE__ */ jsxs(
1524
+ "span",
1525
+ {
1526
+ className: cn(
1527
+ "inline-flex items-center justify-center gap-1 rounded-full font-medium",
1528
+ avatar ? "py-0.5 pl-0.5 pr-2.5" : "px-2.5 py-0.5",
1529
+ sizeStyles2[size],
1530
+ variants2[variant][color],
1531
+ className
1532
+ ),
1533
+ style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
1534
+ ...rest,
1535
+ children: [
1536
+ avatar && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: avatar }),
1537
+ startIcon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: startIcon }),
1538
+ children,
1539
+ endIcon && /* @__PURE__ */ jsx("span", { className: "flex items-center", children: endIcon }),
1540
+ onClose && /* @__PURE__ */ jsx(
1541
+ "button",
1542
+ {
1543
+ type: "button",
1544
+ "aria-label": "Remove",
1545
+ onClick: onClose,
1546
+ className: "ml-0.5 flex h-4 w-4 items-center justify-center rounded-full text-current opacity-70 transition hover:opacity-100 focus:outline-none",
1547
+ children: /* @__PURE__ */ jsx(
1548
+ "svg",
1549
+ {
1550
+ width: "12",
1551
+ height: "12",
1552
+ viewBox: "0 0 12 12",
1553
+ fill: "none",
1554
+ xmlns: "http://www.w3.org/2000/svg",
1555
+ "aria-hidden": "true",
1556
+ children: /* @__PURE__ */ jsx(
1557
+ "path",
1558
+ {
1559
+ d: "M9 3L3 9M3 3L9 9",
1560
+ stroke: "currentColor",
1561
+ strokeWidth: "1.5",
1562
+ strokeLinecap: "round",
1563
+ strokeLinejoin: "round"
1564
+ }
1565
+ )
1566
+ }
1567
+ )
1568
+ }
1569
+ )
1570
+ ]
1571
+ }
1572
+ );
1573
+ };
1574
+ var sizeStyles3 = {
1575
+ sm: "h-1.5",
1576
+ md: "h-2.5",
1577
+ lg: "h-4"
1578
+ };
1579
+ var fillColors = {
1580
+ primary: "bg-brand-500",
1581
+ success: "bg-success-500",
1582
+ error: "bg-error-500",
1583
+ warning: "bg-warning-500",
1584
+ info: "bg-blue-light-500",
1585
+ light: "bg-gray-400",
1586
+ dark: "bg-gray-700 dark:bg-gray-300"
1587
+ };
1588
+ var indeterminateKeyframes = `@keyframes tdui-progress-indeterminate {
1589
+ 0% { left: -40%; width: 40%; }
1590
+ 50% { left: 30%; width: 60%; }
1591
+ 100% { left: 100%; width: 40%; }
1592
+ }`;
1593
+ var Progress = ({
1594
+ value = 0,
1595
+ maxValue = 100,
1596
+ color = "primary",
1597
+ size = "md",
1598
+ label,
1599
+ showValueLabel = false,
1600
+ isIndeterminate = false,
1601
+ className,
1602
+ bgColor,
1603
+ textColor,
1604
+ borderColor,
1605
+ style,
1606
+ ...rest
1607
+ }) => {
1608
+ const safeMax = maxValue <= 0 ? 100 : maxValue;
1609
+ const clamped = Math.min(Math.max(value, 0), safeMax);
1610
+ const percent = Math.round(clamped / safeMax * 100);
1611
+ return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), ...rest, children: [
1612
+ (label || showValueLabel) && /* @__PURE__ */ jsxs("div", { className: "mb-1.5 flex items-center justify-between", children: [
1613
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-400", children: label }),
1614
+ showValueLabel && !isIndeterminate && /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-400", children: [
1615
+ percent,
1616
+ "%"
1617
+ ] })
1618
+ ] }),
1619
+ /* @__PURE__ */ jsx(
1620
+ "div",
1621
+ {
1622
+ role: "progressbar",
1623
+ "aria-valuemin": 0,
1624
+ "aria-valuemax": safeMax,
1625
+ "aria-valuenow": isIndeterminate ? void 0 : clamped,
1626
+ className: cn(
1627
+ "relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800",
1628
+ sizeStyles3[size]
1629
+ ),
1630
+ style: styleOverride({ bgColor, borderColor }),
1631
+ children: isIndeterminate ? /* @__PURE__ */ jsxs(Fragment, { children: [
1632
+ /* @__PURE__ */ jsx("style", { children: indeterminateKeyframes }),
1633
+ /* @__PURE__ */ jsx(
1634
+ "div",
1635
+ {
1636
+ className: cn("absolute top-0 h-full rounded-full", fillColors[color]),
1637
+ style: {
1638
+ animation: "tdui-progress-indeterminate 1.5s ease-in-out infinite",
1639
+ ...textColor ? { backgroundColor: textColor } : {},
1640
+ ...style
1641
+ }
1642
+ }
1643
+ )
1644
+ ] }) : /* @__PURE__ */ jsx(
1645
+ "div",
1646
+ {
1647
+ className: cn(
1648
+ "h-full rounded-full transition-all duration-300",
1649
+ fillColors[color]
1650
+ ),
1651
+ style: {
1652
+ width: `${percent}%`,
1653
+ ...textColor ? { backgroundColor: textColor } : {},
1654
+ ...style
1655
+ }
1656
+ }
1657
+ )
1658
+ }
1659
+ )
1660
+ ] });
1661
+ };
1662
+ var sizeStyles4 = {
1663
+ sm: "h-4 w-4 border-2",
1664
+ md: "h-6 w-6 border-2",
1665
+ lg: "h-8 w-8 border-[3px]"
1666
+ };
1667
+ var colorStyles = {
1668
+ primary: "text-brand-500",
1669
+ success: "text-success-500",
1670
+ error: "text-error-500",
1671
+ warning: "text-warning-500",
1672
+ info: "text-blue-light-500",
1673
+ light: "text-gray-400",
1674
+ dark: "text-gray-700 dark:text-gray-300"
1675
+ };
1676
+ var Spinner = ({
1677
+ size = "md",
1678
+ color = "primary",
1679
+ label,
1680
+ className,
1681
+ bgColor,
1682
+ textColor,
1683
+ borderColor,
1684
+ style,
1685
+ ...rest
1686
+ }) => {
1687
+ const accessibleLabel = typeof label === "string" ? label : "Loading";
1688
+ return /* @__PURE__ */ jsxs(
1689
+ "span",
1690
+ {
1691
+ role: "status",
1692
+ "aria-label": accessibleLabel,
1693
+ className: cn("inline-flex items-center gap-2", className),
1694
+ style: { ...styleOverride({ bgColor, borderColor }), ...style },
1695
+ ...rest,
1696
+ children: [
1697
+ /* @__PURE__ */ jsx(
1698
+ "span",
1699
+ {
1700
+ "aria-hidden": "true",
1701
+ className: cn(
1702
+ "inline-block animate-spin rounded-full border-current border-t-transparent",
1703
+ sizeStyles4[size],
1704
+ !textColor && colorStyles[color]
1705
+ ),
1706
+ style: textColor ? { color: textColor } : void 0
1707
+ }
1708
+ ),
1709
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: label })
1710
+ ]
1711
+ }
1712
+ );
1713
+ };
1714
+ var Skeleton = ({
1715
+ isLoaded = false,
1716
+ width,
1717
+ height,
1718
+ className,
1719
+ children,
1720
+ style,
1721
+ ...rest
1722
+ }) => {
1723
+ if (isLoaded) {
1724
+ return /* @__PURE__ */ jsx(Fragment, { children });
1725
+ }
1726
+ return /* @__PURE__ */ jsx(
1727
+ "div",
1728
+ {
1729
+ "aria-hidden": "true",
1730
+ className: cn(
1731
+ "animate-pulse rounded-lg bg-gray-200 dark:bg-gray-800",
1732
+ className
1733
+ ),
1734
+ style: { width, height, ...style },
1735
+ ...rest,
1736
+ children: /* @__PURE__ */ jsx("span", { className: "invisible", children })
1737
+ }
1738
+ );
1739
+ };
1740
+ var sizeClasses3 = {
1741
+ sm: "text-xs px-1 py-0.5",
1742
+ md: "text-sm px-1.5 py-0.5"
1743
+ };
1744
+ var colorClasses2 = {
1745
+ primary: "bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-400",
1746
+ success: "bg-success-50 text-success-600 dark:bg-success-500/15 dark:text-success-500",
1747
+ error: "bg-error-50 text-error-600 dark:bg-error-500/15 dark:text-error-500",
1748
+ warning: "bg-warning-50 text-warning-600 dark:bg-warning-500/15 dark:text-orange-400",
1749
+ info: "bg-blue-light-50 text-blue-light-500 dark:bg-blue-light-500/15 dark:text-blue-light-500",
1750
+ default: "bg-gray-100 text-gray-700 dark:bg-white/5 dark:text-white/80"
1751
+ };
1752
+ var Code = ({
1753
+ color = "default",
1754
+ size = "md",
1755
+ className,
1756
+ children,
1757
+ bgColor,
1758
+ textColor,
1759
+ borderColor,
1760
+ style,
1761
+ ...rest
1762
+ }) => {
1763
+ return /* @__PURE__ */ jsx(
1764
+ "code",
1765
+ {
1766
+ className: cn(
1767
+ "inline-flex items-center rounded-md font-mono font-normal",
1768
+ sizeClasses3[size],
1769
+ colorClasses2[color],
1770
+ className
1771
+ ),
1772
+ style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
1773
+ ...rest,
1774
+ children
1775
+ }
1776
+ );
1777
+ };
1778
+ var sizeClasses4 = {
1779
+ sm: "text-xs p-3",
1780
+ md: "text-sm p-4"
1781
+ };
1782
+ var CopyIcon = () => /* @__PURE__ */ jsxs(
1783
+ "svg",
1784
+ {
1785
+ width: "16",
1786
+ height: "16",
1787
+ viewBox: "0 0 24 24",
1788
+ fill: "none",
1789
+ stroke: "currentColor",
1790
+ strokeWidth: "2",
1791
+ strokeLinecap: "round",
1792
+ strokeLinejoin: "round",
1793
+ "aria-hidden": "true",
1794
+ children: [
1795
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1796
+ /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
1797
+ ]
1798
+ }
1799
+ );
1800
+ var CheckIcon = () => /* @__PURE__ */ jsx(
1801
+ "svg",
1802
+ {
1803
+ width: "16",
1804
+ height: "16",
1805
+ viewBox: "0 0 24 24",
1806
+ fill: "none",
1807
+ stroke: "currentColor",
1808
+ strokeWidth: "2",
1809
+ strokeLinecap: "round",
1810
+ strokeLinejoin: "round",
1811
+ "aria-hidden": "true",
1812
+ children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
1813
+ }
1814
+ );
1815
+ var Snippet = ({
1816
+ code,
1817
+ children,
1818
+ symbol = "",
1819
+ hideCopyButton = false,
1820
+ hideSymbol = false,
1821
+ size = "md",
1822
+ className,
1823
+ bgColor,
1824
+ textColor,
1825
+ borderColor,
1826
+ style,
1827
+ ...rest
1828
+ }) => {
1829
+ const [copied, setCopied] = useState(false);
1830
+ const raw = code ?? children ?? "";
1831
+ const lines = Array.isArray(raw) ? raw : raw.split("\n");
1832
+ const text = lines.join("\n");
1833
+ const handleCopy = async () => {
1834
+ try {
1835
+ await navigator.clipboard.writeText(text);
1836
+ setCopied(true);
1837
+ setTimeout(() => setCopied(false), 1500);
1838
+ } catch {
1839
+ }
1840
+ };
1841
+ return /* @__PURE__ */ jsxs(
1842
+ "div",
1843
+ {
1844
+ className: cn(
1845
+ "relative rounded-xl border border-gray-200 bg-gray-50 font-mono text-gray-800 dark:border-gray-800 dark:bg-white/[0.03] dark:text-white/90",
1846
+ sizeClasses4[size],
1847
+ className
1848
+ ),
1849
+ style: { ...styleOverride({ bgColor, textColor, borderColor }), ...style },
1850
+ ...rest,
1851
+ children: [
1852
+ /* @__PURE__ */ jsx("pre", { className: cn("overflow-x-auto", !hideCopyButton && "pr-8"), children: /* @__PURE__ */ jsx("code", { children: lines.map((line, i) => /* @__PURE__ */ jsxs("span", { className: "block whitespace-pre", children: [
1853
+ !hideSymbol && symbol && /* @__PURE__ */ jsx("span", { className: "select-none text-gray-400 dark:text-gray-500", children: symbol }),
1854
+ line
1855
+ ] }, i)) }) }),
1856
+ !hideCopyButton && /* @__PURE__ */ jsx(
1857
+ "button",
1858
+ {
1859
+ type: "button",
1860
+ onClick: handleCopy,
1861
+ "aria-label": copied ? "Copied" : "Copy to clipboard",
1862
+ className: cn(
1863
+ "absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-lg text-gray-500 transition hover:bg-gray-200 hover:text-gray-700 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-white/90",
1864
+ copied && "text-success-500 dark:text-success-500"
1865
+ ),
1866
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
1867
+ }
1868
+ )
1869
+ ]
1870
+ }
1871
+ );
1872
+ };
1873
+ var Label = ({ children, className, ...rest }) => {
1874
+ return /* @__PURE__ */ jsx(
1875
+ "label",
1876
+ {
1877
+ className: cn(
1878
+ "mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400",
1879
+ className
1880
+ ),
1881
+ ...rest,
1882
+ children
1883
+ }
1884
+ );
1885
+ };
1886
+ var TextArea = ({
1887
+ placeholder = "Enter your message",
1888
+ rows = 3,
1889
+ value = "",
1890
+ onChange,
1891
+ className,
1892
+ disabled = false,
1893
+ error = false,
1894
+ hint = ""
1895
+ }) => {
1896
+ const handleChange = (e) => {
1897
+ if (onChange) {
1898
+ onChange(e.target.value);
1899
+ }
1900
+ };
1901
+ const stateClass = disabled ? "bg-gray-100 opacity-50 text-gray-500 border-gray-300 cursor-not-allowed dark:bg-gray-800 dark:text-gray-400 dark:border-gray-700" : error ? "bg-transparent text-gray-400 border-gray-300 focus:border-error-300 focus:ring-3 focus:ring-error-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:focus:border-error-800" : "bg-transparent text-gray-400 border-gray-300 focus:border-brand-300 focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:focus:border-brand-800";
1902
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1903
+ /* @__PURE__ */ jsx(
1904
+ "textarea",
1905
+ {
1906
+ placeholder,
1907
+ rows,
1908
+ value,
1909
+ onChange: handleChange,
1910
+ disabled,
1911
+ className: cn(
1912
+ "w-full rounded-lg border px-4 py-2.5 text-sm shadow-theme-xs focus:outline-hidden",
1913
+ stateClass,
1914
+ className
1915
+ )
1916
+ }
1917
+ ),
1918
+ hint && /* @__PURE__ */ jsx(
1919
+ "p",
1920
+ {
1921
+ className: cn(
1922
+ "mt-2 text-sm",
1923
+ error ? "text-error-500" : "text-gray-500 dark:text-gray-400"
1924
+ ),
1925
+ children: hint
1926
+ }
1927
+ )
1928
+ ] });
1929
+ };
1930
+ var Checkbox = ({
1931
+ label,
1932
+ checked,
1933
+ id,
1934
+ onChange,
1935
+ className,
1936
+ disabled = false,
1937
+ checkedColor
1938
+ }) => {
1939
+ return /* @__PURE__ */ jsxs(
1940
+ "label",
1941
+ {
1942
+ className: cn(
1943
+ "flex items-center space-x-3 group cursor-pointer",
1944
+ disabled && "cursor-not-allowed opacity-60"
1945
+ ),
1946
+ children: [
1947
+ /* @__PURE__ */ jsxs("div", { className: "relative w-5 h-5", children: [
1948
+ /* @__PURE__ */ jsx(
1949
+ "input",
1950
+ {
1951
+ id,
1952
+ type: "checkbox",
1953
+ className: cn(
1954
+ "w-5 h-5 appearance-none cursor-pointer dark:border-gray-700 border border-gray-300 checked:border-transparent rounded-md checked:bg-brand-500 disabled:opacity-60",
1955
+ className
1956
+ ),
1957
+ checked,
1958
+ onChange: (e) => onChange(e.target.checked),
1959
+ disabled,
1960
+ style: checkedColor ? { accentColor: checkedColor } : void 0
1961
+ }
1962
+ ),
1963
+ checked && /* @__PURE__ */ jsx(
1964
+ "svg",
1965
+ {
1966
+ className: "absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 pointer-events-none",
1967
+ xmlns: "http://www.w3.org/2000/svg",
1968
+ width: "14",
1969
+ height: "14",
1970
+ viewBox: "0 0 14 14",
1971
+ fill: "none",
1972
+ children: /* @__PURE__ */ jsx(
1973
+ "path",
1974
+ {
1975
+ d: "M11.6666 3.5L5.24992 9.91667L2.33325 7",
1976
+ stroke: "white",
1977
+ strokeWidth: "1.94437",
1978
+ strokeLinecap: "round",
1979
+ strokeLinejoin: "round"
1980
+ }
1981
+ )
1982
+ }
1983
+ ),
1984
+ disabled && /* @__PURE__ */ jsx(
1985
+ "svg",
1986
+ {
1987
+ className: "absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 pointer-events-none",
1988
+ xmlns: "http://www.w3.org/2000/svg",
1989
+ width: "14",
1990
+ height: "14",
1991
+ viewBox: "0 0 14 14",
1992
+ fill: "none",
1993
+ children: /* @__PURE__ */ jsx(
1994
+ "path",
1995
+ {
1996
+ d: "M11.6666 3.5L5.24992 9.91667L2.33325 7",
1997
+ stroke: "#E4E7EC",
1998
+ strokeWidth: "2.33333",
1999
+ strokeLinecap: "round",
2000
+ strokeLinejoin: "round"
2001
+ }
2002
+ )
2003
+ }
2004
+ )
2005
+ ] }),
2006
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-800 dark:text-gray-200", children: label })
2007
+ ]
2008
+ }
2009
+ );
2010
+ };
2011
+ var Radio = ({
2012
+ id,
2013
+ name,
2014
+ value,
2015
+ checked,
2016
+ label,
2017
+ onChange,
2018
+ className,
2019
+ disabled = false
2020
+ }) => {
2021
+ return /* @__PURE__ */ jsxs(
2022
+ "label",
2023
+ {
2024
+ htmlFor: id,
2025
+ className: cn(
2026
+ "relative flex cursor-pointer select-none items-center gap-3 text-sm font-medium",
2027
+ disabled ? "text-gray-300 dark:text-gray-600 cursor-not-allowed" : "text-gray-700 dark:text-gray-400",
2028
+ className
2029
+ ),
2030
+ children: [
2031
+ /* @__PURE__ */ jsx(
2032
+ "input",
2033
+ {
2034
+ id,
2035
+ name,
2036
+ type: "radio",
2037
+ value,
2038
+ checked,
2039
+ onChange: () => !disabled && onChange(value),
2040
+ className: "sr-only",
2041
+ disabled
2042
+ }
2043
+ ),
2044
+ /* @__PURE__ */ jsx(
2045
+ "span",
2046
+ {
2047
+ className: cn(
2048
+ "flex h-5 w-5 items-center justify-center rounded-full border-[1.25px]",
2049
+ checked ? "border-brand-500 bg-brand-500" : "bg-transparent border-gray-300 dark:border-gray-700",
2050
+ disabled && "bg-gray-100 dark:bg-gray-700 border-gray-200 dark:border-gray-700"
2051
+ ),
2052
+ children: /* @__PURE__ */ jsx(
2053
+ "span",
2054
+ {
2055
+ className: cn(
2056
+ "h-2 w-2 rounded-full bg-white",
2057
+ checked ? "block" : "hidden"
2058
+ )
2059
+ }
2060
+ )
2061
+ }
2062
+ ),
2063
+ label
2064
+ ]
2065
+ }
2066
+ );
2067
+ };
2068
+ var RadioSm = ({
2069
+ id,
2070
+ name,
2071
+ value,
2072
+ checked,
2073
+ label,
2074
+ onChange,
2075
+ className
2076
+ }) => {
2077
+ return /* @__PURE__ */ jsxs(
2078
+ "label",
2079
+ {
2080
+ htmlFor: id,
2081
+ className: cn(
2082
+ "flex cursor-pointer select-none items-center text-sm text-gray-500 dark:text-gray-400",
2083
+ className
2084
+ ),
2085
+ children: [
2086
+ /* @__PURE__ */ jsxs("span", { className: "relative", children: [
2087
+ /* @__PURE__ */ jsx(
2088
+ "input",
2089
+ {
2090
+ type: "radio",
2091
+ id,
2092
+ name,
2093
+ value,
2094
+ checked,
2095
+ onChange: () => onChange(value),
2096
+ className: "sr-only"
2097
+ }
2098
+ ),
2099
+ /* @__PURE__ */ jsx(
2100
+ "span",
2101
+ {
2102
+ className: cn(
2103
+ "mr-2 flex h-4 w-4 items-center justify-center rounded-full border",
2104
+ checked ? "border-brand-500 bg-brand-500" : "bg-transparent border-gray-300 dark:border-gray-700"
2105
+ ),
2106
+ children: /* @__PURE__ */ jsx(
2107
+ "span",
2108
+ {
2109
+ className: cn(
2110
+ "h-1.5 w-1.5 rounded-full",
2111
+ checked ? "bg-white" : "bg-white dark:bg-[#1e2636]"
2112
+ )
2113
+ }
2114
+ )
2115
+ }
2116
+ )
2117
+ ] }),
2118
+ label
2119
+ ]
2120
+ }
2121
+ );
2122
+ };
2123
+ var Switch = ({
2124
+ label,
2125
+ checked,
2126
+ defaultChecked = false,
2127
+ disabled = false,
2128
+ onChange,
2129
+ color = "blue"
2130
+ }) => {
2131
+ const isControlled = checked !== void 0;
2132
+ const [internalChecked, setInternalChecked] = useState(defaultChecked);
2133
+ const isChecked = isControlled ? checked : internalChecked;
2134
+ const handleToggle = () => {
2135
+ if (disabled) return;
2136
+ const newCheckedState = !isChecked;
2137
+ if (!isControlled) {
2138
+ setInternalChecked(newCheckedState);
2139
+ }
2140
+ if (onChange) {
2141
+ onChange(newCheckedState);
2142
+ }
2143
+ };
2144
+ const switchColors = color === "blue" ? {
2145
+ background: isChecked ? "bg-brand-500 " : "bg-gray-200 dark:bg-white/10",
2146
+ // Blue version
2147
+ knob: isChecked ? "translate-x-full bg-white" : "translate-x-0 bg-white"
2148
+ } : {
2149
+ background: isChecked ? "bg-gray-800 dark:bg-white/10" : "bg-gray-200 dark:bg-white/10",
2150
+ // Gray version
2151
+ knob: isChecked ? "translate-x-full bg-white" : "translate-x-0 bg-white"
2152
+ };
2153
+ return /* @__PURE__ */ jsxs(
2154
+ "label",
2155
+ {
2156
+ className: cn(
2157
+ "flex cursor-pointer select-none items-center gap-3 text-sm font-medium",
2158
+ disabled ? "text-gray-400" : "text-gray-700 dark:text-gray-400"
2159
+ ),
2160
+ onClick: handleToggle,
2161
+ children: [
2162
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2163
+ /* @__PURE__ */ jsx(
2164
+ "div",
2165
+ {
2166
+ className: cn(
2167
+ "block transition duration-150 ease-linear h-6 w-11 rounded-full",
2168
+ disabled ? "bg-gray-100 pointer-events-none dark:bg-gray-800" : switchColors.background
2169
+ )
2170
+ }
2171
+ ),
2172
+ /* @__PURE__ */ jsx(
2173
+ "div",
2174
+ {
2175
+ className: cn(
2176
+ "absolute left-0.5 top-0.5 h-5 w-5 rounded-full shadow-theme-sm duration-150 ease-linear transform",
2177
+ switchColors.knob
2178
+ )
2179
+ }
2180
+ )
2181
+ ] }),
2182
+ label
2183
+ ]
2184
+ }
2185
+ );
2186
+ };
2187
+ var Select = ({
2188
+ options,
2189
+ placeholder = "Select an option",
2190
+ onChange,
2191
+ className,
2192
+ defaultValue = "",
2193
+ disabled = false
2194
+ }) => {
2195
+ const [selectedValue, setSelectedValue] = useState(defaultValue);
2196
+ const [isOpen, setIsOpen] = useState(false);
2197
+ const rootRef = useRef(null);
2198
+ useEffect(() => {
2199
+ if (!isOpen) return;
2200
+ const onPointerDown = (e) => {
2201
+ if (rootRef.current && !rootRef.current.contains(e.target)) {
2202
+ setIsOpen(false);
2203
+ }
2204
+ };
2205
+ const onKeyDown = (e) => {
2206
+ if (e.key === "Escape") setIsOpen(false);
2207
+ };
2208
+ document.addEventListener("mousedown", onPointerDown);
2209
+ document.addEventListener("keydown", onKeyDown);
2210
+ return () => {
2211
+ document.removeEventListener("mousedown", onPointerDown);
2212
+ document.removeEventListener("keydown", onKeyDown);
2213
+ };
2214
+ }, [isOpen]);
2215
+ const toggleOpen = () => {
2216
+ if (!disabled) setIsOpen((prev) => !prev);
2217
+ };
2218
+ const handleSelect = (value) => {
2219
+ setSelectedValue(value);
2220
+ onChange(value);
2221
+ setIsOpen(false);
2222
+ };
2223
+ const selectedLabel = options.find((o) => o.value === selectedValue)?.label;
2224
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative w-full", className), children: [
2225
+ /* @__PURE__ */ jsxs(
2226
+ "button",
2227
+ {
2228
+ type: "button",
2229
+ onClick: toggleOpen,
2230
+ disabled,
2231
+ "aria-haspopup": "listbox",
2232
+ "aria-expanded": isOpen,
2233
+ className: cn(
2234
+ "flex h-11 w-full items-center justify-between rounded-lg border border-gray-300 px-4 py-2.5 text-left text-sm shadow-theme-xs transition focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:focus:border-brand-800",
2235
+ disabled && "cursor-not-allowed opacity-50",
2236
+ selectedLabel ? "text-gray-800 dark:text-white/90" : "text-gray-400 dark:text-gray-400"
2237
+ ),
2238
+ children: [
2239
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: selectedLabel ?? placeholder }),
2240
+ /* @__PURE__ */ jsx(
2241
+ "svg",
2242
+ {
2243
+ className: cn(
2244
+ "ml-2 h-5 w-5 shrink-0 stroke-current text-gray-500 transition-transform dark:text-gray-400",
2245
+ isOpen && "rotate-180"
2246
+ ),
2247
+ width: "20",
2248
+ height: "20",
2249
+ viewBox: "0 0 20 20",
2250
+ fill: "none",
2251
+ xmlns: "http://www.w3.org/2000/svg",
2252
+ children: /* @__PURE__ */ jsx(
2253
+ "path",
2254
+ {
2255
+ d: "M4.79175 7.39551L10.0001 12.6038L15.2084 7.39551",
2256
+ stroke: "currentColor",
2257
+ strokeWidth: "1.5",
2258
+ strokeLinecap: "round",
2259
+ strokeLinejoin: "round"
2260
+ }
2261
+ )
2262
+ }
2263
+ )
2264
+ ]
2265
+ }
2266
+ ),
2267
+ isOpen && /* @__PURE__ */ jsx(
2268
+ "ul",
2269
+ {
2270
+ role: "listbox",
2271
+ className: "absolute left-0 top-full z-40 mt-1.5 max-h-60 w-full overflow-y-auto rounded-lg border border-gray-200 bg-white py-1 shadow-theme-lg dark:border-gray-800 dark:bg-gray-900",
2272
+ children: options.map((option) => {
2273
+ const isSelected = option.value === selectedValue;
2274
+ return /* @__PURE__ */ jsxs(
2275
+ "li",
2276
+ {
2277
+ role: "option",
2278
+ "aria-selected": isSelected,
2279
+ onClick: () => handleSelect(option.value),
2280
+ className: cn(
2281
+ "flex cursor-pointer items-center justify-between px-4 py-2 text-sm transition hover:bg-gray-50 dark:hover:bg-white/5",
2282
+ isSelected ? "bg-brand-50 font-medium text-brand-600 dark:bg-brand-500/15 dark:text-brand-400" : "text-gray-700 dark:text-gray-300"
2283
+ ),
2284
+ children: [
2285
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: option.label }),
2286
+ isSelected && /* @__PURE__ */ jsx(
2287
+ "svg",
2288
+ {
2289
+ className: "ml-2 h-4 w-4 shrink-0 stroke-current",
2290
+ width: "16",
2291
+ height: "16",
2292
+ viewBox: "0 0 16 16",
2293
+ fill: "none",
2294
+ xmlns: "http://www.w3.org/2000/svg",
2295
+ children: /* @__PURE__ */ jsx(
2296
+ "path",
2297
+ {
2298
+ d: "M13.3334 4L6.00008 11.3333L2.66675 8",
2299
+ stroke: "currentColor",
2300
+ strokeWidth: "1.6",
2301
+ strokeLinecap: "round",
2302
+ strokeLinejoin: "round"
2303
+ }
2304
+ )
2305
+ }
2306
+ )
2307
+ ]
2308
+ },
2309
+ option.value
2310
+ );
2311
+ })
2312
+ }
2313
+ )
2314
+ ] });
2315
+ };
2316
+ var MultiSelect = ({
2317
+ label,
2318
+ options,
2319
+ defaultSelected = [],
2320
+ onChange,
2321
+ disabled = false
2322
+ }) => {
2323
+ const [selectedOptions, setSelectedOptions] = useState(defaultSelected);
2324
+ const [isOpen, setIsOpen] = useState(false);
2325
+ const toggleDropdown = () => {
2326
+ if (disabled) return;
2327
+ setIsOpen((prev) => !prev);
2328
+ };
2329
+ const handleSelect = (optionValue) => {
2330
+ const newSelectedOptions = selectedOptions.includes(optionValue) ? selectedOptions.filter((value) => value !== optionValue) : [...selectedOptions, optionValue];
2331
+ setSelectedOptions(newSelectedOptions);
2332
+ if (onChange) onChange(newSelectedOptions);
2333
+ };
2334
+ const removeOption = (_index, value) => {
2335
+ const newSelectedOptions = selectedOptions.filter((opt) => opt !== value);
2336
+ setSelectedOptions(newSelectedOptions);
2337
+ if (onChange) onChange(newSelectedOptions);
2338
+ };
2339
+ const selectedValuesText = selectedOptions.map(
2340
+ (value) => options.find((option) => option.value === value)?.text || ""
2341
+ );
2342
+ return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
2343
+ /* @__PURE__ */ jsx("label", { className: "mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400", children: label }),
2344
+ /* @__PURE__ */ jsx("div", { className: "relative z-20 inline-block w-full", children: /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center", children: [
2345
+ /* @__PURE__ */ jsx("div", { onClick: toggleDropdown, className: "w-full", children: /* @__PURE__ */ jsxs("div", { className: "mb-2 flex h-11 rounded-lg border border-gray-300 py-1.5 px-4 shadow-theme-xs outline-hidden transition focus:border-brand-300 focus:shadow-focus-ring dark:border-gray-700 dark:bg-gray-900 dark:focus:border-brand-300", children: [
2346
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap flex-auto gap-2", children: selectedValuesText.length > 0 ? selectedValuesText.map((text, index) => /* @__PURE__ */ jsxs(
2347
+ "div",
2348
+ {
2349
+ className: "group flex items-center justify-center rounded-full border-[0.7px] border-transparent bg-gray-100 py-1 pl-2.5 pr-2 text-sm text-gray-800 hover:border-gray-200 dark:bg-gray-800 dark:text-white/90 dark:hover:border-gray-800",
2350
+ children: [
2351
+ /* @__PURE__ */ jsx("span", { className: "flex-initial max-w-full", children: text }),
2352
+ /* @__PURE__ */ jsx("div", { className: "flex flex-row-reverse flex-auto", children: /* @__PURE__ */ jsx(
2353
+ "div",
2354
+ {
2355
+ onClick: () => removeOption(index, selectedOptions[index]),
2356
+ className: "pl-2 text-gray-500 cursor-pointer group-hover:text-gray-400 dark:text-gray-400",
2357
+ children: /* @__PURE__ */ jsx(
2358
+ "svg",
2359
+ {
2360
+ className: "fill-current",
2361
+ role: "button",
2362
+ width: "14",
2363
+ height: "14",
2364
+ viewBox: "0 0 14 14",
2365
+ xmlns: "http://www.w3.org/2000/svg",
2366
+ children: /* @__PURE__ */ jsx(
2367
+ "path",
2368
+ {
2369
+ fillRule: "evenodd",
2370
+ clipRule: "evenodd",
2371
+ d: "M3.40717 4.46881C3.11428 4.17591 3.11428 3.70104 3.40717 3.40815C3.70006 3.11525 4.17494 3.11525 4.46783 3.40815L6.99943 5.93975L9.53095 3.40822C9.82385 3.11533 10.2987 3.11533 10.5916 3.40822C10.8845 3.70112 10.8845 4.17599 10.5916 4.46888L8.06009 7.00041L10.5916 9.53193C10.8845 9.82482 10.8845 10.2997 10.5916 10.5926C10.2987 10.8855 9.82385 10.8855 9.53095 10.5926L6.99943 8.06107L4.46783 10.5927C4.17494 10.8856 3.70006 10.8856 3.40717 10.5927C3.11428 10.2998 3.11428 9.8249 3.40717 9.53201L5.93877 7.00041L3.40717 4.46881Z"
2372
+ }
2373
+ )
2374
+ }
2375
+ )
2376
+ }
2377
+ ) })
2378
+ ]
2379
+ },
2380
+ index
2381
+ )) : /* @__PURE__ */ jsx(
2382
+ "input",
2383
+ {
2384
+ placeholder: "Select option",
2385
+ className: "w-full h-full p-1 pr-2 text-sm bg-transparent border-0 outline-hidden appearance-none placeholder:text-gray-800 focus:border-0 focus:outline-hidden focus:ring-0 dark:placeholder:text-white/90",
2386
+ readOnly: true,
2387
+ value: "Select option"
2388
+ }
2389
+ ) }),
2390
+ /* @__PURE__ */ jsx("div", { className: "flex items-center py-1 pl-1 pr-1 w-7", children: /* @__PURE__ */ jsx(
2391
+ "button",
2392
+ {
2393
+ type: "button",
2394
+ onClick: toggleDropdown,
2395
+ className: "w-5 h-5 text-gray-700 outline-hidden cursor-pointer focus:outline-hidden dark:text-gray-400",
2396
+ children: /* @__PURE__ */ jsx(
2397
+ "svg",
2398
+ {
2399
+ className: `stroke-current ${isOpen ? "rotate-180" : ""}`,
2400
+ width: "20",
2401
+ height: "20",
2402
+ viewBox: "0 0 20 20",
2403
+ fill: "none",
2404
+ xmlns: "http://www.w3.org/2000/svg",
2405
+ children: /* @__PURE__ */ jsx(
2406
+ "path",
2407
+ {
2408
+ d: "M4.79175 7.39551L10.0001 12.6038L15.2084 7.39551",
2409
+ stroke: "currentColor",
2410
+ strokeWidth: "1.5",
2411
+ strokeLinecap: "round",
2412
+ strokeLinejoin: "round"
2413
+ }
2414
+ )
2415
+ }
2416
+ )
2417
+ }
2418
+ ) })
2419
+ ] }) }),
2420
+ isOpen && /* @__PURE__ */ jsx(
2421
+ "div",
2422
+ {
2423
+ className: "absolute left-0 z-40 w-full overflow-y-auto bg-white rounded-lg shadow-sm top-full max-h-select dark:bg-gray-900",
2424
+ onClick: (e) => e.stopPropagation(),
2425
+ children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: options.map((option, index) => {
2426
+ const isSelected = selectedOptions.includes(option.value);
2427
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
2428
+ "div",
2429
+ {
2430
+ className: `w-full cursor-pointer rounded-t border-b border-gray-200 hover:bg-brand-500/5 dark:border-gray-800`,
2431
+ onClick: () => handleSelect(option.value),
2432
+ children: /* @__PURE__ */ jsxs(
2433
+ "div",
2434
+ {
2435
+ className: `relative flex w-full items-center justify-between p-2 pl-2 ${isSelected ? "bg-brand-500/10" : ""}`,
2436
+ children: [
2437
+ /* @__PURE__ */ jsx(
2438
+ "div",
2439
+ {
2440
+ className: `mx-2 leading-6 ${isSelected ? "font-medium text-brand-600 dark:text-brand-400" : "text-gray-800 dark:text-white/90"}`,
2441
+ children: option.text
2442
+ }
2443
+ ),
2444
+ isSelected && /* @__PURE__ */ jsx(
2445
+ "svg",
2446
+ {
2447
+ className: "mr-2 h-4 w-4 shrink-0 stroke-current text-brand-500",
2448
+ width: "16",
2449
+ height: "16",
2450
+ viewBox: "0 0 16 16",
2451
+ fill: "none",
2452
+ xmlns: "http://www.w3.org/2000/svg",
2453
+ children: /* @__PURE__ */ jsx(
2454
+ "path",
2455
+ {
2456
+ d: "M13.3334 4L6.00008 11.3333L2.66675 8",
2457
+ stroke: "currentColor",
2458
+ strokeWidth: "1.6",
2459
+ strokeLinecap: "round",
2460
+ strokeLinejoin: "round"
2461
+ }
2462
+ )
2463
+ }
2464
+ )
2465
+ ]
2466
+ }
2467
+ )
2468
+ }
2469
+ ) }, index);
2470
+ }) })
2471
+ }
2472
+ )
2473
+ ] }) })
2474
+ ] });
2475
+ };
2476
+ var FileInput = ({ className, ...rest }) => {
2477
+ return /* @__PURE__ */ jsx(
2478
+ "input",
2479
+ {
2480
+ type: "file",
2481
+ className: cn(
2482
+ "focus:border-ring-brand-300 h-11 w-full overflow-hidden rounded-lg border border-gray-300 bg-transparent text-sm text-gray-500 shadow-theme-xs transition-colors file:mr-5 file:border-collapse file:cursor-pointer file:rounded-l-lg file:border-0 file:border-r file:border-solid file:border-gray-200 file:bg-gray-50 file:py-3 file:pl-3.5 file:pr-3 file:text-sm file:text-gray-700 placeholder:text-gray-400 hover:file:bg-gray-100 focus:outline-hidden focus:file:ring-brand-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400 dark:text-white/90 dark:file:border-gray-800 dark:file:bg-white/[0.03] dark:file:text-gray-400 dark:placeholder:text-gray-400",
2483
+ className
2484
+ ),
2485
+ ...rest
2486
+ }
2487
+ );
2488
+ };
2489
+ var DatePicker = ({
2490
+ id,
2491
+ mode,
2492
+ onChange,
2493
+ label,
2494
+ defaultDate,
2495
+ placeholder
2496
+ }) => {
2497
+ useEffect(() => {
2498
+ const flatPickr = flatpickr(`#${id}`, {
2499
+ mode: mode || "single",
2500
+ static: true,
2501
+ monthSelectorType: "static",
2502
+ dateFormat: "Y-m-d",
2503
+ defaultDate,
2504
+ onChange
2505
+ });
2506
+ return () => {
2507
+ if (!Array.isArray(flatPickr)) {
2508
+ flatPickr.destroy();
2509
+ }
2510
+ };
2511
+ }, [mode, onChange, id, defaultDate]);
2512
+ return /* @__PURE__ */ jsxs("div", { children: [
2513
+ label && /* @__PURE__ */ jsx(Label, { htmlFor: id, children: label }),
2514
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2515
+ /* @__PURE__ */ jsx(
2516
+ "input",
2517
+ {
2518
+ id,
2519
+ placeholder,
2520
+ className: "h-11 w-full rounded-lg border appearance-none pl-4 pr-11 py-2.5 text-sm shadow-theme-xs placeholder:text-gray-400 focus:outline-hidden focus:ring-3 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30 bg-transparent text-gray-800 border-gray-300 focus:border-brand-300 focus:ring-brand-500/20 dark:border-gray-700 dark:focus:border-brand-800"
2521
+ }
2522
+ ),
2523
+ /* @__PURE__ */ jsx("span", { className: "absolute text-gray-500 -translate-y-1/2 pointer-events-none right-3 top-1/2 dark:text-gray-400", children: /* @__PURE__ */ jsx(
2524
+ "svg",
2525
+ {
2526
+ className: "size-6",
2527
+ width: "24",
2528
+ height: "24",
2529
+ viewBox: "0 0 24 24",
2530
+ fill: "none",
2531
+ xmlns: "http://www.w3.org/2000/svg",
2532
+ children: /* @__PURE__ */ jsx(
2533
+ "path",
2534
+ {
2535
+ fillRule: "evenodd",
2536
+ clipRule: "evenodd",
2537
+ d: "M8 2C8.41421 2 8.75 2.33579 8.75 2.75V3.75H15.25V2.75C15.25 2.33579 15.5858 2 16 2C16.4142 2 16.75 2.33579 16.75 2.75V3.75H18.5C19.7426 3.75 20.75 4.75736 20.75 6V9V19C20.75 20.2426 19.7426 21.25 18.5 21.25H5.5C4.25736 21.25 3.25 20.2426 3.25 19V9V6C3.25 4.75736 4.25736 3.75 5.5 3.75H7.25V2.75C7.25 2.33579 7.58579 2 8 2ZM8 5.25H5.5C5.08579 5.25 4.75 5.58579 4.75 6V8.25H19.25V6C19.25 5.58579 18.9142 5.25 18.5 5.25H16H8ZM19.25 9.75H4.75V19C4.75 19.4142 5.08579 19.75 5.5 19.75H18.5C18.9142 19.75 19.25 19.4142 19.25 19V9.75Z",
2538
+ fill: "currentColor"
2539
+ }
2540
+ )
2541
+ }
2542
+ ) })
2543
+ ] })
2544
+ ] });
2545
+ };
2546
+ var clampNum = (raw, max) => {
2547
+ const digits = raw.replace(/\D/g, "").slice(0, 2);
2548
+ if (digits === "") return "";
2549
+ return String(Math.min(parseInt(digits, 10), max));
2550
+ };
2551
+ var DateTimePicker = ({
2552
+ id,
2553
+ label,
2554
+ placeholder,
2555
+ defaultDate,
2556
+ defaultTime = "",
2557
+ onChange
2558
+ }) => {
2559
+ const dateRef = useRef(void 0);
2560
+ const [hh, setHh] = useState(defaultTime.split(":")[0] ?? "");
2561
+ const [mm, setMm] = useState(defaultTime.split(":")[1] ?? "");
2562
+ const hhRef = useRef(hh);
2563
+ const mmRef = useRef(mm);
2564
+ hhRef.current = hh;
2565
+ mmRef.current = mm;
2566
+ const emit = () => {
2567
+ onChange?.({
2568
+ date: dateRef.current,
2569
+ time: `${(hhRef.current || "0").padStart(2, "0")}:${(mmRef.current || "0").padStart(2, "0")}`
2570
+ });
2571
+ };
2572
+ useEffect(() => {
2573
+ const flatPickr = flatpickr(`#${id}-date`, {
2574
+ mode: "single",
2575
+ static: true,
2576
+ monthSelectorType: "static",
2577
+ dateFormat: "Y-m-d",
2578
+ defaultDate,
2579
+ onChange: (dates) => {
2580
+ dateRef.current = dates[0];
2581
+ emit();
2582
+ }
2583
+ });
2584
+ return () => {
2585
+ if (!Array.isArray(flatPickr)) {
2586
+ flatPickr.destroy();
2587
+ }
2588
+ };
2589
+ }, [id, defaultDate]);
2590
+ const handleHh = (e) => {
2591
+ const v = clampNum(e.target.value, 23);
2592
+ setHh(v);
2593
+ hhRef.current = v;
2594
+ emit();
2595
+ };
2596
+ const handleMm = (e) => {
2597
+ const v = clampNum(e.target.value, 59);
2598
+ setMm(v);
2599
+ mmRef.current = v;
2600
+ emit();
2601
+ };
2602
+ const padOnBlur = (value, setter) => () => {
2603
+ if (value !== "") setter(value.padStart(2, "0"));
2604
+ };
2605
+ const timeFieldClass = "w-7 bg-transparent text-center tabular-nums placeholder:text-gray-400 focus:outline-hidden dark:placeholder:text-white/30";
2606
+ return /* @__PURE__ */ jsxs("div", { children: [
2607
+ label && /* @__PURE__ */ jsx(Label, { htmlFor: `${id}-date`, children: label }),
2608
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
2609
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
2610
+ /* @__PURE__ */ jsx(
2611
+ "input",
2612
+ {
2613
+ id: `${id}-date`,
2614
+ placeholder,
2615
+ className: "h-11 w-full appearance-none rounded-lg border border-gray-300 bg-transparent py-2.5 pl-4 pr-11 text-sm text-gray-800 shadow-theme-xs placeholder:text-gray-400 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/20 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800"
2616
+ }
2617
+ ),
2618
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("svg", { className: "size-6", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
2619
+ "path",
2620
+ {
2621
+ fillRule: "evenodd",
2622
+ clipRule: "evenodd",
2623
+ d: "M8 2C8.41421 2 8.75 2.33579 8.75 2.75V3.75H15.25V2.75C15.25 2.33579 15.5858 2 16 2C16.4142 2 16.75 2.33579 16.75 2.75V3.75H18.5C19.7426 3.75 20.75 4.75736 20.75 6V9V19C20.75 20.2426 19.7426 21.25 18.5 21.25H5.5C4.25736 21.25 3.25 20.2426 3.25 19V9V6C3.25 4.75736 4.25736 3.75 5.5 3.75H7.25V2.75C7.25 2.33579 7.58579 2 8 2ZM8 5.25H5.5C5.08579 5.25 4.75 5.58579 4.75 6V8.25H19.25V6C19.25 5.58579 18.9142 5.25 18.5 5.25H16H8ZM19.25 9.75H4.75V19C4.75 19.4142 5.08579 19.75 5.5 19.75H18.5C18.9142 19.75 19.25 19.4142 19.25 19V9.75Z",
2624
+ fill: "currentColor"
2625
+ }
2626
+ ) }) })
2627
+ ] }),
2628
+ /* @__PURE__ */ jsxs("div", { className: "flex h-11 items-center rounded-lg border border-gray-300 bg-transparent px-3 text-sm text-gray-800 shadow-theme-xs focus-within:border-brand-300 focus-within:ring-3 focus-within:ring-brand-500/20 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:focus-within:border-brand-800", children: [
2629
+ /* @__PURE__ */ jsx(
2630
+ "input",
2631
+ {
2632
+ "aria-label": "Hours",
2633
+ inputMode: "numeric",
2634
+ placeholder: "00",
2635
+ maxLength: 2,
2636
+ value: hh,
2637
+ onChange: handleHh,
2638
+ onBlur: padOnBlur(hh, (v) => setHh(v)),
2639
+ className: timeFieldClass
2640
+ }
2641
+ ),
2642
+ /* @__PURE__ */ jsx("span", { className: "px-0.5 text-gray-400 dark:text-gray-500", children: ":" }),
2643
+ /* @__PURE__ */ jsx(
2644
+ "input",
2645
+ {
2646
+ "aria-label": "Minutes",
2647
+ inputMode: "numeric",
2648
+ placeholder: "00",
2649
+ maxLength: 2,
2650
+ value: mm,
2651
+ onChange: handleMm,
2652
+ onBlur: padOnBlur(mm, (v) => setMm(v)),
2653
+ className: timeFieldClass
2654
+ }
2655
+ ),
2656
+ /* @__PURE__ */ jsx("span", { className: "ml-1 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
2657
+ "path",
2658
+ {
2659
+ fillRule: "evenodd",
2660
+ clipRule: "evenodd",
2661
+ d: "M3.04175 9.99984C3.04175 6.15686 6.1571 3.0415 10.0001 3.0415C13.8431 3.0415 16.9584 6.15686 16.9584 9.99984C16.9584 13.8428 13.8431 16.9582 10.0001 16.9582C6.1571 16.9582 3.04175 13.8428 3.04175 9.99984ZM10.0001 1.5415C5.32867 1.5415 1.54175 5.32843 1.54175 9.99984C1.54175 14.6712 5.32867 18.4582 10.0001 18.4582C14.6715 18.4582 18.4584 14.6712 18.4584 9.99984C18.4584 5.32843 14.6715 1.5415 10.0001 1.5415ZM9.99998 10.7498C9.58577 10.7498 9.24998 10.4141 9.24998 9.99984V5.4165C9.24998 5.00229 9.58577 4.6665 9.99998 4.6665C10.4142 4.6665 10.75 5.00229 10.75 5.4165V9.24984H13.3334C13.7476 9.24984 14.0834 9.58562 14.0834 9.99984C14.0834 10.4141 13.7476 10.7498 13.3334 10.7498H10.0001H9.99998Z",
2662
+ fill: "currentColor"
2663
+ }
2664
+ ) }) })
2665
+ ] })
2666
+ ] })
2667
+ ] });
2668
+ };
2669
+ var PasswordInput = ({
2670
+ className,
2671
+ ...rest
2672
+ }) => {
2673
+ const [show, setShow] = useState(false);
2674
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2675
+ /* @__PURE__ */ jsx(
2676
+ "input",
2677
+ {
2678
+ type: show ? "text" : "password",
2679
+ className: cn(
2680
+ "h-11 w-full appearance-none rounded-lg border border-gray-300 bg-transparent py-2.5 pl-4 pr-11 text-sm text-gray-800 shadow-theme-xs placeholder:text-gray-400 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800",
2681
+ className
2682
+ ),
2683
+ ...rest
2684
+ }
2685
+ ),
2686
+ /* @__PURE__ */ jsx(
2687
+ "button",
2688
+ {
2689
+ type: "button",
2690
+ onClick: () => setShow((s) => !s),
2691
+ "aria-label": show ? "Hide password" : "Show password",
2692
+ className: "absolute right-4 top-1/2 z-30 -translate-y-1/2 cursor-pointer text-gray-500 dark:text-gray-400",
2693
+ children: show ? /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
2694
+ "path",
2695
+ {
2696
+ fillRule: "evenodd",
2697
+ clipRule: "evenodd",
2698
+ d: "M10.0002 13.8619C7.23361 13.8619 4.86803 12.1372 3.92328 9.70241C4.86804 7.26761 7.23361 5.54297 10.0002 5.54297C12.7667 5.54297 15.1323 7.26762 16.0771 9.70243C15.1323 12.1372 12.7667 13.8619 10.0002 13.8619ZM10.0002 4.04297C6.48191 4.04297 3.49489 6.30917 2.4155 9.4593C2.3615 9.61687 2.3615 9.78794 2.41549 9.94552C3.49488 13.0957 6.48191 15.3619 10.0002 15.3619C13.5184 15.3619 16.5055 13.0957 17.5849 9.94555C17.6389 9.78797 17.6389 9.6169 17.5849 9.45932C16.5055 6.30919 13.5184 4.04297 10.0002 4.04297ZM9.99151 7.84413C8.96527 7.84413 8.13333 8.67606 8.13333 9.70231C8.13333 10.7286 8.96527 11.5605 9.99151 11.5605H10.0064C11.0326 11.5605 11.8646 10.7286 11.8646 9.70231C11.8646 8.67606 11.0326 7.84413 10.0064 7.84413H9.99151Z"
2699
+ }
2700
+ ) }) : /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
2701
+ "path",
2702
+ {
2703
+ fillRule: "evenodd",
2704
+ clipRule: "evenodd",
2705
+ d: "M4.63803 3.57709C4.34513 3.2842 3.87026 3.2842 3.57737 3.57709C3.28447 3.86999 3.28447 4.34486 3.57737 4.63775L4.85323 5.91362C3.74609 6.84199 2.89363 8.06395 2.4155 9.45936C2.3615 9.61694 2.3615 9.78801 2.41549 9.94558C3.49488 13.0957 6.48191 15.3619 10.0002 15.3619C11.255 15.3619 12.4422 15.0737 13.4994 14.5598L15.3625 16.4229C15.6554 16.7158 16.1302 16.7158 16.4231 16.4229C16.716 16.13 16.716 15.6551 16.4231 15.3622L4.63803 3.57709ZM12.3608 13.4212L10.4475 11.5079C10.3061 11.5423 10.1584 11.5606 10.0064 11.5606H9.99151C8.96527 11.5606 8.13333 10.7286 8.13333 9.70237C8.13333 9.5461 8.15262 9.39434 8.18895 9.24933L5.91885 6.97923C5.03505 7.69015 4.34057 8.62704 3.92328 9.70247C4.86803 12.1373 7.23361 13.8619 10.0002 13.8619C10.8326 13.8619 11.6287 13.7058 12.3608 13.4212ZM16.0771 9.70249C15.7843 10.4569 15.3552 11.1432 14.8199 11.7311L15.8813 12.7925C16.6329 11.9813 17.2187 11.0143 17.5849 9.94561C17.6389 9.78803 17.6389 9.61696 17.5849 9.45938C16.5055 6.30925 13.5184 4.04303 10.0002 4.04303C9.13525 4.04303 8.30244 4.17999 7.52218 4.43338L8.75139 5.66259C9.1556 5.58413 9.57311 5.54303 10.0002 5.54303C12.7667 5.54303 15.1323 7.26768 16.0771 9.70249Z"
2706
+ }
2707
+ ) })
2708
+ }
2709
+ )
2710
+ ] });
2711
+ };
2712
+ var Form = ({
2713
+ onSubmit,
2714
+ children,
2715
+ className,
2716
+ ...rest
2717
+ }) => {
2718
+ return /* @__PURE__ */ jsx(
2719
+ "form",
2720
+ {
2721
+ onSubmit: (event) => {
2722
+ event.preventDefault();
2723
+ onSubmit?.(event);
2724
+ },
2725
+ className: cn(className),
2726
+ ...rest,
2727
+ children
2728
+ }
2729
+ );
2730
+ };
2731
+ var accentClasses = {
2732
+ brand: "accent-brand-500",
2733
+ primary: "accent-brand-500",
2734
+ success: "accent-success-500",
2735
+ error: "accent-error-500",
2736
+ warning: "accent-warning-500",
2737
+ info: "accent-blue-light-500"
2738
+ };
2739
+ var fillColors2 = {
2740
+ brand: "#465fff",
2741
+ primary: "#465fff",
2742
+ success: "#12b76a",
2743
+ error: "#f04438",
2744
+ warning: "#f79009",
2745
+ info: "#0ba5ec"
2746
+ };
2747
+ var Slider = ({
2748
+ value,
2749
+ defaultValue = 0,
2750
+ onChange,
2751
+ min = 0,
2752
+ max = 100,
2753
+ step = 1,
2754
+ disabled = false,
2755
+ color = "brand",
2756
+ label,
2757
+ showValue = false,
2758
+ className,
2759
+ bgColor,
2760
+ textColor,
2761
+ borderColor,
2762
+ style,
2763
+ ...rest
2764
+ }) => {
2765
+ const isControlled = value !== void 0;
2766
+ const [internalValue, setInternalValue] = useState(defaultValue);
2767
+ const currentValue = isControlled ? value : internalValue;
2768
+ const handleChange = (e) => {
2769
+ const next = Number(e.target.value);
2770
+ if (!isControlled) {
2771
+ setInternalValue(next);
2772
+ }
2773
+ onChange?.(next);
2774
+ };
2775
+ const percent = max === min ? 0 : (currentValue - min) / (max - min) * 100;
2776
+ const fill = fillColors2[color];
2777
+ const trackBg = `linear-gradient(to right, ${fill} 0%, ${fill} ${percent}%, var(--slider-track, #e4e7ec) ${percent}%, var(--slider-track, #e4e7ec) 100%)`;
2778
+ return /* @__PURE__ */ jsxs("div", { className: cn("w-full", disabled && "opacity-50"), children: [
2779
+ (label || showValue) && /* @__PURE__ */ jsxs("div", { className: "mb-1.5 flex items-center justify-between text-sm font-medium text-gray-700 dark:text-gray-400", children: [
2780
+ label && /* @__PURE__ */ jsx("span", { children: label }),
2781
+ showValue && /* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-400", children: currentValue })
2782
+ ] }),
2783
+ /* @__PURE__ */ jsx(
2784
+ "input",
2785
+ {
2786
+ type: "range",
2787
+ role: "slider",
2788
+ min,
2789
+ max,
2790
+ step,
2791
+ value: currentValue,
2792
+ disabled,
2793
+ onChange: handleChange,
2794
+ "aria-valuemin": min,
2795
+ "aria-valuemax": max,
2796
+ "aria-valuenow": currentValue,
2797
+ className: cn(
2798
+ "h-2 w-full cursor-pointer appearance-none rounded-lg focus:outline-hidden focus:ring-3 focus:ring-brand-500/10",
2799
+ accentClasses[color],
2800
+ disabled && "cursor-not-allowed",
2801
+ className
2802
+ ),
2803
+ style: {
2804
+ background: trackBg,
2805
+ ...styleOverride({ bgColor, textColor, borderColor }),
2806
+ ...style
2807
+ },
2808
+ ...rest
2809
+ }
2810
+ )
2811
+ ] });
2812
+ };
2813
+
2814
+ export { Accordion, AccordionItem, Alert, Avatar, AvatarText, Badge, Breadcrumb, Button, Checkbox, Chip, Code, DataTable, DatePicker, DateTimePicker, Drawer, Dropdown, DropdownItem, Dropzone, FileInput, Form, Input, Label, MultiSelect, Pagination, PasswordInput, Popover, Progress, Radio, RadioSm, Ribbon, Select, Skeleton, Slider, Snippet, Spinner, Switch, Tab, Table, TableBody, TableCell, TableHeader, TableRow, Tabs, TextArea, ThemeToggleButton, Tooltip, styleOverride };
2815
+ //# sourceMappingURL=index.js.map
2816
+ //# sourceMappingURL=index.js.map