@dev-dga/react 0.3.0 → 0.5.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/CHANGELOG.md +74 -0
- package/README.md +9 -1
- package/dist/index.cjs +2428 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +690 -4
- package/dist/index.d.ts +690 -4
- package/dist/index.js +2308 -134
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/components/Button/Button.tsx
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
4
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
4
5
|
|
|
5
6
|
// src/utils/cn.ts
|
|
6
7
|
import { clsx } from "clsx";
|
|
@@ -8,64 +9,20 @@ function cn(...inputs) {
|
|
|
8
9
|
return clsx(inputs);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
// src/
|
|
12
|
+
// src/components/Spinner/Spinner.tsx
|
|
13
|
+
import { cva } from "class-variance-authority";
|
|
12
14
|
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
height: "1em",
|
|
20
|
-
viewBox: "0 0 24 24",
|
|
21
|
-
fill: "none",
|
|
22
|
-
stroke: "currentColor",
|
|
23
|
-
strokeWidth: "2",
|
|
24
|
-
strokeLinecap: "round",
|
|
25
|
-
strokeLinejoin: "round",
|
|
26
|
-
className: "ddga-spinner",
|
|
27
|
-
...props,
|
|
28
|
-
children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
function Check(props) {
|
|
33
|
-
return /* @__PURE__ */ jsx(
|
|
34
|
-
"svg",
|
|
35
|
-
{
|
|
36
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
-
width: "1em",
|
|
38
|
-
height: "1em",
|
|
39
|
-
viewBox: "0 0 24 24",
|
|
40
|
-
fill: "none",
|
|
41
|
-
stroke: "currentColor",
|
|
42
|
-
strokeWidth: "3",
|
|
43
|
-
strokeLinecap: "round",
|
|
44
|
-
strokeLinejoin: "round",
|
|
45
|
-
...props,
|
|
46
|
-
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
function Minus(props) {
|
|
51
|
-
return /* @__PURE__ */ jsx(
|
|
52
|
-
"svg",
|
|
53
|
-
{
|
|
54
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
55
|
-
width: "1em",
|
|
56
|
-
height: "1em",
|
|
57
|
-
viewBox: "0 0 24 24",
|
|
58
|
-
fill: "none",
|
|
59
|
-
stroke: "currentColor",
|
|
60
|
-
strokeWidth: "3",
|
|
61
|
-
strokeLinecap: "round",
|
|
62
|
-
strokeLinejoin: "round",
|
|
63
|
-
...props,
|
|
64
|
-
children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
|
|
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"
|
|
65
21
|
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
function
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
function Spinner({ size, className, "aria-label": ariaLabel, ...props }) {
|
|
25
|
+
const hidden = props["aria-hidden"] === true || props["aria-hidden"] === "true";
|
|
69
26
|
return /* @__PURE__ */ jsx(
|
|
70
27
|
"svg",
|
|
71
28
|
{
|
|
@@ -78,22 +35,31 @@ function ChevronDown(props) {
|
|
|
78
35
|
strokeWidth: "2",
|
|
79
36
|
strokeLinecap: "round",
|
|
80
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),
|
|
81
42
|
...props,
|
|
82
|
-
children: /* @__PURE__ */ jsx("path", { d: "
|
|
43
|
+
children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
83
44
|
}
|
|
84
45
|
);
|
|
85
46
|
}
|
|
86
47
|
|
|
87
48
|
// src/components/Button/Button.tsx
|
|
88
49
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
89
|
-
var buttonVariants =
|
|
50
|
+
var buttonVariants = cva2("ddga-button", {
|
|
90
51
|
variants: {
|
|
91
52
|
variant: {
|
|
92
53
|
primary: "ddga-button--primary",
|
|
93
54
|
secondary: "ddga-button--secondary",
|
|
94
55
|
outline: "ddga-button--outline",
|
|
95
56
|
ghost: "ddga-button--ghost",
|
|
96
|
-
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"
|
|
97
63
|
},
|
|
98
64
|
size: {
|
|
99
65
|
sm: "ddga-button--sm",
|
|
@@ -104,6 +70,16 @@ var buttonVariants = cva("ddga-button", {
|
|
|
104
70
|
},
|
|
105
71
|
fullWidth: {
|
|
106
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"
|
|
107
83
|
}
|
|
108
84
|
},
|
|
109
85
|
compoundVariants: [],
|
|
@@ -116,11 +92,13 @@ function Button({
|
|
|
116
92
|
variant,
|
|
117
93
|
size,
|
|
118
94
|
fullWidth,
|
|
95
|
+
inverted,
|
|
119
96
|
loading,
|
|
120
97
|
disabled,
|
|
121
98
|
startIcon,
|
|
122
99
|
endIcon,
|
|
123
100
|
iconFlip,
|
|
101
|
+
asChild,
|
|
124
102
|
className,
|
|
125
103
|
children,
|
|
126
104
|
type = "button",
|
|
@@ -134,16 +112,17 @@ function Button({
|
|
|
134
112
|
}
|
|
135
113
|
}
|
|
136
114
|
const isDisabled = disabled || loading;
|
|
115
|
+
const Comp = asChild ? SlotPrimitive.Slot : "button";
|
|
137
116
|
return /* @__PURE__ */ jsxs(
|
|
138
|
-
|
|
117
|
+
Comp,
|
|
139
118
|
{
|
|
140
|
-
type,
|
|
141
|
-
|
|
119
|
+
...asChild ? {} : { type, disabled: isDisabled },
|
|
120
|
+
...asChild && isDisabled ? { tabIndex: -1 } : {},
|
|
142
121
|
"aria-disabled": isDisabled || void 0,
|
|
143
122
|
"aria-busy": loading || void 0,
|
|
144
123
|
"data-slot": "button",
|
|
145
124
|
className: cn(
|
|
146
|
-
buttonVariants({ variant, size, fullWidth }),
|
|
125
|
+
buttonVariants({ variant, size, fullWidth, inverted }),
|
|
147
126
|
loading && "ddga-button--loading",
|
|
148
127
|
className
|
|
149
128
|
),
|
|
@@ -151,7 +130,12 @@ function Button({
|
|
|
151
130
|
children: [
|
|
152
131
|
loading && /* @__PURE__ */ jsx2(Spinner, { "aria-hidden": "true" }),
|
|
153
132
|
!loading && startIcon && /* @__PURE__ */ jsx2("span", { className: cn("ddga-button__icon", iconFlip && "ddga-icon-flip"), "aria-hidden": "true", children: startIcon }),
|
|
154
|
-
|
|
133
|
+
asChild ? (
|
|
134
|
+
// children IS the consumer's single element (e.g. <Link>). Slottable
|
|
135
|
+
// marks where THAT element's original children should land , without
|
|
136
|
+
// it the icons would replace the link text entirely.
|
|
137
|
+
/* @__PURE__ */ jsx2(SlotPrimitive.Slottable, { children })
|
|
138
|
+
) : children != null && children !== "" && /* @__PURE__ */ jsx2("span", { className: "ddga-button__text", children }),
|
|
155
139
|
!loading && endIcon && /* @__PURE__ */ jsx2("span", { className: cn("ddga-button__icon", iconFlip && "ddga-icon-flip"), "aria-hidden": "true", children: endIcon })
|
|
156
140
|
]
|
|
157
141
|
}
|
|
@@ -159,7 +143,7 @@ function Button({
|
|
|
159
143
|
}
|
|
160
144
|
|
|
161
145
|
// src/components/Input/Input.tsx
|
|
162
|
-
import { cva as
|
|
146
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
163
147
|
|
|
164
148
|
// src/field/use-field-a11y.ts
|
|
165
149
|
import { useId } from "react";
|
|
@@ -213,7 +197,7 @@ function FieldMessage({ id, variant, children }) {
|
|
|
213
197
|
|
|
214
198
|
// src/components/Input/Input.tsx
|
|
215
199
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
216
|
-
var inputVariants =
|
|
200
|
+
var inputVariants = cva3("ddga-input", {
|
|
217
201
|
variants: {
|
|
218
202
|
size: {
|
|
219
203
|
sm: "ddga-input--sm",
|
|
@@ -297,9 +281,9 @@ function Input({
|
|
|
297
281
|
}
|
|
298
282
|
|
|
299
283
|
// src/components/Textarea/Textarea.tsx
|
|
300
|
-
import { cva as
|
|
284
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
301
285
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
302
|
-
var textareaVariants =
|
|
286
|
+
var textareaVariants = cva4("ddga-textarea", {
|
|
303
287
|
variants: {
|
|
304
288
|
size: {
|
|
305
289
|
sm: "ddga-textarea--sm",
|
|
@@ -367,9 +351,192 @@ function Textarea({
|
|
|
367
351
|
|
|
368
352
|
// src/components/Checkbox/Checkbox.tsx
|
|
369
353
|
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
|
370
|
-
import { cva as
|
|
354
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
355
|
+
|
|
356
|
+
// src/internal/icons/index.tsx
|
|
371
357
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
372
|
-
|
|
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" })
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
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" })
|
|
391
|
+
}
|
|
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 MoreHorizontal(props) {
|
|
518
|
+
return /* @__PURE__ */ jsxs4(
|
|
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: "currentColor",
|
|
526
|
+
stroke: "none",
|
|
527
|
+
...props,
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ jsx6("circle", { cx: "5", cy: "12", r: "1.5" }),
|
|
530
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "1.5" }),
|
|
531
|
+
/* @__PURE__ */ jsx6("circle", { cx: "19", cy: "12", r: "1.5" })
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
538
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
539
|
+
var checkboxVariants = cva5("ddga-checkbox", {
|
|
373
540
|
variants: {
|
|
374
541
|
size: {
|
|
375
542
|
sm: "ddga-checkbox--sm",
|
|
@@ -404,9 +571,9 @@ function Checkbox({
|
|
|
404
571
|
"aria-label": props["aria-label"],
|
|
405
572
|
"aria-labelledby": props["aria-labelledby"]
|
|
406
573
|
});
|
|
407
|
-
return /* @__PURE__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
574
|
+
return /* @__PURE__ */ jsxs5("div", { "data-slot": "checkbox-field", className: "ddga-field", children: [
|
|
575
|
+
/* @__PURE__ */ jsxs5("div", { className: "ddga-checkbox-row", children: [
|
|
576
|
+
/* @__PURE__ */ jsx7(
|
|
410
577
|
CheckboxPrimitive.Root,
|
|
411
578
|
{
|
|
412
579
|
...props,
|
|
@@ -414,35 +581,35 @@ function Checkbox({
|
|
|
414
581
|
"data-slot": "checkbox",
|
|
415
582
|
required,
|
|
416
583
|
className: cn(checkboxVariants({ size, error: hasError }), className),
|
|
417
|
-
children: /* @__PURE__ */
|
|
584
|
+
children: /* @__PURE__ */ jsxs5(
|
|
418
585
|
CheckboxPrimitive.Indicator,
|
|
419
586
|
{
|
|
420
587
|
"data-slot": "checkbox-indicator",
|
|
421
588
|
className: "ddga-checkbox__indicator",
|
|
422
589
|
children: [
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ jsx7(Check, { className: "ddga-checkbox__check", "aria-hidden": "true" }),
|
|
591
|
+
/* @__PURE__ */ jsx7(Minus, { className: "ddga-checkbox__minus", "aria-hidden": "true" })
|
|
425
592
|
]
|
|
426
593
|
}
|
|
427
594
|
)
|
|
428
595
|
}
|
|
429
596
|
),
|
|
430
|
-
label && /* @__PURE__ */
|
|
597
|
+
label && /* @__PURE__ */ jsxs5("label", { htmlFor: fieldId, className: "ddga-checkbox__label", children: [
|
|
431
598
|
label,
|
|
432
|
-
required && /* @__PURE__ */
|
|
599
|
+
required && /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", className: "ddga-checkbox__required", children: "*" })
|
|
433
600
|
] })
|
|
434
601
|
] }),
|
|
435
|
-
hasErrorMessage && /* @__PURE__ */
|
|
436
|
-
hasHelper && /* @__PURE__ */
|
|
602
|
+
hasErrorMessage && /* @__PURE__ */ jsx7(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
603
|
+
hasHelper && /* @__PURE__ */ jsx7(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
437
604
|
] });
|
|
438
605
|
}
|
|
439
606
|
|
|
440
607
|
// src/components/Radio/Radio.tsx
|
|
441
608
|
import { useId as useId2 } from "react";
|
|
442
609
|
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
443
|
-
import { cva as
|
|
444
|
-
import { jsx as
|
|
445
|
-
var radioGroupVariants =
|
|
610
|
+
import { cva as cva6 } from "class-variance-authority";
|
|
611
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
612
|
+
var radioGroupVariants = cva6("ddga-radio-group", {
|
|
446
613
|
variants: {
|
|
447
614
|
size: {
|
|
448
615
|
sm: "ddga-radio-group--sm",
|
|
@@ -461,7 +628,7 @@ var radioGroupVariants = cva5("ddga-radio-group", {
|
|
|
461
628
|
orientation: "vertical"
|
|
462
629
|
}
|
|
463
630
|
});
|
|
464
|
-
var radioVariants =
|
|
631
|
+
var radioVariants = cva6("ddga-radio");
|
|
465
632
|
function RadioGroup({
|
|
466
633
|
id: externalId,
|
|
467
634
|
label,
|
|
@@ -486,12 +653,12 @@ function RadioGroup({
|
|
|
486
653
|
"aria-labelledby": props["aria-labelledby"]
|
|
487
654
|
});
|
|
488
655
|
const labelId = `${fieldId}-label`;
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
label && /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ jsxs6("div", { "data-slot": "radio-group-field", className: "ddga-field", children: [
|
|
657
|
+
label && /* @__PURE__ */ jsxs6("span", { id: labelId, className: "ddga-radio-group__label", children: [
|
|
491
658
|
label,
|
|
492
|
-
required && /* @__PURE__ */
|
|
659
|
+
required && /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", className: "ddga-radio-group__required", children: "*" })
|
|
493
660
|
] }),
|
|
494
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ jsx8(
|
|
495
662
|
RadioGroupPrimitive.Root,
|
|
496
663
|
{
|
|
497
664
|
...props,
|
|
@@ -505,40 +672,40 @@ function RadioGroup({
|
|
|
505
672
|
children
|
|
506
673
|
}
|
|
507
674
|
),
|
|
508
|
-
hasErrorMessage && /* @__PURE__ */
|
|
509
|
-
hasHelper && /* @__PURE__ */
|
|
675
|
+
hasErrorMessage && /* @__PURE__ */ jsx8(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
676
|
+
hasHelper && /* @__PURE__ */ jsx8(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
510
677
|
] });
|
|
511
678
|
}
|
|
512
679
|
function Radio({ id: externalId, label, className, ...props }) {
|
|
513
680
|
const generatedId = useId2();
|
|
514
681
|
const itemId = externalId ?? generatedId;
|
|
515
|
-
return /* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
682
|
+
return /* @__PURE__ */ jsxs6("div", { className: "ddga-radio-row", children: [
|
|
683
|
+
/* @__PURE__ */ jsx8(
|
|
517
684
|
RadioGroupPrimitive.Item,
|
|
518
685
|
{
|
|
519
686
|
...props,
|
|
520
687
|
id: itemId,
|
|
521
688
|
"data-slot": "radio",
|
|
522
689
|
className: cn(radioVariants(), className),
|
|
523
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ jsx8(
|
|
524
691
|
RadioGroupPrimitive.Indicator,
|
|
525
692
|
{
|
|
526
693
|
"data-slot": "radio-indicator",
|
|
527
694
|
className: "ddga-radio__indicator",
|
|
528
|
-
children: /* @__PURE__ */
|
|
695
|
+
children: /* @__PURE__ */ jsx8("span", { className: "ddga-radio__dot", "aria-hidden": "true" })
|
|
529
696
|
}
|
|
530
697
|
)
|
|
531
698
|
}
|
|
532
699
|
),
|
|
533
|
-
label && /* @__PURE__ */
|
|
700
|
+
label && /* @__PURE__ */ jsx8("label", { htmlFor: itemId, className: "ddga-radio__label", children: label })
|
|
534
701
|
] });
|
|
535
702
|
}
|
|
536
703
|
|
|
537
704
|
// src/components/Switch/Switch.tsx
|
|
538
705
|
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
539
|
-
import { cva as
|
|
540
|
-
import { jsx as
|
|
541
|
-
var switchVariants =
|
|
706
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
707
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
708
|
+
var switchVariants = cva7("ddga-switch", {
|
|
542
709
|
variants: {
|
|
543
710
|
size: {
|
|
544
711
|
sm: "ddga-switch--sm",
|
|
@@ -573,9 +740,9 @@ function Switch({
|
|
|
573
740
|
"aria-label": props["aria-label"],
|
|
574
741
|
"aria-labelledby": props["aria-labelledby"]
|
|
575
742
|
});
|
|
576
|
-
return /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ jsxs7("div", { "data-slot": "switch-field", className: "ddga-field", children: [
|
|
744
|
+
/* @__PURE__ */ jsxs7("div", { className: "ddga-switch-row", children: [
|
|
745
|
+
/* @__PURE__ */ jsx9(
|
|
579
746
|
SwitchPrimitive.Root,
|
|
580
747
|
{
|
|
581
748
|
...props,
|
|
@@ -583,23 +750,23 @@ function Switch({
|
|
|
583
750
|
"data-slot": "switch",
|
|
584
751
|
required,
|
|
585
752
|
className: cn(switchVariants({ size, error: hasError }), className),
|
|
586
|
-
children: /* @__PURE__ */
|
|
753
|
+
children: /* @__PURE__ */ jsx9(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "ddga-switch__thumb" })
|
|
587
754
|
}
|
|
588
755
|
),
|
|
589
|
-
label && /* @__PURE__ */
|
|
756
|
+
label && /* @__PURE__ */ jsxs7("label", { htmlFor: fieldId, className: "ddga-switch__label", children: [
|
|
590
757
|
label,
|
|
591
|
-
required && /* @__PURE__ */
|
|
758
|
+
required && /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "ddga-switch__required", children: "*" })
|
|
592
759
|
] })
|
|
593
760
|
] }),
|
|
594
|
-
hasErrorMessage && /* @__PURE__ */
|
|
595
|
-
hasHelper && /* @__PURE__ */
|
|
761
|
+
hasErrorMessage && /* @__PURE__ */ jsx9(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
762
|
+
hasHelper && /* @__PURE__ */ jsx9(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
596
763
|
] });
|
|
597
764
|
}
|
|
598
765
|
|
|
599
766
|
// src/components/Select/Select.tsx
|
|
600
767
|
import { useContext as useContext2 } from "react";
|
|
601
768
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
602
|
-
import { cva as
|
|
769
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
603
770
|
|
|
604
771
|
// src/providers/DgaContext.ts
|
|
605
772
|
import { createContext, useContext } from "react";
|
|
@@ -613,8 +780,8 @@ function useDga() {
|
|
|
613
780
|
}
|
|
614
781
|
|
|
615
782
|
// src/components/Select/Select.tsx
|
|
616
|
-
import { jsx as
|
|
617
|
-
var selectTriggerVariants =
|
|
783
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
784
|
+
var selectTriggerVariants = cva8("ddga-select-trigger", {
|
|
618
785
|
variants: {
|
|
619
786
|
size: {
|
|
620
787
|
sm: "ddga-select-trigger--sm",
|
|
@@ -653,59 +820,1952 @@ function Select({
|
|
|
653
820
|
});
|
|
654
821
|
const ctx = useContext2(DgaContext);
|
|
655
822
|
const portalContainer = ctx?.rootEl ?? void 0;
|
|
656
|
-
return /* @__PURE__ */
|
|
657
|
-
label && /* @__PURE__ */
|
|
823
|
+
return /* @__PURE__ */ jsxs8("div", { "data-slot": "select-field", className: "ddga-field", children: [
|
|
824
|
+
label && /* @__PURE__ */ jsxs8("label", { htmlFor: fieldId, className: "ddga-select__label", children: [
|
|
658
825
|
label,
|
|
659
|
-
required && /* @__PURE__ */
|
|
826
|
+
required && /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "ddga-select__required", children: "*" })
|
|
660
827
|
] }),
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ jsxs8(SelectPrimitive.Root, { required, ...rootProps, children: [
|
|
829
|
+
/* @__PURE__ */ jsxs8(
|
|
663
830
|
SelectPrimitive.Trigger,
|
|
664
831
|
{
|
|
665
832
|
...controlProps,
|
|
666
833
|
"data-slot": "select-trigger",
|
|
667
834
|
className: cn(selectTriggerVariants({ size, error: hasError }), className),
|
|
668
835
|
children: [
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ jsx10(SelectPrimitive.Value, { placeholder }),
|
|
837
|
+
/* @__PURE__ */ jsx10(SelectPrimitive.Icon, { asChild: true, className: "ddga-select__icon", children: /* @__PURE__ */ jsx10(ChevronDown, { "aria-hidden": "true" }) })
|
|
671
838
|
]
|
|
672
839
|
}
|
|
673
840
|
),
|
|
674
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ jsx10(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx10(
|
|
675
842
|
SelectPrimitive.Content,
|
|
676
843
|
{
|
|
677
844
|
"data-slot": "select-content",
|
|
678
845
|
className: "ddga-select-content",
|
|
679
846
|
position: "popper",
|
|
680
847
|
sideOffset: 4,
|
|
681
|
-
children: /* @__PURE__ */
|
|
848
|
+
children: /* @__PURE__ */ jsx10(SelectPrimitive.Viewport, { className: "ddga-select-viewport", children })
|
|
682
849
|
}
|
|
683
850
|
) })
|
|
684
851
|
] }),
|
|
685
|
-
hasErrorMessage && /* @__PURE__ */
|
|
686
|
-
hasHelper && /* @__PURE__ */
|
|
852
|
+
hasErrorMessage && /* @__PURE__ */ jsx10(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
853
|
+
hasHelper && /* @__PURE__ */ jsx10(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
687
854
|
] });
|
|
688
855
|
}
|
|
689
856
|
function SelectItem({ className, children, ...props }) {
|
|
690
|
-
return /* @__PURE__ */
|
|
857
|
+
return /* @__PURE__ */ jsxs8(
|
|
691
858
|
SelectPrimitive.Item,
|
|
692
859
|
{
|
|
693
860
|
...props,
|
|
694
861
|
"data-slot": "select-item",
|
|
695
862
|
className: cn("ddga-select-item", className),
|
|
696
863
|
children: [
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx10(SelectPrimitive.ItemText, { children }),
|
|
865
|
+
/* @__PURE__ */ jsx10(SelectPrimitive.ItemIndicator, { className: "ddga-select-item__indicator", children: /* @__PURE__ */ jsx10(Check, { className: "ddga-select-item__check", "aria-hidden": "true" }) })
|
|
699
866
|
]
|
|
700
867
|
}
|
|
701
868
|
);
|
|
702
869
|
}
|
|
703
870
|
|
|
871
|
+
// src/components/Card/Card.tsx
|
|
872
|
+
import { Slot as SlotPrimitive2 } from "radix-ui";
|
|
873
|
+
import { cva as cva9 } from "class-variance-authority";
|
|
874
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
875
|
+
var cardVariants = cva9("ddga-card", {
|
|
876
|
+
variants: {
|
|
877
|
+
variant: {
|
|
878
|
+
default: "ddga-card--default",
|
|
879
|
+
outline: "ddga-card--outline",
|
|
880
|
+
elevated: "ddga-card--elevated",
|
|
881
|
+
filled: "ddga-card--filled",
|
|
882
|
+
gradient: "ddga-card--gradient",
|
|
883
|
+
ghost: "ddga-card--ghost"
|
|
884
|
+
},
|
|
885
|
+
padding: {
|
|
886
|
+
sm: "ddga-card--padding-sm",
|
|
887
|
+
md: "ddga-card--padding-md",
|
|
888
|
+
lg: "ddga-card--padding-lg"
|
|
889
|
+
},
|
|
890
|
+
orientation: {
|
|
891
|
+
vertical: "ddga-card--vertical",
|
|
892
|
+
horizontal: "ddga-card--horizontal"
|
|
893
|
+
},
|
|
894
|
+
interactive: {
|
|
895
|
+
true: "ddga-card--interactive"
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
defaultVariants: {
|
|
899
|
+
variant: "default",
|
|
900
|
+
padding: "md",
|
|
901
|
+
orientation: "vertical"
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
function Card({
|
|
905
|
+
variant,
|
|
906
|
+
padding,
|
|
907
|
+
orientation,
|
|
908
|
+
interactive,
|
|
909
|
+
asChild,
|
|
910
|
+
className,
|
|
911
|
+
...props
|
|
912
|
+
}) {
|
|
913
|
+
const Comp = asChild ? SlotPrimitive2.Slot : "div";
|
|
914
|
+
return /* @__PURE__ */ jsx11(
|
|
915
|
+
Comp,
|
|
916
|
+
{
|
|
917
|
+
"data-slot": "card",
|
|
918
|
+
"data-orientation": orientation ?? "vertical",
|
|
919
|
+
className: cn(cardVariants({ variant, padding, orientation, interactive }), className),
|
|
920
|
+
...props
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
function CardImage({ aspectRatio = "16/9", className, style, ...props }) {
|
|
925
|
+
return /* @__PURE__ */ jsx11(
|
|
926
|
+
"img",
|
|
927
|
+
{
|
|
928
|
+
"data-slot": "card-image",
|
|
929
|
+
className: cn("ddga-card__image", className),
|
|
930
|
+
style: {
|
|
931
|
+
"--ddga-card-image-aspect": aspectRatio,
|
|
932
|
+
...style
|
|
933
|
+
},
|
|
934
|
+
...props
|
|
935
|
+
}
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
function CardHeader({ asChild, className, ...props }) {
|
|
939
|
+
const Comp = asChild ? SlotPrimitive2.Slot : "div";
|
|
940
|
+
return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-header", className: cn("ddga-card__header", className), ...props });
|
|
941
|
+
}
|
|
942
|
+
function CardTitle({ asChild, className, ...props }) {
|
|
943
|
+
const Comp = asChild ? SlotPrimitive2.Slot : "h3";
|
|
944
|
+
return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-title", className: cn("ddga-card__title", className), ...props });
|
|
945
|
+
}
|
|
946
|
+
function CardDescription({ asChild, className, ...props }) {
|
|
947
|
+
const Comp = asChild ? SlotPrimitive2.Slot : "p";
|
|
948
|
+
return /* @__PURE__ */ jsx11(
|
|
949
|
+
Comp,
|
|
950
|
+
{
|
|
951
|
+
"data-slot": "card-description",
|
|
952
|
+
className: cn("ddga-card__description", className),
|
|
953
|
+
...props
|
|
954
|
+
}
|
|
955
|
+
);
|
|
956
|
+
}
|
|
957
|
+
function CardContent({ asChild, className, ...props }) {
|
|
958
|
+
const Comp = asChild ? SlotPrimitive2.Slot : "div";
|
|
959
|
+
return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-content", className: cn("ddga-card__content", className), ...props });
|
|
960
|
+
}
|
|
961
|
+
function CardFooter({ asChild, className, ...props }) {
|
|
962
|
+
const Comp = asChild ? SlotPrimitive2.Slot : "div";
|
|
963
|
+
return /* @__PURE__ */ jsx11(Comp, { "data-slot": "card-footer", className: cn("ddga-card__footer", className), ...props });
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
// src/components/Badge/Badge.tsx
|
|
967
|
+
import { useState } from "react";
|
|
968
|
+
import { Slot as SlotPrimitive3 } from "radix-ui";
|
|
969
|
+
import { cva as cva10 } from "class-variance-authority";
|
|
970
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
971
|
+
var badgeVariants = cva10("ddga-badge", {
|
|
972
|
+
variants: {
|
|
973
|
+
variant: {
|
|
974
|
+
// Solid family
|
|
975
|
+
default: "ddga-badge--default",
|
|
976
|
+
primary: "ddga-badge--primary",
|
|
977
|
+
secondary: "ddga-badge--secondary",
|
|
978
|
+
destructive: "ddga-badge--destructive",
|
|
979
|
+
success: "ddga-badge--success",
|
|
980
|
+
warning: "ddga-badge--warning",
|
|
981
|
+
info: "ddga-badge--info",
|
|
982
|
+
// Subtle family (tonal)
|
|
983
|
+
"primary-subtle": "ddga-badge--primary-subtle",
|
|
984
|
+
"secondary-subtle": "ddga-badge--secondary-subtle",
|
|
985
|
+
"destructive-subtle": "ddga-badge--destructive-subtle",
|
|
986
|
+
"success-subtle": "ddga-badge--success-subtle",
|
|
987
|
+
"warning-subtle": "ddga-badge--warning-subtle",
|
|
988
|
+
"info-subtle": "ddga-badge--info-subtle",
|
|
989
|
+
// Outline
|
|
990
|
+
outline: "ddga-badge--outline"
|
|
991
|
+
},
|
|
992
|
+
size: {
|
|
993
|
+
sm: "ddga-badge--sm",
|
|
994
|
+
md: "ddga-badge--md"
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
defaultVariants: {
|
|
998
|
+
variant: "default",
|
|
999
|
+
size: "md"
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
function Badge({
|
|
1003
|
+
variant,
|
|
1004
|
+
size,
|
|
1005
|
+
asChild,
|
|
1006
|
+
dot,
|
|
1007
|
+
startIcon,
|
|
1008
|
+
endIcon,
|
|
1009
|
+
dismissible,
|
|
1010
|
+
open,
|
|
1011
|
+
onDismiss,
|
|
1012
|
+
closeLabel = "Dismiss",
|
|
1013
|
+
className,
|
|
1014
|
+
children,
|
|
1015
|
+
...props
|
|
1016
|
+
}) {
|
|
1017
|
+
const isControlled = open !== void 0;
|
|
1018
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(true);
|
|
1019
|
+
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
1020
|
+
if (process.env.NODE_ENV !== "production" && asChild && dismissible) {
|
|
1021
|
+
console.warn(
|
|
1022
|
+
"[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."
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
if (!isOpen) return null;
|
|
1026
|
+
const Comp = asChild ? SlotPrimitive3.Slot : "span";
|
|
1027
|
+
const showClose = dismissible && !asChild;
|
|
1028
|
+
const handleDismiss = () => {
|
|
1029
|
+
if (!isControlled) setUncontrolledOpen(false);
|
|
1030
|
+
onDismiss?.();
|
|
1031
|
+
};
|
|
1032
|
+
return /* @__PURE__ */ jsxs9(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props, children: [
|
|
1033
|
+
dot ? /* @__PURE__ */ jsx12("span", { className: "ddga-badge__dot", "aria-hidden": "true" }) : null,
|
|
1034
|
+
startIcon ? /* @__PURE__ */ jsx12("span", { className: "ddga-badge__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
1035
|
+
asChild ? (
|
|
1036
|
+
// children IS the consumer's single element (e.g. <a>). Slottable marks
|
|
1037
|
+
// where THAT element's original children should land — without it the
|
|
1038
|
+
// dot/icons would replace the link text.
|
|
1039
|
+
/* @__PURE__ */ jsx12(SlotPrimitive3.Slottable, { children })
|
|
1040
|
+
) : children,
|
|
1041
|
+
endIcon ? /* @__PURE__ */ jsx12("span", { className: "ddga-badge__icon", "aria-hidden": "true", children: endIcon }) : null,
|
|
1042
|
+
showClose ? /* @__PURE__ */ jsx12(
|
|
1043
|
+
"button",
|
|
1044
|
+
{
|
|
1045
|
+
type: "button",
|
|
1046
|
+
className: "ddga-badge__close",
|
|
1047
|
+
"aria-label": closeLabel,
|
|
1048
|
+
onClick: handleDismiss,
|
|
1049
|
+
"data-slot": "badge-close",
|
|
1050
|
+
children: /* @__PURE__ */ jsx12(Close, { "aria-hidden": "true" })
|
|
1051
|
+
}
|
|
1052
|
+
) : null
|
|
1053
|
+
] });
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// src/components/Divider/Divider.tsx
|
|
1057
|
+
import { cva as cva11 } from "class-variance-authority";
|
|
1058
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1059
|
+
var dividerVariants = cva11("ddga-divider", {
|
|
1060
|
+
variants: {
|
|
1061
|
+
orientation: {
|
|
1062
|
+
horizontal: "ddga-divider--horizontal",
|
|
1063
|
+
vertical: "ddga-divider--vertical"
|
|
1064
|
+
},
|
|
1065
|
+
variant: {
|
|
1066
|
+
solid: "ddga-divider--solid",
|
|
1067
|
+
dashed: "ddga-divider--dashed"
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
1070
|
+
defaultVariants: {
|
|
1071
|
+
orientation: "horizontal",
|
|
1072
|
+
variant: "solid"
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
function Divider({
|
|
1076
|
+
orientation = "horizontal",
|
|
1077
|
+
variant = "solid",
|
|
1078
|
+
labelPosition = "center",
|
|
1079
|
+
decorative = false,
|
|
1080
|
+
className,
|
|
1081
|
+
children,
|
|
1082
|
+
...props
|
|
1083
|
+
}) {
|
|
1084
|
+
const isLabeled = orientation === "horizontal" && children !== void 0 && children !== null && children !== "";
|
|
1085
|
+
const a11yProps = decorative ? { role: "none" } : {
|
|
1086
|
+
role: "separator",
|
|
1087
|
+
...orientation === "vertical" ? { "aria-orientation": "vertical" } : {}
|
|
1088
|
+
};
|
|
1089
|
+
return /* @__PURE__ */ jsx13(
|
|
1090
|
+
"div",
|
|
1091
|
+
{
|
|
1092
|
+
"data-slot": "divider",
|
|
1093
|
+
"data-orientation": orientation,
|
|
1094
|
+
className: cn(
|
|
1095
|
+
dividerVariants({ orientation, variant }),
|
|
1096
|
+
isLabeled && "ddga-divider--labeled",
|
|
1097
|
+
isLabeled && `ddga-divider--label-${labelPosition}`,
|
|
1098
|
+
className
|
|
1099
|
+
),
|
|
1100
|
+
...a11yProps,
|
|
1101
|
+
...props,
|
|
1102
|
+
children: isLabeled ? /* @__PURE__ */ jsx13("span", { className: "ddga-divider__label", children }) : null
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// src/components/Avatar/Avatar.tsx
|
|
1108
|
+
import { Children, isValidElement, cloneElement } from "react";
|
|
1109
|
+
import { Avatar as AvatarPrimitive } from "radix-ui";
|
|
1110
|
+
import { cva as cva12 } from "class-variance-authority";
|
|
1111
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1112
|
+
var avatarVariants = cva12("ddga-avatar", {
|
|
1113
|
+
variants: {
|
|
1114
|
+
size: {
|
|
1115
|
+
xs: "ddga-avatar--xs",
|
|
1116
|
+
sm: "ddga-avatar--sm",
|
|
1117
|
+
md: "ddga-avatar--md",
|
|
1118
|
+
lg: "ddga-avatar--lg",
|
|
1119
|
+
xl: "ddga-avatar--xl"
|
|
1120
|
+
},
|
|
1121
|
+
shape: {
|
|
1122
|
+
circle: "ddga-avatar--circle",
|
|
1123
|
+
square: "ddga-avatar--square"
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
defaultVariants: {
|
|
1127
|
+
size: "md",
|
|
1128
|
+
shape: "circle"
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
var fallbackVariants = cva12("ddga-avatar__fallback", {
|
|
1132
|
+
variants: {
|
|
1133
|
+
colorScheme: {
|
|
1134
|
+
default: "ddga-avatar__fallback--default",
|
|
1135
|
+
primary: "ddga-avatar__fallback--primary",
|
|
1136
|
+
secondary: "ddga-avatar__fallback--secondary",
|
|
1137
|
+
success: "ddga-avatar__fallback--success",
|
|
1138
|
+
warning: "ddga-avatar__fallback--warning",
|
|
1139
|
+
destructive: "ddga-avatar__fallback--destructive",
|
|
1140
|
+
info: "ddga-avatar__fallback--info"
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
defaultVariants: {
|
|
1144
|
+
colorScheme: "default"
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
function Avatar({ size, shape, status, statusLabel, className, children, ...props }) {
|
|
1148
|
+
return /* @__PURE__ */ jsxs10(
|
|
1149
|
+
AvatarPrimitive.Root,
|
|
1150
|
+
{
|
|
1151
|
+
"data-slot": "avatar",
|
|
1152
|
+
"data-status": status,
|
|
1153
|
+
className: cn(avatarVariants({ size, shape }), className),
|
|
1154
|
+
...props,
|
|
1155
|
+
children: [
|
|
1156
|
+
children,
|
|
1157
|
+
status ? /* @__PURE__ */ jsx14(
|
|
1158
|
+
"span",
|
|
1159
|
+
{
|
|
1160
|
+
className: cn("ddga-avatar__status", `ddga-avatar__status--${status}`),
|
|
1161
|
+
role: "status",
|
|
1162
|
+
"aria-label": statusLabel ?? status
|
|
1163
|
+
}
|
|
1164
|
+
) : null
|
|
1165
|
+
]
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
function AvatarImage({ className, ...props }) {
|
|
1170
|
+
return /* @__PURE__ */ jsx14(
|
|
1171
|
+
AvatarPrimitive.Image,
|
|
1172
|
+
{
|
|
1173
|
+
"data-slot": "avatar-image",
|
|
1174
|
+
className: cn("ddga-avatar__image", className),
|
|
1175
|
+
...props
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
}
|
|
1179
|
+
function AvatarFallback({ colorScheme, className, ...props }) {
|
|
1180
|
+
return /* @__PURE__ */ jsx14(
|
|
1181
|
+
AvatarPrimitive.Fallback,
|
|
1182
|
+
{
|
|
1183
|
+
"data-slot": "avatar-fallback",
|
|
1184
|
+
"data-color-scheme": colorScheme ?? "default",
|
|
1185
|
+
className: cn(fallbackVariants({ colorScheme }), className),
|
|
1186
|
+
...props
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
function AvatarGroup({ max, size, shape, className, children, ...props }) {
|
|
1191
|
+
const all = Children.toArray(children).filter(isValidElement);
|
|
1192
|
+
const visible = max !== void 0 && all.length > max ? all.slice(0, max) : all;
|
|
1193
|
+
const overflow = max !== void 0 ? Math.max(0, all.length - max) : 0;
|
|
1194
|
+
const cascaded = visible.map(
|
|
1195
|
+
(child, i) => cloneElement(child, {
|
|
1196
|
+
key: child.key ?? i,
|
|
1197
|
+
size: child.props.size ?? size,
|
|
1198
|
+
shape: child.props.shape ?? shape
|
|
1199
|
+
})
|
|
1200
|
+
);
|
|
1201
|
+
return /* @__PURE__ */ jsxs10("div", { "data-slot": "avatar-group", className: cn("ddga-avatar-group", className), ...props, children: [
|
|
1202
|
+
cascaded,
|
|
1203
|
+
overflow > 0 ? /* @__PURE__ */ jsx14(Avatar, { size, shape, "aria-label": `${overflow} more`, children: /* @__PURE__ */ jsxs10(AvatarFallback, { children: [
|
|
1204
|
+
"+",
|
|
1205
|
+
overflow
|
|
1206
|
+
] }) }) : null
|
|
1207
|
+
] });
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
1211
|
+
import { useContext as useContext3 } from "react";
|
|
1212
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
1213
|
+
import { cva as cva13 } from "class-variance-authority";
|
|
1214
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1215
|
+
var tooltipContentVariants = cva13("ddga-tooltip", {
|
|
1216
|
+
variants: {
|
|
1217
|
+
size: {
|
|
1218
|
+
sm: "ddga-tooltip--sm",
|
|
1219
|
+
md: "ddga-tooltip--md"
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
defaultVariants: {
|
|
1223
|
+
size: "md"
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
function Tooltip(props) {
|
|
1227
|
+
return /* @__PURE__ */ jsx15(TooltipPrimitive.Root, { ...props });
|
|
1228
|
+
}
|
|
1229
|
+
function TooltipTrigger({ className, ...props }) {
|
|
1230
|
+
return /* @__PURE__ */ jsx15(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", className, ...props });
|
|
1231
|
+
}
|
|
1232
|
+
function TooltipContent({
|
|
1233
|
+
size,
|
|
1234
|
+
arrow = true,
|
|
1235
|
+
sideOffset = 6,
|
|
1236
|
+
className,
|
|
1237
|
+
children,
|
|
1238
|
+
...props
|
|
1239
|
+
}) {
|
|
1240
|
+
const ctx = useContext3(DgaContext);
|
|
1241
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
1242
|
+
return /* @__PURE__ */ jsx15(TooltipPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxs11(
|
|
1243
|
+
TooltipPrimitive.Content,
|
|
1244
|
+
{
|
|
1245
|
+
"data-slot": "tooltip-content",
|
|
1246
|
+
sideOffset,
|
|
1247
|
+
className: cn(tooltipContentVariants({ size }), className),
|
|
1248
|
+
...props,
|
|
1249
|
+
children: [
|
|
1250
|
+
children,
|
|
1251
|
+
arrow ? /* @__PURE__ */ jsx15(TooltipPrimitive.Arrow, { className: "ddga-tooltip__arrow" }) : null
|
|
1252
|
+
]
|
|
1253
|
+
}
|
|
1254
|
+
) });
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
// src/components/Alert/Alert.tsx
|
|
1258
|
+
import { useState as useState2 } from "react";
|
|
1259
|
+
import { Slot as SlotPrimitive4 } from "radix-ui";
|
|
1260
|
+
import { cva as cva14 } from "class-variance-authority";
|
|
1261
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1262
|
+
var alertVariants = cva14("ddga-alert", {
|
|
1263
|
+
variants: {
|
|
1264
|
+
variant: {
|
|
1265
|
+
info: "ddga-alert--info",
|
|
1266
|
+
success: "ddga-alert--success",
|
|
1267
|
+
warning: "ddga-alert--warning",
|
|
1268
|
+
destructive: "ddga-alert--destructive"
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
defaultVariants: {
|
|
1272
|
+
variant: "info"
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
var DEFAULT_ICONS = {
|
|
1276
|
+
info: /* @__PURE__ */ jsx16(Info, { "aria-hidden": "true" }),
|
|
1277
|
+
success: /* @__PURE__ */ jsx16(Check, { "aria-hidden": "true" }),
|
|
1278
|
+
warning: /* @__PURE__ */ jsx16(AlertTriangle, { "aria-hidden": "true" }),
|
|
1279
|
+
destructive: /* @__PURE__ */ jsx16(AlertCircle, { "aria-hidden": "true" })
|
|
1280
|
+
};
|
|
1281
|
+
function Alert({
|
|
1282
|
+
variant,
|
|
1283
|
+
asChild,
|
|
1284
|
+
icon,
|
|
1285
|
+
dismissible,
|
|
1286
|
+
open: controlledOpen,
|
|
1287
|
+
onDismiss,
|
|
1288
|
+
live,
|
|
1289
|
+
closeLabel = "Dismiss",
|
|
1290
|
+
className,
|
|
1291
|
+
children,
|
|
1292
|
+
...props
|
|
1293
|
+
}) {
|
|
1294
|
+
const [internalOpen, setInternalOpen] = useState2(true);
|
|
1295
|
+
const isControlled = controlledOpen !== void 0;
|
|
1296
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
1297
|
+
if (!open) return null;
|
|
1298
|
+
const Comp = asChild ? SlotPrimitive4.Slot : "div";
|
|
1299
|
+
const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS[variant ?? "info"];
|
|
1300
|
+
const liveProps = live === "assertive" ? { role: "alert", "aria-live": "assertive" } : live === "polite" ? { role: "status", "aria-live": "polite" } : {};
|
|
1301
|
+
function handleDismiss() {
|
|
1302
|
+
if (!isControlled) setInternalOpen(false);
|
|
1303
|
+
onDismiss?.();
|
|
1304
|
+
}
|
|
1305
|
+
return /* @__PURE__ */ jsxs12(
|
|
1306
|
+
Comp,
|
|
1307
|
+
{
|
|
1308
|
+
"data-slot": "alert",
|
|
1309
|
+
"data-variant": variant ?? "info",
|
|
1310
|
+
className: cn(alertVariants({ variant }), className),
|
|
1311
|
+
...liveProps,
|
|
1312
|
+
...props,
|
|
1313
|
+
children: [
|
|
1314
|
+
resolvedIcon ? /* @__PURE__ */ jsx16("span", { className: "ddga-alert__icon", children: resolvedIcon }) : null,
|
|
1315
|
+
asChild ? (
|
|
1316
|
+
// Slot mode: the consumer's element receives the children body.
|
|
1317
|
+
// Title/description are nested by the consumer.
|
|
1318
|
+
/* @__PURE__ */ jsx16(SlotPrimitive4.Slottable, { children })
|
|
1319
|
+
) : /* @__PURE__ */ jsx16("div", { className: "ddga-alert__body", children }),
|
|
1320
|
+
dismissible ? /* @__PURE__ */ jsx16(
|
|
1321
|
+
"button",
|
|
1322
|
+
{
|
|
1323
|
+
type: "button",
|
|
1324
|
+
className: "ddga-alert__close",
|
|
1325
|
+
"aria-label": closeLabel,
|
|
1326
|
+
onClick: handleDismiss,
|
|
1327
|
+
children: /* @__PURE__ */ jsx16(Close, { "aria-hidden": "true" })
|
|
1328
|
+
}
|
|
1329
|
+
) : null
|
|
1330
|
+
]
|
|
1331
|
+
}
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
function AlertTitle({ asChild, className, ...props }) {
|
|
1335
|
+
const Comp = asChild ? SlotPrimitive4.Slot : "h5";
|
|
1336
|
+
return /* @__PURE__ */ jsx16(Comp, { "data-slot": "alert-title", className: cn("ddga-alert__title", className), ...props });
|
|
1337
|
+
}
|
|
1338
|
+
function AlertDescription({ asChild, className, ...props }) {
|
|
1339
|
+
const Comp = asChild ? SlotPrimitive4.Slot : "p";
|
|
1340
|
+
return /* @__PURE__ */ jsx16(
|
|
1341
|
+
Comp,
|
|
1342
|
+
{
|
|
1343
|
+
"data-slot": "alert-description",
|
|
1344
|
+
className: cn("ddga-alert__description", className),
|
|
1345
|
+
...props
|
|
1346
|
+
}
|
|
1347
|
+
);
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
// src/components/Modal/Modal.tsx
|
|
1351
|
+
import { useContext as useContext4 } from "react";
|
|
1352
|
+
import { Dialog as DialogPrimitive, Slot as SlotPrimitive5 } from "radix-ui";
|
|
1353
|
+
import { cva as cva15 } from "class-variance-authority";
|
|
1354
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1355
|
+
var modalContentVariants = cva15("ddga-modal", {
|
|
1356
|
+
variants: {
|
|
1357
|
+
size: {
|
|
1358
|
+
sm: "ddga-modal--sm",
|
|
1359
|
+
md: "ddga-modal--md",
|
|
1360
|
+
lg: "ddga-modal--lg",
|
|
1361
|
+
xl: "ddga-modal--xl",
|
|
1362
|
+
full: "ddga-modal--full"
|
|
1363
|
+
}
|
|
1364
|
+
},
|
|
1365
|
+
defaultVariants: {
|
|
1366
|
+
size: "md"
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
function Modal(props) {
|
|
1370
|
+
return /* @__PURE__ */ jsx17(DialogPrimitive.Root, { ...props });
|
|
1371
|
+
}
|
|
1372
|
+
function ModalTrigger({ className, ...props }) {
|
|
1373
|
+
return /* @__PURE__ */ jsx17(DialogPrimitive.Trigger, { "data-slot": "modal-trigger", className, ...props });
|
|
1374
|
+
}
|
|
1375
|
+
function ModalContent({
|
|
1376
|
+
size,
|
|
1377
|
+
showCloseButton = true,
|
|
1378
|
+
closeLabel = "Close",
|
|
1379
|
+
className,
|
|
1380
|
+
children,
|
|
1381
|
+
...props
|
|
1382
|
+
}) {
|
|
1383
|
+
const ctx = useContext4(DgaContext);
|
|
1384
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
1385
|
+
return /* @__PURE__ */ jsxs13(DialogPrimitive.Portal, { container: portalContainer, children: [
|
|
1386
|
+
/* @__PURE__ */ jsx17(DialogPrimitive.Overlay, { className: "ddga-modal__overlay", "data-slot": "modal-overlay" }),
|
|
1387
|
+
/* @__PURE__ */ jsxs13(
|
|
1388
|
+
DialogPrimitive.Content,
|
|
1389
|
+
{
|
|
1390
|
+
"data-slot": "modal-content",
|
|
1391
|
+
className: cn(modalContentVariants({ size }), className),
|
|
1392
|
+
...props,
|
|
1393
|
+
children: [
|
|
1394
|
+
children,
|
|
1395
|
+
showCloseButton ? /* @__PURE__ */ jsx17(
|
|
1396
|
+
DialogPrimitive.Close,
|
|
1397
|
+
{
|
|
1398
|
+
className: "ddga-modal__close",
|
|
1399
|
+
"aria-label": closeLabel,
|
|
1400
|
+
"data-slot": "modal-close-x",
|
|
1401
|
+
children: /* @__PURE__ */ jsx17(Close, { "aria-hidden": "true" })
|
|
1402
|
+
}
|
|
1403
|
+
) : null
|
|
1404
|
+
]
|
|
1405
|
+
}
|
|
1406
|
+
)
|
|
1407
|
+
] });
|
|
1408
|
+
}
|
|
1409
|
+
function ModalHeader({ asChild, className, ...props }) {
|
|
1410
|
+
const Comp = asChild ? SlotPrimitive5.Slot : "div";
|
|
1411
|
+
return /* @__PURE__ */ jsx17(Comp, { "data-slot": "modal-header", className: cn("ddga-modal__header", className), ...props });
|
|
1412
|
+
}
|
|
1413
|
+
function ModalTitle({ asChild, className, ...props }) {
|
|
1414
|
+
return /* @__PURE__ */ jsx17(
|
|
1415
|
+
DialogPrimitive.Title,
|
|
1416
|
+
{
|
|
1417
|
+
asChild,
|
|
1418
|
+
"data-slot": "modal-title",
|
|
1419
|
+
className: cn("ddga-modal__title", className),
|
|
1420
|
+
...props
|
|
1421
|
+
}
|
|
1422
|
+
);
|
|
1423
|
+
}
|
|
1424
|
+
function ModalDescription({ asChild, className, ...props }) {
|
|
1425
|
+
return /* @__PURE__ */ jsx17(
|
|
1426
|
+
DialogPrimitive.Description,
|
|
1427
|
+
{
|
|
1428
|
+
asChild,
|
|
1429
|
+
"data-slot": "modal-description",
|
|
1430
|
+
className: cn("ddga-modal__description", className),
|
|
1431
|
+
...props
|
|
1432
|
+
}
|
|
1433
|
+
);
|
|
1434
|
+
}
|
|
1435
|
+
function ModalFooter({ asChild, className, ...props }) {
|
|
1436
|
+
const Comp = asChild ? SlotPrimitive5.Slot : "div";
|
|
1437
|
+
return /* @__PURE__ */ jsx17(Comp, { "data-slot": "modal-footer", className: cn("ddga-modal__footer", className), ...props });
|
|
1438
|
+
}
|
|
1439
|
+
function ModalClose({ className, ...props }) {
|
|
1440
|
+
return /* @__PURE__ */ jsx17(DialogPrimitive.Close, { "data-slot": "modal-close", className, ...props });
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
// src/components/Toast/Toast.tsx
|
|
1444
|
+
import { useSyncExternalStore } from "react";
|
|
1445
|
+
import { Toast as ToastPrimitive } from "radix-ui";
|
|
1446
|
+
import { cva as cva16 } from "class-variance-authority";
|
|
1447
|
+
|
|
1448
|
+
// src/components/Toast/toast-store.ts
|
|
1449
|
+
import "react";
|
|
1450
|
+
var EXIT_ANIM_MS = 200;
|
|
1451
|
+
function createToastStore() {
|
|
1452
|
+
let toasts = [];
|
|
1453
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1454
|
+
let counter = 0;
|
|
1455
|
+
function emit() {
|
|
1456
|
+
for (const l of listeners) l();
|
|
1457
|
+
}
|
|
1458
|
+
function subscribe(listener) {
|
|
1459
|
+
listeners.add(listener);
|
|
1460
|
+
return () => {
|
|
1461
|
+
listeners.delete(listener);
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
function getSnapshot() {
|
|
1465
|
+
return toasts;
|
|
1466
|
+
}
|
|
1467
|
+
function nextId() {
|
|
1468
|
+
counter += 1;
|
|
1469
|
+
return `t${counter}`;
|
|
1470
|
+
}
|
|
1471
|
+
function add(variant, message, options = {}) {
|
|
1472
|
+
const id = options.id ?? nextId();
|
|
1473
|
+
const existing = toasts.findIndex((t) => t.id === id);
|
|
1474
|
+
const data = {
|
|
1475
|
+
id,
|
|
1476
|
+
variant,
|
|
1477
|
+
open: true,
|
|
1478
|
+
title: message,
|
|
1479
|
+
description: options.description,
|
|
1480
|
+
duration: options.duration,
|
|
1481
|
+
action: options.action,
|
|
1482
|
+
onDismiss: options.onDismiss
|
|
1483
|
+
};
|
|
1484
|
+
if (existing >= 0) {
|
|
1485
|
+
toasts = toasts.map((t, i) => i === existing ? data : t);
|
|
1486
|
+
} else {
|
|
1487
|
+
toasts = [...toasts, data];
|
|
1488
|
+
}
|
|
1489
|
+
emit();
|
|
1490
|
+
return id;
|
|
1491
|
+
}
|
|
1492
|
+
function dismiss(id) {
|
|
1493
|
+
if (id === void 0) {
|
|
1494
|
+
const ids = toasts.map((t) => t.id);
|
|
1495
|
+
toasts = toasts.map((t) => ({ ...t, open: false }));
|
|
1496
|
+
emit();
|
|
1497
|
+
setTimeout(() => {
|
|
1498
|
+
ids.forEach((id2) => remove(id2));
|
|
1499
|
+
}, EXIT_ANIM_MS);
|
|
1500
|
+
} else {
|
|
1501
|
+
toasts = toasts.map((t) => t.id === id ? { ...t, open: false } : t);
|
|
1502
|
+
emit();
|
|
1503
|
+
setTimeout(() => remove(id), EXIT_ANIM_MS);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
function remove(id) {
|
|
1507
|
+
const target = toasts.find((t) => t.id === id);
|
|
1508
|
+
toasts = toasts.filter((t) => t.id !== id);
|
|
1509
|
+
emit();
|
|
1510
|
+
target?.onDismiss?.();
|
|
1511
|
+
}
|
|
1512
|
+
function __reset() {
|
|
1513
|
+
toasts = [];
|
|
1514
|
+
counter = 0;
|
|
1515
|
+
emit();
|
|
1516
|
+
}
|
|
1517
|
+
return { subscribe, getSnapshot, add, dismiss, remove, __reset };
|
|
1518
|
+
}
|
|
1519
|
+
var toastStore = createToastStore();
|
|
1520
|
+
function createToast(store) {
|
|
1521
|
+
const fn = ((message, options) => store.add("default", message, options));
|
|
1522
|
+
fn.default = (message, options) => store.add("default", message, options);
|
|
1523
|
+
fn.info = (message, options) => store.add("info", message, options);
|
|
1524
|
+
fn.success = (message, options) => store.add("success", message, options);
|
|
1525
|
+
fn.warning = (message, options) => store.add("warning", message, options);
|
|
1526
|
+
fn.error = (message, options) => store.add("destructive", message, options);
|
|
1527
|
+
fn.destructive = fn.error;
|
|
1528
|
+
fn.dismiss = (id) => store.dismiss(id);
|
|
1529
|
+
return fn;
|
|
1530
|
+
}
|
|
1531
|
+
var toast = createToast(toastStore);
|
|
1532
|
+
|
|
1533
|
+
// src/components/Toast/Toast.tsx
|
|
1534
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1535
|
+
var toastVariants = cva16("ddga-toast", {
|
|
1536
|
+
variants: {
|
|
1537
|
+
variant: {
|
|
1538
|
+
default: "ddga-toast--default",
|
|
1539
|
+
info: "ddga-toast--info",
|
|
1540
|
+
success: "ddga-toast--success",
|
|
1541
|
+
warning: "ddga-toast--warning",
|
|
1542
|
+
destructive: "ddga-toast--destructive"
|
|
1543
|
+
}
|
|
1544
|
+
},
|
|
1545
|
+
defaultVariants: {
|
|
1546
|
+
variant: "default"
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
var toastViewportVariants = cva16("ddga-toast-viewport", {
|
|
1550
|
+
variants: {
|
|
1551
|
+
position: {
|
|
1552
|
+
"top-start": "ddga-toast-viewport--top-start",
|
|
1553
|
+
"top-center": "ddga-toast-viewport--top-center",
|
|
1554
|
+
"top-end": "ddga-toast-viewport--top-end",
|
|
1555
|
+
"bottom-start": "ddga-toast-viewport--bottom-start",
|
|
1556
|
+
"bottom-center": "ddga-toast-viewport--bottom-center",
|
|
1557
|
+
"bottom-end": "ddga-toast-viewport--bottom-end"
|
|
1558
|
+
},
|
|
1559
|
+
containerized: {
|
|
1560
|
+
true: "ddga-toast-viewport--containerized"
|
|
1561
|
+
}
|
|
1562
|
+
},
|
|
1563
|
+
defaultVariants: {
|
|
1564
|
+
position: "bottom-end"
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
var DEFAULT_ICONS2 = {
|
|
1568
|
+
default: null,
|
|
1569
|
+
info: /* @__PURE__ */ jsx18(Info, { "aria-hidden": "true" }),
|
|
1570
|
+
success: /* @__PURE__ */ jsx18(Check, { "aria-hidden": "true" }),
|
|
1571
|
+
warning: /* @__PURE__ */ jsx18(AlertTriangle, { "aria-hidden": "true" }),
|
|
1572
|
+
destructive: /* @__PURE__ */ jsx18(AlertCircle, { "aria-hidden": "true" })
|
|
1573
|
+
};
|
|
1574
|
+
function Toaster({
|
|
1575
|
+
position = "bottom-end",
|
|
1576
|
+
containerized = false,
|
|
1577
|
+
duration = 4e3,
|
|
1578
|
+
closeButton = true,
|
|
1579
|
+
closeLabel = "Dismiss",
|
|
1580
|
+
hideIcon = false,
|
|
1581
|
+
className,
|
|
1582
|
+
swipeDirection,
|
|
1583
|
+
store = toastStore
|
|
1584
|
+
}) {
|
|
1585
|
+
const toasts = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
1586
|
+
const resolvedSwipe = swipeDirection ?? (position.startsWith("top") ? "up" : "down");
|
|
1587
|
+
return /* @__PURE__ */ jsxs14(ToastPrimitive.Provider, { duration, swipeDirection: resolvedSwipe, children: [
|
|
1588
|
+
toasts.map((t) => /* @__PURE__ */ jsx18(
|
|
1589
|
+
ToastItem,
|
|
1590
|
+
{
|
|
1591
|
+
toast: t,
|
|
1592
|
+
store,
|
|
1593
|
+
closeButton,
|
|
1594
|
+
closeLabel,
|
|
1595
|
+
hideIcon
|
|
1596
|
+
},
|
|
1597
|
+
t.id
|
|
1598
|
+
)),
|
|
1599
|
+
/* @__PURE__ */ jsx18(
|
|
1600
|
+
ToastPrimitive.Viewport,
|
|
1601
|
+
{
|
|
1602
|
+
"data-slot": "toast-viewport",
|
|
1603
|
+
"data-position": position,
|
|
1604
|
+
className: cn(toastViewportVariants({ position, containerized }), className)
|
|
1605
|
+
}
|
|
1606
|
+
)
|
|
1607
|
+
] });
|
|
1608
|
+
}
|
|
1609
|
+
function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
|
|
1610
|
+
const radixType = t.variant === "destructive" ? "foreground" : "background";
|
|
1611
|
+
const icon = hideIcon ? null : DEFAULT_ICONS2[t.variant];
|
|
1612
|
+
return /* @__PURE__ */ jsxs14(
|
|
1613
|
+
ToastPrimitive.Root,
|
|
1614
|
+
{
|
|
1615
|
+
"data-slot": "toast",
|
|
1616
|
+
"data-variant": t.variant,
|
|
1617
|
+
className: toastVariants({ variant: t.variant }),
|
|
1618
|
+
open: t.open,
|
|
1619
|
+
type: radixType,
|
|
1620
|
+
duration: t.duration,
|
|
1621
|
+
onOpenChange: (open) => {
|
|
1622
|
+
if (!open) {
|
|
1623
|
+
store.dismiss(t.id);
|
|
1624
|
+
}
|
|
1625
|
+
},
|
|
1626
|
+
children: [
|
|
1627
|
+
icon ? /* @__PURE__ */ jsx18("span", { className: "ddga-toast__icon", children: icon }) : null,
|
|
1628
|
+
/* @__PURE__ */ jsxs14("div", { className: "ddga-toast__body", children: [
|
|
1629
|
+
t.title ? /* @__PURE__ */ jsx18(ToastPrimitive.Title, { className: "ddga-toast__title", children: t.title }) : null,
|
|
1630
|
+
t.description ? /* @__PURE__ */ jsx18(ToastPrimitive.Description, { className: "ddga-toast__description", children: t.description }) : null,
|
|
1631
|
+
t.action ? /* @__PURE__ */ jsx18(
|
|
1632
|
+
ToastPrimitive.Action,
|
|
1633
|
+
{
|
|
1634
|
+
className: "ddga-toast__action",
|
|
1635
|
+
altText: t.action.altText ?? (typeof t.action.label === "string" ? t.action.label : "Action"),
|
|
1636
|
+
onClick: () => {
|
|
1637
|
+
t.action?.onClick();
|
|
1638
|
+
store.dismiss(t.id);
|
|
1639
|
+
},
|
|
1640
|
+
children: t.action.label
|
|
1641
|
+
}
|
|
1642
|
+
) : null
|
|
1643
|
+
] }),
|
|
1644
|
+
closeButton ? /* @__PURE__ */ jsx18(ToastPrimitive.Close, { className: "ddga-toast__close", "aria-label": closeLabel, children: /* @__PURE__ */ jsx18(Close, { "aria-hidden": "true" }) }) : null
|
|
1645
|
+
]
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
// src/components/Tabs/Tabs.tsx
|
|
1651
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
1652
|
+
import { cva as cva17 } from "class-variance-authority";
|
|
1653
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1654
|
+
var tabsVariants = cva17("ddga-tabs", {
|
|
1655
|
+
variants: {
|
|
1656
|
+
variant: {
|
|
1657
|
+
line: "ddga-tabs--line",
|
|
1658
|
+
pill: "ddga-tabs--pill"
|
|
1659
|
+
},
|
|
1660
|
+
size: {
|
|
1661
|
+
sm: "ddga-tabs--sm",
|
|
1662
|
+
md: "ddga-tabs--md"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
defaultVariants: {
|
|
1666
|
+
variant: "line",
|
|
1667
|
+
size: "md"
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
var tabsListVariants = cva17("ddga-tabs__list", {
|
|
1671
|
+
variants: {
|
|
1672
|
+
fullWidth: {
|
|
1673
|
+
true: "ddga-tabs__list--full-width"
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
function Tabs({ variant, size, className, ...props }) {
|
|
1678
|
+
return /* @__PURE__ */ jsx19(
|
|
1679
|
+
TabsPrimitive.Root,
|
|
1680
|
+
{
|
|
1681
|
+
"data-slot": "tabs",
|
|
1682
|
+
className: cn(tabsVariants({ variant, size }), className),
|
|
1683
|
+
...props
|
|
1684
|
+
}
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
function TabsList({ fullWidth, className, ...props }) {
|
|
1688
|
+
return /* @__PURE__ */ jsx19(
|
|
1689
|
+
TabsPrimitive.List,
|
|
1690
|
+
{
|
|
1691
|
+
"data-slot": "tabs-list",
|
|
1692
|
+
className: cn(tabsListVariants({ fullWidth }), className),
|
|
1693
|
+
...props
|
|
1694
|
+
}
|
|
1695
|
+
);
|
|
1696
|
+
}
|
|
1697
|
+
function TabsTrigger({ className, ...props }) {
|
|
1698
|
+
return /* @__PURE__ */ jsx19(
|
|
1699
|
+
TabsPrimitive.Trigger,
|
|
1700
|
+
{
|
|
1701
|
+
"data-slot": "tabs-trigger",
|
|
1702
|
+
className: cn("ddga-tabs__trigger", className),
|
|
1703
|
+
...props
|
|
1704
|
+
}
|
|
1705
|
+
);
|
|
1706
|
+
}
|
|
1707
|
+
function TabsContent({ className, ...props }) {
|
|
1708
|
+
return /* @__PURE__ */ jsx19(
|
|
1709
|
+
TabsPrimitive.Content,
|
|
1710
|
+
{
|
|
1711
|
+
"data-slot": "tabs-content",
|
|
1712
|
+
className: cn("ddga-tabs__content", className),
|
|
1713
|
+
...props
|
|
1714
|
+
}
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
// src/components/Breadcrumb/Breadcrumb.tsx
|
|
1719
|
+
import { Slot as SlotPrimitive6 } from "radix-ui";
|
|
1720
|
+
import { cva as cva18 } from "class-variance-authority";
|
|
1721
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1722
|
+
var breadcrumbVariants = cva18("ddga-breadcrumb", {
|
|
1723
|
+
variants: {
|
|
1724
|
+
size: {
|
|
1725
|
+
sm: "ddga-breadcrumb--sm",
|
|
1726
|
+
md: "ddga-breadcrumb--md"
|
|
1727
|
+
}
|
|
1728
|
+
},
|
|
1729
|
+
defaultVariants: {
|
|
1730
|
+
size: "md"
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
function Breadcrumb({ size, className, ...props }) {
|
|
1734
|
+
return /* @__PURE__ */ jsx20(
|
|
1735
|
+
"nav",
|
|
1736
|
+
{
|
|
1737
|
+
"aria-label": "Breadcrumb",
|
|
1738
|
+
"data-slot": "breadcrumb",
|
|
1739
|
+
className: cn(breadcrumbVariants({ size }), className),
|
|
1740
|
+
...props
|
|
1741
|
+
}
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
function BreadcrumbList({ className, ...props }) {
|
|
1745
|
+
return /* @__PURE__ */ jsx20("ol", { "data-slot": "breadcrumb-list", className: cn("ddga-breadcrumb__list", className), ...props });
|
|
1746
|
+
}
|
|
1747
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
1748
|
+
return /* @__PURE__ */ jsx20("li", { "data-slot": "breadcrumb-item", className: cn("ddga-breadcrumb__item", className), ...props });
|
|
1749
|
+
}
|
|
1750
|
+
function BreadcrumbLink({ asChild, className, ...props }) {
|
|
1751
|
+
const Comp = asChild ? SlotPrimitive6.Slot : "a";
|
|
1752
|
+
return /* @__PURE__ */ jsx20(
|
|
1753
|
+
Comp,
|
|
1754
|
+
{
|
|
1755
|
+
"data-slot": "breadcrumb-link",
|
|
1756
|
+
className: cn("ddga-breadcrumb__link", className),
|
|
1757
|
+
...props
|
|
1758
|
+
}
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1761
|
+
function BreadcrumbPage({ asChild, className, ...props }) {
|
|
1762
|
+
const Comp = asChild ? SlotPrimitive6.Slot : "span";
|
|
1763
|
+
return /* @__PURE__ */ jsx20(
|
|
1764
|
+
Comp,
|
|
1765
|
+
{
|
|
1766
|
+
"aria-current": "page",
|
|
1767
|
+
"data-slot": "breadcrumb-page",
|
|
1768
|
+
className: cn("ddga-breadcrumb__page", className),
|
|
1769
|
+
...props
|
|
1770
|
+
}
|
|
1771
|
+
);
|
|
1772
|
+
}
|
|
1773
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
1774
|
+
return /* @__PURE__ */ jsx20(
|
|
1775
|
+
"li",
|
|
1776
|
+
{
|
|
1777
|
+
role: "presentation",
|
|
1778
|
+
"aria-hidden": "true",
|
|
1779
|
+
"data-slot": "breadcrumb-separator",
|
|
1780
|
+
className: cn("ddga-breadcrumb__separator", className),
|
|
1781
|
+
...props,
|
|
1782
|
+
children: children ?? /* @__PURE__ */ jsx20(ChevronRight, {})
|
|
1783
|
+
}
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
1787
|
+
return /* @__PURE__ */ jsx20(
|
|
1788
|
+
"span",
|
|
1789
|
+
{
|
|
1790
|
+
role: "presentation",
|
|
1791
|
+
"aria-hidden": "true",
|
|
1792
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
1793
|
+
className: cn("ddga-breadcrumb__ellipsis", className),
|
|
1794
|
+
...props,
|
|
1795
|
+
children: /* @__PURE__ */ jsx20(MoreHorizontal, {})
|
|
1796
|
+
}
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
// src/components/Pagination/Pagination.tsx
|
|
1801
|
+
import { Slot as SlotPrimitive7 } from "radix-ui";
|
|
1802
|
+
import { cva as cva19 } from "class-variance-authority";
|
|
1803
|
+
import { Fragment, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1804
|
+
var paginationVariants = cva19("ddga-pagination", {
|
|
1805
|
+
variants: {
|
|
1806
|
+
size: {
|
|
1807
|
+
sm: "ddga-pagination--sm",
|
|
1808
|
+
md: "ddga-pagination--md"
|
|
1809
|
+
}
|
|
1810
|
+
},
|
|
1811
|
+
defaultVariants: {
|
|
1812
|
+
size: "md"
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1815
|
+
var paginationLinkVariants = cva19("ddga-pagination__link", {
|
|
1816
|
+
variants: {
|
|
1817
|
+
isActive: {
|
|
1818
|
+
true: "ddga-pagination__link--active"
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
function Pagination({ size, className, ...props }) {
|
|
1823
|
+
return /* @__PURE__ */ jsx21(
|
|
1824
|
+
"nav",
|
|
1825
|
+
{
|
|
1826
|
+
"aria-label": "pagination",
|
|
1827
|
+
"data-slot": "pagination",
|
|
1828
|
+
className: cn(paginationVariants({ size }), className),
|
|
1829
|
+
...props
|
|
1830
|
+
}
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
function PaginationContent({ className, ...props }) {
|
|
1834
|
+
return /* @__PURE__ */ jsx21(
|
|
1835
|
+
"ul",
|
|
1836
|
+
{
|
|
1837
|
+
"data-slot": "pagination-content",
|
|
1838
|
+
className: cn("ddga-pagination__content", className),
|
|
1839
|
+
...props
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
function PaginationItem({ className, ...props }) {
|
|
1844
|
+
return /* @__PURE__ */ jsx21("li", { "data-slot": "pagination-item", className: cn("ddga-pagination__item", className), ...props });
|
|
1845
|
+
}
|
|
1846
|
+
function PaginationLink({ asChild, isActive, className, ...props }) {
|
|
1847
|
+
const Comp = asChild ? SlotPrimitive7.Slot : "a";
|
|
1848
|
+
return /* @__PURE__ */ jsx21(
|
|
1849
|
+
Comp,
|
|
1850
|
+
{
|
|
1851
|
+
"aria-current": isActive ? "page" : void 0,
|
|
1852
|
+
"data-slot": "pagination-link",
|
|
1853
|
+
"data-active": isActive ? "" : void 0,
|
|
1854
|
+
className: cn(paginationLinkVariants({ isActive }), className),
|
|
1855
|
+
...props
|
|
1856
|
+
}
|
|
1857
|
+
);
|
|
1858
|
+
}
|
|
1859
|
+
function PaginationPrevious({
|
|
1860
|
+
label = "Previous",
|
|
1861
|
+
className,
|
|
1862
|
+
children,
|
|
1863
|
+
asChild,
|
|
1864
|
+
...props
|
|
1865
|
+
}) {
|
|
1866
|
+
return /* @__PURE__ */ jsx21(
|
|
1867
|
+
PaginationLink,
|
|
1868
|
+
{
|
|
1869
|
+
asChild,
|
|
1870
|
+
"aria-label": label,
|
|
1871
|
+
"data-slot": "pagination-previous",
|
|
1872
|
+
className: cn("ddga-pagination__nav", "ddga-pagination__nav--previous", className),
|
|
1873
|
+
...props,
|
|
1874
|
+
children: children ?? /* @__PURE__ */ jsxs15(Fragment, { children: [
|
|
1875
|
+
/* @__PURE__ */ jsx21(ChevronRight, { className: "ddga-pagination__nav-icon ddga-pagination__nav-icon--previous" }),
|
|
1876
|
+
/* @__PURE__ */ jsx21("span", { children: label })
|
|
1877
|
+
] })
|
|
1878
|
+
}
|
|
1879
|
+
);
|
|
1880
|
+
}
|
|
1881
|
+
function PaginationNext({
|
|
1882
|
+
label = "Next",
|
|
1883
|
+
className,
|
|
1884
|
+
children,
|
|
1885
|
+
asChild,
|
|
1886
|
+
...props
|
|
1887
|
+
}) {
|
|
1888
|
+
return /* @__PURE__ */ jsx21(
|
|
1889
|
+
PaginationLink,
|
|
1890
|
+
{
|
|
1891
|
+
asChild,
|
|
1892
|
+
"aria-label": label,
|
|
1893
|
+
"data-slot": "pagination-next",
|
|
1894
|
+
className: cn("ddga-pagination__nav", "ddga-pagination__nav--next", className),
|
|
1895
|
+
...props,
|
|
1896
|
+
children: children ?? /* @__PURE__ */ jsxs15(Fragment, { children: [
|
|
1897
|
+
/* @__PURE__ */ jsx21("span", { children: label }),
|
|
1898
|
+
/* @__PURE__ */ jsx21(ChevronRight, { className: "ddga-pagination__nav-icon ddga-pagination__nav-icon--next" })
|
|
1899
|
+
] })
|
|
1900
|
+
}
|
|
1901
|
+
);
|
|
1902
|
+
}
|
|
1903
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
1904
|
+
return /* @__PURE__ */ jsx21(
|
|
1905
|
+
"span",
|
|
1906
|
+
{
|
|
1907
|
+
role: "presentation",
|
|
1908
|
+
"aria-hidden": "true",
|
|
1909
|
+
"data-slot": "pagination-ellipsis",
|
|
1910
|
+
className: cn("ddga-pagination__ellipsis", className),
|
|
1911
|
+
...props,
|
|
1912
|
+
children: /* @__PURE__ */ jsx21(MoreHorizontal, {})
|
|
1913
|
+
}
|
|
1914
|
+
);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
// src/components/Accordion/Accordion.tsx
|
|
1918
|
+
import { Accordion as AccordionPrimitive } from "radix-ui";
|
|
1919
|
+
import { cva as cva20 } from "class-variance-authority";
|
|
1920
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1921
|
+
var accordionVariants = cva20("ddga-accordion", {
|
|
1922
|
+
variants: {
|
|
1923
|
+
size: {
|
|
1924
|
+
sm: "ddga-accordion--sm",
|
|
1925
|
+
md: "ddga-accordion--md"
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
defaultVariants: {
|
|
1929
|
+
size: "md"
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
function Accordion({ size, className, ...props }) {
|
|
1933
|
+
return /* @__PURE__ */ jsx22(
|
|
1934
|
+
AccordionPrimitive.Root,
|
|
1935
|
+
{
|
|
1936
|
+
"data-slot": "accordion",
|
|
1937
|
+
className: cn(accordionVariants({ size }), className),
|
|
1938
|
+
...props
|
|
1939
|
+
}
|
|
1940
|
+
);
|
|
1941
|
+
}
|
|
1942
|
+
function AccordionItem({ className, ...props }) {
|
|
1943
|
+
return /* @__PURE__ */ jsx22(
|
|
1944
|
+
AccordionPrimitive.Item,
|
|
1945
|
+
{
|
|
1946
|
+
"data-slot": "accordion-item",
|
|
1947
|
+
className: cn("ddga-accordion__item", className),
|
|
1948
|
+
...props
|
|
1949
|
+
}
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
1953
|
+
return /* @__PURE__ */ jsx22(AccordionPrimitive.Header, { className: "ddga-accordion__header", children: /* @__PURE__ */ jsxs16(
|
|
1954
|
+
AccordionPrimitive.Trigger,
|
|
1955
|
+
{
|
|
1956
|
+
"data-slot": "accordion-trigger",
|
|
1957
|
+
className: cn("ddga-accordion__trigger", className),
|
|
1958
|
+
...props,
|
|
1959
|
+
children: [
|
|
1960
|
+
children,
|
|
1961
|
+
/* @__PURE__ */ jsx22(
|
|
1962
|
+
ChevronDown,
|
|
1963
|
+
{
|
|
1964
|
+
"aria-hidden": "true",
|
|
1965
|
+
className: "ddga-accordion__chevron",
|
|
1966
|
+
"data-slot": "accordion-chevron"
|
|
1967
|
+
}
|
|
1968
|
+
)
|
|
1969
|
+
]
|
|
1970
|
+
}
|
|
1971
|
+
) });
|
|
1972
|
+
}
|
|
1973
|
+
function AccordionContent({ className, children, ...props }) {
|
|
1974
|
+
return /* @__PURE__ */ jsx22(
|
|
1975
|
+
AccordionPrimitive.Content,
|
|
1976
|
+
{
|
|
1977
|
+
"data-slot": "accordion-content",
|
|
1978
|
+
className: cn("ddga-accordion__content", className),
|
|
1979
|
+
...props,
|
|
1980
|
+
children: /* @__PURE__ */ jsx22("div", { className: "ddga-accordion__content-inner", children })
|
|
1981
|
+
}
|
|
1982
|
+
);
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
// src/components/Steps/Steps.tsx
|
|
1986
|
+
import { cva as cva21 } from "class-variance-authority";
|
|
1987
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1988
|
+
var stepsVariants = cva21("ddga-steps", {
|
|
1989
|
+
variants: {
|
|
1990
|
+
size: {
|
|
1991
|
+
sm: "ddga-steps--sm",
|
|
1992
|
+
md: "ddga-steps--md"
|
|
1993
|
+
},
|
|
1994
|
+
orientation: {
|
|
1995
|
+
horizontal: "ddga-steps--horizontal",
|
|
1996
|
+
vertical: "ddga-steps--vertical"
|
|
1997
|
+
}
|
|
1998
|
+
},
|
|
1999
|
+
defaultVariants: {
|
|
2000
|
+
size: "md",
|
|
2001
|
+
orientation: "horizontal"
|
|
2002
|
+
}
|
|
2003
|
+
});
|
|
2004
|
+
var stepVariants = cva21("ddga-steps__step", {
|
|
2005
|
+
variants: {
|
|
2006
|
+
state: {
|
|
2007
|
+
completed: "ddga-steps__step--completed",
|
|
2008
|
+
current: "ddga-steps__step--current",
|
|
2009
|
+
upcoming: "ddga-steps__step--upcoming"
|
|
2010
|
+
}
|
|
2011
|
+
},
|
|
2012
|
+
defaultVariants: {
|
|
2013
|
+
state: "upcoming"
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
2016
|
+
function Steps({ size, orientation, className, ...props }) {
|
|
2017
|
+
return /* @__PURE__ */ jsx23(
|
|
2018
|
+
"ol",
|
|
2019
|
+
{
|
|
2020
|
+
"data-slot": "steps",
|
|
2021
|
+
"data-orientation": orientation ?? "horizontal",
|
|
2022
|
+
className: cn(stepsVariants({ size, orientation }), className),
|
|
2023
|
+
...props
|
|
2024
|
+
}
|
|
2025
|
+
);
|
|
2026
|
+
}
|
|
2027
|
+
function Step({ state, className, ...props }) {
|
|
2028
|
+
return /* @__PURE__ */ jsx23(
|
|
2029
|
+
"li",
|
|
2030
|
+
{
|
|
2031
|
+
"aria-current": state === "current" ? "step" : void 0,
|
|
2032
|
+
"data-slot": "step",
|
|
2033
|
+
"data-state": state ?? "upcoming",
|
|
2034
|
+
className: cn(stepVariants({ state }), className),
|
|
2035
|
+
...props
|
|
2036
|
+
}
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
function StepIndicator({ step, className, ...props }) {
|
|
2040
|
+
return /* @__PURE__ */ jsxs17(
|
|
2041
|
+
"span",
|
|
2042
|
+
{
|
|
2043
|
+
"aria-hidden": "true",
|
|
2044
|
+
"data-slot": "step-indicator",
|
|
2045
|
+
className: cn("ddga-steps__indicator", className),
|
|
2046
|
+
...props,
|
|
2047
|
+
children: [
|
|
2048
|
+
/* @__PURE__ */ jsx23(Check, { className: "ddga-steps__indicator-check" }),
|
|
2049
|
+
/* @__PURE__ */ jsx23("span", { className: "ddga-steps__indicator-number", children: step })
|
|
2050
|
+
]
|
|
2051
|
+
}
|
|
2052
|
+
);
|
|
2053
|
+
}
|
|
2054
|
+
function StepTitle({ className, ...props }) {
|
|
2055
|
+
return /* @__PURE__ */ jsx23("span", { "data-slot": "step-title", className: cn("ddga-steps__title", className), ...props });
|
|
2056
|
+
}
|
|
2057
|
+
function StepDescription({ className, ...props }) {
|
|
2058
|
+
return /* @__PURE__ */ jsx23(
|
|
2059
|
+
"span",
|
|
2060
|
+
{
|
|
2061
|
+
"data-slot": "step-description",
|
|
2062
|
+
className: cn("ddga-steps__description", className),
|
|
2063
|
+
...props
|
|
2064
|
+
}
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
2069
|
+
import { cva as cva22 } from "class-variance-authority";
|
|
2070
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2071
|
+
var skeletonVariants = cva22("ddga-skeleton", {
|
|
2072
|
+
variants: {
|
|
2073
|
+
shape: {
|
|
2074
|
+
text: "ddga-skeleton--text",
|
|
2075
|
+
circle: "ddga-skeleton--circle",
|
|
2076
|
+
rectangle: "ddga-skeleton--rectangle"
|
|
2077
|
+
},
|
|
2078
|
+
animation: {
|
|
2079
|
+
pulse: "ddga-skeleton--pulse",
|
|
2080
|
+
wave: "ddga-skeleton--wave",
|
|
2081
|
+
none: "ddga-skeleton--none"
|
|
2082
|
+
}
|
|
2083
|
+
},
|
|
2084
|
+
defaultVariants: {
|
|
2085
|
+
shape: "text",
|
|
2086
|
+
animation: "pulse"
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
function Skeleton({ shape, animation, width, height, className, style, ...props }) {
|
|
2090
|
+
const sizeStyle = {
|
|
2091
|
+
...width !== void 0 ? { width: typeof width === "number" ? `${width}px` : width } : null,
|
|
2092
|
+
...height !== void 0 ? { height: typeof height === "number" ? `${height}px` : height } : null,
|
|
2093
|
+
...style
|
|
2094
|
+
};
|
|
2095
|
+
return /* @__PURE__ */ jsx24(
|
|
2096
|
+
"div",
|
|
2097
|
+
{
|
|
2098
|
+
"data-slot": "skeleton",
|
|
2099
|
+
"aria-hidden": "true",
|
|
2100
|
+
className: cn(skeletonVariants({ shape, animation }), className),
|
|
2101
|
+
style: sizeStyle,
|
|
2102
|
+
...props
|
|
2103
|
+
}
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
// src/components/Progress/Progress.tsx
|
|
2108
|
+
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
2109
|
+
import { cva as cva23 } from "class-variance-authority";
|
|
2110
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2111
|
+
var progressVariants = cva23("ddga-progress", {
|
|
2112
|
+
variants: {
|
|
2113
|
+
size: {
|
|
2114
|
+
sm: "ddga-progress--sm",
|
|
2115
|
+
md: "ddga-progress--md",
|
|
2116
|
+
lg: "ddga-progress--lg"
|
|
2117
|
+
},
|
|
2118
|
+
color: {
|
|
2119
|
+
primary: "ddga-progress--primary",
|
|
2120
|
+
success: "ddga-progress--success",
|
|
2121
|
+
warning: "ddga-progress--warning",
|
|
2122
|
+
destructive: "ddga-progress--destructive"
|
|
2123
|
+
}
|
|
2124
|
+
},
|
|
2125
|
+
defaultVariants: {
|
|
2126
|
+
size: "md",
|
|
2127
|
+
color: "primary"
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2130
|
+
var circularProgressVariants = cva23("ddga-circular-progress", {
|
|
2131
|
+
variants: {
|
|
2132
|
+
size: {
|
|
2133
|
+
sm: "ddga-circular-progress--sm",
|
|
2134
|
+
md: "ddga-circular-progress--md",
|
|
2135
|
+
lg: "ddga-circular-progress--lg"
|
|
2136
|
+
},
|
|
2137
|
+
color: {
|
|
2138
|
+
primary: "ddga-circular-progress--primary",
|
|
2139
|
+
success: "ddga-circular-progress--success",
|
|
2140
|
+
warning: "ddga-circular-progress--warning",
|
|
2141
|
+
destructive: "ddga-circular-progress--destructive"
|
|
2142
|
+
}
|
|
2143
|
+
},
|
|
2144
|
+
defaultVariants: {
|
|
2145
|
+
size: "md",
|
|
2146
|
+
color: "primary"
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
function Progress({ value = null, max = 100, size, color, className, ...props }) {
|
|
2150
|
+
const isIndeterminate = value === null;
|
|
2151
|
+
const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
2152
|
+
return /* @__PURE__ */ jsx25(
|
|
2153
|
+
ProgressPrimitive.Root,
|
|
2154
|
+
{
|
|
2155
|
+
"data-slot": "progress",
|
|
2156
|
+
value,
|
|
2157
|
+
max,
|
|
2158
|
+
className: cn(progressVariants({ size, color }), className),
|
|
2159
|
+
...props,
|
|
2160
|
+
children: /* @__PURE__ */ jsx25(
|
|
2161
|
+
ProgressPrimitive.Indicator,
|
|
2162
|
+
{
|
|
2163
|
+
"data-slot": "progress-indicator",
|
|
2164
|
+
className: "ddga-progress__indicator",
|
|
2165
|
+
style: isIndeterminate ? void 0 : { transform: `translateX(${pct - 100}%)` }
|
|
2166
|
+
}
|
|
2167
|
+
)
|
|
2168
|
+
}
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
var CIRCULAR_SIZES = { sm: 32, md: 48, lg: 72 };
|
|
2172
|
+
var CIRCULAR_DEFAULT_THICKNESS = { sm: 4, md: 5, lg: 6 };
|
|
2173
|
+
function CircularProgress({
|
|
2174
|
+
value = null,
|
|
2175
|
+
max = 100,
|
|
2176
|
+
size,
|
|
2177
|
+
color,
|
|
2178
|
+
thickness,
|
|
2179
|
+
showLabel = false,
|
|
2180
|
+
className,
|
|
2181
|
+
...props
|
|
2182
|
+
}) {
|
|
2183
|
+
const isIndeterminate = value === null;
|
|
2184
|
+
const sizeKey = size ?? "md";
|
|
2185
|
+
const diameter = CIRCULAR_SIZES[sizeKey];
|
|
2186
|
+
const strokeWidth = thickness ?? CIRCULAR_DEFAULT_THICKNESS[sizeKey];
|
|
2187
|
+
const radius = (diameter - strokeWidth) / 2;
|
|
2188
|
+
const circumference = 2 * Math.PI * radius;
|
|
2189
|
+
const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
2190
|
+
const dashOffset = isIndeterminate ? circumference * 0.75 : circumference * (1 - pct / 100);
|
|
2191
|
+
const state = isIndeterminate ? "indeterminate" : value >= max ? "complete" : "loading";
|
|
2192
|
+
return /* @__PURE__ */ jsxs18(
|
|
2193
|
+
"div",
|
|
2194
|
+
{
|
|
2195
|
+
"data-slot": "circular-progress",
|
|
2196
|
+
"data-state": state,
|
|
2197
|
+
role: "progressbar",
|
|
2198
|
+
"aria-valuemin": 0,
|
|
2199
|
+
"aria-valuemax": max,
|
|
2200
|
+
"aria-valuenow": isIndeterminate ? void 0 : value,
|
|
2201
|
+
className: cn(circularProgressVariants({ size, color }), className),
|
|
2202
|
+
style: { inlineSize: diameter, blockSize: diameter },
|
|
2203
|
+
...props,
|
|
2204
|
+
children: [
|
|
2205
|
+
/* @__PURE__ */ jsxs18(
|
|
2206
|
+
"svg",
|
|
2207
|
+
{
|
|
2208
|
+
className: "ddga-circular-progress__svg",
|
|
2209
|
+
viewBox: `0 0 ${diameter} ${diameter}`,
|
|
2210
|
+
width: diameter,
|
|
2211
|
+
height: diameter,
|
|
2212
|
+
"aria-hidden": "true",
|
|
2213
|
+
focusable: "false",
|
|
2214
|
+
children: [
|
|
2215
|
+
/* @__PURE__ */ jsx25(
|
|
2216
|
+
"circle",
|
|
2217
|
+
{
|
|
2218
|
+
className: "ddga-circular-progress__track",
|
|
2219
|
+
cx: diameter / 2,
|
|
2220
|
+
cy: diameter / 2,
|
|
2221
|
+
r: radius,
|
|
2222
|
+
fill: "none",
|
|
2223
|
+
strokeWidth
|
|
2224
|
+
}
|
|
2225
|
+
),
|
|
2226
|
+
/* @__PURE__ */ jsx25(
|
|
2227
|
+
"circle",
|
|
2228
|
+
{
|
|
2229
|
+
className: "ddga-circular-progress__indicator",
|
|
2230
|
+
cx: diameter / 2,
|
|
2231
|
+
cy: diameter / 2,
|
|
2232
|
+
r: radius,
|
|
2233
|
+
fill: "none",
|
|
2234
|
+
strokeWidth,
|
|
2235
|
+
strokeLinecap: "round",
|
|
2236
|
+
strokeDasharray: circumference,
|
|
2237
|
+
strokeDashoffset: dashOffset,
|
|
2238
|
+
transform: `rotate(-90 ${diameter / 2} ${diameter / 2})`
|
|
2239
|
+
}
|
|
2240
|
+
)
|
|
2241
|
+
]
|
|
2242
|
+
}
|
|
2243
|
+
),
|
|
2244
|
+
showLabel && !isIndeterminate ? /* @__PURE__ */ jsxs18("span", { className: "ddga-circular-progress__label", "aria-hidden": "true", children: [
|
|
2245
|
+
Math.round(pct),
|
|
2246
|
+
"%"
|
|
2247
|
+
] }) : null
|
|
2248
|
+
]
|
|
2249
|
+
}
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
2254
|
+
import { useContext as useContext5 } from "react";
|
|
2255
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
2256
|
+
import { cva as cva24 } from "class-variance-authority";
|
|
2257
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2258
|
+
var dropdownMenuVariants = cva24("ddga-dropdown-menu", {
|
|
2259
|
+
variants: {
|
|
2260
|
+
size: {
|
|
2261
|
+
sm: "ddga-dropdown-menu--sm",
|
|
2262
|
+
md: "ddga-dropdown-menu--md"
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
defaultVariants: {
|
|
2266
|
+
size: "md"
|
|
2267
|
+
}
|
|
2268
|
+
});
|
|
2269
|
+
function DropdownMenu(props) {
|
|
2270
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Root, { ...props });
|
|
2271
|
+
}
|
|
2272
|
+
function DropdownMenuTrigger(props) {
|
|
2273
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2274
|
+
}
|
|
2275
|
+
function DropdownMenuContent({
|
|
2276
|
+
size,
|
|
2277
|
+
className,
|
|
2278
|
+
sideOffset = 6,
|
|
2279
|
+
...props
|
|
2280
|
+
}) {
|
|
2281
|
+
const ctx = useContext5(DgaContext);
|
|
2282
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
2283
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx26(
|
|
2284
|
+
DropdownMenuPrimitive.Content,
|
|
2285
|
+
{
|
|
2286
|
+
"data-slot": "dropdown-menu-content",
|
|
2287
|
+
sideOffset,
|
|
2288
|
+
className: cn(dropdownMenuVariants({ size }), className),
|
|
2289
|
+
...props
|
|
2290
|
+
}
|
|
2291
|
+
) });
|
|
2292
|
+
}
|
|
2293
|
+
function DropdownMenuItem({
|
|
2294
|
+
className,
|
|
2295
|
+
destructive,
|
|
2296
|
+
startIcon,
|
|
2297
|
+
shortcut,
|
|
2298
|
+
children,
|
|
2299
|
+
...props
|
|
2300
|
+
}) {
|
|
2301
|
+
return /* @__PURE__ */ jsxs19(
|
|
2302
|
+
DropdownMenuPrimitive.Item,
|
|
2303
|
+
{
|
|
2304
|
+
"data-slot": "dropdown-menu-item",
|
|
2305
|
+
"data-destructive": destructive ? "" : void 0,
|
|
2306
|
+
className: cn("ddga-dropdown-menu__item", className),
|
|
2307
|
+
...props,
|
|
2308
|
+
children: [
|
|
2309
|
+
startIcon ? /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
2310
|
+
/* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children }),
|
|
2311
|
+
shortcut ? /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__shortcut", "aria-hidden": "true", children: shortcut }) : null
|
|
2312
|
+
]
|
|
2313
|
+
}
|
|
2314
|
+
);
|
|
2315
|
+
}
|
|
2316
|
+
function DropdownMenuCheckboxItem({
|
|
2317
|
+
className,
|
|
2318
|
+
children,
|
|
2319
|
+
onSelect,
|
|
2320
|
+
...props
|
|
2321
|
+
}) {
|
|
2322
|
+
const handleSelect = onSelect ?? ((event) => {
|
|
2323
|
+
event.preventDefault();
|
|
2324
|
+
});
|
|
2325
|
+
return /* @__PURE__ */ jsxs19(
|
|
2326
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
2327
|
+
{
|
|
2328
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
2329
|
+
className: cn("ddga-dropdown-menu__item", "ddga-dropdown-menu__item--checkable", className),
|
|
2330
|
+
onSelect: handleSelect,
|
|
2331
|
+
...props,
|
|
2332
|
+
children: [
|
|
2333
|
+
/* @__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" }) }) }),
|
|
2334
|
+
/* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children })
|
|
2335
|
+
]
|
|
2336
|
+
}
|
|
2337
|
+
);
|
|
2338
|
+
}
|
|
2339
|
+
function DropdownMenuRadioGroup(props) {
|
|
2340
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
|
|
2341
|
+
}
|
|
2342
|
+
function DropdownMenuRadioItem({
|
|
2343
|
+
className,
|
|
2344
|
+
children,
|
|
2345
|
+
onSelect,
|
|
2346
|
+
...props
|
|
2347
|
+
}) {
|
|
2348
|
+
const handleSelect = onSelect ?? ((event) => {
|
|
2349
|
+
event.preventDefault();
|
|
2350
|
+
});
|
|
2351
|
+
return /* @__PURE__ */ jsxs19(
|
|
2352
|
+
DropdownMenuPrimitive.RadioItem,
|
|
2353
|
+
{
|
|
2354
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
2355
|
+
className: cn("ddga-dropdown-menu__item", "ddga-dropdown-menu__item--checkable", className),
|
|
2356
|
+
onSelect: handleSelect,
|
|
2357
|
+
...props,
|
|
2358
|
+
children: [
|
|
2359
|
+
/* @__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" }) }) }),
|
|
2360
|
+
/* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children })
|
|
2361
|
+
]
|
|
2362
|
+
}
|
|
2363
|
+
);
|
|
2364
|
+
}
|
|
2365
|
+
function DropdownMenuLabel({ className, ...props }) {
|
|
2366
|
+
return /* @__PURE__ */ jsx26(
|
|
2367
|
+
DropdownMenuPrimitive.Label,
|
|
2368
|
+
{
|
|
2369
|
+
"data-slot": "dropdown-menu-label",
|
|
2370
|
+
className: cn("ddga-dropdown-menu__group-label", className),
|
|
2371
|
+
...props
|
|
2372
|
+
}
|
|
2373
|
+
);
|
|
2374
|
+
}
|
|
2375
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
2376
|
+
return /* @__PURE__ */ jsx26(
|
|
2377
|
+
DropdownMenuPrimitive.Separator,
|
|
2378
|
+
{
|
|
2379
|
+
"data-slot": "dropdown-menu-separator",
|
|
2380
|
+
className: cn("ddga-dropdown-menu__separator", className),
|
|
2381
|
+
...props
|
|
2382
|
+
}
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
function DropdownMenuGroup(props) {
|
|
2386
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2387
|
+
}
|
|
2388
|
+
function DropdownMenuSub(props) {
|
|
2389
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Sub, { ...props });
|
|
2390
|
+
}
|
|
2391
|
+
function DropdownMenuSubTrigger({
|
|
2392
|
+
className,
|
|
2393
|
+
startIcon,
|
|
2394
|
+
children,
|
|
2395
|
+
...props
|
|
2396
|
+
}) {
|
|
2397
|
+
return /* @__PURE__ */ jsxs19(
|
|
2398
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
2399
|
+
{
|
|
2400
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
2401
|
+
className: cn("ddga-dropdown-menu__item", "ddga-dropdown-menu__item--sub", className),
|
|
2402
|
+
...props,
|
|
2403
|
+
children: [
|
|
2404
|
+
startIcon ? /* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
2405
|
+
/* @__PURE__ */ jsx26("span", { className: "ddga-dropdown-menu__label", children }),
|
|
2406
|
+
/* @__PURE__ */ jsx26(ChevronRight, { className: "ddga-dropdown-menu__sub-chevron", "aria-hidden": "true" })
|
|
2407
|
+
]
|
|
2408
|
+
}
|
|
2409
|
+
);
|
|
2410
|
+
}
|
|
2411
|
+
function DropdownMenuSubContent({ size, className, ...props }) {
|
|
2412
|
+
const ctx = useContext5(DgaContext);
|
|
2413
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
2414
|
+
return /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx26(
|
|
2415
|
+
DropdownMenuPrimitive.SubContent,
|
|
2416
|
+
{
|
|
2417
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
2418
|
+
className: cn(dropdownMenuVariants({ size }), className),
|
|
2419
|
+
...props
|
|
2420
|
+
}
|
|
2421
|
+
) });
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
// src/components/Drawer/Drawer.tsx
|
|
2425
|
+
import { useContext as useContext6 } from "react";
|
|
2426
|
+
import { Dialog as DialogPrimitive2, Slot as SlotPrimitive8 } from "radix-ui";
|
|
2427
|
+
import { cva as cva25 } from "class-variance-authority";
|
|
2428
|
+
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2429
|
+
var drawerVariants = cva25("ddga-drawer", {
|
|
2430
|
+
variants: {
|
|
2431
|
+
side: {
|
|
2432
|
+
start: "ddga-drawer--start",
|
|
2433
|
+
end: "ddga-drawer--end",
|
|
2434
|
+
top: "ddga-drawer--top",
|
|
2435
|
+
bottom: "ddga-drawer--bottom"
|
|
2436
|
+
},
|
|
2437
|
+
size: {
|
|
2438
|
+
sm: "ddga-drawer--sm",
|
|
2439
|
+
md: "ddga-drawer--md",
|
|
2440
|
+
lg: "ddga-drawer--lg",
|
|
2441
|
+
full: "ddga-drawer--full"
|
|
2442
|
+
}
|
|
2443
|
+
},
|
|
2444
|
+
defaultVariants: {
|
|
2445
|
+
side: "end",
|
|
2446
|
+
size: "md"
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
function Drawer(props) {
|
|
2450
|
+
return /* @__PURE__ */ jsx27(DialogPrimitive2.Root, { ...props });
|
|
2451
|
+
}
|
|
2452
|
+
function DrawerTrigger({ className, ...props }) {
|
|
2453
|
+
return /* @__PURE__ */ jsx27(DialogPrimitive2.Trigger, { "data-slot": "drawer-trigger", className, ...props });
|
|
2454
|
+
}
|
|
2455
|
+
function DrawerContent({
|
|
2456
|
+
side,
|
|
2457
|
+
size,
|
|
2458
|
+
showCloseButton = true,
|
|
2459
|
+
closeLabel = "Close",
|
|
2460
|
+
className,
|
|
2461
|
+
children,
|
|
2462
|
+
...props
|
|
2463
|
+
}) {
|
|
2464
|
+
const ctx = useContext6(DgaContext);
|
|
2465
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
2466
|
+
return /* @__PURE__ */ jsxs20(DialogPrimitive2.Portal, { container: portalContainer, children: [
|
|
2467
|
+
/* @__PURE__ */ jsx27(DialogPrimitive2.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
|
|
2468
|
+
/* @__PURE__ */ jsxs20(
|
|
2469
|
+
DialogPrimitive2.Content,
|
|
2470
|
+
{
|
|
2471
|
+
"data-slot": "drawer-content",
|
|
2472
|
+
className: cn(drawerVariants({ side, size }), className),
|
|
2473
|
+
...props,
|
|
2474
|
+
children: [
|
|
2475
|
+
children,
|
|
2476
|
+
showCloseButton ? /* @__PURE__ */ jsx27(
|
|
2477
|
+
DialogPrimitive2.Close,
|
|
2478
|
+
{
|
|
2479
|
+
className: "ddga-drawer__close",
|
|
2480
|
+
"aria-label": closeLabel,
|
|
2481
|
+
"data-slot": "drawer-close-x",
|
|
2482
|
+
children: /* @__PURE__ */ jsx27(Close, { "aria-hidden": "true" })
|
|
2483
|
+
}
|
|
2484
|
+
) : null
|
|
2485
|
+
]
|
|
2486
|
+
}
|
|
2487
|
+
)
|
|
2488
|
+
] });
|
|
2489
|
+
}
|
|
2490
|
+
function DrawerHeader({ asChild, className, ...props }) {
|
|
2491
|
+
const Comp = asChild ? SlotPrimitive8.Slot : "div";
|
|
2492
|
+
return /* @__PURE__ */ jsx27(Comp, { "data-slot": "drawer-header", className: cn("ddga-drawer__header", className), ...props });
|
|
2493
|
+
}
|
|
2494
|
+
function DrawerTitle({ asChild, className, ...props }) {
|
|
2495
|
+
return /* @__PURE__ */ jsx27(
|
|
2496
|
+
DialogPrimitive2.Title,
|
|
2497
|
+
{
|
|
2498
|
+
asChild,
|
|
2499
|
+
"data-slot": "drawer-title",
|
|
2500
|
+
className: cn("ddga-drawer__title", className),
|
|
2501
|
+
...props
|
|
2502
|
+
}
|
|
2503
|
+
);
|
|
2504
|
+
}
|
|
2505
|
+
function DrawerDescription({ asChild, className, ...props }) {
|
|
2506
|
+
return /* @__PURE__ */ jsx27(
|
|
2507
|
+
DialogPrimitive2.Description,
|
|
2508
|
+
{
|
|
2509
|
+
asChild,
|
|
2510
|
+
"data-slot": "drawer-description",
|
|
2511
|
+
className: cn("ddga-drawer__description", className),
|
|
2512
|
+
...props
|
|
2513
|
+
}
|
|
2514
|
+
);
|
|
2515
|
+
}
|
|
2516
|
+
function DrawerBody({ asChild, className, ...props }) {
|
|
2517
|
+
const Comp = asChild ? SlotPrimitive8.Slot : "div";
|
|
2518
|
+
return /* @__PURE__ */ jsx27(Comp, { "data-slot": "drawer-body", className: cn("ddga-drawer__body", className), ...props });
|
|
2519
|
+
}
|
|
2520
|
+
function DrawerFooter({ asChild, className, ...props }) {
|
|
2521
|
+
const Comp = asChild ? SlotPrimitive8.Slot : "div";
|
|
2522
|
+
return /* @__PURE__ */ jsx27(Comp, { "data-slot": "drawer-footer", className: cn("ddga-drawer__footer", className), ...props });
|
|
2523
|
+
}
|
|
2524
|
+
function DrawerClose({ className, ...props }) {
|
|
2525
|
+
return /* @__PURE__ */ jsx27(DialogPrimitive2.Close, { "data-slot": "drawer-close", className, ...props });
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
// src/components/Combobox/Combobox.tsx
|
|
2529
|
+
import {
|
|
2530
|
+
Children as Children2,
|
|
2531
|
+
createContext as createContext2,
|
|
2532
|
+
isValidElement as isValidElement2,
|
|
2533
|
+
useCallback,
|
|
2534
|
+
useContext as useContext7,
|
|
2535
|
+
useId as useId3,
|
|
2536
|
+
useMemo,
|
|
2537
|
+
useState as useState3
|
|
2538
|
+
} from "react";
|
|
2539
|
+
import { Command } from "cmdk";
|
|
2540
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
2541
|
+
import { cva as cva26 } from "class-variance-authority";
|
|
2542
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2543
|
+
var comboboxTriggerVariants = cva26("ddga-combobox-trigger", {
|
|
2544
|
+
variants: {
|
|
2545
|
+
size: {
|
|
2546
|
+
sm: "ddga-combobox-trigger--sm",
|
|
2547
|
+
md: "ddga-combobox-trigger--md"
|
|
2548
|
+
},
|
|
2549
|
+
error: {
|
|
2550
|
+
true: "ddga-combobox-trigger--error"
|
|
2551
|
+
}
|
|
2552
|
+
},
|
|
2553
|
+
defaultVariants: {
|
|
2554
|
+
size: "md"
|
|
2555
|
+
}
|
|
2556
|
+
});
|
|
2557
|
+
var comboboxVariants = comboboxTriggerVariants;
|
|
2558
|
+
var ComboboxContext = createContext2(null);
|
|
2559
|
+
function useComboboxContext(component) {
|
|
2560
|
+
const ctx = useContext7(ComboboxContext);
|
|
2561
|
+
if (!ctx) {
|
|
2562
|
+
throw new Error(`<${component}> must be rendered inside <Combobox>.`);
|
|
2563
|
+
}
|
|
2564
|
+
return ctx;
|
|
2565
|
+
}
|
|
2566
|
+
function Combobox({
|
|
2567
|
+
value: controlledValue,
|
|
2568
|
+
defaultValue,
|
|
2569
|
+
onValueChange,
|
|
2570
|
+
open: controlledOpen,
|
|
2571
|
+
defaultOpen,
|
|
2572
|
+
onOpenChange,
|
|
2573
|
+
label,
|
|
2574
|
+
helperText,
|
|
2575
|
+
errorMessage,
|
|
2576
|
+
error,
|
|
2577
|
+
required,
|
|
2578
|
+
disabled,
|
|
2579
|
+
size,
|
|
2580
|
+
placeholder,
|
|
2581
|
+
searchPlaceholder = "Search\u2026",
|
|
2582
|
+
emptyMessage = "No results.",
|
|
2583
|
+
getLabel,
|
|
2584
|
+
id: externalId,
|
|
2585
|
+
className,
|
|
2586
|
+
children,
|
|
2587
|
+
"aria-label": ariaLabel,
|
|
2588
|
+
"aria-labelledby": ariaLabelledBy
|
|
2589
|
+
}) {
|
|
2590
|
+
const [internalValue, setInternalValue] = useState3(defaultValue);
|
|
2591
|
+
const isControlled = controlledValue !== void 0;
|
|
2592
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
2593
|
+
const [internalOpen, setInternalOpen] = useState3(defaultOpen ?? false);
|
|
2594
|
+
const isOpenControlled = controlledOpen !== void 0;
|
|
2595
|
+
const open = isOpenControlled ? controlledOpen : internalOpen;
|
|
2596
|
+
const setOpen = useCallback(
|
|
2597
|
+
(next) => {
|
|
2598
|
+
if (!isOpenControlled) setInternalOpen(next);
|
|
2599
|
+
onOpenChange?.(next);
|
|
2600
|
+
},
|
|
2601
|
+
[isOpenControlled, onOpenChange]
|
|
2602
|
+
);
|
|
2603
|
+
const select = useCallback(
|
|
2604
|
+
(next) => {
|
|
2605
|
+
if (!isControlled) setInternalValue(next);
|
|
2606
|
+
onValueChange?.(next);
|
|
2607
|
+
setOpen(false);
|
|
2608
|
+
},
|
|
2609
|
+
[isControlled, onValueChange, setOpen]
|
|
2610
|
+
);
|
|
2611
|
+
const ctx = useMemo(() => ({ value, select }), [value, select]);
|
|
2612
|
+
const itemLabels = useMemo(() => {
|
|
2613
|
+
const map = /* @__PURE__ */ new Map();
|
|
2614
|
+
const visit = (nodes) => {
|
|
2615
|
+
Children2.forEach(nodes, (child) => {
|
|
2616
|
+
if (!isValidElement2(child)) return;
|
|
2617
|
+
const childProps = child.props;
|
|
2618
|
+
if (typeof childProps.value === "string") {
|
|
2619
|
+
map.set(childProps.value, childProps.children);
|
|
2620
|
+
} else if (childProps.children) {
|
|
2621
|
+
visit(childProps.children);
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
};
|
|
2625
|
+
visit(children);
|
|
2626
|
+
return map;
|
|
2627
|
+
}, [children]);
|
|
2628
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
2629
|
+
name: "Combobox",
|
|
2630
|
+
id: externalId,
|
|
2631
|
+
label,
|
|
2632
|
+
error,
|
|
2633
|
+
errorMessage,
|
|
2634
|
+
helperText,
|
|
2635
|
+
"aria-label": ariaLabel,
|
|
2636
|
+
"aria-labelledby": ariaLabelledBy
|
|
2637
|
+
});
|
|
2638
|
+
const providerCtx = useContext7(DgaContext);
|
|
2639
|
+
const portalContainer = providerCtx?.rootEl ?? void 0;
|
|
2640
|
+
const triggerLabel = useMemo(() => {
|
|
2641
|
+
if (value === void 0) return null;
|
|
2642
|
+
if (getLabel) return getLabel(value);
|
|
2643
|
+
return itemLabels.get(value) ?? null;
|
|
2644
|
+
}, [value, getLabel, itemLabels]);
|
|
2645
|
+
const searchId = useId3();
|
|
2646
|
+
return /* @__PURE__ */ jsx28(ComboboxContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs21("div", { "data-slot": "combobox-field", className: "ddga-field", children: [
|
|
2647
|
+
label && /* @__PURE__ */ jsxs21("label", { htmlFor: fieldId, className: "ddga-combobox__label", children: [
|
|
2648
|
+
label,
|
|
2649
|
+
required && /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: "ddga-combobox__required", children: "*" })
|
|
2650
|
+
] }),
|
|
2651
|
+
/* @__PURE__ */ jsxs21(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
|
|
2652
|
+
/* @__PURE__ */ jsx28(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs21(
|
|
2653
|
+
"button",
|
|
2654
|
+
{
|
|
2655
|
+
type: "button",
|
|
2656
|
+
...controlProps,
|
|
2657
|
+
"aria-required": required || void 0,
|
|
2658
|
+
disabled,
|
|
2659
|
+
"data-slot": "combobox-trigger",
|
|
2660
|
+
className: cn(comboboxTriggerVariants({ size, error: hasError }), className),
|
|
2661
|
+
children: [
|
|
2662
|
+
/* @__PURE__ */ jsx28("span", { className: "ddga-combobox__value", children: triggerLabel ?? /* @__PURE__ */ jsx28("span", { className: "ddga-combobox__placeholder", children: placeholder }) }),
|
|
2663
|
+
/* @__PURE__ */ jsx28(ChevronDown, { "aria-hidden": "true", className: "ddga-combobox__icon" })
|
|
2664
|
+
]
|
|
2665
|
+
}
|
|
2666
|
+
) }),
|
|
2667
|
+
/* @__PURE__ */ jsx28(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx28(
|
|
2668
|
+
PopoverPrimitive.Content,
|
|
2669
|
+
{
|
|
2670
|
+
"data-slot": "combobox-content",
|
|
2671
|
+
className: "ddga-combobox-content",
|
|
2672
|
+
sideOffset: 4,
|
|
2673
|
+
align: "start",
|
|
2674
|
+
"aria-label": ariaLabel ?? (typeof label === "string" ? label : "Options"),
|
|
2675
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2676
|
+
style: { inlineSize: "var(--radix-popover-trigger-width)" },
|
|
2677
|
+
onOpenAutoFocus: (event) => {
|
|
2678
|
+
event.preventDefault();
|
|
2679
|
+
},
|
|
2680
|
+
children: /* @__PURE__ */ jsxs21(
|
|
2681
|
+
Command,
|
|
2682
|
+
{
|
|
2683
|
+
id: searchId,
|
|
2684
|
+
"data-slot": "combobox-command",
|
|
2685
|
+
className: "ddga-combobox-command",
|
|
2686
|
+
children: [
|
|
2687
|
+
/* @__PURE__ */ jsx28(
|
|
2688
|
+
Command.Input,
|
|
2689
|
+
{
|
|
2690
|
+
autoFocus: true,
|
|
2691
|
+
placeholder: searchPlaceholder,
|
|
2692
|
+
"data-slot": "combobox-input",
|
|
2693
|
+
className: "ddga-combobox-input"
|
|
2694
|
+
}
|
|
2695
|
+
),
|
|
2696
|
+
/* @__PURE__ */ jsxs21(Command.List, { "data-slot": "combobox-list", className: "ddga-combobox-list", children: [
|
|
2697
|
+
/* @__PURE__ */ jsx28(Command.Empty, { "data-slot": "combobox-empty", className: "ddga-combobox-empty", children: emptyMessage }),
|
|
2698
|
+
children
|
|
2699
|
+
] })
|
|
2700
|
+
]
|
|
2701
|
+
}
|
|
2702
|
+
)
|
|
2703
|
+
}
|
|
2704
|
+
) })
|
|
2705
|
+
] }),
|
|
2706
|
+
hasErrorMessage && /* @__PURE__ */ jsx28(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
2707
|
+
hasHelper && /* @__PURE__ */ jsx28(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
2708
|
+
] }) });
|
|
2709
|
+
}
|
|
2710
|
+
function ComboboxItem({
|
|
2711
|
+
value,
|
|
2712
|
+
keywords,
|
|
2713
|
+
disabled,
|
|
2714
|
+
onSelect,
|
|
2715
|
+
className,
|
|
2716
|
+
children,
|
|
2717
|
+
...props
|
|
2718
|
+
}) {
|
|
2719
|
+
const { value: selectedValue, select } = useComboboxContext("ComboboxItem");
|
|
2720
|
+
const isSelected = selectedValue === value;
|
|
2721
|
+
return /* @__PURE__ */ jsxs21(
|
|
2722
|
+
Command.Item,
|
|
2723
|
+
{
|
|
2724
|
+
value,
|
|
2725
|
+
keywords,
|
|
2726
|
+
disabled,
|
|
2727
|
+
onSelect: (v) => {
|
|
2728
|
+
onSelect?.(v);
|
|
2729
|
+
select(v);
|
|
2730
|
+
},
|
|
2731
|
+
"data-slot": "combobox-item",
|
|
2732
|
+
"data-active": isSelected ? "" : void 0,
|
|
2733
|
+
className: cn("ddga-combobox-item", className),
|
|
2734
|
+
...props,
|
|
2735
|
+
children: [
|
|
2736
|
+
/* @__PURE__ */ jsx28("span", { className: "ddga-combobox-item__check", "aria-hidden": "true", children: isSelected ? /* @__PURE__ */ jsx28(Check, {}) : null }),
|
|
2737
|
+
/* @__PURE__ */ jsx28("span", { className: "ddga-combobox-item__label", children })
|
|
2738
|
+
]
|
|
2739
|
+
}
|
|
2740
|
+
);
|
|
2741
|
+
}
|
|
2742
|
+
function ComboboxGroup({ className, heading, ...props }) {
|
|
2743
|
+
return /* @__PURE__ */ jsx28(
|
|
2744
|
+
Command.Group,
|
|
2745
|
+
{
|
|
2746
|
+
heading,
|
|
2747
|
+
"data-slot": "combobox-group",
|
|
2748
|
+
className: cn("ddga-combobox-group", className),
|
|
2749
|
+
...props
|
|
2750
|
+
}
|
|
2751
|
+
);
|
|
2752
|
+
}
|
|
2753
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
2754
|
+
return /* @__PURE__ */ jsx28(
|
|
2755
|
+
Command.Separator,
|
|
2756
|
+
{
|
|
2757
|
+
"data-slot": "combobox-separator",
|
|
2758
|
+
className: cn("ddga-combobox-separator", className),
|
|
2759
|
+
...props
|
|
2760
|
+
}
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
|
|
704
2764
|
// src/providers/DgaProvider.tsx
|
|
705
|
-
import { useState, useMemo, useContext as
|
|
706
|
-
import { Direction as DirectionPrimitive, Tooltip as
|
|
2765
|
+
import { useState as useState4, useMemo as useMemo2, useContext as useContext8 } from "react";
|
|
2766
|
+
import { Direction as DirectionPrimitive, Tooltip as TooltipPrimitive2 } from "radix-ui";
|
|
707
2767
|
import { buildTheme } from "@dev-dga/tokens";
|
|
708
|
-
import { jsx as
|
|
2768
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
709
2769
|
function DgaProvider({
|
|
710
2770
|
dir = "ltr",
|
|
711
2771
|
locale,
|
|
@@ -716,17 +2776,17 @@ function DgaProvider({
|
|
|
716
2776
|
style: consumerStyle,
|
|
717
2777
|
children
|
|
718
2778
|
}) {
|
|
719
|
-
const parentCtx =
|
|
2779
|
+
const parentCtx = useContext8(DgaContext);
|
|
720
2780
|
const isNested = parentCtx !== null;
|
|
721
|
-
const [rootEl, setRootEl] =
|
|
2781
|
+
const [rootEl, setRootEl] = useState4(null);
|
|
722
2782
|
const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
|
|
723
|
-
const ctxValue =
|
|
2783
|
+
const ctxValue = useMemo2(
|
|
724
2784
|
() => ({ dir, locale: resolvedLocale, mode, rootEl }),
|
|
725
2785
|
[dir, resolvedLocale, mode, rootEl]
|
|
726
2786
|
);
|
|
727
|
-
const themeVars =
|
|
728
|
-
const inner = /* @__PURE__ */
|
|
729
|
-
return /* @__PURE__ */
|
|
2787
|
+
const themeVars = useMemo2(() => theme ? buildTheme(theme) : null, [theme]);
|
|
2788
|
+
const inner = /* @__PURE__ */ jsx29(DirectionPrimitive.Provider, { dir, children });
|
|
2789
|
+
return /* @__PURE__ */ jsx29(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx29(
|
|
730
2790
|
Component,
|
|
731
2791
|
{
|
|
732
2792
|
ref: setRootEl,
|
|
@@ -736,7 +2796,7 @@ function DgaProvider({
|
|
|
736
2796
|
"data-theme": mode,
|
|
737
2797
|
className,
|
|
738
2798
|
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
739
|
-
children: isNested ? inner : /* @__PURE__ */
|
|
2799
|
+
children: isNested ? inner : /* @__PURE__ */ jsx29(TooltipPrimitive2.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
740
2800
|
}
|
|
741
2801
|
) });
|
|
742
2802
|
}
|
|
@@ -746,26 +2806,140 @@ function useDir() {
|
|
|
746
2806
|
return useDga().dir;
|
|
747
2807
|
}
|
|
748
2808
|
export {
|
|
2809
|
+
Accordion,
|
|
2810
|
+
AccordionContent,
|
|
2811
|
+
AccordionItem,
|
|
2812
|
+
AccordionTrigger,
|
|
2813
|
+
Alert,
|
|
2814
|
+
AlertDescription,
|
|
2815
|
+
AlertTitle,
|
|
2816
|
+
Avatar,
|
|
2817
|
+
AvatarFallback,
|
|
2818
|
+
AvatarGroup,
|
|
2819
|
+
AvatarImage,
|
|
2820
|
+
Badge,
|
|
2821
|
+
Breadcrumb,
|
|
2822
|
+
BreadcrumbEllipsis,
|
|
2823
|
+
BreadcrumbItem,
|
|
2824
|
+
BreadcrumbLink,
|
|
2825
|
+
BreadcrumbList,
|
|
2826
|
+
BreadcrumbPage,
|
|
2827
|
+
BreadcrumbSeparator,
|
|
749
2828
|
Button,
|
|
2829
|
+
Card,
|
|
2830
|
+
CardContent,
|
|
2831
|
+
CardDescription,
|
|
2832
|
+
CardFooter,
|
|
2833
|
+
CardHeader,
|
|
2834
|
+
CardImage,
|
|
2835
|
+
CardTitle,
|
|
750
2836
|
Checkbox,
|
|
2837
|
+
CircularProgress,
|
|
2838
|
+
Combobox,
|
|
2839
|
+
ComboboxGroup,
|
|
2840
|
+
ComboboxItem,
|
|
2841
|
+
ComboboxSeparator,
|
|
751
2842
|
DgaProvider,
|
|
2843
|
+
Divider,
|
|
2844
|
+
Drawer,
|
|
2845
|
+
DrawerBody,
|
|
2846
|
+
DrawerClose,
|
|
2847
|
+
DrawerContent,
|
|
2848
|
+
DrawerDescription,
|
|
2849
|
+
DrawerFooter,
|
|
2850
|
+
DrawerHeader,
|
|
2851
|
+
DrawerTitle,
|
|
2852
|
+
DrawerTrigger,
|
|
2853
|
+
DropdownMenu,
|
|
2854
|
+
DropdownMenuCheckboxItem,
|
|
2855
|
+
DropdownMenuContent,
|
|
2856
|
+
DropdownMenuGroup,
|
|
2857
|
+
DropdownMenuItem,
|
|
2858
|
+
DropdownMenuLabel,
|
|
2859
|
+
DropdownMenuRadioGroup,
|
|
2860
|
+
DropdownMenuRadioItem,
|
|
2861
|
+
DropdownMenuSeparator,
|
|
2862
|
+
DropdownMenuSub,
|
|
2863
|
+
DropdownMenuSubContent,
|
|
2864
|
+
DropdownMenuSubTrigger,
|
|
2865
|
+
DropdownMenuTrigger,
|
|
752
2866
|
FieldMessage,
|
|
753
2867
|
Input,
|
|
2868
|
+
Modal,
|
|
2869
|
+
ModalClose,
|
|
2870
|
+
ModalContent,
|
|
2871
|
+
ModalDescription,
|
|
2872
|
+
ModalFooter,
|
|
2873
|
+
ModalHeader,
|
|
2874
|
+
ModalTitle,
|
|
2875
|
+
ModalTrigger,
|
|
2876
|
+
Pagination,
|
|
2877
|
+
PaginationContent,
|
|
2878
|
+
PaginationEllipsis,
|
|
2879
|
+
PaginationItem,
|
|
2880
|
+
PaginationLink,
|
|
2881
|
+
PaginationNext,
|
|
2882
|
+
PaginationPrevious,
|
|
2883
|
+
Progress,
|
|
754
2884
|
Radio,
|
|
755
2885
|
RadioGroup,
|
|
756
2886
|
Select,
|
|
757
2887
|
SelectItem,
|
|
2888
|
+
Skeleton,
|
|
2889
|
+
Spinner,
|
|
2890
|
+
Step,
|
|
2891
|
+
StepDescription,
|
|
2892
|
+
StepIndicator,
|
|
2893
|
+
StepTitle,
|
|
2894
|
+
Steps,
|
|
758
2895
|
Switch,
|
|
2896
|
+
Tabs,
|
|
2897
|
+
TabsContent,
|
|
2898
|
+
TabsList,
|
|
2899
|
+
TabsTrigger,
|
|
759
2900
|
Textarea,
|
|
2901
|
+
Toaster,
|
|
2902
|
+
Tooltip,
|
|
2903
|
+
TooltipContent,
|
|
2904
|
+
TooltipTrigger,
|
|
2905
|
+
accordionVariants,
|
|
2906
|
+
alertVariants,
|
|
2907
|
+
avatarVariants,
|
|
2908
|
+
badgeVariants,
|
|
2909
|
+
breadcrumbVariants,
|
|
760
2910
|
buttonVariants,
|
|
2911
|
+
cardVariants,
|
|
761
2912
|
checkboxVariants,
|
|
2913
|
+
circularProgressVariants,
|
|
762
2914
|
cn,
|
|
2915
|
+
comboboxTriggerVariants,
|
|
2916
|
+
comboboxVariants,
|
|
2917
|
+
createToast,
|
|
2918
|
+
createToastStore,
|
|
2919
|
+
dividerVariants,
|
|
2920
|
+
drawerVariants,
|
|
2921
|
+
dropdownMenuVariants,
|
|
763
2922
|
inputVariants,
|
|
2923
|
+
modalContentVariants,
|
|
2924
|
+
paginationLinkVariants,
|
|
2925
|
+
paginationVariants,
|
|
2926
|
+
progressVariants,
|
|
764
2927
|
radioGroupVariants,
|
|
765
2928
|
radioVariants,
|
|
766
2929
|
selectTriggerVariants,
|
|
2930
|
+
skeletonVariants,
|
|
2931
|
+
spinnerVariants,
|
|
2932
|
+
stepVariants,
|
|
2933
|
+
stepsVariants,
|
|
767
2934
|
switchVariants,
|
|
2935
|
+
tabsListVariants,
|
|
2936
|
+
tabsVariants,
|
|
768
2937
|
textareaVariants,
|
|
2938
|
+
toast,
|
|
2939
|
+
toastStore,
|
|
2940
|
+
toastVariants,
|
|
2941
|
+
toastViewportVariants,
|
|
2942
|
+
tooltipContentVariants,
|
|
769
2943
|
useDga,
|
|
770
2944
|
useDir,
|
|
771
2945
|
useFieldA11y
|