@dev-dga/react 0.4.0 → 0.6.0

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