@dev-dga/react 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +618 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +600 -41
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -20,26 +20,50 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
Alert: () => Alert,
|
|
24
|
+
AlertDescription: () => AlertDescription,
|
|
25
|
+
AlertTitle: () => AlertTitle,
|
|
23
26
|
Button: () => Button,
|
|
24
27
|
Checkbox: () => Checkbox,
|
|
25
28
|
DgaProvider: () => DgaProvider,
|
|
26
29
|
FieldMessage: () => FieldMessage,
|
|
27
30
|
Input: () => Input,
|
|
31
|
+
Modal: () => Modal,
|
|
32
|
+
ModalClose: () => ModalClose,
|
|
33
|
+
ModalContent: () => ModalContent,
|
|
34
|
+
ModalDescription: () => ModalDescription,
|
|
35
|
+
ModalFooter: () => ModalFooter,
|
|
36
|
+
ModalHeader: () => ModalHeader,
|
|
37
|
+
ModalTitle: () => ModalTitle,
|
|
38
|
+
ModalTrigger: () => ModalTrigger,
|
|
28
39
|
Radio: () => Radio,
|
|
29
40
|
RadioGroup: () => RadioGroup,
|
|
30
41
|
Select: () => Select,
|
|
31
42
|
SelectItem: () => SelectItem,
|
|
32
43
|
Switch: () => Switch,
|
|
33
44
|
Textarea: () => Textarea,
|
|
45
|
+
Toaster: () => Toaster,
|
|
46
|
+
Tooltip: () => Tooltip,
|
|
47
|
+
TooltipContent: () => TooltipContent,
|
|
48
|
+
TooltipTrigger: () => TooltipTrigger,
|
|
49
|
+
alertVariants: () => alertVariants,
|
|
34
50
|
buttonVariants: () => buttonVariants,
|
|
35
51
|
checkboxVariants: () => checkboxVariants,
|
|
36
52
|
cn: () => cn,
|
|
53
|
+
createToast: () => createToast,
|
|
54
|
+
createToastStore: () => createToastStore,
|
|
37
55
|
inputVariants: () => inputVariants,
|
|
56
|
+
modalContentVariants: () => modalContentVariants,
|
|
38
57
|
radioGroupVariants: () => radioGroupVariants,
|
|
39
58
|
radioVariants: () => radioVariants,
|
|
40
59
|
selectTriggerVariants: () => selectTriggerVariants,
|
|
41
60
|
switchVariants: () => switchVariants,
|
|
42
61
|
textareaVariants: () => textareaVariants,
|
|
62
|
+
toast: () => toast,
|
|
63
|
+
toastStore: () => toastStore,
|
|
64
|
+
toastVariants: () => toastVariants,
|
|
65
|
+
toastViewportVariants: () => toastViewportVariants,
|
|
66
|
+
tooltipContentVariants: () => tooltipContentVariants,
|
|
43
67
|
useDga: () => useDga,
|
|
44
68
|
useDir: () => useDir,
|
|
45
69
|
useFieldA11y: () => useFieldA11y
|
|
@@ -48,6 +72,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
48
72
|
|
|
49
73
|
// src/components/Button/Button.tsx
|
|
50
74
|
var import_react = require("react");
|
|
75
|
+
var import_radix_ui = require("radix-ui");
|
|
51
76
|
var import_class_variance_authority = require("class-variance-authority");
|
|
52
77
|
|
|
53
78
|
// src/utils/cn.ts
|
|
@@ -113,6 +138,93 @@ function Minus(props) {
|
|
|
113
138
|
}
|
|
114
139
|
);
|
|
115
140
|
}
|
|
141
|
+
function Info(props) {
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
143
|
+
"svg",
|
|
144
|
+
{
|
|
145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
+
width: "1em",
|
|
147
|
+
height: "1em",
|
|
148
|
+
viewBox: "0 0 24 24",
|
|
149
|
+
fill: "none",
|
|
150
|
+
stroke: "currentColor",
|
|
151
|
+
strokeWidth: "2",
|
|
152
|
+
strokeLinecap: "round",
|
|
153
|
+
strokeLinejoin: "round",
|
|
154
|
+
...props,
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
157
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 16v-4" }),
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 8h.01" })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
function AlertTriangle(props) {
|
|
164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
165
|
+
"svg",
|
|
166
|
+
{
|
|
167
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
168
|
+
width: "1em",
|
|
169
|
+
height: "1em",
|
|
170
|
+
viewBox: "0 0 24 24",
|
|
171
|
+
fill: "none",
|
|
172
|
+
stroke: "currentColor",
|
|
173
|
+
strokeWidth: "2",
|
|
174
|
+
strokeLinecap: "round",
|
|
175
|
+
strokeLinejoin: "round",
|
|
176
|
+
...props,
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 9v4" }),
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 17h.01" })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function AlertCircle(props) {
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
187
|
+
"svg",
|
|
188
|
+
{
|
|
189
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
190
|
+
width: "1em",
|
|
191
|
+
height: "1em",
|
|
192
|
+
viewBox: "0 0 24 24",
|
|
193
|
+
fill: "none",
|
|
194
|
+
stroke: "currentColor",
|
|
195
|
+
strokeWidth: "2",
|
|
196
|
+
strokeLinecap: "round",
|
|
197
|
+
strokeLinejoin: "round",
|
|
198
|
+
...props,
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
function Close(props) {
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
209
|
+
"svg",
|
|
210
|
+
{
|
|
211
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
+
width: "1em",
|
|
213
|
+
height: "1em",
|
|
214
|
+
viewBox: "0 0 24 24",
|
|
215
|
+
fill: "none",
|
|
216
|
+
stroke: "currentColor",
|
|
217
|
+
strokeWidth: "2",
|
|
218
|
+
strokeLinecap: "round",
|
|
219
|
+
strokeLinejoin: "round",
|
|
220
|
+
...props,
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }),
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
}
|
|
116
228
|
function ChevronDown(props) {
|
|
117
229
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
230
|
"svg",
|
|
@@ -169,6 +281,7 @@ function Button({
|
|
|
169
281
|
startIcon,
|
|
170
282
|
endIcon,
|
|
171
283
|
iconFlip,
|
|
284
|
+
asChild,
|
|
172
285
|
className,
|
|
173
286
|
children,
|
|
174
287
|
type = "button",
|
|
@@ -182,11 +295,12 @@ function Button({
|
|
|
182
295
|
}
|
|
183
296
|
}
|
|
184
297
|
const isDisabled = disabled || loading;
|
|
298
|
+
const Comp = asChild ? import_radix_ui.Slot.Slot : "button";
|
|
185
299
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
186
|
-
|
|
300
|
+
Comp,
|
|
187
301
|
{
|
|
188
|
-
type,
|
|
189
|
-
|
|
302
|
+
...asChild ? {} : { type, disabled: isDisabled },
|
|
303
|
+
...asChild && isDisabled ? { tabIndex: -1 } : {},
|
|
190
304
|
"aria-disabled": isDisabled || void 0,
|
|
191
305
|
"aria-busy": loading || void 0,
|
|
192
306
|
"data-slot": "button",
|
|
@@ -199,7 +313,12 @@ function Button({
|
|
|
199
313
|
children: [
|
|
200
314
|
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spinner, { "aria-hidden": "true" }),
|
|
201
315
|
!loading && startIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: cn("ddga-button__icon", iconFlip && "ddga-icon-flip"), "aria-hidden": "true", children: startIcon }),
|
|
202
|
-
|
|
316
|
+
asChild ? (
|
|
317
|
+
// children IS the consumer's single element (e.g. <Link>). Slottable
|
|
318
|
+
// marks where THAT element's original children should land , without
|
|
319
|
+
// it the icons would replace the link text entirely.
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_radix_ui.Slot.Slottable, { children })
|
|
321
|
+
) : children != null && children !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ddga-button__text", children }),
|
|
203
322
|
!loading && endIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: cn("ddga-button__icon", iconFlip && "ddga-icon-flip"), "aria-hidden": "true", children: endIcon })
|
|
204
323
|
]
|
|
205
324
|
}
|
|
@@ -414,7 +533,7 @@ function Textarea({
|
|
|
414
533
|
}
|
|
415
534
|
|
|
416
535
|
// src/components/Checkbox/Checkbox.tsx
|
|
417
|
-
var
|
|
536
|
+
var import_radix_ui2 = require("radix-ui");
|
|
418
537
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
419
538
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
420
539
|
var checkboxVariants = (0, import_class_variance_authority4.cva)("ddga-checkbox", {
|
|
@@ -455,7 +574,7 @@ function Checkbox({
|
|
|
455
574
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-slot": "checkbox-field", className: "ddga-field", children: [
|
|
456
575
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ddga-checkbox-row", children: [
|
|
457
576
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
458
|
-
|
|
577
|
+
import_radix_ui2.Checkbox.Root,
|
|
459
578
|
{
|
|
460
579
|
...props,
|
|
461
580
|
...controlProps,
|
|
@@ -463,7 +582,7 @@ function Checkbox({
|
|
|
463
582
|
required,
|
|
464
583
|
className: cn(checkboxVariants({ size, error: hasError }), className),
|
|
465
584
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
466
|
-
|
|
585
|
+
import_radix_ui2.Checkbox.Indicator,
|
|
467
586
|
{
|
|
468
587
|
"data-slot": "checkbox-indicator",
|
|
469
588
|
className: "ddga-checkbox__indicator",
|
|
@@ -487,7 +606,7 @@ function Checkbox({
|
|
|
487
606
|
|
|
488
607
|
// src/components/Radio/Radio.tsx
|
|
489
608
|
var import_react3 = require("react");
|
|
490
|
-
var
|
|
609
|
+
var import_radix_ui3 = require("radix-ui");
|
|
491
610
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
492
611
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
493
612
|
var radioGroupVariants = (0, import_class_variance_authority5.cva)("ddga-radio-group", {
|
|
@@ -540,7 +659,7 @@ function RadioGroup({
|
|
|
540
659
|
required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", className: "ddga-radio-group__required", children: "*" })
|
|
541
660
|
] }),
|
|
542
661
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
543
|
-
|
|
662
|
+
import_radix_ui3.RadioGroup.Root,
|
|
544
663
|
{
|
|
545
664
|
...props,
|
|
546
665
|
"aria-invalid": controlProps["aria-invalid"],
|
|
@@ -562,14 +681,14 @@ function Radio({ id: externalId, label, className, ...props }) {
|
|
|
562
681
|
const itemId = externalId ?? generatedId;
|
|
563
682
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ddga-radio-row", children: [
|
|
564
683
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
565
|
-
|
|
684
|
+
import_radix_ui3.RadioGroup.Item,
|
|
566
685
|
{
|
|
567
686
|
...props,
|
|
568
687
|
id: itemId,
|
|
569
688
|
"data-slot": "radio",
|
|
570
689
|
className: cn(radioVariants(), className),
|
|
571
690
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
572
|
-
|
|
691
|
+
import_radix_ui3.RadioGroup.Indicator,
|
|
573
692
|
{
|
|
574
693
|
"data-slot": "radio-indicator",
|
|
575
694
|
className: "ddga-radio__indicator",
|
|
@@ -583,7 +702,7 @@ function Radio({ id: externalId, label, className, ...props }) {
|
|
|
583
702
|
}
|
|
584
703
|
|
|
585
704
|
// src/components/Switch/Switch.tsx
|
|
586
|
-
var
|
|
705
|
+
var import_radix_ui4 = require("radix-ui");
|
|
587
706
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
588
707
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
589
708
|
var switchVariants = (0, import_class_variance_authority6.cva)("ddga-switch", {
|
|
@@ -624,14 +743,14 @@ function Switch({
|
|
|
624
743
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { "data-slot": "switch-field", className: "ddga-field", children: [
|
|
625
744
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "ddga-switch-row", children: [
|
|
626
745
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
627
|
-
|
|
746
|
+
import_radix_ui4.Switch.Root,
|
|
628
747
|
{
|
|
629
748
|
...props,
|
|
630
749
|
...controlProps,
|
|
631
750
|
"data-slot": "switch",
|
|
632
751
|
required,
|
|
633
752
|
className: cn(switchVariants({ size, error: hasError }), className),
|
|
634
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radix_ui4.Switch.Thumb, { "data-slot": "switch-thumb", className: "ddga-switch__thumb" })
|
|
635
754
|
}
|
|
636
755
|
),
|
|
637
756
|
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: fieldId, className: "ddga-switch__label", children: [
|
|
@@ -646,7 +765,7 @@ function Switch({
|
|
|
646
765
|
|
|
647
766
|
// src/components/Select/Select.tsx
|
|
648
767
|
var import_react5 = require("react");
|
|
649
|
-
var
|
|
768
|
+
var import_radix_ui5 = require("radix-ui");
|
|
650
769
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
651
770
|
|
|
652
771
|
// src/providers/DgaContext.ts
|
|
@@ -706,27 +825,27 @@ function Select({
|
|
|
706
825
|
label,
|
|
707
826
|
required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", className: "ddga-select__required", children: "*" })
|
|
708
827
|
] }),
|
|
709
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_radix_ui5.Select.Root, { required, ...rootProps, children: [
|
|
710
829
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
711
|
-
|
|
830
|
+
import_radix_ui5.Select.Trigger,
|
|
712
831
|
{
|
|
713
832
|
...controlProps,
|
|
714
833
|
"data-slot": "select-trigger",
|
|
715
834
|
className: cn(selectTriggerVariants({ size, error: hasError }), className),
|
|
716
835
|
children: [
|
|
717
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
718
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Select.Value, { placeholder }),
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Select.Icon, { asChild: true, className: "ddga-select__icon", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronDown, { "aria-hidden": "true" }) })
|
|
719
838
|
]
|
|
720
839
|
}
|
|
721
840
|
),
|
|
722
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
723
|
-
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Select.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
842
|
+
import_radix_ui5.Select.Content,
|
|
724
843
|
{
|
|
725
844
|
"data-slot": "select-content",
|
|
726
845
|
className: "ddga-select-content",
|
|
727
846
|
position: "popper",
|
|
728
847
|
sideOffset: 4,
|
|
729
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Select.Viewport, { className: "ddga-select-viewport", children })
|
|
730
849
|
}
|
|
731
850
|
) })
|
|
732
851
|
] }),
|
|
@@ -736,24 +855,464 @@ function Select({
|
|
|
736
855
|
}
|
|
737
856
|
function SelectItem({ className, children, ...props }) {
|
|
738
857
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
739
|
-
|
|
858
|
+
import_radix_ui5.Select.Item,
|
|
740
859
|
{
|
|
741
860
|
...props,
|
|
742
861
|
"data-slot": "select-item",
|
|
743
862
|
className: cn("ddga-select-item", className),
|
|
744
863
|
children: [
|
|
745
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
746
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Select.ItemText, { children }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui5.Select.ItemIndicator, { className: "ddga-select-item__indicator", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Check, { className: "ddga-select-item__check", "aria-hidden": "true" }) })
|
|
747
866
|
]
|
|
748
867
|
}
|
|
749
868
|
);
|
|
750
869
|
}
|
|
751
870
|
|
|
752
|
-
// src/
|
|
871
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
753
872
|
var import_react6 = require("react");
|
|
754
|
-
var
|
|
755
|
-
var
|
|
873
|
+
var import_radix_ui6 = require("radix-ui");
|
|
874
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
756
875
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
876
|
+
var tooltipContentVariants = (0, import_class_variance_authority8.cva)("ddga-tooltip", {
|
|
877
|
+
variants: {
|
|
878
|
+
size: {
|
|
879
|
+
sm: "ddga-tooltip--sm",
|
|
880
|
+
md: "ddga-tooltip--md"
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
defaultVariants: {
|
|
884
|
+
size: "md"
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
function Tooltip(props) {
|
|
888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_radix_ui6.Tooltip.Root, { ...props });
|
|
889
|
+
}
|
|
890
|
+
function TooltipTrigger({ className, ...props }) {
|
|
891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_radix_ui6.Tooltip.Trigger, { "data-slot": "tooltip-trigger", className, ...props });
|
|
892
|
+
}
|
|
893
|
+
function TooltipContent({
|
|
894
|
+
size,
|
|
895
|
+
arrow = true,
|
|
896
|
+
sideOffset = 6,
|
|
897
|
+
className,
|
|
898
|
+
children,
|
|
899
|
+
...props
|
|
900
|
+
}) {
|
|
901
|
+
const ctx = (0, import_react6.useContext)(DgaContext);
|
|
902
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_radix_ui6.Tooltip.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
904
|
+
import_radix_ui6.Tooltip.Content,
|
|
905
|
+
{
|
|
906
|
+
"data-slot": "tooltip-content",
|
|
907
|
+
sideOffset,
|
|
908
|
+
className: cn(tooltipContentVariants({ size }), className),
|
|
909
|
+
...props,
|
|
910
|
+
children: [
|
|
911
|
+
children,
|
|
912
|
+
arrow ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_radix_ui6.Tooltip.Arrow, { className: "ddga-tooltip__arrow" }) : null
|
|
913
|
+
]
|
|
914
|
+
}
|
|
915
|
+
) });
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// src/components/Alert/Alert.tsx
|
|
919
|
+
var import_react7 = require("react");
|
|
920
|
+
var import_radix_ui7 = require("radix-ui");
|
|
921
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
922
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
923
|
+
var alertVariants = (0, import_class_variance_authority9.cva)("ddga-alert", {
|
|
924
|
+
variants: {
|
|
925
|
+
variant: {
|
|
926
|
+
info: "ddga-alert--info",
|
|
927
|
+
success: "ddga-alert--success",
|
|
928
|
+
warning: "ddga-alert--warning",
|
|
929
|
+
destructive: "ddga-alert--destructive"
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
defaultVariants: {
|
|
933
|
+
variant: "info"
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
var DEFAULT_ICONS = {
|
|
937
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Info, { "aria-hidden": "true" }),
|
|
938
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Check, { "aria-hidden": "true" }),
|
|
939
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlertTriangle, { "aria-hidden": "true" }),
|
|
940
|
+
destructive: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlertCircle, { "aria-hidden": "true" })
|
|
941
|
+
};
|
|
942
|
+
function Alert({
|
|
943
|
+
variant,
|
|
944
|
+
asChild,
|
|
945
|
+
icon,
|
|
946
|
+
dismissible,
|
|
947
|
+
open: controlledOpen,
|
|
948
|
+
onDismiss,
|
|
949
|
+
live,
|
|
950
|
+
closeLabel = "Dismiss",
|
|
951
|
+
className,
|
|
952
|
+
children,
|
|
953
|
+
...props
|
|
954
|
+
}) {
|
|
955
|
+
const [internalOpen, setInternalOpen] = (0, import_react7.useState)(true);
|
|
956
|
+
const isControlled = controlledOpen !== void 0;
|
|
957
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
958
|
+
if (!open) return null;
|
|
959
|
+
const Comp = asChild ? import_radix_ui7.Slot.Slot : "div";
|
|
960
|
+
const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS[variant ?? "info"];
|
|
961
|
+
const liveProps = live === "assertive" ? { role: "alert", "aria-live": "assertive" } : live === "polite" ? { role: "status", "aria-live": "polite" } : {};
|
|
962
|
+
function handleDismiss() {
|
|
963
|
+
if (!isControlled) setInternalOpen(false);
|
|
964
|
+
onDismiss?.();
|
|
965
|
+
}
|
|
966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
967
|
+
Comp,
|
|
968
|
+
{
|
|
969
|
+
"data-slot": "alert",
|
|
970
|
+
"data-variant": variant ?? "info",
|
|
971
|
+
className: cn(alertVariants({ variant }), className),
|
|
972
|
+
...liveProps,
|
|
973
|
+
...props,
|
|
974
|
+
children: [
|
|
975
|
+
resolvedIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "ddga-alert__icon", children: resolvedIcon }) : null,
|
|
976
|
+
asChild ? (
|
|
977
|
+
// Slot mode: the consumer's element receives the children body.
|
|
978
|
+
// Title/description are nested by the consumer.
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_radix_ui7.Slot.Slottable, { children })
|
|
980
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "ddga-alert__body", children }),
|
|
981
|
+
dismissible ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
982
|
+
"button",
|
|
983
|
+
{
|
|
984
|
+
type: "button",
|
|
985
|
+
className: "ddga-alert__close",
|
|
986
|
+
"aria-label": closeLabel,
|
|
987
|
+
onClick: handleDismiss,
|
|
988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Close, { "aria-hidden": "true" })
|
|
989
|
+
}
|
|
990
|
+
) : null
|
|
991
|
+
]
|
|
992
|
+
}
|
|
993
|
+
);
|
|
994
|
+
}
|
|
995
|
+
function AlertTitle({ asChild, className, ...props }) {
|
|
996
|
+
const Comp = asChild ? import_radix_ui7.Slot.Slot : "h5";
|
|
997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Comp, { "data-slot": "alert-title", className: cn("ddga-alert__title", className), ...props });
|
|
998
|
+
}
|
|
999
|
+
function AlertDescription({ asChild, className, ...props }) {
|
|
1000
|
+
const Comp = asChild ? import_radix_ui7.Slot.Slot : "p";
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1002
|
+
Comp,
|
|
1003
|
+
{
|
|
1004
|
+
"data-slot": "alert-description",
|
|
1005
|
+
className: cn("ddga-alert__description", className),
|
|
1006
|
+
...props
|
|
1007
|
+
}
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// src/components/Modal/Modal.tsx
|
|
1012
|
+
var import_react8 = require("react");
|
|
1013
|
+
var import_radix_ui8 = require("radix-ui");
|
|
1014
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
1015
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1016
|
+
var modalContentVariants = (0, import_class_variance_authority10.cva)("ddga-modal", {
|
|
1017
|
+
variants: {
|
|
1018
|
+
size: {
|
|
1019
|
+
sm: "ddga-modal--sm",
|
|
1020
|
+
md: "ddga-modal--md",
|
|
1021
|
+
lg: "ddga-modal--lg",
|
|
1022
|
+
xl: "ddga-modal--xl",
|
|
1023
|
+
full: "ddga-modal--full"
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
defaultVariants: {
|
|
1027
|
+
size: "md"
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
function Modal(props) {
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_radix_ui8.Dialog.Root, { ...props });
|
|
1032
|
+
}
|
|
1033
|
+
function ModalTrigger({ className, ...props }) {
|
|
1034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_radix_ui8.Dialog.Trigger, { "data-slot": "modal-trigger", className, ...props });
|
|
1035
|
+
}
|
|
1036
|
+
function ModalContent({
|
|
1037
|
+
size,
|
|
1038
|
+
showCloseButton = true,
|
|
1039
|
+
closeLabel = "Close",
|
|
1040
|
+
className,
|
|
1041
|
+
children,
|
|
1042
|
+
...props
|
|
1043
|
+
}) {
|
|
1044
|
+
const ctx = (0, import_react8.useContext)(DgaContext);
|
|
1045
|
+
const portalContainer = ctx?.rootEl ?? void 0;
|
|
1046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_radix_ui8.Dialog.Portal, { container: portalContainer, children: [
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_radix_ui8.Dialog.Overlay, { className: "ddga-modal__overlay", "data-slot": "modal-overlay" }),
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1049
|
+
import_radix_ui8.Dialog.Content,
|
|
1050
|
+
{
|
|
1051
|
+
"data-slot": "modal-content",
|
|
1052
|
+
className: cn(modalContentVariants({ size }), className),
|
|
1053
|
+
...props,
|
|
1054
|
+
children: [
|
|
1055
|
+
children,
|
|
1056
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1057
|
+
import_radix_ui8.Dialog.Close,
|
|
1058
|
+
{
|
|
1059
|
+
className: "ddga-modal__close",
|
|
1060
|
+
"aria-label": closeLabel,
|
|
1061
|
+
"data-slot": "modal-close-x",
|
|
1062
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Close, { "aria-hidden": "true" })
|
|
1063
|
+
}
|
|
1064
|
+
) : null
|
|
1065
|
+
]
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
] });
|
|
1069
|
+
}
|
|
1070
|
+
function ModalHeader({ asChild, className, ...props }) {
|
|
1071
|
+
const Comp = asChild ? import_radix_ui8.Slot.Slot : "div";
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, { "data-slot": "modal-header", className: cn("ddga-modal__header", className), ...props });
|
|
1073
|
+
}
|
|
1074
|
+
function ModalTitle({ asChild, className, ...props }) {
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1076
|
+
import_radix_ui8.Dialog.Title,
|
|
1077
|
+
{
|
|
1078
|
+
asChild,
|
|
1079
|
+
"data-slot": "modal-title",
|
|
1080
|
+
className: cn("ddga-modal__title", className),
|
|
1081
|
+
...props
|
|
1082
|
+
}
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
function ModalDescription({ asChild, className, ...props }) {
|
|
1086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1087
|
+
import_radix_ui8.Dialog.Description,
|
|
1088
|
+
{
|
|
1089
|
+
asChild,
|
|
1090
|
+
"data-slot": "modal-description",
|
|
1091
|
+
className: cn("ddga-modal__description", className),
|
|
1092
|
+
...props
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
function ModalFooter({ asChild, className, ...props }) {
|
|
1097
|
+
const Comp = asChild ? import_radix_ui8.Slot.Slot : "div";
|
|
1098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, { "data-slot": "modal-footer", className: cn("ddga-modal__footer", className), ...props });
|
|
1099
|
+
}
|
|
1100
|
+
function ModalClose({ className, ...props }) {
|
|
1101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_radix_ui8.Dialog.Close, { "data-slot": "modal-close", className, ...props });
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// src/components/Toast/Toast.tsx
|
|
1105
|
+
var import_react10 = require("react");
|
|
1106
|
+
var import_radix_ui9 = require("radix-ui");
|
|
1107
|
+
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1108
|
+
|
|
1109
|
+
// src/components/Toast/toast-store.ts
|
|
1110
|
+
var import_react9 = require("react");
|
|
1111
|
+
var EXIT_ANIM_MS = 200;
|
|
1112
|
+
function createToastStore() {
|
|
1113
|
+
let toasts = [];
|
|
1114
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1115
|
+
let counter = 0;
|
|
1116
|
+
function emit() {
|
|
1117
|
+
for (const l of listeners) l();
|
|
1118
|
+
}
|
|
1119
|
+
function subscribe(listener) {
|
|
1120
|
+
listeners.add(listener);
|
|
1121
|
+
return () => {
|
|
1122
|
+
listeners.delete(listener);
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
function getSnapshot() {
|
|
1126
|
+
return toasts;
|
|
1127
|
+
}
|
|
1128
|
+
function nextId() {
|
|
1129
|
+
counter += 1;
|
|
1130
|
+
return `t${counter}`;
|
|
1131
|
+
}
|
|
1132
|
+
function add(variant, message, options = {}) {
|
|
1133
|
+
const id = options.id ?? nextId();
|
|
1134
|
+
const existing = toasts.findIndex((t) => t.id === id);
|
|
1135
|
+
const data = {
|
|
1136
|
+
id,
|
|
1137
|
+
variant,
|
|
1138
|
+
open: true,
|
|
1139
|
+
title: message,
|
|
1140
|
+
description: options.description,
|
|
1141
|
+
duration: options.duration,
|
|
1142
|
+
action: options.action,
|
|
1143
|
+
onDismiss: options.onDismiss
|
|
1144
|
+
};
|
|
1145
|
+
if (existing >= 0) {
|
|
1146
|
+
toasts = toasts.map((t, i) => i === existing ? data : t);
|
|
1147
|
+
} else {
|
|
1148
|
+
toasts = [...toasts, data];
|
|
1149
|
+
}
|
|
1150
|
+
emit();
|
|
1151
|
+
return id;
|
|
1152
|
+
}
|
|
1153
|
+
function dismiss(id) {
|
|
1154
|
+
if (id === void 0) {
|
|
1155
|
+
const ids = toasts.map((t) => t.id);
|
|
1156
|
+
toasts = toasts.map((t) => ({ ...t, open: false }));
|
|
1157
|
+
emit();
|
|
1158
|
+
setTimeout(() => {
|
|
1159
|
+
ids.forEach((id2) => remove(id2));
|
|
1160
|
+
}, EXIT_ANIM_MS);
|
|
1161
|
+
} else {
|
|
1162
|
+
toasts = toasts.map((t) => t.id === id ? { ...t, open: false } : t);
|
|
1163
|
+
emit();
|
|
1164
|
+
setTimeout(() => remove(id), EXIT_ANIM_MS);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
function remove(id) {
|
|
1168
|
+
const target = toasts.find((t) => t.id === id);
|
|
1169
|
+
toasts = toasts.filter((t) => t.id !== id);
|
|
1170
|
+
emit();
|
|
1171
|
+
target?.onDismiss?.();
|
|
1172
|
+
}
|
|
1173
|
+
function __reset() {
|
|
1174
|
+
toasts = [];
|
|
1175
|
+
counter = 0;
|
|
1176
|
+
emit();
|
|
1177
|
+
}
|
|
1178
|
+
return { subscribe, getSnapshot, add, dismiss, remove, __reset };
|
|
1179
|
+
}
|
|
1180
|
+
var toastStore = createToastStore();
|
|
1181
|
+
function createToast(store) {
|
|
1182
|
+
const fn = ((message, options) => store.add("default", message, options));
|
|
1183
|
+
fn.default = (message, options) => store.add("default", message, options);
|
|
1184
|
+
fn.info = (message, options) => store.add("info", message, options);
|
|
1185
|
+
fn.success = (message, options) => store.add("success", message, options);
|
|
1186
|
+
fn.warning = (message, options) => store.add("warning", message, options);
|
|
1187
|
+
fn.error = (message, options) => store.add("destructive", message, options);
|
|
1188
|
+
fn.destructive = fn.error;
|
|
1189
|
+
fn.dismiss = (id) => store.dismiss(id);
|
|
1190
|
+
return fn;
|
|
1191
|
+
}
|
|
1192
|
+
var toast = createToast(toastStore);
|
|
1193
|
+
|
|
1194
|
+
// src/components/Toast/Toast.tsx
|
|
1195
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1196
|
+
var toastVariants = (0, import_class_variance_authority11.cva)("ddga-toast", {
|
|
1197
|
+
variants: {
|
|
1198
|
+
variant: {
|
|
1199
|
+
default: "ddga-toast--default",
|
|
1200
|
+
info: "ddga-toast--info",
|
|
1201
|
+
success: "ddga-toast--success",
|
|
1202
|
+
warning: "ddga-toast--warning",
|
|
1203
|
+
destructive: "ddga-toast--destructive"
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
defaultVariants: {
|
|
1207
|
+
variant: "default"
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
var toastViewportVariants = (0, import_class_variance_authority11.cva)("ddga-toast-viewport", {
|
|
1211
|
+
variants: {
|
|
1212
|
+
position: {
|
|
1213
|
+
"top-start": "ddga-toast-viewport--top-start",
|
|
1214
|
+
"top-center": "ddga-toast-viewport--top-center",
|
|
1215
|
+
"top-end": "ddga-toast-viewport--top-end",
|
|
1216
|
+
"bottom-start": "ddga-toast-viewport--bottom-start",
|
|
1217
|
+
"bottom-center": "ddga-toast-viewport--bottom-center",
|
|
1218
|
+
"bottom-end": "ddga-toast-viewport--bottom-end"
|
|
1219
|
+
},
|
|
1220
|
+
containerized: {
|
|
1221
|
+
true: "ddga-toast-viewport--containerized"
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
defaultVariants: {
|
|
1225
|
+
position: "bottom-end"
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
var DEFAULT_ICONS2 = {
|
|
1229
|
+
default: null,
|
|
1230
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Info, { "aria-hidden": "true" }),
|
|
1231
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Check, { "aria-hidden": "true" }),
|
|
1232
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlertTriangle, { "aria-hidden": "true" }),
|
|
1233
|
+
destructive: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlertCircle, { "aria-hidden": "true" })
|
|
1234
|
+
};
|
|
1235
|
+
function Toaster({
|
|
1236
|
+
position = "bottom-end",
|
|
1237
|
+
containerized = false,
|
|
1238
|
+
duration = 4e3,
|
|
1239
|
+
closeButton = true,
|
|
1240
|
+
closeLabel = "Dismiss",
|
|
1241
|
+
hideIcon = false,
|
|
1242
|
+
className,
|
|
1243
|
+
swipeDirection,
|
|
1244
|
+
store = toastStore
|
|
1245
|
+
}) {
|
|
1246
|
+
const toasts = (0, import_react10.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
1247
|
+
const resolvedSwipe = swipeDirection ?? (position.startsWith("top") ? "up" : "down");
|
|
1248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_radix_ui9.Toast.Provider, { duration, swipeDirection: resolvedSwipe, children: [
|
|
1249
|
+
toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1250
|
+
ToastItem,
|
|
1251
|
+
{
|
|
1252
|
+
toast: t,
|
|
1253
|
+
store,
|
|
1254
|
+
closeButton,
|
|
1255
|
+
closeLabel,
|
|
1256
|
+
hideIcon
|
|
1257
|
+
},
|
|
1258
|
+
t.id
|
|
1259
|
+
)),
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1261
|
+
import_radix_ui9.Toast.Viewport,
|
|
1262
|
+
{
|
|
1263
|
+
"data-slot": "toast-viewport",
|
|
1264
|
+
"data-position": position,
|
|
1265
|
+
className: cn(toastViewportVariants({ position, containerized }), className)
|
|
1266
|
+
}
|
|
1267
|
+
)
|
|
1268
|
+
] });
|
|
1269
|
+
}
|
|
1270
|
+
function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
|
|
1271
|
+
const radixType = t.variant === "destructive" ? "foreground" : "background";
|
|
1272
|
+
const icon = hideIcon ? null : DEFAULT_ICONS2[t.variant];
|
|
1273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1274
|
+
import_radix_ui9.Toast.Root,
|
|
1275
|
+
{
|
|
1276
|
+
"data-slot": "toast",
|
|
1277
|
+
"data-variant": t.variant,
|
|
1278
|
+
className: toastVariants({ variant: t.variant }),
|
|
1279
|
+
open: t.open,
|
|
1280
|
+
type: radixType,
|
|
1281
|
+
duration: t.duration,
|
|
1282
|
+
onOpenChange: (open) => {
|
|
1283
|
+
if (!open) {
|
|
1284
|
+
store.dismiss(t.id);
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
children: [
|
|
1288
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "ddga-toast__icon", children: icon }) : null,
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "ddga-toast__body", children: [
|
|
1290
|
+
t.title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_radix_ui9.Toast.Title, { className: "ddga-toast__title", children: t.title }) : null,
|
|
1291
|
+
t.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_radix_ui9.Toast.Description, { className: "ddga-toast__description", children: t.description }) : null,
|
|
1292
|
+
t.action ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1293
|
+
import_radix_ui9.Toast.Action,
|
|
1294
|
+
{
|
|
1295
|
+
className: "ddga-toast__action",
|
|
1296
|
+
altText: t.action.altText ?? (typeof t.action.label === "string" ? t.action.label : "Action"),
|
|
1297
|
+
onClick: () => {
|
|
1298
|
+
t.action?.onClick();
|
|
1299
|
+
store.dismiss(t.id);
|
|
1300
|
+
},
|
|
1301
|
+
children: t.action.label
|
|
1302
|
+
}
|
|
1303
|
+
) : null
|
|
1304
|
+
] }),
|
|
1305
|
+
closeButton ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_radix_ui9.Toast.Close, { className: "ddga-toast__close", "aria-label": closeLabel, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Close, { "aria-hidden": "true" }) }) : null
|
|
1306
|
+
]
|
|
1307
|
+
}
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// src/providers/DgaProvider.tsx
|
|
1312
|
+
var import_react11 = require("react");
|
|
1313
|
+
var import_radix_ui10 = require("radix-ui");
|
|
1314
|
+
var import_tokens = require("@dev-dga/tokens");
|
|
1315
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
757
1316
|
function DgaProvider({
|
|
758
1317
|
dir = "ltr",
|
|
759
1318
|
locale,
|
|
@@ -764,17 +1323,17 @@ function DgaProvider({
|
|
|
764
1323
|
style: consumerStyle,
|
|
765
1324
|
children
|
|
766
1325
|
}) {
|
|
767
|
-
const parentCtx = (0,
|
|
1326
|
+
const parentCtx = (0, import_react11.useContext)(DgaContext);
|
|
768
1327
|
const isNested = parentCtx !== null;
|
|
769
|
-
const [rootEl, setRootEl] = (0,
|
|
1328
|
+
const [rootEl, setRootEl] = (0, import_react11.useState)(null);
|
|
770
1329
|
const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
|
|
771
|
-
const ctxValue = (0,
|
|
1330
|
+
const ctxValue = (0, import_react11.useMemo)(
|
|
772
1331
|
() => ({ dir, locale: resolvedLocale, mode, rootEl }),
|
|
773
1332
|
[dir, resolvedLocale, mode, rootEl]
|
|
774
1333
|
);
|
|
775
|
-
const themeVars = (0,
|
|
776
|
-
const inner = /* @__PURE__ */ (0,
|
|
777
|
-
return /* @__PURE__ */ (0,
|
|
1334
|
+
const themeVars = (0, import_react11.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
|
|
1335
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_radix_ui10.Direction.Provider, { dir, children });
|
|
1336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
778
1337
|
Component,
|
|
779
1338
|
{
|
|
780
1339
|
ref: setRootEl,
|
|
@@ -784,7 +1343,7 @@ function DgaProvider({
|
|
|
784
1343
|
"data-theme": mode,
|
|
785
1344
|
className,
|
|
786
1345
|
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
787
|
-
children: isNested ? inner : /* @__PURE__ */ (0,
|
|
1346
|
+
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_radix_ui10.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
788
1347
|
}
|
|
789
1348
|
) });
|
|
790
1349
|
}
|
|
@@ -795,26 +1354,50 @@ function useDir() {
|
|
|
795
1354
|
}
|
|
796
1355
|
// Annotate the CommonJS export names for ESM import in node:
|
|
797
1356
|
0 && (module.exports = {
|
|
1357
|
+
Alert,
|
|
1358
|
+
AlertDescription,
|
|
1359
|
+
AlertTitle,
|
|
798
1360
|
Button,
|
|
799
1361
|
Checkbox,
|
|
800
1362
|
DgaProvider,
|
|
801
1363
|
FieldMessage,
|
|
802
1364
|
Input,
|
|
1365
|
+
Modal,
|
|
1366
|
+
ModalClose,
|
|
1367
|
+
ModalContent,
|
|
1368
|
+
ModalDescription,
|
|
1369
|
+
ModalFooter,
|
|
1370
|
+
ModalHeader,
|
|
1371
|
+
ModalTitle,
|
|
1372
|
+
ModalTrigger,
|
|
803
1373
|
Radio,
|
|
804
1374
|
RadioGroup,
|
|
805
1375
|
Select,
|
|
806
1376
|
SelectItem,
|
|
807
1377
|
Switch,
|
|
808
1378
|
Textarea,
|
|
1379
|
+
Toaster,
|
|
1380
|
+
Tooltip,
|
|
1381
|
+
TooltipContent,
|
|
1382
|
+
TooltipTrigger,
|
|
1383
|
+
alertVariants,
|
|
809
1384
|
buttonVariants,
|
|
810
1385
|
checkboxVariants,
|
|
811
1386
|
cn,
|
|
1387
|
+
createToast,
|
|
1388
|
+
createToastStore,
|
|
812
1389
|
inputVariants,
|
|
1390
|
+
modalContentVariants,
|
|
813
1391
|
radioGroupVariants,
|
|
814
1392
|
radioVariants,
|
|
815
1393
|
selectTriggerVariants,
|
|
816
1394
|
switchVariants,
|
|
817
1395
|
textareaVariants,
|
|
1396
|
+
toast,
|
|
1397
|
+
toastStore,
|
|
1398
|
+
toastVariants,
|
|
1399
|
+
toastViewportVariants,
|
|
1400
|
+
tooltipContentVariants,
|
|
818
1401
|
useDga,
|
|
819
1402
|
useDir,
|
|
820
1403
|
useFieldA11y
|