@dev-dga/react 0.4.0 → 0.6.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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/components/Button/Button.tsx
2
2
  import "react";
3
3
  import { Slot as SlotPrimitive } from "radix-ui";
4
- import { cva } from "class-variance-authority";
4
+ import { cva as cva2 } from "class-variance-authority";
5
5
 
6
6
  // src/utils/cn.ts
7
7
  import { clsx } from "clsx";
@@ -9,151 +9,20 @@ function cn(...inputs) {
9
9
  return clsx(inputs);
10
10
  }
11
11
 
12
- // src/internal/icons/index.tsx
13
- import { jsx, jsxs } from "react/jsx-runtime";
14
- function Spinner(props) {
15
- return /* @__PURE__ */ jsx(
16
- "svg",
17
- {
18
- xmlns: "http://www.w3.org/2000/svg",
19
- width: "1em",
20
- height: "1em",
21
- viewBox: "0 0 24 24",
22
- fill: "none",
23
- stroke: "currentColor",
24
- strokeWidth: "2",
25
- strokeLinecap: "round",
26
- strokeLinejoin: "round",
27
- className: "ddga-spinner",
28
- ...props,
29
- children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
30
- }
31
- );
32
- }
33
- function Check(props) {
34
- return /* @__PURE__ */ jsx(
35
- "svg",
36
- {
37
- xmlns: "http://www.w3.org/2000/svg",
38
- width: "1em",
39
- height: "1em",
40
- viewBox: "0 0 24 24",
41
- fill: "none",
42
- stroke: "currentColor",
43
- strokeWidth: "3",
44
- strokeLinecap: "round",
45
- strokeLinejoin: "round",
46
- ...props,
47
- children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
48
- }
49
- );
50
- }
51
- function Minus(props) {
52
- return /* @__PURE__ */ jsx(
53
- "svg",
54
- {
55
- xmlns: "http://www.w3.org/2000/svg",
56
- width: "1em",
57
- height: "1em",
58
- viewBox: "0 0 24 24",
59
- fill: "none",
60
- stroke: "currentColor",
61
- strokeWidth: "3",
62
- strokeLinecap: "round",
63
- strokeLinejoin: "round",
64
- ...props,
65
- children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
66
- }
67
- );
68
- }
69
- function Info(props) {
70
- return /* @__PURE__ */ jsxs(
71
- "svg",
72
- {
73
- xmlns: "http://www.w3.org/2000/svg",
74
- width: "1em",
75
- height: "1em",
76
- viewBox: "0 0 24 24",
77
- fill: "none",
78
- stroke: "currentColor",
79
- strokeWidth: "2",
80
- strokeLinecap: "round",
81
- strokeLinejoin: "round",
82
- ...props,
83
- children: [
84
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
85
- /* @__PURE__ */ jsx("path", { d: "M12 16v-4" }),
86
- /* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
87
- ]
88
- }
89
- );
90
- }
91
- function AlertTriangle(props) {
92
- return /* @__PURE__ */ jsxs(
93
- "svg",
94
- {
95
- xmlns: "http://www.w3.org/2000/svg",
96
- width: "1em",
97
- height: "1em",
98
- viewBox: "0 0 24 24",
99
- fill: "none",
100
- stroke: "currentColor",
101
- strokeWidth: "2",
102
- strokeLinecap: "round",
103
- strokeLinejoin: "round",
104
- ...props,
105
- children: [
106
- /* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
107
- /* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
108
- /* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
109
- ]
110
- }
111
- );
112
- }
113
- function AlertCircle(props) {
114
- return /* @__PURE__ */ jsxs(
115
- "svg",
116
- {
117
- xmlns: "http://www.w3.org/2000/svg",
118
- width: "1em",
119
- height: "1em",
120
- viewBox: "0 0 24 24",
121
- fill: "none",
122
- stroke: "currentColor",
123
- strokeWidth: "2",
124
- strokeLinecap: "round",
125
- strokeLinejoin: "round",
126
- ...props,
127
- children: [
128
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
129
- /* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
130
- /* @__PURE__ */ jsx("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
131
- ]
132
- }
133
- );
134
- }
135
- function Close(props) {
136
- return /* @__PURE__ */ jsxs(
137
- "svg",
138
- {
139
- xmlns: "http://www.w3.org/2000/svg",
140
- width: "1em",
141
- height: "1em",
142
- viewBox: "0 0 24 24",
143
- fill: "none",
144
- stroke: "currentColor",
145
- strokeWidth: "2",
146
- strokeLinecap: "round",
147
- strokeLinejoin: "round",
148
- ...props,
149
- children: [
150
- /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
151
- /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
152
- ]
12
+ // src/components/Spinner/Spinner.tsx
13
+ import { cva } from "class-variance-authority";
14
+ import { jsx } from "react/jsx-runtime";
15
+ var spinnerVariants = cva("ddga-spinner", {
16
+ variants: {
17
+ size: {
18
+ sm: "ddga-spinner--sm",
19
+ md: "ddga-spinner--md",
20
+ lg: "ddga-spinner--lg"
153
21
  }
154
- );
155
- }
156
- function ChevronDown(props) {
22
+ }
23
+ });
24
+ function Spinner({ size, className, "aria-label": ariaLabel, ...props }) {
25
+ const hidden = props["aria-hidden"] === true || props["aria-hidden"] === "true";
157
26
  return /* @__PURE__ */ jsx(
158
27
  "svg",
159
28
  {
@@ -166,22 +35,31 @@ function ChevronDown(props) {
166
35
  strokeWidth: "2",
167
36
  strokeLinecap: "round",
168
37
  strokeLinejoin: "round",
38
+ role: hidden ? void 0 : "status",
39
+ "aria-label": hidden ? void 0 : ariaLabel ?? "Loading",
40
+ "data-slot": "spinner",
41
+ className: cn(spinnerVariants({ size }), className),
169
42
  ...props,
170
- children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
43
+ children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
171
44
  }
172
45
  );
173
46
  }
174
47
 
175
48
  // src/components/Button/Button.tsx
176
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
177
- var buttonVariants = cva("ddga-button", {
49
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
50
+ var buttonVariants = cva2("ddga-button", {
178
51
  variants: {
179
52
  variant: {
180
53
  primary: "ddga-button--primary",
181
54
  secondary: "ddga-button--secondary",
182
55
  outline: "ddga-button--outline",
183
56
  ghost: "ddga-button--ghost",
184
- destructive: "ddga-button--destructive"
57
+ destructive: "ddga-button--destructive",
58
+ // Destructive sub-variants — match the DGA library's full destructive
59
+ // family (des-primary maps to plain `destructive` above).
60
+ "destructive-outline": "ddga-button--destructive-outline",
61
+ "destructive-subtle": "ddga-button--destructive-subtle",
62
+ "destructive-ghost": "ddga-button--destructive-ghost"
185
63
  },
186
64
  size: {
187
65
  sm: "ddga-button--sm",
@@ -192,6 +70,16 @@ var buttonVariants = cva("ddga-button", {
192
70
  },
193
71
  fullWidth: {
194
72
  true: "ddga-button--full-width"
73
+ },
74
+ /**
75
+ * Use on dark / branded colored backgrounds. Visually inverts non-filled
76
+ * variants (`outline`, `ghost`, destructive's outline/ghost forms) so
77
+ * text + border stay visible against the surface. Filled variants
78
+ * (`primary`, `secondary`, `destructive`, `destructive-subtle`) ignore
79
+ * it — they already carry their own background contrast.
80
+ */
81
+ inverted: {
82
+ true: "ddga-button--inverted"
195
83
  }
196
84
  },
197
85
  compoundVariants: [],
@@ -204,6 +92,7 @@ function Button({
204
92
  variant,
205
93
  size,
206
94
  fullWidth,
95
+ inverted,
207
96
  loading,
208
97
  disabled,
209
98
  startIcon,
@@ -224,7 +113,7 @@ function Button({
224
113
  }
225
114
  const isDisabled = disabled || loading;
226
115
  const Comp = asChild ? SlotPrimitive.Slot : "button";
227
- return /* @__PURE__ */ jsxs2(
116
+ return /* @__PURE__ */ jsxs(
228
117
  Comp,
229
118
  {
230
119
  ...asChild ? {} : { type, disabled: isDisabled },
@@ -233,7 +122,7 @@ function Button({
233
122
  "aria-busy": loading || void 0,
234
123
  "data-slot": "button",
235
124
  className: cn(
236
- buttonVariants({ variant, size, fullWidth }),
125
+ buttonVariants({ variant, size, fullWidth, inverted }),
237
126
  loading && "ddga-button--loading",
238
127
  className
239
128
  ),
@@ -254,7 +143,7 @@ function Button({
254
143
  }
255
144
 
256
145
  // src/components/Input/Input.tsx
257
- import { cva as cva2 } from "class-variance-authority";
146
+ import { cva as cva3 } from "class-variance-authority";
258
147
 
259
148
  // src/field/use-field-a11y.ts
260
149
  import { useId } from "react";
@@ -307,8 +196,8 @@ function FieldMessage({ id, variant, children }) {
307
196
  }
308
197
 
309
198
  // src/components/Input/Input.tsx
310
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
311
- var inputVariants = cva2("ddga-input", {
199
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
200
+ var inputVariants = cva3("ddga-input", {
312
201
  variants: {
313
202
  size: {
314
203
  sm: "ddga-input--sm",
@@ -346,12 +235,12 @@ function Input({
346
235
  "aria-label": props["aria-label"],
347
236
  "aria-labelledby": props["aria-labelledby"]
348
237
  });
349
- return /* @__PURE__ */ jsxs3("div", { "data-slot": "input-field", className: "ddga-field", children: [
350
- label && /* @__PURE__ */ jsxs3("label", { htmlFor: fieldId, className: "ddga-input__label", children: [
238
+ return /* @__PURE__ */ jsxs2("div", { "data-slot": "input-field", className: "ddga-field", children: [
239
+ label && /* @__PURE__ */ jsxs2("label", { htmlFor: fieldId, className: "ddga-input__label", children: [
351
240
  label,
352
241
  required && /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", className: "ddga-input__required", children: "*" })
353
242
  ] }),
354
- /* @__PURE__ */ jsxs3(
243
+ /* @__PURE__ */ jsxs2(
355
244
  "div",
356
245
  {
357
246
  "data-slot": "input-control",
@@ -392,9 +281,9 @@ function Input({
392
281
  }
393
282
 
394
283
  // src/components/Textarea/Textarea.tsx
395
- import { cva as cva3 } from "class-variance-authority";
396
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
397
- var textareaVariants = cva3("ddga-textarea", {
284
+ import { cva as cva4 } from "class-variance-authority";
285
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
286
+ var textareaVariants = cva4("ddga-textarea", {
398
287
  variants: {
399
288
  size: {
400
289
  sm: "ddga-textarea--sm",
@@ -439,8 +328,8 @@ function Textarea({
439
328
  "aria-label": props["aria-label"],
440
329
  "aria-labelledby": props["aria-labelledby"]
441
330
  });
442
- return /* @__PURE__ */ jsxs4("div", { "data-slot": "textarea-field", className: "ddga-field", children: [
443
- label && /* @__PURE__ */ jsxs4("label", { htmlFor: fieldId, className: "ddga-textarea__label", children: [
331
+ return /* @__PURE__ */ jsxs3("div", { "data-slot": "textarea-field", className: "ddga-field", children: [
332
+ label && /* @__PURE__ */ jsxs3("label", { htmlFor: fieldId, className: "ddga-textarea__label", children: [
444
333
  label,
445
334
  required && /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", className: "ddga-textarea__required", children: "*" })
446
335
  ] }),
@@ -462,204 +351,2974 @@ function Textarea({
462
351
 
463
352
  // src/components/Checkbox/Checkbox.tsx
464
353
  import { Checkbox as CheckboxPrimitive } from "radix-ui";
465
- import { cva as cva4 } from "class-variance-authority";
466
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
467
- var checkboxVariants = cva4("ddga-checkbox", {
468
- variants: {
469
- size: {
470
- sm: "ddga-checkbox--sm",
471
- md: "ddga-checkbox--md"
472
- },
473
- error: {
474
- true: "ddga-checkbox--error"
354
+ import { cva as cva5 } from "class-variance-authority";
355
+
356
+ // src/internal/icons/index.tsx
357
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
358
+ function Check(props) {
359
+ return /* @__PURE__ */ jsx6(
360
+ "svg",
361
+ {
362
+ xmlns: "http://www.w3.org/2000/svg",
363
+ width: "1em",
364
+ height: "1em",
365
+ viewBox: "0 0 24 24",
366
+ fill: "none",
367
+ stroke: "currentColor",
368
+ strokeWidth: "3",
369
+ strokeLinecap: "round",
370
+ strokeLinejoin: "round",
371
+ ...props,
372
+ children: /* @__PURE__ */ jsx6("path", { d: "M20 6 9 17l-5-5" })
475
373
  }
476
- },
477
- defaultVariants: {
478
- size: "md"
479
- }
480
- });
481
- function Checkbox({
482
- id: externalId,
483
- label,
484
- helperText,
485
- errorMessage,
486
- error,
487
- size,
488
- required,
489
- className,
490
- ...props
491
- }) {
492
- const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
493
- name: "Checkbox",
494
- id: externalId,
495
- label,
496
- error,
497
- errorMessage,
498
- helperText,
499
- "aria-label": props["aria-label"],
500
- "aria-labelledby": props["aria-labelledby"]
501
- });
502
- return /* @__PURE__ */ jsxs5("div", { "data-slot": "checkbox-field", className: "ddga-field", children: [
503
- /* @__PURE__ */ jsxs5("div", { className: "ddga-checkbox-row", children: [
504
- /* @__PURE__ */ jsx6(
505
- CheckboxPrimitive.Root,
506
- {
507
- ...props,
508
- ...controlProps,
509
- "data-slot": "checkbox",
510
- required,
511
- className: cn(checkboxVariants({ size, error: hasError }), className),
512
- children: /* @__PURE__ */ jsxs5(
513
- CheckboxPrimitive.Indicator,
514
- {
515
- "data-slot": "checkbox-indicator",
516
- className: "ddga-checkbox__indicator",
517
- children: [
518
- /* @__PURE__ */ jsx6(Check, { className: "ddga-checkbox__check", "aria-hidden": "true" }),
519
- /* @__PURE__ */ jsx6(Minus, { className: "ddga-checkbox__minus", "aria-hidden": "true" })
520
- ]
521
- }
522
- )
523
- }
524
- ),
525
- label && /* @__PURE__ */ jsxs5("label", { htmlFor: fieldId, className: "ddga-checkbox__label", children: [
526
- label,
527
- required && /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", className: "ddga-checkbox__required", children: "*" })
528
- ] })
529
- ] }),
530
- hasErrorMessage && /* @__PURE__ */ jsx6(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
531
- hasHelper && /* @__PURE__ */ jsx6(FieldMessage, { id: helperId, variant: "helper", children: helperText })
532
- ] });
374
+ );
533
375
  }
534
-
535
- // src/components/Radio/Radio.tsx
536
- import { useId as useId2 } from "react";
537
- import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
538
- import { cva as cva5 } from "class-variance-authority";
539
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
540
- var radioGroupVariants = cva5("ddga-radio-group", {
541
- variants: {
542
- size: {
543
- sm: "ddga-radio-group--sm",
544
- md: "ddga-radio-group--md"
545
- },
546
- orientation: {
547
- vertical: "ddga-radio-group--vertical",
548
- horizontal: "ddga-radio-group--horizontal"
549
- },
550
- error: {
551
- true: "ddga-radio-group--error"
376
+ function Minus(props) {
377
+ return /* @__PURE__ */ jsx6(
378
+ "svg",
379
+ {
380
+ xmlns: "http://www.w3.org/2000/svg",
381
+ width: "1em",
382
+ height: "1em",
383
+ viewBox: "0 0 24 24",
384
+ fill: "none",
385
+ stroke: "currentColor",
386
+ strokeWidth: "3",
387
+ strokeLinecap: "round",
388
+ strokeLinejoin: "round",
389
+ ...props,
390
+ children: /* @__PURE__ */ jsx6("path", { d: "M5 12h14" })
552
391
  }
553
- },
554
- defaultVariants: {
555
- size: "md",
556
- orientation: "vertical"
557
- }
558
- });
559
- var radioVariants = cva5("ddga-radio");
560
- function RadioGroup({
561
- id: externalId,
562
- label,
392
+ );
393
+ }
394
+ function Info(props) {
395
+ return /* @__PURE__ */ jsxs4(
396
+ "svg",
397
+ {
398
+ xmlns: "http://www.w3.org/2000/svg",
399
+ width: "1em",
400
+ height: "1em",
401
+ viewBox: "0 0 24 24",
402
+ fill: "none",
403
+ stroke: "currentColor",
404
+ strokeWidth: "2",
405
+ strokeLinecap: "round",
406
+ strokeLinejoin: "round",
407
+ ...props,
408
+ children: [
409
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "10" }),
410
+ /* @__PURE__ */ jsx6("path", { d: "M12 16v-4" }),
411
+ /* @__PURE__ */ jsx6("path", { d: "M12 8h.01" })
412
+ ]
413
+ }
414
+ );
415
+ }
416
+ function AlertTriangle(props) {
417
+ return /* @__PURE__ */ jsxs4(
418
+ "svg",
419
+ {
420
+ xmlns: "http://www.w3.org/2000/svg",
421
+ width: "1em",
422
+ height: "1em",
423
+ viewBox: "0 0 24 24",
424
+ fill: "none",
425
+ stroke: "currentColor",
426
+ strokeWidth: "2",
427
+ strokeLinecap: "round",
428
+ strokeLinejoin: "round",
429
+ ...props,
430
+ children: [
431
+ /* @__PURE__ */ jsx6("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
432
+ /* @__PURE__ */ jsx6("path", { d: "M12 9v4" }),
433
+ /* @__PURE__ */ jsx6("path", { d: "M12 17h.01" })
434
+ ]
435
+ }
436
+ );
437
+ }
438
+ function AlertCircle(props) {
439
+ return /* @__PURE__ */ jsxs4(
440
+ "svg",
441
+ {
442
+ xmlns: "http://www.w3.org/2000/svg",
443
+ width: "1em",
444
+ height: "1em",
445
+ viewBox: "0 0 24 24",
446
+ fill: "none",
447
+ stroke: "currentColor",
448
+ strokeWidth: "2",
449
+ strokeLinecap: "round",
450
+ strokeLinejoin: "round",
451
+ ...props,
452
+ children: [
453
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "10" }),
454
+ /* @__PURE__ */ jsx6("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
455
+ /* @__PURE__ */ jsx6("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
456
+ ]
457
+ }
458
+ );
459
+ }
460
+ function Close(props) {
461
+ return /* @__PURE__ */ jsxs4(
462
+ "svg",
463
+ {
464
+ xmlns: "http://www.w3.org/2000/svg",
465
+ width: "1em",
466
+ height: "1em",
467
+ viewBox: "0 0 24 24",
468
+ fill: "none",
469
+ stroke: "currentColor",
470
+ strokeWidth: "2",
471
+ strokeLinecap: "round",
472
+ strokeLinejoin: "round",
473
+ ...props,
474
+ children: [
475
+ /* @__PURE__ */ jsx6("path", { d: "M18 6 6 18" }),
476
+ /* @__PURE__ */ jsx6("path", { d: "m6 6 12 12" })
477
+ ]
478
+ }
479
+ );
480
+ }
481
+ function ChevronDown(props) {
482
+ return /* @__PURE__ */ jsx6(
483
+ "svg",
484
+ {
485
+ xmlns: "http://www.w3.org/2000/svg",
486
+ width: "1em",
487
+ height: "1em",
488
+ viewBox: "0 0 24 24",
489
+ fill: "none",
490
+ stroke: "currentColor",
491
+ strokeWidth: "2",
492
+ strokeLinecap: "round",
493
+ strokeLinejoin: "round",
494
+ ...props,
495
+ children: /* @__PURE__ */ jsx6("path", { d: "m6 9 6 6 6-6" })
496
+ }
497
+ );
498
+ }
499
+ function ChevronRight(props) {
500
+ return /* @__PURE__ */ jsx6(
501
+ "svg",
502
+ {
503
+ xmlns: "http://www.w3.org/2000/svg",
504
+ width: "1em",
505
+ height: "1em",
506
+ viewBox: "0 0 24 24",
507
+ fill: "none",
508
+ stroke: "currentColor",
509
+ strokeWidth: "2",
510
+ strokeLinecap: "round",
511
+ strokeLinejoin: "round",
512
+ ...props,
513
+ children: /* @__PURE__ */ jsx6("path", { d: "m9 18 6-6-6-6" })
514
+ }
515
+ );
516
+ }
517
+ function ChevronLeft(props) {
518
+ return /* @__PURE__ */ jsx6(
519
+ "svg",
520
+ {
521
+ xmlns: "http://www.w3.org/2000/svg",
522
+ width: "1em",
523
+ height: "1em",
524
+ viewBox: "0 0 24 24",
525
+ fill: "none",
526
+ stroke: "currentColor",
527
+ strokeWidth: "2",
528
+ strokeLinecap: "round",
529
+ strokeLinejoin: "round",
530
+ ...props,
531
+ children: /* @__PURE__ */ jsx6("path", { d: "m15 18-6-6 6-6" })
532
+ }
533
+ );
534
+ }
535
+ function CalendarIcon(props) {
536
+ return /* @__PURE__ */ jsxs4(
537
+ "svg",
538
+ {
539
+ xmlns: "http://www.w3.org/2000/svg",
540
+ width: "1em",
541
+ height: "1em",
542
+ viewBox: "0 0 24 24",
543
+ fill: "none",
544
+ stroke: "currentColor",
545
+ strokeWidth: "2",
546
+ strokeLinecap: "round",
547
+ strokeLinejoin: "round",
548
+ ...props,
549
+ children: [
550
+ /* @__PURE__ */ jsx6("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
551
+ /* @__PURE__ */ jsx6("line", { x1: "16", x2: "16", y1: "2", y2: "6" }),
552
+ /* @__PURE__ */ jsx6("line", { x1: "8", x2: "8", y1: "2", y2: "6" }),
553
+ /* @__PURE__ */ jsx6("line", { x1: "3", x2: "21", y1: "10", y2: "10" })
554
+ ]
555
+ }
556
+ );
557
+ }
558
+ function MoreHorizontal(props) {
559
+ return /* @__PURE__ */ jsxs4(
560
+ "svg",
561
+ {
562
+ xmlns: "http://www.w3.org/2000/svg",
563
+ width: "1em",
564
+ height: "1em",
565
+ viewBox: "0 0 24 24",
566
+ fill: "currentColor",
567
+ stroke: "none",
568
+ ...props,
569
+ children: [
570
+ /* @__PURE__ */ jsx6("circle", { cx: "5", cy: "12", r: "1.5" }),
571
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "1.5" }),
572
+ /* @__PURE__ */ jsx6("circle", { cx: "19", cy: "12", r: "1.5" })
573
+ ]
574
+ }
575
+ );
576
+ }
577
+ function Plus(props) {
578
+ return /* @__PURE__ */ jsxs4(
579
+ "svg",
580
+ {
581
+ xmlns: "http://www.w3.org/2000/svg",
582
+ width: "1em",
583
+ height: "1em",
584
+ viewBox: "0 0 24 24",
585
+ fill: "none",
586
+ stroke: "currentColor",
587
+ strokeWidth: "3",
588
+ strokeLinecap: "round",
589
+ strokeLinejoin: "round",
590
+ ...props,
591
+ children: [
592
+ /* @__PURE__ */ jsx6("path", { d: "M12 5v14" }),
593
+ /* @__PURE__ */ jsx6("path", { d: "M5 12h14" })
594
+ ]
595
+ }
596
+ );
597
+ }
598
+ function Star(props) {
599
+ return /* @__PURE__ */ jsx6(
600
+ "svg",
601
+ {
602
+ xmlns: "http://www.w3.org/2000/svg",
603
+ width: "1em",
604
+ height: "1em",
605
+ viewBox: "0 0 24 24",
606
+ fill: "currentColor",
607
+ stroke: "none",
608
+ ...props,
609
+ children: /* @__PURE__ */ jsx6("path", { d: "m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
610
+ }
611
+ );
612
+ }
613
+ function Upload(props) {
614
+ return /* @__PURE__ */ jsxs4(
615
+ "svg",
616
+ {
617
+ xmlns: "http://www.w3.org/2000/svg",
618
+ width: "1em",
619
+ height: "1em",
620
+ viewBox: "0 0 24 24",
621
+ fill: "none",
622
+ stroke: "currentColor",
623
+ strokeWidth: "2",
624
+ strokeLinecap: "round",
625
+ strokeLinejoin: "round",
626
+ ...props,
627
+ children: [
628
+ /* @__PURE__ */ jsx6("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
629
+ /* @__PURE__ */ jsx6("path", { d: "M17 8l-5-5-5 5" }),
630
+ /* @__PURE__ */ jsx6("path", { d: "M12 3v12" })
631
+ ]
632
+ }
633
+ );
634
+ }
635
+
636
+ // src/components/Checkbox/Checkbox.tsx
637
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
638
+ var checkboxVariants = cva5("ddga-checkbox", {
639
+ variants: {
640
+ size: {
641
+ sm: "ddga-checkbox--sm",
642
+ md: "ddga-checkbox--md"
643
+ },
644
+ error: {
645
+ true: "ddga-checkbox--error"
646
+ }
647
+ },
648
+ defaultVariants: {
649
+ size: "md"
650
+ }
651
+ });
652
+ function Checkbox({
653
+ id: externalId,
654
+ label,
655
+ helperText,
656
+ errorMessage,
657
+ error,
658
+ size,
659
+ required,
660
+ className,
661
+ ...props
662
+ }) {
663
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
664
+ name: "Checkbox",
665
+ id: externalId,
666
+ label,
667
+ error,
668
+ errorMessage,
669
+ helperText,
670
+ "aria-label": props["aria-label"],
671
+ "aria-labelledby": props["aria-labelledby"]
672
+ });
673
+ return /* @__PURE__ */ jsxs5("div", { "data-slot": "checkbox-field", className: "ddga-field", children: [
674
+ /* @__PURE__ */ jsxs5("div", { className: "ddga-checkbox-row", children: [
675
+ /* @__PURE__ */ jsx7(
676
+ CheckboxPrimitive.Root,
677
+ {
678
+ ...props,
679
+ ...controlProps,
680
+ "data-slot": "checkbox",
681
+ required,
682
+ className: cn(checkboxVariants({ size, error: hasError }), className),
683
+ children: /* @__PURE__ */ jsxs5(
684
+ CheckboxPrimitive.Indicator,
685
+ {
686
+ "data-slot": "checkbox-indicator",
687
+ className: "ddga-checkbox__indicator",
688
+ children: [
689
+ /* @__PURE__ */ jsx7(Check, { className: "ddga-checkbox__check", "aria-hidden": "true" }),
690
+ /* @__PURE__ */ jsx7(Minus, { className: "ddga-checkbox__minus", "aria-hidden": "true" })
691
+ ]
692
+ }
693
+ )
694
+ }
695
+ ),
696
+ label && /* @__PURE__ */ jsxs5("label", { htmlFor: fieldId, className: "ddga-checkbox__label", children: [
697
+ label,
698
+ required && /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", className: "ddga-checkbox__required", children: "*" })
699
+ ] })
700
+ ] }),
701
+ hasErrorMessage && /* @__PURE__ */ jsx7(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
702
+ hasHelper && /* @__PURE__ */ jsx7(FieldMessage, { id: helperId, variant: "helper", children: helperText })
703
+ ] });
704
+ }
705
+
706
+ // src/components/Radio/Radio.tsx
707
+ import { useId as useId2 } from "react";
708
+ import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
709
+ import { cva as cva6 } from "class-variance-authority";
710
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
711
+ var radioGroupVariants = cva6("ddga-radio-group", {
712
+ variants: {
713
+ size: {
714
+ sm: "ddga-radio-group--sm",
715
+ md: "ddga-radio-group--md"
716
+ },
717
+ orientation: {
718
+ vertical: "ddga-radio-group--vertical",
719
+ horizontal: "ddga-radio-group--horizontal"
720
+ },
721
+ error: {
722
+ true: "ddga-radio-group--error"
723
+ }
724
+ },
725
+ defaultVariants: {
726
+ size: "md",
727
+ orientation: "vertical"
728
+ }
729
+ });
730
+ var radioVariants = cva6("ddga-radio");
731
+ function RadioGroup({
732
+ id: externalId,
733
+ label,
734
+ helperText,
735
+ errorMessage,
736
+ error,
737
+ size,
738
+ orientation,
739
+ required,
740
+ className,
741
+ children,
742
+ ...props
743
+ }) {
744
+ const { errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps, fieldId } = useFieldA11y({
745
+ name: "RadioGroup",
746
+ id: externalId,
747
+ label,
748
+ error,
749
+ errorMessage,
750
+ helperText,
751
+ "aria-label": props["aria-label"],
752
+ "aria-labelledby": props["aria-labelledby"]
753
+ });
754
+ const labelId = `${fieldId}-label`;
755
+ return /* @__PURE__ */ jsxs6("div", { "data-slot": "radio-group-field", className: "ddga-field", children: [
756
+ label && /* @__PURE__ */ jsxs6("span", { id: labelId, className: "ddga-radio-group__label", children: [
757
+ label,
758
+ required && /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", className: "ddga-radio-group__required", children: "*" })
759
+ ] }),
760
+ /* @__PURE__ */ jsx8(
761
+ RadioGroupPrimitive.Root,
762
+ {
763
+ ...props,
764
+ "aria-invalid": controlProps["aria-invalid"],
765
+ "aria-describedby": controlProps["aria-describedby"],
766
+ "aria-labelledby": label ? labelId : props["aria-labelledby"],
767
+ orientation: orientation === "horizontal" ? "horizontal" : "vertical",
768
+ required,
769
+ "data-slot": "radio-group",
770
+ className: cn(radioGroupVariants({ size, orientation, error: hasError }), className),
771
+ children
772
+ }
773
+ ),
774
+ hasErrorMessage && /* @__PURE__ */ jsx8(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
775
+ hasHelper && /* @__PURE__ */ jsx8(FieldMessage, { id: helperId, variant: "helper", children: helperText })
776
+ ] });
777
+ }
778
+ function Radio({ id: externalId, label, className, ...props }) {
779
+ const generatedId = useId2();
780
+ const itemId = externalId ?? generatedId;
781
+ return /* @__PURE__ */ jsxs6("div", { className: "ddga-radio-row", children: [
782
+ /* @__PURE__ */ jsx8(
783
+ RadioGroupPrimitive.Item,
784
+ {
785
+ ...props,
786
+ id: itemId,
787
+ "data-slot": "radio",
788
+ className: cn(radioVariants(), className),
789
+ children: /* @__PURE__ */ jsx8(
790
+ RadioGroupPrimitive.Indicator,
791
+ {
792
+ "data-slot": "radio-indicator",
793
+ className: "ddga-radio__indicator",
794
+ children: /* @__PURE__ */ jsx8("span", { className: "ddga-radio__dot", "aria-hidden": "true" })
795
+ }
796
+ )
797
+ }
798
+ ),
799
+ label && /* @__PURE__ */ jsx8("label", { htmlFor: itemId, className: "ddga-radio__label", children: label })
800
+ ] });
801
+ }
802
+
803
+ // src/components/Switch/Switch.tsx
804
+ import { Switch as SwitchPrimitive } from "radix-ui";
805
+ import { cva as cva7 } from "class-variance-authority";
806
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
807
+ var switchVariants = cva7("ddga-switch", {
808
+ variants: {
809
+ size: {
810
+ sm: "ddga-switch--sm",
811
+ md: "ddga-switch--md"
812
+ },
813
+ error: {
814
+ true: "ddga-switch--error"
815
+ }
816
+ },
817
+ defaultVariants: {
818
+ size: "md"
819
+ }
820
+ });
821
+ function Switch({
822
+ id: externalId,
823
+ label,
824
+ helperText,
825
+ errorMessage,
826
+ error,
827
+ size,
828
+ required,
829
+ className,
830
+ ...props
831
+ }) {
832
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
833
+ name: "Switch",
834
+ id: externalId,
835
+ label,
836
+ error,
837
+ errorMessage,
838
+ helperText,
839
+ "aria-label": props["aria-label"],
840
+ "aria-labelledby": props["aria-labelledby"]
841
+ });
842
+ return /* @__PURE__ */ jsxs7("div", { "data-slot": "switch-field", className: "ddga-field", children: [
843
+ /* @__PURE__ */ jsxs7("div", { className: "ddga-switch-row", children: [
844
+ /* @__PURE__ */ jsx9(
845
+ SwitchPrimitive.Root,
846
+ {
847
+ ...props,
848
+ ...controlProps,
849
+ "data-slot": "switch",
850
+ required,
851
+ className: cn(switchVariants({ size, error: hasError }), className),
852
+ children: /* @__PURE__ */ jsx9(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "ddga-switch__thumb" })
853
+ }
854
+ ),
855
+ label && /* @__PURE__ */ jsxs7("label", { htmlFor: fieldId, className: "ddga-switch__label", children: [
856
+ label,
857
+ required && /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "ddga-switch__required", children: "*" })
858
+ ] })
859
+ ] }),
860
+ hasErrorMessage && /* @__PURE__ */ jsx9(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
861
+ hasHelper && /* @__PURE__ */ jsx9(FieldMessage, { id: helperId, variant: "helper", children: helperText })
862
+ ] });
863
+ }
864
+
865
+ // src/components/Select/Select.tsx
866
+ import { useContext as useContext2 } from "react";
867
+ import { Select as SelectPrimitive } from "radix-ui";
868
+ import { cva as cva8 } from "class-variance-authority";
869
+
870
+ // src/providers/DgaContext.ts
871
+ import { createContext, useContext } from "react";
872
+ var DgaContext = createContext(null);
873
+ function useDga() {
874
+ const ctx = useContext(DgaContext);
875
+ if (!ctx) {
876
+ throw new Error("useDga must be used within a <DgaProvider>");
877
+ }
878
+ return ctx;
879
+ }
880
+
881
+ // src/components/Select/Select.tsx
882
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
883
+ var selectTriggerVariants = cva8("ddga-select-trigger", {
884
+ variants: {
885
+ size: {
886
+ sm: "ddga-select-trigger--sm",
887
+ md: "ddga-select-trigger--md"
888
+ },
889
+ error: {
890
+ true: "ddga-select-trigger--error"
891
+ }
892
+ },
893
+ defaultVariants: {
894
+ size: "md"
895
+ }
896
+ });
897
+ function Select({
898
+ id: externalId,
899
+ label,
900
+ helperText,
901
+ errorMessage,
902
+ error,
903
+ size,
904
+ required,
905
+ placeholder,
906
+ className,
907
+ children,
908
+ ...rootProps
909
+ }) {
910
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
911
+ name: "Select",
912
+ id: externalId,
913
+ label,
914
+ error,
915
+ errorMessage,
916
+ helperText,
917
+ "aria-label": rootProps["aria-label"],
918
+ "aria-labelledby": rootProps["aria-labelledby"]
919
+ });
920
+ const ctx = useContext2(DgaContext);
921
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
922
+ return /* @__PURE__ */ jsxs8("div", { "data-slot": "select-field", className: "ddga-field", children: [
923
+ label && /* @__PURE__ */ jsxs8("label", { htmlFor: fieldId, className: "ddga-select__label", children: [
924
+ label,
925
+ required && /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "ddga-select__required", children: "*" })
926
+ ] }),
927
+ /* @__PURE__ */ jsxs8(SelectPrimitive.Root, { required, ...rootProps, children: [
928
+ /* @__PURE__ */ jsxs8(
929
+ SelectPrimitive.Trigger,
930
+ {
931
+ ...controlProps,
932
+ "data-slot": "select-trigger",
933
+ className: cn(selectTriggerVariants({ size, error: hasError }), className),
934
+ children: [
935
+ /* @__PURE__ */ jsx10(SelectPrimitive.Value, { placeholder }),
936
+ /* @__PURE__ */ jsx10(SelectPrimitive.Icon, { asChild: true, className: "ddga-select__icon", children: /* @__PURE__ */ jsx10(ChevronDown, { "aria-hidden": "true" }) })
937
+ ]
938
+ }
939
+ ),
940
+ /* @__PURE__ */ jsx10(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx10(
941
+ SelectPrimitive.Content,
942
+ {
943
+ "data-slot": "select-content",
944
+ className: "ddga-select-content",
945
+ position: "popper",
946
+ sideOffset: 4,
947
+ children: /* @__PURE__ */ jsx10(SelectPrimitive.Viewport, { className: "ddga-select-viewport", children })
948
+ }
949
+ ) })
950
+ ] }),
951
+ hasErrorMessage && /* @__PURE__ */ jsx10(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
952
+ hasHelper && /* @__PURE__ */ jsx10(FieldMessage, { id: helperId, variant: "helper", children: helperText })
953
+ ] });
954
+ }
955
+ function SelectItem({ className, children, ...props }) {
956
+ return /* @__PURE__ */ jsxs8(
957
+ SelectPrimitive.Item,
958
+ {
959
+ ...props,
960
+ "data-slot": "select-item",
961
+ className: cn("ddga-select-item", className),
962
+ children: [
963
+ /* @__PURE__ */ jsx10(SelectPrimitive.ItemText, { children }),
964
+ /* @__PURE__ */ jsx10(SelectPrimitive.ItemIndicator, { className: "ddga-select-item__indicator", children: /* @__PURE__ */ jsx10(Check, { className: "ddga-select-item__check", "aria-hidden": "true" }) })
965
+ ]
966
+ }
967
+ );
968
+ }
969
+
970
+ // src/components/Card/Card.tsx
971
+ import { Slot as SlotPrimitive2 } from "radix-ui";
972
+ import { cva as cva9 } from "class-variance-authority";
973
+ import { jsx as jsx11 } from "react/jsx-runtime";
974
+ var cardVariants = cva9("ddga-card", {
975
+ variants: {
976
+ variant: {
977
+ default: "ddga-card--default",
978
+ outline: "ddga-card--outline",
979
+ elevated: "ddga-card--elevated",
980
+ filled: "ddga-card--filled",
981
+ gradient: "ddga-card--gradient",
982
+ ghost: "ddga-card--ghost"
983
+ },
984
+ padding: {
985
+ sm: "ddga-card--padding-sm",
986
+ md: "ddga-card--padding-md",
987
+ lg: "ddga-card--padding-lg"
988
+ },
989
+ orientation: {
990
+ vertical: "ddga-card--vertical",
991
+ horizontal: "ddga-card--horizontal"
992
+ },
993
+ interactive: {
994
+ true: "ddga-card--interactive"
995
+ }
996
+ },
997
+ defaultVariants: {
998
+ variant: "default",
999
+ padding: "md",
1000
+ orientation: "vertical"
1001
+ }
1002
+ });
1003
+ function Card({
1004
+ variant,
1005
+ padding,
1006
+ orientation,
1007
+ interactive,
1008
+ asChild,
1009
+ className,
1010
+ ...props
1011
+ }) {
1012
+ const Comp = asChild ? SlotPrimitive2.Slot : "div";
1013
+ return /* @__PURE__ */ jsx11(
1014
+ Comp,
1015
+ {
1016
+ "data-slot": "card",
1017
+ "data-orientation": orientation ?? "vertical",
1018
+ className: cn(cardVariants({ variant, padding, orientation, interactive }), className),
1019
+ ...props
1020
+ }
1021
+ );
1022
+ }
1023
+ function CardImage({ aspectRatio = "16/9", className, style, ...props }) {
1024
+ return /* @__PURE__ */ jsx11(
1025
+ "img",
1026
+ {
1027
+ "data-slot": "card-image",
1028
+ className: cn("ddga-card__image", className),
1029
+ style: {
1030
+ "--ddga-card-image-aspect": aspectRatio,
1031
+ ...style
1032
+ },
1033
+ ...props
1034
+ }
1035
+ );
1036
+ }
1037
+ function CardHeader({ asChild, className, ...props }) {
1038
+ const Comp = asChild ? SlotPrimitive2.Slot : "div";
1039
+ return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-header", className: cn("ddga-card__header", className), ...props });
1040
+ }
1041
+ function CardTitle({ asChild, className, ...props }) {
1042
+ const Comp = asChild ? SlotPrimitive2.Slot : "h3";
1043
+ return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-title", className: cn("ddga-card__title", className), ...props });
1044
+ }
1045
+ function CardDescription({ asChild, className, ...props }) {
1046
+ const Comp = asChild ? SlotPrimitive2.Slot : "p";
1047
+ return /* @__PURE__ */ jsx11(
1048
+ Comp,
1049
+ {
1050
+ "data-slot": "card-description",
1051
+ className: cn("ddga-card__description", className),
1052
+ ...props
1053
+ }
1054
+ );
1055
+ }
1056
+ function CardContent({ asChild, className, ...props }) {
1057
+ const Comp = asChild ? SlotPrimitive2.Slot : "div";
1058
+ return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-content", className: cn("ddga-card__content", className), ...props });
1059
+ }
1060
+ function CardFooter({ asChild, className, ...props }) {
1061
+ const Comp = asChild ? SlotPrimitive2.Slot : "div";
1062
+ return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-footer", className: cn("ddga-card__footer", className), ...props });
1063
+ }
1064
+
1065
+ // src/components/Badge/Badge.tsx
1066
+ import { useState } from "react";
1067
+ import { Slot as SlotPrimitive3 } from "radix-ui";
1068
+ import { cva as cva10 } from "class-variance-authority";
1069
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
1070
+ var badgeVariants = cva10("ddga-badge", {
1071
+ variants: {
1072
+ variant: {
1073
+ // Solid family
1074
+ default: "ddga-badge--default",
1075
+ primary: "ddga-badge--primary",
1076
+ secondary: "ddga-badge--secondary",
1077
+ destructive: "ddga-badge--destructive",
1078
+ success: "ddga-badge--success",
1079
+ warning: "ddga-badge--warning",
1080
+ info: "ddga-badge--info",
1081
+ // Subtle family (tonal)
1082
+ "primary-subtle": "ddga-badge--primary-subtle",
1083
+ "secondary-subtle": "ddga-badge--secondary-subtle",
1084
+ "destructive-subtle": "ddga-badge--destructive-subtle",
1085
+ "success-subtle": "ddga-badge--success-subtle",
1086
+ "warning-subtle": "ddga-badge--warning-subtle",
1087
+ "info-subtle": "ddga-badge--info-subtle",
1088
+ // Outline
1089
+ outline: "ddga-badge--outline"
1090
+ },
1091
+ size: {
1092
+ sm: "ddga-badge--sm",
1093
+ md: "ddga-badge--md"
1094
+ }
1095
+ },
1096
+ defaultVariants: {
1097
+ variant: "default",
1098
+ size: "md"
1099
+ }
1100
+ });
1101
+ function Badge({
1102
+ variant,
1103
+ size,
1104
+ asChild,
1105
+ dot,
1106
+ startIcon,
1107
+ endIcon,
1108
+ dismissible,
1109
+ open,
1110
+ onDismiss,
1111
+ closeLabel = "Dismiss",
1112
+ className,
1113
+ children,
1114
+ ...props
1115
+ }) {
1116
+ const isControlled = open !== void 0;
1117
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(true);
1118
+ const isOpen = isControlled ? open : uncontrolledOpen;
1119
+ if (process.env.NODE_ENV !== "production" && asChild && dismissible) {
1120
+ console.warn(
1121
+ "[Badge] `dismissible` is not supported with `asChild` because it would nest an interactive close button inside the consumer's element (invalid HTML). The close button will not render."
1122
+ );
1123
+ }
1124
+ if (!isOpen) return null;
1125
+ const Comp = asChild ? SlotPrimitive3.Slot : "span";
1126
+ const showClose = dismissible && !asChild;
1127
+ const handleDismiss = () => {
1128
+ if (!isControlled) setUncontrolledOpen(false);
1129
+ onDismiss?.();
1130
+ };
1131
+ return /* @__PURE__ */ jsxs9(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props, children: [
1132
+ dot ? /* @__PURE__ */ jsx12("span", { className: "ddga-badge__dot", "aria-hidden": "true" }) : null,
1133
+ startIcon ? /* @__PURE__ */ jsx12("span", { className: "ddga-badge__icon", "aria-hidden": "true", children: startIcon }) : null,
1134
+ asChild ? (
1135
+ // children IS the consumer's single element (e.g. <a>). Slottable marks
1136
+ // where THAT element's original children should land — without it the
1137
+ // dot/icons would replace the link text.
1138
+ /* @__PURE__ */ jsx12(SlotPrimitive3.Slottable, { children })
1139
+ ) : children,
1140
+ endIcon ? /* @__PURE__ */ jsx12("span", { className: "ddga-badge__icon", "aria-hidden": "true", children: endIcon }) : null,
1141
+ showClose ? /* @__PURE__ */ jsx12(
1142
+ "button",
1143
+ {
1144
+ type: "button",
1145
+ className: "ddga-badge__close",
1146
+ "aria-label": closeLabel,
1147
+ onClick: handleDismiss,
1148
+ "data-slot": "badge-close",
1149
+ children: /* @__PURE__ */ jsx12(Close, { "aria-hidden": "true" })
1150
+ }
1151
+ ) : null
1152
+ ] });
1153
+ }
1154
+
1155
+ // src/components/Divider/Divider.tsx
1156
+ import { cva as cva11 } from "class-variance-authority";
1157
+ import { jsx as jsx13 } from "react/jsx-runtime";
1158
+ var dividerVariants = cva11("ddga-divider", {
1159
+ variants: {
1160
+ orientation: {
1161
+ horizontal: "ddga-divider--horizontal",
1162
+ vertical: "ddga-divider--vertical"
1163
+ },
1164
+ variant: {
1165
+ solid: "ddga-divider--solid",
1166
+ dashed: "ddga-divider--dashed"
1167
+ }
1168
+ },
1169
+ defaultVariants: {
1170
+ orientation: "horizontal",
1171
+ variant: "solid"
1172
+ }
1173
+ });
1174
+ function Divider({
1175
+ orientation = "horizontal",
1176
+ variant = "solid",
1177
+ labelPosition = "center",
1178
+ decorative = false,
1179
+ className,
1180
+ children,
1181
+ ...props
1182
+ }) {
1183
+ const isLabeled = orientation === "horizontal" && children !== void 0 && children !== null && children !== "";
1184
+ const a11yProps = decorative ? { role: "none" } : {
1185
+ role: "separator",
1186
+ ...orientation === "vertical" ? { "aria-orientation": "vertical" } : {}
1187
+ };
1188
+ return /* @__PURE__ */ jsx13(
1189
+ "div",
1190
+ {
1191
+ "data-slot": "divider",
1192
+ "data-orientation": orientation,
1193
+ className: cn(
1194
+ dividerVariants({ orientation, variant }),
1195
+ isLabeled && "ddga-divider--labeled",
1196
+ isLabeled && `ddga-divider--label-${labelPosition}`,
1197
+ className
1198
+ ),
1199
+ ...a11yProps,
1200
+ ...props,
1201
+ children: isLabeled ? /* @__PURE__ */ jsx13("span", { className: "ddga-divider__label", children }) : null
1202
+ }
1203
+ );
1204
+ }
1205
+
1206
+ // src/components/Avatar/Avatar.tsx
1207
+ import { Children, isValidElement, cloneElement } from "react";
1208
+ import { Avatar as AvatarPrimitive } from "radix-ui";
1209
+ import { cva as cva12 } from "class-variance-authority";
1210
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1211
+ var avatarVariants = cva12("ddga-avatar", {
1212
+ variants: {
1213
+ size: {
1214
+ xs: "ddga-avatar--xs",
1215
+ sm: "ddga-avatar--sm",
1216
+ md: "ddga-avatar--md",
1217
+ lg: "ddga-avatar--lg",
1218
+ xl: "ddga-avatar--xl"
1219
+ },
1220
+ shape: {
1221
+ circle: "ddga-avatar--circle",
1222
+ square: "ddga-avatar--square"
1223
+ }
1224
+ },
1225
+ defaultVariants: {
1226
+ size: "md",
1227
+ shape: "circle"
1228
+ }
1229
+ });
1230
+ var fallbackVariants = cva12("ddga-avatar__fallback", {
1231
+ variants: {
1232
+ colorScheme: {
1233
+ default: "ddga-avatar__fallback--default",
1234
+ primary: "ddga-avatar__fallback--primary",
1235
+ secondary: "ddga-avatar__fallback--secondary",
1236
+ success: "ddga-avatar__fallback--success",
1237
+ warning: "ddga-avatar__fallback--warning",
1238
+ destructive: "ddga-avatar__fallback--destructive",
1239
+ info: "ddga-avatar__fallback--info"
1240
+ }
1241
+ },
1242
+ defaultVariants: {
1243
+ colorScheme: "default"
1244
+ }
1245
+ });
1246
+ function Avatar({ size, shape, status, statusLabel, className, children, ...props }) {
1247
+ return /* @__PURE__ */ jsxs10(
1248
+ AvatarPrimitive.Root,
1249
+ {
1250
+ "data-slot": "avatar",
1251
+ "data-status": status,
1252
+ className: cn(avatarVariants({ size, shape }), className),
1253
+ ...props,
1254
+ children: [
1255
+ children,
1256
+ status ? /* @__PURE__ */ jsx14(
1257
+ "span",
1258
+ {
1259
+ className: cn("ddga-avatar__status", `ddga-avatar__status--${status}`),
1260
+ role: "status",
1261
+ "aria-label": statusLabel ?? status
1262
+ }
1263
+ ) : null
1264
+ ]
1265
+ }
1266
+ );
1267
+ }
1268
+ function AvatarImage({ className, ...props }) {
1269
+ return /* @__PURE__ */ jsx14(
1270
+ AvatarPrimitive.Image,
1271
+ {
1272
+ "data-slot": "avatar-image",
1273
+ className: cn("ddga-avatar__image", className),
1274
+ ...props
1275
+ }
1276
+ );
1277
+ }
1278
+ function AvatarFallback({ colorScheme, className, ...props }) {
1279
+ return /* @__PURE__ */ jsx14(
1280
+ AvatarPrimitive.Fallback,
1281
+ {
1282
+ "data-slot": "avatar-fallback",
1283
+ "data-color-scheme": colorScheme ?? "default",
1284
+ className: cn(fallbackVariants({ colorScheme }), className),
1285
+ ...props
1286
+ }
1287
+ );
1288
+ }
1289
+ function AvatarGroup({ max, size, shape, className, children, ...props }) {
1290
+ const all = Children.toArray(children).filter(isValidElement);
1291
+ const visible = max !== void 0 && all.length > max ? all.slice(0, max) : all;
1292
+ const overflow = max !== void 0 ? Math.max(0, all.length - max) : 0;
1293
+ const cascaded = visible.map(
1294
+ (child, i) => cloneElement(child, {
1295
+ key: child.key ?? i,
1296
+ size: child.props.size ?? size,
1297
+ shape: child.props.shape ?? shape
1298
+ })
1299
+ );
1300
+ return /* @__PURE__ */ jsxs10("div", { "data-slot": "avatar-group", className: cn("ddga-avatar-group", className), ...props, children: [
1301
+ cascaded,
1302
+ overflow > 0 ? /* @__PURE__ */ jsx14(Avatar, { size, shape, "aria-label": `${overflow} more`, children: /* @__PURE__ */ jsxs10(AvatarFallback, { children: [
1303
+ "+",
1304
+ overflow
1305
+ ] }) }) : null
1306
+ ] });
1307
+ }
1308
+
1309
+ // src/components/Tooltip/Tooltip.tsx
1310
+ import { useContext as useContext3 } from "react";
1311
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
1312
+ import { cva as cva13 } from "class-variance-authority";
1313
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1314
+ var tooltipContentVariants = cva13("ddga-tooltip", {
1315
+ variants: {
1316
+ size: {
1317
+ sm: "ddga-tooltip--sm",
1318
+ md: "ddga-tooltip--md"
1319
+ }
1320
+ },
1321
+ defaultVariants: {
1322
+ size: "md"
1323
+ }
1324
+ });
1325
+ function Tooltip(props) {
1326
+ return /* @__PURE__ */ jsx15(TooltipPrimitive.Root, { ...props });
1327
+ }
1328
+ function TooltipTrigger({ className, ...props }) {
1329
+ return /* @__PURE__ */ jsx15(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", className, ...props });
1330
+ }
1331
+ function TooltipContent({
1332
+ size,
1333
+ arrow = true,
1334
+ sideOffset = 6,
1335
+ className,
1336
+ children,
1337
+ ...props
1338
+ }) {
1339
+ const ctx = useContext3(DgaContext);
1340
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
1341
+ return /* @__PURE__ */ jsx15(TooltipPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxs11(
1342
+ TooltipPrimitive.Content,
1343
+ {
1344
+ "data-slot": "tooltip-content",
1345
+ sideOffset,
1346
+ className: cn(tooltipContentVariants({ size }), className),
1347
+ ...props,
1348
+ children: [
1349
+ children,
1350
+ arrow ? /* @__PURE__ */ jsx15(TooltipPrimitive.Arrow, { className: "ddga-tooltip__arrow" }) : null
1351
+ ]
1352
+ }
1353
+ ) });
1354
+ }
1355
+
1356
+ // src/components/Alert/Alert.tsx
1357
+ import { useState as useState2 } from "react";
1358
+ import { Slot as SlotPrimitive4 } from "radix-ui";
1359
+ import { cva as cva14 } from "class-variance-authority";
1360
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1361
+ var alertVariants = cva14("ddga-alert", {
1362
+ variants: {
1363
+ variant: {
1364
+ info: "ddga-alert--info",
1365
+ success: "ddga-alert--success",
1366
+ warning: "ddga-alert--warning",
1367
+ destructive: "ddga-alert--destructive"
1368
+ }
1369
+ },
1370
+ defaultVariants: {
1371
+ variant: "info"
1372
+ }
1373
+ });
1374
+ var DEFAULT_ICONS = {
1375
+ info: /* @__PURE__ */ jsx16(Info, { "aria-hidden": "true" }),
1376
+ success: /* @__PURE__ */ jsx16(Check, { "aria-hidden": "true" }),
1377
+ warning: /* @__PURE__ */ jsx16(AlertTriangle, { "aria-hidden": "true" }),
1378
+ destructive: /* @__PURE__ */ jsx16(AlertCircle, { "aria-hidden": "true" })
1379
+ };
1380
+ function Alert({
1381
+ variant,
1382
+ asChild,
1383
+ icon,
1384
+ dismissible,
1385
+ open: controlledOpen,
1386
+ onDismiss,
1387
+ live,
1388
+ closeLabel = "Dismiss",
1389
+ className,
1390
+ children,
1391
+ ...props
1392
+ }) {
1393
+ const [internalOpen, setInternalOpen] = useState2(true);
1394
+ const isControlled = controlledOpen !== void 0;
1395
+ const open = isControlled ? controlledOpen : internalOpen;
1396
+ if (!open) return null;
1397
+ const Comp = asChild ? SlotPrimitive4.Slot : "div";
1398
+ const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS[variant ?? "info"];
1399
+ const liveProps = live === "assertive" ? { role: "alert", "aria-live": "assertive" } : live === "polite" ? { role: "status", "aria-live": "polite" } : {};
1400
+ function handleDismiss() {
1401
+ if (!isControlled) setInternalOpen(false);
1402
+ onDismiss?.();
1403
+ }
1404
+ return /* @__PURE__ */ jsxs12(
1405
+ Comp,
1406
+ {
1407
+ "data-slot": "alert",
1408
+ "data-variant": variant ?? "info",
1409
+ className: cn(alertVariants({ variant }), className),
1410
+ ...liveProps,
1411
+ ...props,
1412
+ children: [
1413
+ resolvedIcon ? /* @__PURE__ */ jsx16("span", { className: "ddga-alert__icon", children: resolvedIcon }) : null,
1414
+ asChild ? (
1415
+ // Slot mode: the consumer's element receives the children body.
1416
+ // Title/description are nested by the consumer.
1417
+ /* @__PURE__ */ jsx16(SlotPrimitive4.Slottable, { children })
1418
+ ) : /* @__PURE__ */ jsx16("div", { className: "ddga-alert__body", children }),
1419
+ dismissible ? /* @__PURE__ */ jsx16(
1420
+ "button",
1421
+ {
1422
+ type: "button",
1423
+ className: "ddga-alert__close",
1424
+ "aria-label": closeLabel,
1425
+ onClick: handleDismiss,
1426
+ children: /* @__PURE__ */ jsx16(Close, { "aria-hidden": "true" })
1427
+ }
1428
+ ) : null
1429
+ ]
1430
+ }
1431
+ );
1432
+ }
1433
+ function AlertTitle({ asChild, className, ...props }) {
1434
+ const Comp = asChild ? SlotPrimitive4.Slot : "h5";
1435
+ return /* @__PURE__ */ jsx16(Comp, { "data-slot": "alert-title", className: cn("ddga-alert__title", className), ...props });
1436
+ }
1437
+ function AlertDescription({ asChild, className, ...props }) {
1438
+ const Comp = asChild ? SlotPrimitive4.Slot : "p";
1439
+ return /* @__PURE__ */ jsx16(
1440
+ Comp,
1441
+ {
1442
+ "data-slot": "alert-description",
1443
+ className: cn("ddga-alert__description", className),
1444
+ ...props
1445
+ }
1446
+ );
1447
+ }
1448
+
1449
+ // src/components/Modal/Modal.tsx
1450
+ import { useContext as useContext4 } from "react";
1451
+ import { Dialog as DialogPrimitive, Slot as SlotPrimitive5 } from "radix-ui";
1452
+ import { cva as cva15 } from "class-variance-authority";
1453
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1454
+ var modalContentVariants = cva15("ddga-modal", {
1455
+ variants: {
1456
+ size: {
1457
+ sm: "ddga-modal--sm",
1458
+ md: "ddga-modal--md",
1459
+ lg: "ddga-modal--lg",
1460
+ xl: "ddga-modal--xl",
1461
+ full: "ddga-modal--full"
1462
+ }
1463
+ },
1464
+ defaultVariants: {
1465
+ size: "md"
1466
+ }
1467
+ });
1468
+ function Modal(props) {
1469
+ return /* @__PURE__ */ jsx17(DialogPrimitive.Root, { ...props });
1470
+ }
1471
+ function ModalTrigger({ className, ...props }) {
1472
+ return /* @__PURE__ */ jsx17(DialogPrimitive.Trigger, { "data-slot": "modal-trigger", className, ...props });
1473
+ }
1474
+ function ModalContent({
1475
+ size,
1476
+ showCloseButton = true,
1477
+ closeLabel = "Close",
1478
+ className,
1479
+ children,
1480
+ ...props
1481
+ }) {
1482
+ const ctx = useContext4(DgaContext);
1483
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
1484
+ return /* @__PURE__ */ jsxs13(DialogPrimitive.Portal, { container: portalContainer, children: [
1485
+ /* @__PURE__ */ jsx17(DialogPrimitive.Overlay, { className: "ddga-modal__overlay", "data-slot": "modal-overlay" }),
1486
+ /* @__PURE__ */ jsxs13(
1487
+ DialogPrimitive.Content,
1488
+ {
1489
+ "data-slot": "modal-content",
1490
+ className: cn(modalContentVariants({ size }), className),
1491
+ ...props,
1492
+ children: [
1493
+ children,
1494
+ showCloseButton ? /* @__PURE__ */ jsx17(
1495
+ DialogPrimitive.Close,
1496
+ {
1497
+ className: "ddga-modal__close",
1498
+ "aria-label": closeLabel,
1499
+ "data-slot": "modal-close-x",
1500
+ children: /* @__PURE__ */ jsx17(Close, { "aria-hidden": "true" })
1501
+ }
1502
+ ) : null
1503
+ ]
1504
+ }
1505
+ )
1506
+ ] });
1507
+ }
1508
+ function ModalHeader({ asChild, className, ...props }) {
1509
+ const Comp = asChild ? SlotPrimitive5.Slot : "div";
1510
+ return /* @__PURE__ */ jsx17(Comp, { "data-slot": "modal-header", className: cn("ddga-modal__header", className), ...props });
1511
+ }
1512
+ function ModalTitle({ asChild, className, ...props }) {
1513
+ return /* @__PURE__ */ jsx17(
1514
+ DialogPrimitive.Title,
1515
+ {
1516
+ asChild,
1517
+ "data-slot": "modal-title",
1518
+ className: cn("ddga-modal__title", className),
1519
+ ...props
1520
+ }
1521
+ );
1522
+ }
1523
+ function ModalDescription({ asChild, className, ...props }) {
1524
+ return /* @__PURE__ */ jsx17(
1525
+ DialogPrimitive.Description,
1526
+ {
1527
+ asChild,
1528
+ "data-slot": "modal-description",
1529
+ className: cn("ddga-modal__description", className),
1530
+ ...props
1531
+ }
1532
+ );
1533
+ }
1534
+ function ModalFooter({ asChild, className, ...props }) {
1535
+ const Comp = asChild ? SlotPrimitive5.Slot : "div";
1536
+ return /* @__PURE__ */ jsx17(Comp, { "data-slot": "modal-footer", className: cn("ddga-modal__footer", className), ...props });
1537
+ }
1538
+ function ModalClose({ className, ...props }) {
1539
+ return /* @__PURE__ */ jsx17(DialogPrimitive.Close, { "data-slot": "modal-close", className, ...props });
1540
+ }
1541
+
1542
+ // src/components/Toast/Toast.tsx
1543
+ import { useSyncExternalStore } from "react";
1544
+ import { Toast as ToastPrimitive } from "radix-ui";
1545
+ import { cva as cva16 } from "class-variance-authority";
1546
+
1547
+ // src/components/Toast/toast-store.ts
1548
+ import "react";
1549
+ var EXIT_ANIM_MS = 200;
1550
+ function createToastStore() {
1551
+ let toasts = [];
1552
+ const listeners = /* @__PURE__ */ new Set();
1553
+ let counter = 0;
1554
+ function emit() {
1555
+ for (const l of listeners) l();
1556
+ }
1557
+ function subscribe(listener) {
1558
+ listeners.add(listener);
1559
+ return () => {
1560
+ listeners.delete(listener);
1561
+ };
1562
+ }
1563
+ function getSnapshot() {
1564
+ return toasts;
1565
+ }
1566
+ function nextId() {
1567
+ counter += 1;
1568
+ return `t${counter}`;
1569
+ }
1570
+ function add(variant, message, options = {}) {
1571
+ const id = options.id ?? nextId();
1572
+ const existing = toasts.findIndex((t) => t.id === id);
1573
+ const data = {
1574
+ id,
1575
+ variant,
1576
+ open: true,
1577
+ title: message,
1578
+ description: options.description,
1579
+ duration: options.duration,
1580
+ action: options.action,
1581
+ onDismiss: options.onDismiss
1582
+ };
1583
+ if (existing >= 0) {
1584
+ toasts = toasts.map((t, i) => i === existing ? data : t);
1585
+ } else {
1586
+ toasts = [...toasts, data];
1587
+ }
1588
+ emit();
1589
+ return id;
1590
+ }
1591
+ function dismiss(id) {
1592
+ if (id === void 0) {
1593
+ const ids = toasts.map((t) => t.id);
1594
+ toasts = toasts.map((t) => ({ ...t, open: false }));
1595
+ emit();
1596
+ setTimeout(() => {
1597
+ ids.forEach((id2) => remove(id2));
1598
+ }, EXIT_ANIM_MS);
1599
+ } else {
1600
+ toasts = toasts.map((t) => t.id === id ? { ...t, open: false } : t);
1601
+ emit();
1602
+ setTimeout(() => remove(id), EXIT_ANIM_MS);
1603
+ }
1604
+ }
1605
+ function remove(id) {
1606
+ const target = toasts.find((t) => t.id === id);
1607
+ toasts = toasts.filter((t) => t.id !== id);
1608
+ emit();
1609
+ target?.onDismiss?.();
1610
+ }
1611
+ function __reset() {
1612
+ toasts = [];
1613
+ counter = 0;
1614
+ emit();
1615
+ }
1616
+ return { subscribe, getSnapshot, add, dismiss, remove, __reset };
1617
+ }
1618
+ var toastStore = createToastStore();
1619
+ function createToast(store) {
1620
+ const fn = ((message, options) => store.add("default", message, options));
1621
+ fn.default = (message, options) => store.add("default", message, options);
1622
+ fn.info = (message, options) => store.add("info", message, options);
1623
+ fn.success = (message, options) => store.add("success", message, options);
1624
+ fn.warning = (message, options) => store.add("warning", message, options);
1625
+ fn.error = (message, options) => store.add("destructive", message, options);
1626
+ fn.destructive = fn.error;
1627
+ fn.dismiss = (id) => store.dismiss(id);
1628
+ return fn;
1629
+ }
1630
+ var toast = createToast(toastStore);
1631
+
1632
+ // src/components/Toast/Toast.tsx
1633
+ import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
1634
+ var toastVariants = cva16("ddga-toast", {
1635
+ variants: {
1636
+ variant: {
1637
+ default: "ddga-toast--default",
1638
+ info: "ddga-toast--info",
1639
+ success: "ddga-toast--success",
1640
+ warning: "ddga-toast--warning",
1641
+ destructive: "ddga-toast--destructive"
1642
+ }
1643
+ },
1644
+ defaultVariants: {
1645
+ variant: "default"
1646
+ }
1647
+ });
1648
+ var toastViewportVariants = cva16("ddga-toast-viewport", {
1649
+ variants: {
1650
+ position: {
1651
+ "top-start": "ddga-toast-viewport--top-start",
1652
+ "top-center": "ddga-toast-viewport--top-center",
1653
+ "top-end": "ddga-toast-viewport--top-end",
1654
+ "bottom-start": "ddga-toast-viewport--bottom-start",
1655
+ "bottom-center": "ddga-toast-viewport--bottom-center",
1656
+ "bottom-end": "ddga-toast-viewport--bottom-end"
1657
+ },
1658
+ containerized: {
1659
+ true: "ddga-toast-viewport--containerized"
1660
+ }
1661
+ },
1662
+ defaultVariants: {
1663
+ position: "bottom-end"
1664
+ }
1665
+ });
1666
+ var DEFAULT_ICONS2 = {
1667
+ default: null,
1668
+ info: /* @__PURE__ */ jsx18(Info, { "aria-hidden": "true" }),
1669
+ success: /* @__PURE__ */ jsx18(Check, { "aria-hidden": "true" }),
1670
+ warning: /* @__PURE__ */ jsx18(AlertTriangle, { "aria-hidden": "true" }),
1671
+ destructive: /* @__PURE__ */ jsx18(AlertCircle, { "aria-hidden": "true" })
1672
+ };
1673
+ function Toaster({
1674
+ position = "bottom-end",
1675
+ containerized = false,
1676
+ duration = 4e3,
1677
+ closeButton = true,
1678
+ closeLabel = "Dismiss",
1679
+ hideIcon = false,
1680
+ className,
1681
+ swipeDirection,
1682
+ store = toastStore
1683
+ }) {
1684
+ const toasts = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
1685
+ const resolvedSwipe = swipeDirection ?? (position.startsWith("top") ? "up" : "down");
1686
+ return /* @__PURE__ */ jsxs14(ToastPrimitive.Provider, { duration, swipeDirection: resolvedSwipe, children: [
1687
+ toasts.map((t) => /* @__PURE__ */ jsx18(
1688
+ ToastItem,
1689
+ {
1690
+ toast: t,
1691
+ store,
1692
+ closeButton,
1693
+ closeLabel,
1694
+ hideIcon
1695
+ },
1696
+ t.id
1697
+ )),
1698
+ /* @__PURE__ */ jsx18(
1699
+ ToastPrimitive.Viewport,
1700
+ {
1701
+ "data-slot": "toast-viewport",
1702
+ "data-position": position,
1703
+ className: cn(toastViewportVariants({ position, containerized }), className)
1704
+ }
1705
+ )
1706
+ ] });
1707
+ }
1708
+ function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
1709
+ const radixType = t.variant === "destructive" ? "foreground" : "background";
1710
+ const icon = hideIcon ? null : DEFAULT_ICONS2[t.variant];
1711
+ return /* @__PURE__ */ jsxs14(
1712
+ ToastPrimitive.Root,
1713
+ {
1714
+ "data-slot": "toast",
1715
+ "data-variant": t.variant,
1716
+ className: toastVariants({ variant: t.variant }),
1717
+ open: t.open,
1718
+ type: radixType,
1719
+ duration: t.duration,
1720
+ onOpenChange: (open) => {
1721
+ if (!open) {
1722
+ store.dismiss(t.id);
1723
+ }
1724
+ },
1725
+ children: [
1726
+ icon ? /* @__PURE__ */ jsx18("span", { className: "ddga-toast__icon", children: icon }) : null,
1727
+ /* @__PURE__ */ jsxs14("div", { className: "ddga-toast__body", children: [
1728
+ t.title ? /* @__PURE__ */ jsx18(ToastPrimitive.Title, { className: "ddga-toast__title", children: t.title }) : null,
1729
+ t.description ? /* @__PURE__ */ jsx18(ToastPrimitive.Description, { className: "ddga-toast__description", children: t.description }) : null,
1730
+ t.action ? /* @__PURE__ */ jsx18(
1731
+ ToastPrimitive.Action,
1732
+ {
1733
+ className: "ddga-toast__action",
1734
+ altText: t.action.altText ?? (typeof t.action.label === "string" ? t.action.label : "Action"),
1735
+ onClick: () => {
1736
+ t.action?.onClick();
1737
+ store.dismiss(t.id);
1738
+ },
1739
+ children: t.action.label
1740
+ }
1741
+ ) : null
1742
+ ] }),
1743
+ closeButton ? /* @__PURE__ */ jsx18(ToastPrimitive.Close, { className: "ddga-toast__close", "aria-label": closeLabel, children: /* @__PURE__ */ jsx18(Close, { "aria-hidden": "true" }) }) : null
1744
+ ]
1745
+ }
1746
+ );
1747
+ }
1748
+
1749
+ // src/components/Tabs/Tabs.tsx
1750
+ import { Tabs as TabsPrimitive } from "radix-ui";
1751
+ import { cva as cva17 } from "class-variance-authority";
1752
+ import { jsx as jsx19 } from "react/jsx-runtime";
1753
+ var tabsVariants = cva17("ddga-tabs", {
1754
+ variants: {
1755
+ variant: {
1756
+ line: "ddga-tabs--line",
1757
+ pill: "ddga-tabs--pill"
1758
+ },
1759
+ size: {
1760
+ sm: "ddga-tabs--sm",
1761
+ md: "ddga-tabs--md"
1762
+ }
1763
+ },
1764
+ defaultVariants: {
1765
+ variant: "line",
1766
+ size: "md"
1767
+ }
1768
+ });
1769
+ var tabsListVariants = cva17("ddga-tabs__list", {
1770
+ variants: {
1771
+ fullWidth: {
1772
+ true: "ddga-tabs__list--full-width"
1773
+ }
1774
+ }
1775
+ });
1776
+ function Tabs({ variant, size, className, ...props }) {
1777
+ return /* @__PURE__ */ jsx19(
1778
+ TabsPrimitive.Root,
1779
+ {
1780
+ "data-slot": "tabs",
1781
+ className: cn(tabsVariants({ variant, size }), className),
1782
+ ...props
1783
+ }
1784
+ );
1785
+ }
1786
+ function TabsList({ fullWidth, className, ...props }) {
1787
+ return /* @__PURE__ */ jsx19(
1788
+ TabsPrimitive.List,
1789
+ {
1790
+ "data-slot": "tabs-list",
1791
+ className: cn(tabsListVariants({ fullWidth }), className),
1792
+ ...props
1793
+ }
1794
+ );
1795
+ }
1796
+ function TabsTrigger({ className, ...props }) {
1797
+ return /* @__PURE__ */ jsx19(
1798
+ TabsPrimitive.Trigger,
1799
+ {
1800
+ "data-slot": "tabs-trigger",
1801
+ className: cn("ddga-tabs__trigger", className),
1802
+ ...props
1803
+ }
1804
+ );
1805
+ }
1806
+ function TabsContent({ className, ...props }) {
1807
+ return /* @__PURE__ */ jsx19(
1808
+ TabsPrimitive.Content,
1809
+ {
1810
+ "data-slot": "tabs-content",
1811
+ className: cn("ddga-tabs__content", className),
1812
+ ...props
1813
+ }
1814
+ );
1815
+ }
1816
+
1817
+ // src/components/Breadcrumb/Breadcrumb.tsx
1818
+ import { Slot as SlotPrimitive6 } from "radix-ui";
1819
+ import { cva as cva18 } from "class-variance-authority";
1820
+ import { jsx as jsx20 } from "react/jsx-runtime";
1821
+ var breadcrumbVariants = cva18("ddga-breadcrumb", {
1822
+ variants: {
1823
+ size: {
1824
+ sm: "ddga-breadcrumb--sm",
1825
+ md: "ddga-breadcrumb--md"
1826
+ }
1827
+ },
1828
+ defaultVariants: {
1829
+ size: "md"
1830
+ }
1831
+ });
1832
+ function Breadcrumb({ size, className, ...props }) {
1833
+ return /* @__PURE__ */ jsx20(
1834
+ "nav",
1835
+ {
1836
+ "aria-label": "Breadcrumb",
1837
+ "data-slot": "breadcrumb",
1838
+ className: cn(breadcrumbVariants({ size }), className),
1839
+ ...props
1840
+ }
1841
+ );
1842
+ }
1843
+ function BreadcrumbList({ className, ...props }) {
1844
+ return /* @__PURE__ */ jsx20("ol", { "data-slot": "breadcrumb-list", className: cn("ddga-breadcrumb__list", className), ...props });
1845
+ }
1846
+ function BreadcrumbItem({ className, ...props }) {
1847
+ return /* @__PURE__ */ jsx20("li", { "data-slot": "breadcrumb-item", className: cn("ddga-breadcrumb__item", className), ...props });
1848
+ }
1849
+ function BreadcrumbLink({ asChild, className, ...props }) {
1850
+ const Comp = asChild ? SlotPrimitive6.Slot : "a";
1851
+ return /* @__PURE__ */ jsx20(
1852
+ Comp,
1853
+ {
1854
+ "data-slot": "breadcrumb-link",
1855
+ className: cn("ddga-breadcrumb__link", className),
1856
+ ...props
1857
+ }
1858
+ );
1859
+ }
1860
+ function BreadcrumbPage({ asChild, className, ...props }) {
1861
+ const Comp = asChild ? SlotPrimitive6.Slot : "span";
1862
+ return /* @__PURE__ */ jsx20(
1863
+ Comp,
1864
+ {
1865
+ "aria-current": "page",
1866
+ "data-slot": "breadcrumb-page",
1867
+ className: cn("ddga-breadcrumb__page", className),
1868
+ ...props
1869
+ }
1870
+ );
1871
+ }
1872
+ function BreadcrumbSeparator({ children, className, ...props }) {
1873
+ return /* @__PURE__ */ jsx20(
1874
+ "li",
1875
+ {
1876
+ role: "presentation",
1877
+ "aria-hidden": "true",
1878
+ "data-slot": "breadcrumb-separator",
1879
+ className: cn("ddga-breadcrumb__separator", className),
1880
+ ...props,
1881
+ children: children ?? /* @__PURE__ */ jsx20(ChevronRight, {})
1882
+ }
1883
+ );
1884
+ }
1885
+ function BreadcrumbEllipsis({ className, ...props }) {
1886
+ return /* @__PURE__ */ jsx20(
1887
+ "span",
1888
+ {
1889
+ role: "presentation",
1890
+ "aria-hidden": "true",
1891
+ "data-slot": "breadcrumb-ellipsis",
1892
+ className: cn("ddga-breadcrumb__ellipsis", className),
1893
+ ...props,
1894
+ children: /* @__PURE__ */ jsx20(MoreHorizontal, {})
1895
+ }
1896
+ );
1897
+ }
1898
+
1899
+ // src/components/Pagination/Pagination.tsx
1900
+ import { Slot as SlotPrimitive7 } from "radix-ui";
1901
+ import { cva as cva19 } from "class-variance-authority";
1902
+ import { Fragment, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1903
+ var paginationVariants = cva19("ddga-pagination", {
1904
+ variants: {
1905
+ size: {
1906
+ sm: "ddga-pagination--sm",
1907
+ md: "ddga-pagination--md"
1908
+ }
1909
+ },
1910
+ defaultVariants: {
1911
+ size: "md"
1912
+ }
1913
+ });
1914
+ var paginationLinkVariants = cva19("ddga-pagination__link", {
1915
+ variants: {
1916
+ isActive: {
1917
+ true: "ddga-pagination__link--active"
1918
+ }
1919
+ }
1920
+ });
1921
+ function Pagination({ size, className, ...props }) {
1922
+ return /* @__PURE__ */ jsx21(
1923
+ "nav",
1924
+ {
1925
+ "aria-label": "pagination",
1926
+ "data-slot": "pagination",
1927
+ className: cn(paginationVariants({ size }), className),
1928
+ ...props
1929
+ }
1930
+ );
1931
+ }
1932
+ function PaginationContent({ className, ...props }) {
1933
+ return /* @__PURE__ */ jsx21(
1934
+ "ul",
1935
+ {
1936
+ "data-slot": "pagination-content",
1937
+ className: cn("ddga-pagination__content", className),
1938
+ ...props
1939
+ }
1940
+ );
1941
+ }
1942
+ function PaginationItem({ className, ...props }) {
1943
+ return /* @__PURE__ */ jsx21("li", { "data-slot": "pagination-item", className: cn("ddga-pagination__item", className), ...props });
1944
+ }
1945
+ function PaginationLink({ asChild, isActive, className, ...props }) {
1946
+ const Comp = asChild ? SlotPrimitive7.Slot : "a";
1947
+ return /* @__PURE__ */ jsx21(
1948
+ Comp,
1949
+ {
1950
+ "aria-current": isActive ? "page" : void 0,
1951
+ "data-slot": "pagination-link",
1952
+ "data-active": isActive ? "" : void 0,
1953
+ className: cn(paginationLinkVariants({ isActive }), className),
1954
+ ...props
1955
+ }
1956
+ );
1957
+ }
1958
+ function PaginationPrevious({
1959
+ label = "Previous",
1960
+ className,
1961
+ children,
1962
+ asChild,
1963
+ ...props
1964
+ }) {
1965
+ return /* @__PURE__ */ jsx21(
1966
+ PaginationLink,
1967
+ {
1968
+ asChild,
1969
+ "aria-label": label,
1970
+ "data-slot": "pagination-previous",
1971
+ className: cn("ddga-pagination__nav", "ddga-pagination__nav--previous", className),
1972
+ ...props,
1973
+ children: children ?? /* @__PURE__ */ jsxs15(Fragment, { children: [
1974
+ /* @__PURE__ */ jsx21(ChevronRight, { className: "ddga-pagination__nav-icon ddga-pagination__nav-icon--previous" }),
1975
+ /* @__PURE__ */ jsx21("span", { children: label })
1976
+ ] })
1977
+ }
1978
+ );
1979
+ }
1980
+ function PaginationNext({
1981
+ label = "Next",
1982
+ className,
1983
+ children,
1984
+ asChild,
1985
+ ...props
1986
+ }) {
1987
+ return /* @__PURE__ */ jsx21(
1988
+ PaginationLink,
1989
+ {
1990
+ asChild,
1991
+ "aria-label": label,
1992
+ "data-slot": "pagination-next",
1993
+ className: cn("ddga-pagination__nav", "ddga-pagination__nav--next", className),
1994
+ ...props,
1995
+ children: children ?? /* @__PURE__ */ jsxs15(Fragment, { children: [
1996
+ /* @__PURE__ */ jsx21("span", { children: label }),
1997
+ /* @__PURE__ */ jsx21(ChevronRight, { className: "ddga-pagination__nav-icon ddga-pagination__nav-icon--next" })
1998
+ ] })
1999
+ }
2000
+ );
2001
+ }
2002
+ function PaginationEllipsis({ className, ...props }) {
2003
+ return /* @__PURE__ */ jsx21(
2004
+ "span",
2005
+ {
2006
+ role: "presentation",
2007
+ "aria-hidden": "true",
2008
+ "data-slot": "pagination-ellipsis",
2009
+ className: cn("ddga-pagination__ellipsis", className),
2010
+ ...props,
2011
+ children: /* @__PURE__ */ jsx21(MoreHorizontal, {})
2012
+ }
2013
+ );
2014
+ }
2015
+
2016
+ // src/components/Accordion/Accordion.tsx
2017
+ import { Accordion as AccordionPrimitive } from "radix-ui";
2018
+ import { cva as cva20 } from "class-variance-authority";
2019
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
2020
+ var accordionVariants = cva20("ddga-accordion", {
2021
+ variants: {
2022
+ size: {
2023
+ sm: "ddga-accordion--sm",
2024
+ md: "ddga-accordion--md"
2025
+ }
2026
+ },
2027
+ defaultVariants: {
2028
+ size: "md"
2029
+ }
2030
+ });
2031
+ function Accordion({ size, className, ...props }) {
2032
+ return /* @__PURE__ */ jsx22(
2033
+ AccordionPrimitive.Root,
2034
+ {
2035
+ "data-slot": "accordion",
2036
+ className: cn(accordionVariants({ size }), className),
2037
+ ...props
2038
+ }
2039
+ );
2040
+ }
2041
+ function AccordionItem({ className, ...props }) {
2042
+ return /* @__PURE__ */ jsx22(
2043
+ AccordionPrimitive.Item,
2044
+ {
2045
+ "data-slot": "accordion-item",
2046
+ className: cn("ddga-accordion__item", className),
2047
+ ...props
2048
+ }
2049
+ );
2050
+ }
2051
+ function AccordionTrigger({ className, children, ...props }) {
2052
+ return /* @__PURE__ */ jsx22(AccordionPrimitive.Header, { className: "ddga-accordion__header", children: /* @__PURE__ */ jsxs16(
2053
+ AccordionPrimitive.Trigger,
2054
+ {
2055
+ "data-slot": "accordion-trigger",
2056
+ className: cn("ddga-accordion__trigger", className),
2057
+ ...props,
2058
+ children: [
2059
+ children,
2060
+ /* @__PURE__ */ jsx22(
2061
+ ChevronDown,
2062
+ {
2063
+ "aria-hidden": "true",
2064
+ className: "ddga-accordion__chevron",
2065
+ "data-slot": "accordion-chevron"
2066
+ }
2067
+ )
2068
+ ]
2069
+ }
2070
+ ) });
2071
+ }
2072
+ function AccordionContent({ className, children, ...props }) {
2073
+ return /* @__PURE__ */ jsx22(
2074
+ AccordionPrimitive.Content,
2075
+ {
2076
+ "data-slot": "accordion-content",
2077
+ className: cn("ddga-accordion__content", className),
2078
+ ...props,
2079
+ children: /* @__PURE__ */ jsx22("div", { className: "ddga-accordion__content-inner", children })
2080
+ }
2081
+ );
2082
+ }
2083
+
2084
+ // src/components/Steps/Steps.tsx
2085
+ import { cva as cva21 } from "class-variance-authority";
2086
+ import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
2087
+ var stepsVariants = cva21("ddga-steps", {
2088
+ variants: {
2089
+ size: {
2090
+ sm: "ddga-steps--sm",
2091
+ md: "ddga-steps--md"
2092
+ },
2093
+ orientation: {
2094
+ horizontal: "ddga-steps--horizontal",
2095
+ vertical: "ddga-steps--vertical"
2096
+ }
2097
+ },
2098
+ defaultVariants: {
2099
+ size: "md",
2100
+ orientation: "horizontal"
2101
+ }
2102
+ });
2103
+ var stepVariants = cva21("ddga-steps__step", {
2104
+ variants: {
2105
+ state: {
2106
+ completed: "ddga-steps__step--completed",
2107
+ current: "ddga-steps__step--current",
2108
+ upcoming: "ddga-steps__step--upcoming"
2109
+ }
2110
+ },
2111
+ defaultVariants: {
2112
+ state: "upcoming"
2113
+ }
2114
+ });
2115
+ function Steps({ size, orientation, className, ...props }) {
2116
+ return /* @__PURE__ */ jsx23(
2117
+ "ol",
2118
+ {
2119
+ "data-slot": "steps",
2120
+ "data-orientation": orientation ?? "horizontal",
2121
+ className: cn(stepsVariants({ size, orientation }), className),
2122
+ ...props
2123
+ }
2124
+ );
2125
+ }
2126
+ function Step({ state, className, ...props }) {
2127
+ return /* @__PURE__ */ jsx23(
2128
+ "li",
2129
+ {
2130
+ "aria-current": state === "current" ? "step" : void 0,
2131
+ "data-slot": "step",
2132
+ "data-state": state ?? "upcoming",
2133
+ className: cn(stepVariants({ state }), className),
2134
+ ...props
2135
+ }
2136
+ );
2137
+ }
2138
+ function StepIndicator({ step, className, ...props }) {
2139
+ return /* @__PURE__ */ jsxs17(
2140
+ "span",
2141
+ {
2142
+ "aria-hidden": "true",
2143
+ "data-slot": "step-indicator",
2144
+ className: cn("ddga-steps__indicator", className),
2145
+ ...props,
2146
+ children: [
2147
+ /* @__PURE__ */ jsx23(Check, { className: "ddga-steps__indicator-check" }),
2148
+ /* @__PURE__ */ jsx23("span", { className: "ddga-steps__indicator-number", children: step })
2149
+ ]
2150
+ }
2151
+ );
2152
+ }
2153
+ function StepTitle({ className, ...props }) {
2154
+ return /* @__PURE__ */ jsx23("span", { "data-slot": "step-title", className: cn("ddga-steps__title", className), ...props });
2155
+ }
2156
+ function StepDescription({ className, ...props }) {
2157
+ return /* @__PURE__ */ jsx23(
2158
+ "span",
2159
+ {
2160
+ "data-slot": "step-description",
2161
+ className: cn("ddga-steps__description", className),
2162
+ ...props
2163
+ }
2164
+ );
2165
+ }
2166
+
2167
+ // src/components/Skeleton/Skeleton.tsx
2168
+ import { cva as cva22 } from "class-variance-authority";
2169
+ import { jsx as jsx24 } from "react/jsx-runtime";
2170
+ var skeletonVariants = cva22("ddga-skeleton", {
2171
+ variants: {
2172
+ shape: {
2173
+ text: "ddga-skeleton--text",
2174
+ circle: "ddga-skeleton--circle",
2175
+ rectangle: "ddga-skeleton--rectangle"
2176
+ },
2177
+ animation: {
2178
+ pulse: "ddga-skeleton--pulse",
2179
+ wave: "ddga-skeleton--wave",
2180
+ none: "ddga-skeleton--none"
2181
+ }
2182
+ },
2183
+ defaultVariants: {
2184
+ shape: "text",
2185
+ animation: "pulse"
2186
+ }
2187
+ });
2188
+ function Skeleton({ shape, animation, width, height, className, style, ...props }) {
2189
+ const sizeStyle = {
2190
+ ...width !== void 0 ? { width: typeof width === "number" ? `${width}px` : width } : null,
2191
+ ...height !== void 0 ? { height: typeof height === "number" ? `${height}px` : height } : null,
2192
+ ...style
2193
+ };
2194
+ return /* @__PURE__ */ jsx24(
2195
+ "div",
2196
+ {
2197
+ "data-slot": "skeleton",
2198
+ "aria-hidden": "true",
2199
+ className: cn(skeletonVariants({ shape, animation }), className),
2200
+ style: sizeStyle,
2201
+ ...props
2202
+ }
2203
+ );
2204
+ }
2205
+
2206
+ // src/components/Progress/Progress.tsx
2207
+ import { Progress as ProgressPrimitive } from "radix-ui";
2208
+ import { cva as cva23 } from "class-variance-authority";
2209
+ import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
2210
+ var progressVariants = cva23("ddga-progress", {
2211
+ variants: {
2212
+ size: {
2213
+ sm: "ddga-progress--sm",
2214
+ md: "ddga-progress--md",
2215
+ lg: "ddga-progress--lg"
2216
+ },
2217
+ color: {
2218
+ primary: "ddga-progress--primary",
2219
+ success: "ddga-progress--success",
2220
+ warning: "ddga-progress--warning",
2221
+ destructive: "ddga-progress--destructive"
2222
+ }
2223
+ },
2224
+ defaultVariants: {
2225
+ size: "md",
2226
+ color: "primary"
2227
+ }
2228
+ });
2229
+ var circularProgressVariants = cva23("ddga-circular-progress", {
2230
+ variants: {
2231
+ size: {
2232
+ sm: "ddga-circular-progress--sm",
2233
+ md: "ddga-circular-progress--md",
2234
+ lg: "ddga-circular-progress--lg"
2235
+ },
2236
+ color: {
2237
+ primary: "ddga-circular-progress--primary",
2238
+ success: "ddga-circular-progress--success",
2239
+ warning: "ddga-circular-progress--warning",
2240
+ destructive: "ddga-circular-progress--destructive"
2241
+ }
2242
+ },
2243
+ defaultVariants: {
2244
+ size: "md",
2245
+ color: "primary"
2246
+ }
2247
+ });
2248
+ function Progress({ value = null, max = 100, size, color, className, ...props }) {
2249
+ const isIndeterminate = value === null;
2250
+ const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
2251
+ return /* @__PURE__ */ jsx25(
2252
+ ProgressPrimitive.Root,
2253
+ {
2254
+ "data-slot": "progress",
2255
+ value,
2256
+ max,
2257
+ className: cn(progressVariants({ size, color }), className),
2258
+ ...props,
2259
+ children: /* @__PURE__ */ jsx25(
2260
+ ProgressPrimitive.Indicator,
2261
+ {
2262
+ "data-slot": "progress-indicator",
2263
+ className: "ddga-progress__indicator",
2264
+ style: isIndeterminate ? void 0 : { transform: `translateX(${pct - 100}%)` }
2265
+ }
2266
+ )
2267
+ }
2268
+ );
2269
+ }
2270
+ var CIRCULAR_SIZES = { sm: 32, md: 48, lg: 72 };
2271
+ var CIRCULAR_DEFAULT_THICKNESS = { sm: 4, md: 5, lg: 6 };
2272
+ function CircularProgress({
2273
+ value = null,
2274
+ max = 100,
2275
+ size,
2276
+ color,
2277
+ thickness,
2278
+ showLabel = false,
2279
+ className,
2280
+ ...props
2281
+ }) {
2282
+ const isIndeterminate = value === null;
2283
+ const sizeKey = size ?? "md";
2284
+ const diameter = CIRCULAR_SIZES[sizeKey];
2285
+ const strokeWidth = thickness ?? CIRCULAR_DEFAULT_THICKNESS[sizeKey];
2286
+ const radius = (diameter - strokeWidth) / 2;
2287
+ const circumference = 2 * Math.PI * radius;
2288
+ const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
2289
+ const dashOffset = isIndeterminate ? circumference * 0.75 : circumference * (1 - pct / 100);
2290
+ const state = isIndeterminate ? "indeterminate" : value >= max ? "complete" : "loading";
2291
+ return /* @__PURE__ */ jsxs18(
2292
+ "div",
2293
+ {
2294
+ "data-slot": "circular-progress",
2295
+ "data-state": state,
2296
+ role: "progressbar",
2297
+ "aria-valuemin": 0,
2298
+ "aria-valuemax": max,
2299
+ "aria-valuenow": isIndeterminate ? void 0 : value,
2300
+ className: cn(circularProgressVariants({ size, color }), className),
2301
+ style: { inlineSize: diameter, blockSize: diameter },
2302
+ ...props,
2303
+ children: [
2304
+ /* @__PURE__ */ jsxs18(
2305
+ "svg",
2306
+ {
2307
+ className: "ddga-circular-progress__svg",
2308
+ viewBox: `0 0 ${diameter} ${diameter}`,
2309
+ width: diameter,
2310
+ height: diameter,
2311
+ "aria-hidden": "true",
2312
+ focusable: "false",
2313
+ children: [
2314
+ /* @__PURE__ */ jsx25(
2315
+ "circle",
2316
+ {
2317
+ className: "ddga-circular-progress__track",
2318
+ cx: diameter / 2,
2319
+ cy: diameter / 2,
2320
+ r: radius,
2321
+ fill: "none",
2322
+ strokeWidth
2323
+ }
2324
+ ),
2325
+ /* @__PURE__ */ jsx25(
2326
+ "circle",
2327
+ {
2328
+ className: "ddga-circular-progress__indicator",
2329
+ cx: diameter / 2,
2330
+ cy: diameter / 2,
2331
+ r: radius,
2332
+ fill: "none",
2333
+ strokeWidth,
2334
+ strokeLinecap: "round",
2335
+ strokeDasharray: circumference,
2336
+ strokeDashoffset: dashOffset,
2337
+ transform: `rotate(-90 ${diameter / 2} ${diameter / 2})`
2338
+ }
2339
+ )
2340
+ ]
2341
+ }
2342
+ ),
2343
+ showLabel && !isIndeterminate ? /* @__PURE__ */ jsxs18("span", { className: "ddga-circular-progress__label", "aria-hidden": "true", children: [
2344
+ Math.round(pct),
2345
+ "%"
2346
+ ] }) : null
2347
+ ]
2348
+ }
2349
+ );
2350
+ }
2351
+
2352
+ // src/components/DropdownMenu/DropdownMenu.tsx
2353
+ import { useContext as useContext5 } from "react";
2354
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
2355
+ import { cva as cva24 } from "class-variance-authority";
2356
+ import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
2357
+ var dropdownMenuVariants = cva24("ddga-dropdown-menu", {
2358
+ variants: {
2359
+ size: {
2360
+ sm: "ddga-dropdown-menu--sm",
2361
+ md: "ddga-dropdown-menu--md"
2362
+ }
2363
+ },
2364
+ defaultVariants: {
2365
+ size: "md"
2366
+ }
2367
+ });
2368
+ function DropdownMenu(props) {
2369
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Root, { ...props });
2370
+ }
2371
+ function DropdownMenuTrigger(props) {
2372
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
2373
+ }
2374
+ function DropdownMenuContent({
2375
+ size,
2376
+ className,
2377
+ sideOffset = 6,
2378
+ ...props
2379
+ }) {
2380
+ const ctx = useContext5(DgaContext);
2381
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
2382
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx26(
2383
+ DropdownMenuPrimitive.Content,
2384
+ {
2385
+ "data-slot": "dropdown-menu-content",
2386
+ sideOffset,
2387
+ className: cn(dropdownMenuVariants({ size }), className),
2388
+ ...props
2389
+ }
2390
+ ) });
2391
+ }
2392
+ function DropdownMenuItem({
2393
+ className,
2394
+ destructive,
2395
+ startIcon,
2396
+ shortcut,
2397
+ children,
2398
+ ...props
2399
+ }) {
2400
+ return /* @__PURE__ */ jsxs19(
2401
+ DropdownMenuPrimitive.Item,
2402
+ {
2403
+ "data-slot": "dropdown-menu-item",
2404
+ "data-destructive": destructive ? "" : void 0,
2405
+ className: cn("ddga-dropdown-menu__item", className),
2406
+ ...props,
2407
+ children: [
2408
+ startIcon ? /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
2409
+ /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children }),
2410
+ shortcut ? /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__shortcut", "aria-hidden": "true", children: shortcut }) : null
2411
+ ]
2412
+ }
2413
+ );
2414
+ }
2415
+ function DropdownMenuCheckboxItem({
2416
+ className,
2417
+ children,
2418
+ onSelect,
2419
+ ...props
2420
+ }) {
2421
+ const handleSelect = onSelect ?? ((event) => {
2422
+ event.preventDefault();
2423
+ });
2424
+ return /* @__PURE__ */ jsxs19(
2425
+ DropdownMenuPrimitive.CheckboxItem,
2426
+ {
2427
+ "data-slot": "dropdown-menu-checkbox-item",
2428
+ className: cn("ddga-dropdown-menu__item", "ddga-dropdown-menu__item--checkable", className),
2429
+ onSelect: handleSelect,
2430
+ ...props,
2431
+ children: [
2432
+ /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx26(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx26(Check, { className: "ddga-dropdown-menu__indicator-icon" }) }) }),
2433
+ /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children })
2434
+ ]
2435
+ }
2436
+ );
2437
+ }
2438
+ function DropdownMenuRadioGroup(props) {
2439
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
2440
+ }
2441
+ function DropdownMenuRadioItem({
2442
+ className,
2443
+ children,
2444
+ onSelect,
2445
+ ...props
2446
+ }) {
2447
+ const handleSelect = onSelect ?? ((event) => {
2448
+ event.preventDefault();
2449
+ });
2450
+ return /* @__PURE__ */ jsxs19(
2451
+ DropdownMenuPrimitive.RadioItem,
2452
+ {
2453
+ "data-slot": "dropdown-menu-radio-item",
2454
+ className: cn("ddga-dropdown-menu__item", "ddga-dropdown-menu__item--checkable", className),
2455
+ onSelect: handleSelect,
2456
+ ...props,
2457
+ children: [
2458
+ /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx26(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__radio-dot" }) }) }),
2459
+ /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children })
2460
+ ]
2461
+ }
2462
+ );
2463
+ }
2464
+ function DropdownMenuLabel({ className, ...props }) {
2465
+ return /* @__PURE__ */ jsx26(
2466
+ DropdownMenuPrimitive.Label,
2467
+ {
2468
+ "data-slot": "dropdown-menu-label",
2469
+ className: cn("ddga-dropdown-menu__group-label", className),
2470
+ ...props
2471
+ }
2472
+ );
2473
+ }
2474
+ function DropdownMenuSeparator({ className, ...props }) {
2475
+ return /* @__PURE__ */ jsx26(
2476
+ DropdownMenuPrimitive.Separator,
2477
+ {
2478
+ "data-slot": "dropdown-menu-separator",
2479
+ className: cn("ddga-dropdown-menu__separator", className),
2480
+ ...props
2481
+ }
2482
+ );
2483
+ }
2484
+ function DropdownMenuGroup(props) {
2485
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
2486
+ }
2487
+ function DropdownMenuSub(props) {
2488
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Sub, { ...props });
2489
+ }
2490
+ function DropdownMenuSubTrigger({
2491
+ className,
2492
+ startIcon,
2493
+ children,
2494
+ ...props
2495
+ }) {
2496
+ return /* @__PURE__ */ jsxs19(
2497
+ DropdownMenuPrimitive.SubTrigger,
2498
+ {
2499
+ "data-slot": "dropdown-menu-sub-trigger",
2500
+ className: cn("ddga-dropdown-menu__item", "ddga-dropdown-menu__item--sub", className),
2501
+ ...props,
2502
+ children: [
2503
+ startIcon ? /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
2504
+ /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children }),
2505
+ /* @__PURE__ */ jsx26(ChevronRight, { className: "ddga-dropdown-menu__sub-chevron", "aria-hidden": "true" })
2506
+ ]
2507
+ }
2508
+ );
2509
+ }
2510
+ function DropdownMenuSubContent({ size, className, ...props }) {
2511
+ const ctx = useContext5(DgaContext);
2512
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
2513
+ return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx26(
2514
+ DropdownMenuPrimitive.SubContent,
2515
+ {
2516
+ "data-slot": "dropdown-menu-sub-content",
2517
+ className: cn(dropdownMenuVariants({ size }), className),
2518
+ ...props
2519
+ }
2520
+ ) });
2521
+ }
2522
+
2523
+ // src/components/Drawer/Drawer.tsx
2524
+ import { useContext as useContext6 } from "react";
2525
+ import { Dialog as DialogPrimitive2, Slot as SlotPrimitive8 } from "radix-ui";
2526
+ import { cva as cva25 } from "class-variance-authority";
2527
+ import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
2528
+ var drawerVariants = cva25("ddga-drawer", {
2529
+ variants: {
2530
+ side: {
2531
+ start: "ddga-drawer--start",
2532
+ end: "ddga-drawer--end",
2533
+ top: "ddga-drawer--top",
2534
+ bottom: "ddga-drawer--bottom"
2535
+ },
2536
+ size: {
2537
+ sm: "ddga-drawer--sm",
2538
+ md: "ddga-drawer--md",
2539
+ lg: "ddga-drawer--lg",
2540
+ full: "ddga-drawer--full"
2541
+ }
2542
+ },
2543
+ defaultVariants: {
2544
+ side: "end",
2545
+ size: "md"
2546
+ }
2547
+ });
2548
+ function Drawer(props) {
2549
+ return /* @__PURE__ */ jsx27(DialogPrimitive2.Root, { ...props });
2550
+ }
2551
+ function DrawerTrigger({ className, ...props }) {
2552
+ return /* @__PURE__ */ jsx27(DialogPrimitive2.Trigger, { "data-slot": "drawer-trigger", className, ...props });
2553
+ }
2554
+ function DrawerContent({
2555
+ side,
2556
+ size,
2557
+ showCloseButton = true,
2558
+ closeLabel = "Close",
2559
+ className,
2560
+ children,
2561
+ ...props
2562
+ }) {
2563
+ const ctx = useContext6(DgaContext);
2564
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
2565
+ return /* @__PURE__ */ jsxs20(DialogPrimitive2.Portal, { container: portalContainer, children: [
2566
+ /* @__PURE__ */ jsx27(DialogPrimitive2.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
2567
+ /* @__PURE__ */ jsxs20(
2568
+ DialogPrimitive2.Content,
2569
+ {
2570
+ "data-slot": "drawer-content",
2571
+ className: cn(drawerVariants({ side, size }), className),
2572
+ ...props,
2573
+ children: [
2574
+ children,
2575
+ showCloseButton ? /* @__PURE__ */ jsx27(
2576
+ DialogPrimitive2.Close,
2577
+ {
2578
+ className: "ddga-drawer__close",
2579
+ "aria-label": closeLabel,
2580
+ "data-slot": "drawer-close-x",
2581
+ children: /* @__PURE__ */ jsx27(Close, { "aria-hidden": "true" })
2582
+ }
2583
+ ) : null
2584
+ ]
2585
+ }
2586
+ )
2587
+ ] });
2588
+ }
2589
+ function DrawerHeader({ asChild, className, ...props }) {
2590
+ const Comp = asChild ? SlotPrimitive8.Slot : "div";
2591
+ return /* @__PURE__ */ jsx27(Comp, { "data-slot": "drawer-header", className: cn("ddga-drawer__header", className), ...props });
2592
+ }
2593
+ function DrawerTitle({ asChild, className, ...props }) {
2594
+ return /* @__PURE__ */ jsx27(
2595
+ DialogPrimitive2.Title,
2596
+ {
2597
+ asChild,
2598
+ "data-slot": "drawer-title",
2599
+ className: cn("ddga-drawer__title", className),
2600
+ ...props
2601
+ }
2602
+ );
2603
+ }
2604
+ function DrawerDescription({ asChild, className, ...props }) {
2605
+ return /* @__PURE__ */ jsx27(
2606
+ DialogPrimitive2.Description,
2607
+ {
2608
+ asChild,
2609
+ "data-slot": "drawer-description",
2610
+ className: cn("ddga-drawer__description", className),
2611
+ ...props
2612
+ }
2613
+ );
2614
+ }
2615
+ function DrawerBody({ asChild, className, ...props }) {
2616
+ const Comp = asChild ? SlotPrimitive8.Slot : "div";
2617
+ return /* @__PURE__ */ jsx27(Comp, { "data-slot": "drawer-body", className: cn("ddga-drawer__body", className), ...props });
2618
+ }
2619
+ function DrawerFooter({ asChild, className, ...props }) {
2620
+ const Comp = asChild ? SlotPrimitive8.Slot : "div";
2621
+ return /* @__PURE__ */ jsx27(Comp, { "data-slot": "drawer-footer", className: cn("ddga-drawer__footer", className), ...props });
2622
+ }
2623
+ function DrawerClose({ className, ...props }) {
2624
+ return /* @__PURE__ */ jsx27(DialogPrimitive2.Close, { "data-slot": "drawer-close", className, ...props });
2625
+ }
2626
+
2627
+ // src/components/Combobox/Combobox.tsx
2628
+ import {
2629
+ Children as Children2,
2630
+ createContext as createContext2,
2631
+ isValidElement as isValidElement2,
2632
+ useCallback,
2633
+ useContext as useContext7,
2634
+ useId as useId3,
2635
+ useMemo,
2636
+ useState as useState3
2637
+ } from "react";
2638
+ import { Command } from "cmdk";
2639
+ import { Popover as PopoverPrimitive } from "radix-ui";
2640
+ import { cva as cva26 } from "class-variance-authority";
2641
+ import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
2642
+ var comboboxTriggerVariants = cva26("ddga-combobox-trigger", {
2643
+ variants: {
2644
+ size: {
2645
+ sm: "ddga-combobox-trigger--sm",
2646
+ md: "ddga-combobox-trigger--md"
2647
+ },
2648
+ error: {
2649
+ true: "ddga-combobox-trigger--error"
2650
+ }
2651
+ },
2652
+ defaultVariants: {
2653
+ size: "md"
2654
+ }
2655
+ });
2656
+ var comboboxVariants = comboboxTriggerVariants;
2657
+ var ComboboxContext = createContext2(null);
2658
+ function useComboboxContext(component) {
2659
+ const ctx = useContext7(ComboboxContext);
2660
+ if (!ctx) {
2661
+ throw new Error(`<${component}> must be rendered inside <Combobox>.`);
2662
+ }
2663
+ return ctx;
2664
+ }
2665
+ function Combobox({
2666
+ value: controlledValue,
2667
+ defaultValue,
2668
+ onValueChange,
2669
+ open: controlledOpen,
2670
+ defaultOpen,
2671
+ onOpenChange,
2672
+ label,
563
2673
  helperText,
564
2674
  errorMessage,
565
2675
  error,
566
- size,
567
- orientation,
568
2676
  required,
2677
+ disabled,
2678
+ size,
2679
+ placeholder,
2680
+ searchPlaceholder = "Search\u2026",
2681
+ emptyMessage = "No results.",
2682
+ getLabel,
2683
+ id: externalId,
569
2684
  className,
570
2685
  children,
571
- ...props
2686
+ "aria-label": ariaLabel,
2687
+ "aria-labelledby": ariaLabelledBy
572
2688
  }) {
573
- const { errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps, fieldId } = useFieldA11y({
574
- name: "RadioGroup",
2689
+ const [internalValue, setInternalValue] = useState3(defaultValue);
2690
+ const isControlled = controlledValue !== void 0;
2691
+ const value = isControlled ? controlledValue : internalValue;
2692
+ const [internalOpen, setInternalOpen] = useState3(defaultOpen ?? false);
2693
+ const isOpenControlled = controlledOpen !== void 0;
2694
+ const open = isOpenControlled ? controlledOpen : internalOpen;
2695
+ const setOpen = useCallback(
2696
+ (next) => {
2697
+ if (!isOpenControlled) setInternalOpen(next);
2698
+ onOpenChange?.(next);
2699
+ },
2700
+ [isOpenControlled, onOpenChange]
2701
+ );
2702
+ const select = useCallback(
2703
+ (next) => {
2704
+ if (!isControlled) setInternalValue(next);
2705
+ onValueChange?.(next);
2706
+ setOpen(false);
2707
+ },
2708
+ [isControlled, onValueChange, setOpen]
2709
+ );
2710
+ const ctx = useMemo(() => ({ value, select }), [value, select]);
2711
+ const itemLabels = useMemo(() => {
2712
+ const map = /* @__PURE__ */ new Map();
2713
+ const visit = (nodes) => {
2714
+ Children2.forEach(nodes, (child) => {
2715
+ if (!isValidElement2(child)) return;
2716
+ const childProps = child.props;
2717
+ if (typeof childProps.value === "string") {
2718
+ map.set(childProps.value, childProps.children);
2719
+ } else if (childProps.children) {
2720
+ visit(childProps.children);
2721
+ }
2722
+ });
2723
+ };
2724
+ visit(children);
2725
+ return map;
2726
+ }, [children]);
2727
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
2728
+ name: "Combobox",
575
2729
  id: externalId,
576
2730
  label,
577
2731
  error,
578
2732
  errorMessage,
579
2733
  helperText,
580
- "aria-label": props["aria-label"],
581
- "aria-labelledby": props["aria-labelledby"]
2734
+ "aria-label": ariaLabel,
2735
+ "aria-labelledby": ariaLabelledBy
582
2736
  });
583
- const labelId = `${fieldId}-label`;
584
- return /* @__PURE__ */ jsxs6("div", { "data-slot": "radio-group-field", className: "ddga-field", children: [
585
- label && /* @__PURE__ */ jsxs6("span", { id: labelId, className: "ddga-radio-group__label", children: [
2737
+ const providerCtx = useContext7(DgaContext);
2738
+ const portalContainer = providerCtx?.portalEl ?? providerCtx?.rootEl ?? void 0;
2739
+ const triggerLabel = useMemo(() => {
2740
+ if (value === void 0) return null;
2741
+ if (getLabel) return getLabel(value);
2742
+ return itemLabels.get(value) ?? null;
2743
+ }, [value, getLabel, itemLabels]);
2744
+ const searchId = useId3();
2745
+ return /* @__PURE__ */ jsx28(ComboboxContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs21("div", { "data-slot": "combobox-field", className: "ddga-field", children: [
2746
+ label && /* @__PURE__ */ jsxs21("label", { htmlFor: fieldId, className: "ddga-combobox__label", children: [
586
2747
  label,
587
- required && /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", className: "ddga-radio-group__required", children: "*" })
2748
+ required && /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: "ddga-combobox__required", children: "*" })
588
2749
  ] }),
589
- /* @__PURE__ */ jsx7(
590
- RadioGroupPrimitive.Root,
591
- {
592
- ...props,
593
- "aria-invalid": controlProps["aria-invalid"],
594
- "aria-describedby": controlProps["aria-describedby"],
595
- "aria-labelledby": label ? labelId : props["aria-labelledby"],
596
- orientation: orientation === "horizontal" ? "horizontal" : "vertical",
597
- required,
598
- "data-slot": "radio-group",
599
- className: cn(radioGroupVariants({ size, orientation, error: hasError }), className),
600
- children
601
- }
602
- ),
603
- hasErrorMessage && /* @__PURE__ */ jsx7(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
604
- hasHelper && /* @__PURE__ */ jsx7(FieldMessage, { id: helperId, variant: "helper", children: helperText })
605
- ] });
2750
+ /* @__PURE__ */ jsxs21(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
2751
+ /* @__PURE__ */ jsx28(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs21(
2752
+ "button",
2753
+ {
2754
+ type: "button",
2755
+ ...controlProps,
2756
+ "aria-required": required || void 0,
2757
+ disabled,
2758
+ "data-slot": "combobox-trigger",
2759
+ className: cn(comboboxTriggerVariants({ size, error: hasError }), className),
2760
+ children: [
2761
+ /* @__PURE__ */ jsx28("span", { className: "ddga-combobox__value", children: triggerLabel ?? /* @__PURE__ */ jsx28("span", { className: "ddga-combobox__placeholder", children: placeholder }) }),
2762
+ /* @__PURE__ */ jsx28(ChevronDown, { "aria-hidden": "true", className: "ddga-combobox__icon" })
2763
+ ]
2764
+ }
2765
+ ) }),
2766
+ /* @__PURE__ */ jsx28(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx28(
2767
+ PopoverPrimitive.Content,
2768
+ {
2769
+ "data-slot": "combobox-content",
2770
+ className: "ddga-combobox-content",
2771
+ sideOffset: 4,
2772
+ align: "start",
2773
+ "aria-label": ariaLabel ?? (typeof label === "string" ? label : "Options"),
2774
+ "aria-labelledby": ariaLabelledBy,
2775
+ style: { inlineSize: "var(--radix-popover-trigger-width)" },
2776
+ onOpenAutoFocus: (event) => {
2777
+ event.preventDefault();
2778
+ },
2779
+ children: /* @__PURE__ */ jsxs21(
2780
+ Command,
2781
+ {
2782
+ id: searchId,
2783
+ "data-slot": "combobox-command",
2784
+ className: "ddga-combobox-command",
2785
+ children: [
2786
+ /* @__PURE__ */ jsx28(
2787
+ Command.Input,
2788
+ {
2789
+ autoFocus: true,
2790
+ placeholder: searchPlaceholder,
2791
+ "data-slot": "combobox-input",
2792
+ className: "ddga-combobox-input"
2793
+ }
2794
+ ),
2795
+ /* @__PURE__ */ jsxs21(Command.List, { "data-slot": "combobox-list", className: "ddga-combobox-list", children: [
2796
+ /* @__PURE__ */ jsx28(Command.Empty, { "data-slot": "combobox-empty", className: "ddga-combobox-empty", children: emptyMessage }),
2797
+ children
2798
+ ] })
2799
+ ]
2800
+ }
2801
+ )
2802
+ }
2803
+ ) })
2804
+ ] }),
2805
+ hasErrorMessage && /* @__PURE__ */ jsx28(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
2806
+ hasHelper && /* @__PURE__ */ jsx28(FieldMessage, { id: helperId, variant: "helper", children: helperText })
2807
+ ] }) });
606
2808
  }
607
- function Radio({ id: externalId, label, className, ...props }) {
608
- const generatedId = useId2();
609
- const itemId = externalId ?? generatedId;
610
- return /* @__PURE__ */ jsxs6("div", { className: "ddga-radio-row", children: [
611
- /* @__PURE__ */ jsx7(
612
- RadioGroupPrimitive.Item,
613
- {
614
- ...props,
615
- id: itemId,
616
- "data-slot": "radio",
617
- className: cn(radioVariants(), className),
618
- children: /* @__PURE__ */ jsx7(
619
- RadioGroupPrimitive.Indicator,
620
- {
621
- "data-slot": "radio-indicator",
622
- className: "ddga-radio__indicator",
623
- children: /* @__PURE__ */ jsx7("span", { className: "ddga-radio__dot", "aria-hidden": "true" })
624
- }
625
- )
626
- }
627
- ),
628
- label && /* @__PURE__ */ jsx7("label", { htmlFor: itemId, className: "ddga-radio__label", children: label })
629
- ] });
2809
+ function ComboboxItem({
2810
+ value,
2811
+ keywords,
2812
+ disabled,
2813
+ onSelect,
2814
+ className,
2815
+ children,
2816
+ ...props
2817
+ }) {
2818
+ const { value: selectedValue, select } = useComboboxContext("ComboboxItem");
2819
+ const isSelected = selectedValue === value;
2820
+ return /* @__PURE__ */ jsxs21(
2821
+ Command.Item,
2822
+ {
2823
+ value,
2824
+ keywords,
2825
+ disabled,
2826
+ onSelect: (v) => {
2827
+ onSelect?.(v);
2828
+ select(v);
2829
+ },
2830
+ "data-slot": "combobox-item",
2831
+ "data-active": isSelected ? "" : void 0,
2832
+ className: cn("ddga-combobox-item", className),
2833
+ ...props,
2834
+ children: [
2835
+ /* @__PURE__ */ jsx28("span", { className: "ddga-combobox-item__check", "aria-hidden": "true", children: isSelected ? /* @__PURE__ */ jsx28(Check, {}) : null }),
2836
+ /* @__PURE__ */ jsx28("span", { className: "ddga-combobox-item__label", children })
2837
+ ]
2838
+ }
2839
+ );
2840
+ }
2841
+ function ComboboxGroup({ className, heading, ...props }) {
2842
+ return /* @__PURE__ */ jsx28(
2843
+ Command.Group,
2844
+ {
2845
+ heading,
2846
+ "data-slot": "combobox-group",
2847
+ className: cn("ddga-combobox-group", className),
2848
+ ...props
2849
+ }
2850
+ );
2851
+ }
2852
+ function ComboboxSeparator({ className, ...props }) {
2853
+ return /* @__PURE__ */ jsx28(
2854
+ Command.Separator,
2855
+ {
2856
+ "data-slot": "combobox-separator",
2857
+ className: cn("ddga-combobox-separator", className),
2858
+ ...props
2859
+ }
2860
+ );
630
2861
  }
631
2862
 
632
- // src/components/Switch/Switch.tsx
633
- import { Switch as SwitchPrimitive } from "radix-ui";
634
- import { cva as cva6 } from "class-variance-authority";
635
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
636
- var switchVariants = cva6("ddga-switch", {
2863
+ // src/components/DatePicker/DatePicker.tsx
2864
+ import { useCallback as useCallback2, useContext as useContext8, useMemo as useMemo2, useState as useState4 } from "react";
2865
+ import {
2866
+ Button as AriaButton,
2867
+ Calendar as AriaCalendar,
2868
+ CalendarCell as AriaCalendarCell,
2869
+ CalendarGrid as AriaCalendarGrid,
2870
+ CalendarGridBody as AriaCalendarGridBody,
2871
+ CalendarGridHeader as AriaCalendarGridHeader,
2872
+ CalendarHeaderCell as AriaCalendarHeaderCell,
2873
+ CalendarStateContext as AriaCalendarStateContext,
2874
+ DateInput as AriaDateInput,
2875
+ DatePicker as AriaDatePicker,
2876
+ DateSegment as AriaDateSegment,
2877
+ Dialog as AriaDialog,
2878
+ FieldError as AriaFieldError,
2879
+ Group as AriaGroup,
2880
+ I18nProvider,
2881
+ Label as AriaLabel,
2882
+ Popover as AriaPopover,
2883
+ Text as AriaText
2884
+ } from "react-aria-components";
2885
+ import {
2886
+ CalendarDate,
2887
+ GregorianCalendar,
2888
+ IslamicUmalquraCalendar,
2889
+ toCalendar
2890
+ } from "@internationalized/date";
2891
+ import { cva as cva27 } from "class-variance-authority";
2892
+ import { Fragment as Fragment2, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
2893
+ var datePickerTriggerVariants = cva27("ddga-date-picker-trigger", {
637
2894
  variants: {
638
2895
  size: {
639
- sm: "ddga-switch--sm",
640
- md: "ddga-switch--md"
2896
+ sm: "ddga-date-picker-trigger--sm",
2897
+ md: "ddga-date-picker-trigger--md"
641
2898
  },
642
2899
  error: {
643
- true: "ddga-switch--error"
2900
+ true: "ddga-date-picker-trigger--error"
644
2901
  }
645
2902
  },
646
2903
  defaultVariants: {
647
2904
  size: "md"
648
2905
  }
649
2906
  });
650
- function Switch({
651
- id: externalId,
2907
+ var datePickerVariants = datePickerTriggerVariants;
2908
+ function dateToCalendarDate(date) {
2909
+ if (!date) return null;
2910
+ return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
2911
+ }
2912
+ function calendarDateToDate(value) {
2913
+ if (!value) return null;
2914
+ const greg = value.calendar.identifier === "gregory" ? value : toCalendar(value, new GregorianCalendar());
2915
+ return new Date(greg.year, greg.month - 1, greg.day);
2916
+ }
2917
+ function composeLocale(dgaLocale, calendar) {
2918
+ const base = dgaLocale === "ar" ? "ar-SA" : dgaLocale === "en" ? "en-US" : dgaLocale;
2919
+ const isArabic = base.startsWith("ar");
2920
+ if (calendar === "hijri") {
2921
+ return isArabic ? `${base}-u-ca-islamic-umalqura-nu-latn` : `${base}-u-ca-islamic-umalqura`;
2922
+ }
2923
+ return isArabic ? `${base}-u-nu-latn` : base;
2924
+ }
2925
+ var GREGORIAN = new GregorianCalendar();
2926
+ var ISLAMIC_UMALQURA = new IslamicUmalquraCalendar();
2927
+ function secondaryDayNumber(date, mainCalendar) {
2928
+ const other = mainCalendar === "hijri" ? GREGORIAN : ISLAMIC_UMALQURA;
2929
+ return toCalendar(date, other).day;
2930
+ }
2931
+ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
2932
+ const state = useContext8(AriaCalendarStateContext);
2933
+ const focusedDate = state?.focusedDate ?? null;
2934
+ const focusedYear = focusedDate?.year ?? 0;
2935
+ const focusedCalendar = focusedDate?.calendar ?? GREGORIAN;
2936
+ const minValue = state?.minValue ?? null;
2937
+ const maxValue = state?.maxValue ?? null;
2938
+ const monthNames = useMemo2(() => {
2939
+ if (!focusedDate) return [];
2940
+ const fmt = new Intl.DateTimeFormat(locale, { month: "long" });
2941
+ return Array.from({ length: 12 }, (_, i) => {
2942
+ const cd = new CalendarDate(focusedCalendar, focusedYear, i + 1, 1);
2943
+ const greg = toCalendar(cd, GREGORIAN);
2944
+ const js = new Date(greg.year, greg.month - 1, greg.day);
2945
+ return fmt.format(js);
2946
+ });
2947
+ }, [locale, focusedDate, focusedCalendar, focusedYear]);
2948
+ const yearOptions = useMemo2(() => {
2949
+ if (!focusedDate) return [];
2950
+ const minY = minValue ? toCalendar(minValue, focusedCalendar).year : focusedYear - 100;
2951
+ const maxY = maxValue ? toCalendar(maxValue, focusedCalendar).year : focusedYear + 30;
2952
+ const start = Math.min(minY, focusedYear);
2953
+ const end = Math.max(maxY, focusedYear);
2954
+ return Array.from({ length: end - start + 1 }, (_, i) => start + i);
2955
+ }, [focusedDate, focusedCalendar, focusedYear, minValue, maxValue]);
2956
+ if (!state || !focusedDate) return null;
2957
+ return /* @__PURE__ */ jsxs22("div", { className: "ddga-date-picker-calendar__nav-selects", "data-slot": "date-picker-calendar-nav", children: [
2958
+ /* @__PURE__ */ jsx29(
2959
+ "select",
2960
+ {
2961
+ "aria-label": monthLabel,
2962
+ className: "ddga-date-picker-calendar__select ddga-date-picker-calendar__month-select",
2963
+ "data-slot": "date-picker-month-select",
2964
+ value: focusedDate.month,
2965
+ onChange: (e) => state.setFocusedDate(focusedDate.set({ month: Number(e.target.value) })),
2966
+ children: monthNames.map((name, i) => /* @__PURE__ */ jsx29("option", { value: i + 1, children: name }, i + 1))
2967
+ }
2968
+ ),
2969
+ /* @__PURE__ */ jsx29(
2970
+ "select",
2971
+ {
2972
+ "aria-label": yearLabel,
2973
+ className: "ddga-date-picker-calendar__select ddga-date-picker-calendar__year-select",
2974
+ "data-slot": "date-picker-year-select",
2975
+ value: focusedDate.year,
2976
+ onChange: (e) => state.setFocusedDate(focusedDate.set({ year: Number(e.target.value) })),
2977
+ children: yearOptions.map((y) => /* @__PURE__ */ jsx29("option", { value: y, children: y }, y))
2978
+ }
2979
+ )
2980
+ ] });
2981
+ }
2982
+ function CalendarDayCell({ date, showSecondary, calendarSystem }) {
2983
+ const state = useContext8(AriaCalendarStateContext);
2984
+ const start = state?.visibleRange.start;
2985
+ const isOutside = !!start && (date.year !== start.year || date.month !== start.month);
2986
+ const isOutOfBounds = state ? state.isInvalid(date) : false;
2987
+ if (state && isOutside && !isOutOfBounds) {
2988
+ const selected = state.value;
2989
+ const isSelected = !!selected && selected.year === date.year && selected.month === date.month && selected.day === date.day;
2990
+ const handleSelect = () => {
2991
+ state.setFocusedDate(date);
2992
+ state.selectDate(date);
2993
+ };
2994
+ return /* @__PURE__ */ jsx29("td", { role: "gridcell", children: /* @__PURE__ */ jsx29(
2995
+ "button",
2996
+ {
2997
+ type: "button",
2998
+ tabIndex: -1,
2999
+ className: "ddga-date-picker-calendar__cell",
3000
+ "data-outside-month": "",
3001
+ "data-selected": isSelected ? "" : void 0,
3002
+ "data-slot": "date-picker-day-cell",
3003
+ onClick: handleSelect,
3004
+ children: showSecondary ? /* @__PURE__ */ jsxs22(Fragment2, { children: [
3005
+ /* @__PURE__ */ jsx29("span", { className: "ddga-date-picker-calendar__cell-primary", children: date.day }),
3006
+ /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
3007
+ ] }) : String(date.day)
3008
+ }
3009
+ ) });
3010
+ }
3011
+ return /* @__PURE__ */ jsx29(AriaCalendarCell, { date, className: "ddga-date-picker-calendar__cell", children: ({ formattedDate }) => showSecondary ? /* @__PURE__ */ jsxs22(Fragment2, { children: [
3012
+ /* @__PURE__ */ jsx29("span", { className: "ddga-date-picker-calendar__cell-primary", children: formattedDate }),
3013
+ /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
3014
+ ] }) : formattedDate });
3015
+ }
3016
+ function DatePicker({
3017
+ value: controlledValue,
3018
+ defaultValue,
3019
+ onChange,
3020
+ minValue,
3021
+ maxValue,
652
3022
  label,
653
3023
  helperText,
654
3024
  errorMessage,
655
3025
  error,
3026
+ required,
3027
+ disabled,
656
3028
  size,
3029
+ id,
3030
+ className,
3031
+ "aria-label": ariaLabel,
3032
+ "aria-labelledby": ariaLabelledBy,
3033
+ calendar: controlledCalendar,
3034
+ defaultCalendar = "gregorian",
3035
+ onCalendarChange,
3036
+ showCalendarToggle = true,
3037
+ calendarLabels,
3038
+ showSecondaryCalendar = false
3039
+ }) {
3040
+ const isValueControlled = controlledValue !== void 0;
3041
+ const [internalValue, setInternalValue] = useState4(
3042
+ () => dateToCalendarDate(defaultValue)
3043
+ );
3044
+ const value = isValueControlled ? dateToCalendarDate(controlledValue) : internalValue;
3045
+ const handleAriaChange = useCallback2(
3046
+ (next) => {
3047
+ const nextCD = next ? new CalendarDate(next.year, next.month, next.day) : null;
3048
+ if (!isValueControlled) setInternalValue(nextCD);
3049
+ onChange?.(calendarDateToDate(nextCD));
3050
+ },
3051
+ [isValueControlled, onChange]
3052
+ );
3053
+ const isCalendarControlled = controlledCalendar !== void 0;
3054
+ const [internalCalendar, setInternalCalendar] = useState4(defaultCalendar);
3055
+ const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
3056
+ const setCalendar = useCallback2(
3057
+ (next) => {
3058
+ if (!isCalendarControlled) setInternalCalendar(next);
3059
+ onCalendarChange?.(next);
3060
+ },
3061
+ [isCalendarControlled, onCalendarChange]
3062
+ );
3063
+ const dgaCtx = useContext8(DgaContext);
3064
+ const dgaLocale = dgaCtx?.locale ?? "en";
3065
+ const ariaLocale = useMemo2(
3066
+ () => composeLocale(dgaLocale, calendarSystem),
3067
+ [dgaLocale, calendarSystem]
3068
+ );
3069
+ const portalContainer = dgaCtx?.portalEl ?? dgaCtx?.rootEl ?? void 0;
3070
+ const dgaDir = dgaCtx?.dir ?? "ltr";
3071
+ const PrevChevron = dgaDir === "rtl" ? ChevronRight : ChevronLeft;
3072
+ const NextChevron = dgaDir === "rtl" ? ChevronLeft : ChevronRight;
3073
+ const resolvedLabels = useMemo2(() => {
3074
+ if (calendarLabels) return calendarLabels;
3075
+ const isArabic = dgaLocale.startsWith("ar");
3076
+ return isArabic ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
3077
+ }, [calendarLabels, dgaLocale]);
3078
+ const navLabels = useMemo2(
3079
+ () => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
3080
+ [dgaLocale]
3081
+ );
3082
+ const ariaMinValue = useMemo2(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
3083
+ const ariaMaxValue = useMemo2(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
3084
+ const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : "Date");
3085
+ const showToggle = showCalendarToggle && !isCalendarControlled;
3086
+ const hasError = !!error;
3087
+ const hasErrorMessage = hasError && errorMessage != null && errorMessage !== "";
3088
+ const hasHelper = !hasErrorMessage && helperText != null && helperText !== "";
3089
+ return /* @__PURE__ */ jsx29(I18nProvider, { locale: ariaLocale, children: /* @__PURE__ */ jsxs22(
3090
+ AriaDatePicker,
3091
+ {
3092
+ value,
3093
+ onChange: handleAriaChange,
3094
+ minValue: ariaMinValue,
3095
+ maxValue: ariaMaxValue,
3096
+ isRequired: required,
3097
+ isDisabled: disabled,
3098
+ isInvalid: hasError,
3099
+ shouldCloseOnSelect: true,
3100
+ id,
3101
+ "aria-label": ariaLabel,
3102
+ "aria-labelledby": ariaLabelledBy,
3103
+ className: "ddga-field",
3104
+ "data-slot": "date-picker-field",
3105
+ children: [
3106
+ label && /* @__PURE__ */ jsxs22(AriaLabel, { className: "ddga-date-picker__label", children: [
3107
+ label,
3108
+ required && /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: "ddga-date-picker__required", children: "*" })
3109
+ ] }),
3110
+ /* @__PURE__ */ jsxs22(
3111
+ AriaGroup,
3112
+ {
3113
+ "data-slot": "date-picker-trigger",
3114
+ className: cn(datePickerTriggerVariants({ size, error: hasError }), className),
3115
+ children: [
3116
+ /* @__PURE__ */ jsx29(AriaDateInput, { className: "ddga-date-picker__input", "data-slot": "date-picker-input", children: (segment) => /* @__PURE__ */ jsx29(
3117
+ AriaDateSegment,
3118
+ {
3119
+ segment,
3120
+ className: "ddga-date-picker__segment",
3121
+ "data-slot": "date-picker-segment"
3122
+ }
3123
+ ) }),
3124
+ /* @__PURE__ */ jsx29(
3125
+ AriaButton,
3126
+ {
3127
+ className: "ddga-date-picker__icon-button",
3128
+ "aria-label": "Open calendar",
3129
+ "data-slot": "date-picker-trigger-button",
3130
+ children: /* @__PURE__ */ jsx29(CalendarIcon, { "aria-hidden": "true", className: "ddga-date-picker__icon" })
3131
+ }
3132
+ )
3133
+ ]
3134
+ }
3135
+ ),
3136
+ hasHelper && /* @__PURE__ */ jsx29(
3137
+ AriaText,
3138
+ {
3139
+ slot: "description",
3140
+ className: "ddga-field__message ddga-field__message--helper",
3141
+ "data-slot": "field-helper",
3142
+ children: helperText
3143
+ }
3144
+ ),
3145
+ hasErrorMessage && /* @__PURE__ */ jsx29(
3146
+ AriaFieldError,
3147
+ {
3148
+ className: "ddga-field__message ddga-field__message--error",
3149
+ "data-slot": "field-error",
3150
+ children: errorMessage
3151
+ }
3152
+ ),
3153
+ /* @__PURE__ */ jsx29(
3154
+ AriaPopover,
3155
+ {
3156
+ UNSTABLE_portalContainer: portalContainer,
3157
+ className: "ddga-date-picker-popover",
3158
+ "data-slot": "date-picker-popover",
3159
+ offset: 6,
3160
+ containerPadding: 12,
3161
+ children: /* @__PURE__ */ jsxs22(
3162
+ AriaDialog,
3163
+ {
3164
+ className: "ddga-date-picker-dialog",
3165
+ "data-slot": "date-picker-dialog",
3166
+ "aria-label": dialogAriaLabel,
3167
+ "aria-labelledby": ariaLabelledBy,
3168
+ children: [
3169
+ showToggle && /* @__PURE__ */ jsxs22(
3170
+ "div",
3171
+ {
3172
+ role: "tablist",
3173
+ "aria-label": "Calendar system",
3174
+ className: "ddga-date-picker-toggle",
3175
+ "data-slot": "date-picker-toggle",
3176
+ children: [
3177
+ /* @__PURE__ */ jsx29(
3178
+ "button",
3179
+ {
3180
+ type: "button",
3181
+ role: "tab",
3182
+ "aria-selected": calendarSystem === "gregorian",
3183
+ className: "ddga-date-picker-toggle__button",
3184
+ "data-active": calendarSystem === "gregorian" ? "" : void 0,
3185
+ onClick: () => setCalendar("gregorian"),
3186
+ children: resolvedLabels.gregorian
3187
+ }
3188
+ ),
3189
+ /* @__PURE__ */ jsx29(
3190
+ "button",
3191
+ {
3192
+ type: "button",
3193
+ role: "tab",
3194
+ "aria-selected": calendarSystem === "hijri",
3195
+ className: "ddga-date-picker-toggle__button",
3196
+ "data-active": calendarSystem === "hijri" ? "" : void 0,
3197
+ onClick: () => setCalendar("hijri"),
3198
+ children: resolvedLabels.hijri
3199
+ }
3200
+ )
3201
+ ]
3202
+ }
3203
+ ),
3204
+ /* @__PURE__ */ jsxs22(AriaCalendar, { className: "ddga-date-picker-calendar", "data-slot": "date-picker-calendar", children: [
3205
+ /* @__PURE__ */ jsxs22("header", { className: "ddga-date-picker-calendar__header", children: [
3206
+ /* @__PURE__ */ jsx29(
3207
+ AriaButton,
3208
+ {
3209
+ slot: "previous",
3210
+ className: "ddga-date-picker-calendar__nav",
3211
+ "data-slot": "date-picker-calendar-prev",
3212
+ children: /* @__PURE__ */ jsx29(PrevChevron, { "aria-hidden": "true" })
3213
+ }
3214
+ ),
3215
+ /* @__PURE__ */ jsx29(
3216
+ CalendarNavHeader,
3217
+ {
3218
+ locale: ariaLocale,
3219
+ monthLabel: navLabels.month,
3220
+ yearLabel: navLabels.year
3221
+ }
3222
+ ),
3223
+ /* @__PURE__ */ jsx29(
3224
+ AriaButton,
3225
+ {
3226
+ slot: "next",
3227
+ className: "ddga-date-picker-calendar__nav",
3228
+ "data-slot": "date-picker-calendar-next",
3229
+ children: /* @__PURE__ */ jsx29(NextChevron, { "aria-hidden": "true" })
3230
+ }
3231
+ )
3232
+ ] }),
3233
+ /* @__PURE__ */ jsxs22(AriaCalendarGrid, { className: "ddga-date-picker-calendar__grid", children: [
3234
+ /* @__PURE__ */ jsx29(AriaCalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx29(AriaCalendarHeaderCell, { className: "ddga-date-picker-calendar__weekday", children: day }) }),
3235
+ /* @__PURE__ */ jsx29(AriaCalendarGridBody, { children: (date) => /* @__PURE__ */ jsx29(
3236
+ CalendarDayCell,
3237
+ {
3238
+ date,
3239
+ showSecondary: showSecondaryCalendar,
3240
+ calendarSystem
3241
+ }
3242
+ ) })
3243
+ ] })
3244
+ ] })
3245
+ ]
3246
+ }
3247
+ )
3248
+ }
3249
+ )
3250
+ ]
3251
+ }
3252
+ ) });
3253
+ }
3254
+
3255
+ // src/components/FileUpload/FileUpload.tsx
3256
+ import { useRef, useState as useState5 } from "react";
3257
+ import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
3258
+ function matchesAccept(file, accept) {
3259
+ if (!accept) return true;
3260
+ const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
3261
+ if (tokens.length === 0) return true;
3262
+ const name = file.name.toLowerCase();
3263
+ const type = file.type.toLowerCase();
3264
+ return tokens.some((token) => {
3265
+ if (token.startsWith(".")) return name.endsWith(token);
3266
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, token.indexOf("/") + 1));
3267
+ return type === token;
3268
+ });
3269
+ }
3270
+ function splitFiles(incoming, config) {
3271
+ const { accept, maxSize, maxFiles, currentCount } = config;
3272
+ const accepted = [];
3273
+ const rejections = [];
3274
+ for (const file of incoming) {
3275
+ const errors = [];
3276
+ if (!matchesAccept(file, accept)) errors.push("file-invalid-type");
3277
+ if (maxSize != null && file.size > maxSize) errors.push("file-too-large");
3278
+ if (errors.length > 0) {
3279
+ rejections.push({ file, errors });
3280
+ continue;
3281
+ }
3282
+ if (maxFiles != null && currentCount + accepted.length >= maxFiles) {
3283
+ rejections.push({ file, errors: ["too-many-files"] });
3284
+ continue;
3285
+ }
3286
+ accepted.push(file);
3287
+ }
3288
+ return { accepted, rejections };
3289
+ }
3290
+ var UNITS = ["B", "KB", "MB", "GB", "TB"];
3291
+ function formatBytes(bytes) {
3292
+ if (bytes === 0) return "0 B";
3293
+ const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), UNITS.length - 1);
3294
+ const value = bytes / 1024 ** exponent;
3295
+ return `${exponent === 0 ? value : value.toFixed(1)} ${UNITS[exponent]}`;
3296
+ }
3297
+ function FileUpload({
3298
+ files,
3299
+ onFilesAdded,
3300
+ onFilesRejected,
3301
+ onRemove,
3302
+ accept,
3303
+ maxSize,
3304
+ maxFiles,
3305
+ multiple = true,
3306
+ disabled = false,
657
3307
  required,
3308
+ label,
3309
+ helperText,
3310
+ errorMessage,
3311
+ error,
3312
+ hint = "Drag files here, or click to browse",
3313
+ removeLabel = "Remove",
3314
+ id: externalId,
658
3315
  className,
659
3316
  ...props
660
3317
  }) {
3318
+ const inputRef = useRef(null);
3319
+ const [isDragging, setIsDragging] = useState5(false);
661
3320
  const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
662
- name: "Switch",
3321
+ name: "FileUpload",
663
3322
  id: externalId,
664
3323
  label,
665
3324
  error,
@@ -668,579 +3327,706 @@ function Switch({
668
3327
  "aria-label": props["aria-label"],
669
3328
  "aria-labelledby": props["aria-labelledby"]
670
3329
  });
671
- return /* @__PURE__ */ jsxs7("div", { "data-slot": "switch-field", className: "ddga-field", children: [
672
- /* @__PURE__ */ jsxs7("div", { className: "ddga-switch-row", children: [
673
- /* @__PURE__ */ jsx8(
674
- SwitchPrimitive.Root,
675
- {
676
- ...props,
677
- ...controlProps,
678
- "data-slot": "switch",
679
- required,
680
- className: cn(switchVariants({ size, error: hasError }), className),
681
- children: /* @__PURE__ */ jsx8(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "ddga-switch__thumb" })
682
- }
683
- ),
684
- label && /* @__PURE__ */ jsxs7("label", { htmlFor: fieldId, className: "ddga-switch__label", children: [
685
- label,
686
- required && /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", className: "ddga-switch__required", children: "*" })
687
- ] })
688
- ] }),
689
- hasErrorMessage && /* @__PURE__ */ jsx8(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
690
- hasHelper && /* @__PURE__ */ jsx8(FieldMessage, { id: helperId, variant: "helper", children: helperText })
691
- ] });
692
- }
693
-
694
- // src/components/Select/Select.tsx
695
- import { useContext as useContext2 } from "react";
696
- import { Select as SelectPrimitive } from "radix-ui";
697
- import { cva as cva7 } from "class-variance-authority";
698
-
699
- // src/providers/DgaContext.ts
700
- import { createContext, useContext } from "react";
701
- var DgaContext = createContext(null);
702
- function useDga() {
703
- const ctx = useContext(DgaContext);
704
- if (!ctx) {
705
- throw new Error("useDga must be used within a <DgaProvider>");
3330
+ const effectiveMaxFiles = multiple ? maxFiles : 1;
3331
+ function process2(incoming) {
3332
+ if (disabled || incoming.length === 0) return;
3333
+ const { accepted, rejections } = splitFiles(incoming, {
3334
+ accept,
3335
+ maxSize,
3336
+ maxFiles: effectiveMaxFiles,
3337
+ currentCount: files.length
3338
+ });
3339
+ if (accepted.length > 0) onFilesAdded(accepted);
3340
+ if (rejections.length > 0) onFilesRejected?.(rejections);
706
3341
  }
707
- return ctx;
3342
+ function handleInputChange(event) {
3343
+ process2(Array.from(event.target.files ?? []));
3344
+ event.target.value = "";
3345
+ }
3346
+ function handleDrop(event) {
3347
+ event.preventDefault();
3348
+ setIsDragging(false);
3349
+ if (disabled) return;
3350
+ process2(Array.from(event.dataTransfer.files));
3351
+ }
3352
+ function handleDragOver(event) {
3353
+ event.preventDefault();
3354
+ if (!disabled) setIsDragging(true);
3355
+ }
3356
+ function handleDragLeave(event) {
3357
+ if (!event.currentTarget.contains(event.relatedTarget)) {
3358
+ setIsDragging(false);
3359
+ }
3360
+ }
3361
+ return /* @__PURE__ */ jsxs23("div", { "data-slot": "file-upload-field", className: cn("ddga-field", "ddga-file-upload", className), children: [
3362
+ label && /* @__PURE__ */ jsxs23("label", { htmlFor: fieldId, className: "ddga-file-upload__label", children: [
3363
+ label,
3364
+ required && /* @__PURE__ */ jsx30("span", { "aria-hidden": "true", className: "ddga-file-upload__required", children: "*" })
3365
+ ] }),
3366
+ /* @__PURE__ */ jsxs23(
3367
+ "div",
3368
+ {
3369
+ "data-slot": "file-upload-dropzone",
3370
+ className: cn(
3371
+ "ddga-file-upload__dropzone",
3372
+ hasError && "ddga-file-upload__dropzone--error"
3373
+ ),
3374
+ "data-dragging": isDragging || void 0,
3375
+ "data-disabled": disabled || void 0,
3376
+ "aria-disabled": disabled || void 0,
3377
+ onClick: () => {
3378
+ if (!disabled) inputRef.current?.click();
3379
+ },
3380
+ onDragOver: handleDragOver,
3381
+ onDragLeave: handleDragLeave,
3382
+ onDrop: handleDrop,
3383
+ children: [
3384
+ /* @__PURE__ */ jsx30(Upload, { className: "ddga-file-upload__icon", "aria-hidden": "true" }),
3385
+ /* @__PURE__ */ jsx30("span", { className: "ddga-file-upload__hint", children: hint }),
3386
+ /* @__PURE__ */ jsx30(
3387
+ "input",
3388
+ {
3389
+ ...controlProps,
3390
+ ref: inputRef,
3391
+ type: "file",
3392
+ className: "ddga-file-upload__input",
3393
+ accept,
3394
+ multiple,
3395
+ disabled,
3396
+ required,
3397
+ onChange: handleInputChange,
3398
+ onClick: (event) => event.stopPropagation(),
3399
+ "data-slot": "file-upload-input"
3400
+ }
3401
+ )
3402
+ ]
3403
+ }
3404
+ ),
3405
+ hasErrorMessage && /* @__PURE__ */ jsx30(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
3406
+ hasHelper && /* @__PURE__ */ jsx30(FieldMessage, { id: helperId, variant: "helper", children: helperText }),
3407
+ files.length > 0 && /* @__PURE__ */ jsx30("ul", { "data-slot": "file-upload-list", className: "ddga-file-upload__list", children: files.map((item) => {
3408
+ const status = item.status ?? "pending";
3409
+ return /* @__PURE__ */ jsxs23(
3410
+ "li",
3411
+ {
3412
+ "data-slot": "file-upload-item",
3413
+ "data-status": status,
3414
+ className: "ddga-file-upload__item",
3415
+ children: [
3416
+ /* @__PURE__ */ jsx30("span", { className: "ddga-file-upload__item-icon", "aria-hidden": "true", children: status === "success" ? /* @__PURE__ */ jsx30(Check, {}) : status === "error" ? /* @__PURE__ */ jsx30(AlertCircle, {}) : /* @__PURE__ */ jsx30(Upload, {}) }),
3417
+ /* @__PURE__ */ jsxs23("div", { className: "ddga-file-upload__item-main", children: [
3418
+ /* @__PURE__ */ jsxs23("div", { className: "ddga-file-upload__item-head", children: [
3419
+ /* @__PURE__ */ jsx30("span", { className: "ddga-file-upload__item-name", title: item.file.name, children: item.file.name }),
3420
+ /* @__PURE__ */ jsx30("span", { className: "ddga-file-upload__item-meta", children: formatBytes(item.file.size) })
3421
+ ] }),
3422
+ status === "uploading" && /* @__PURE__ */ jsx30(
3423
+ Progress,
3424
+ {
3425
+ size: "sm",
3426
+ value: item.progress ?? 0,
3427
+ "aria-label": `Uploading ${item.file.name}`,
3428
+ className: "ddga-file-upload__item-progress"
3429
+ }
3430
+ ),
3431
+ status === "error" && item.error && /* @__PURE__ */ jsx30("span", { role: "alert", className: "ddga-file-upload__item-error", children: item.error })
3432
+ ] }),
3433
+ onRemove && /* @__PURE__ */ jsx30(
3434
+ Button,
3435
+ {
3436
+ type: "button",
3437
+ variant: "ghost",
3438
+ size: "icon-sm",
3439
+ "aria-label": `${removeLabel}: ${item.file.name}`,
3440
+ onClick: () => onRemove(item.id),
3441
+ className: "ddga-file-upload__item-remove",
3442
+ children: /* @__PURE__ */ jsx30(Close, { "aria-hidden": "true" })
3443
+ }
3444
+ )
3445
+ ]
3446
+ },
3447
+ item.id
3448
+ );
3449
+ }) })
3450
+ ] });
708
3451
  }
709
3452
 
710
- // src/components/Select/Select.tsx
711
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
712
- var selectTriggerVariants = cva7("ddga-select-trigger", {
3453
+ // src/components/Slider/Slider.tsx
3454
+ import { useId as useId4 } from "react";
3455
+ import { Slider as SliderPrimitive } from "radix-ui";
3456
+ import { cva as cva28 } from "class-variance-authority";
3457
+ import { jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
3458
+ var sliderVariants = cva28("ddga-slider", {
713
3459
  variants: {
714
3460
  size: {
715
- sm: "ddga-select-trigger--sm",
716
- md: "ddga-select-trigger--md"
3461
+ sm: "ddga-slider--sm",
3462
+ md: "ddga-slider--md"
717
3463
  },
718
3464
  error: {
719
- true: "ddga-select-trigger--error"
3465
+ true: "ddga-slider--error"
720
3466
  }
721
3467
  },
722
3468
  defaultVariants: {
723
3469
  size: "md"
724
3470
  }
725
3471
  });
726
- function Select({
3472
+ var DEFAULT_THUMB_LABELS = ["Minimum", "Maximum"];
3473
+ function toArray(value) {
3474
+ if (value === void 0) return void 0;
3475
+ return Array.isArray(value) ? value : [value];
3476
+ }
3477
+ function Slider({
727
3478
  id: externalId,
3479
+ value,
3480
+ defaultValue,
3481
+ onValueChange,
3482
+ onValueCommit,
3483
+ min = 0,
3484
+ max = 100,
3485
+ size,
728
3486
  label,
729
3487
  helperText,
730
3488
  errorMessage,
731
3489
  error,
732
- size,
733
- required,
734
- placeholder,
3490
+ showValue = false,
3491
+ formatValue,
3492
+ thumbLabels = DEFAULT_THUMB_LABELS,
735
3493
  className,
736
- children,
737
- ...rootProps
3494
+ ...props
738
3495
  }) {
3496
+ const labelId = useId4();
739
3497
  const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
740
- name: "Select",
3498
+ name: "Slider",
741
3499
  id: externalId,
742
3500
  label,
743
3501
  error,
744
3502
  errorMessage,
745
3503
  helperText,
746
- "aria-label": rootProps["aria-label"],
747
- "aria-labelledby": rootProps["aria-labelledby"]
3504
+ "aria-label": props["aria-label"],
3505
+ "aria-labelledby": props["aria-labelledby"] ?? (label ? labelId : void 0)
748
3506
  });
749
- const ctx = useContext2(DgaContext);
750
- const portalContainer = ctx?.rootEl ?? void 0;
751
- return /* @__PURE__ */ jsxs8("div", { "data-slot": "select-field", className: "ddga-field", children: [
752
- label && /* @__PURE__ */ jsxs8("label", { htmlFor: fieldId, className: "ddga-select__label", children: [
753
- label,
754
- required && /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "ddga-select__required", children: "*" })
755
- ] }),
756
- /* @__PURE__ */ jsxs8(SelectPrimitive.Root, { required, ...rootProps, children: [
757
- /* @__PURE__ */ jsxs8(
758
- SelectPrimitive.Trigger,
759
- {
760
- ...controlProps,
761
- "data-slot": "select-trigger",
762
- className: cn(selectTriggerVariants({ size, error: hasError }), className),
763
- children: [
764
- /* @__PURE__ */ jsx9(SelectPrimitive.Value, { placeholder }),
765
- /* @__PURE__ */ jsx9(SelectPrimitive.Icon, { asChild: true, className: "ddga-select__icon", children: /* @__PURE__ */ jsx9(ChevronDown, { "aria-hidden": "true" }) })
766
- ]
767
- }
768
- ),
769
- /* @__PURE__ */ jsx9(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx9(
770
- SelectPrimitive.Content,
771
- {
772
- "data-slot": "select-content",
773
- className: "ddga-select-content",
774
- position: "popper",
775
- sideOffset: 4,
776
- children: /* @__PURE__ */ jsx9(SelectPrimitive.Viewport, { className: "ddga-select-viewport", children })
777
- }
778
- ) })
3507
+ const isRange = Array.isArray(value ?? defaultValue);
3508
+ const valueArray = toArray(value);
3509
+ const defaultArray = toArray(defaultValue) ?? [min];
3510
+ const wrap = (next) => isRange ? next : next[0];
3511
+ const currentForRender = valueArray ?? defaultArray;
3512
+ const fmt = (n) => formatValue ? formatValue(n) : String(n);
3513
+ return /* @__PURE__ */ jsxs24("div", { "data-slot": "slider-field", className: "ddga-field", children: [
3514
+ (label || showValue) && /* @__PURE__ */ jsxs24("div", { className: "ddga-slider__header", children: [
3515
+ label && /* @__PURE__ */ jsx31("span", { id: labelId, className: "ddga-slider__label", children: label }),
3516
+ showValue && /* @__PURE__ */ jsx31("span", { className: "ddga-slider__value", "aria-hidden": "true", children: currentForRender.map(fmt).join(" \u2013 ") })
779
3517
  ] }),
780
- hasErrorMessage && /* @__PURE__ */ jsx9(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
781
- hasHelper && /* @__PURE__ */ jsx9(FieldMessage, { id: helperId, variant: "helper", children: helperText })
3518
+ /* @__PURE__ */ jsxs24(
3519
+ SliderPrimitive.Root,
3520
+ {
3521
+ ...props,
3522
+ id: fieldId,
3523
+ min,
3524
+ max,
3525
+ value: valueArray,
3526
+ defaultValue: value === void 0 ? defaultArray : void 0,
3527
+ onValueChange: onValueChange ? (next) => onValueChange(wrap(next)) : void 0,
3528
+ onValueCommit: onValueCommit ? (next) => onValueCommit(wrap(next)) : void 0,
3529
+ "aria-invalid": controlProps["aria-invalid"],
3530
+ "data-slot": "slider",
3531
+ className: cn(sliderVariants({ size, error: hasError }), className),
3532
+ children: [
3533
+ /* @__PURE__ */ jsx31(SliderPrimitive.Track, { "data-slot": "slider-track", className: "ddga-slider__track", children: /* @__PURE__ */ jsx31(SliderPrimitive.Range, { "data-slot": "slider-range", className: "ddga-slider__range" }) }),
3534
+ currentForRender.map((thumbValue, index) => /* @__PURE__ */ jsx31(
3535
+ SliderPrimitive.Thumb,
3536
+ {
3537
+ "data-slot": "slider-thumb",
3538
+ className: "ddga-slider__thumb",
3539
+ "aria-label": isRange ? thumbLabels[index] : void 0,
3540
+ "aria-labelledby": !isRange && label ? labelId : void 0,
3541
+ "aria-valuetext": formatValue ? fmt(thumbValue) : void 0,
3542
+ "aria-describedby": controlProps["aria-describedby"]
3543
+ },
3544
+ index
3545
+ ))
3546
+ ]
3547
+ }
3548
+ ),
3549
+ hasErrorMessage && /* @__PURE__ */ jsx31(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
3550
+ hasHelper && /* @__PURE__ */ jsx31(FieldMessage, { id: helperId, variant: "helper", children: helperText })
782
3551
  ] });
783
3552
  }
784
- function SelectItem({ className, children, ...props }) {
785
- return /* @__PURE__ */ jsxs8(
786
- SelectPrimitive.Item,
787
- {
788
- ...props,
789
- "data-slot": "select-item",
790
- className: cn("ddga-select-item", className),
791
- children: [
792
- /* @__PURE__ */ jsx9(SelectPrimitive.ItemText, { children }),
793
- /* @__PURE__ */ jsx9(SelectPrimitive.ItemIndicator, { className: "ddga-select-item__indicator", children: /* @__PURE__ */ jsx9(Check, { className: "ddga-select-item__check", "aria-hidden": "true" }) })
794
- ]
795
- }
796
- );
797
- }
798
3553
 
799
- // src/components/Tooltip/Tooltip.tsx
800
- import { useContext as useContext3 } from "react";
801
- import { Tooltip as TooltipPrimitive } from "radix-ui";
802
- import { cva as cva8 } from "class-variance-authority";
803
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
804
- var tooltipContentVariants = cva8("ddga-tooltip", {
3554
+ // src/components/NumberInput/NumberInput.tsx
3555
+ import { useState as useState6 } from "react";
3556
+ import { cva as cva29 } from "class-variance-authority";
3557
+ import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
3558
+ var numberInputVariants = cva29("ddga-number-input", {
805
3559
  variants: {
806
3560
  size: {
807
- sm: "ddga-tooltip--sm",
808
- md: "ddga-tooltip--md"
3561
+ sm: "ddga-number-input--sm",
3562
+ md: "ddga-number-input--md",
3563
+ lg: "ddga-number-input--lg"
3564
+ },
3565
+ error: {
3566
+ true: "ddga-number-input--error"
809
3567
  }
810
3568
  },
811
3569
  defaultVariants: {
812
3570
  size: "md"
813
3571
  }
814
3572
  });
815
- function Tooltip(props) {
816
- return /* @__PURE__ */ jsx10(TooltipPrimitive.Root, { ...props });
3573
+ function clamp(value, min, max) {
3574
+ let next = value;
3575
+ if (min != null) next = Math.max(min, next);
3576
+ if (max != null) next = Math.min(max, next);
3577
+ return next;
817
3578
  }
818
- function TooltipTrigger({ className, ...props }) {
819
- return /* @__PURE__ */ jsx10(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", className, ...props });
3579
+ function formatNumber(value) {
3580
+ if (!Number.isFinite(value)) return "";
3581
+ return value.toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 20 });
820
3582
  }
821
- function TooltipContent({
3583
+ function NumberInput({
3584
+ id: externalId,
3585
+ value,
3586
+ defaultValue,
3587
+ onValueChange,
3588
+ min,
3589
+ max,
3590
+ step = 1,
822
3591
  size,
823
- arrow = true,
824
- sideOffset = 6,
3592
+ hideControls = false,
3593
+ decrementLabel = "Decrease",
3594
+ incrementLabel = "Increase",
3595
+ label,
3596
+ helperText,
3597
+ errorMessage,
3598
+ error,
3599
+ required,
3600
+ disabled,
825
3601
  className,
826
- children,
3602
+ onBlur,
3603
+ onKeyDown,
827
3604
  ...props
828
3605
  }) {
829
- const ctx = useContext3(DgaContext);
830
- const portalContainer = ctx?.rootEl ?? void 0;
831
- return /* @__PURE__ */ jsx10(TooltipPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxs9(
832
- TooltipPrimitive.Content,
833
- {
834
- "data-slot": "tooltip-content",
835
- sideOffset,
836
- className: cn(tooltipContentVariants({ size }), className),
837
- ...props,
838
- children: [
839
- children,
840
- arrow ? /* @__PURE__ */ jsx10(TooltipPrimitive.Arrow, { className: "ddga-tooltip__arrow" }) : null
841
- ]
3606
+ const isControlled = value !== void 0;
3607
+ const [internal, setInternal] = useState6(defaultValue ?? null);
3608
+ const numericValue = isControlled ? value : internal;
3609
+ const [draft, setDraft] = useState6(null);
3610
+ const allowDecimal = !Number.isInteger(step);
3611
+ const allowNegative = min == null || min < 0;
3612
+ const displayValue = draft ?? (numericValue == null ? "" : formatNumber(numericValue));
3613
+ const allowedPattern = new RegExp(
3614
+ `^${allowNegative ? "-?" : ""}\\d*${allowDecimal ? "(\\.\\d*)?" : ""}$`
3615
+ );
3616
+ function commit(next) {
3617
+ if (!isControlled) setInternal(next);
3618
+ onValueChange?.(next);
3619
+ }
3620
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
3621
+ name: "NumberInput",
3622
+ id: externalId,
3623
+ label,
3624
+ error,
3625
+ errorMessage,
3626
+ helperText,
3627
+ "aria-label": props["aria-label"],
3628
+ "aria-labelledby": props["aria-labelledby"]
3629
+ });
3630
+ function handleChange(event) {
3631
+ const raw = event.target.value;
3632
+ if (!allowedPattern.test(raw)) return;
3633
+ setDraft(raw);
3634
+ if (raw.trim() === "") {
3635
+ commit(null);
3636
+ return;
842
3637
  }
843
- ) });
3638
+ const parsed = Number(raw);
3639
+ if (Number.isFinite(parsed)) commit(parsed);
3640
+ }
3641
+ function handleBlur(event) {
3642
+ if (numericValue != null) commit(clamp(numericValue, min, max));
3643
+ setDraft(null);
3644
+ onBlur?.(event);
3645
+ }
3646
+ function stepBy(direction) {
3647
+ const base = numericValue ?? (direction > 0 ? min ?? 0 : max ?? 0);
3648
+ const next = clamp(base + direction * step, min, max);
3649
+ const rounded = allowDecimal ? Number(next.toFixed(10)) : next;
3650
+ commit(rounded);
3651
+ setDraft(null);
3652
+ }
3653
+ function handleKeyDown(event) {
3654
+ if (!disabled) {
3655
+ if (event.key === "ArrowUp") {
3656
+ event.preventDefault();
3657
+ stepBy(1);
3658
+ } else if (event.key === "ArrowDown") {
3659
+ event.preventDefault();
3660
+ stepBy(-1);
3661
+ }
3662
+ }
3663
+ onKeyDown?.(event);
3664
+ }
3665
+ const atMin = min != null && numericValue != null && numericValue <= min;
3666
+ const atMax = max != null && numericValue != null && numericValue >= max;
3667
+ return /* @__PURE__ */ jsxs25("div", { "data-slot": "number-input-field", className: "ddga-field", children: [
3668
+ label && /* @__PURE__ */ jsxs25("label", { htmlFor: fieldId, className: "ddga-number-input__label", children: [
3669
+ label,
3670
+ required && /* @__PURE__ */ jsx32("span", { "aria-hidden": "true", className: "ddga-number-input__required", children: "*" })
3671
+ ] }),
3672
+ /* @__PURE__ */ jsxs25(
3673
+ "div",
3674
+ {
3675
+ "data-slot": "number-input-control",
3676
+ className: cn(numberInputVariants({ size, error: hasError }), className),
3677
+ children: [
3678
+ !hideControls && /* @__PURE__ */ jsx32(
3679
+ "button",
3680
+ {
3681
+ type: "button",
3682
+ "data-slot": "number-input-decrement",
3683
+ className: "ddga-number-input__step ddga-number-input__step--decrement",
3684
+ "aria-label": decrementLabel,
3685
+ onClick: () => stepBy(-1),
3686
+ disabled: disabled || atMin,
3687
+ tabIndex: -1,
3688
+ children: /* @__PURE__ */ jsx32(Minus, { "aria-hidden": "true" })
3689
+ }
3690
+ ),
3691
+ /* @__PURE__ */ jsx32(
3692
+ "input",
3693
+ {
3694
+ ...props,
3695
+ ...controlProps,
3696
+ type: "text",
3697
+ inputMode: allowDecimal ? "decimal" : "numeric",
3698
+ value: displayValue,
3699
+ required,
3700
+ disabled,
3701
+ onChange: handleChange,
3702
+ onBlur: handleBlur,
3703
+ onKeyDown: handleKeyDown,
3704
+ "data-slot": "number-input",
3705
+ className: "ddga-number-input__field"
3706
+ }
3707
+ ),
3708
+ !hideControls && /* @__PURE__ */ jsx32(
3709
+ "button",
3710
+ {
3711
+ type: "button",
3712
+ "data-slot": "number-input-increment",
3713
+ className: "ddga-number-input__step ddga-number-input__step--increment",
3714
+ "aria-label": incrementLabel,
3715
+ onClick: () => stepBy(1),
3716
+ disabled: disabled || atMax,
3717
+ tabIndex: -1,
3718
+ children: /* @__PURE__ */ jsx32(Plus, { "aria-hidden": "true" })
3719
+ }
3720
+ )
3721
+ ]
3722
+ }
3723
+ ),
3724
+ hasErrorMessage && /* @__PURE__ */ jsx32(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
3725
+ hasHelper && /* @__PURE__ */ jsx32(FieldMessage, { id: helperId, variant: "helper", children: helperText })
3726
+ ] });
844
3727
  }
845
3728
 
846
- // src/components/Alert/Alert.tsx
847
- import { useState } from "react";
848
- import { Slot as SlotPrimitive2 } from "radix-ui";
849
- import { cva as cva9 } from "class-variance-authority";
850
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
851
- var alertVariants = cva9("ddga-alert", {
3729
+ // src/components/Rating/Rating.tsx
3730
+ import { useRef as useRef2, useState as useState7 } from "react";
3731
+ import { cva as cva30 } from "class-variance-authority";
3732
+ import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
3733
+ var ratingVariants = cva30("ddga-rating", {
852
3734
  variants: {
853
- variant: {
854
- info: "ddga-alert--info",
855
- success: "ddga-alert--success",
856
- warning: "ddga-alert--warning",
857
- destructive: "ddga-alert--destructive"
3735
+ size: {
3736
+ sm: "ddga-rating--sm",
3737
+ md: "ddga-rating--md",
3738
+ lg: "ddga-rating--lg"
858
3739
  }
859
3740
  },
860
3741
  defaultVariants: {
861
- variant: "info"
3742
+ size: "md"
862
3743
  }
863
3744
  });
864
- var DEFAULT_ICONS = {
865
- info: /* @__PURE__ */ jsx11(Info, { "aria-hidden": "true" }),
866
- success: /* @__PURE__ */ jsx11(Check, { "aria-hidden": "true" }),
867
- warning: /* @__PURE__ */ jsx11(AlertTriangle, { "aria-hidden": "true" }),
868
- destructive: /* @__PURE__ */ jsx11(AlertCircle, { "aria-hidden": "true" })
869
- };
870
- function Alert({
871
- variant,
872
- asChild,
873
- icon,
874
- dismissible,
875
- open: controlledOpen,
876
- onDismiss,
877
- live,
878
- closeLabel = "Dismiss",
3745
+ function clamp2(value, min, max) {
3746
+ return Math.min(max, Math.max(min, value));
3747
+ }
3748
+ function defaultValueText(value, max) {
3749
+ return `${value} out of ${max} stars`;
3750
+ }
3751
+ function fillFor(index, value, allowHalf) {
3752
+ if (value >= index + 1) return "full";
3753
+ if (allowHalf && value >= index + 0.5) return "half";
3754
+ return "empty";
3755
+ }
3756
+ function Rating({
3757
+ id: externalId,
3758
+ value,
3759
+ defaultValue,
3760
+ onValueChange,
3761
+ max = 5,
3762
+ allowHalf = false,
3763
+ readOnly = false,
3764
+ disabled = false,
3765
+ size,
3766
+ label,
3767
+ helperText,
3768
+ errorMessage,
3769
+ error,
3770
+ formatValueText = defaultValueText,
879
3771
  className,
880
- children,
881
3772
  ...props
882
3773
  }) {
883
- const [internalOpen, setInternalOpen] = useState(true);
884
- const isControlled = controlledOpen !== void 0;
885
- const open = isControlled ? controlledOpen : internalOpen;
886
- if (!open) return null;
887
- const Comp = asChild ? SlotPrimitive2.Slot : "div";
888
- const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS[variant ?? "info"];
889
- const liveProps = live === "assertive" ? { role: "alert", "aria-live": "assertive" } : live === "polite" ? { role: "status", "aria-live": "polite" } : {};
890
- function handleDismiss() {
891
- if (!isControlled) setInternalOpen(false);
892
- onDismiss?.();
3774
+ const rootRef = useRef2(null);
3775
+ const isControlled = value !== void 0;
3776
+ const [internal, setInternal] = useState7(defaultValue ?? 0);
3777
+ const currentValue = isControlled ? value : internal;
3778
+ const [hover, setHover] = useState7(null);
3779
+ const interactive = !readOnly && !disabled;
3780
+ const stepSize = allowHalf ? 0.5 : 1;
3781
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
3782
+ name: "Rating",
3783
+ id: externalId,
3784
+ label,
3785
+ error,
3786
+ errorMessage,
3787
+ helperText,
3788
+ // role=slider / role=img always have an accessible name (label or the
3789
+ // value text), so suppress the no-label dev warning.
3790
+ "aria-label": props["aria-label"] ?? formatValueText(currentValue, max),
3791
+ "aria-labelledby": props["aria-labelledby"]
3792
+ });
3793
+ const displayValue = hover ?? currentValue;
3794
+ function commit(next) {
3795
+ if (!isControlled) setInternal(next);
3796
+ onValueChange?.(next);
893
3797
  }
894
- return /* @__PURE__ */ jsxs10(
895
- Comp,
896
- {
897
- "data-slot": "alert",
898
- "data-variant": variant ?? "info",
899
- className: cn(alertVariants({ variant }), className),
900
- ...liveProps,
901
- ...props,
902
- children: [
903
- resolvedIcon ? /* @__PURE__ */ jsx11("span", { className: "ddga-alert__icon", children: resolvedIcon }) : null,
904
- asChild ? (
905
- // Slot mode: the consumer's element receives the children body.
906
- // Title/description are nested by the consumer.
907
- /* @__PURE__ */ jsx11(SlotPrimitive2.Slottable, { children })
908
- ) : /* @__PURE__ */ jsx11("div", { className: "ddga-alert__body", children }),
909
- dismissible ? /* @__PURE__ */ jsx11(
910
- "button",
911
- {
912
- type: "button",
913
- className: "ddga-alert__close",
914
- "aria-label": closeLabel,
915
- onClick: handleDismiss,
916
- children: /* @__PURE__ */ jsx11(Close, { "aria-hidden": "true" })
917
- }
918
- ) : null
919
- ]
920
- }
921
- );
922
- }
923
- function AlertTitle({ asChild, className, ...props }) {
924
- const Comp = asChild ? SlotPrimitive2.Slot : "h5";
925
- return /* @__PURE__ */ jsx11(Comp, { "data-slot": "alert-title", className: cn("ddga-alert__title", className), ...props });
926
- }
927
- function AlertDescription({ asChild, className, ...props }) {
928
- const Comp = asChild ? SlotPrimitive2.Slot : "p";
929
- return /* @__PURE__ */ jsx11(
930
- Comp,
931
- {
932
- "data-slot": "alert-description",
933
- className: cn("ddga-alert__description", className),
934
- ...props
3798
+ function readDir() {
3799
+ const el = rootRef.current;
3800
+ if (!el || typeof getComputedStyle !== "function") return "ltr";
3801
+ return getComputedStyle(el).direction === "rtl" ? "rtl" : "ltr";
3802
+ }
3803
+ function pointerValue(event, index) {
3804
+ const rect = event.currentTarget.getBoundingClientRect();
3805
+ let fraction = rect.width ? (event.clientX - rect.left) / rect.width : 1;
3806
+ if (readDir() === "rtl") fraction = 1 - fraction;
3807
+ if (allowHalf) return index + (fraction <= 0.5 ? 0.5 : 1);
3808
+ return index + 1;
3809
+ }
3810
+ function handleKeyDown(event) {
3811
+ if (!interactive) return;
3812
+ const rtl = readDir() === "rtl";
3813
+ let next = null;
3814
+ switch (event.key) {
3815
+ case "ArrowUp":
3816
+ next = currentValue + stepSize;
3817
+ break;
3818
+ case "ArrowDown":
3819
+ next = currentValue - stepSize;
3820
+ break;
3821
+ case "ArrowRight":
3822
+ next = currentValue + (rtl ? -stepSize : stepSize);
3823
+ break;
3824
+ case "ArrowLeft":
3825
+ next = currentValue + (rtl ? stepSize : -stepSize);
3826
+ break;
3827
+ case "Home":
3828
+ next = 0;
3829
+ break;
3830
+ case "End":
3831
+ next = max;
3832
+ break;
3833
+ default:
3834
+ return;
935
3835
  }
936
- );
3836
+ event.preventDefault();
3837
+ commit(clamp2(next, 0, max));
3838
+ }
3839
+ const stars = Array.from({ length: max }, (_, index) => {
3840
+ const level = fillFor(index, displayValue, allowHalf);
3841
+ return /* @__PURE__ */ jsxs26(
3842
+ "span",
3843
+ {
3844
+ "data-slot": "rating-star",
3845
+ "data-fill": level,
3846
+ className: "ddga-rating__star",
3847
+ onPointerMove: interactive ? (event) => setHover(pointerValue(event, index)) : void 0,
3848
+ onClick: interactive ? (event) => commit(pointerValue(event, index)) : void 0,
3849
+ children: [
3850
+ /* @__PURE__ */ jsx33(Star, { className: "ddga-rating__star-bg", "aria-hidden": "true" }),
3851
+ /* @__PURE__ */ jsx33("span", { className: "ddga-rating__star-fill", "aria-hidden": "true", children: /* @__PURE__ */ jsx33(Star, { className: "ddga-rating__star-fg", "aria-hidden": "true" }) })
3852
+ ]
3853
+ },
3854
+ index
3855
+ );
3856
+ });
3857
+ const sharedProps = {
3858
+ ref: rootRef,
3859
+ "data-slot": "rating",
3860
+ "data-disabled": disabled || void 0,
3861
+ className: cn(ratingVariants({ size }), hasError && "ddga-rating--error", className),
3862
+ onPointerLeave: interactive ? () => setHover(null) : void 0
3863
+ };
3864
+ const labelledBy = label ? `${fieldId}-label` : props["aria-labelledby"];
3865
+ const ariaLabel = labelledBy ? void 0 : props["aria-label"] ?? "Rating";
3866
+ return /* @__PURE__ */ jsxs26("div", { "data-slot": "rating-field", className: "ddga-field", children: [
3867
+ label && /* @__PURE__ */ jsx33("span", { id: `${fieldId}-label`, className: "ddga-rating__label", children: label }),
3868
+ readOnly ? /* @__PURE__ */ jsx33("div", { ...sharedProps, role: "img", "aria-label": formatValueText(currentValue, max), children: stars }) : /* @__PURE__ */ jsx33(
3869
+ "div",
3870
+ {
3871
+ ...sharedProps,
3872
+ role: "slider",
3873
+ id: fieldId,
3874
+ tabIndex: disabled ? -1 : 0,
3875
+ "aria-valuemin": 0,
3876
+ "aria-valuemax": max,
3877
+ "aria-valuenow": currentValue,
3878
+ "aria-valuetext": formatValueText(currentValue, max),
3879
+ "aria-labelledby": labelledBy,
3880
+ "aria-label": ariaLabel,
3881
+ "aria-invalid": controlProps["aria-invalid"],
3882
+ "aria-describedby": controlProps["aria-describedby"],
3883
+ "aria-disabled": disabled || void 0,
3884
+ onKeyDown: handleKeyDown,
3885
+ children: stars
3886
+ }
3887
+ ),
3888
+ hasErrorMessage && /* @__PURE__ */ jsx33(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
3889
+ hasHelper && /* @__PURE__ */ jsx33(FieldMessage, { id: helperId, variant: "helper", children: helperText })
3890
+ ] });
937
3891
  }
938
3892
 
939
- // src/components/Modal/Modal.tsx
940
- import { useContext as useContext4 } from "react";
941
- import { Dialog as DialogPrimitive, Slot as SlotPrimitive3 } from "radix-ui";
942
- import { cva as cva10 } from "class-variance-authority";
943
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
944
- var modalContentVariants = cva10("ddga-modal", {
3893
+ // src/components/Toggle/Toggle.tsx
3894
+ import { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
3895
+ import { cva as cva31 } from "class-variance-authority";
3896
+ import { jsx as jsx34 } from "react/jsx-runtime";
3897
+ var toggleVariants = cva31("ddga-toggle", {
3898
+ variants: {
3899
+ variant: {
3900
+ default: "ddga-toggle--default",
3901
+ outline: "ddga-toggle--outline"
3902
+ },
3903
+ size: {
3904
+ sm: "ddga-toggle--sm",
3905
+ md: "ddga-toggle--md",
3906
+ lg: "ddga-toggle--lg"
3907
+ }
3908
+ },
3909
+ defaultVariants: {
3910
+ variant: "default",
3911
+ size: "md"
3912
+ }
3913
+ });
3914
+ var toggleGroupVariants = cva31("ddga-toggle-group", {
945
3915
  variants: {
3916
+ variant: {
3917
+ default: "ddga-toggle-group--default",
3918
+ outline: "ddga-toggle-group--outline"
3919
+ },
946
3920
  size: {
947
- sm: "ddga-modal--sm",
948
- md: "ddga-modal--md",
949
- lg: "ddga-modal--lg",
950
- xl: "ddga-modal--xl",
951
- full: "ddga-modal--full"
3921
+ sm: "ddga-toggle-group--sm",
3922
+ md: "ddga-toggle-group--md",
3923
+ lg: "ddga-toggle-group--lg"
952
3924
  }
953
3925
  },
954
3926
  defaultVariants: {
3927
+ variant: "default",
955
3928
  size: "md"
956
3929
  }
957
3930
  });
958
- function Modal(props) {
959
- return /* @__PURE__ */ jsx12(DialogPrimitive.Root, { ...props });
960
- }
961
- function ModalTrigger({ className, ...props }) {
962
- return /* @__PURE__ */ jsx12(DialogPrimitive.Trigger, { "data-slot": "modal-trigger", className, ...props });
963
- }
964
- function ModalContent({
965
- size,
966
- showCloseButton = true,
967
- closeLabel = "Close",
968
- className,
969
- children,
970
- ...props
971
- }) {
972
- const ctx = useContext4(DgaContext);
973
- const portalContainer = ctx?.rootEl ?? void 0;
974
- return /* @__PURE__ */ jsxs11(DialogPrimitive.Portal, { container: portalContainer, children: [
975
- /* @__PURE__ */ jsx12(DialogPrimitive.Overlay, { className: "ddga-modal__overlay", "data-slot": "modal-overlay" }),
976
- /* @__PURE__ */ jsxs11(
977
- DialogPrimitive.Content,
978
- {
979
- "data-slot": "modal-content",
980
- className: cn(modalContentVariants({ size }), className),
981
- ...props,
982
- children: [
983
- children,
984
- showCloseButton ? /* @__PURE__ */ jsx12(
985
- DialogPrimitive.Close,
986
- {
987
- className: "ddga-modal__close",
988
- "aria-label": closeLabel,
989
- "data-slot": "modal-close-x",
990
- children: /* @__PURE__ */ jsx12(Close, { "aria-hidden": "true" })
991
- }
992
- ) : null
993
- ]
994
- }
995
- )
996
- ] });
997
- }
998
- function ModalHeader({ asChild, className, ...props }) {
999
- const Comp = asChild ? SlotPrimitive3.Slot : "div";
1000
- return /* @__PURE__ */ jsx12(Comp, { "data-slot": "modal-header", className: cn("ddga-modal__header", className), ...props });
1001
- }
1002
- function ModalTitle({ asChild, className, ...props }) {
1003
- return /* @__PURE__ */ jsx12(
1004
- DialogPrimitive.Title,
3931
+ function Toggle({ variant, size, className, ...props }) {
3932
+ return /* @__PURE__ */ jsx34(
3933
+ TogglePrimitive.Root,
1005
3934
  {
1006
- asChild,
1007
- "data-slot": "modal-title",
1008
- className: cn("ddga-modal__title", className),
3935
+ "data-slot": "toggle",
3936
+ className: cn(toggleVariants({ variant, size }), className),
1009
3937
  ...props
1010
3938
  }
1011
3939
  );
1012
3940
  }
1013
- function ModalDescription({ asChild, className, ...props }) {
1014
- return /* @__PURE__ */ jsx12(
1015
- DialogPrimitive.Description,
3941
+ function ToggleGroup({ variant, size, className, ...props }) {
3942
+ if (process.env.NODE_ENV === "development" && !props["aria-label"] && !props["aria-labelledby"]) {
3943
+ console.warn(
3944
+ "[@dev-dga/react] ToggleGroup should have an `aria-label` or `aria-labelledby` so the button group has an accessible name."
3945
+ );
3946
+ }
3947
+ return /* @__PURE__ */ jsx34(
3948
+ ToggleGroupPrimitive.Root,
1016
3949
  {
1017
- asChild,
1018
- "data-slot": "modal-description",
1019
- className: cn("ddga-modal__description", className),
3950
+ "data-slot": "toggle-group",
3951
+ className: cn(toggleGroupVariants({ variant, size }), className),
1020
3952
  ...props
1021
3953
  }
1022
3954
  );
1023
3955
  }
1024
- function ModalFooter({ asChild, className, ...props }) {
1025
- const Comp = asChild ? SlotPrimitive3.Slot : "div";
1026
- return /* @__PURE__ */ jsx12(Comp, { "data-slot": "modal-footer", className: cn("ddga-modal__footer", className), ...props });
1027
- }
1028
- function ModalClose({ className, ...props }) {
1029
- return /* @__PURE__ */ jsx12(DialogPrimitive.Close, { "data-slot": "modal-close", className, ...props });
1030
- }
1031
-
1032
- // src/components/Toast/Toast.tsx
1033
- import { useSyncExternalStore } from "react";
1034
- import { Toast as ToastPrimitive } from "radix-ui";
1035
- import { cva as cva11 } from "class-variance-authority";
1036
-
1037
- // src/components/Toast/toast-store.ts
1038
- import "react";
1039
- var EXIT_ANIM_MS = 200;
1040
- function createToastStore() {
1041
- let toasts = [];
1042
- const listeners = /* @__PURE__ */ new Set();
1043
- let counter = 0;
1044
- function emit() {
1045
- for (const l of listeners) l();
1046
- }
1047
- function subscribe(listener) {
1048
- listeners.add(listener);
1049
- return () => {
1050
- listeners.delete(listener);
1051
- };
1052
- }
1053
- function getSnapshot() {
1054
- return toasts;
1055
- }
1056
- function nextId() {
1057
- counter += 1;
1058
- return `t${counter}`;
1059
- }
1060
- function add(variant, message, options = {}) {
1061
- const id = options.id ?? nextId();
1062
- const existing = toasts.findIndex((t) => t.id === id);
1063
- const data = {
1064
- id,
1065
- variant,
1066
- open: true,
1067
- title: message,
1068
- description: options.description,
1069
- duration: options.duration,
1070
- action: options.action,
1071
- onDismiss: options.onDismiss
1072
- };
1073
- if (existing >= 0) {
1074
- toasts = toasts.map((t, i) => i === existing ? data : t);
1075
- } else {
1076
- toasts = [...toasts, data];
1077
- }
1078
- emit();
1079
- return id;
1080
- }
1081
- function dismiss(id) {
1082
- if (id === void 0) {
1083
- const ids = toasts.map((t) => t.id);
1084
- toasts = toasts.map((t) => ({ ...t, open: false }));
1085
- emit();
1086
- setTimeout(() => {
1087
- ids.forEach((id2) => remove(id2));
1088
- }, EXIT_ANIM_MS);
1089
- } else {
1090
- toasts = toasts.map((t) => t.id === id ? { ...t, open: false } : t);
1091
- emit();
1092
- setTimeout(() => remove(id), EXIT_ANIM_MS);
3956
+ function ToggleGroupItem({ className, ...props }) {
3957
+ return /* @__PURE__ */ jsx34(
3958
+ ToggleGroupPrimitive.Item,
3959
+ {
3960
+ "data-slot": "toggle-group-item",
3961
+ className: cn("ddga-toggle-group__item", className),
3962
+ ...props
1093
3963
  }
1094
- }
1095
- function remove(id) {
1096
- const target = toasts.find((t) => t.id === id);
1097
- toasts = toasts.filter((t) => t.id !== id);
1098
- emit();
1099
- target?.onDismiss?.();
1100
- }
1101
- function __reset() {
1102
- toasts = [];
1103
- counter = 0;
1104
- emit();
1105
- }
1106
- return { subscribe, getSnapshot, add, dismiss, remove, __reset };
1107
- }
1108
- var toastStore = createToastStore();
1109
- function createToast(store) {
1110
- const fn = ((message, options) => store.add("default", message, options));
1111
- fn.default = (message, options) => store.add("default", message, options);
1112
- fn.info = (message, options) => store.add("info", message, options);
1113
- fn.success = (message, options) => store.add("success", message, options);
1114
- fn.warning = (message, options) => store.add("warning", message, options);
1115
- fn.error = (message, options) => store.add("destructive", message, options);
1116
- fn.destructive = fn.error;
1117
- fn.dismiss = (id) => store.dismiss(id);
1118
- return fn;
3964
+ );
1119
3965
  }
1120
- var toast = createToast(toastStore);
1121
3966
 
1122
- // src/components/Toast/Toast.tsx
1123
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1124
- var toastVariants = cva11("ddga-toast", {
1125
- variants: {
1126
- variant: {
1127
- default: "ddga-toast--default",
1128
- info: "ddga-toast--info",
1129
- success: "ddga-toast--success",
1130
- warning: "ddga-toast--warning",
1131
- destructive: "ddga-toast--destructive"
1132
- }
1133
- },
1134
- defaultVariants: {
1135
- variant: "default"
1136
- }
1137
- });
1138
- var toastViewportVariants = cva11("ddga-toast-viewport", {
3967
+ // src/components/DescriptionList/DescriptionList.tsx
3968
+ import { cva as cva32 } from "class-variance-authority";
3969
+ import { jsx as jsx35 } from "react/jsx-runtime";
3970
+ var descriptionListVariants = cva32("ddga-description-list", {
1139
3971
  variants: {
1140
- position: {
1141
- "top-start": "ddga-toast-viewport--top-start",
1142
- "top-center": "ddga-toast-viewport--top-center",
1143
- "top-end": "ddga-toast-viewport--top-end",
1144
- "bottom-start": "ddga-toast-viewport--bottom-start",
1145
- "bottom-center": "ddga-toast-viewport--bottom-center",
1146
- "bottom-end": "ddga-toast-viewport--bottom-end"
3972
+ orientation: {
3973
+ horizontal: "ddga-description-list--horizontal",
3974
+ vertical: "ddga-description-list--vertical"
1147
3975
  },
1148
- containerized: {
1149
- true: "ddga-toast-viewport--containerized"
3976
+ divided: {
3977
+ true: "ddga-description-list--divided"
1150
3978
  }
1151
3979
  },
1152
3980
  defaultVariants: {
1153
- position: "bottom-end"
3981
+ orientation: "horizontal"
1154
3982
  }
1155
3983
  });
1156
- var DEFAULT_ICONS2 = {
1157
- default: null,
1158
- info: /* @__PURE__ */ jsx13(Info, { "aria-hidden": "true" }),
1159
- success: /* @__PURE__ */ jsx13(Check, { "aria-hidden": "true" }),
1160
- warning: /* @__PURE__ */ jsx13(AlertTriangle, { "aria-hidden": "true" }),
1161
- destructive: /* @__PURE__ */ jsx13(AlertCircle, { "aria-hidden": "true" })
1162
- };
1163
- function Toaster({
1164
- position = "bottom-end",
1165
- containerized = false,
1166
- duration = 4e3,
1167
- closeButton = true,
1168
- closeLabel = "Dismiss",
1169
- hideIcon = false,
1170
- className,
1171
- swipeDirection,
1172
- store = toastStore
1173
- }) {
1174
- const toasts = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
1175
- const resolvedSwipe = swipeDirection ?? (position.startsWith("top") ? "up" : "down");
1176
- return /* @__PURE__ */ jsxs12(ToastPrimitive.Provider, { duration, swipeDirection: resolvedSwipe, children: [
1177
- toasts.map((t) => /* @__PURE__ */ jsx13(
1178
- ToastItem,
1179
- {
1180
- toast: t,
1181
- store,
1182
- closeButton,
1183
- closeLabel,
1184
- hideIcon
1185
- },
1186
- t.id
1187
- )),
1188
- /* @__PURE__ */ jsx13(
1189
- ToastPrimitive.Viewport,
1190
- {
1191
- "data-slot": "toast-viewport",
1192
- "data-position": position,
1193
- className: cn(toastViewportVariants({ position, containerized }), className)
1194
- }
1195
- )
1196
- ] });
3984
+ function DescriptionList({ orientation, divided, className, ...props }) {
3985
+ return /* @__PURE__ */ jsx35(
3986
+ "dl",
3987
+ {
3988
+ "data-slot": "description-list",
3989
+ className: cn(descriptionListVariants({ orientation, divided }), className),
3990
+ ...props
3991
+ }
3992
+ );
1197
3993
  }
1198
- function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
1199
- const radixType = t.variant === "destructive" ? "foreground" : "background";
1200
- const icon = hideIcon ? null : DEFAULT_ICONS2[t.variant];
1201
- return /* @__PURE__ */ jsxs12(
1202
- ToastPrimitive.Root,
3994
+ function DescriptionItem({ className, ...props }) {
3995
+ return /* @__PURE__ */ jsx35(
3996
+ "div",
1203
3997
  {
1204
- "data-slot": "toast",
1205
- "data-variant": t.variant,
1206
- className: toastVariants({ variant: t.variant }),
1207
- open: t.open,
1208
- type: radixType,
1209
- duration: t.duration,
1210
- onOpenChange: (open) => {
1211
- if (!open) {
1212
- store.dismiss(t.id);
1213
- }
1214
- },
1215
- children: [
1216
- icon ? /* @__PURE__ */ jsx13("span", { className: "ddga-toast__icon", children: icon }) : null,
1217
- /* @__PURE__ */ jsxs12("div", { className: "ddga-toast__body", children: [
1218
- t.title ? /* @__PURE__ */ jsx13(ToastPrimitive.Title, { className: "ddga-toast__title", children: t.title }) : null,
1219
- t.description ? /* @__PURE__ */ jsx13(ToastPrimitive.Description, { className: "ddga-toast__description", children: t.description }) : null,
1220
- t.action ? /* @__PURE__ */ jsx13(
1221
- ToastPrimitive.Action,
1222
- {
1223
- className: "ddga-toast__action",
1224
- altText: t.action.altText ?? (typeof t.action.label === "string" ? t.action.label : "Action"),
1225
- onClick: () => {
1226
- t.action?.onClick();
1227
- store.dismiss(t.id);
1228
- },
1229
- children: t.action.label
1230
- }
1231
- ) : null
1232
- ] }),
1233
- closeButton ? /* @__PURE__ */ jsx13(ToastPrimitive.Close, { className: "ddga-toast__close", "aria-label": closeLabel, children: /* @__PURE__ */ jsx13(Close, { "aria-hidden": "true" }) }) : null
1234
- ]
3998
+ "data-slot": "description-item",
3999
+ className: cn("ddga-description-list__item", className),
4000
+ ...props
4001
+ }
4002
+ );
4003
+ }
4004
+ function DescriptionTerm({ className, ...props }) {
4005
+ return /* @__PURE__ */ jsx35(
4006
+ "dt",
4007
+ {
4008
+ "data-slot": "description-term",
4009
+ className: cn("ddga-description-list__term", className),
4010
+ ...props
4011
+ }
4012
+ );
4013
+ }
4014
+ function DescriptionDetails({ className, ...props }) {
4015
+ return /* @__PURE__ */ jsx35(
4016
+ "dd",
4017
+ {
4018
+ "data-slot": "description-details",
4019
+ className: cn("ddga-description-list__details", className),
4020
+ ...props
1235
4021
  }
1236
4022
  );
1237
4023
  }
1238
4024
 
1239
4025
  // src/providers/DgaProvider.tsx
1240
- import { useState as useState2, useMemo, useContext as useContext5 } from "react";
4026
+ import { useState as useState8, useMemo as useMemo3, useContext as useContext9, useEffect, useRef as useRef3 } from "react";
1241
4027
  import { Direction as DirectionPrimitive, Tooltip as TooltipPrimitive2 } from "radix-ui";
1242
4028
  import { buildTheme } from "@dev-dga/tokens";
1243
- import { jsx as jsx14 } from "react/jsx-runtime";
4029
+ import { jsx as jsx36 } from "react/jsx-runtime";
1244
4030
  function DgaProvider({
1245
4031
  dir = "ltr",
1246
4032
  locale,
@@ -1251,17 +4037,46 @@ function DgaProvider({
1251
4037
  style: consumerStyle,
1252
4038
  children
1253
4039
  }) {
1254
- const parentCtx = useContext5(DgaContext);
4040
+ const parentCtx = useContext9(DgaContext);
1255
4041
  const isNested = parentCtx !== null;
1256
- const [rootEl, setRootEl] = useState2(null);
4042
+ const [rootEl, setRootEl] = useState8(null);
4043
+ const portalRef = useRef3(null);
4044
+ const [portalEl, setPortalEl] = useState8(null);
1257
4045
  const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
1258
- const ctxValue = useMemo(
1259
- () => ({ dir, locale: resolvedLocale, mode, rootEl }),
1260
- [dir, resolvedLocale, mode, rootEl]
4046
+ const themeVars = useMemo3(() => theme ? buildTheme(theme) : null, [theme]);
4047
+ useEffect(() => {
4048
+ if (typeof document === "undefined") return;
4049
+ const el = document.createElement("div");
4050
+ el.setAttribute("data-slot", "dga-portal");
4051
+ el.style.position = "relative";
4052
+ el.style.zIndex = "50";
4053
+ document.body.appendChild(el);
4054
+ portalRef.current = el;
4055
+ setPortalEl(el);
4056
+ return () => {
4057
+ el.remove();
4058
+ portalRef.current = null;
4059
+ setPortalEl(null);
4060
+ };
4061
+ }, []);
4062
+ useEffect(() => {
4063
+ const el = portalRef.current;
4064
+ if (!el) return;
4065
+ el.setAttribute("data-theme", mode);
4066
+ el.setAttribute("dir", dir);
4067
+ el.style.colorScheme = mode;
4068
+ if (themeVars) {
4069
+ for (const [k, v] of Object.entries(themeVars)) {
4070
+ el.style.setProperty(k, String(v));
4071
+ }
4072
+ }
4073
+ }, [mode, dir, themeVars, portalEl]);
4074
+ const ctxValue = useMemo3(
4075
+ () => ({ dir, locale: resolvedLocale, mode, rootEl, portalEl }),
4076
+ [dir, resolvedLocale, mode, rootEl, portalEl]
1261
4077
  );
1262
- const themeVars = useMemo(() => theme ? buildTheme(theme) : null, [theme]);
1263
- const inner = /* @__PURE__ */ jsx14(DirectionPrimitive.Provider, { dir, children });
1264
- return /* @__PURE__ */ jsx14(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx14(
4078
+ const inner = /* @__PURE__ */ jsx36(DirectionPrimitive.Provider, { dir, children });
4079
+ return /* @__PURE__ */ jsx36(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx36(
1265
4080
  Component,
1266
4081
  {
1267
4082
  ref: setRootEl,
@@ -1271,7 +4086,7 @@ function DgaProvider({
1271
4086
  "data-theme": mode,
1272
4087
  className,
1273
4088
  style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
1274
- children: isNested ? inner : /* @__PURE__ */ jsx14(TooltipPrimitive2.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
4089
+ children: isNested ? inner : /* @__PURE__ */ jsx36(TooltipPrimitive2.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
1275
4090
  }
1276
4091
  ) });
1277
4092
  }
@@ -1281,13 +4096,70 @@ function useDir() {
1281
4096
  return useDga().dir;
1282
4097
  }
1283
4098
  export {
4099
+ Accordion,
4100
+ AccordionContent,
4101
+ AccordionItem,
4102
+ AccordionTrigger,
1284
4103
  Alert,
1285
4104
  AlertDescription,
1286
4105
  AlertTitle,
4106
+ Avatar,
4107
+ AvatarFallback,
4108
+ AvatarGroup,
4109
+ AvatarImage,
4110
+ Badge,
4111
+ Breadcrumb,
4112
+ BreadcrumbEllipsis,
4113
+ BreadcrumbItem,
4114
+ BreadcrumbLink,
4115
+ BreadcrumbList,
4116
+ BreadcrumbPage,
4117
+ BreadcrumbSeparator,
1287
4118
  Button,
4119
+ Card,
4120
+ CardContent,
4121
+ CardDescription,
4122
+ CardFooter,
4123
+ CardHeader,
4124
+ CardImage,
4125
+ CardTitle,
1288
4126
  Checkbox,
4127
+ CircularProgress,
4128
+ Combobox,
4129
+ ComboboxGroup,
4130
+ ComboboxItem,
4131
+ ComboboxSeparator,
4132
+ DatePicker,
4133
+ DescriptionDetails,
4134
+ DescriptionItem,
4135
+ DescriptionList,
4136
+ DescriptionTerm,
1289
4137
  DgaProvider,
4138
+ Divider,
4139
+ Drawer,
4140
+ DrawerBody,
4141
+ DrawerClose,
4142
+ DrawerContent,
4143
+ DrawerDescription,
4144
+ DrawerFooter,
4145
+ DrawerHeader,
4146
+ DrawerTitle,
4147
+ DrawerTrigger,
4148
+ DropdownMenu,
4149
+ DropdownMenuCheckboxItem,
4150
+ DropdownMenuContent,
4151
+ DropdownMenuGroup,
4152
+ DropdownMenuItem,
4153
+ DropdownMenuLabel,
4154
+ DropdownMenuRadioGroup,
4155
+ DropdownMenuRadioItem,
4156
+ DropdownMenuSeparator,
4157
+ DropdownMenuSub,
4158
+ DropdownMenuSubContent,
4159
+ DropdownMenuSubTrigger,
4160
+ DropdownMenuTrigger,
1290
4161
  FieldMessage,
4162
+ FileUpload,
1291
4163
  Input,
1292
4164
  Modal,
1293
4165
  ModalClose,
@@ -1297,33 +4169,85 @@ export {
1297
4169
  ModalHeader,
1298
4170
  ModalTitle,
1299
4171
  ModalTrigger,
4172
+ NumberInput,
4173
+ Pagination,
4174
+ PaginationContent,
4175
+ PaginationEllipsis,
4176
+ PaginationItem,
4177
+ PaginationLink,
4178
+ PaginationNext,
4179
+ PaginationPrevious,
4180
+ Progress,
1300
4181
  Radio,
1301
4182
  RadioGroup,
4183
+ Rating,
1302
4184
  Select,
1303
4185
  SelectItem,
4186
+ Skeleton,
4187
+ Slider,
4188
+ Spinner,
4189
+ Step,
4190
+ StepDescription,
4191
+ StepIndicator,
4192
+ StepTitle,
4193
+ Steps,
1304
4194
  Switch,
4195
+ Tabs,
4196
+ TabsContent,
4197
+ TabsList,
4198
+ TabsTrigger,
1305
4199
  Textarea,
1306
4200
  Toaster,
4201
+ Toggle,
4202
+ ToggleGroup,
4203
+ ToggleGroupItem,
1307
4204
  Tooltip,
1308
4205
  TooltipContent,
1309
4206
  TooltipTrigger,
4207
+ accordionVariants,
1310
4208
  alertVariants,
4209
+ avatarVariants,
4210
+ badgeVariants,
4211
+ breadcrumbVariants,
1311
4212
  buttonVariants,
4213
+ cardVariants,
1312
4214
  checkboxVariants,
4215
+ circularProgressVariants,
1313
4216
  cn,
4217
+ comboboxTriggerVariants,
4218
+ comboboxVariants,
1314
4219
  createToast,
1315
4220
  createToastStore,
4221
+ datePickerVariants,
4222
+ descriptionListVariants,
4223
+ dividerVariants,
4224
+ drawerVariants,
4225
+ dropdownMenuVariants,
1316
4226
  inputVariants,
1317
4227
  modalContentVariants,
4228
+ numberInputVariants,
4229
+ paginationLinkVariants,
4230
+ paginationVariants,
4231
+ progressVariants,
1318
4232
  radioGroupVariants,
1319
4233
  radioVariants,
4234
+ ratingVariants,
1320
4235
  selectTriggerVariants,
4236
+ skeletonVariants,
4237
+ sliderVariants,
4238
+ spinnerVariants,
4239
+ stepVariants,
4240
+ stepsVariants,
1321
4241
  switchVariants,
4242
+ tabsListVariants,
4243
+ tabsVariants,
1322
4244
  textareaVariants,
1323
4245
  toast,
1324
4246
  toastStore,
1325
4247
  toastVariants,
1326
4248
  toastViewportVariants,
4249
+ toggleGroupVariants,
4250
+ toggleVariants,
1327
4251
  tooltipContentVariants,
1328
4252
  useDga,
1329
4253
  useDir,