ergo-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.
@@ -0,0 +1,1219 @@
1
+ import { jsxs as p, jsx as l } from "react/jsx-runtime";
2
+ import * as x from "react";
3
+ import { forwardRef as y, useRef as M, useId as z, useEffect as O } from "react";
4
+ function E(r) {
5
+ var a, e, t = "";
6
+ if (typeof r == "string" || typeof r == "number") t += r;
7
+ else if (typeof r == "object") if (Array.isArray(r)) {
8
+ var s = r.length;
9
+ for (a = 0; a < s; a++) r[a] && (e = E(r[a])) && (t && (t += " "), t += e);
10
+ } else for (e in r) r[e] && (t && (t += " "), t += e);
11
+ return t;
12
+ }
13
+ function B() {
14
+ for (var r, a, e = 0, t = "", s = arguments.length; e < s; e++) (r = arguments[e]) && (a = E(r)) && (t && (t += " "), t += a);
15
+ return t;
16
+ }
17
+ const A = (r) => typeof r == "boolean" ? `${r}` : r === 0 ? "0" : r, _ = B, u = (r, a) => (e) => {
18
+ var t;
19
+ if ((a == null ? void 0 : a.variants) == null) return _(r, e == null ? void 0 : e.class, e == null ? void 0 : e.className);
20
+ const { variants: s, defaultVariants: n } = a, o = Object.keys(s).map((i) => {
21
+ const f = e == null ? void 0 : e[i], d = n == null ? void 0 : n[i];
22
+ if (f === null) return null;
23
+ const b = A(f) || A(d);
24
+ return s[i][b];
25
+ }), m = e && Object.entries(e).reduce((i, f) => {
26
+ let [d, b] = f;
27
+ return b === void 0 || (i[d] = b), i;
28
+ }, {}), c = a == null || (t = a.compoundVariants) === null || t === void 0 ? void 0 : t.reduce((i, f) => {
29
+ let { class: d, className: b, ...h } = f;
30
+ return Object.entries(h).every((v) => {
31
+ let [g, N] = v;
32
+ return Array.isArray(N) ? N.includes({
33
+ ...n,
34
+ ...m
35
+ }[g]) : {
36
+ ...n,
37
+ ...m
38
+ }[g] === N;
39
+ }) ? [
40
+ ...i,
41
+ d,
42
+ b
43
+ ] : i;
44
+ }, []);
45
+ return _(r, o, c, e == null ? void 0 : e.class, e == null ? void 0 : e.className);
46
+ };
47
+ function D({
48
+ title: r,
49
+ titleId: a,
50
+ ...e
51
+ }, t) {
52
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
53
+ xmlns: "http://www.w3.org/2000/svg",
54
+ fill: "none",
55
+ viewBox: "0 0 24 24",
56
+ strokeWidth: 1.5,
57
+ stroke: "currentColor",
58
+ "aria-hidden": "true",
59
+ "data-slot": "icon",
60
+ ref: t,
61
+ "aria-labelledby": a
62
+ }, e), r ? /* @__PURE__ */ x.createElement("title", {
63
+ id: a
64
+ }, r) : null, /* @__PURE__ */ x.createElement("path", {
65
+ strokeLinecap: "round",
66
+ strokeLinejoin: "round",
67
+ d: "m19.5 8.25-7.5 7.5-7.5-7.5"
68
+ }));
69
+ }
70
+ const $ = /* @__PURE__ */ x.forwardRef(D);
71
+ function W({
72
+ title: r,
73
+ titleId: a,
74
+ ...e
75
+ }, t) {
76
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
77
+ xmlns: "http://www.w3.org/2000/svg",
78
+ fill: "none",
79
+ viewBox: "0 0 24 24",
80
+ strokeWidth: 1.5,
81
+ stroke: "currentColor",
82
+ "aria-hidden": "true",
83
+ "data-slot": "icon",
84
+ ref: t,
85
+ "aria-labelledby": a
86
+ }, e), r ? /* @__PURE__ */ x.createElement("title", {
87
+ id: a
88
+ }, r) : null, /* @__PURE__ */ x.createElement("path", {
89
+ strokeLinecap: "round",
90
+ strokeLinejoin: "round",
91
+ d: "M6 18 18 6M6 6l12 12"
92
+ }));
93
+ }
94
+ const X = /* @__PURE__ */ x.forwardRef(W), U = u("w-full bg-gray-500 text-white overflow-hidden", {
95
+ variants: {
96
+ variant: {
97
+ primary: "bg-emerald-500",
98
+ secondary: "bg-violet-700",
99
+ tertiary: "bg-blue-500"
100
+ },
101
+ sharp: {
102
+ true: "rounded-none",
103
+ false: "rounded-lg border"
104
+ }
105
+ },
106
+ compoundVariants: [
107
+ { sharp: !1, variant: "primary", className: "border-emerald-500" },
108
+ { sharp: !1, variant: "secondary", className: "border-violet-700" },
109
+ { sharp: !1, variant: "tertiary", className: "border-blue-500" }
110
+ ],
111
+ defaultVariants: {
112
+ sharp: !1,
113
+ variant: "primary"
114
+ }
115
+ }), F = u(
116
+ "w-full flex list-none cursor-pointer select-none items-center justify-between px-4 py-3 font-semibold [&::-webkit-details-marker]:hidden",
117
+ {
118
+ variants: {
119
+ variant: {
120
+ primary: "bg-emerald-500",
121
+ secondary: "bg-violet-700",
122
+ tertiary: "bg-blue-500"
123
+ }
124
+ },
125
+ defaultVariants: {
126
+ variant: "primary"
127
+ }
128
+ }
129
+ ), G = u(
130
+ "border-l-4 px-4 pb-4 pt-3 text-gray-300 bg-gray-500",
131
+ {
132
+ variants: {
133
+ variant: {
134
+ primary: "border-l-emerald-500",
135
+ secondary: "border-l-violet-700",
136
+ tertiary: "border-l-blue-500"
137
+ }
138
+ },
139
+ defaultVariants: {
140
+ variant: "primary"
141
+ }
142
+ }
143
+ ), K = u("block p-px", {
144
+ variants: {
145
+ variant: {
146
+ primary: "bg-emerald-500",
147
+ secondary: "bg-violet-700",
148
+ tertiary: "bg-blue-500"
149
+ }
150
+ },
151
+ defaultVariants: {
152
+ variant: "primary"
153
+ }
154
+ }), C = "polygon(22px 0%, 100% 0%, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0% 100%, 0% 22px)", Y = y(
155
+ ({ className: r, sharp: a, variant: e, title: t, children: s, defaultOpen: n, customColour: o, ...m }, c) => {
156
+ const i = /* @__PURE__ */ p(
157
+ "details",
158
+ {
159
+ ref: c,
160
+ open: n,
161
+ className: `group ${U({ sharp: a, variant: e, className: r })}`,
162
+ style: a ? { clipPath: C } : { borderColor: o },
163
+ ...m,
164
+ children: [
165
+ /* @__PURE__ */ p("summary", { className: F({ variant: e }), style: { backgroundColor: o }, children: [
166
+ /* @__PURE__ */ l("span", { children: t }),
167
+ /* @__PURE__ */ l($, { "aria-hidden": "true", className: "h-5 w-5 flex-shrink-0 transition-transform duration-200 group-open:rotate-180" })
168
+ ] }),
169
+ /* @__PURE__ */ l("div", { className: G({ variant: e }), style: { borderLeftColor: o }, children: s })
170
+ ]
171
+ }
172
+ );
173
+ return a ? /* @__PURE__ */ l(
174
+ "div",
175
+ {
176
+ className: K({ variant: e }),
177
+ style: { backgroundColor: o, clipPath: C },
178
+ children: i
179
+ }
180
+ ) : i;
181
+ }
182
+ );
183
+ Y.displayName = "Accordion";
184
+ const q = u("flex justify-center items-center p-3", {
185
+ variants: {
186
+ variant: {
187
+ complete: "bg-emerald-500",
188
+ info: "bg-blue-500",
189
+ secondary: "bg-violet-700",
190
+ danger: "bg-red-500"
191
+ },
192
+ sharp: {
193
+ true: "",
194
+ false: "rounded-l-2xl"
195
+ }
196
+ },
197
+ defaultVariants: { variant: "complete", sharp: !1 }
198
+ }), J = u("px-4 py-2", {
199
+ variants: {
200
+ variant: {
201
+ complete: "bg-emerald-500",
202
+ info: "bg-blue-500",
203
+ secondary: "bg-violet-700",
204
+ danger: "bg-red-500"
205
+ },
206
+ sharp: {
207
+ true: "",
208
+ false: "rounded-tr-2xl"
209
+ }
210
+ },
211
+ defaultVariants: { variant: "complete", sharp: !1 }
212
+ }), Q = u("bg-gray-500 flex-1", {
213
+ variants: {
214
+ sharp: {
215
+ true: "",
216
+ false: "rounded-r-2xl"
217
+ }
218
+ },
219
+ defaultVariants: { sharp: !1 }
220
+ }), Z = "polygon(20px 0%, 100% 0%, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0% 100%, 0% 20px)";
221
+ function Me({
222
+ variant: r,
223
+ sharp: a,
224
+ alertIcon: e,
225
+ headingText: t,
226
+ bodyText: s,
227
+ customColour: n
228
+ }) {
229
+ const o = n ? { backgroundColor: n } : void 0;
230
+ return /* @__PURE__ */ p(
231
+ "div",
232
+ {
233
+ role: "alert",
234
+ className: "flex max-w-[600px]",
235
+ style: a ? { clipPath: Z } : void 0,
236
+ children: [
237
+ /* @__PURE__ */ l("div", { className: q({ variant: r, sharp: a }), style: o, children: /* @__PURE__ */ l("span", { "aria-hidden": "true", children: e }) }),
238
+ /* @__PURE__ */ p("div", { className: Q({ sharp: a }), children: [
239
+ /* @__PURE__ */ l("div", { className: J({ variant: r, sharp: a }), style: o, children: /* @__PURE__ */ l("span", { className: "text-white text-lg font-semibold", children: t }) }),
240
+ /* @__PURE__ */ l("div", { className: "p-4", children: /* @__PURE__ */ l("p", { className: "text-slate-200", children: s }) })
241
+ ] })
242
+ ]
243
+ }
244
+ );
245
+ }
246
+ const ee = u("relative inline-block shrink-0", {
247
+ variants: {
248
+ sharp: {
249
+ true: "rounded-none",
250
+ false: "rounded-full"
251
+ }
252
+ },
253
+ defaultVariants: {
254
+ sharp: !1
255
+ }
256
+ }), ae = u("w-full h-full object-cover", {
257
+ variants: {
258
+ sharp: {
259
+ true: "rounded-none",
260
+ false: "rounded-full"
261
+ }
262
+ },
263
+ defaultVariants: {
264
+ sharp: !1
265
+ }
266
+ }), re = u("absolute block border border-gray-900", {
267
+ variants: {
268
+ status: {
269
+ online: "bg-emerald-500",
270
+ away: "bg-amber-400",
271
+ offline: "bg-red-500"
272
+ },
273
+ sharp: {
274
+ true: "rounded-none top-[-5px] right-[-5px]",
275
+ false: "rounded-full top-0 right-0"
276
+ }
277
+ },
278
+ defaultVariants: {
279
+ sharp: !1
280
+ }
281
+ }), te = y(
282
+ ({ sharp: r, status: a, size: e = 48, src: t, alt: s, className: n, customColour: o, ...m }, c) => {
283
+ const i = Math.max(8, Math.round(e * 0.22));
284
+ return /* @__PURE__ */ p(
285
+ "div",
286
+ {
287
+ className: ee({ sharp: r, className: n }),
288
+ style: { width: e, height: e },
289
+ children: [
290
+ /* @__PURE__ */ l(
291
+ "img",
292
+ {
293
+ ref: c,
294
+ src: t,
295
+ alt: s ?? "avatar",
296
+ className: ae({ sharp: r }),
297
+ style: { width: e, height: e },
298
+ ...m
299
+ }
300
+ ),
301
+ a && /* @__PURE__ */ l(
302
+ "span",
303
+ {
304
+ role: "img",
305
+ "aria-label": a,
306
+ className: re({ status: a, sharp: r }),
307
+ style: { width: i, height: i, ...o ? { backgroundColor: o } : {} }
308
+ }
309
+ )
310
+ ]
311
+ }
312
+ );
313
+ }
314
+ );
315
+ te.displayName = "Avatar";
316
+ const le = u(
317
+ "inline-flex items-center justify-center font-semibold",
318
+ {
319
+ variants: {
320
+ variant: {
321
+ primary: "bg-emerald-500 text-white",
322
+ secondary: "bg-violet-700 text-white",
323
+ tertiary: "bg-blue-500 text-white",
324
+ danger: "bg-red-500 text-white"
325
+ },
326
+ size: {
327
+ sm: "px-2 py-0.5 text-xs",
328
+ md: "px-2.5 py-1 text-sm",
329
+ lg: "px-3 py-1.5 text-base"
330
+ },
331
+ sharp: {
332
+ true: "rounded-none",
333
+ false: "rounded-full"
334
+ }
335
+ },
336
+ defaultVariants: {
337
+ variant: "primary",
338
+ size: "md",
339
+ sharp: !1
340
+ }
341
+ }
342
+ ), ne = "polygon(6px 0%, 100% 0%, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0% 100%, 0% 6px)", se = y(
343
+ ({ className: r, variant: a, size: e, sharp: t, children: s, style: n, customColour: o, ...m }, c) => {
344
+ const i = o ? { backgroundColor: o } : void 0;
345
+ return /* @__PURE__ */ l(
346
+ "span",
347
+ {
348
+ ref: c,
349
+ className: le({ variant: a, size: e, sharp: t, className: r }),
350
+ style: t ? { clipPath: ne, ...i, ...n } : { ...i, ...n },
351
+ ...m,
352
+ children: s
353
+ }
354
+ );
355
+ }
356
+ );
357
+ se.displayName = "Badge";
358
+ const ie = u(
359
+ `font-semibold transition-colors focus:outline-none focus-visible:outline-none
360
+ focus:ring-2 focus:ring-gray-900 disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center gap-2`,
361
+ {
362
+ variants: {
363
+ variant: {
364
+ primary: "",
365
+ secondary: "",
366
+ tertiary: "",
367
+ ghost: "bg-transparent text-slate-200 hover:bg-gray-600",
368
+ danger: ""
369
+ },
370
+ size: {
371
+ sm: "px-3 py-1.5 text-sm",
372
+ md: "px-4 py-2 text-base",
373
+ lg: "px-6 py-3 text-lg"
374
+ },
375
+ sharp: {
376
+ true: "rounded-none active:opacity-75",
377
+ false: "rounded-lg"
378
+ },
379
+ outline: {
380
+ true: "border",
381
+ false: "border-transparent"
382
+ }
383
+ },
384
+ compoundVariants: [
385
+ // Non-sharp outline: transparent bg
386
+ { outline: !0, sharp: !1, className: "bg-transparent" },
387
+ // Sharp outline: dark bg so only the wrapper's 1px edge shows as the border
388
+ {
389
+ outline: !0,
390
+ sharp: !0,
391
+ className: "bg-gray-950 border-transparent hover:bg-gray-800"
392
+ },
393
+ // Per-variant outline Colors
394
+ {
395
+ outline: !0,
396
+ variant: "primary",
397
+ className: "text-emerald-500 border-emerald-500 hover:border-emerald-500/75"
398
+ },
399
+ {
400
+ outline: !0,
401
+ variant: "secondary",
402
+ className: "text-violet-700 border-violet-700 hover:border-violet-700/75"
403
+ },
404
+ {
405
+ outline: !0,
406
+ variant: "tertiary",
407
+ className: "text-blue-500 border-blue-500 hover:border-blue-500/75"
408
+ },
409
+ {
410
+ outline: !0,
411
+ variant: "danger",
412
+ className: "text-red-500 border-red-500 hover:border-red-500/75"
413
+ },
414
+ // Filled variants
415
+ {
416
+ outline: !1,
417
+ variant: "primary",
418
+ className: "bg-emerald-500 text-white hover:bg-emerald-600"
419
+ },
420
+ {
421
+ outline: !1,
422
+ variant: "secondary",
423
+ className: "bg-violet-700 text-white hover:bg-violet-800"
424
+ },
425
+ {
426
+ outline: !1,
427
+ variant: "tertiary",
428
+ className: "bg-blue-500 text-white hover:bg-blue-600"
429
+ },
430
+ {
431
+ outline: !1,
432
+ variant: "danger",
433
+ className: "bg-red-500 text-white hover:bg-red-600"
434
+ }
435
+ ],
436
+ defaultVariants: {
437
+ variant: "primary",
438
+ size: "md",
439
+ sharp: !1,
440
+ outline: !1
441
+ }
442
+ }
443
+ ), oe = u("inline-block p-px", {
444
+ variants: {
445
+ variant: {
446
+ primary: "bg-emerald-500",
447
+ secondary: "bg-violet-700",
448
+ tertiary: "bg-blue-500",
449
+ ghost: "bg-slate-400",
450
+ danger: "bg-red-500"
451
+ }
452
+ },
453
+ defaultVariants: {
454
+ variant: "primary"
455
+ }
456
+ }), R = "polygon(10px 0%, 100% 0%, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0% 100%, 0% 10px)", de = y(
457
+ ({
458
+ className: r,
459
+ variant: a,
460
+ size: e,
461
+ sharp: t,
462
+ outline: s,
463
+ icon: n,
464
+ iconPosition: o = "left",
465
+ children: m,
466
+ style: c,
467
+ customColor: i,
468
+ ...f
469
+ }, d) => {
470
+ const b = i ? { backgroundColor: i } : void 0, h = i ? { borderColor: i, color: i } : void 0, v = /* @__PURE__ */ p(
471
+ "button",
472
+ {
473
+ ref: d,
474
+ className: ie({ variant: a, size: e, sharp: t, outline: s, className: r }),
475
+ style: t ? {
476
+ clipPath: R,
477
+ ...s ? h : b,
478
+ ...c
479
+ } : { ...s ? h : b, ...c },
480
+ ...f,
481
+ children: [
482
+ n && o === "left" && /* @__PURE__ */ l("span", { className: "inline-flex", "aria-hidden": "true", children: n }),
483
+ m,
484
+ n && o === "right" && /* @__PURE__ */ l("span", { className: "inline-flex", "aria-hidden": "true", children: n })
485
+ ]
486
+ }
487
+ );
488
+ return t && s ? /* @__PURE__ */ l(
489
+ "div",
490
+ {
491
+ className: oe({ variant: a }),
492
+ style: {
493
+ clipPath: R,
494
+ ...i ? { backgroundColor: i } : {}
495
+ },
496
+ children: v
497
+ }
498
+ ) : v;
499
+ }
500
+ );
501
+ de.displayName = "Button";
502
+ const ce = u(
503
+ `w-full py-2 bg-white dark:bg-gray-900 border text-gray-800 dark:text-gray-400
504
+ transition-colors placeholder:text-gray-500
505
+ focus:outline-none disabled:cursor-not-allowed disabled:opacity-50`,
506
+ {
507
+ variants: {
508
+ variant: {
509
+ primary: "",
510
+ secondary: "",
511
+ tertiary: ""
512
+ },
513
+ error: {
514
+ true: "border-red-500",
515
+ false: ""
516
+ },
517
+ sharp: {
518
+ true: "rounded-none",
519
+ false: "rounded-lg"
520
+ },
521
+ iconLeft: {
522
+ true: "pl-10 pr-4",
523
+ false: "pr-10 pl-4"
524
+ }
525
+ },
526
+ compoundVariants: [
527
+ {
528
+ variant: "primary",
529
+ error: !1,
530
+ className: "border-emerald-700 focus:ring-2 focus:ring-emerald-500"
531
+ },
532
+ {
533
+ variant: "secondary",
534
+ error: !1,
535
+ className: "border-violet-700 focus:ring-2 focus:ring-violet-500"
536
+ },
537
+ {
538
+ variant: "tertiary",
539
+ error: !1,
540
+ className: "border-blue-700 focus:ring-2 focus:ring-blue-500"
541
+ }
542
+ ],
543
+ defaultVariants: {
544
+ variant: "primary",
545
+ error: !1,
546
+ sharp: !1,
547
+ iconLeft: !1
548
+ }
549
+ }
550
+ ), T = "polygon(0% 0%, 100% 0%, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0% 100%)", ue = u("inline-block p-px", {
551
+ variants: {
552
+ variant: {
553
+ primary: "",
554
+ secondary: "",
555
+ tertiary: ""
556
+ },
557
+ error: {
558
+ true: "bg-red-500",
559
+ false: ""
560
+ }
561
+ },
562
+ compoundVariants: [
563
+ {
564
+ variant: "primary",
565
+ error: !1,
566
+ className: "bg-emerald-700 focus-within:bg-emerald-500"
567
+ },
568
+ {
569
+ variant: "secondary",
570
+ error: !1,
571
+ className: "bg-violet-700 focus-within:bg-violet-500"
572
+ },
573
+ {
574
+ variant: "tertiary",
575
+ error: !1,
576
+ className: "bg-blue-700 focus-within:bg-blue-500"
577
+ }
578
+ ],
579
+ defaultVariants: {
580
+ variant: "primary",
581
+ error: !1
582
+ }
583
+ }), me = y(
584
+ ({
585
+ className: r,
586
+ variant: a,
587
+ error: e,
588
+ sharp: t,
589
+ iconLeft: s,
590
+ icon: n,
591
+ placeholder: o,
592
+ style: m,
593
+ label: c,
594
+ ...i
595
+ }, f) => {
596
+ const d = n != null, b = /* @__PURE__ */ l(
597
+ "input",
598
+ {
599
+ ref: f,
600
+ placeholder: o,
601
+ "aria-invalid": e === !0 ? !0 : void 0,
602
+ className: ce({
603
+ variant: a,
604
+ error: e,
605
+ sharp: t,
606
+ iconLeft: d ? s : void 0,
607
+ className: r
608
+ }),
609
+ style: t ? { clipPath: T, ...m } : m,
610
+ ...i
611
+ }
612
+ ), v = d ? /* @__PURE__ */ p("div", { className: "relative flex items-center", children: [
613
+ b,
614
+ d && /* @__PURE__ */ l(
615
+ "span",
616
+ {
617
+ "aria-hidden": "true",
618
+ className: `absolute top-1/2 -translate-y-1/2 text-gray-500 pointer-events-none ${s ? "left-3" : "right-3"}`,
619
+ children: n
620
+ }
621
+ )
622
+ ] }) : b;
623
+ return t ? /* @__PURE__ */ p("label", { className: "flex flex-col gap-0", children: [
624
+ /* @__PURE__ */ l("span", { className: "text-gray-800 dark:text-gray-300", children: c }),
625
+ /* @__PURE__ */ l(
626
+ "div",
627
+ {
628
+ className: ue({ variant: a, error: e }),
629
+ style: { clipPath: T },
630
+ children: v
631
+ }
632
+ )
633
+ ] }) : /* @__PURE__ */ p("label", { children: [
634
+ /* @__PURE__ */ l("span", { className: "text-gray-800 dark:text-gray-300", children: c }),
635
+ v
636
+ ] });
637
+ }
638
+ );
639
+ me.displayName = "Input";
640
+ const H = {
641
+ primary: "#10b981",
642
+ secondary: "#8b5cf6",
643
+ tertiary: "#3b82f6"
644
+ }, pe = { sm: "h-1.5", md: "h-3", lg: "h-5" }, be = { sm: 64, md: 96, lg: 128 }, fe = y(
645
+ ({
646
+ className: r,
647
+ variant: a = "primary",
648
+ size: e = "md",
649
+ sharp: t = !1,
650
+ value: s,
651
+ type: n = "bar",
652
+ showLabel: o = !1,
653
+ customColour: m,
654
+ style: c,
655
+ ...i
656
+ }, f) => {
657
+ const d = Math.max(0, Math.min(100, s)), b = m ?? H[a ?? "primary"] ?? H.primary;
658
+ if (n === "circular") {
659
+ const g = be[e ?? "md"], N = Math.max(6, Math.round(g * 0.1)), k = (g - N) / 2, P = 2 * Math.PI * k, j = P * (1 - d / 100), w = g / 2;
660
+ return /* @__PURE__ */ p(
661
+ "div",
662
+ {
663
+ ref: f,
664
+ role: "progressbar",
665
+ "aria-valuenow": d,
666
+ "aria-valuemin": 0,
667
+ "aria-valuemax": 100,
668
+ className: `relative inline-flex items-center justify-center${r ? ` ${r}` : ""}`,
669
+ style: { width: g, height: g, ...c },
670
+ ...i,
671
+ children: [
672
+ /* @__PURE__ */ p(
673
+ "svg",
674
+ {
675
+ width: g,
676
+ height: g,
677
+ style: { transform: "rotate(-90deg)" },
678
+ children: [
679
+ /* @__PURE__ */ l(
680
+ "circle",
681
+ {
682
+ cx: w,
683
+ cy: w,
684
+ r: k,
685
+ fill: "none",
686
+ stroke: "#1f2937",
687
+ strokeWidth: N
688
+ }
689
+ ),
690
+ /* @__PURE__ */ l(
691
+ "circle",
692
+ {
693
+ cx: w,
694
+ cy: w,
695
+ r: k,
696
+ fill: "none",
697
+ stroke: b,
698
+ strokeWidth: N,
699
+ strokeDasharray: P,
700
+ strokeDashoffset: j,
701
+ strokeLinecap: t ? "butt" : "round",
702
+ style: { transition: "stroke-dashoffset 0.5s ease" }
703
+ }
704
+ )
705
+ ]
706
+ }
707
+ ),
708
+ o && /* @__PURE__ */ p(
709
+ "span",
710
+ {
711
+ className: "absolute text-gray-800 dark:text-gray-300 font-semibold tabular-nums",
712
+ style: { fontSize: Math.round(g * 0.2) },
713
+ children: [
714
+ d,
715
+ "%"
716
+ ]
717
+ }
718
+ )
719
+ ]
720
+ }
721
+ );
722
+ }
723
+ const h = pe[e ?? "md"], v = t ? "rounded-none" : "rounded-full";
724
+ return /* @__PURE__ */ p(
725
+ "div",
726
+ {
727
+ ref: f,
728
+ className: `flex items-center gap-2${r ? ` ${r}` : ""}`,
729
+ style: c,
730
+ ...i,
731
+ children: [
732
+ /* @__PURE__ */ l(
733
+ "div",
734
+ {
735
+ role: "progressbar",
736
+ "aria-valuenow": d,
737
+ "aria-valuemin": 0,
738
+ "aria-valuemax": 100,
739
+ className: `flex-1 overflow-hidden bg-gray-700 ${h} ${v}`,
740
+ children: /* @__PURE__ */ l(
741
+ "div",
742
+ {
743
+ className: `h-full ${v} transition-all duration-500`,
744
+ style: { width: `${d}%`, backgroundColor: b }
745
+ }
746
+ )
747
+ }
748
+ ),
749
+ o && /* @__PURE__ */ p("span", { className: "text-sm text-gray-800 dark:text-gray-300 tabular-nums min-w-[3ch] text-right", children: [
750
+ d,
751
+ "%"
752
+ ] })
753
+ ]
754
+ }
755
+ );
756
+ }
757
+ );
758
+ fe.displayName = "Progress";
759
+ const ge = u(
760
+ `w-full pl-4 pr-10 py-2 text-base bg-white dark:bg-gray-900 border text-gray-800 dark:text-gray-400 appearance-none
761
+ transition-colors focus:outline-none disabled:cursor-not-allowed disabled:opacity-50`,
762
+ {
763
+ variants: {
764
+ error: {
765
+ true: "border-red-500",
766
+ false: "border-emerald-700 focus:ring-2 focus:ring-emerald-500"
767
+ },
768
+ sharp: {
769
+ true: "rounded-none",
770
+ false: "rounded-lg"
771
+ }
772
+ },
773
+ defaultVariants: {
774
+ error: !1,
775
+ sharp: !1
776
+ }
777
+ }
778
+ ), ye = u("inline-block p-px", {
779
+ variants: {
780
+ error: {
781
+ true: "bg-red-500",
782
+ false: "bg-emerald-700 focus-within:bg-emerald-500"
783
+ }
784
+ },
785
+ defaultVariants: {
786
+ error: !1
787
+ }
788
+ }), V = "polygon(0% 0%, 100% 0%, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0% 100%)", he = y(
789
+ ({ className: r, error: a, sharp: e, label: t, customColour: s, style: n, children: o, ...m }, c) => {
790
+ const i = /* @__PURE__ */ p("div", { className: "relative", children: [
791
+ /* @__PURE__ */ l(
792
+ "select",
793
+ {
794
+ ref: c,
795
+ "aria-invalid": a === !0 ? !0 : void 0,
796
+ className: ge({ error: a, sharp: e, className: r }),
797
+ style: e ? { clipPath: V, ...n } : { borderColor: s, ...n },
798
+ ...m,
799
+ children: o
800
+ }
801
+ ),
802
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-gray-500", children: /* @__PURE__ */ l($, { className: "w-4 h-4" }) })
803
+ ] });
804
+ return e ? /* @__PURE__ */ p("label", { className: "flex flex-col gap-0", children: [
805
+ /* @__PURE__ */ l("span", { className: "text-gray-800 dark:text-gray-300", children: t }),
806
+ /* @__PURE__ */ l(
807
+ "div",
808
+ {
809
+ className: ye({ error: a }),
810
+ style: s ? {
811
+ backgroundColor: s,
812
+ clipPath: V
813
+ } : { clipPath: V },
814
+ children: i
815
+ }
816
+ )
817
+ ] }) : /* @__PURE__ */ p("label", { className: "flex flex-col gap-0", children: [
818
+ /* @__PURE__ */ l("span", { className: "text-gray-800 dark:text-gray-300", children: t }),
819
+ i
820
+ ] });
821
+ }
822
+ );
823
+ he.displayName = "Select";
824
+ const I = {
825
+ primary: "#10b981",
826
+ secondary: "#8b5cf6",
827
+ tertiary: "#3b82f6"
828
+ }, ve = u(
829
+ `w-full h-2 appearance-none cursor-pointer
830
+ bg-gray-700
831
+ [&::-webkit-slider-thumb]:appearance-none
832
+ [&::-webkit-slider-thumb]:h-4
833
+ [&::-webkit-slider-thumb]:w-4
834
+ [&::-webkit-slider-thumb]:cursor-pointer
835
+ [&::-webkit-slider-thumb]:bg-[var(--slider-color)]
836
+ [&::-webkit-slider-thumb]:transition-transform
837
+ [&::-webkit-slider-thumb]:hover:scale-110
838
+ [&::-moz-range-thumb]:border-none
839
+ [&::-moz-range-thumb]:h-4
840
+ [&::-moz-range-thumb]:w-4
841
+ [&::-moz-range-thumb]:cursor-pointer
842
+ [&::-moz-range-thumb]:bg-[var(--slider-color)]
843
+ [&::-moz-range-progress]:bg-[var(--slider-color)]
844
+ [&::-moz-range-progress]:h-2
845
+ disabled:opacity-50 disabled:cursor-not-allowed`,
846
+ {
847
+ variants: {
848
+ variant: {
849
+ primary: "",
850
+ secondary: "",
851
+ tertiary: ""
852
+ },
853
+ sharp: {
854
+ true: "rounded-none [&::-webkit-slider-thumb]:rounded-none [&::-moz-range-thumb]:rounded-none",
855
+ false: "rounded-full [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:rounded-full"
856
+ }
857
+ },
858
+ defaultVariants: {
859
+ variant: "primary",
860
+ sharp: !1
861
+ }
862
+ }
863
+ ), xe = y(
864
+ ({ className: r, variant: a = "primary", sharp: e, label: t, customColour: s, style: n, ...o }, m) => {
865
+ const c = s ?? I[a ?? "primary"] ?? I.primary;
866
+ return /* @__PURE__ */ p("label", { className: "flex flex-col gap-2", children: [
867
+ /* @__PURE__ */ l("span", { className: "text-sm text-gray-800 dark:text-gray-300", children: t }),
868
+ /* @__PURE__ */ l(
869
+ "input",
870
+ {
871
+ ...o,
872
+ type: "range",
873
+ ref: m,
874
+ className: ve({ variant: a, sharp: e, className: r }),
875
+ style: {
876
+ "--slider-color": c,
877
+ accentColor: c,
878
+ ...n
879
+ }
880
+ }
881
+ )
882
+ ] });
883
+ }
884
+ );
885
+ xe.displayName = "Slider";
886
+ const Ne = u(
887
+ `w-full px-4 py-2 bg-white dark:bg-gray-900 border text-gray-800 dark:text-gray-400 resize-none
888
+ transition-colors placeholder:text-gray-500
889
+ focus:outline-none disabled:cursor-not-allowed disabled:opacity-50`,
890
+ {
891
+ variants: {
892
+ variant: {
893
+ primary: "",
894
+ secondary: "",
895
+ tertiary: ""
896
+ },
897
+ error: {
898
+ true: "border-red-500",
899
+ false: ""
900
+ },
901
+ sharp: {
902
+ true: "rounded-none",
903
+ false: "rounded-lg"
904
+ }
905
+ },
906
+ compoundVariants: [
907
+ {
908
+ variant: "primary",
909
+ error: !1,
910
+ className: "border-emerald-700 focus:ring-2 focus:ring-emerald-500"
911
+ },
912
+ {
913
+ variant: "secondary",
914
+ error: !1,
915
+ className: "border-violet-700 focus:ring-2 focus:ring-violet-500"
916
+ },
917
+ {
918
+ variant: "tertiary",
919
+ error: !1,
920
+ className: "border-blue-700 focus:ring-2 focus:ring-blue-500"
921
+ }
922
+ ],
923
+ defaultVariants: {
924
+ variant: "primary",
925
+ error: !1,
926
+ sharp: !1
927
+ }
928
+ }
929
+ ), we = u("block p-px", {
930
+ variants: {
931
+ variant: {
932
+ primary: "",
933
+ secondary: "",
934
+ tertiary: ""
935
+ },
936
+ error: {
937
+ true: "bg-red-500",
938
+ false: ""
939
+ }
940
+ },
941
+ compoundVariants: [
942
+ {
943
+ variant: "primary",
944
+ error: !1,
945
+ className: "bg-emerald-700 focus-within:bg-emerald-500"
946
+ },
947
+ {
948
+ variant: "secondary",
949
+ error: !1,
950
+ className: "bg-violet-700 focus-within:bg-violet-500"
951
+ },
952
+ {
953
+ variant: "tertiary",
954
+ error: !1,
955
+ className: "bg-blue-700 focus-within:bg-blue-500"
956
+ }
957
+ ],
958
+ defaultVariants: {
959
+ variant: "primary",
960
+ error: !1
961
+ }
962
+ }), S = "polygon(0% 0%, 100% 0%, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0% 100%)", ke = y(
963
+ ({ className: r, variant: a, error: e, sharp: t, label: s, style: n, ...o }, m) => {
964
+ const c = /* @__PURE__ */ l(
965
+ "textarea",
966
+ {
967
+ ref: m,
968
+ rows: 4,
969
+ "aria-invalid": e === !0 ? !0 : void 0,
970
+ className: Ne({ variant: a, error: e, sharp: t, className: r }),
971
+ style: t ? { clipPath: S, ...n } : n,
972
+ ...o
973
+ }
974
+ );
975
+ return t ? /* @__PURE__ */ p("label", { className: "flex flex-col gap-0", children: [
976
+ /* @__PURE__ */ l("span", { className: "text-gray-800 dark:text-gray-300", children: s }),
977
+ /* @__PURE__ */ l(
978
+ "div",
979
+ {
980
+ className: we({ variant: a, error: e }),
981
+ style: { clipPath: S },
982
+ children: c
983
+ }
984
+ )
985
+ ] }) : /* @__PURE__ */ p("label", { className: "flex flex-col gap-0", children: [
986
+ /* @__PURE__ */ l("span", { className: "text-gray-800 dark:text-gray-300", children: s }),
987
+ c
988
+ ] });
989
+ }
990
+ );
991
+ ke.displayName = "TextArea";
992
+ const Ve = u(
993
+ "group relative inline-flex w-11 shrink-0 bg-gray-500 p-0.5 shadow-inner outline-offset-2 transition-colors duration-200 ease-in-out has-[:focus-visible]:outline-2",
994
+ {
995
+ variants: {
996
+ variant: {
997
+ primary: "has-[:checked]:bg-emerald-500 outline-emerald-500",
998
+ secondary: "has-[:checked]:bg-violet-700 outline-violet-700",
999
+ tertiary: "has-[:checked]:bg-blue-500 outline-blue-500"
1000
+ },
1001
+ sharp: {
1002
+ true: "rounded-none",
1003
+ false: "rounded-full"
1004
+ }
1005
+ },
1006
+ defaultVariants: {
1007
+ variant: "primary",
1008
+ sharp: !1
1009
+ }
1010
+ }
1011
+ ), Pe = u(
1012
+ "size-5 rounded-full bg-white shadow-sm ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out group-has-[:checked]:translate-x-5",
1013
+ {
1014
+ variants: {
1015
+ sharp: {
1016
+ true: "rounded-none",
1017
+ false: "rounded-full"
1018
+ }
1019
+ },
1020
+ defaultVariants: {
1021
+ sharp: !1
1022
+ }
1023
+ }
1024
+ ), Ae = y(
1025
+ ({ variant: r, sharp: a, customColour: e, "aria-label": t, ...s }, n) => /* @__PURE__ */ p(
1026
+ "div",
1027
+ {
1028
+ className: `${Ve({ variant: r, sharp: a })}${e ? " has-[:checked]:[background-color:var(--toggle-color)]" : ""}`,
1029
+ style: e ? { "--toggle-color": e } : void 0,
1030
+ children: [
1031
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: Pe({ sharp: a }) }),
1032
+ /* @__PURE__ */ l(
1033
+ "input",
1034
+ {
1035
+ ref: n,
1036
+ name: "track",
1037
+ type: "checkbox",
1038
+ "aria-label": t ?? "Toggle",
1039
+ className: "absolute inset-0 size-full appearance-none focus:outline-hidden",
1040
+ ...s
1041
+ }
1042
+ )
1043
+ ]
1044
+ }
1045
+ )
1046
+ );
1047
+ Ae.displayName = "Toggle";
1048
+ const _e = u("w-full text-white overflow-hidden", {
1049
+ variants: {
1050
+ variant: {
1051
+ primary: "bg-emerald-500",
1052
+ secondary: "bg-violet-700",
1053
+ tertiary: "bg-blue-500"
1054
+ },
1055
+ sharp: {
1056
+ true: "rounded-none",
1057
+ false: "rounded-lg border"
1058
+ }
1059
+ },
1060
+ compoundVariants: [
1061
+ { sharp: !1, variant: "primary", className: "border-emerald-500" },
1062
+ { sharp: !1, variant: "secondary", className: "border-violet-700" },
1063
+ { sharp: !1, variant: "tertiary", className: "border-blue-500" }
1064
+ ],
1065
+ defaultVariants: {
1066
+ sharp: !1,
1067
+ variant: "primary"
1068
+ }
1069
+ }), Ce = u("w-full px-4 py-3 font-semibold text-white", {
1070
+ variants: {
1071
+ variant: {
1072
+ primary: "bg-emerald-500",
1073
+ secondary: "bg-violet-700",
1074
+ tertiary: "bg-blue-500"
1075
+ }
1076
+ }
1077
+ }), Re = u("border-l-4 px-4 py-4 text-slate-200 bg-gray-500", {
1078
+ variants: {
1079
+ variant: {
1080
+ primary: "border-l-emerald-500",
1081
+ secondary: "border-l-violet-700",
1082
+ tertiary: "border-l-blue-500"
1083
+ }
1084
+ },
1085
+ defaultVariants: {
1086
+ variant: "primary"
1087
+ }
1088
+ }), Te = u("block p-px", {
1089
+ variants: {
1090
+ variant: {
1091
+ primary: "bg-emerald-500",
1092
+ secondary: "bg-violet-700",
1093
+ tertiary: "bg-blue-500"
1094
+ }
1095
+ },
1096
+ defaultVariants: {
1097
+ variant: "primary"
1098
+ }
1099
+ }), L = "polygon(22px 0%, 100% 0%, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0% 100%, 0% 22px)", He = y(
1100
+ ({ className: r, sharp: a, variant: e, title: t, children: s, customColour: n, ...o }, m) => {
1101
+ const c = /* @__PURE__ */ p(
1102
+ "div",
1103
+ {
1104
+ ref: m,
1105
+ className: _e({ sharp: a, variant: e, className: r }),
1106
+ style: a ? { clipPath: L } : { borderColor: n },
1107
+ ...o,
1108
+ children: [
1109
+ /* @__PURE__ */ l("div", { className: Ce({ variant: e }), style: { backgroundColor: n }, children: /* @__PURE__ */ l("span", { className: "text-lg", children: t }) }),
1110
+ /* @__PURE__ */ l("div", { className: Re({ variant: e }), style: { borderLeftColor: n }, children: s })
1111
+ ]
1112
+ }
1113
+ );
1114
+ return a ? /* @__PURE__ */ l(
1115
+ "div",
1116
+ {
1117
+ className: Te({ variant: e }),
1118
+ style: { backgroundColor: n, clipPath: L },
1119
+ children: c
1120
+ }
1121
+ ) : c;
1122
+ }
1123
+ );
1124
+ He.displayName = "Card";
1125
+ const Ie = u(
1126
+ "flex items-center justify-between px-6 py-4 flex-shrink-0",
1127
+ {
1128
+ variants: {
1129
+ variant: {
1130
+ primary: "bg-emerald-500",
1131
+ secondary: "bg-violet-700",
1132
+ tertiary: "bg-blue-500"
1133
+ }
1134
+ },
1135
+ defaultVariants: {
1136
+ variant: "primary"
1137
+ }
1138
+ }
1139
+ ), Se = u(
1140
+ `open:flex open:flex-col p-0 border-none outline-none
1141
+ bg-gray-500
1142
+ w-full max-w-lg
1143
+ shadow-2xl
1144
+ backdrop:bg-black/60`,
1145
+ {
1146
+ variants: {
1147
+ sharp: {
1148
+ true: "rounded-none",
1149
+ false: "rounded-xl overflow-hidden"
1150
+ }
1151
+ },
1152
+ defaultVariants: {
1153
+ sharp: !1
1154
+ }
1155
+ }
1156
+ ), Le = "polygon(20px 0%, 100% 0%, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0% 100%, 0% 20px)", Ee = ({
1157
+ open: r,
1158
+ onClose: a,
1159
+ title: e,
1160
+ children: t,
1161
+ variant: s,
1162
+ sharp: n,
1163
+ customColour: o
1164
+ }) => {
1165
+ const m = M(null), c = z();
1166
+ O(() => {
1167
+ const d = m.current;
1168
+ d && (r && !d.open ? d.showModal() : !r && d.open && d.close());
1169
+ }, [r]);
1170
+ const i = (d) => {
1171
+ var h;
1172
+ const b = (h = m.current) == null ? void 0 : h.getBoundingClientRect();
1173
+ b && (d.clientX < b.left || d.clientX > b.right || d.clientY < b.top || d.clientY > b.bottom) && a();
1174
+ }, f = o ? { backgroundColor: o } : void 0;
1175
+ return /* @__PURE__ */ l(
1176
+ "dialog",
1177
+ {
1178
+ ref: m,
1179
+ "aria-labelledby": c,
1180
+ onClick: i,
1181
+ onCancel: (d) => {
1182
+ d.preventDefault(), a();
1183
+ },
1184
+ className: Se({ sharp: n }),
1185
+ style: n ? { clipPath: Le } : void 0,
1186
+ children: /* @__PURE__ */ p("div", { onClick: (d) => d.stopPropagation(), className: "flex flex-col", children: [
1187
+ /* @__PURE__ */ p("header", { className: Ie({ variant: s }), style: f, children: [
1188
+ /* @__PURE__ */ l("h2", { id: c, className: "text-white font-semibold", children: e }),
1189
+ /* @__PURE__ */ l(
1190
+ "button",
1191
+ {
1192
+ onClick: a,
1193
+ className: "text-white/70 hover:text-white transition-colors ml-4 flex-shrink-0",
1194
+ "aria-label": "Close modal",
1195
+ children: /* @__PURE__ */ l(X, { className: "w-5 h-5" })
1196
+ }
1197
+ )
1198
+ ] }),
1199
+ /* @__PURE__ */ l("div", { className: "px-6 py-5 text-gray-300", children: t })
1200
+ ] })
1201
+ }
1202
+ );
1203
+ };
1204
+ Ee.displayName = "Modal";
1205
+ export {
1206
+ Y as Accordion,
1207
+ Me as Alert,
1208
+ te as Avatar,
1209
+ se as Badge,
1210
+ de as Button,
1211
+ He as Card,
1212
+ me as Input,
1213
+ Ee as Modal,
1214
+ fe as Progress,
1215
+ he as Select,
1216
+ xe as Slider,
1217
+ ke as TextArea,
1218
+ Ae as Toggle
1219
+ };