@fabio.caffarello/react-design-system 1.14.2 → 1.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2874 +0,0 @@
1
- var ke = Object.defineProperty, Se = Object.defineProperties;
2
- var Ee = Object.getOwnPropertyDescriptors;
3
- var ue = Object.getOwnPropertySymbols;
4
- var pe = Object.prototype.hasOwnProperty, xe = Object.prototype.propertyIsEnumerable;
5
- var ge = (m, s, t) => s in m ? ke(m, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[s] = t, N = (m, s) => {
6
- for (var t in s || (s = {}))
7
- pe.call(s, t) && ge(m, t, s[t]);
8
- if (ue)
9
- for (var t of ue(s))
10
- xe.call(s, t) && ge(m, t, s[t]);
11
- return m;
12
- }, R = (m, s) => Se(m, Ee(s));
13
- var C = (m, s) => {
14
- var t = {};
15
- for (var r in m)
16
- pe.call(m, r) && s.indexOf(r) < 0 && (t[r] = m[r]);
17
- if (m != null && ue)
18
- for (var r of ue(m))
19
- s.indexOf(r) < 0 && xe.call(m, r) && (t[r] = m[r]);
20
- return t;
21
- };
22
- import { getRadiusClass as z, getSpacingClass as u, getTypographyClasses as T, getTypographySize as E, getTypographyWeight as ie, getZIndexClass as $e, getBorderWidthClass as Le, getSwitchClasses as Fe, getAnimationClass as fe } from "../tokens/index.js";
23
- import { c as e, j as a, L as Ve, a as H, X as he, E as Re, b as Ce, C as Ae } from "../components-DEuqI-ld.js";
24
- import { forwardRef as O, memo as U, useMemo as d, useState as Y, useCallback as _, useRef as te, useEffect as ae, isValidElement as we, cloneElement as je, Children as Me } from "react";
25
- function cr(r) {
26
- var o = r, {
27
- variant: m = "info",
28
- className: s
29
- } = o, t = C(o, [
30
- "variant",
31
- "className"
32
- ]);
33
- const i = {
34
- warning: e("bg-warning-bg", "text-warning-dark", "border-warning"),
35
- error: e("bg-error-bg", "text-error-dark", "border-error"),
36
- info: e("bg-info-bg", "text-info-dark", "border-info")
37
- };
38
- return /* @__PURE__ */ a.jsx(
39
- "div",
40
- N({
41
- role: "alert",
42
- className: e(
43
- "border",
44
- u("base", "px"),
45
- u("sm", "py"),
46
- z("lg"),
47
- i[m],
48
- s
49
- )
50
- }, t)
51
- );
52
- }
53
- const Ie = {
54
- primary: {
55
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
56
- light: "text-indigo-400",
57
- DEFAULT: "text-fg-brand",
58
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
59
- dark: "text-indigo-600",
60
- contrast: "text-fg-inverse"
61
- },
62
- secondary: {
63
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
64
- light: "text-pink-300",
65
- DEFAULT: "text-fg-brand-secondary",
66
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
67
- dark: "text-pink-600",
68
- contrast: "text-fg-inverse"
69
- },
70
- success: {
71
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
72
- light: "text-green-300",
73
- DEFAULT: "text-fg-success",
74
- dark: "text-success-dark",
75
- contrast: "text-fg-inverse"
76
- },
77
- warning: {
78
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
79
- light: "text-yellow-300",
80
- DEFAULT: "text-fg-warning",
81
- dark: "text-warning-dark",
82
- contrast: "text-fg-inverse"
83
- },
84
- error: {
85
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
86
- light: "text-red-300",
87
- DEFAULT: "text-fg-error",
88
- dark: "text-error-dark",
89
- contrast: "text-fg-inverse"
90
- },
91
- info: {
92
- // exception: variant color — no semantic equivalent (Principle 3, .claude/rules/colors.md)
93
- light: "text-blue-300",
94
- DEFAULT: "text-fg-info",
95
- dark: "text-info-dark",
96
- contrast: "text-fg-inverse"
97
- },
98
- neutral: {
99
- light: "text-fg-tertiary",
100
- DEFAULT: "text-fg-secondary",
101
- dark: "text-fg-primary",
102
- contrast: "text-fg-inverse"
103
- }
104
- };
105
- function ze(x, p) {
106
- var g = x, {
107
- variant: m = "paragraph",
108
- bold: s,
109
- italic: t,
110
- className: r,
111
- as: o,
112
- color: i,
113
- colorRole: n = "neutral",
114
- colorShade: c = "dark"
115
- } = g, b = C(g, [
116
- "variant",
117
- "bold",
118
- "italic",
119
- "className",
120
- "as",
121
- "color",
122
- "colorRole",
123
- "colorShade"
124
- ]);
125
- const l = [];
126
- let f;
127
- if (o)
128
- f = o;
129
- else
130
- switch (m) {
131
- case "heading":
132
- f = "h2";
133
- break;
134
- case "list":
135
- f = "li";
136
- break;
137
- case "paragraph":
138
- default:
139
- f = "p";
140
- break;
141
- }
142
- return m === "heading" ? l.push(T("h2")) : m === "body" || m === "paragraph" ? l.push(T("body")) : m === "bodySmall" ? l.push(T("bodySmall")) : m === "bodyLarge" ? l.push(T("bodyLarge")) : m === "caption" ? l.push(T("caption")) : m === "label" ? l.push(T("label")) : l.push(T("body")), s && l.push("font-bold"), t && l.push("italic"), l.push(Ie[n][c]), /* @__PURE__ */ a.jsx(f, N({ ref: p, className: e(...l, r) }, b));
143
- }
144
- const dr = O(ze), De = H("motion-safe:animate-spin", {
145
- variants: {
146
- size: {
147
- sm: "h-4 w-4",
148
- md: "h-5 w-5",
149
- lg: "h-8 w-8"
150
- },
151
- variant: {
152
- primary: "text-fg-brand",
153
- secondary: "text-fg-brand-secondary",
154
- neutral: "text-fg-secondary"
155
- }
156
- },
157
- defaultVariants: {
158
- size: "md",
159
- variant: "primary"
160
- }
161
- }), Ne = U(function(n) {
162
- var c = n, {
163
- size: s = "md",
164
- variant: t = "primary",
165
- label: r,
166
- className: o = ""
167
- } = c, i = C(c, [
168
- "size",
169
- "variant",
170
- "label",
171
- "className"
172
- ]);
173
- return /* @__PURE__ */ a.jsxs(
174
- "div",
175
- R(N({
176
- className: e("inline-flex", "items-center", o),
177
- role: "status",
178
- "aria-label": r || "Loading",
179
- "aria-live": "polite"
180
- }, i), {
181
- children: [
182
- /* @__PURE__ */ a.jsx(
183
- Ve,
184
- {
185
- className: e(De({ size: s, variant: t })),
186
- "aria-hidden": "true"
187
- }
188
- ),
189
- r && /* @__PURE__ */ a.jsx(
190
- "span",
191
- {
192
- className: e(
193
- u("sm", "ml"),
194
- E("bodySmall"),
195
- "text-fg-secondary",
196
- "sr-only"
197
- ),
198
- children: r
199
- }
200
- )
201
- ]
202
- })
203
- );
204
- });
205
- Ne.displayName = "Spinner";
206
- const Te = H(
207
- // Base classes
208
- e(
209
- "inline-flex",
210
- "items-center",
211
- "justify-center",
212
- T("button").split(" ")[2] || "font-medium",
213
- // Extract font-medium
214
- z("md"),
215
- "transition-colors",
216
- "focus:outline-none",
217
- "focus:ring-2",
218
- "focus:ring-offset-2",
219
- "disabled:opacity-50",
220
- "disabled:cursor-not-allowed"
221
- ),
222
- {
223
- variants: {
224
- variant: {
225
- primary: e(
226
- "bg-surface-brand",
227
- "text-fg-inverse",
228
- "hover:opacity-90",
229
- "focus:ring-line-brand"
230
- ),
231
- secondary: e(
232
- "bg-surface-secondary",
233
- "text-fg-inverse",
234
- "hover:opacity-90",
235
- "focus:ring-line-secondary"
236
- ),
237
- error: e(
238
- "bg-error",
239
- "text-fg-inverse",
240
- "hover:opacity-90",
241
- "focus:ring-error"
242
- ),
243
- outline: e(
244
- "border-2",
245
- "border-line-default",
246
- "bg-transparent",
247
- "text-fg-primary",
248
- "hover:bg-surface-hover",
249
- "focus:ring-line-focus"
250
- ),
251
- ghost: e(
252
- "bg-transparent",
253
- "text-fg-primary",
254
- "hover:bg-surface-hover",
255
- "focus:ring-line-focus"
256
- ),
257
- iconOnly: e(
258
- "bg-transparent",
259
- "text-fg-primary",
260
- "hover:bg-surface-hover",
261
- "focus:ring-line-focus",
262
- "p-0"
263
- )
264
- },
265
- size: {
266
- sm: e(
267
- u("md", "px"),
268
- u("1.5", "py"),
269
- E("bodySmall"),
270
- u("1.5", "gap")
271
- ),
272
- md: e(
273
- u("base", "px"),
274
- u("sm", "py"),
275
- E("body"),
276
- u("sm", "gap")
277
- ),
278
- lg: e(
279
- u("lg", "px"),
280
- u("md", "py"),
281
- E("bodyLarge"),
282
- u("2.5", "gap")
283
- )
284
- }
285
- },
286
- compoundVariants: [
287
- // IconOnly variant has different sizing
288
- {
289
- variant: "iconOnly",
290
- size: "sm",
291
- class: e("h-8", "w-8", "p-0")
292
- },
293
- {
294
- variant: "iconOnly",
295
- size: "md",
296
- class: e("h-10", "w-10", "p-0")
297
- },
298
- {
299
- variant: "iconOnly",
300
- size: "lg",
301
- class: e("h-12", "w-12", "p-0")
302
- }
303
- ],
304
- defaultVariants: {
305
- variant: "primary",
306
- size: "md"
307
- }
308
- }
309
- );
310
- function ye({
311
- children: m,
312
- position: s
313
- }) {
314
- return m ? /* @__PURE__ */ a.jsx(
315
- "span",
316
- {
317
- className: `inline-flex items-center ${s === "left" ? "mr-0" : "ml-0"}`,
318
- children: m
319
- }
320
- ) : null;
321
- }
322
- const me = U(
323
- O(function(j, h) {
324
- var S = j, {
325
- variant: s = "primary",
326
- size: t = "md",
327
- isLoading: r = !1,
328
- loadingText: o,
329
- loadingIcon: i,
330
- leftIcon: n,
331
- rightIcon: c,
332
- fullWidth: b = !1,
333
- as: p = "button",
334
- className: x = "",
335
- disabled: g = !1,
336
- children: l,
337
- "aria-label": f
338
- } = S, y = C(S, [
339
- "variant",
340
- "size",
341
- "isLoading",
342
- "loadingText",
343
- "loadingIcon",
344
- "leftIcon",
345
- "rightIcon",
346
- "fullWidth",
347
- "as",
348
- "className",
349
- "disabled",
350
- "children",
351
- "aria-label"
352
- ]);
353
- const k = d(
354
- () => e(
355
- Te({
356
- variant: s,
357
- size: t
358
- }),
359
- b && "w-full",
360
- x
361
- ),
362
- [s, t, b, x]
363
- ), L = d(
364
- () => s === "iconOnly" || !l && (n || c),
365
- [s, l, n, c]
366
- ), A = d(
367
- () => L && !f && !l ? "Button" : f,
368
- [L, f, l]
369
- ), v = d(() => s === "error" ? "primary" : s === "primary" || s === "secondary" ? "neutral" : "primary", [s]), F = d(
370
- () => t === "sm" ? "sm" : t === "lg" ? "lg" : "md",
371
- [t]
372
- ), W = d(
373
- () => i || /* @__PURE__ */ a.jsx(Ne, { size: F, variant: v }),
374
- [i, F, v]
375
- ), P = p === "button" && !y.type ? "button" : void 0, Z = N(N({
376
- className: k,
377
- disabled: g || r,
378
- "aria-busy": r,
379
- "aria-label": A,
380
- "aria-disabled": g || r
381
- }, P ? { type: P } : {}), y);
382
- return /* @__PURE__ */ a.jsx(p, R(N({ ref: h }, Z), { children: r ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
383
- W,
384
- o && /* @__PURE__ */ a.jsx("span", { className: "ml-2", children: o }),
385
- !o && l && /* @__PURE__ */ a.jsx("span", { className: "ml-2 opacity-0", children: l })
386
- ] }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
387
- n && /* @__PURE__ */ a.jsx(ye, { position: "left", children: n }),
388
- l,
389
- c && /* @__PURE__ */ a.jsx(ye, { position: "right", children: c })
390
- ] }) }));
391
- })
392
- );
393
- me.displayName = "Button";
394
- const Pe = U(function({
395
- error: s,
396
- success: t,
397
- helperText: r,
398
- errorId: o,
399
- helperId: i
400
- }) {
401
- const n = d(
402
- () => e(
403
- u("xs", "mt"),
404
- T("caption"),
405
- s && "text-fg-error",
406
- t && "text-fg-success",
407
- !s && !t && "text-fg-secondary"
408
- ),
409
- [s, t]
410
- ), c = d(
411
- () => r || (s ? "Error" : t ? "Success" : ""),
412
- [r, s, t]
413
- );
414
- return /* @__PURE__ */ a.jsx(
415
- "div",
416
- {
417
- id: o || i,
418
- className: n,
419
- role: s || t ? "alert" : void 0,
420
- children: c
421
- }
422
- );
423
- }), Be = U(
424
- O(function(L, k) {
425
- var A = L, {
426
- id: s,
427
- label: t,
428
- error: r = !1,
429
- success: o = !1,
430
- helperText: i,
431
- size: n = "md",
432
- variant: c = "outlined",
433
- leftIcon: b,
434
- rightIcon: p,
435
- showClearButton: x = !1,
436
- onClear: g,
437
- className: l = "",
438
- disabled: f = !1,
439
- type: y = "text",
440
- value: h,
441
- onChange: j
442
- } = A, S = C(A, [
443
- "id",
444
- "label",
445
- "error",
446
- "success",
447
- "helperText",
448
- "size",
449
- "variant",
450
- "leftIcon",
451
- "rightIcon",
452
- "showClearButton",
453
- "onClear",
454
- "className",
455
- "disabled",
456
- "type",
457
- "value",
458
- "onChange"
459
- ]);
460
- const v = d(
461
- () => s || `input-${Math.random().toString(36).substr(2, 9)}`,
462
- [s]
463
- ), F = d(
464
- () => r ? `${v}-error` : void 0,
465
- [r, v]
466
- ), W = d(
467
- () => i ? `${v}-helper` : void 0,
468
- [i, v]
469
- ), [P, Z] = Y(!1), V = d(() => y === "password", [y]), w = d(
470
- () => V && P ? "text" : y,
471
- [V, P, y]
472
- ), B = d(
473
- () => r ? "error" : o ? "success" : "default",
474
- [r, o]
475
- ), $ = d(
476
- () => h != null && h !== "",
477
- [h]
478
- ), M = d(
479
- () => x && $ && !f,
480
- [x, $, f]
481
- ), ne = d(() => "focus:border-line-focus", []), le = d(() => "focus:border-error", []), ce = d(() => "focus:border-success", []), de = d(
482
- () => ne.replace("focus:border-", "focus:ring-"),
483
- [ne]
484
- ), re = _(
485
- (D) => D === "error" ? le.replace("focus:border-", "focus:ring-") : ce.replace("focus:border-", "focus:ring-"),
486
- [le, ce]
487
- ), se = H(
488
- // Base classes
489
- e(
490
- "w-full",
491
- z("md"),
492
- "transition-colors",
493
- "focus:outline-none",
494
- "focus:ring-2",
495
- "focus:ring-offset-2",
496
- "disabled:opacity-50",
497
- "disabled:cursor-not-allowed"
498
- ),
499
- {
500
- variants: {
501
- variant: {
502
- default: e(
503
- "border-0",
504
- "border-b-2",
505
- "border-line-default",
506
- "focus:border-line-focus"
507
- ),
508
- outlined: e(
509
- "border",
510
- "border-line-default",
511
- "focus:border-line-focus"
512
- ),
513
- filled: e(
514
- "bg-surface-muted",
515
- "border-0",
516
- "focus:bg-surface-base",
517
- "focus:ring-2",
518
- de
519
- )
520
- },
521
- size: {
522
- sm: e(
523
- "h-8",
524
- E("bodySmall"),
525
- u("md", "px")
526
- ),
527
- md: e(
528
- "h-10",
529
- E("body"),
530
- u("base", "px")
531
- ),
532
- lg: e(
533
- "h-12",
534
- E("bodyLarge"),
535
- u("lg", "px")
536
- )
537
- },
538
- state: {
539
- default: "",
540
- error: e(
541
- "border-error",
542
- "focus:border-error",
543
- re("error")
544
- ),
545
- success: e(
546
- "border-success",
547
- "focus:border-success",
548
- re("success")
549
- )
550
- }
551
- },
552
- defaultVariants: {
553
- variant: "outlined",
554
- size: "md",
555
- state: "default"
556
- }
557
- }
558
- ), K = d(
559
- () => e(
560
- se({ variant: c, size: n, state: B }),
561
- // Icon padding - specific values for icon positioning
562
- b && (n === "sm" ? "pl-9" : n === "lg" ? "pl-12" : "pl-10"),
563
- (p || M || V) && (n === "sm" ? "pr-9" : n === "lg" ? "pr-12" : "pr-10"),
564
- l
565
- ),
566
- [
567
- c,
568
- n,
569
- B,
570
- b,
571
- p,
572
- M,
573
- V,
574
- l
575
- ]
576
- ), ee = d(
577
- () => e(
578
- "block",
579
- T("label"),
580
- u("xs", "mb"),
581
- f && "opacity-50"
582
- ),
583
- [f]
584
- ), Q = d(
585
- () => n === "sm" ? "h-4 w-4" : n === "lg" ? "h-5 w-5" : "h-4 w-4",
586
- [n]
587
- ), oe = d(
588
- () => n === "sm" ? "top-2" : n === "lg" ? "top-3.5" : "top-2.5",
589
- [n]
590
- ), I = _(
591
- (D) => {
592
- var J;
593
- if (D.stopPropagation(), g)
594
- g();
595
- else if (j) {
596
- const G = (J = D.currentTarget.closest(".relative")) == null ? void 0 : J.querySelector("input");
597
- if (G) {
598
- const X = {
599
- target: G,
600
- currentTarget: G,
601
- bubbles: !0,
602
- cancelable: !0,
603
- defaultPrevented: !1,
604
- eventPhase: 2,
605
- isTrusted: !1,
606
- nativeEvent: new Event("change"),
607
- preventDefault: () => {
608
- },
609
- stopPropagation: () => {
610
- },
611
- persist: () => {
612
- },
613
- timeStamp: Date.now()
614
- };
615
- Object.defineProperty(X.target, "value", {
616
- value: "",
617
- writable: !0
618
- }), Object.defineProperty(X.currentTarget, "value", {
619
- value: "",
620
- writable: !0
621
- }), j(X);
622
- }
623
- }
624
- },
625
- [g, j]
626
- ), q = _(() => {
627
- Z((D) => !D);
628
- }, []);
629
- return /* @__PURE__ */ a.jsxs("div", { className: "w-full", children: [
630
- t && /* @__PURE__ */ a.jsx("label", { htmlFor: v, className: ee, children: t }),
631
- /* @__PURE__ */ a.jsxs("div", { className: "relative", children: [
632
- b && /* @__PURE__ */ a.jsx(
633
- "div",
634
- {
635
- className: `absolute left-3 ${oe} text-fg-secondary opacity-60 pointer-events-none`,
636
- children: /* @__PURE__ */ a.jsx("div", { className: Q, children: b })
637
- }
638
- ),
639
- /* @__PURE__ */ a.jsx(
640
- "input",
641
- N({
642
- id: v,
643
- ref: k,
644
- type: w,
645
- className: K,
646
- disabled: f,
647
- value: h,
648
- onChange: j,
649
- "aria-invalid": r,
650
- "aria-required": S.required,
651
- "aria-describedby": F || W,
652
- suppressHydrationWarning: !0
653
- }, S)
654
- ),
655
- /* @__PURE__ */ a.jsxs("div", { className: "absolute right-3 top-0 bottom-0 flex items-center gap-1", children: [
656
- M && /* @__PURE__ */ a.jsx(
657
- me,
658
- {
659
- variant: "ghost",
660
- size: "sm",
661
- onClick: I,
662
- className: "h-auto p-1",
663
- "aria-label": "Clear input",
664
- children: /* @__PURE__ */ a.jsx(he, { className: Q })
665
- }
666
- ),
667
- V && /* @__PURE__ */ a.jsx(
668
- me,
669
- {
670
- variant: "ghost",
671
- size: "sm",
672
- onClick: q,
673
- className: "h-auto p-1",
674
- "aria-label": P ? "Hide password" : "Show password",
675
- children: P ? /* @__PURE__ */ a.jsx(Re, { className: Q }) : /* @__PURE__ */ a.jsx(Ce, { className: Q })
676
- }
677
- ),
678
- p && !M && !V && /* @__PURE__ */ a.jsx(
679
- "div",
680
- {
681
- className: `text-fg-secondary opacity-60 pointer-events-none ${Q}`,
682
- children: p
683
- }
684
- )
685
- ] })
686
- ] }),
687
- (r || o || i) && /* @__PURE__ */ a.jsx(
688
- Pe,
689
- {
690
- error: r,
691
- success: o,
692
- helperText: i,
693
- errorId: F,
694
- helperId: W
695
- }
696
- )
697
- ] });
698
- })
699
- );
700
- Be.displayName = "Input";
701
- function Oe({
702
- href: m,
703
- active: s
704
- }) {
705
- const t = d(() => s !== void 0 ? s : !1, [s]), r = d(() => {
706
- try {
707
- const o = (
708
- // eslint-disable-next-line @typescript-eslint/no-require-imports
709
- typeof require != "undefined" ? require("next/link") : null
710
- );
711
- return o == null ? void 0 : o.default;
712
- } catch (o) {
713
- return;
714
- }
715
- }, []);
716
- return {
717
- isActive: t,
718
- NextLink: r
719
- };
720
- }
721
- const qe = H(
722
- // Base classes
723
- e(
724
- "inline-flex",
725
- "items-center",
726
- "transition-colors",
727
- "focus:outline-none",
728
- "focus:ring-2",
729
- "focus:ring-offset-2",
730
- "disabled:opacity-50",
731
- "disabled:cursor-not-allowed",
732
- "disabled:pointer-events-none",
733
- "no-underline"
734
- ),
735
- {
736
- variants: {
737
- variant: {
738
- default: e(
739
- "text-fg-primary",
740
- "hover:opacity-80",
741
- "focus-visible:opacity-100",
742
- "focus:ring-line-brand"
743
- ),
744
- underline: e(
745
- "text-fg-primary",
746
- "hover:opacity-80",
747
- "focus-visible:opacity-100",
748
- "border-b-2",
749
- "border-transparent",
750
- "hover:border-current",
751
- "focus:ring-line-brand"
752
- ),
753
- background: e(
754
- "text-fg-primary",
755
- "hover:bg-surface-hover",
756
- "rounded-md",
757
- z("md"),
758
- "focus:ring-line-brand"
759
- )
760
- },
761
- size: {
762
- sm: e(
763
- u("sm", "px"),
764
- u("xs", "py"),
765
- E("bodySmall")
766
- ),
767
- md: e(
768
- u("base", "px"),
769
- u("sm", "py"),
770
- E("body")
771
- ),
772
- lg: e(
773
- u("lg", "px"),
774
- u("md", "py"),
775
- E("bodyLarge")
776
- )
777
- }
778
- },
779
- defaultVariants: {
780
- variant: "default",
781
- size: "md"
782
- },
783
- compoundVariants: [
784
- {
785
- variant: "underline",
786
- size: "sm",
787
- class: u("0.5", "pb")
788
- },
789
- {
790
- variant: "underline",
791
- size: "md",
792
- class: u("xs", "pb")
793
- },
794
- {
795
- variant: "underline",
796
- size: "lg",
797
- class: u("1.5", "pb")
798
- },
799
- {
800
- variant: "background",
801
- size: "sm",
802
- class: u("xs", "px")
803
- },
804
- {
805
- variant: "background",
806
- size: "md",
807
- class: u("sm", "px")
808
- },
809
- {
810
- variant: "background",
811
- size: "lg",
812
- class: u("base", "px")
813
- }
814
- ]
815
- }
816
- );
817
- function ur(l) {
818
- var f = l, {
819
- href: m,
820
- children: s,
821
- active: t,
822
- disabled: r = !1,
823
- variant: o = "default",
824
- size: i = "md",
825
- as: n,
826
- className: c,
827
- "aria-label": b,
828
- onClick: p,
829
- onKeyDown: x
830
- } = f, g = C(f, [
831
- "href",
832
- "children",
833
- "active",
834
- "disabled",
835
- "variant",
836
- "size",
837
- "as",
838
- "className",
839
- "aria-label",
840
- "onClick",
841
- "onKeyDown"
842
- ]);
843
- const y = d(() => t !== void 0 ? t : !1, [t]), { NextLink: h } = Oe({ href: m, active: y }), j = n || h || "a", S = d(() => {
844
- if (!y) return "";
845
- switch (o) {
846
- case "underline":
847
- return e("border-b-2", "border-line-brand", "text-fg-brand-emphasis");
848
- case "background":
849
- return e("bg-surface-brand-muted", "text-fg-brand-emphasis");
850
- case "default":
851
- default:
852
- return e("text-fg-brand-emphasis", "font-semibold");
853
- }
854
- }, [y, o]), k = _(
855
- (v) => {
856
- if (r) {
857
- v.preventDefault(), v.stopPropagation();
858
- return;
859
- }
860
- p == null || p(v);
861
- },
862
- [r, p]
863
- ), L = _(
864
- (v) => {
865
- if (r) {
866
- (v.key === "Enter" || v.key === " ") && (v.preventDefault(), v.stopPropagation());
867
- return;
868
- }
869
- x == null || x(v);
870
- },
871
- [r, x]
872
- ), A = d(() => {
873
- const v = N({
874
- className: e(
875
- qe({ variant: o, size: i }),
876
- S,
877
- r && "opacity-50 cursor-not-allowed pointer-events-none",
878
- c
879
- ),
880
- "aria-current": y ? "page" : void 0,
881
- "aria-disabled": r ? !0 : void 0,
882
- "aria-label": b,
883
- tabIndex: r ? -1 : void 0,
884
- onClick: k,
885
- onKeyDown: L,
886
- "data-active": y,
887
- "data-disabled": r
888
- }, g);
889
- return h && !n ? R(N({}, v), {
890
- href: r ? void 0 : m
891
- }) : R(N({}, v), {
892
- href: r ? void 0 : m
893
- });
894
- }, [
895
- o,
896
- i,
897
- S,
898
- r,
899
- c,
900
- y,
901
- b,
902
- k,
903
- L,
904
- m,
905
- h,
906
- n,
907
- g
908
- ]);
909
- return /* @__PURE__ */ a.jsx(j, R(N({}, A), { children: s }));
910
- }
911
- const He = H(
912
- // Base classes
913
- e(
914
- "inline-flex",
915
- "items-center",
916
- "justify-center",
917
- ie("label"),
918
- z("md"),
919
- "border"
920
- ),
921
- {
922
- variants: {
923
- variant: {
924
- success: "",
925
- warning: "",
926
- error: "",
927
- info: "",
928
- neutral: "",
929
- primary: "",
930
- secondary: ""
931
- },
932
- size: {
933
- sm: e(
934
- u("1.5", "px"),
935
- u("0.5", "py"),
936
- E("caption")
937
- ),
938
- md: e(
939
- u("sm", "px"),
940
- u("xs", "py"),
941
- E("caption")
942
- ),
943
- lg: e(
944
- u("sm", "px"),
945
- u("xs", "py"),
946
- E("bodySmall")
947
- )
948
- },
949
- style: {
950
- solid: "",
951
- outline: ""
952
- }
953
- },
954
- compoundVariants: [
955
- // Solid style variants
956
- {
957
- variant: "success",
958
- style: "solid",
959
- class: e("bg-success-bg", "text-success-dark", "border-success")
960
- },
961
- {
962
- variant: "warning",
963
- style: "solid",
964
- class: e("bg-warning-bg", "text-warning-dark", "border-warning")
965
- },
966
- {
967
- variant: "error",
968
- style: "solid",
969
- class: e("bg-error-bg", "text-error-dark", "border-error")
970
- },
971
- {
972
- variant: "info",
973
- style: "solid",
974
- class: e("bg-info-bg", "text-info-dark", "border-info")
975
- },
976
- {
977
- variant: "neutral",
978
- style: "solid",
979
- class: e("bg-surface-muted", "text-fg-primary", "border-line-default")
980
- },
981
- {
982
- variant: "primary",
983
- style: "solid",
984
- class: e(
985
- "bg-surface-brand",
986
- "text-fg-brand-emphasis",
987
- "border-line-brand"
988
- )
989
- },
990
- {
991
- variant: "secondary",
992
- style: "solid",
993
- // bg-pink-300: secondary solid badge — no semantic equivalent
994
- // (would shift 2 shades to bg-surface-secondary). Kept literal until
995
- // secondary brand surface palette expands beyond DEFAULT.
996
- class: e(
997
- "bg-pink-300",
998
- "text-fg-brand-secondary-emphasis",
999
- "border-line-secondary"
1000
- )
1001
- },
1002
- // Outline style variants
1003
- {
1004
- variant: "success",
1005
- style: "outline",
1006
- class: e("bg-transparent", "border-success", "text-fg-success")
1007
- },
1008
- {
1009
- variant: "warning",
1010
- style: "outline",
1011
- class: e("bg-transparent", "border-warning", "text-fg-warning")
1012
- },
1013
- {
1014
- variant: "error",
1015
- style: "outline",
1016
- class: e("bg-transparent", "border-error", "text-fg-error")
1017
- },
1018
- {
1019
- variant: "info",
1020
- style: "outline",
1021
- class: e("bg-transparent", "border-info", "text-fg-info")
1022
- },
1023
- {
1024
- variant: "neutral",
1025
- style: "outline",
1026
- class: e("bg-transparent", "border-line-default", "text-fg-secondary")
1027
- },
1028
- {
1029
- variant: "primary",
1030
- style: "outline",
1031
- class: e("bg-transparent", "border-line-brand", "text-fg-brand")
1032
- },
1033
- {
1034
- variant: "secondary",
1035
- style: "outline",
1036
- class: e(
1037
- "bg-transparent",
1038
- "border-line-secondary",
1039
- "text-fg-brand-secondary"
1040
- )
1041
- }
1042
- ],
1043
- defaultVariants: {
1044
- variant: "neutral",
1045
- size: "md",
1046
- style: "solid"
1047
- }
1048
- }
1049
- ), Ue = U(
1050
- O(function(p, b) {
1051
- var x = p, {
1052
- variant: s = "neutral",
1053
- size: t = "md",
1054
- style: r = "solid",
1055
- className: o = "",
1056
- children: i,
1057
- "aria-label": n
1058
- } = x, c = C(x, [
1059
- "variant",
1060
- "size",
1061
- "style",
1062
- "className",
1063
- "children",
1064
- "aria-label"
1065
- ]);
1066
- const g = d(
1067
- () => e(He({ variant: s, size: t, style: r }), o),
1068
- [s, t, r, o]
1069
- ), l = d(() => {
1070
- if (n) return n;
1071
- if (typeof i == "string") return i;
1072
- if (typeof i == "object" && i !== null && "props" in i) {
1073
- const f = i.props;
1074
- if (f != null && f.children && typeof f.children == "string")
1075
- return f.children;
1076
- }
1077
- }, [n, i]);
1078
- return /* @__PURE__ */ a.jsx(
1079
- "span",
1080
- R(N({
1081
- ref: b,
1082
- role: "status",
1083
- "aria-label": l,
1084
- className: g
1085
- }, c), {
1086
- children: i
1087
- })
1088
- );
1089
- })
1090
- );
1091
- Ue.displayName = "Badge";
1092
- const _e = U(function({
1093
- error: s,
1094
- success: t,
1095
- helperText: r,
1096
- errorId: o,
1097
- helperId: i
1098
- }) {
1099
- const n = d(
1100
- () => e(
1101
- u("xs", "mt"),
1102
- T("caption"),
1103
- s && "text-fg-error",
1104
- t && "text-fg-success",
1105
- !s && !t && "text-fg-secondary"
1106
- ),
1107
- [s, t]
1108
- ), c = d(
1109
- () => r || (s ? "Error" : t ? "Success" : ""),
1110
- [r, s, t]
1111
- );
1112
- return /* @__PURE__ */ a.jsx(
1113
- "div",
1114
- {
1115
- id: o || i,
1116
- className: n,
1117
- role: s || t ? "alert" : void 0,
1118
- children: c
1119
- }
1120
- );
1121
- }), We = U(
1122
- O(function(y, f) {
1123
- var h = y, {
1124
- options: s = [],
1125
- optionGroups: t,
1126
- placeholder: r,
1127
- label: o,
1128
- error: i = !1,
1129
- success: n = !1,
1130
- helperText: c,
1131
- size: b = "md",
1132
- className: p = "",
1133
- disabled: x = !1,
1134
- id: g
1135
- } = h, l = C(h, [
1136
- "options",
1137
- "optionGroups",
1138
- "placeholder",
1139
- "label",
1140
- "error",
1141
- "success",
1142
- "helperText",
1143
- "size",
1144
- "className",
1145
- "disabled",
1146
- "id"
1147
- ]);
1148
- const j = d(
1149
- () => g || `select-${Math.random().toString(36).substr(2, 9)}`,
1150
- [g]
1151
- ), S = d(
1152
- () => i ? `${j}-error` : void 0,
1153
- [i, j]
1154
- ), k = d(
1155
- () => c ? `${j}-helper` : void 0,
1156
- [c, j]
1157
- ), L = d(() => "focus:border-line-focus", []), A = d(() => "focus:border-error", []), v = d(() => "focus:border-success", []), F = _(
1158
- (w) => w === "error" ? A.replace("focus:border-", "focus:ring-") : w === "success" ? v.replace("focus:border-", "focus:ring-") : L.replace("focus:border-", "focus:ring-"),
1159
- [A, v, L]
1160
- ), W = H(
1161
- // Base classes
1162
- e(
1163
- "block",
1164
- "w-full",
1165
- z("md"),
1166
- "border",
1167
- "bg-surface-base",
1168
- "transition-colors",
1169
- "focus:outline-none",
1170
- "focus:ring-2",
1171
- "focus:ring-offset-2",
1172
- "disabled:opacity-50",
1173
- "disabled:cursor-not-allowed"
1174
- ),
1175
- {
1176
- variants: {
1177
- size: {
1178
- sm: e(
1179
- "h-8",
1180
- E("bodySmall"),
1181
- u("md", "px")
1182
- ),
1183
- md: e(
1184
- "h-10",
1185
- E("body"),
1186
- u("base", "px")
1187
- ),
1188
- lg: e(
1189
- "h-12",
1190
- E("bodyLarge"),
1191
- u("lg", "px")
1192
- )
1193
- },
1194
- state: {
1195
- default: e("border-line-default", F()),
1196
- error: e("border-error", F("error")),
1197
- success: e("border-success", F("success"))
1198
- }
1199
- },
1200
- defaultVariants: {
1201
- size: "md",
1202
- state: "default"
1203
- }
1204
- }
1205
- ), P = d(
1206
- () => i ? "error" : n ? "success" : "default",
1207
- [i, n]
1208
- ), Z = d(
1209
- () => e(W({ size: b, state: P }), p),
1210
- [b, P, p]
1211
- ), V = d(
1212
- () => e(
1213
- "block",
1214
- T("label"),
1215
- u("xs", "mb"),
1216
- x && "opacity-50"
1217
- ),
1218
- [x]
1219
- );
1220
- return /* @__PURE__ */ a.jsxs("div", { className: "w-full", children: [
1221
- o && /* @__PURE__ */ a.jsx("label", { htmlFor: j, className: V, children: o }),
1222
- /* @__PURE__ */ a.jsxs(
1223
- "select",
1224
- R(N({
1225
- id: j,
1226
- ref: f,
1227
- className: Z,
1228
- disabled: x,
1229
- "aria-invalid": i,
1230
- "aria-required": l.required,
1231
- "aria-describedby": S || k
1232
- }, l), {
1233
- children: [
1234
- r && /* @__PURE__ */ a.jsx("option", { value: "", disabled: !0, children: r }),
1235
- t && t.length > 0 ? t.map((w, B) => /* @__PURE__ */ a.jsx("optgroup", { label: w.label, children: (w.options || []).map(($) => /* @__PURE__ */ a.jsx(
1236
- "option",
1237
- {
1238
- value: $.value,
1239
- disabled: $.disabled,
1240
- children: $.label
1241
- },
1242
- $.value
1243
- )) }, B)) : (s || []).map((w) => /* @__PURE__ */ a.jsx(
1244
- "option",
1245
- {
1246
- value: w.value,
1247
- disabled: w.disabled,
1248
- children: w.label
1249
- },
1250
- w.value
1251
- ))
1252
- ]
1253
- })
1254
- ),
1255
- (i || n || c) && /* @__PURE__ */ a.jsx(
1256
- _e,
1257
- {
1258
- error: i,
1259
- success: n,
1260
- helperText: c,
1261
- errorId: S,
1262
- helperId: k
1263
- }
1264
- )
1265
- ] });
1266
- })
1267
- );
1268
- We.displayName = "Select";
1269
- const Xe = U(
1270
- O(function(n, i) {
1271
- var c = n, { error: s = !1, resize: t = "vertical", className: r = "" } = c, o = C(c, ["error", "resize", "className"]);
1272
- const b = d(() => "focus:border-line-focus", []), p = d(() => "focus:border-error", []), x = d(
1273
- () => s ? p.replace("focus:border-", "focus:ring-") : b.replace("focus:border-", "focus:ring-"),
1274
- [s, p, b]
1275
- ), g = d(
1276
- () => ({
1277
- none: "resize-none",
1278
- both: "resize",
1279
- horizontal: "resize-x",
1280
- vertical: "resize-y"
1281
- }),
1282
- []
1283
- ), l = d(
1284
- () => e(
1285
- "block",
1286
- "w-full",
1287
- z("md"),
1288
- u("base", "px"),
1289
- u("md", "py"),
1290
- "border",
1291
- E("body"),
1292
- "focus:outline-none",
1293
- "focus:ring-2",
1294
- "focus:ring-offset-2",
1295
- g[t],
1296
- s ? e("border-error", x) : e("border-line-default", x),
1297
- r
1298
- ),
1299
- [t, g, s, x, r]
1300
- ), f = d(
1301
- () => s && o.id ? `${o.id}-error` : void 0,
1302
- [s, o.id]
1303
- );
1304
- return /* @__PURE__ */ a.jsx(
1305
- "textarea",
1306
- N({
1307
- ref: i,
1308
- className: l,
1309
- "aria-invalid": s,
1310
- "aria-describedby": f
1311
- }, o)
1312
- );
1313
- })
1314
- );
1315
- Xe.displayName = "Textarea";
1316
- const Ze = U(
1317
- O(function(n, i) {
1318
- var c = n, { variant: s = "default", className: t = "", children: r } = c, o = C(c, ["variant", "className", "children"]);
1319
- const b = d(
1320
- () => e(
1321
- "block",
1322
- E("label"),
1323
- ie("label"),
1324
- "text-fg-primary"
1325
- ),
1326
- []
1327
- ), p = d(
1328
- () => ({
1329
- default: "",
1330
- required: e(
1331
- "after:content-['*']",
1332
- `after:${u("0.5", "ml")}`,
1333
- "after:text-fg-error"
1334
- ),
1335
- optional: e(
1336
- "after:content-['(optional)']",
1337
- "after:ml-1",
1338
- // xs spacing = 1 (4px) - note: test expects ml-1, not ml-0.5
1339
- "after:text-fg-tertiary",
1340
- "after:font-normal"
1341
- )
1342
- }),
1343
- []
1344
- ), x = d(
1345
- () => e(b, p[s], t),
1346
- [b, p, s, t]
1347
- );
1348
- return /* @__PURE__ */ a.jsx("label", R(N({ ref: i, className: x }, o), { children: r }));
1349
- })
1350
- );
1351
- Ze.displayName = "Label";
1352
- function fr(o) {
1353
- var i = o, {
1354
- message: m,
1355
- id: s,
1356
- className: t = ""
1357
- } = i, r = C(i, [
1358
- "message",
1359
- "id",
1360
- "className"
1361
- ]);
1362
- const n = [
1363
- u("xs", "mt"),
1364
- E("bodySmall"),
1365
- "text-fg-error",
1366
- "flex",
1367
- "items-center",
1368
- u("xs", "gap")
1369
- ], c = e(...n, t);
1370
- return /* @__PURE__ */ a.jsxs("div", R(N({ role: "alert", id: s, className: c, "aria-live": "polite" }, r), { children: [
1371
- /* @__PURE__ */ a.jsx(Ae, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }),
1372
- /* @__PURE__ */ a.jsx("span", { children: m })
1373
- ] }));
1374
- }
1375
- function mr(b) {
1376
- var p = b, {
1377
- content: m,
1378
- children: s,
1379
- position: t = "top",
1380
- delay: r = 200,
1381
- className: o = "",
1382
- "aria-label": i,
1383
- preservePositioning: n = !1
1384
- } = p, c = C(p, [
1385
- "content",
1386
- "children",
1387
- "position",
1388
- "delay",
1389
- "className",
1390
- "aria-label",
1391
- "preservePositioning"
1392
- ]);
1393
- const [x, g] = Y(!1), l = te(null), f = te(null), y = te(null), h = `tooltip-${Math.random().toString(36).substr(2, 9)}`, j = () => {
1394
- const V = setTimeout(() => {
1395
- g(!0);
1396
- }, r);
1397
- l.current = V;
1398
- }, S = () => {
1399
- l.current && (clearTimeout(l.current), l.current = null), g(!1);
1400
- }, k = () => {
1401
- g(!0);
1402
- }, L = () => {
1403
- g(!1);
1404
- }, A = (V) => {
1405
- var w;
1406
- V.key === "Escape" && (g(!1), (w = y.current) == null || w.blur());
1407
- };
1408
- ae(() => () => {
1409
- l.current && (clearTimeout(l.current), l.current = null);
1410
- }, []), ae(() => {
1411
- if (!x) return;
1412
- const V = (w) => {
1413
- f.current && !f.current.contains(w.target) && y.current && !y.current.contains(w.target) && g(!1);
1414
- };
1415
- return document.addEventListener("mousedown", V), () => {
1416
- document.removeEventListener("mousedown", V);
1417
- };
1418
- }, [x]);
1419
- const v = (V) => ({
1420
- top: "border-t-surface-inverse",
1421
- bottom: "border-b-surface-inverse",
1422
- left: "border-l-surface-inverse",
1423
- right: "border-r-surface-inverse"
1424
- })[V], F = H(
1425
- e(
1426
- "absolute",
1427
- $e("tooltip"),
1428
- u("sm", "px"),
1429
- u("xs", "py"),
1430
- E("caption"),
1431
- "text-fg-inverse",
1432
- "bg-surface-inverse",
1433
- z("md"),
1434
- "shadow-lg",
1435
- "whitespace-nowrap"
1436
- ),
1437
- {
1438
- variants: {
1439
- position: {
1440
- top: e(
1441
- "bottom-full",
1442
- "left-1/2",
1443
- "transform",
1444
- "-translate-x-1/2",
1445
- u("sm", "mb")
1446
- ),
1447
- bottom: e(
1448
- "top-full",
1449
- "left-1/2",
1450
- "transform",
1451
- "-translate-x-1/2",
1452
- u("sm", "mt")
1453
- ),
1454
- left: e(
1455
- "right-full",
1456
- "top-1/2",
1457
- "transform",
1458
- "-translate-y-1/2",
1459
- u("sm", "mr")
1460
- ),
1461
- right: e(
1462
- "left-full",
1463
- "top-1/2",
1464
- "transform",
1465
- "-translate-y-1/2",
1466
- u("sm", "ml")
1467
- )
1468
- }
1469
- },
1470
- defaultVariants: {
1471
- position: "top"
1472
- }
1473
- }
1474
- ), W = H(
1475
- e(
1476
- "absolute",
1477
- "w-0",
1478
- "h-0",
1479
- Le("thick"),
1480
- "border-transparent"
1481
- ),
1482
- {
1483
- variants: {
1484
- position: {
1485
- top: e(
1486
- "top-full",
1487
- "left-1/2",
1488
- "transform",
1489
- "-translate-x-1/2",
1490
- v("top")
1491
- ),
1492
- bottom: e(
1493
- "bottom-full",
1494
- "left-1/2",
1495
- "transform",
1496
- "-translate-x-1/2",
1497
- v("bottom")
1498
- ),
1499
- left: e(
1500
- "left-full",
1501
- "top-1/2",
1502
- "transform",
1503
- "-translate-y-1/2",
1504
- v("left")
1505
- ),
1506
- right: e(
1507
- "right-full",
1508
- "top-1/2",
1509
- "transform",
1510
- "-translate-y-1/2",
1511
- v("right")
1512
- )
1513
- }
1514
- },
1515
- defaultVariants: {
1516
- position: "top"
1517
- }
1518
- }
1519
- ), P = we(s) ? (() => {
1520
- const V = s, w = V.props, B = w.ref;
1521
- return je(V, {
1522
- ref: ($) => {
1523
- y.current = $, typeof B == "function" ? B($) : B && typeof B == "object" && "current" in B && (B.current = $);
1524
- },
1525
- "aria-describedby": x ? h : w["aria-describedby"],
1526
- onMouseEnter: ($) => {
1527
- var M;
1528
- j(), (M = w.onMouseEnter) == null || M.call(w, $);
1529
- },
1530
- onMouseLeave: ($) => {
1531
- var M;
1532
- S(), (M = w.onMouseLeave) == null || M.call(w, $);
1533
- },
1534
- onFocus: ($) => {
1535
- var M;
1536
- k(), (M = w.onFocus) == null || M.call(w, $);
1537
- },
1538
- onBlur: ($) => {
1539
- var M;
1540
- L(), (M = w.onBlur) == null || M.call(w, $);
1541
- },
1542
- onKeyDown: ($) => {
1543
- var M;
1544
- A($), (M = w.onKeyDown) == null || M.call(w, $);
1545
- }
1546
- });
1547
- })() : s, Z = n ? e("static", "inline-block", o) : e("relative", "inline-block", o);
1548
- return /* @__PURE__ */ a.jsxs("div", R(N({ className: Z }, c), { children: [
1549
- P,
1550
- x && /* @__PURE__ */ a.jsxs(
1551
- "div",
1552
- {
1553
- ref: f,
1554
- id: h,
1555
- className: e(F({ position: t })),
1556
- role: "tooltip",
1557
- "aria-live": "polite",
1558
- children: [
1559
- m,
1560
- /* @__PURE__ */ a.jsx("div", { className: e(W({ position: t })), "aria-hidden": "true" })
1561
- ]
1562
- }
1563
- )
1564
- ] }));
1565
- }
1566
- function br(c) {
1567
- var b = c, {
1568
- variant: m = "text",
1569
- width: s,
1570
- height: t,
1571
- lines: r = 1,
1572
- className: o = "",
1573
- "aria-label": i
1574
- } = b, n = C(b, [
1575
- "variant",
1576
- "width",
1577
- "height",
1578
- "lines",
1579
- "className",
1580
- "aria-label"
1581
- ]);
1582
- const p = [
1583
- "motion-safe:animate-pulse",
1584
- "bg-surface-muted",
1585
- z("sm")
1586
- ], x = {
1587
- text: "h-4",
1588
- card: "h-32",
1589
- list: "h-12",
1590
- circle: "rounded-full"
1591
- }, g = e(...p, x[m], o), l = {};
1592
- s && (l.width = s), t && (l.height = t);
1593
- const f = i || `Loading ${m} content`;
1594
- return m === "text" && r > 1 ? /* @__PURE__ */ a.jsx(
1595
- "div",
1596
- R(N({
1597
- className: u("sm", "space-y"),
1598
- role: "status",
1599
- "aria-busy": "true",
1600
- "aria-label": f
1601
- }, n), {
1602
- children: Array.from({ length: r }).map((y, h) => /* @__PURE__ */ a.jsx(
1603
- "div",
1604
- {
1605
- className: g,
1606
- style: h === r - 1 ? { width: "75%" } : l,
1607
- "aria-hidden": "true"
1608
- },
1609
- h
1610
- ))
1611
- })
1612
- ) : /* @__PURE__ */ a.jsx(
1613
- "div",
1614
- N({
1615
- className: g,
1616
- style: l,
1617
- role: "status",
1618
- "aria-busy": "true",
1619
- "aria-label": f
1620
- }, n)
1621
- );
1622
- }
1623
- function Je({
1624
- defaultOpen: m = !0,
1625
- open: s,
1626
- onOpenChange: t,
1627
- storageKey: r
1628
- }) {
1629
- const o = _(() => {
1630
- if (r && typeof window != "undefined") {
1631
- const x = localStorage.getItem(r);
1632
- if (x !== null)
1633
- return x === "true";
1634
- }
1635
- return m;
1636
- }, [m, r]), [i, n] = Y(o), c = s !== void 0 ? s : i;
1637
- ae(() => {
1638
- r && typeof window != "undefined" && s === void 0 && localStorage.setItem(r, String(i));
1639
- }, [i, r, s]);
1640
- const b = _(
1641
- (x) => {
1642
- s === void 0 && n(x), t == null || t(x);
1643
- },
1644
- [s, t]
1645
- ), p = _(() => {
1646
- b(!c);
1647
- }, [c, b]);
1648
- return {
1649
- isOpen: c,
1650
- toggle: p,
1651
- setOpen: b
1652
- };
1653
- }
1654
- function gr(x) {
1655
- var g = x, {
1656
- children: m,
1657
- trigger: s,
1658
- defaultOpen: t = !0,
1659
- open: r,
1660
- onOpenChange: o,
1661
- disabled: i = !1,
1662
- duration: n = 200,
1663
- storageKey: c,
1664
- className: b = ""
1665
- } = g, p = C(g, [
1666
- "children",
1667
- "trigger",
1668
- "defaultOpen",
1669
- "open",
1670
- "onOpenChange",
1671
- "disabled",
1672
- "duration",
1673
- "storageKey",
1674
- "className"
1675
- ]);
1676
- const { isOpen: l, toggle: f } = Je({
1677
- defaultOpen: t,
1678
- open: r,
1679
- onOpenChange: o,
1680
- storageKey: c
1681
- }), y = te(null), [h, j] = Y(l ? "auto" : 0);
1682
- ae(() => {
1683
- y.current && j(l ? y.current.scrollHeight : 0);
1684
- }, [l, m]), ae(() => {
1685
- if (!l || !y.current) return;
1686
- const k = new ResizeObserver(() => {
1687
- y.current && l && j(y.current.scrollHeight);
1688
- });
1689
- return k.observe(y.current), () => {
1690
- k.disconnect();
1691
- };
1692
- }, [l]);
1693
- const S = `collapsible-content-${Math.random().toString(36).substr(2, 9)}`;
1694
- return /* @__PURE__ */ a.jsxs("div", R(N({ className: b }, p), { children: [
1695
- /* @__PURE__ */ a.jsx(
1696
- "button",
1697
- {
1698
- type: "button",
1699
- onClick: f,
1700
- onKeyDown: (k) => {
1701
- (k.key === "Enter" || k.key === " ") && (k.preventDefault(), i || f());
1702
- },
1703
- disabled: i,
1704
- "aria-expanded": l,
1705
- "aria-controls": S,
1706
- "aria-disabled": i,
1707
- className: e(
1708
- "w-full",
1709
- "text-left",
1710
- "focus:outline-none",
1711
- "focus:ring-2",
1712
- "focus:ring-line-brand",
1713
- "focus:ring-offset-2",
1714
- z("md")
1715
- ),
1716
- children: s
1717
- }
1718
- ),
1719
- /* @__PURE__ */ a.jsx(
1720
- "div",
1721
- {
1722
- id: S,
1723
- ref: y,
1724
- style: {
1725
- height: typeof h == "number" ? `${h}px` : h,
1726
- overflow: "hidden",
1727
- transition: `height ${n}ms ease-in-out`
1728
- },
1729
- "aria-hidden": !l,
1730
- children: /* @__PURE__ */ a.jsx("div", { children: m })
1731
- }
1732
- )
1733
- ] }));
1734
- }
1735
- const Qe = U(
1736
- O(function(x, p) {
1737
- var g = x, {
1738
- id: s,
1739
- label: t,
1740
- error: r = !1,
1741
- helperText: o,
1742
- className: i = "",
1743
- disabled: n = !1,
1744
- indeterminate: c = !1
1745
- } = g, b = C(g, [
1746
- "id",
1747
- "label",
1748
- "error",
1749
- "helperText",
1750
- "className",
1751
- "disabled",
1752
- "indeterminate"
1753
- ]);
1754
- const l = d(
1755
- () => s || `checkbox-${Math.random().toString(36).substr(2, 9)}`,
1756
- [s]
1757
- ), f = d(
1758
- () => r ? `${l}-error` : void 0,
1759
- [r, l]
1760
- ), y = d(
1761
- () => o ? `${l}-helper` : void 0,
1762
- [o, l]
1763
- ), h = d(() => "focus:border-line-focus", []), j = d(() => "focus:border-error", []), S = d(
1764
- () => r ? j.replace("focus:border-", "focus:ring-") : h.replace("focus:border-", "focus:ring-"),
1765
- [r, j, h]
1766
- ), k = d(
1767
- () => e(
1768
- "h-4",
1769
- "w-4",
1770
- z("sm"),
1771
- "border",
1772
- "border-line-default",
1773
- "text-fg-brand",
1774
- "focus:ring-2",
1775
- S,
1776
- "focus:ring-offset-2",
1777
- "disabled:opacity-50",
1778
- "disabled:cursor-not-allowed",
1779
- "cursor-pointer",
1780
- r && "border-error",
1781
- i
1782
- ),
1783
- [S, r, i]
1784
- ), L = d(
1785
- () => e(
1786
- T("label"),
1787
- u("sm", "ml"),
1788
- n ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1789
- ),
1790
- [n]
1791
- ), A = te(null), v = _(
1792
- (F) => {
1793
- A.current = F, typeof p == "function" ? p(F) : p && (p.current = F), F && (F.indeterminate = c);
1794
- },
1795
- [p, c]
1796
- );
1797
- return ae(() => {
1798
- A.current && (A.current.indeterminate = c);
1799
- }, [c]), /* @__PURE__ */ a.jsxs("div", { className: e("flex", "flex-col", u("sm", "my")), children: [
1800
- /* @__PURE__ */ a.jsxs("div", { className: "flex items-center", children: [
1801
- /* @__PURE__ */ a.jsx(
1802
- "input",
1803
- N({
1804
- type: "checkbox",
1805
- id: l,
1806
- ref: v,
1807
- className: k,
1808
- disabled: n,
1809
- "aria-invalid": r,
1810
- "aria-describedby": f || y || void 0,
1811
- "aria-label": t ? void 0 : "Checkbox"
1812
- }, b)
1813
- ),
1814
- t && /* @__PURE__ */ a.jsx("label", { htmlFor: l, className: L, children: t })
1815
- ] }),
1816
- (r || o) && /* @__PURE__ */ a.jsx(
1817
- "div",
1818
- {
1819
- id: f || y,
1820
- className: e(
1821
- u("xs", "mt"),
1822
- T("caption"),
1823
- r ? "text-fg-error" : "text-fg-secondary"
1824
- ),
1825
- role: r ? "alert" : void 0,
1826
- children: r ? o || "This field has an error" : o
1827
- }
1828
- )
1829
- ] });
1830
- })
1831
- );
1832
- Qe.displayName = "Checkbox";
1833
- const Ye = U(
1834
- O(function(p, b) {
1835
- var x = p, {
1836
- id: s,
1837
- label: t,
1838
- error: r = !1,
1839
- helperText: o,
1840
- className: i = "",
1841
- disabled: n = !1
1842
- } = x, c = C(x, [
1843
- "id",
1844
- "label",
1845
- "error",
1846
- "helperText",
1847
- "className",
1848
- "disabled"
1849
- ]);
1850
- const g = d(
1851
- () => s || `radio-${Math.random().toString(36).substr(2, 9)}`,
1852
- [s]
1853
- ), l = d(
1854
- () => r ? `${g}-error` : void 0,
1855
- [r, g]
1856
- ), f = d(
1857
- () => o ? `${g}-helper` : void 0,
1858
- [o, g]
1859
- ), y = d(() => "focus:border-line-focus", []), h = d(() => "focus:border-error", []), j = d(
1860
- () => r ? h.replace("focus:border-", "focus:ring-") : y.replace("focus:border-", "focus:ring-"),
1861
- [r, h, y]
1862
- ), S = d(
1863
- () => e(
1864
- "h-4",
1865
- "w-4",
1866
- "border",
1867
- "border-line-default",
1868
- "text-fg-brand",
1869
- "focus:ring-2",
1870
- j,
1871
- "focus:ring-offset-2",
1872
- "disabled:opacity-50",
1873
- "disabled:cursor-not-allowed",
1874
- "cursor-pointer",
1875
- r && "border-error",
1876
- i
1877
- ),
1878
- [j, r, i]
1879
- ), k = d(
1880
- () => e(
1881
- T("label"),
1882
- u("sm", "ml"),
1883
- n ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1884
- ),
1885
- [n]
1886
- );
1887
- return /* @__PURE__ */ a.jsxs("div", { className: e("flex", "flex-col", u("sm", "my")), children: [
1888
- /* @__PURE__ */ a.jsxs("div", { className: "flex items-center", children: [
1889
- /* @__PURE__ */ a.jsx(
1890
- "input",
1891
- N({
1892
- type: "radio",
1893
- id: g,
1894
- ref: b,
1895
- className: S,
1896
- disabled: n,
1897
- "aria-invalid": r,
1898
- "aria-describedby": l || f || void 0,
1899
- "aria-label": t ? void 0 : "Radio button"
1900
- }, c)
1901
- ),
1902
- t && /* @__PURE__ */ a.jsx("label", { htmlFor: g, className: k, children: t })
1903
- ] }),
1904
- (r || o) && /* @__PURE__ */ a.jsx(
1905
- "div",
1906
- {
1907
- id: l || f,
1908
- className: e(
1909
- u("xs", "mt"),
1910
- T("caption"),
1911
- r ? "text-fg-error" : "text-fg-secondary"
1912
- ),
1913
- role: r ? "alert" : void 0,
1914
- children: r ? o || "This field has an error" : o
1915
- }
1916
- )
1917
- ] });
1918
- })
1919
- );
1920
- Ye.displayName = "Radio";
1921
- const Ge = H("w-full", {
1922
- variants: {
1923
- size: {
1924
- sm: "h-1",
1925
- md: "h-2",
1926
- lg: "h-3"
1927
- },
1928
- variant: {
1929
- primary: "bg-surface-muted",
1930
- secondary: "bg-surface-muted",
1931
- success: "bg-success-bg-emphasis",
1932
- error: "bg-error-bg-emphasis",
1933
- warning: "bg-warning-bg-emphasis",
1934
- info: "bg-info-bg-emphasis"
1935
- }
1936
- },
1937
- defaultVariants: {
1938
- size: "md",
1939
- variant: "primary"
1940
- }
1941
- }), ve = H("transition-all", {
1942
- variants: {
1943
- variant: {
1944
- primary: "bg-surface-brand",
1945
- secondary: "bg-surface-secondary",
1946
- success: "bg-success",
1947
- error: "bg-error",
1948
- warning: "bg-warning",
1949
- info: "bg-info"
1950
- }
1951
- },
1952
- defaultVariants: {
1953
- variant: "primary"
1954
- }
1955
- }), Ke = O(function(g, x) {
1956
- var l = g, {
1957
- value: s,
1958
- max: t = 100,
1959
- variant: r = "primary",
1960
- size: o = "md",
1961
- showLabel: i = !1,
1962
- label: n,
1963
- "aria-label": c,
1964
- className: b = ""
1965
- } = l, p = C(l, [
1966
- "value",
1967
- "max",
1968
- "variant",
1969
- "size",
1970
- "showLabel",
1971
- "label",
1972
- "aria-label",
1973
- "className"
1974
- ]);
1975
- const f = s === void 0, y = f ? void 0 : Math.min(Math.max(s / t * 100, 0), 100), h = c || (f ? "Loading in progress" : `Progress: ${y == null ? void 0 : y.toFixed(0)}%`);
1976
- return /* @__PURE__ */ a.jsxs("div", R(N({ ref: x, className: e("w-full", b) }, p), { children: [
1977
- i && (n || !f) && /* @__PURE__ */ a.jsxs(
1978
- "div",
1979
- {
1980
- className: e(
1981
- "flex",
1982
- "items-center",
1983
- "justify-between",
1984
- u("xs", "mb")
1985
- ),
1986
- children: [
1987
- n && /* @__PURE__ */ a.jsx(
1988
- "span",
1989
- {
1990
- className: e(
1991
- E("bodySmall"),
1992
- ie("label"),
1993
- "text-fg-primary"
1994
- ),
1995
- children: n
1996
- }
1997
- ),
1998
- !f && y !== void 0 && /* @__PURE__ */ a.jsxs(
1999
- "span",
2000
- {
2001
- className: e(
2002
- E("bodySmall"),
2003
- "text-fg-secondary"
2004
- ),
2005
- children: [
2006
- y.toFixed(0),
2007
- "%"
2008
- ]
2009
- }
2010
- )
2011
- ]
2012
- }
2013
- ),
2014
- /* @__PURE__ */ a.jsx(
2015
- "div",
2016
- {
2017
- role: "progressbar",
2018
- "aria-valuemin": f ? void 0 : 0,
2019
- "aria-valuemax": f ? void 0 : t,
2020
- "aria-valuenow": f ? void 0 : s,
2021
- "aria-label": h,
2022
- "aria-busy": f,
2023
- className: e(
2024
- "relative",
2025
- "w-full",
2026
- "overflow-hidden",
2027
- Ge({ size: o, variant: r }),
2028
- z("full")
2029
- ),
2030
- children: f ? /* @__PURE__ */ a.jsx(
2031
- "div",
2032
- {
2033
- className: e(
2034
- "absolute",
2035
- "top-0",
2036
- "left-0",
2037
- "bottom-0",
2038
- ve({ variant: r }),
2039
- z("full"),
2040
- "motion-reduce:animate-none"
2041
- ),
2042
- style: {
2043
- width: "30%",
2044
- animation: "progress-indeterminate 1.5s ease-in-out infinite"
2045
- }
2046
- }
2047
- ) : /* @__PURE__ */ a.jsx(
2048
- "div",
2049
- {
2050
- className: e(
2051
- "h-full",
2052
- ve({ variant: r }),
2053
- z("full"),
2054
- "transition-all",
2055
- "duration-300",
2056
- "ease-out"
2057
- ),
2058
- style: {
2059
- width: `${y}%`
2060
- },
2061
- "aria-hidden": "true"
2062
- }
2063
- )
2064
- }
2065
- )
2066
- ] }));
2067
- });
2068
- Ke.displayName = "Progress";
2069
- const er = U(
2070
- O(function(l, g) {
2071
- var f = l, {
2072
- size: s = "md",
2073
- label: t,
2074
- description: r,
2075
- error: o = !1,
2076
- className: i = "",
2077
- disabled: n = !1,
2078
- checked: c,
2079
- onChange: b,
2080
- id: p
2081
- } = f, x = C(f, [
2082
- "size",
2083
- "label",
2084
- "description",
2085
- "error",
2086
- "className",
2087
- "disabled",
2088
- "checked",
2089
- "onChange",
2090
- "id"
2091
- ]);
2092
- const y = d(
2093
- () => p || `switch-${Math.random().toString(36).substr(2, 9)}`,
2094
- [p]
2095
- ), h = d(
2096
- () => t ? `${y}-label` : void 0,
2097
- [t, y]
2098
- ), j = d(
2099
- () => r ? `${y}-description` : void 0,
2100
- [r, y]
2101
- ), S = d(() => Fe(s), [s]), k = d(
2102
- () => "focus:border-line-focus".replace("focus:border-", "focus:ring-"),
2103
- []
2104
- ), L = d(
2105
- () => e(
2106
- "relative",
2107
- "inline-flex",
2108
- "shrink-0",
2109
- "cursor-pointer",
2110
- "rounded-full",
2111
- "border-2",
2112
- "border-transparent",
2113
- fe("base"),
2114
- "focus:outline-none",
2115
- "focus:ring-2",
2116
- k,
2117
- "focus:ring-offset-2",
2118
- S.track,
2119
- c ? "bg-surface-brand" : "bg-surface-muted",
2120
- o && !c && "border-error",
2121
- n && "opacity-50 cursor-not-allowed",
2122
- i
2123
- ),
2124
- [k, S.track, c, o, n, i]
2125
- ), A = d(
2126
- () => e(
2127
- "pointer-events-none",
2128
- "inline-block",
2129
- "rounded-full",
2130
- "bg-surface-base",
2131
- "shadow",
2132
- "transform",
2133
- fe("base"),
2134
- S.thumb,
2135
- c ? S.translate : "translate-x-0"
2136
- ),
2137
- [S.thumb, S.translate, c]
2138
- );
2139
- return /* @__PURE__ */ a.jsxs("div", { className: e("flex", "items-start", u("md", "gap")), children: [
2140
- /* @__PURE__ */ a.jsxs("div", { className: "flex items-center", children: [
2141
- /* @__PURE__ */ a.jsx(
2142
- "button",
2143
- {
2144
- type: "button",
2145
- className: L,
2146
- role: "switch",
2147
- "aria-checked": c,
2148
- "aria-labelledby": h,
2149
- "aria-describedby": j,
2150
- disabled: n,
2151
- onClick: _(
2152
- (v) => {
2153
- if (!n && b) {
2154
- const F = R(N({}, v), {
2155
- target: R(N({}, v.target), { checked: !c }),
2156
- currentTarget: R(N({}, v.currentTarget), { checked: !c })
2157
- });
2158
- b(F);
2159
- }
2160
- },
2161
- [n, b, c]
2162
- ),
2163
- onKeyDown: _(
2164
- (v) => {
2165
- if ((v.key === "Enter" || v.key === " ") && !n && b) {
2166
- v.preventDefault();
2167
- const F = R(N({}, v), {
2168
- target: R(N({}, v.target), { checked: !c }),
2169
- currentTarget: R(N({}, v.currentTarget), { checked: !c })
2170
- });
2171
- b(F);
2172
- }
2173
- },
2174
- [n, b, c]
2175
- ),
2176
- children: /* @__PURE__ */ a.jsx("span", { className: A })
2177
- }
2178
- ),
2179
- /* @__PURE__ */ a.jsx(
2180
- "input",
2181
- N({
2182
- ref: g,
2183
- type: "checkbox",
2184
- id: y,
2185
- checked: c,
2186
- onChange: b,
2187
- disabled: n,
2188
- className: "sr-only",
2189
- "aria-hidden": "true"
2190
- }, x)
2191
- )
2192
- ] }),
2193
- (t || r) && /* @__PURE__ */ a.jsxs("div", { className: "flex-1", children: [
2194
- t && /* @__PURE__ */ a.jsx(
2195
- "label",
2196
- {
2197
- id: h,
2198
- htmlFor: y,
2199
- className: e(
2200
- "block",
2201
- E("bodySmall"),
2202
- ie("label"),
2203
- o ? "text-fg-error" : "text-fg-primary",
2204
- n ? "opacity-50" : "cursor-pointer"
2205
- ),
2206
- children: t
2207
- }
2208
- ),
2209
- r && /* @__PURE__ */ a.jsx(
2210
- "p",
2211
- {
2212
- id: j,
2213
- className: e(
2214
- u("xs", "mt"),
2215
- E("bodySmall"),
2216
- o ? "text-fg-error" : "text-fg-secondary"
2217
- ),
2218
- children: r
2219
- }
2220
- )
2221
- ] })
2222
- ] });
2223
- })
2224
- );
2225
- er.displayName = "Switch";
2226
- const rr = U(function(i) {
2227
- var n = i, {
2228
- orientation: s = "horizontal",
2229
- variant: t = "solid",
2230
- className: r = ""
2231
- } = n, o = C(n, [
2232
- "orientation",
2233
- "variant",
2234
- "className"
2235
- ]);
2236
- const c = d(() => {
2237
- const b = ["border-0", "border-line-default"], p = {
2238
- horizontal: "w-full border-t",
2239
- vertical: "h-full border-l self-stretch"
2240
- }, x = {
2241
- solid: "border-solid",
2242
- dashed: "border-dashed",
2243
- dotted: "border-dotted"
2244
- };
2245
- return e(
2246
- ...b,
2247
- p[s],
2248
- x[t],
2249
- r
2250
- );
2251
- }, [s, t, r]);
2252
- return s === "vertical" ? /* @__PURE__ */ a.jsx(
2253
- "div",
2254
- N({
2255
- className: c,
2256
- role: "separator",
2257
- "aria-orientation": "vertical"
2258
- }, o)
2259
- ) : /* @__PURE__ */ a.jsx(
2260
- "hr",
2261
- N({
2262
- className: c,
2263
- role: "separator",
2264
- "aria-orientation": "horizontal"
2265
- }, o)
2266
- );
2267
- });
2268
- rr.displayName = "Separator";
2269
- const sr = O(function(S, j) {
2270
- var k = S, {
2271
- value: s,
2272
- defaultValue: t,
2273
- min: r = 0,
2274
- max: o = 100,
2275
- step: i = 1,
2276
- variant: n = "single",
2277
- size: c = "md",
2278
- disabled: b = !1,
2279
- showValue: p = !1,
2280
- marks: x = [],
2281
- onChange: g,
2282
- onValueChange: l,
2283
- label: f,
2284
- className: y = ""
2285
- } = k, h = C(k, [
2286
- "value",
2287
- "defaultValue",
2288
- "min",
2289
- "max",
2290
- "step",
2291
- "variant",
2292
- "size",
2293
- "disabled",
2294
- "showValue",
2295
- "marks",
2296
- "onChange",
2297
- "onValueChange",
2298
- "label",
2299
- "className"
2300
- ]);
2301
- const L = te(null), [A, v] = Y(
2302
- t || (n === "range" ? [r, o] : r)
2303
- ), [F, W] = Y(!1), [P, Z] = Y(null), V = s !== void 0, w = V ? s : A, B = (I) => (I - r) / (o - r) * 100, $ = (I) => {
2304
- if (!L.current) return r;
2305
- const q = L.current.getBoundingClientRect(), D = Math.max(
2306
- 0,
2307
- Math.min(1, (I - q.left) / q.width)
2308
- ), J = r + D * (o - r);
2309
- return Math.round(J / i) * i;
2310
- }, M = (I, q = "min") => {
2311
- if (b) return;
2312
- I.preventDefault(), W(!0), Z(q);
2313
- const D = (G) => {
2314
- if (!L.current) return;
2315
- const X = $(G.clientX);
2316
- ne(X, q);
2317
- }, J = () => {
2318
- W(!1), Z(null), document.removeEventListener("mousemove", D), document.removeEventListener("mouseup", J);
2319
- };
2320
- document.addEventListener("mousemove", D), document.addEventListener("mouseup", J);
2321
- }, ne = (I, q = "min") => {
2322
- const D = Math.max(r, Math.min(o, I));
2323
- if (n === "range") {
2324
- const [J, G] = Array.isArray(w) ? w : [r, o];
2325
- let X;
2326
- q === "min" ? X = [Math.min(D, G), G] : X = [J, Math.max(D, J)], V || v(X), g == null || g(X), l == null || l(X);
2327
- } else
2328
- V || v(D), g == null || g(D), l == null || l(D);
2329
- }, le = (I) => {
2330
- if (b || F) return;
2331
- const q = $(I.clientX);
2332
- ne(q);
2333
- }, ce = () => "focus:ring-line-brand ring-offset-2", de = H(e("relative", "cursor-pointer"), {
2334
- variants: {
2335
- size: {
2336
- sm: "h-1",
2337
- md: "h-2",
2338
- lg: "h-3"
2339
- },
2340
- disabled: {
2341
- true: "opacity-50 cursor-not-allowed",
2342
- false: ""
2343
- }
2344
- },
2345
- defaultVariants: {
2346
- size: "md",
2347
- disabled: !1
2348
- }
2349
- }), re = H(
2350
- e(
2351
- "absolute",
2352
- "bg-surface-brand",
2353
- "rounded-full",
2354
- "border-2",
2355
- "border-white",
2356
- "shadow-md",
2357
- "cursor-grab",
2358
- "active:cursor-grabbing",
2359
- fe("base"),
2360
- "-translate-x-1/2",
2361
- "-translate-y-1/2",
2362
- "top-1/2"
2363
- ),
2364
- {
2365
- variants: {
2366
- size: {
2367
- sm: "w-3 h-3",
2368
- md: "w-4 h-4",
2369
- lg: "w-5 h-5"
2370
- },
2371
- active: {
2372
- true: ce(),
2373
- false: ""
2374
- }
2375
- },
2376
- defaultVariants: {
2377
- size: "md",
2378
- active: !1
2379
- }
2380
- }
2381
- ), se = typeof w == "number" ? w : w[0], K = Array.isArray(w) ? w[0] : r, ee = Array.isArray(w) ? w[1] : se, Q = B(K), oe = B(ee);
2382
- return /* @__PURE__ */ a.jsxs("div", R(N({ ref: j, className: e("w-full", y) }, h), { children: [
2383
- f && /* @__PURE__ */ a.jsxs(
2384
- "label",
2385
- {
2386
- className: e(
2387
- "block",
2388
- E("bodySmall"),
2389
- ie("label"),
2390
- "text-fg-primary",
2391
- u("sm", "mb")
2392
- ),
2393
- children: [
2394
- f,
2395
- p && /* @__PURE__ */ a.jsx(
2396
- "span",
2397
- {
2398
- className: e(u("sm", "ml"), "text-fg-secondary"),
2399
- children: n === "range" ? `${K} - ${ee}` : se
2400
- }
2401
- )
2402
- ]
2403
- }
2404
- ),
2405
- /* @__PURE__ */ a.jsxs(
2406
- "div",
2407
- {
2408
- ref: L,
2409
- className: e(
2410
- de({ size: c, disabled: b }),
2411
- "bg-surface-muted",
2412
- z("full")
2413
- ),
2414
- onClick: le,
2415
- role: n === "range" ? void 0 : "slider",
2416
- "aria-valuemin": n === "range" ? void 0 : r,
2417
- "aria-valuemax": n === "range" ? void 0 : o,
2418
- "aria-valuenow": n === "range" ? void 0 : se,
2419
- "aria-disabled": n === "range" ? void 0 : b,
2420
- "aria-label": n === "range" ? void 0 : f,
2421
- children: [
2422
- /* @__PURE__ */ a.jsx(
2423
- "div",
2424
- {
2425
- className: e(
2426
- "absolute",
2427
- de({ size: c }),
2428
- "bg-surface-brand",
2429
- z("full"),
2430
- fe("base")
2431
- ),
2432
- style: {
2433
- left: `${Q}%`,
2434
- width: `${oe - Q}%`
2435
- }
2436
- }
2437
- ),
2438
- x.map((I) => {
2439
- const q = B(I);
2440
- return /* @__PURE__ */ a.jsx(
2441
- "div",
2442
- {
2443
- className: e(
2444
- "absolute",
2445
- "w-1",
2446
- "h-1",
2447
- "bg-line-strong",
2448
- z("full"),
2449
- "-translate-x-1/2"
2450
- ),
2451
- style: {
2452
- left: `${q}%`,
2453
- top: "50%",
2454
- transform: "translate(-50%, -50%)"
2455
- }
2456
- },
2457
- I
2458
- );
2459
- }),
2460
- n === "range" ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
2461
- /* @__PURE__ */ a.jsx(
2462
- "div",
2463
- {
2464
- className: e(
2465
- re({ size: c, active: P === "min" })
2466
- ),
2467
- style: { left: `${Q}%` },
2468
- onMouseDown: (I) => M(I, "min"),
2469
- role: "slider",
2470
- "aria-valuemin": r,
2471
- "aria-valuemax": ee,
2472
- "aria-valuenow": K
2473
- }
2474
- ),
2475
- /* @__PURE__ */ a.jsx(
2476
- "div",
2477
- {
2478
- className: e(
2479
- re({ size: c, active: P === "max" })
2480
- ),
2481
- style: { left: `${oe}%` },
2482
- onMouseDown: (I) => M(I, "max"),
2483
- role: "slider",
2484
- "aria-valuemin": K,
2485
- "aria-valuemax": o,
2486
- "aria-valuenow": ee
2487
- }
2488
- )
2489
- ] }) : /* @__PURE__ */ a.jsx(
2490
- "div",
2491
- {
2492
- className: e(re({ size: c, active: F })),
2493
- style: { left: `${oe}%` },
2494
- onMouseDown: (I) => M(I)
2495
- }
2496
- ),
2497
- p && !f && /* @__PURE__ */ a.jsx("div", { className: "absolute -top-6 left-0 right-0 flex justify-center", children: /* @__PURE__ */ a.jsx(
2498
- "span",
2499
- {
2500
- className: e(
2501
- E("caption"),
2502
- "text-fg-secondary",
2503
- "bg-surface-overlay",
2504
- u("sm", "px"),
2505
- u("xs", "py"),
2506
- z("md"),
2507
- "shadow"
2508
- ),
2509
- children: n === "range" ? `${K} - ${ee}` : se
2510
- }
2511
- ) })
2512
- ]
2513
- }
2514
- )
2515
- ] }));
2516
- });
2517
- sr.displayName = "Slider";
2518
- const tr = H(
2519
- // Base classes
2520
- e(
2521
- "inline-flex",
2522
- "items-center",
2523
- "font-medium",
2524
- z("full"),
2525
- u("xs", "gap")
2526
- ),
2527
- {
2528
- variants: {
2529
- variant: {
2530
- default: e(
2531
- "bg-surface-muted",
2532
- "text-fg-primary",
2533
- "border",
2534
- "border-line-default"
2535
- ),
2536
- outlined: e(
2537
- "bg-transparent",
2538
- "text-fg-primary",
2539
- "border",
2540
- "border-line-default"
2541
- ),
2542
- filled: e(
2543
- "bg-surface-brand",
2544
- "text-fg-inverse",
2545
- "border",
2546
- "border-transparent"
2547
- )
2548
- },
2549
- size: {
2550
- sm: e(
2551
- u("xs", "px"),
2552
- u("xs", "py"),
2553
- E("caption")
2554
- ),
2555
- md: e(
2556
- u("sm", "px"),
2557
- u("xs", "py"),
2558
- E("bodySmall")
2559
- ),
2560
- lg: e(
2561
- u("md", "px"),
2562
- u("sm", "py"),
2563
- E("body")
2564
- )
2565
- },
2566
- selected: {
2567
- true: e(
2568
- "bg-surface-brand",
2569
- "text-fg-inverse",
2570
- "border",
2571
- "border-line-brand"
2572
- ),
2573
- false: ""
2574
- },
2575
- disabled: {
2576
- true: "opacity-50 cursor-not-allowed",
2577
- false: ""
2578
- }
2579
- },
2580
- compoundVariants: [
2581
- {
2582
- selected: !0,
2583
- variant: "default",
2584
- class: ""
2585
- // Override variant when selected
2586
- },
2587
- {
2588
- selected: !0,
2589
- variant: "outlined",
2590
- class: ""
2591
- // Override variant when selected
2592
- },
2593
- {
2594
- selected: !0,
2595
- variant: "filled",
2596
- class: ""
2597
- // Override variant when selected
2598
- }
2599
- ],
2600
- defaultVariants: {
2601
- variant: "default",
2602
- size: "md",
2603
- selected: !1,
2604
- disabled: !1
2605
- }
2606
- }
2607
- ), ar = O(function(f, l) {
2608
- var y = f, {
2609
- children: s,
2610
- variant: t = "default",
2611
- size: r = "md",
2612
- onRemove: o,
2613
- selected: i = !1,
2614
- disabled: n = !1,
2615
- className: c = "",
2616
- "aria-label": b,
2617
- onClick: p,
2618
- tabIndex: x
2619
- } = y, g = C(y, [
2620
- "children",
2621
- "variant",
2622
- "size",
2623
- "onRemove",
2624
- "selected",
2625
- "disabled",
2626
- "className",
2627
- "aria-label",
2628
- "onClick",
2629
- "tabIndex"
2630
- ]);
2631
- const h = p !== void 0 || i !== !1 && i !== void 0, j = i ? "option" : h ? "button" : void 0, k = (() => {
2632
- if (b) return b;
2633
- if (typeof s == "string") return s;
2634
- if (typeof s == "object" && s !== null && "props" in s) {
2635
- const v = s.props;
2636
- if (v != null && v.children && typeof v.children == "string")
2637
- return v.children;
2638
- }
2639
- })(), L = j === "button" && !k, A = (v) => {
2640
- n || (v.key === "Enter" || v.key === " ") && (v.preventDefault(), p && p());
2641
- };
2642
- return /* @__PURE__ */ a.jsxs(
2643
- "div",
2644
- R(N({
2645
- ref: l,
2646
- className: e(
2647
- tr({ variant: t, size: r, selected: i, disabled: n }),
2648
- o && u("xs", "pr"),
2649
- h && !n && "cursor-pointer focus:outline-none focus:ring-2 focus:ring-line-focus focus:ring-offset-2",
2650
- c
2651
- ),
2652
- role: j,
2653
- "aria-selected": i ? !0 : void 0,
2654
- "aria-disabled": n,
2655
- "aria-label": L ? "Chip" : b || (j === "button" ? k : void 0),
2656
- tabIndex: x !== void 0 ? x : h && !n ? 0 : void 0,
2657
- onClick: n ? void 0 : p,
2658
- onKeyDown: A
2659
- }, g), {
2660
- children: [
2661
- /* @__PURE__ */ a.jsx("span", { children: s }),
2662
- o && !n && /* @__PURE__ */ a.jsx(
2663
- "button",
2664
- {
2665
- type: "button",
2666
- onClick: (v) => {
2667
- v.stopPropagation(), o();
2668
- },
2669
- className: e(
2670
- u("xs", "ml"),
2671
- "hover:bg-tint-hover",
2672
- z("full"),
2673
- u("xs", "p"),
2674
- "transition-colors",
2675
- "focus:outline-none",
2676
- "focus:ring-2",
2677
- "focus:ring-line-focus",
2678
- "focus:ring-offset-1"
2679
- ),
2680
- "aria-label": `Remove ${k || "chip"}`,
2681
- children: /* @__PURE__ */ a.jsx(he, { className: "h-3 w-3", "aria-hidden": "true" })
2682
- }
2683
- )
2684
- ]
2685
- })
2686
- );
2687
- });
2688
- ar.displayName = "Chip";
2689
- const be = O(function(x, p) {
2690
- var g = x, {
2691
- src: s,
2692
- alt: t,
2693
- fallback: r,
2694
- size: o = "md",
2695
- variant: i = "circle",
2696
- "aria-label": n,
2697
- className: c = ""
2698
- } = g, b = C(g, [
2699
- "src",
2700
- "alt",
2701
- "fallback",
2702
- "size",
2703
- "variant",
2704
- "aria-label",
2705
- "className"
2706
- ]);
2707
- const [l, f] = Y(!1), [y, h] = Y(!1), j = {
2708
- xs: "h-6 w-6 text-xs",
2709
- sm: "h-8 w-8 text-sm",
2710
- md: "h-10 w-10 text-base",
2711
- lg: "h-12 w-12 text-lg",
2712
- xl: "h-16 w-16 text-xl"
2713
- }, S = {
2714
- circle: "rounded-full",
2715
- square: "rounded-none",
2716
- rounded: "rounded-md"
2717
- }, k = !s || l, L = typeof r == "string" ? r.toUpperCase().slice(0, 2) : r, A = n || t || "User avatar";
2718
- return /* @__PURE__ */ a.jsxs(
2719
- "div",
2720
- R(N({
2721
- ref: p,
2722
- className: e(
2723
- "relative",
2724
- "inline-flex",
2725
- "items-center",
2726
- "justify-center",
2727
- "shrink-0",
2728
- "font-medium",
2729
- "overflow-hidden",
2730
- j[o],
2731
- S[i],
2732
- "bg-surface-muted",
2733
- "text-fg-primary",
2734
- c
2735
- ),
2736
- role: "img",
2737
- "aria-label": A
2738
- }, b), {
2739
- children: [
2740
- !k && s && /* @__PURE__ */ a.jsx(
2741
- "img",
2742
- {
2743
- src: s,
2744
- alt: t || "",
2745
- className: e(
2746
- "w-full",
2747
- "h-full",
2748
- "object-cover",
2749
- i === "circle" ? "rounded-full" : i === "square" ? "rounded-none" : "rounded-md",
2750
- y ? "opacity-100" : "opacity-0",
2751
- "transition-opacity",
2752
- "duration-200"
2753
- ),
2754
- onLoad: () => h(!0),
2755
- onError: () => {
2756
- f(!0), h(!1);
2757
- },
2758
- "aria-hidden": "true"
2759
- }
2760
- ),
2761
- k && /* @__PURE__ */ a.jsx(
2762
- "span",
2763
- {
2764
- className: e(
2765
- "flex",
2766
- "items-center",
2767
- "justify-center",
2768
- "w-full",
2769
- "h-full",
2770
- i === "circle" ? "rounded-full" : i === "square" ? "rounded-none" : "rounded-md"
2771
- ),
2772
- "aria-hidden": "true",
2773
- children: L || "?"
2774
- }
2775
- )
2776
- ]
2777
- })
2778
- );
2779
- });
2780
- be.displayName = "Avatar";
2781
- function pr(c) {
2782
- var b = c, {
2783
- children: m,
2784
- max: s = 3,
2785
- size: t = "md",
2786
- variant: r = "circle",
2787
- spacing: o = "md",
2788
- className: i = ""
2789
- } = b, n = C(b, [
2790
- "children",
2791
- "max",
2792
- "size",
2793
- "variant",
2794
- "spacing",
2795
- "className"
2796
- ]);
2797
- const p = {
2798
- none: "",
2799
- sm: "-space-x-1",
2800
- md: "-space-x-2",
2801
- lg: "-space-x-3"
2802
- }, x = Me.toArray(m).filter(Boolean), g = x.slice(0, s), l = x.length - s;
2803
- return /* @__PURE__ */ a.jsxs(
2804
- "div",
2805
- R(N({
2806
- className: e("flex", "items-center", p[o], i),
2807
- role: "group",
2808
- "aria-label": `${x.length} avatars`
2809
- }, n), {
2810
- children: [
2811
- g.map((f, y) => {
2812
- let h = f;
2813
- if (we(f) && f.type === be) {
2814
- const j = f.props;
2815
- h = je(
2816
- f,
2817
- {
2818
- size: j.size || t,
2819
- variant: j.variant || r
2820
- }
2821
- );
2822
- }
2823
- return /* @__PURE__ */ a.jsx(
2824
- "div",
2825
- {
2826
- className: "ring-2 ring-surface-base",
2827
- style: { zIndex: x.length - y },
2828
- children: h
2829
- },
2830
- y
2831
- );
2832
- }),
2833
- l > 0 && /* @__PURE__ */ a.jsx(
2834
- be,
2835
- {
2836
- size: t,
2837
- variant: r,
2838
- fallback: `+${l}`,
2839
- "aria-label": `${l} more avatars`,
2840
- className: "ring-2 ring-surface-base",
2841
- style: { zIndex: 0 }
2842
- }
2843
- )
2844
- ]
2845
- })
2846
- );
2847
- }
2848
- export {
2849
- be as Avatar,
2850
- pr as AvatarGroup,
2851
- Ue as Badge,
2852
- me as Button,
2853
- Qe as Checkbox,
2854
- ar as Chip,
2855
- gr as Collapsible,
2856
- fr as ErrorMessage,
2857
- cr as Info,
2858
- Be as Input,
2859
- Ze as Label,
2860
- ur as NavLink,
2861
- Ke as Progress,
2862
- Ye as Radio,
2863
- We as Select,
2864
- rr as Separator,
2865
- br as Skeleton,
2866
- sr as Slider,
2867
- Ne as Spinner,
2868
- er as Switch,
2869
- dr as Text,
2870
- Xe as Textarea,
2871
- mr as Tooltip,
2872
- Oe as useNavLink
2873
- };
2874
- //# sourceMappingURL=index.js.map