@dev-dga/react 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/README.md +6 -4
- package/dist/index.cjs +2735 -127
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +709 -11
- package/dist/index.d.ts +709 -11
- package/dist/index.js +2632 -137
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -49,10 +49,21 @@ __export(src_exports, {
|
|
|
49
49
|
CardTitle: () => CardTitle,
|
|
50
50
|
Checkbox: () => Checkbox,
|
|
51
51
|
CircularProgress: () => CircularProgress,
|
|
52
|
+
Collapsible: () => Collapsible,
|
|
53
|
+
CollapsibleContent: () => CollapsibleContent,
|
|
54
|
+
CollapsibleTrigger: () => CollapsibleTrigger,
|
|
52
55
|
Combobox: () => Combobox,
|
|
53
56
|
ComboboxGroup: () => ComboboxGroup,
|
|
54
57
|
ComboboxItem: () => ComboboxItem,
|
|
55
58
|
ComboboxSeparator: () => ComboboxSeparator,
|
|
59
|
+
Command: () => Command2,
|
|
60
|
+
CommandDialog: () => CommandDialog,
|
|
61
|
+
CommandEmpty: () => CommandEmpty,
|
|
62
|
+
CommandGroup: () => CommandGroup,
|
|
63
|
+
CommandInput: () => CommandInput,
|
|
64
|
+
CommandItem: () => CommandItem,
|
|
65
|
+
CommandList: () => CommandList,
|
|
66
|
+
CommandSeparator: () => CommandSeparator,
|
|
56
67
|
DatePicker: () => DatePicker,
|
|
57
68
|
DescriptionDetails: () => DescriptionDetails,
|
|
58
69
|
DescriptionItem: () => DescriptionItem,
|
|
@@ -82,9 +93,35 @@ __export(src_exports, {
|
|
|
82
93
|
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
83
94
|
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
84
95
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
96
|
+
EmptyState: () => EmptyState,
|
|
97
|
+
EmptyStateActions: () => EmptyStateActions,
|
|
98
|
+
EmptyStateDescription: () => EmptyStateDescription,
|
|
99
|
+
EmptyStateMedia: () => EmptyStateMedia,
|
|
100
|
+
EmptyStateTitle: () => EmptyStateTitle,
|
|
85
101
|
FieldMessage: () => FieldMessage,
|
|
86
102
|
FileUpload: () => FileUpload,
|
|
87
103
|
Input: () => Input,
|
|
104
|
+
InputOTP: () => InputOTP,
|
|
105
|
+
Link: () => Link,
|
|
106
|
+
List: () => List,
|
|
107
|
+
ListItem: () => ListItem,
|
|
108
|
+
ListItemAction: () => ListItemAction,
|
|
109
|
+
ListItemContent: () => ListItemContent,
|
|
110
|
+
ListItemIcon: () => ListItemIcon,
|
|
111
|
+
Menubar: () => Menubar,
|
|
112
|
+
MenubarCheckboxItem: () => MenubarCheckboxItem,
|
|
113
|
+
MenubarContent: () => MenubarContent,
|
|
114
|
+
MenubarGroup: () => MenubarGroup,
|
|
115
|
+
MenubarItem: () => MenubarItem,
|
|
116
|
+
MenubarLabel: () => MenubarLabel,
|
|
117
|
+
MenubarMenu: () => MenubarMenu,
|
|
118
|
+
MenubarRadioGroup: () => MenubarRadioGroup,
|
|
119
|
+
MenubarRadioItem: () => MenubarRadioItem,
|
|
120
|
+
MenubarSeparator: () => MenubarSeparator,
|
|
121
|
+
MenubarSub: () => MenubarSub,
|
|
122
|
+
MenubarSubContent: () => MenubarSubContent,
|
|
123
|
+
MenubarSubTrigger: () => MenubarSubTrigger,
|
|
124
|
+
MenubarTrigger: () => MenubarTrigger,
|
|
88
125
|
Modal: () => Modal,
|
|
89
126
|
ModalClose: () => ModalClose,
|
|
90
127
|
ModalContent: () => ModalContent,
|
|
@@ -101,26 +138,82 @@ __export(src_exports, {
|
|
|
101
138
|
PaginationLink: () => PaginationLink,
|
|
102
139
|
PaginationNext: () => PaginationNext,
|
|
103
140
|
PaginationPrevious: () => PaginationPrevious,
|
|
141
|
+
Popover: () => Popover,
|
|
142
|
+
PopoverAnchor: () => PopoverAnchor,
|
|
143
|
+
PopoverClose: () => PopoverClose,
|
|
144
|
+
PopoverContent: () => PopoverContent,
|
|
145
|
+
PopoverTrigger: () => PopoverTrigger,
|
|
104
146
|
Progress: () => Progress,
|
|
147
|
+
Quote: () => Quote,
|
|
148
|
+
QuoteAuthor: () => QuoteAuthor,
|
|
149
|
+
QuoteCaption: () => QuoteCaption,
|
|
150
|
+
QuoteContent: () => QuoteContent,
|
|
151
|
+
QuoteSource: () => QuoteSource,
|
|
105
152
|
Radio: () => Radio,
|
|
106
153
|
RadioGroup: () => RadioGroup,
|
|
107
154
|
Rating: () => Rating,
|
|
155
|
+
ScrollArea: () => ScrollArea,
|
|
156
|
+
SearchBox: () => SearchBox,
|
|
108
157
|
Select: () => Select,
|
|
109
158
|
SelectItem: () => SelectItem,
|
|
159
|
+
Sidebar: () => Sidebar,
|
|
160
|
+
SidebarContent: () => SidebarContent,
|
|
161
|
+
SidebarFooter: () => SidebarFooter,
|
|
162
|
+
SidebarGroup: () => SidebarGroup,
|
|
163
|
+
SidebarGroupAction: () => SidebarGroupAction,
|
|
164
|
+
SidebarGroupContent: () => SidebarGroupContent,
|
|
165
|
+
SidebarGroupLabel: () => SidebarGroupLabel,
|
|
166
|
+
SidebarHeader: () => SidebarHeader,
|
|
167
|
+
SidebarInset: () => SidebarInset,
|
|
168
|
+
SidebarMenu: () => SidebarMenu,
|
|
169
|
+
SidebarMenuAction: () => SidebarMenuAction,
|
|
170
|
+
SidebarMenuBadge: () => SidebarMenuBadge,
|
|
171
|
+
SidebarMenuButton: () => SidebarMenuButton,
|
|
172
|
+
SidebarMenuItem: () => SidebarMenuItem,
|
|
173
|
+
SidebarMenuSkeleton: () => SidebarMenuSkeleton,
|
|
174
|
+
SidebarMenuSub: () => SidebarMenuSub,
|
|
175
|
+
SidebarMenuSubButton: () => SidebarMenuSubButton,
|
|
176
|
+
SidebarMenuSubItem: () => SidebarMenuSubItem,
|
|
177
|
+
SidebarProvider: () => SidebarProvider,
|
|
178
|
+
SidebarRail: () => SidebarRail,
|
|
179
|
+
SidebarSeparator: () => SidebarSeparator,
|
|
180
|
+
SidebarTrigger: () => SidebarTrigger,
|
|
110
181
|
Skeleton: () => Skeleton,
|
|
111
182
|
Slider: () => Slider,
|
|
112
183
|
Spinner: () => Spinner,
|
|
184
|
+
Stat: () => Stat,
|
|
185
|
+
StatChange: () => StatChange,
|
|
186
|
+
StatChart: () => StatChart,
|
|
187
|
+
StatGroup: () => StatGroup,
|
|
188
|
+
StatLabel: () => StatLabel,
|
|
189
|
+
StatValue: () => StatValue,
|
|
113
190
|
Step: () => Step,
|
|
114
191
|
StepDescription: () => StepDescription,
|
|
115
192
|
StepIndicator: () => StepIndicator,
|
|
116
193
|
StepTitle: () => StepTitle,
|
|
117
194
|
Steps: () => Steps,
|
|
118
195
|
Switch: () => Switch,
|
|
196
|
+
Table: () => Table,
|
|
197
|
+
TableBody: () => TableBody,
|
|
198
|
+
TableCaption: () => TableCaption,
|
|
199
|
+
TableCell: () => TableCell,
|
|
200
|
+
TableFooter: () => TableFooter,
|
|
201
|
+
TableHead: () => TableHead,
|
|
202
|
+
TableHeader: () => TableHeader,
|
|
203
|
+
TableRow: () => TableRow,
|
|
119
204
|
Tabs: () => Tabs,
|
|
120
205
|
TabsContent: () => TabsContent,
|
|
121
206
|
TabsList: () => TabsList,
|
|
122
207
|
TabsTrigger: () => TabsTrigger,
|
|
208
|
+
TagInput: () => TagInput,
|
|
123
209
|
Textarea: () => Textarea,
|
|
210
|
+
Timeline: () => Timeline,
|
|
211
|
+
TimelineContent: () => TimelineContent,
|
|
212
|
+
TimelineDescription: () => TimelineDescription,
|
|
213
|
+
TimelineItem: () => TimelineItem,
|
|
214
|
+
TimelineMarker: () => TimelineMarker,
|
|
215
|
+
TimelineTime: () => TimelineTime,
|
|
216
|
+
TimelineTitle: () => TimelineTitle,
|
|
124
217
|
Toaster: () => Toaster,
|
|
125
218
|
Toggle: () => Toggle,
|
|
126
219
|
ToggleGroup: () => ToggleGroup,
|
|
@@ -140,6 +233,7 @@ __export(src_exports, {
|
|
|
140
233
|
cn: () => cn,
|
|
141
234
|
comboboxTriggerVariants: () => comboboxTriggerVariants,
|
|
142
235
|
comboboxVariants: () => comboboxVariants,
|
|
236
|
+
commandVariants: () => commandVariants,
|
|
143
237
|
createToast: () => createToast,
|
|
144
238
|
createToastStore: () => createToastStore,
|
|
145
239
|
datePickerVariants: () => datePickerVariants,
|
|
@@ -147,25 +241,42 @@ __export(src_exports, {
|
|
|
147
241
|
dividerVariants: () => dividerVariants,
|
|
148
242
|
drawerVariants: () => drawerVariants,
|
|
149
243
|
dropdownMenuVariants: () => dropdownMenuVariants,
|
|
244
|
+
emptyStateVariants: () => emptyStateVariants,
|
|
245
|
+
inputOTPVariants: () => inputOTPVariants,
|
|
150
246
|
inputVariants: () => inputVariants,
|
|
247
|
+
linkVariants: () => linkVariants,
|
|
248
|
+
listVariants: () => listVariants,
|
|
249
|
+
menubarContentVariants: () => menubarContentVariants,
|
|
250
|
+
menubarTriggerVariants: () => menubarTriggerVariants,
|
|
151
251
|
modalContentVariants: () => modalContentVariants,
|
|
152
252
|
numberInputVariants: () => numberInputVariants,
|
|
153
253
|
paginationLinkVariants: () => paginationLinkVariants,
|
|
154
254
|
paginationVariants: () => paginationVariants,
|
|
255
|
+
popoverContentVariants: () => popoverContentVariants,
|
|
155
256
|
progressVariants: () => progressVariants,
|
|
257
|
+
quoteVariants: () => quoteVariants,
|
|
156
258
|
radioGroupVariants: () => radioGroupVariants,
|
|
157
259
|
radioVariants: () => radioVariants,
|
|
158
260
|
ratingVariants: () => ratingVariants,
|
|
261
|
+
scrollAreaVariants: () => scrollAreaVariants,
|
|
159
262
|
selectTriggerVariants: () => selectTriggerVariants,
|
|
263
|
+
sidebarMenuButtonVariants: () => sidebarMenuButtonVariants,
|
|
264
|
+
sidebarMenuSubButtonVariants: () => sidebarMenuSubButtonVariants,
|
|
160
265
|
skeletonVariants: () => skeletonVariants,
|
|
161
266
|
sliderVariants: () => sliderVariants,
|
|
162
267
|
spinnerVariants: () => spinnerVariants,
|
|
268
|
+
statGroupVariants: () => statGroupVariants,
|
|
269
|
+
statVariants: () => statVariants,
|
|
163
270
|
stepVariants: () => stepVariants,
|
|
164
271
|
stepsVariants: () => stepsVariants,
|
|
165
272
|
switchVariants: () => switchVariants,
|
|
273
|
+
tableVariants: () => tableVariants,
|
|
166
274
|
tabsListVariants: () => tabsListVariants,
|
|
167
275
|
tabsVariants: () => tabsVariants,
|
|
276
|
+
tagInputVariants: () => tagInputVariants,
|
|
168
277
|
textareaVariants: () => textareaVariants,
|
|
278
|
+
timelineMarkerVariants: () => timelineMarkerVariants,
|
|
279
|
+
timelineVariants: () => timelineVariants,
|
|
169
280
|
toast: () => toast,
|
|
170
281
|
toastStore: () => toastStore,
|
|
171
282
|
toastVariants: () => toastVariants,
|
|
@@ -175,7 +286,9 @@ __export(src_exports, {
|
|
|
175
286
|
tooltipContentVariants: () => tooltipContentVariants,
|
|
176
287
|
useDga: () => useDga,
|
|
177
288
|
useDir: () => useDir,
|
|
178
|
-
useFieldA11y: () => useFieldA11y
|
|
289
|
+
useFieldA11y: () => useFieldA11y,
|
|
290
|
+
useIsMobile: () => useIsMobile,
|
|
291
|
+
useSidebar: () => useSidebar
|
|
179
292
|
});
|
|
180
293
|
module.exports = __toCommonJS(src_exports);
|
|
181
294
|
|
|
@@ -261,6 +374,16 @@ var buttonVariants = (0, import_class_variance_authority2.cva)("ddga-button", {
|
|
|
261
374
|
*/
|
|
262
375
|
inverted: {
|
|
263
376
|
true: "ddga-button--inverted"
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* Floating action button: fully-rounded + elevated. Orthogonal to `variant`
|
|
380
|
+
* (color) and `size` — pair with `size="icon"` for a circular FAB, or a text
|
|
381
|
+
* size for an extended pill FAB. Positioning (`position: fixed`, safe-area
|
|
382
|
+
* insets) is the consumer's responsibility — see the placement recipe in the
|
|
383
|
+
* stories. Keep it a modifier, not a `Fab` wrapper component.
|
|
384
|
+
*/
|
|
385
|
+
fab: {
|
|
386
|
+
true: "ddga-button--fab"
|
|
264
387
|
}
|
|
265
388
|
},
|
|
266
389
|
compoundVariants: [],
|
|
@@ -274,6 +397,7 @@ function Button({
|
|
|
274
397
|
size,
|
|
275
398
|
fullWidth,
|
|
276
399
|
inverted,
|
|
400
|
+
fab,
|
|
277
401
|
loading,
|
|
278
402
|
disabled,
|
|
279
403
|
startIcon,
|
|
@@ -303,7 +427,7 @@ function Button({
|
|
|
303
427
|
"aria-busy": loading || void 0,
|
|
304
428
|
"data-slot": "button",
|
|
305
429
|
className: cn(
|
|
306
|
-
buttonVariants({ variant, size, fullWidth, inverted }),
|
|
430
|
+
buttonVariants({ variant, size, fullWidth, inverted, fab }),
|
|
307
431
|
loading && "ddga-button--loading",
|
|
308
432
|
className
|
|
309
433
|
),
|
|
@@ -813,6 +937,136 @@ function Upload(props) {
|
|
|
813
937
|
}
|
|
814
938
|
);
|
|
815
939
|
}
|
|
940
|
+
function Inbox(props) {
|
|
941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
942
|
+
"svg",
|
|
943
|
+
{
|
|
944
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
945
|
+
width: "1em",
|
|
946
|
+
height: "1em",
|
|
947
|
+
viewBox: "0 0 24 24",
|
|
948
|
+
fill: "none",
|
|
949
|
+
stroke: "currentColor",
|
|
950
|
+
strokeWidth: "2",
|
|
951
|
+
strokeLinecap: "round",
|
|
952
|
+
strokeLinejoin: "round",
|
|
953
|
+
...props,
|
|
954
|
+
children: [
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M22 12h-6l-2 3h-4l-2-3H2" }),
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
|
|
957
|
+
]
|
|
958
|
+
}
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
function Search(props) {
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
963
|
+
"svg",
|
|
964
|
+
{
|
|
965
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
966
|
+
width: "1em",
|
|
967
|
+
height: "1em",
|
|
968
|
+
viewBox: "0 0 24 24",
|
|
969
|
+
fill: "none",
|
|
970
|
+
stroke: "currentColor",
|
|
971
|
+
strokeWidth: "2",
|
|
972
|
+
strokeLinecap: "round",
|
|
973
|
+
strokeLinejoin: "round",
|
|
974
|
+
...props,
|
|
975
|
+
children: [
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m21 21-4.3-4.3" })
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
);
|
|
981
|
+
}
|
|
982
|
+
function CaretUp(props) {
|
|
983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
984
|
+
"svg",
|
|
985
|
+
{
|
|
986
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
987
|
+
width: "1em",
|
|
988
|
+
height: "1em",
|
|
989
|
+
viewBox: "0 0 24 24",
|
|
990
|
+
fill: "currentColor",
|
|
991
|
+
stroke: "none",
|
|
992
|
+
...props,
|
|
993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m12 8-6 8h12z" })
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
function CaretDown(props) {
|
|
998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
999
|
+
"svg",
|
|
1000
|
+
{
|
|
1001
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1002
|
+
width: "1em",
|
|
1003
|
+
height: "1em",
|
|
1004
|
+
viewBox: "0 0 24 24",
|
|
1005
|
+
fill: "currentColor",
|
|
1006
|
+
stroke: "none",
|
|
1007
|
+
...props,
|
|
1008
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m12 16 6-8H6z" })
|
|
1009
|
+
}
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
function ExternalLink(props) {
|
|
1013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1014
|
+
"svg",
|
|
1015
|
+
{
|
|
1016
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1017
|
+
width: "1em",
|
|
1018
|
+
height: "1em",
|
|
1019
|
+
viewBox: "0 0 24 24",
|
|
1020
|
+
fill: "none",
|
|
1021
|
+
stroke: "currentColor",
|
|
1022
|
+
strokeWidth: "2",
|
|
1023
|
+
strokeLinecap: "round",
|
|
1024
|
+
strokeLinejoin: "round",
|
|
1025
|
+
...props,
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M15 3h6v6" }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M10 14 21 3" }),
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
1030
|
+
]
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
function QuoteMark(props) {
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1036
|
+
"svg",
|
|
1037
|
+
{
|
|
1038
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1039
|
+
width: "1em",
|
|
1040
|
+
height: "1em",
|
|
1041
|
+
viewBox: "0 0 24 24",
|
|
1042
|
+
fill: "currentColor",
|
|
1043
|
+
stroke: "none",
|
|
1044
|
+
...props,
|
|
1045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M7 7C4.8 7 3 8.8 3 11s1.8 4 4 4c.2 0 .4 0 .6-.1C7.2 16.4 6 17.5 4.2 17.7L4 17.7V20c3.6-.3 6-3.2 6-7v-1.2C10 8.7 8.4 7 7 7zM18 7c-2.2 0-4 1.8-4 4s1.8 4 4 4c.2 0 .4 0 .6-.1-.4 1.5-1.6 2.6-3.4 2.8l-.2 0V20c3.6-.3 6-3.2 6-7v-1.2C21 8.7 19.4 7 18 7z" })
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
function PanelLeft(props) {
|
|
1050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1051
|
+
"svg",
|
|
1052
|
+
{
|
|
1053
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1054
|
+
width: "1em",
|
|
1055
|
+
height: "1em",
|
|
1056
|
+
viewBox: "0 0 24 24",
|
|
1057
|
+
fill: "none",
|
|
1058
|
+
stroke: "currentColor",
|
|
1059
|
+
strokeWidth: "2",
|
|
1060
|
+
strokeLinecap: "round",
|
|
1061
|
+
strokeLinejoin: "round",
|
|
1062
|
+
...props,
|
|
1063
|
+
children: [
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 3v18" })
|
|
1066
|
+
]
|
|
1067
|
+
}
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
816
1070
|
|
|
817
1071
|
// src/components/Checkbox/Checkbox.tsx
|
|
818
1072
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -1928,6 +2182,7 @@ function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
|
|
|
1928
2182
|
}
|
|
1929
2183
|
|
|
1930
2184
|
// src/components/Tabs/Tabs.tsx
|
|
2185
|
+
var import_react13 = require("react");
|
|
1931
2186
|
var import_radix_ui13 = require("radix-ui");
|
|
1932
2187
|
var import_class_variance_authority17 = require("class-variance-authority");
|
|
1933
2188
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -1974,13 +2229,49 @@ function TabsList({ fullWidth, className, ...props }) {
|
|
|
1974
2229
|
}
|
|
1975
2230
|
);
|
|
1976
2231
|
}
|
|
1977
|
-
function TabsTrigger({
|
|
2232
|
+
function TabsTrigger({
|
|
2233
|
+
className,
|
|
2234
|
+
startIcon,
|
|
2235
|
+
endIcon,
|
|
2236
|
+
children,
|
|
2237
|
+
asChild,
|
|
2238
|
+
...props
|
|
2239
|
+
}) {
|
|
2240
|
+
const hasIcon = startIcon != null || endIcon != null;
|
|
2241
|
+
const hasText = children != null && children !== "" && typeof children !== "boolean";
|
|
2242
|
+
const isIconOnly = !asChild && hasIcon && !hasText;
|
|
2243
|
+
if (process.env.NODE_ENV === "development") {
|
|
2244
|
+
if (isIconOnly && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
2245
|
+
console.warn(
|
|
2246
|
+
"[@dev-dga/react] An icon-only TabsTrigger (icon with no text label) requires an aria-label or aria-labelledby for screen reader accessibility."
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
if (asChild && hasIcon) {
|
|
2250
|
+
console.warn(
|
|
2251
|
+
"[@dev-dga/react] TabsTrigger `startIcon`/`endIcon` are ignored when `asChild` is set \u2014 render the icons inside your child element instead."
|
|
2252
|
+
);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
1978
2255
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1979
2256
|
import_radix_ui13.Tabs.Trigger,
|
|
1980
2257
|
{
|
|
1981
2258
|
"data-slot": "tabs-trigger",
|
|
1982
|
-
|
|
1983
|
-
|
|
2259
|
+
asChild,
|
|
2260
|
+
className: cn("ddga-tabs__trigger", isIconOnly && "ddga-tabs__trigger--icon-only", className),
|
|
2261
|
+
...props,
|
|
2262
|
+
children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2263
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2264
|
+
"span",
|
|
2265
|
+
{
|
|
2266
|
+
className: "ddga-tabs__icon",
|
|
2267
|
+
"data-slot": "tabs-trigger-start-icon",
|
|
2268
|
+
"aria-hidden": "true",
|
|
2269
|
+
children: startIcon
|
|
2270
|
+
}
|
|
2271
|
+
),
|
|
2272
|
+
children,
|
|
2273
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ddga-tabs__icon", "data-slot": "tabs-trigger-end-icon", "aria-hidden": "true", children: endIcon })
|
|
2274
|
+
] })
|
|
1984
2275
|
}
|
|
1985
2276
|
);
|
|
1986
2277
|
}
|
|
@@ -2450,30 +2741,60 @@ function Progress({ value = null, max = 100, size, color, className, ...props })
|
|
|
2450
2741
|
}
|
|
2451
2742
|
var CIRCULAR_SIZES = { sm: 32, md: 48, lg: 72 };
|
|
2452
2743
|
var CIRCULAR_DEFAULT_THICKNESS = { sm: 4, md: 5, lg: 6 };
|
|
2744
|
+
var SEGMENT_GAP_FRACTION = 0.16;
|
|
2453
2745
|
function CircularProgress({
|
|
2454
2746
|
value = null,
|
|
2455
2747
|
max = 100,
|
|
2456
2748
|
size,
|
|
2457
2749
|
color,
|
|
2458
2750
|
thickness,
|
|
2751
|
+
segments,
|
|
2459
2752
|
showLabel = false,
|
|
2460
2753
|
className,
|
|
2461
2754
|
...props
|
|
2462
2755
|
}) {
|
|
2463
2756
|
const isIndeterminate = value === null;
|
|
2757
|
+
const isSegmented = typeof segments === "number" && segments >= 2;
|
|
2464
2758
|
const sizeKey = size ?? "md";
|
|
2465
2759
|
const diameter = CIRCULAR_SIZES[sizeKey];
|
|
2466
2760
|
const strokeWidth = thickness ?? CIRCULAR_DEFAULT_THICKNESS[sizeKey];
|
|
2467
2761
|
const radius = (diameter - strokeWidth) / 2;
|
|
2468
2762
|
const circumference = 2 * Math.PI * radius;
|
|
2763
|
+
const center = diameter / 2;
|
|
2469
2764
|
const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
2470
2765
|
const dashOffset = isIndeterminate ? circumference * 0.75 : circumference * (1 - pct / 100);
|
|
2471
2766
|
const state = isIndeterminate ? "indeterminate" : value >= max ? "complete" : "loading";
|
|
2767
|
+
const segmentEls = isSegmented && segments ? (() => {
|
|
2768
|
+
const filled = isIndeterminate ? 0 : Math.round(pct / 100 * segments);
|
|
2769
|
+
const segAngle = 360 / segments;
|
|
2770
|
+
const gapAngle = segAngle * SEGMENT_GAP_FRACTION;
|
|
2771
|
+
const segLen = circumference * ((1 - SEGMENT_GAP_FRACTION) / segments);
|
|
2772
|
+
return Array.from({ length: segments }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2773
|
+
"circle",
|
|
2774
|
+
{
|
|
2775
|
+
className: cn(
|
|
2776
|
+
"ddga-circular-progress__segment",
|
|
2777
|
+
i < filled && "ddga-circular-progress__segment--filled"
|
|
2778
|
+
),
|
|
2779
|
+
cx: center,
|
|
2780
|
+
cy: center,
|
|
2781
|
+
r: radius,
|
|
2782
|
+
fill: "none",
|
|
2783
|
+
strokeWidth,
|
|
2784
|
+
strokeLinecap: "butt",
|
|
2785
|
+
strokeDasharray: `${segLen} ${circumference}`,
|
|
2786
|
+
transform: `rotate(${-90 + i * segAngle + gapAngle / 2} ${center} ${center})`
|
|
2787
|
+
},
|
|
2788
|
+
i
|
|
2789
|
+
));
|
|
2790
|
+
})() : null;
|
|
2791
|
+
const labelText = isSegmented ? `${segments ? Math.round(pct / 100 * segments) : 0}/${segments}` : `${Math.round(pct)}%`;
|
|
2472
2792
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2473
2793
|
"div",
|
|
2474
2794
|
{
|
|
2475
2795
|
"data-slot": "circular-progress",
|
|
2476
2796
|
"data-state": state,
|
|
2797
|
+
"data-segmented": isSegmented ? "" : void 0,
|
|
2477
2798
|
role: "progressbar",
|
|
2478
2799
|
"aria-valuemin": 0,
|
|
2479
2800
|
"aria-valuemax": max,
|
|
@@ -2482,7 +2803,7 @@ function CircularProgress({
|
|
|
2482
2803
|
style: { inlineSize: diameter, blockSize: diameter },
|
|
2483
2804
|
...props,
|
|
2484
2805
|
children: [
|
|
2485
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2486
2807
|
"svg",
|
|
2487
2808
|
{
|
|
2488
2809
|
className: "ddga-circular-progress__svg",
|
|
@@ -2491,13 +2812,13 @@ function CircularProgress({
|
|
|
2491
2812
|
height: diameter,
|
|
2492
2813
|
"aria-hidden": "true",
|
|
2493
2814
|
focusable: "false",
|
|
2494
|
-
children: [
|
|
2815
|
+
children: isSegmented ? segmentEls : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2495
2816
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2496
2817
|
"circle",
|
|
2497
2818
|
{
|
|
2498
2819
|
className: "ddga-circular-progress__track",
|
|
2499
|
-
cx:
|
|
2500
|
-
cy:
|
|
2820
|
+
cx: center,
|
|
2821
|
+
cy: center,
|
|
2501
2822
|
r: radius,
|
|
2502
2823
|
fill: "none",
|
|
2503
2824
|
strokeWidth
|
|
@@ -2507,31 +2828,28 @@ function CircularProgress({
|
|
|
2507
2828
|
"circle",
|
|
2508
2829
|
{
|
|
2509
2830
|
className: "ddga-circular-progress__indicator",
|
|
2510
|
-
cx:
|
|
2511
|
-
cy:
|
|
2831
|
+
cx: center,
|
|
2832
|
+
cy: center,
|
|
2512
2833
|
r: radius,
|
|
2513
2834
|
fill: "none",
|
|
2514
2835
|
strokeWidth,
|
|
2515
2836
|
strokeLinecap: "round",
|
|
2516
2837
|
strokeDasharray: circumference,
|
|
2517
2838
|
strokeDashoffset: dashOffset,
|
|
2518
|
-
transform: `rotate(-90 ${
|
|
2839
|
+
transform: `rotate(-90 ${center} ${center})`
|
|
2519
2840
|
}
|
|
2520
2841
|
)
|
|
2521
|
-
]
|
|
2842
|
+
] })
|
|
2522
2843
|
}
|
|
2523
2844
|
),
|
|
2524
|
-
showLabel && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2525
|
-
Math.round(pct),
|
|
2526
|
-
"%"
|
|
2527
|
-
] }) : null
|
|
2845
|
+
showLabel && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ddga-circular-progress__label", "aria-hidden": "true", children: labelText }) : null
|
|
2528
2846
|
]
|
|
2529
2847
|
}
|
|
2530
2848
|
);
|
|
2531
2849
|
}
|
|
2532
2850
|
|
|
2533
2851
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
2534
|
-
var
|
|
2852
|
+
var import_react14 = require("react");
|
|
2535
2853
|
var import_radix_ui18 = require("radix-ui");
|
|
2536
2854
|
var import_class_variance_authority24 = require("class-variance-authority");
|
|
2537
2855
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -2558,7 +2876,7 @@ function DropdownMenuContent({
|
|
|
2558
2876
|
sideOffset = 6,
|
|
2559
2877
|
...props
|
|
2560
2878
|
}) {
|
|
2561
|
-
const ctx = (0,
|
|
2879
|
+
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2562
2880
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2563
2881
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2564
2882
|
import_radix_ui18.DropdownMenu.Content,
|
|
@@ -2689,7 +3007,7 @@ function DropdownMenuSubTrigger({
|
|
|
2689
3007
|
);
|
|
2690
3008
|
}
|
|
2691
3009
|
function DropdownMenuSubContent({ size, className, ...props }) {
|
|
2692
|
-
const ctx = (0,
|
|
3010
|
+
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2693
3011
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2694
3012
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2695
3013
|
import_radix_ui18.DropdownMenu.SubContent,
|
|
@@ -2702,7 +3020,7 @@ function DropdownMenuSubContent({ size, className, ...props }) {
|
|
|
2702
3020
|
}
|
|
2703
3021
|
|
|
2704
3022
|
// src/components/Drawer/Drawer.tsx
|
|
2705
|
-
var
|
|
3023
|
+
var import_react15 = require("react");
|
|
2706
3024
|
var import_radix_ui19 = require("radix-ui");
|
|
2707
3025
|
var import_class_variance_authority25 = require("class-variance-authority");
|
|
2708
3026
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -2741,7 +3059,7 @@ function DrawerContent({
|
|
|
2741
3059
|
children,
|
|
2742
3060
|
...props
|
|
2743
3061
|
}) {
|
|
2744
|
-
const ctx = (0,
|
|
3062
|
+
const ctx = (0, import_react15.useContext)(DgaContext);
|
|
2745
3063
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2746
3064
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_radix_ui19.Dialog.Portal, { container: portalContainer, children: [
|
|
2747
3065
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_radix_ui19.Dialog.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
|
|
@@ -2806,7 +3124,7 @@ function DrawerClose({ className, ...props }) {
|
|
|
2806
3124
|
}
|
|
2807
3125
|
|
|
2808
3126
|
// src/components/Combobox/Combobox.tsx
|
|
2809
|
-
var
|
|
3127
|
+
var import_react16 = require("react");
|
|
2810
3128
|
var import_cmdk = require("cmdk");
|
|
2811
3129
|
var import_radix_ui20 = require("radix-ui");
|
|
2812
3130
|
var import_class_variance_authority26 = require("class-variance-authority");
|
|
@@ -2826,9 +3144,9 @@ var comboboxTriggerVariants = (0, import_class_variance_authority26.cva)("ddga-c
|
|
|
2826
3144
|
}
|
|
2827
3145
|
});
|
|
2828
3146
|
var comboboxVariants = comboboxTriggerVariants;
|
|
2829
|
-
var ComboboxContext = (0,
|
|
3147
|
+
var ComboboxContext = (0, import_react16.createContext)(null);
|
|
2830
3148
|
function useComboboxContext(component) {
|
|
2831
|
-
const ctx = (0,
|
|
3149
|
+
const ctx = (0, import_react16.useContext)(ComboboxContext);
|
|
2832
3150
|
if (!ctx) {
|
|
2833
3151
|
throw new Error(`<${component}> must be rendered inside <Combobox>.`);
|
|
2834
3152
|
}
|
|
@@ -2858,20 +3176,20 @@ function Combobox({
|
|
|
2858
3176
|
"aria-label": ariaLabel,
|
|
2859
3177
|
"aria-labelledby": ariaLabelledBy
|
|
2860
3178
|
}) {
|
|
2861
|
-
const [internalValue, setInternalValue] = (0,
|
|
3179
|
+
const [internalValue, setInternalValue] = (0, import_react16.useState)(defaultValue);
|
|
2862
3180
|
const isControlled = controlledValue !== void 0;
|
|
2863
3181
|
const value = isControlled ? controlledValue : internalValue;
|
|
2864
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
3182
|
+
const [internalOpen, setInternalOpen] = (0, import_react16.useState)(defaultOpen ?? false);
|
|
2865
3183
|
const isOpenControlled = controlledOpen !== void 0;
|
|
2866
3184
|
const open = isOpenControlled ? controlledOpen : internalOpen;
|
|
2867
|
-
const setOpen = (0,
|
|
3185
|
+
const setOpen = (0, import_react16.useCallback)(
|
|
2868
3186
|
(next) => {
|
|
2869
3187
|
if (!isOpenControlled) setInternalOpen(next);
|
|
2870
3188
|
onOpenChange?.(next);
|
|
2871
3189
|
},
|
|
2872
3190
|
[isOpenControlled, onOpenChange]
|
|
2873
3191
|
);
|
|
2874
|
-
const select = (0,
|
|
3192
|
+
const select = (0, import_react16.useCallback)(
|
|
2875
3193
|
(next) => {
|
|
2876
3194
|
if (!isControlled) setInternalValue(next);
|
|
2877
3195
|
onValueChange?.(next);
|
|
@@ -2879,12 +3197,12 @@ function Combobox({
|
|
|
2879
3197
|
},
|
|
2880
3198
|
[isControlled, onValueChange, setOpen]
|
|
2881
3199
|
);
|
|
2882
|
-
const ctx = (0,
|
|
2883
|
-
const itemLabels = (0,
|
|
3200
|
+
const ctx = (0, import_react16.useMemo)(() => ({ value, select }), [value, select]);
|
|
3201
|
+
const itemLabels = (0, import_react16.useMemo)(() => {
|
|
2884
3202
|
const map = /* @__PURE__ */ new Map();
|
|
2885
3203
|
const visit = (nodes) => {
|
|
2886
|
-
|
|
2887
|
-
if (!(0,
|
|
3204
|
+
import_react16.Children.forEach(nodes, (child) => {
|
|
3205
|
+
if (!(0, import_react16.isValidElement)(child)) return;
|
|
2888
3206
|
const childProps = child.props;
|
|
2889
3207
|
if (typeof childProps.value === "string") {
|
|
2890
3208
|
map.set(childProps.value, childProps.children);
|
|
@@ -2906,14 +3224,14 @@ function Combobox({
|
|
|
2906
3224
|
"aria-label": ariaLabel,
|
|
2907
3225
|
"aria-labelledby": ariaLabelledBy
|
|
2908
3226
|
});
|
|
2909
|
-
const providerCtx = (0,
|
|
3227
|
+
const providerCtx = (0, import_react16.useContext)(DgaContext);
|
|
2910
3228
|
const portalContainer = providerCtx?.portalEl ?? providerCtx?.rootEl ?? void 0;
|
|
2911
|
-
const triggerLabel = (0,
|
|
3229
|
+
const triggerLabel = (0, import_react16.useMemo)(() => {
|
|
2912
3230
|
if (value === void 0) return null;
|
|
2913
3231
|
if (getLabel) return getLabel(value);
|
|
2914
3232
|
return itemLabels.get(value) ?? null;
|
|
2915
3233
|
}, [value, getLabel, itemLabels]);
|
|
2916
|
-
const searchId = (0,
|
|
3234
|
+
const searchId = (0, import_react16.useId)();
|
|
2917
3235
|
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
3236
|
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { htmlFor: fieldId, className: "ddga-combobox__label", children: [
|
|
2919
3237
|
label,
|
|
@@ -3033,7 +3351,7 @@ function ComboboxSeparator({ className, ...props }) {
|
|
|
3033
3351
|
}
|
|
3034
3352
|
|
|
3035
3353
|
// src/components/DatePicker/DatePicker.tsx
|
|
3036
|
-
var
|
|
3354
|
+
var import_react17 = require("react");
|
|
3037
3355
|
var import_react_aria_components = require("react-aria-components");
|
|
3038
3356
|
var import_date = require("@internationalized/date");
|
|
3039
3357
|
var import_class_variance_authority27 = require("class-variance-authority");
|
|
@@ -3077,13 +3395,13 @@ function secondaryDayNumber(date, mainCalendar) {
|
|
|
3077
3395
|
return (0, import_date.toCalendar)(date, other).day;
|
|
3078
3396
|
}
|
|
3079
3397
|
function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
3080
|
-
const state = (0,
|
|
3398
|
+
const state = (0, import_react17.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3081
3399
|
const focusedDate = state?.focusedDate ?? null;
|
|
3082
3400
|
const focusedYear = focusedDate?.year ?? 0;
|
|
3083
3401
|
const focusedCalendar = focusedDate?.calendar ?? GREGORIAN;
|
|
3084
3402
|
const minValue = state?.minValue ?? null;
|
|
3085
3403
|
const maxValue = state?.maxValue ?? null;
|
|
3086
|
-
const monthNames = (0,
|
|
3404
|
+
const monthNames = (0, import_react17.useMemo)(() => {
|
|
3087
3405
|
if (!focusedDate) return [];
|
|
3088
3406
|
const fmt = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
3089
3407
|
return Array.from({ length: 12 }, (_, i) => {
|
|
@@ -3093,7 +3411,7 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3093
3411
|
return fmt.format(js);
|
|
3094
3412
|
});
|
|
3095
3413
|
}, [locale, focusedDate, focusedCalendar, focusedYear]);
|
|
3096
|
-
const yearOptions = (0,
|
|
3414
|
+
const yearOptions = (0, import_react17.useMemo)(() => {
|
|
3097
3415
|
if (!focusedDate) return [];
|
|
3098
3416
|
const minY = minValue ? (0, import_date.toCalendar)(minValue, focusedCalendar).year : focusedYear - 100;
|
|
3099
3417
|
const maxY = maxValue ? (0, import_date.toCalendar)(maxValue, focusedCalendar).year : focusedYear + 30;
|
|
@@ -3128,7 +3446,7 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3128
3446
|
] });
|
|
3129
3447
|
}
|
|
3130
3448
|
function CalendarDayCell({ date, showSecondary, calendarSystem }) {
|
|
3131
|
-
const state = (0,
|
|
3449
|
+
const state = (0, import_react17.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3132
3450
|
const start = state?.visibleRange.start;
|
|
3133
3451
|
const isOutside = !!start && (date.year !== start.year || date.month !== start.month);
|
|
3134
3452
|
const isOutOfBounds = state ? state.isInvalid(date) : false;
|
|
@@ -3186,11 +3504,11 @@ function DatePicker({
|
|
|
3186
3504
|
showSecondaryCalendar = false
|
|
3187
3505
|
}) {
|
|
3188
3506
|
const isValueControlled = controlledValue !== void 0;
|
|
3189
|
-
const [internalValue, setInternalValue] = (0,
|
|
3507
|
+
const [internalValue, setInternalValue] = (0, import_react17.useState)(
|
|
3190
3508
|
() => dateToCalendarDate(defaultValue)
|
|
3191
3509
|
);
|
|
3192
3510
|
const value = isValueControlled ? dateToCalendarDate(controlledValue) : internalValue;
|
|
3193
|
-
const handleAriaChange = (0,
|
|
3511
|
+
const handleAriaChange = (0, import_react17.useCallback)(
|
|
3194
3512
|
(next) => {
|
|
3195
3513
|
const nextCD = next ? new import_date.CalendarDate(next.year, next.month, next.day) : null;
|
|
3196
3514
|
if (!isValueControlled) setInternalValue(nextCD);
|
|
@@ -3199,18 +3517,18 @@ function DatePicker({
|
|
|
3199
3517
|
[isValueControlled, onChange]
|
|
3200
3518
|
);
|
|
3201
3519
|
const isCalendarControlled = controlledCalendar !== void 0;
|
|
3202
|
-
const [internalCalendar, setInternalCalendar] = (0,
|
|
3520
|
+
const [internalCalendar, setInternalCalendar] = (0, import_react17.useState)(defaultCalendar);
|
|
3203
3521
|
const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
|
|
3204
|
-
const setCalendar = (0,
|
|
3522
|
+
const setCalendar = (0, import_react17.useCallback)(
|
|
3205
3523
|
(next) => {
|
|
3206
3524
|
if (!isCalendarControlled) setInternalCalendar(next);
|
|
3207
3525
|
onCalendarChange?.(next);
|
|
3208
3526
|
},
|
|
3209
3527
|
[isCalendarControlled, onCalendarChange]
|
|
3210
3528
|
);
|
|
3211
|
-
const dgaCtx = (0,
|
|
3529
|
+
const dgaCtx = (0, import_react17.useContext)(DgaContext);
|
|
3212
3530
|
const dgaLocale = dgaCtx?.locale ?? "en";
|
|
3213
|
-
const ariaLocale = (0,
|
|
3531
|
+
const ariaLocale = (0, import_react17.useMemo)(
|
|
3214
3532
|
() => composeLocale(dgaLocale, calendarSystem),
|
|
3215
3533
|
[dgaLocale, calendarSystem]
|
|
3216
3534
|
);
|
|
@@ -3218,17 +3536,17 @@ function DatePicker({
|
|
|
3218
3536
|
const dgaDir = dgaCtx?.dir ?? "ltr";
|
|
3219
3537
|
const PrevChevron = dgaDir === "rtl" ? ChevronRight : ChevronLeft;
|
|
3220
3538
|
const NextChevron = dgaDir === "rtl" ? ChevronLeft : ChevronRight;
|
|
3221
|
-
const resolvedLabels = (0,
|
|
3539
|
+
const resolvedLabels = (0, import_react17.useMemo)(() => {
|
|
3222
3540
|
if (calendarLabels) return calendarLabels;
|
|
3223
3541
|
const isArabic = dgaLocale.startsWith("ar");
|
|
3224
3542
|
return isArabic ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
|
|
3225
3543
|
}, [calendarLabels, dgaLocale]);
|
|
3226
|
-
const navLabels = (0,
|
|
3544
|
+
const navLabels = (0, import_react17.useMemo)(
|
|
3227
3545
|
() => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
|
|
3228
3546
|
[dgaLocale]
|
|
3229
3547
|
);
|
|
3230
|
-
const ariaMinValue = (0,
|
|
3231
|
-
const ariaMaxValue = (0,
|
|
3548
|
+
const ariaMinValue = (0, import_react17.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
|
|
3549
|
+
const ariaMaxValue = (0, import_react17.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
|
|
3232
3550
|
const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : "Date");
|
|
3233
3551
|
const showToggle = showCalendarToggle && !isCalendarControlled;
|
|
3234
3552
|
const hasError = !!error;
|
|
@@ -3401,7 +3719,7 @@ function DatePicker({
|
|
|
3401
3719
|
}
|
|
3402
3720
|
|
|
3403
3721
|
// src/components/FileUpload/FileUpload.tsx
|
|
3404
|
-
var
|
|
3722
|
+
var import_react18 = require("react");
|
|
3405
3723
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3406
3724
|
function matchesAccept(file, accept) {
|
|
3407
3725
|
if (!accept) return true;
|
|
@@ -3463,8 +3781,8 @@ function FileUpload({
|
|
|
3463
3781
|
className,
|
|
3464
3782
|
...props
|
|
3465
3783
|
}) {
|
|
3466
|
-
const inputRef = (0,
|
|
3467
|
-
const [isDragging, setIsDragging] = (0,
|
|
3784
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
3785
|
+
const [isDragging, setIsDragging] = (0, import_react18.useState)(false);
|
|
3468
3786
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3469
3787
|
name: "FileUpload",
|
|
3470
3788
|
id: externalId,
|
|
@@ -3599,7 +3917,7 @@ function FileUpload({
|
|
|
3599
3917
|
}
|
|
3600
3918
|
|
|
3601
3919
|
// src/components/Slider/Slider.tsx
|
|
3602
|
-
var
|
|
3920
|
+
var import_react19 = require("react");
|
|
3603
3921
|
var import_radix_ui21 = require("radix-ui");
|
|
3604
3922
|
var import_class_variance_authority28 = require("class-variance-authority");
|
|
3605
3923
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -3641,7 +3959,7 @@ function Slider({
|
|
|
3641
3959
|
className,
|
|
3642
3960
|
...props
|
|
3643
3961
|
}) {
|
|
3644
|
-
const labelId = (0,
|
|
3962
|
+
const labelId = (0, import_react19.useId)();
|
|
3645
3963
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3646
3964
|
name: "Slider",
|
|
3647
3965
|
id: externalId,
|
|
@@ -3700,7 +4018,7 @@ function Slider({
|
|
|
3700
4018
|
}
|
|
3701
4019
|
|
|
3702
4020
|
// src/components/NumberInput/NumberInput.tsx
|
|
3703
|
-
var
|
|
4021
|
+
var import_react20 = require("react");
|
|
3704
4022
|
var import_class_variance_authority29 = require("class-variance-authority");
|
|
3705
4023
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3706
4024
|
var numberInputVariants = (0, import_class_variance_authority29.cva)("ddga-number-input", {
|
|
@@ -3752,9 +4070,9 @@ function NumberInput({
|
|
|
3752
4070
|
...props
|
|
3753
4071
|
}) {
|
|
3754
4072
|
const isControlled = value !== void 0;
|
|
3755
|
-
const [internal, setInternal] = (0,
|
|
4073
|
+
const [internal, setInternal] = (0, import_react20.useState)(defaultValue ?? null);
|
|
3756
4074
|
const numericValue = isControlled ? value : internal;
|
|
3757
|
-
const [draft, setDraft] = (0,
|
|
4075
|
+
const [draft, setDraft] = (0, import_react20.useState)(null);
|
|
3758
4076
|
const allowDecimal = !Number.isInteger(step);
|
|
3759
4077
|
const allowNegative = min == null || min < 0;
|
|
3760
4078
|
const displayValue = draft ?? (numericValue == null ? "" : formatNumber(numericValue));
|
|
@@ -3875,7 +4193,7 @@ function NumberInput({
|
|
|
3875
4193
|
}
|
|
3876
4194
|
|
|
3877
4195
|
// src/components/Rating/Rating.tsx
|
|
3878
|
-
var
|
|
4196
|
+
var import_react21 = require("react");
|
|
3879
4197
|
var import_class_variance_authority30 = require("class-variance-authority");
|
|
3880
4198
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3881
4199
|
var ratingVariants = (0, import_class_variance_authority30.cva)("ddga-rating", {
|
|
@@ -3919,11 +4237,11 @@ function Rating({
|
|
|
3919
4237
|
className,
|
|
3920
4238
|
...props
|
|
3921
4239
|
}) {
|
|
3922
|
-
const rootRef = (0,
|
|
4240
|
+
const rootRef = (0, import_react21.useRef)(null);
|
|
3923
4241
|
const isControlled = value !== void 0;
|
|
3924
|
-
const [internal, setInternal] = (0,
|
|
4242
|
+
const [internal, setInternal] = (0, import_react21.useState)(defaultValue ?? 0);
|
|
3925
4243
|
const currentValue = isControlled ? value : internal;
|
|
3926
|
-
const [hover, setHover] = (0,
|
|
4244
|
+
const [hover, setHover] = (0, import_react21.useState)(null);
|
|
3927
4245
|
const interactive = !readOnly && !disabled;
|
|
3928
4246
|
const stepSize = allowHalf ? 0.5 : 1;
|
|
3929
4247
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
@@ -4170,78 +4488,2255 @@ function DescriptionDetails({ className, ...props }) {
|
|
|
4170
4488
|
);
|
|
4171
4489
|
}
|
|
4172
4490
|
|
|
4173
|
-
// src/
|
|
4174
|
-
var
|
|
4491
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
4492
|
+
var import_react22 = require("react");
|
|
4175
4493
|
var import_radix_ui23 = require("radix-ui");
|
|
4176
|
-
var
|
|
4494
|
+
var import_class_variance_authority33 = require("class-variance-authority");
|
|
4177
4495
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4496
|
+
var emptyStateVariants = (0, import_class_variance_authority33.cva)("ddga-empty-state", {
|
|
4497
|
+
variants: {
|
|
4498
|
+
variant: {
|
|
4499
|
+
default: "ddga-empty-state--default",
|
|
4500
|
+
search: "ddga-empty-state--search",
|
|
4501
|
+
error: "ddga-empty-state--error",
|
|
4502
|
+
success: "ddga-empty-state--success"
|
|
4503
|
+
},
|
|
4504
|
+
size: {
|
|
4505
|
+
sm: "ddga-empty-state--sm",
|
|
4506
|
+
md: "ddga-empty-state--md",
|
|
4507
|
+
lg: "ddga-empty-state--lg"
|
|
4508
|
+
}
|
|
4509
|
+
},
|
|
4510
|
+
defaultVariants: {
|
|
4511
|
+
variant: "default",
|
|
4512
|
+
size: "md"
|
|
4513
|
+
}
|
|
4514
|
+
});
|
|
4515
|
+
var DEFAULT_ICONS3 = {
|
|
4516
|
+
default: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Inbox, { "aria-hidden": "true" }),
|
|
4517
|
+
search: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Search, { "aria-hidden": "true" }),
|
|
4518
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AlertCircle, { "aria-hidden": "true" }),
|
|
4519
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Check, { "aria-hidden": "true" })
|
|
4520
|
+
};
|
|
4521
|
+
function EmptyState({
|
|
4522
|
+
variant,
|
|
4523
|
+
size,
|
|
4524
|
+
icon,
|
|
4525
|
+
title,
|
|
4526
|
+
description,
|
|
4527
|
+
action,
|
|
4528
|
+
secondaryAction,
|
|
4184
4529
|
className,
|
|
4185
|
-
|
|
4186
|
-
|
|
4530
|
+
children,
|
|
4531
|
+
...props
|
|
4187
4532
|
}) {
|
|
4188
|
-
const
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
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
|
-
}
|
|
4533
|
+
const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS3[variant ?? "default"];
|
|
4534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4535
|
+
"div",
|
|
4536
|
+
{
|
|
4537
|
+
"data-slot": "empty-state",
|
|
4538
|
+
"data-variant": variant ?? "default",
|
|
4539
|
+
"data-size": size ?? "md",
|
|
4540
|
+
className: cn(emptyStateVariants({ variant, size }), className),
|
|
4541
|
+
...props,
|
|
4542
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
4543
|
+
resolvedIcon ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmptyStateMedia, { children: resolvedIcon }) : null,
|
|
4544
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmptyStateTitle, { children: title }) : null,
|
|
4545
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmptyStateDescription, { children: description }) : null,
|
|
4546
|
+
action || secondaryAction ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(EmptyStateActions, { children: [
|
|
4547
|
+
action,
|
|
4548
|
+
secondaryAction
|
|
4549
|
+
] }) : null
|
|
4550
|
+
] })
|
|
4220
4551
|
}
|
|
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]
|
|
4225
4552
|
);
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4553
|
+
}
|
|
4554
|
+
function EmptyStateMedia({ className, ...props }) {
|
|
4555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4556
|
+
"div",
|
|
4229
4557
|
{
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
"data-theme": mode,
|
|
4235
|
-
className,
|
|
4236
|
-
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
4237
|
-
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_radix_ui23.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
4558
|
+
"data-slot": "empty-state-media",
|
|
4559
|
+
"aria-hidden": "true",
|
|
4560
|
+
className: cn("ddga-empty-state__media", className),
|
|
4561
|
+
...props
|
|
4238
4562
|
}
|
|
4239
|
-
)
|
|
4563
|
+
);
|
|
4240
4564
|
}
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4565
|
+
function EmptyStateTitle({ asChild, className, ...props }) {
|
|
4566
|
+
const Comp = asChild ? import_radix_ui23.Slot.Slot : "h3";
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4568
|
+
Comp,
|
|
4569
|
+
{
|
|
4570
|
+
"data-slot": "empty-state-title",
|
|
4571
|
+
className: cn("ddga-empty-state__title", className),
|
|
4572
|
+
...props
|
|
4573
|
+
}
|
|
4574
|
+
);
|
|
4575
|
+
}
|
|
4576
|
+
function EmptyStateDescription({ asChild, className, ...props }) {
|
|
4577
|
+
const Comp = asChild ? import_radix_ui23.Slot.Slot : "p";
|
|
4578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4579
|
+
Comp,
|
|
4580
|
+
{
|
|
4581
|
+
"data-slot": "empty-state-description",
|
|
4582
|
+
className: cn("ddga-empty-state__description", className),
|
|
4583
|
+
...props
|
|
4584
|
+
}
|
|
4585
|
+
);
|
|
4586
|
+
}
|
|
4587
|
+
function EmptyStateActions({ asChild, className, ...props }) {
|
|
4588
|
+
const Comp = asChild ? import_radix_ui23.Slot.Slot : "div";
|
|
4589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4590
|
+
Comp,
|
|
4591
|
+
{
|
|
4592
|
+
"data-slot": "empty-state-actions",
|
|
4593
|
+
className: cn("ddga-empty-state__actions", className),
|
|
4594
|
+
...props
|
|
4595
|
+
}
|
|
4596
|
+
);
|
|
4597
|
+
}
|
|
4598
|
+
|
|
4599
|
+
// src/components/Stat/Stat.tsx
|
|
4600
|
+
var import_react23 = require("react");
|
|
4601
|
+
var import_class_variance_authority34 = require("class-variance-authority");
|
|
4602
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4603
|
+
var statVariants = (0, import_class_variance_authority34.cva)("ddga-stat", {
|
|
4604
|
+
variants: {
|
|
4605
|
+
variant: {
|
|
4606
|
+
flat: "ddga-stat--flat",
|
|
4607
|
+
elevated: "ddga-stat--elevated",
|
|
4608
|
+
accent: "ddga-stat--accent",
|
|
4609
|
+
// Soft sentiment-tinted gradient surface (reuses the accent tint vars).
|
|
4610
|
+
gradient: "ddga-stat--gradient"
|
|
4611
|
+
},
|
|
4612
|
+
size: {
|
|
4613
|
+
sm: "ddga-stat--sm",
|
|
4614
|
+
md: "ddga-stat--md",
|
|
4615
|
+
lg: "ddga-stat--lg",
|
|
4616
|
+
// Hero/display size for headline KPIs (display-scale value).
|
|
4617
|
+
xl: "ddga-stat--xl"
|
|
4618
|
+
}
|
|
4619
|
+
},
|
|
4620
|
+
defaultVariants: {
|
|
4621
|
+
variant: "flat",
|
|
4622
|
+
size: "md"
|
|
4623
|
+
}
|
|
4624
|
+
});
|
|
4625
|
+
var TREND_ICONS = {
|
|
4626
|
+
up: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CaretUp, { "aria-hidden": "true" }),
|
|
4627
|
+
down: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CaretDown, { "aria-hidden": "true" }),
|
|
4628
|
+
flat: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Minus, { "aria-hidden": "true" })
|
|
4629
|
+
};
|
|
4630
|
+
var TREND_SENTIMENT = {
|
|
4631
|
+
up: "positive",
|
|
4632
|
+
down: "negative",
|
|
4633
|
+
flat: "neutral"
|
|
4634
|
+
};
|
|
4635
|
+
function resolveSentiment(trend, sentiment) {
|
|
4636
|
+
if (sentiment) return sentiment;
|
|
4637
|
+
if (trend) return TREND_SENTIMENT[trend];
|
|
4638
|
+
return void 0;
|
|
4639
|
+
}
|
|
4640
|
+
function Stat({
|
|
4641
|
+
variant,
|
|
4642
|
+
size,
|
|
4643
|
+
label,
|
|
4644
|
+
value,
|
|
4645
|
+
change,
|
|
4646
|
+
changeLabel,
|
|
4647
|
+
trend,
|
|
4648
|
+
sentiment,
|
|
4649
|
+
changeVariant,
|
|
4650
|
+
icon,
|
|
4651
|
+
className,
|
|
4652
|
+
children,
|
|
4653
|
+
...props
|
|
4654
|
+
}) {
|
|
4655
|
+
const resolvedSentiment = resolveSentiment(trend, sentiment);
|
|
4656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4657
|
+
"div",
|
|
4658
|
+
{
|
|
4659
|
+
"data-slot": "stat",
|
|
4660
|
+
"data-variant": variant ?? "flat",
|
|
4661
|
+
"data-trend": trend,
|
|
4662
|
+
"data-sentiment": resolvedSentiment,
|
|
4663
|
+
className: cn(statVariants({ variant, size }), className),
|
|
4664
|
+
...props,
|
|
4665
|
+
children: [
|
|
4666
|
+
label || icon ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ddga-stat__label-row", children: [
|
|
4667
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatLabel, { children: label }) : null,
|
|
4668
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__icon", "aria-hidden": "true", children: icon }) : null
|
|
4669
|
+
] }) : null,
|
|
4670
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatValue, { children: value }) : null,
|
|
4671
|
+
change || changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ddga-stat__change-row", children: [
|
|
4672
|
+
change ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatChange, { trend, sentiment, variant: changeVariant, children: change }) : null,
|
|
4673
|
+
changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__change-label", children: changeLabel }) : null
|
|
4674
|
+
] }) : null,
|
|
4675
|
+
children
|
|
4676
|
+
]
|
|
4677
|
+
}
|
|
4678
|
+
);
|
|
4679
|
+
}
|
|
4680
|
+
function StatLabel({ className, ...props }) {
|
|
4681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-label", className: cn("ddga-stat__label", className), ...props });
|
|
4682
|
+
}
|
|
4683
|
+
function StatValue({ className, ...props }) {
|
|
4684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-value", className: cn("ddga-stat__value", className), ...props });
|
|
4685
|
+
}
|
|
4686
|
+
function StatChart({ className, ...props }) {
|
|
4687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-chart", className: cn("ddga-stat__chart", className), ...props });
|
|
4688
|
+
}
|
|
4689
|
+
function StatChange({ trend, sentiment, variant, className, children, ...props }) {
|
|
4690
|
+
const resolvedSentiment = resolveSentiment(trend, sentiment);
|
|
4691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4692
|
+
"div",
|
|
4693
|
+
{
|
|
4694
|
+
"data-slot": "stat-change",
|
|
4695
|
+
"data-trend": trend,
|
|
4696
|
+
"data-sentiment": resolvedSentiment,
|
|
4697
|
+
className: cn(
|
|
4698
|
+
"ddga-stat__change",
|
|
4699
|
+
resolvedSentiment ? `ddga-stat__change--${resolvedSentiment}` : null,
|
|
4700
|
+
variant === "chip" && "ddga-stat__change--chip",
|
|
4701
|
+
className
|
|
4702
|
+
),
|
|
4703
|
+
...props,
|
|
4704
|
+
children: [
|
|
4705
|
+
trend ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__change-icon", children: TREND_ICONS[trend] }) : null,
|
|
4706
|
+
children
|
|
4707
|
+
]
|
|
4708
|
+
}
|
|
4709
|
+
);
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4712
|
+
// src/components/Stat/StatGroup.tsx
|
|
4713
|
+
var import_class_variance_authority35 = require("class-variance-authority");
|
|
4714
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4715
|
+
var statGroupVariants = (0, import_class_variance_authority35.cva)("ddga-stat-group", {
|
|
4716
|
+
variants: {
|
|
4717
|
+
orientation: {
|
|
4718
|
+
horizontal: "ddga-stat-group--horizontal",
|
|
4719
|
+
vertical: "ddga-stat-group--vertical"
|
|
4720
|
+
},
|
|
4721
|
+
gap: {
|
|
4722
|
+
sm: "ddga-stat-group--gap-sm",
|
|
4723
|
+
md: "ddga-stat-group--gap-md",
|
|
4724
|
+
lg: "ddga-stat-group--gap-lg"
|
|
4725
|
+
}
|
|
4726
|
+
},
|
|
4727
|
+
defaultVariants: {
|
|
4728
|
+
orientation: "horizontal",
|
|
4729
|
+
gap: "md"
|
|
4730
|
+
}
|
|
4731
|
+
});
|
|
4732
|
+
function StatGroup({ orientation, gap, columns, className, style, ...props }) {
|
|
4733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4734
|
+
"div",
|
|
4735
|
+
{
|
|
4736
|
+
"data-slot": "stat-group",
|
|
4737
|
+
className: cn(
|
|
4738
|
+
statGroupVariants({ orientation, gap }),
|
|
4739
|
+
columns != null && "ddga-stat-group--cols",
|
|
4740
|
+
className
|
|
4741
|
+
),
|
|
4742
|
+
style: columns != null ? { "--ddga-stat-group-columns": columns, ...style } : style,
|
|
4743
|
+
...props
|
|
4744
|
+
}
|
|
4745
|
+
);
|
|
4746
|
+
}
|
|
4747
|
+
|
|
4748
|
+
// src/components/Popover/Popover.tsx
|
|
4749
|
+
var import_react24 = require("react");
|
|
4750
|
+
var import_radix_ui24 = require("radix-ui");
|
|
4751
|
+
var import_class_variance_authority36 = require("class-variance-authority");
|
|
4752
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4753
|
+
var popoverContentVariants = (0, import_class_variance_authority36.cva)("ddga-popover", {
|
|
4754
|
+
variants: {
|
|
4755
|
+
size: {
|
|
4756
|
+
sm: "ddga-popover--sm",
|
|
4757
|
+
md: "ddga-popover--md"
|
|
4758
|
+
}
|
|
4759
|
+
},
|
|
4760
|
+
defaultVariants: {
|
|
4761
|
+
size: "md"
|
|
4762
|
+
}
|
|
4763
|
+
});
|
|
4764
|
+
function Popover(props) {
|
|
4765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Root, { ...props });
|
|
4766
|
+
}
|
|
4767
|
+
function PopoverTrigger({ className, ...props }) {
|
|
4768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Trigger, { "data-slot": "popover-trigger", className, ...props });
|
|
4769
|
+
}
|
|
4770
|
+
function PopoverAnchor(props) {
|
|
4771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
4772
|
+
}
|
|
4773
|
+
function PopoverContent({
|
|
4774
|
+
size,
|
|
4775
|
+
arrow = false,
|
|
4776
|
+
sideOffset = 6,
|
|
4777
|
+
className,
|
|
4778
|
+
children,
|
|
4779
|
+
...props
|
|
4780
|
+
}) {
|
|
4781
|
+
if (process.env.NODE_ENV === "development" && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
4782
|
+
console.warn(
|
|
4783
|
+
'[@dev-dga/react] PopoverContent renders role="dialog" and should have an `aria-label` or `aria-labelledby` so the panel has an accessible name.'
|
|
4784
|
+
);
|
|
4785
|
+
}
|
|
4786
|
+
const ctx = (0, import_react24.useContext)(DgaContext);
|
|
4787
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
4788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
4789
|
+
import_radix_ui24.Popover.Content,
|
|
4790
|
+
{
|
|
4791
|
+
"data-slot": "popover-content",
|
|
4792
|
+
sideOffset,
|
|
4793
|
+
className: cn(popoverContentVariants({ size }), className),
|
|
4794
|
+
...props,
|
|
4795
|
+
children: [
|
|
4796
|
+
children,
|
|
4797
|
+
arrow ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Arrow, { className: "ddga-popover__arrow", width: 16, height: 8 }) : null
|
|
4798
|
+
]
|
|
4799
|
+
}
|
|
4800
|
+
) });
|
|
4801
|
+
}
|
|
4802
|
+
function PopoverClose({
|
|
4803
|
+
className,
|
|
4804
|
+
children,
|
|
4805
|
+
closeLabel = "Close",
|
|
4806
|
+
asChild,
|
|
4807
|
+
...props
|
|
4808
|
+
}) {
|
|
4809
|
+
const hasRenderableChildren = children != null && children !== false;
|
|
4810
|
+
if (asChild || hasRenderableChildren) {
|
|
4811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4812
|
+
import_radix_ui24.Popover.Close,
|
|
4813
|
+
{
|
|
4814
|
+
"data-slot": "popover-close",
|
|
4815
|
+
asChild,
|
|
4816
|
+
className,
|
|
4817
|
+
...props,
|
|
4818
|
+
children
|
|
4819
|
+
}
|
|
4820
|
+
);
|
|
4821
|
+
}
|
|
4822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4823
|
+
import_radix_ui24.Popover.Close,
|
|
4824
|
+
{
|
|
4825
|
+
"data-slot": "popover-close",
|
|
4826
|
+
"aria-label": closeLabel,
|
|
4827
|
+
className: cn("ddga-popover__close", className),
|
|
4828
|
+
...props,
|
|
4829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Close, { "aria-hidden": "true" })
|
|
4830
|
+
}
|
|
4831
|
+
);
|
|
4832
|
+
}
|
|
4833
|
+
|
|
4834
|
+
// src/components/Sidebar/Sidebar.tsx
|
|
4835
|
+
var import_react27 = require("react");
|
|
4836
|
+
var import_radix_ui25 = require("radix-ui");
|
|
4837
|
+
|
|
4838
|
+
// src/components/Sidebar/SidebarContext.ts
|
|
4839
|
+
var import_react25 = require("react");
|
|
4840
|
+
var SidebarContext = (0, import_react25.createContext)(null);
|
|
4841
|
+
function useSidebar() {
|
|
4842
|
+
const ctx = (0, import_react25.useContext)(SidebarContext);
|
|
4843
|
+
if (!ctx) {
|
|
4844
|
+
throw new Error("useSidebar must be used within a <SidebarProvider>");
|
|
4845
|
+
}
|
|
4846
|
+
return ctx;
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
// src/components/Sidebar/useIsMobile.ts
|
|
4850
|
+
var import_react26 = require("react");
|
|
4851
|
+
function useIsMobile(breakpoint = 768) {
|
|
4852
|
+
const [isMobile, setIsMobile] = (0, import_react26.useState)(false);
|
|
4853
|
+
(0, import_react26.useEffect)(() => {
|
|
4854
|
+
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
4855
|
+
const onChange = () => setIsMobile(mql.matches);
|
|
4856
|
+
onChange();
|
|
4857
|
+
mql.addEventListener("change", onChange);
|
|
4858
|
+
return () => mql.removeEventListener("change", onChange);
|
|
4859
|
+
}, [breakpoint]);
|
|
4860
|
+
return isMobile;
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
// src/components/Sidebar/Sidebar.tsx
|
|
4864
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4865
|
+
function SidebarProvider({
|
|
4866
|
+
defaultOpen = true,
|
|
4867
|
+
open: openProp,
|
|
4868
|
+
onOpenChange,
|
|
4869
|
+
mobileBreakpoint = 768,
|
|
4870
|
+
keyboardShortcut = true,
|
|
4871
|
+
className,
|
|
4872
|
+
style,
|
|
4873
|
+
children,
|
|
4874
|
+
...props
|
|
4875
|
+
}) {
|
|
4876
|
+
const isMobile = useIsMobile(mobileBreakpoint);
|
|
4877
|
+
const [openMobile, setOpenMobile] = (0, import_react27.useState)(false);
|
|
4878
|
+
const isControlled = openProp !== void 0;
|
|
4879
|
+
const [openInternal, setOpenInternal] = (0, import_react27.useState)(defaultOpen);
|
|
4880
|
+
const open = isControlled ? openProp : openInternal;
|
|
4881
|
+
const setOpen = (0, import_react27.useCallback)(
|
|
4882
|
+
(value2) => {
|
|
4883
|
+
if (!isControlled) setOpenInternal(value2);
|
|
4884
|
+
onOpenChange?.(value2);
|
|
4885
|
+
},
|
|
4886
|
+
[isControlled, onOpenChange]
|
|
4887
|
+
);
|
|
4888
|
+
const toggleSidebar = (0, import_react27.useCallback)(() => {
|
|
4889
|
+
if (isMobile) {
|
|
4890
|
+
setOpenMobile((v) => !v);
|
|
4891
|
+
return;
|
|
4892
|
+
}
|
|
4893
|
+
if (isControlled) {
|
|
4894
|
+
onOpenChange?.(!open);
|
|
4895
|
+
} else {
|
|
4896
|
+
setOpenInternal((v) => !v);
|
|
4897
|
+
}
|
|
4898
|
+
}, [isMobile, isControlled, onOpenChange, open]);
|
|
4899
|
+
(0, import_react27.useEffect)(() => {
|
|
4900
|
+
if (!keyboardShortcut) return;
|
|
4901
|
+
const onKeyDown = (e) => {
|
|
4902
|
+
if (e.key.toLowerCase() === "b" && (e.metaKey || e.ctrlKey)) {
|
|
4903
|
+
e.preventDefault();
|
|
4904
|
+
toggleSidebar();
|
|
4905
|
+
}
|
|
4906
|
+
};
|
|
4907
|
+
window.addEventListener("keydown", onKeyDown);
|
|
4908
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
4909
|
+
}, [keyboardShortcut, toggleSidebar]);
|
|
4910
|
+
const state = open ? "expanded" : "collapsed";
|
|
4911
|
+
const value = (0, import_react27.useMemo)(
|
|
4912
|
+
() => ({ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }),
|
|
4913
|
+
[state, open, setOpen, openMobile, isMobile, toggleSidebar]
|
|
4914
|
+
);
|
|
4915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SidebarContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4916
|
+
"div",
|
|
4917
|
+
{
|
|
4918
|
+
"data-slot": "sidebar-wrapper",
|
|
4919
|
+
className: cn("ddga-sidebar-wrapper", className),
|
|
4920
|
+
style,
|
|
4921
|
+
...props,
|
|
4922
|
+
children
|
|
4923
|
+
}
|
|
4924
|
+
) });
|
|
4925
|
+
}
|
|
4926
|
+
function Sidebar({
|
|
4927
|
+
variant = "sidebar",
|
|
4928
|
+
collapsible = "icon",
|
|
4929
|
+
side = "start",
|
|
4930
|
+
className,
|
|
4931
|
+
children,
|
|
4932
|
+
"aria-label": ariaLabel = "Sidebar",
|
|
4933
|
+
...props
|
|
4934
|
+
}) {
|
|
4935
|
+
const { isMobile, openMobile, setOpenMobile, state } = useSidebar();
|
|
4936
|
+
if (isMobile) {
|
|
4937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Drawer, { open: openMobile, onOpenChange: setOpenMobile, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4938
|
+
DrawerContent,
|
|
4939
|
+
{
|
|
4940
|
+
side,
|
|
4941
|
+
size: "sm",
|
|
4942
|
+
"aria-label": ariaLabel,
|
|
4943
|
+
"data-mobile": "true",
|
|
4944
|
+
"data-variant": variant,
|
|
4945
|
+
"data-side": side,
|
|
4946
|
+
className: cn("ddga-sidebar", "ddga-sidebar--mobile", className),
|
|
4947
|
+
children
|
|
4948
|
+
}
|
|
4949
|
+
) });
|
|
4950
|
+
}
|
|
4951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4952
|
+
"aside",
|
|
4953
|
+
{
|
|
4954
|
+
"data-slot": "sidebar",
|
|
4955
|
+
"aria-label": ariaLabel,
|
|
4956
|
+
"data-state": state,
|
|
4957
|
+
"data-collapsible": collapsible,
|
|
4958
|
+
"data-variant": variant,
|
|
4959
|
+
"data-side": side,
|
|
4960
|
+
className: cn("ddga-sidebar", className),
|
|
4961
|
+
...props,
|
|
4962
|
+
children
|
|
4963
|
+
}
|
|
4964
|
+
);
|
|
4965
|
+
}
|
|
4966
|
+
function SidebarTrigger({
|
|
4967
|
+
asChild,
|
|
4968
|
+
className,
|
|
4969
|
+
onClick,
|
|
4970
|
+
children,
|
|
4971
|
+
"aria-label": ariaLabel = "Toggle sidebar",
|
|
4972
|
+
...props
|
|
4973
|
+
}) {
|
|
4974
|
+
const { toggleSidebar, open, openMobile, isMobile } = useSidebar();
|
|
4975
|
+
const Comp = asChild ? import_radix_ui25.Slot.Slot : "button";
|
|
4976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4977
|
+
Comp,
|
|
4978
|
+
{
|
|
4979
|
+
type: asChild ? void 0 : "button",
|
|
4980
|
+
"data-slot": "sidebar-trigger",
|
|
4981
|
+
"aria-label": asChild ? void 0 : ariaLabel,
|
|
4982
|
+
"aria-haspopup": isMobile ? "dialog" : void 0,
|
|
4983
|
+
"aria-expanded": isMobile ? openMobile : open,
|
|
4984
|
+
className: cn("ddga-sidebar__trigger", className),
|
|
4985
|
+
onClick: (e) => {
|
|
4986
|
+
onClick?.(e);
|
|
4987
|
+
toggleSidebar();
|
|
4988
|
+
},
|
|
4989
|
+
...props,
|
|
4990
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PanelLeft, { "aria-hidden": "true" })
|
|
4991
|
+
}
|
|
4992
|
+
);
|
|
4993
|
+
}
|
|
4994
|
+
function SidebarRail({
|
|
4995
|
+
className,
|
|
4996
|
+
"aria-label": ariaLabel = "Toggle sidebar",
|
|
4997
|
+
...props
|
|
4998
|
+
}) {
|
|
4999
|
+
const { toggleSidebar } = useSidebar();
|
|
5000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5001
|
+
"button",
|
|
5002
|
+
{
|
|
5003
|
+
type: "button",
|
|
5004
|
+
"data-slot": "sidebar-rail",
|
|
5005
|
+
"aria-label": ariaLabel,
|
|
5006
|
+
title: ariaLabel,
|
|
5007
|
+
tabIndex: -1,
|
|
5008
|
+
className: cn("ddga-sidebar__rail", className),
|
|
5009
|
+
onClick: toggleSidebar,
|
|
5010
|
+
...props
|
|
5011
|
+
}
|
|
5012
|
+
);
|
|
5013
|
+
}
|
|
5014
|
+
function SidebarInset({ asChild, className, ...props }) {
|
|
5015
|
+
const Comp = asChild ? import_radix_ui25.Slot.Slot : "main";
|
|
5016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { "data-slot": "sidebar-inset", className: cn("ddga-sidebar-inset", className), ...props });
|
|
5017
|
+
}
|
|
5018
|
+
function SidebarHeader({ asChild, className, ...props }) {
|
|
5019
|
+
const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
|
|
5020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { "data-slot": "sidebar-header", className: cn("ddga-sidebar__header", className), ...props });
|
|
5021
|
+
}
|
|
5022
|
+
function SidebarContent({ asChild, className, ...props }) {
|
|
5023
|
+
const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
|
|
5024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5025
|
+
Comp,
|
|
5026
|
+
{
|
|
5027
|
+
"data-slot": "sidebar-content",
|
|
5028
|
+
className: cn("ddga-sidebar__content", className),
|
|
5029
|
+
...props
|
|
5030
|
+
}
|
|
5031
|
+
);
|
|
5032
|
+
}
|
|
5033
|
+
function SidebarFooter({ asChild, className, ...props }) {
|
|
5034
|
+
const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
|
|
5035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { "data-slot": "sidebar-footer", className: cn("ddga-sidebar__footer", className), ...props });
|
|
5036
|
+
}
|
|
5037
|
+
function SidebarSeparator({ className, ...props }) {
|
|
5038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5039
|
+
"hr",
|
|
5040
|
+
{
|
|
5041
|
+
"data-slot": "sidebar-separator",
|
|
5042
|
+
className: cn("ddga-sidebar__separator", className),
|
|
5043
|
+
...props
|
|
5044
|
+
}
|
|
5045
|
+
);
|
|
5046
|
+
}
|
|
5047
|
+
|
|
5048
|
+
// src/components/Sidebar/SidebarGroup.tsx
|
|
5049
|
+
var import_radix_ui26 = require("radix-ui");
|
|
5050
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5051
|
+
function SidebarGroup({ asChild, className, ...props }) {
|
|
5052
|
+
const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
|
|
5053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5054
|
+
Comp,
|
|
5055
|
+
{
|
|
5056
|
+
"data-slot": "sidebar-group",
|
|
5057
|
+
role: "group",
|
|
5058
|
+
className: cn("ddga-sidebar__group", className),
|
|
5059
|
+
...props
|
|
5060
|
+
}
|
|
5061
|
+
);
|
|
5062
|
+
}
|
|
5063
|
+
function SidebarGroupLabel({ asChild, className, ...props }) {
|
|
5064
|
+
const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
|
|
5065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5066
|
+
Comp,
|
|
5067
|
+
{
|
|
5068
|
+
"data-slot": "sidebar-group-label",
|
|
5069
|
+
className: cn("ddga-sidebar__group-label", className),
|
|
5070
|
+
...props
|
|
5071
|
+
}
|
|
5072
|
+
);
|
|
5073
|
+
}
|
|
5074
|
+
function SidebarGroupAction({ asChild, className, ...props }) {
|
|
5075
|
+
const Comp = asChild ? import_radix_ui26.Slot.Slot : "button";
|
|
5076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5077
|
+
Comp,
|
|
5078
|
+
{
|
|
5079
|
+
type: asChild ? void 0 : "button",
|
|
5080
|
+
"data-slot": "sidebar-group-action",
|
|
5081
|
+
className: cn("ddga-sidebar__group-action", className),
|
|
5082
|
+
...props
|
|
5083
|
+
}
|
|
5084
|
+
);
|
|
5085
|
+
}
|
|
5086
|
+
function SidebarGroupContent({ asChild, className, ...props }) {
|
|
5087
|
+
const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
|
|
5088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5089
|
+
Comp,
|
|
5090
|
+
{
|
|
5091
|
+
"data-slot": "sidebar-group-content",
|
|
5092
|
+
className: cn("ddga-sidebar__group-content", className),
|
|
5093
|
+
...props
|
|
5094
|
+
}
|
|
5095
|
+
);
|
|
5096
|
+
}
|
|
5097
|
+
|
|
5098
|
+
// src/components/Sidebar/SidebarMenu.tsx
|
|
5099
|
+
var import_radix_ui27 = require("radix-ui");
|
|
5100
|
+
var import_class_variance_authority37 = require("class-variance-authority");
|
|
5101
|
+
|
|
5102
|
+
// src/hooks/useDir.ts
|
|
5103
|
+
function useDir() {
|
|
5104
|
+
return useDga().dir;
|
|
5105
|
+
}
|
|
5106
|
+
|
|
5107
|
+
// src/components/Sidebar/SidebarMenu.tsx
|
|
5108
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5109
|
+
function SidebarMenu({ className, ...props }) {
|
|
5110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { "data-slot": "sidebar-menu", className: cn("ddga-sidebar__menu", className), ...props });
|
|
5111
|
+
}
|
|
5112
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
5113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5114
|
+
"li",
|
|
5115
|
+
{
|
|
5116
|
+
"data-slot": "sidebar-menu-item",
|
|
5117
|
+
className: cn("ddga-sidebar__menu-item", className),
|
|
5118
|
+
...props
|
|
5119
|
+
}
|
|
5120
|
+
);
|
|
5121
|
+
}
|
|
5122
|
+
var sidebarMenuButtonVariants = (0, import_class_variance_authority37.cva)("ddga-sidebar__menu-button", {
|
|
5123
|
+
variants: {
|
|
5124
|
+
size: {
|
|
5125
|
+
sm: "ddga-sidebar__menu-button--sm",
|
|
5126
|
+
md: "ddga-sidebar__menu-button--md",
|
|
5127
|
+
lg: "ddga-sidebar__menu-button--lg"
|
|
5128
|
+
}
|
|
5129
|
+
},
|
|
5130
|
+
defaultVariants: { size: "md" }
|
|
5131
|
+
});
|
|
5132
|
+
function SidebarMenuButton({
|
|
5133
|
+
asChild,
|
|
5134
|
+
isActive,
|
|
5135
|
+
size,
|
|
5136
|
+
tooltip,
|
|
5137
|
+
className,
|
|
5138
|
+
...props
|
|
5139
|
+
}) {
|
|
5140
|
+
const { state, isMobile } = useSidebar();
|
|
5141
|
+
const dir = useDir();
|
|
5142
|
+
const Comp = asChild ? import_radix_ui27.Slot.Slot : "button";
|
|
5143
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5144
|
+
Comp,
|
|
5145
|
+
{
|
|
5146
|
+
type: asChild ? void 0 : "button",
|
|
5147
|
+
"data-slot": "sidebar-menu-button",
|
|
5148
|
+
"data-active": isActive || void 0,
|
|
5149
|
+
"data-size": size ?? "md",
|
|
5150
|
+
"aria-current": isActive ? "page" : void 0,
|
|
5151
|
+
className: cn(sidebarMenuButtonVariants({ size }), className),
|
|
5152
|
+
...props
|
|
5153
|
+
}
|
|
5154
|
+
);
|
|
5155
|
+
if (!tooltip || state !== "collapsed" || isMobile) {
|
|
5156
|
+
return button;
|
|
5157
|
+
}
|
|
5158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
5159
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-slot": "tooltip-trigger", style: { display: "contents" }, children: button }) }),
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { side: dir === "rtl" ? "left" : "right", children: tooltip })
|
|
5161
|
+
] });
|
|
5162
|
+
}
|
|
5163
|
+
function SidebarMenuAction({ asChild, showOnHover, className, ...props }) {
|
|
5164
|
+
const Comp = asChild ? import_radix_ui27.Slot.Slot : "button";
|
|
5165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5166
|
+
Comp,
|
|
5167
|
+
{
|
|
5168
|
+
type: asChild ? void 0 : "button",
|
|
5169
|
+
"data-slot": "sidebar-menu-action",
|
|
5170
|
+
"data-show-on-hover": showOnHover || void 0,
|
|
5171
|
+
className: cn("ddga-sidebar__menu-action", className),
|
|
5172
|
+
...props
|
|
5173
|
+
}
|
|
5174
|
+
);
|
|
5175
|
+
}
|
|
5176
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
5177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5178
|
+
"span",
|
|
5179
|
+
{
|
|
5180
|
+
"data-slot": "sidebar-menu-badge",
|
|
5181
|
+
className: cn("ddga-sidebar__menu-badge", className),
|
|
5182
|
+
...props
|
|
5183
|
+
}
|
|
5184
|
+
);
|
|
5185
|
+
}
|
|
5186
|
+
function SidebarMenuSkeleton({ showIcon, className, ...props }) {
|
|
5187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5188
|
+
"div",
|
|
5189
|
+
{
|
|
5190
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
5191
|
+
className: cn("ddga-sidebar__menu-skeleton", className),
|
|
5192
|
+
...props,
|
|
5193
|
+
children: [
|
|
5194
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { shape: "circle", width: "1rem", height: "1rem" }) : null,
|
|
5195
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { shape: "text", className: "ddga-sidebar__menu-skeleton-text" })
|
|
5196
|
+
]
|
|
5197
|
+
}
|
|
5198
|
+
);
|
|
5199
|
+
}
|
|
5200
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
5201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5202
|
+
"ul",
|
|
5203
|
+
{
|
|
5204
|
+
"data-slot": "sidebar-menu-sub",
|
|
5205
|
+
className: cn("ddga-sidebar__menu-sub", className),
|
|
5206
|
+
...props
|
|
5207
|
+
}
|
|
5208
|
+
);
|
|
5209
|
+
}
|
|
5210
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
5211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5212
|
+
"li",
|
|
5213
|
+
{
|
|
5214
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
5215
|
+
className: cn("ddga-sidebar__menu-sub-item", className),
|
|
5216
|
+
...props
|
|
5217
|
+
}
|
|
5218
|
+
);
|
|
5219
|
+
}
|
|
5220
|
+
var sidebarMenuSubButtonVariants = (0, import_class_variance_authority37.cva)("ddga-sidebar__menu-sub-button", {
|
|
5221
|
+
variants: {
|
|
5222
|
+
size: {
|
|
5223
|
+
sm: "ddga-sidebar__menu-sub-button--sm",
|
|
5224
|
+
md: "ddga-sidebar__menu-sub-button--md"
|
|
5225
|
+
}
|
|
5226
|
+
},
|
|
5227
|
+
defaultVariants: { size: "md" }
|
|
5228
|
+
});
|
|
5229
|
+
function SidebarMenuSubButton({
|
|
5230
|
+
asChild,
|
|
5231
|
+
isActive,
|
|
5232
|
+
size,
|
|
5233
|
+
className,
|
|
5234
|
+
...props
|
|
5235
|
+
}) {
|
|
5236
|
+
const Comp = asChild ? import_radix_ui27.Slot.Slot : "a";
|
|
5237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5238
|
+
Comp,
|
|
5239
|
+
{
|
|
5240
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
5241
|
+
"data-active": isActive || void 0,
|
|
5242
|
+
"data-size": size ?? "md",
|
|
5243
|
+
"aria-current": isActive ? "page" : void 0,
|
|
5244
|
+
className: cn(sidebarMenuSubButtonVariants({ size }), className),
|
|
5245
|
+
...props
|
|
5246
|
+
}
|
|
5247
|
+
);
|
|
5248
|
+
}
|
|
5249
|
+
|
|
5250
|
+
// src/components/ScrollArea/ScrollArea.tsx
|
|
5251
|
+
var import_radix_ui28 = require("radix-ui");
|
|
5252
|
+
var import_class_variance_authority38 = require("class-variance-authority");
|
|
5253
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5254
|
+
var scrollAreaVariants = (0, import_class_variance_authority38.cva)("ddga-scroll-area", {
|
|
5255
|
+
variants: {
|
|
5256
|
+
orientation: {
|
|
5257
|
+
vertical: "ddga-scroll-area--vertical",
|
|
5258
|
+
horizontal: "ddga-scroll-area--horizontal",
|
|
5259
|
+
both: "ddga-scroll-area--both"
|
|
5260
|
+
}
|
|
5261
|
+
},
|
|
5262
|
+
defaultVariants: {
|
|
5263
|
+
orientation: "vertical"
|
|
5264
|
+
}
|
|
5265
|
+
});
|
|
5266
|
+
function warnMissingLabel(ariaLabel, ariaLabelledby) {
|
|
5267
|
+
if (process.env.NODE_ENV === "production") return;
|
|
5268
|
+
if (ariaLabel || ariaLabelledby) return;
|
|
5269
|
+
console.warn(
|
|
5270
|
+
"[dga/ScrollArea] <ScrollArea> has no accessible name. The scroll viewport is keyboard-focusable; pass `aria-label` or `aria-labelledby` so screen-reader users know what region they are scrolling. If the content is itself focusable (e.g. a list of links) and you do not want a labelled region, pass `viewportProps={{ tabIndex: -1 }}`."
|
|
5271
|
+
);
|
|
5272
|
+
}
|
|
5273
|
+
function ScrollArea({
|
|
5274
|
+
className,
|
|
5275
|
+
orientation = "vertical",
|
|
5276
|
+
type = "hover",
|
|
5277
|
+
scrollHideDelay = 600,
|
|
5278
|
+
viewportRef,
|
|
5279
|
+
viewportProps,
|
|
5280
|
+
children,
|
|
5281
|
+
"aria-label": ariaLabel,
|
|
5282
|
+
"aria-labelledby": ariaLabelledby,
|
|
5283
|
+
...props
|
|
5284
|
+
}) {
|
|
5285
|
+
warnMissingLabel(ariaLabel, ariaLabelledby);
|
|
5286
|
+
const hasLabel = Boolean(ariaLabel || ariaLabelledby);
|
|
5287
|
+
const showVertical = orientation === "vertical" || orientation === "both";
|
|
5288
|
+
const showHorizontal = orientation === "horizontal" || orientation === "both";
|
|
5289
|
+
const { className: viewportClassName, ...restViewportProps } = viewportProps ?? {};
|
|
5290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5291
|
+
import_radix_ui28.ScrollArea.Root,
|
|
5292
|
+
{
|
|
5293
|
+
"data-slot": "scroll-area",
|
|
5294
|
+
type,
|
|
5295
|
+
scrollHideDelay,
|
|
5296
|
+
className: cn(scrollAreaVariants({ orientation }), className),
|
|
5297
|
+
...props,
|
|
5298
|
+
children: [
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5300
|
+
import_radix_ui28.ScrollArea.Viewport,
|
|
5301
|
+
{
|
|
5302
|
+
"data-slot": "scroll-area-viewport",
|
|
5303
|
+
className: cn("ddga-scroll-area__viewport", viewportClassName),
|
|
5304
|
+
ref: viewportRef,
|
|
5305
|
+
tabIndex: 0,
|
|
5306
|
+
role: hasLabel ? "region" : void 0,
|
|
5307
|
+
"aria-label": ariaLabel,
|
|
5308
|
+
"aria-labelledby": ariaLabelledby,
|
|
5309
|
+
...restViewportProps,
|
|
5310
|
+
children
|
|
5311
|
+
}
|
|
5312
|
+
),
|
|
5313
|
+
showVertical ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5314
|
+
import_radix_ui28.ScrollArea.Scrollbar,
|
|
5315
|
+
{
|
|
5316
|
+
"data-slot": "scroll-area-scrollbar",
|
|
5317
|
+
orientation: "vertical",
|
|
5318
|
+
className: "ddga-scroll-area__scrollbar",
|
|
5319
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui28.ScrollArea.Thumb, { className: "ddga-scroll-area__thumb" })
|
|
5320
|
+
}
|
|
5321
|
+
) : null,
|
|
5322
|
+
showHorizontal ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5323
|
+
import_radix_ui28.ScrollArea.Scrollbar,
|
|
5324
|
+
{
|
|
5325
|
+
"data-slot": "scroll-area-scrollbar",
|
|
5326
|
+
orientation: "horizontal",
|
|
5327
|
+
className: "ddga-scroll-area__scrollbar",
|
|
5328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui28.ScrollArea.Thumb, { className: "ddga-scroll-area__thumb" })
|
|
5329
|
+
}
|
|
5330
|
+
) : null,
|
|
5331
|
+
orientation === "both" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui28.ScrollArea.Corner, { className: "ddga-scroll-area__corner" }) : null
|
|
5332
|
+
]
|
|
5333
|
+
}
|
|
5334
|
+
);
|
|
5335
|
+
}
|
|
5336
|
+
|
|
5337
|
+
// src/components/Menubar/Menubar.tsx
|
|
5338
|
+
var import_react28 = require("react");
|
|
5339
|
+
var import_radix_ui29 = require("radix-ui");
|
|
5340
|
+
var import_class_variance_authority39 = require("class-variance-authority");
|
|
5341
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5342
|
+
var menubarContentVariants = (0, import_class_variance_authority39.cva)("ddga-menubar-menu", {
|
|
5343
|
+
variants: {
|
|
5344
|
+
size: {
|
|
5345
|
+
sm: "ddga-menubar-menu--sm",
|
|
5346
|
+
md: "ddga-menubar-menu--md"
|
|
5347
|
+
}
|
|
5348
|
+
},
|
|
5349
|
+
defaultVariants: {
|
|
5350
|
+
size: "md"
|
|
5351
|
+
}
|
|
5352
|
+
});
|
|
5353
|
+
var menubarTriggerVariants = (0, import_class_variance_authority39.cva)("ddga-menubar__trigger", {
|
|
5354
|
+
variants: {
|
|
5355
|
+
variant: {
|
|
5356
|
+
default: "ddga-menubar__trigger--default",
|
|
5357
|
+
outline: "ddga-menubar__trigger--outline"
|
|
5358
|
+
}
|
|
5359
|
+
},
|
|
5360
|
+
defaultVariants: {
|
|
5361
|
+
variant: "default"
|
|
5362
|
+
}
|
|
5363
|
+
});
|
|
5364
|
+
function Menubar({ className, ...props }) {
|
|
5365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5366
|
+
import_radix_ui29.Menubar.Root,
|
|
5367
|
+
{
|
|
5368
|
+
"data-slot": "menubar",
|
|
5369
|
+
className: cn("ddga-menubar", className),
|
|
5370
|
+
...props
|
|
5371
|
+
}
|
|
5372
|
+
);
|
|
5373
|
+
}
|
|
5374
|
+
function MenubarMenu(props) {
|
|
5375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Menu, { ...props });
|
|
5376
|
+
}
|
|
5377
|
+
function MenubarTrigger({ variant, className, ...props }) {
|
|
5378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5379
|
+
import_radix_ui29.Menubar.Trigger,
|
|
5380
|
+
{
|
|
5381
|
+
"data-slot": "menubar-trigger",
|
|
5382
|
+
"data-variant": variant ?? "default",
|
|
5383
|
+
className: cn(menubarTriggerVariants({ variant }), className),
|
|
5384
|
+
...props
|
|
5385
|
+
}
|
|
5386
|
+
);
|
|
5387
|
+
}
|
|
5388
|
+
function MenubarContent({ size, className, sideOffset = 6, ...props }) {
|
|
5389
|
+
const ctx = (0, import_react28.useContext)(DgaContext);
|
|
5390
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5392
|
+
import_radix_ui29.Menubar.Content,
|
|
5393
|
+
{
|
|
5394
|
+
"data-slot": "menubar-content",
|
|
5395
|
+
sideOffset,
|
|
5396
|
+
className: cn(menubarContentVariants({ size }), className),
|
|
5397
|
+
...props
|
|
5398
|
+
}
|
|
5399
|
+
) });
|
|
5400
|
+
}
|
|
5401
|
+
function MenubarItem({
|
|
5402
|
+
className,
|
|
5403
|
+
destructive,
|
|
5404
|
+
startIcon,
|
|
5405
|
+
shortcut,
|
|
5406
|
+
children,
|
|
5407
|
+
...props
|
|
5408
|
+
}) {
|
|
5409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5410
|
+
import_radix_ui29.Menubar.Item,
|
|
5411
|
+
{
|
|
5412
|
+
"data-slot": "menubar-item",
|
|
5413
|
+
"data-destructive": destructive ? "" : void 0,
|
|
5414
|
+
className: cn("ddga-menubar-menu__item", className),
|
|
5415
|
+
...props,
|
|
5416
|
+
children: [
|
|
5417
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
5418
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children }),
|
|
5419
|
+
shortcut ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__shortcut", "aria-hidden": "true", children: shortcut }) : null
|
|
5420
|
+
]
|
|
5421
|
+
}
|
|
5422
|
+
);
|
|
5423
|
+
}
|
|
5424
|
+
function MenubarCheckboxItem({
|
|
5425
|
+
className,
|
|
5426
|
+
children,
|
|
5427
|
+
onSelect,
|
|
5428
|
+
...props
|
|
5429
|
+
}) {
|
|
5430
|
+
const handleSelect = onSelect ?? ((event) => {
|
|
5431
|
+
event.preventDefault();
|
|
5432
|
+
});
|
|
5433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5434
|
+
import_radix_ui29.Menubar.CheckboxItem,
|
|
5435
|
+
{
|
|
5436
|
+
"data-slot": "menubar-checkbox-item",
|
|
5437
|
+
className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--checkable", className),
|
|
5438
|
+
onSelect: handleSelect,
|
|
5439
|
+
...props,
|
|
5440
|
+
children: [
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Check, { className: "ddga-menubar-menu__indicator-icon" }) }) }),
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children })
|
|
5443
|
+
]
|
|
5444
|
+
}
|
|
5445
|
+
);
|
|
5446
|
+
}
|
|
5447
|
+
function MenubarRadioGroup(props) {
|
|
5448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.RadioGroup, { "data-slot": "menubar-radio-group", ...props });
|
|
5449
|
+
}
|
|
5450
|
+
function MenubarRadioItem({ className, children, onSelect, ...props }) {
|
|
5451
|
+
const handleSelect = onSelect ?? ((event) => {
|
|
5452
|
+
event.preventDefault();
|
|
5453
|
+
});
|
|
5454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5455
|
+
import_radix_ui29.Menubar.RadioItem,
|
|
5456
|
+
{
|
|
5457
|
+
"data-slot": "menubar-radio-item",
|
|
5458
|
+
className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--checkable", className),
|
|
5459
|
+
onSelect: handleSelect,
|
|
5460
|
+
...props,
|
|
5461
|
+
children: [
|
|
5462
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__radio-dot" }) }) }),
|
|
5463
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children })
|
|
5464
|
+
]
|
|
5465
|
+
}
|
|
5466
|
+
);
|
|
5467
|
+
}
|
|
5468
|
+
function MenubarLabel({ className, ...props }) {
|
|
5469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5470
|
+
import_radix_ui29.Menubar.Label,
|
|
5471
|
+
{
|
|
5472
|
+
"data-slot": "menubar-label",
|
|
5473
|
+
className: cn("ddga-menubar-menu__group-label", className),
|
|
5474
|
+
...props
|
|
5475
|
+
}
|
|
5476
|
+
);
|
|
5477
|
+
}
|
|
5478
|
+
function MenubarSeparator({ className, ...props }) {
|
|
5479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5480
|
+
import_radix_ui29.Menubar.Separator,
|
|
5481
|
+
{
|
|
5482
|
+
"data-slot": "menubar-separator",
|
|
5483
|
+
className: cn("ddga-menubar-menu__separator", className),
|
|
5484
|
+
...props
|
|
5485
|
+
}
|
|
5486
|
+
);
|
|
5487
|
+
}
|
|
5488
|
+
function MenubarGroup(props) {
|
|
5489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Group, { "data-slot": "menubar-group", ...props });
|
|
5490
|
+
}
|
|
5491
|
+
function MenubarSub(props) {
|
|
5492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Sub, { ...props });
|
|
5493
|
+
}
|
|
5494
|
+
function MenubarSubTrigger({ className, startIcon, children, ...props }) {
|
|
5495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5496
|
+
import_radix_ui29.Menubar.SubTrigger,
|
|
5497
|
+
{
|
|
5498
|
+
"data-slot": "menubar-sub-trigger",
|
|
5499
|
+
className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--sub", className),
|
|
5500
|
+
...props,
|
|
5501
|
+
children: [
|
|
5502
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children }),
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronRight, { className: "ddga-menubar-menu__sub-chevron", "aria-hidden": "true" })
|
|
5505
|
+
]
|
|
5506
|
+
}
|
|
5507
|
+
);
|
|
5508
|
+
}
|
|
5509
|
+
function MenubarSubContent({ size, className, ...props }) {
|
|
5510
|
+
const ctx = (0, import_react28.useContext)(DgaContext);
|
|
5511
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5513
|
+
import_radix_ui29.Menubar.SubContent,
|
|
5514
|
+
{
|
|
5515
|
+
"data-slot": "menubar-sub-content",
|
|
5516
|
+
className: cn(menubarContentVariants({ size }), className),
|
|
5517
|
+
...props
|
|
5518
|
+
}
|
|
5519
|
+
) });
|
|
5520
|
+
}
|
|
5521
|
+
|
|
5522
|
+
// src/components/Timeline/Timeline.tsx
|
|
5523
|
+
var import_class_variance_authority40 = require("class-variance-authority");
|
|
5524
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5525
|
+
var timelineVariants = (0, import_class_variance_authority40.cva)("ddga-timeline", {
|
|
5526
|
+
variants: {
|
|
5527
|
+
size: {
|
|
5528
|
+
sm: "ddga-timeline--sm",
|
|
5529
|
+
md: "ddga-timeline--md"
|
|
5530
|
+
},
|
|
5531
|
+
orientation: {
|
|
5532
|
+
vertical: "ddga-timeline--vertical",
|
|
5533
|
+
horizontal: "ddga-timeline--horizontal"
|
|
5534
|
+
}
|
|
5535
|
+
},
|
|
5536
|
+
defaultVariants: {
|
|
5537
|
+
size: "md",
|
|
5538
|
+
orientation: "vertical"
|
|
5539
|
+
}
|
|
5540
|
+
});
|
|
5541
|
+
var timelineMarkerVariants = (0, import_class_variance_authority40.cva)("ddga-timeline__marker", {
|
|
5542
|
+
variants: {
|
|
5543
|
+
status: {
|
|
5544
|
+
default: "ddga-timeline__marker--default",
|
|
5545
|
+
success: "ddga-timeline__marker--success",
|
|
5546
|
+
error: "ddga-timeline__marker--error",
|
|
5547
|
+
warning: "ddga-timeline__marker--warning",
|
|
5548
|
+
info: "ddga-timeline__marker--info"
|
|
5549
|
+
}
|
|
5550
|
+
},
|
|
5551
|
+
defaultVariants: {
|
|
5552
|
+
status: "default"
|
|
5553
|
+
}
|
|
5554
|
+
});
|
|
5555
|
+
function Timeline({ size, orientation, className, ...props }) {
|
|
5556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5557
|
+
"ol",
|
|
5558
|
+
{
|
|
5559
|
+
"data-slot": "timeline",
|
|
5560
|
+
"data-orientation": orientation ?? "vertical",
|
|
5561
|
+
className: cn(timelineVariants({ size, orientation }), className),
|
|
5562
|
+
...props
|
|
5563
|
+
}
|
|
5564
|
+
);
|
|
5565
|
+
}
|
|
5566
|
+
function TimelineItem({ className, ...props }) {
|
|
5567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("li", { "data-slot": "timeline-item", className: cn("ddga-timeline__item", className), ...props });
|
|
5568
|
+
}
|
|
5569
|
+
function TimelineMarker({ status, className, children, ...props }) {
|
|
5570
|
+
const resolved = status ?? "default";
|
|
5571
|
+
const reached = resolved !== "default";
|
|
5572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5573
|
+
"span",
|
|
5574
|
+
{
|
|
5575
|
+
"aria-hidden": "true",
|
|
5576
|
+
"data-slot": "timeline-marker",
|
|
5577
|
+
"data-status": resolved,
|
|
5578
|
+
"data-reached": reached ? "" : void 0,
|
|
5579
|
+
className: cn(timelineMarkerVariants({ status }), className),
|
|
5580
|
+
...props,
|
|
5581
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-timeline__dot" })
|
|
5582
|
+
}
|
|
5583
|
+
);
|
|
5584
|
+
}
|
|
5585
|
+
function TimelineContent({ className, ...props }) {
|
|
5586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5587
|
+
"div",
|
|
5588
|
+
{
|
|
5589
|
+
"data-slot": "timeline-content",
|
|
5590
|
+
className: cn("ddga-timeline__content", className),
|
|
5591
|
+
...props
|
|
5592
|
+
}
|
|
5593
|
+
);
|
|
5594
|
+
}
|
|
5595
|
+
function TimelineTitle({ className, ...props }) {
|
|
5596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-slot": "timeline-title", className: cn("ddga-timeline__title", className), ...props });
|
|
5597
|
+
}
|
|
5598
|
+
function TimelineDescription({ className, ...props }) {
|
|
5599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5600
|
+
"span",
|
|
5601
|
+
{
|
|
5602
|
+
"data-slot": "timeline-description",
|
|
5603
|
+
className: cn("ddga-timeline__description", className),
|
|
5604
|
+
...props
|
|
5605
|
+
}
|
|
5606
|
+
);
|
|
5607
|
+
}
|
|
5608
|
+
function TimelineTime({ className, ...props }) {
|
|
5609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("time", { "data-slot": "timeline-time", className: cn("ddga-timeline__time", className), ...props });
|
|
5610
|
+
}
|
|
5611
|
+
|
|
5612
|
+
// src/components/Command/Command.tsx
|
|
5613
|
+
var import_react29 = require("react");
|
|
5614
|
+
var import_cmdk2 = require("cmdk");
|
|
5615
|
+
var import_radix_ui30 = require("radix-ui");
|
|
5616
|
+
var import_class_variance_authority41 = require("class-variance-authority");
|
|
5617
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5618
|
+
var commandVariants = (0, import_class_variance_authority41.cva)("ddga-command");
|
|
5619
|
+
function Command2({ className, ...props }) {
|
|
5620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_cmdk2.Command, { "data-slot": "command", className: cn(commandVariants(), className), ...props });
|
|
5621
|
+
}
|
|
5622
|
+
function CommandInput({
|
|
5623
|
+
className,
|
|
5624
|
+
placeholder,
|
|
5625
|
+
"aria-label": ariaLabel,
|
|
5626
|
+
...props
|
|
5627
|
+
}) {
|
|
5628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "ddga-command__input-wrapper", "data-slot": "command-input-wrapper", children: [
|
|
5629
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Search, { className: "ddga-command__search-icon", "aria-hidden": "true" }),
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5631
|
+
import_cmdk2.Command.Input,
|
|
5632
|
+
{
|
|
5633
|
+
"data-slot": "command-input",
|
|
5634
|
+
className: cn("ddga-command__input", className),
|
|
5635
|
+
placeholder,
|
|
5636
|
+
"aria-label": ariaLabel ?? (typeof placeholder === "string" ? placeholder : void 0),
|
|
5637
|
+
...props
|
|
5638
|
+
}
|
|
5639
|
+
)
|
|
5640
|
+
] });
|
|
5641
|
+
}
|
|
5642
|
+
function CommandList({ className, ...props }) {
|
|
5643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5644
|
+
import_cmdk2.Command.List,
|
|
5645
|
+
{
|
|
5646
|
+
"data-slot": "command-list",
|
|
5647
|
+
className: cn("ddga-command__list", className),
|
|
5648
|
+
...props
|
|
5649
|
+
}
|
|
5650
|
+
);
|
|
5651
|
+
}
|
|
5652
|
+
function CommandEmpty({ className, ...props }) {
|
|
5653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5654
|
+
import_cmdk2.Command.Empty,
|
|
5655
|
+
{
|
|
5656
|
+
"data-slot": "command-empty",
|
|
5657
|
+
className: cn("ddga-command__empty", className),
|
|
5658
|
+
...props
|
|
5659
|
+
}
|
|
5660
|
+
);
|
|
5661
|
+
}
|
|
5662
|
+
function CommandGroup({ className, ...props }) {
|
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5664
|
+
import_cmdk2.Command.Group,
|
|
5665
|
+
{
|
|
5666
|
+
"data-slot": "command-group",
|
|
5667
|
+
className: cn("ddga-command__group", className),
|
|
5668
|
+
...props
|
|
5669
|
+
}
|
|
5670
|
+
);
|
|
5671
|
+
}
|
|
5672
|
+
function CommandSeparator({
|
|
5673
|
+
className,
|
|
5674
|
+
"aria-hidden": ariaHidden = true,
|
|
5675
|
+
...props
|
|
5676
|
+
}) {
|
|
5677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5678
|
+
import_cmdk2.Command.Separator,
|
|
5679
|
+
{
|
|
5680
|
+
"aria-hidden": ariaHidden,
|
|
5681
|
+
"data-slot": "command-separator",
|
|
5682
|
+
className: cn("ddga-command__separator", className),
|
|
5683
|
+
...props
|
|
5684
|
+
}
|
|
5685
|
+
);
|
|
5686
|
+
}
|
|
5687
|
+
function CommandItem({
|
|
5688
|
+
startIcon,
|
|
5689
|
+
shortcut,
|
|
5690
|
+
className,
|
|
5691
|
+
children,
|
|
5692
|
+
keywords,
|
|
5693
|
+
...props
|
|
5694
|
+
}) {
|
|
5695
|
+
const labelText = typeof children === "string" ? children : void 0;
|
|
5696
|
+
const mergedKeywords = labelText && !keywords?.includes(labelText) ? [...keywords ?? [], labelText] : keywords;
|
|
5697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5698
|
+
import_cmdk2.Command.Item,
|
|
5699
|
+
{
|
|
5700
|
+
"data-slot": "command-item",
|
|
5701
|
+
className: cn("ddga-command__item", className),
|
|
5702
|
+
keywords: mergedKeywords,
|
|
5703
|
+
...props,
|
|
5704
|
+
children: [
|
|
5705
|
+
startIcon != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-command__item-icon", "aria-hidden": "true", children: startIcon }),
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-command__item-label", children }),
|
|
5707
|
+
shortcut != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-command__item-shortcut", children: shortcut })
|
|
5708
|
+
]
|
|
5709
|
+
}
|
|
5710
|
+
);
|
|
5711
|
+
}
|
|
5712
|
+
function CommandDialog({
|
|
5713
|
+
open: controlledOpen,
|
|
5714
|
+
defaultOpen,
|
|
5715
|
+
onOpenChange,
|
|
5716
|
+
shortcut = "k",
|
|
5717
|
+
label = "Command palette",
|
|
5718
|
+
description,
|
|
5719
|
+
className,
|
|
5720
|
+
filter,
|
|
5721
|
+
shouldFilter,
|
|
5722
|
+
loop,
|
|
5723
|
+
children
|
|
5724
|
+
}) {
|
|
5725
|
+
const [internalOpen, setInternalOpen] = (0, import_react29.useState)(defaultOpen ?? false);
|
|
5726
|
+
const isControlled = controlledOpen !== void 0;
|
|
5727
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
5728
|
+
const setOpen = (0, import_react29.useCallback)(
|
|
5729
|
+
(next) => {
|
|
5730
|
+
if (!isControlled) setInternalOpen(next);
|
|
5731
|
+
onOpenChange?.(next);
|
|
5732
|
+
},
|
|
5733
|
+
[isControlled, onOpenChange]
|
|
5734
|
+
);
|
|
5735
|
+
const openRef = (0, import_react29.useRef)(open);
|
|
5736
|
+
(0, import_react29.useEffect)(() => {
|
|
5737
|
+
openRef.current = open;
|
|
5738
|
+
});
|
|
5739
|
+
(0, import_react29.useEffect)(() => {
|
|
5740
|
+
if (typeof shortcut !== "string") return;
|
|
5741
|
+
const key = shortcut.toLowerCase();
|
|
5742
|
+
const onKeyDown = (event) => {
|
|
5743
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === key) {
|
|
5744
|
+
event.preventDefault();
|
|
5745
|
+
setOpen(!openRef.current);
|
|
5746
|
+
}
|
|
5747
|
+
};
|
|
5748
|
+
document.addEventListener("keydown", onKeyDown);
|
|
5749
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5750
|
+
}, [shortcut, setOpen]);
|
|
5751
|
+
const ctx = (0, import_react29.useContext)(DgaContext);
|
|
5752
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_radix_ui30.Dialog.Portal, { container: portalContainer, children: [
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Overlay, { className: "ddga-command__overlay", "data-slot": "command-overlay" }),
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5756
|
+
import_radix_ui30.Dialog.Content,
|
|
5757
|
+
{
|
|
5758
|
+
"data-slot": "command-dialog",
|
|
5759
|
+
className: cn("ddga-command-dialog", className),
|
|
5760
|
+
...description == null ? { "aria-describedby": void 0 } : {},
|
|
5761
|
+
children: [
|
|
5762
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Title, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.VisuallyHidden.Root, { children: label }) }),
|
|
5763
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Description, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.VisuallyHidden.Root, { children: description }) }),
|
|
5764
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5765
|
+
Command2,
|
|
5766
|
+
{
|
|
5767
|
+
"data-slot": "command-dialog-command",
|
|
5768
|
+
className: "ddga-command--dialog",
|
|
5769
|
+
label: typeof label === "string" ? label : "Command palette",
|
|
5770
|
+
filter,
|
|
5771
|
+
shouldFilter,
|
|
5772
|
+
loop,
|
|
5773
|
+
children
|
|
5774
|
+
}
|
|
5775
|
+
)
|
|
5776
|
+
]
|
|
5777
|
+
}
|
|
5778
|
+
)
|
|
5779
|
+
] }) });
|
|
5780
|
+
}
|
|
5781
|
+
|
|
5782
|
+
// src/components/Table/Table.tsx
|
|
5783
|
+
var import_class_variance_authority42 = require("class-variance-authority");
|
|
5784
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5785
|
+
var tableVariants = (0, import_class_variance_authority42.cva)("ddga-table", {
|
|
5786
|
+
variants: {
|
|
5787
|
+
size: {
|
|
5788
|
+
sm: "ddga-table--sm",
|
|
5789
|
+
md: "ddga-table--md",
|
|
5790
|
+
lg: "ddga-table--lg"
|
|
5791
|
+
},
|
|
5792
|
+
striped: { true: "ddga-table--striped" },
|
|
5793
|
+
divided: { true: "ddga-table--divided" },
|
|
5794
|
+
bordered: { true: "ddga-table--bordered" },
|
|
5795
|
+
stickyHeader: { true: "ddga-table--sticky" }
|
|
5796
|
+
},
|
|
5797
|
+
defaultVariants: {
|
|
5798
|
+
size: "md"
|
|
5799
|
+
}
|
|
5800
|
+
});
|
|
5801
|
+
function Table({
|
|
5802
|
+
size,
|
|
5803
|
+
striped,
|
|
5804
|
+
divided,
|
|
5805
|
+
bordered,
|
|
5806
|
+
stickyHeader,
|
|
5807
|
+
className,
|
|
5808
|
+
maxHeight,
|
|
5809
|
+
"aria-label": ariaLabel,
|
|
5810
|
+
"aria-labelledby": ariaLabelledby,
|
|
5811
|
+
...props
|
|
5812
|
+
}) {
|
|
5813
|
+
const named = Boolean(ariaLabel || ariaLabelledby);
|
|
5814
|
+
if (process.env.NODE_ENV !== "production" && !named) {
|
|
5815
|
+
console.warn(
|
|
5816
|
+
"[ddga] <Table> wraps its table in a horizontally scrollable container. Pass `aria-label` (or `aria-labelledby`) so keyboard and screen-reader users can identify and scroll it. Without a name it degrades to a plain scroll container with no landmark."
|
|
5817
|
+
);
|
|
5818
|
+
}
|
|
5819
|
+
if (process.env.NODE_ENV !== "production" && ariaLabel && ariaLabelledby) {
|
|
5820
|
+
console.warn(
|
|
5821
|
+
"[ddga] <Table> received both `aria-label` and `aria-labelledby`. `aria-labelledby` takes precedence; `aria-label` will be ignored by assistive technology."
|
|
5822
|
+
);
|
|
5823
|
+
}
|
|
5824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5825
|
+
"div",
|
|
5826
|
+
{
|
|
5827
|
+
"data-slot": "table-region",
|
|
5828
|
+
className: "ddga-table__region",
|
|
5829
|
+
style: maxHeight != null ? { maxBlockSize: maxHeight, overflowY: "auto" } : void 0,
|
|
5830
|
+
...named ? {
|
|
5831
|
+
role: "region",
|
|
5832
|
+
tabIndex: 0,
|
|
5833
|
+
"aria-label": ariaLabel,
|
|
5834
|
+
"aria-labelledby": ariaLabelledby
|
|
5835
|
+
} : {},
|
|
5836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5837
|
+
"table",
|
|
5838
|
+
{
|
|
5839
|
+
"data-slot": "table",
|
|
5840
|
+
className: cn(tableVariants({ size, striped, divided, bordered, stickyHeader }), className),
|
|
5841
|
+
...props
|
|
5842
|
+
}
|
|
5843
|
+
)
|
|
5844
|
+
}
|
|
5845
|
+
);
|
|
5846
|
+
}
|
|
5847
|
+
function TableHeader({ className, ...props }) {
|
|
5848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("thead", { "data-slot": "table-header", className: cn("ddga-table__header", className), ...props });
|
|
5849
|
+
}
|
|
5850
|
+
function TableBody({ className, ...props }) {
|
|
5851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tbody", { "data-slot": "table-body", className: cn("ddga-table__body", className), ...props });
|
|
5852
|
+
}
|
|
5853
|
+
function TableFooter({ className, ...props }) {
|
|
5854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tfoot", { "data-slot": "table-footer", className: cn("ddga-table__footer", className), ...props });
|
|
5855
|
+
}
|
|
5856
|
+
function TableRow({ className, selected, ...props }) {
|
|
5857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5858
|
+
"tr",
|
|
5859
|
+
{
|
|
5860
|
+
"data-slot": "table-row",
|
|
5861
|
+
"data-state": selected ? "selected" : void 0,
|
|
5862
|
+
className: cn("ddga-table__row", className),
|
|
5863
|
+
...props
|
|
5864
|
+
}
|
|
5865
|
+
);
|
|
5866
|
+
}
|
|
5867
|
+
function TableHead({
|
|
5868
|
+
className,
|
|
5869
|
+
align,
|
|
5870
|
+
sortable,
|
|
5871
|
+
sortDirection = false,
|
|
5872
|
+
sortLabel,
|
|
5873
|
+
onClick,
|
|
5874
|
+
children,
|
|
5875
|
+
...props
|
|
5876
|
+
}) {
|
|
5877
|
+
const headClass = cn("ddga-table__head", align && `ddga-table__head--align-${align}`, className);
|
|
5878
|
+
if (process.env.NODE_ENV !== "production" && sortable && !sortLabel) {
|
|
5879
|
+
console.warn(
|
|
5880
|
+
'[ddga] <TableHead sortable> has no `sortLabel`. `aria-sort` conveys the sort state, but pass a localized cue (e.g. "activate to sort") so a focused sort button announces its action to screen-reader users.'
|
|
5881
|
+
);
|
|
5882
|
+
}
|
|
5883
|
+
if (!sortable) {
|
|
5884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("th", { scope: "col", "data-slot": "table-head", className: headClass, ...props, children });
|
|
5885
|
+
}
|
|
5886
|
+
const ariaSort = sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none";
|
|
5887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("th", { scope: "col", "data-slot": "table-head", "aria-sort": ariaSort, className: headClass, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
5888
|
+
"button",
|
|
5889
|
+
{
|
|
5890
|
+
type: "button",
|
|
5891
|
+
"data-slot": "table-sort-button",
|
|
5892
|
+
className: "ddga-table__sort-button",
|
|
5893
|
+
onClick,
|
|
5894
|
+
children: [
|
|
5895
|
+
children,
|
|
5896
|
+
sortLabel ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-sr-only", children: sortLabel }) : null,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-table__sort-icon", "data-slot": "table-sort-icon", "aria-hidden": "true", children: sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretUp, {}) : sortDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretDown, {}) : (
|
|
5898
|
+
// Neutral affordance: stacked carets, dimmed via CSS.
|
|
5899
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretUp, {}),
|
|
5901
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretDown, {})
|
|
5902
|
+
] })
|
|
5903
|
+
) })
|
|
5904
|
+
]
|
|
5905
|
+
}
|
|
5906
|
+
) });
|
|
5907
|
+
}
|
|
5908
|
+
function TableCell({ className, align, ...props }) {
|
|
5909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5910
|
+
"td",
|
|
5911
|
+
{
|
|
5912
|
+
"data-slot": "table-cell",
|
|
5913
|
+
className: cn("ddga-table__cell", align && `ddga-table__cell--align-${align}`, className),
|
|
5914
|
+
...props
|
|
5915
|
+
}
|
|
5916
|
+
);
|
|
5917
|
+
}
|
|
5918
|
+
function TableCaption({ className, ...props }) {
|
|
5919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5920
|
+
"caption",
|
|
5921
|
+
{
|
|
5922
|
+
"data-slot": "table-caption",
|
|
5923
|
+
className: cn("ddga-table__caption", className),
|
|
5924
|
+
...props
|
|
5925
|
+
}
|
|
5926
|
+
);
|
|
5927
|
+
}
|
|
5928
|
+
|
|
5929
|
+
// src/components/InputOTP/InputOTP.tsx
|
|
5930
|
+
var import_react30 = require("react");
|
|
5931
|
+
var import_class_variance_authority43 = require("class-variance-authority");
|
|
5932
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5933
|
+
var DEFAULT_PATTERN = "^[0-9]*$";
|
|
5934
|
+
var inputOTPVariants = (0, import_class_variance_authority43.cva)("ddga-input-otp", {
|
|
5935
|
+
variants: {
|
|
5936
|
+
size: {
|
|
5937
|
+
sm: "ddga-input-otp--sm",
|
|
5938
|
+
md: "ddga-input-otp--md",
|
|
5939
|
+
lg: "ddga-input-otp--lg"
|
|
5940
|
+
},
|
|
5941
|
+
error: {
|
|
5942
|
+
true: "ddga-input-otp--error"
|
|
5943
|
+
}
|
|
5944
|
+
},
|
|
5945
|
+
defaultVariants: {
|
|
5946
|
+
size: "md"
|
|
5947
|
+
}
|
|
5948
|
+
});
|
|
5949
|
+
function resolveGroups(length, groupSizes) {
|
|
5950
|
+
if (!groupSizes || groupSizes.length === 0) return [length];
|
|
5951
|
+
const sum = groupSizes.reduce((total, n) => total + n, 0);
|
|
5952
|
+
if (sum !== length) {
|
|
5953
|
+
if (process.env.NODE_ENV === "development") {
|
|
5954
|
+
console.warn(
|
|
5955
|
+
`[@dev-dga/react] InputOTP: groupSizes must sum to length (${length}); got ${sum}. Falling back to a single group.`
|
|
5956
|
+
);
|
|
5957
|
+
}
|
|
5958
|
+
return [length];
|
|
5959
|
+
}
|
|
5960
|
+
return groupSizes;
|
|
5961
|
+
}
|
|
5962
|
+
function Slot({
|
|
5963
|
+
char,
|
|
5964
|
+
active,
|
|
5965
|
+
caret,
|
|
5966
|
+
mask
|
|
5967
|
+
}) {
|
|
5968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
5969
|
+
"div",
|
|
5970
|
+
{
|
|
5971
|
+
"data-slot": "input-otp-slot",
|
|
5972
|
+
"data-active": active || void 0,
|
|
5973
|
+
"data-filled": char != null || void 0,
|
|
5974
|
+
className: "ddga-input-otp__slot",
|
|
5975
|
+
children: [
|
|
5976
|
+
char != null ? mask ? "\u2022" : char : null,
|
|
5977
|
+
caret && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "aria-hidden": "true", "data-slot": "input-otp-caret", className: "ddga-input-otp__caret" })
|
|
5978
|
+
]
|
|
5979
|
+
}
|
|
5980
|
+
);
|
|
5981
|
+
}
|
|
5982
|
+
function InputOTP({
|
|
5983
|
+
id: externalId,
|
|
5984
|
+
length = 6,
|
|
5985
|
+
groupSizes,
|
|
5986
|
+
value,
|
|
5987
|
+
defaultValue,
|
|
5988
|
+
onChange,
|
|
5989
|
+
onComplete,
|
|
5990
|
+
pattern = DEFAULT_PATTERN,
|
|
5991
|
+
mask = false,
|
|
5992
|
+
separator,
|
|
5993
|
+
size,
|
|
5994
|
+
disabled,
|
|
5995
|
+
autoFocus,
|
|
5996
|
+
name,
|
|
5997
|
+
required,
|
|
5998
|
+
label,
|
|
5999
|
+
helperText,
|
|
6000
|
+
errorMessage,
|
|
6001
|
+
error,
|
|
6002
|
+
className,
|
|
6003
|
+
"aria-label": ariaLabel,
|
|
6004
|
+
"aria-labelledby": ariaLabelledby,
|
|
6005
|
+
...props
|
|
6006
|
+
}) {
|
|
6007
|
+
const inputRef = (0, import_react30.useRef)(null);
|
|
6008
|
+
const [focused, setFocused] = (0, import_react30.useState)(false);
|
|
6009
|
+
const isControlled = value !== void 0;
|
|
6010
|
+
const [internal, setInternal] = (0, import_react30.useState)(defaultValue ?? "");
|
|
6011
|
+
const current = isControlled ? value : internal;
|
|
6012
|
+
const compiledPattern = (0, import_react30.useMemo)(() => {
|
|
6013
|
+
try {
|
|
6014
|
+
return new RegExp(pattern);
|
|
6015
|
+
} catch {
|
|
6016
|
+
if (process.env.NODE_ENV === "development") {
|
|
6017
|
+
console.warn(
|
|
6018
|
+
`[@dev-dga/react] InputOTP: invalid \`pattern\` regex "${pattern}". Falling back to digits-only.`
|
|
6019
|
+
);
|
|
6020
|
+
}
|
|
6021
|
+
return new RegExp(DEFAULT_PATTERN);
|
|
6022
|
+
}
|
|
6023
|
+
}, [pattern]);
|
|
6024
|
+
const completedRef = (0, import_react30.useRef)(null);
|
|
6025
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
6026
|
+
name: "InputOTP",
|
|
6027
|
+
id: externalId,
|
|
6028
|
+
label,
|
|
6029
|
+
error,
|
|
6030
|
+
errorMessage,
|
|
6031
|
+
helperText,
|
|
6032
|
+
"aria-label": ariaLabel,
|
|
6033
|
+
"aria-labelledby": ariaLabelledby
|
|
6034
|
+
});
|
|
6035
|
+
function handleChange(event) {
|
|
6036
|
+
const next = event.target.value.replace(/[\s-]/g, "").slice(0, length);
|
|
6037
|
+
if (!compiledPattern.test(next)) return;
|
|
6038
|
+
if (!isControlled) setInternal(next);
|
|
6039
|
+
onChange?.(next);
|
|
6040
|
+
if (next.length === length) {
|
|
6041
|
+
if (completedRef.current !== next) {
|
|
6042
|
+
completedRef.current = next;
|
|
6043
|
+
onComplete?.(next);
|
|
6044
|
+
}
|
|
6045
|
+
} else {
|
|
6046
|
+
completedRef.current = null;
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
function moveCaretToEnd() {
|
|
6050
|
+
const el = inputRef.current;
|
|
6051
|
+
if (el) el.setSelectionRange(el.value.length, el.value.length);
|
|
6052
|
+
}
|
|
6053
|
+
const groups = resolveGroups(length, groupSizes);
|
|
6054
|
+
const lastGroup = groups.length - 1;
|
|
6055
|
+
const activeIndex = focused ? Math.min(current.length, length - 1) : -1;
|
|
6056
|
+
const inputMode = pattern === DEFAULT_PATTERN ? "numeric" : "text";
|
|
6057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { "data-slot": "input-otp-field", className: "ddga-field", ...props, children: [
|
|
6058
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { htmlFor: fieldId, className: "ddga-input-otp__label", children: [
|
|
6059
|
+
label,
|
|
6060
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { "aria-hidden": "true", className: "ddga-input-otp__required", children: "*" })
|
|
6061
|
+
] }),
|
|
6062
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
6063
|
+
"div",
|
|
6064
|
+
{
|
|
6065
|
+
className: cn(inputOTPVariants({ size, error: hasError }), className),
|
|
6066
|
+
"data-slot": "input-otp",
|
|
6067
|
+
children: [
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6069
|
+
"input",
|
|
6070
|
+
{
|
|
6071
|
+
...controlProps,
|
|
6072
|
+
ref: inputRef,
|
|
6073
|
+
type: "text",
|
|
6074
|
+
inputMode,
|
|
6075
|
+
autoComplete: "one-time-code",
|
|
6076
|
+
value: current,
|
|
6077
|
+
maxLength: length,
|
|
6078
|
+
disabled,
|
|
6079
|
+
autoFocus,
|
|
6080
|
+
name,
|
|
6081
|
+
required,
|
|
6082
|
+
"aria-label": ariaLabel,
|
|
6083
|
+
"aria-labelledby": ariaLabelledby,
|
|
6084
|
+
onChange: handleChange,
|
|
6085
|
+
onFocus: () => {
|
|
6086
|
+
setFocused(true);
|
|
6087
|
+
moveCaretToEnd();
|
|
6088
|
+
},
|
|
6089
|
+
onBlur: () => setFocused(false),
|
|
6090
|
+
onPointerUp: moveCaretToEnd,
|
|
6091
|
+
className: "ddga-input-otp__input",
|
|
6092
|
+
"data-slot": "input-otp-input"
|
|
6093
|
+
}
|
|
6094
|
+
),
|
|
6095
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { dir: "ltr", "aria-hidden": "true", "data-slot": "input-otp-row", className: "ddga-input-otp__row", children: groups.map((count, groupIndex) => {
|
|
6096
|
+
const start = groups.slice(0, groupIndex).reduce((total, n) => total + n, 0);
|
|
6097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react30.Fragment, { children: [
|
|
6098
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "data-slot": "input-otp-group", className: "ddga-input-otp__group", children: Array.from({ length: count }, (_, offset) => {
|
|
6099
|
+
const index = start + offset;
|
|
6100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6101
|
+
Slot,
|
|
6102
|
+
{
|
|
6103
|
+
char: current[index],
|
|
6104
|
+
active: index === activeIndex,
|
|
6105
|
+
caret: index === activeIndex && current.length < length,
|
|
6106
|
+
mask
|
|
6107
|
+
},
|
|
6108
|
+
index
|
|
6109
|
+
);
|
|
6110
|
+
}) }),
|
|
6111
|
+
groupIndex < lastGroup && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6112
|
+
"span",
|
|
6113
|
+
{
|
|
6114
|
+
"aria-hidden": "true",
|
|
6115
|
+
"data-slot": "input-otp-separator",
|
|
6116
|
+
className: "ddga-input-otp__separator",
|
|
6117
|
+
children: separator ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ddga-input-otp__separator-dash" })
|
|
6118
|
+
}
|
|
6119
|
+
)
|
|
6120
|
+
] }, groupIndex);
|
|
6121
|
+
}) })
|
|
6122
|
+
]
|
|
6123
|
+
}
|
|
6124
|
+
),
|
|
6125
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
6126
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
6127
|
+
] });
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
// src/components/Link/Link.tsx
|
|
6131
|
+
var import_react31 = require("react");
|
|
6132
|
+
var import_radix_ui31 = require("radix-ui");
|
|
6133
|
+
var import_class_variance_authority44 = require("class-variance-authority");
|
|
6134
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6135
|
+
var linkVariants = (0, import_class_variance_authority44.cva)("ddga-link", {
|
|
6136
|
+
variants: {
|
|
6137
|
+
variant: {
|
|
6138
|
+
// Inline links in running prose. Underlined always — color alone fails
|
|
6139
|
+
// WCAG 1.4.1 when a link sits inside a block of text.
|
|
6140
|
+
default: "ddga-link--default",
|
|
6141
|
+
// Links in UI chrome (footers, meta rows) where context makes them
|
|
6142
|
+
// obviously links: no underline until hover.
|
|
6143
|
+
subtle: "ddga-link--subtle",
|
|
6144
|
+
// Block-level CTAs ("Learn more →"): inline-flex with gapped icons,
|
|
6145
|
+
// no underline. Not for mid-sentence use.
|
|
6146
|
+
standalone: "ddga-link--standalone"
|
|
6147
|
+
}
|
|
6148
|
+
},
|
|
6149
|
+
defaultVariants: {
|
|
6150
|
+
variant: "default"
|
|
6151
|
+
}
|
|
6152
|
+
});
|
|
6153
|
+
function Link({
|
|
6154
|
+
variant,
|
|
6155
|
+
external,
|
|
6156
|
+
startIcon,
|
|
6157
|
+
endIcon,
|
|
6158
|
+
iconFlip,
|
|
6159
|
+
asChild,
|
|
6160
|
+
className,
|
|
6161
|
+
children,
|
|
6162
|
+
rel,
|
|
6163
|
+
...props
|
|
6164
|
+
}) {
|
|
6165
|
+
if (process.env.NODE_ENV === "development" && !asChild && props.href == null) {
|
|
6166
|
+
console.warn(
|
|
6167
|
+
'[@dev-dga/react] Link rendered without an `href`. A link needs an href to be focusable and exposed as a link to assistive tech. Provide `href`, use `asChild` to render your own element (e.g. a router Link), or use `Button variant="ghost"` for an action that is not navigation.'
|
|
6168
|
+
);
|
|
6169
|
+
}
|
|
6170
|
+
const Comp = asChild ? import_radix_ui31.Slot.Slot : "a";
|
|
6171
|
+
const relValue = external ? Array.from(
|
|
6172
|
+
/* @__PURE__ */ new Set([...rel ? rel.split(/\s+/).filter(Boolean) : [], "noopener", "noreferrer"])
|
|
6173
|
+
).join(" ") : rel;
|
|
6174
|
+
const showExternalIcon = external && !endIcon;
|
|
6175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
6176
|
+
Comp,
|
|
6177
|
+
{
|
|
6178
|
+
"data-slot": "link",
|
|
6179
|
+
className: cn(linkVariants({ variant }), className),
|
|
6180
|
+
rel: relValue,
|
|
6181
|
+
...props,
|
|
6182
|
+
children: [
|
|
6183
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6184
|
+
"span",
|
|
6185
|
+
{
|
|
6186
|
+
className: cn("ddga-link__icon", iconFlip && "ddga-icon-flip"),
|
|
6187
|
+
"data-slot": "link-start-icon",
|
|
6188
|
+
"aria-hidden": "true",
|
|
6189
|
+
children: startIcon
|
|
6190
|
+
}
|
|
6191
|
+
),
|
|
6192
|
+
asChild ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui31.Slot.Slottable, { children }) : children,
|
|
6193
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6194
|
+
"span",
|
|
6195
|
+
{
|
|
6196
|
+
className: cn("ddga-link__icon", iconFlip && "ddga-icon-flip"),
|
|
6197
|
+
"data-slot": "link-end-icon",
|
|
6198
|
+
"aria-hidden": "true",
|
|
6199
|
+
children: endIcon
|
|
6200
|
+
}
|
|
6201
|
+
),
|
|
6202
|
+
showExternalIcon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6203
|
+
"span",
|
|
6204
|
+
{
|
|
6205
|
+
className: "ddga-link__icon ddga-link__icon--external",
|
|
6206
|
+
"data-slot": "link-external-icon",
|
|
6207
|
+
"aria-hidden": "true",
|
|
6208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ExternalLink, {})
|
|
6209
|
+
}
|
|
6210
|
+
)
|
|
6211
|
+
]
|
|
6212
|
+
}
|
|
6213
|
+
);
|
|
6214
|
+
}
|
|
6215
|
+
|
|
6216
|
+
// src/components/SearchBox/SearchBox.tsx
|
|
6217
|
+
var import_react32 = require("react");
|
|
6218
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
6219
|
+
function setNativeInputValue(el, value) {
|
|
6220
|
+
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
6221
|
+
setter?.call(el, value);
|
|
6222
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
6223
|
+
}
|
|
6224
|
+
function SearchBox({
|
|
6225
|
+
value,
|
|
6226
|
+
defaultValue,
|
|
6227
|
+
onChange,
|
|
6228
|
+
onKeyDown,
|
|
6229
|
+
onSearch,
|
|
6230
|
+
onClear,
|
|
6231
|
+
clearable = true,
|
|
6232
|
+
clearLabel = "Clear search",
|
|
6233
|
+
className,
|
|
6234
|
+
...rest
|
|
6235
|
+
}) {
|
|
6236
|
+
const inputRef = (0, import_react32.useRef)(null);
|
|
6237
|
+
const isControlled = value !== void 0;
|
|
6238
|
+
const [internal, setInternal] = (0, import_react32.useState)(
|
|
6239
|
+
defaultValue != null ? String(defaultValue) : ""
|
|
6240
|
+
);
|
|
6241
|
+
const currentValue = isControlled ? String(value ?? "") : internal;
|
|
6242
|
+
const handleChange = (event) => {
|
|
6243
|
+
if (!isControlled) setInternal(event.target.value);
|
|
6244
|
+
onChange?.(event);
|
|
6245
|
+
};
|
|
6246
|
+
const clear = () => {
|
|
6247
|
+
const el = inputRef.current;
|
|
6248
|
+
if (!el) return;
|
|
6249
|
+
setNativeInputValue(el, "");
|
|
6250
|
+
el.focus();
|
|
6251
|
+
onClear?.();
|
|
6252
|
+
};
|
|
6253
|
+
const handleKeyDown = (event) => {
|
|
6254
|
+
onKeyDown?.(event);
|
|
6255
|
+
if (event.defaultPrevented) return;
|
|
6256
|
+
if (event.key === "Enter") {
|
|
6257
|
+
onSearch?.(currentValue);
|
|
6258
|
+
} else if (event.key === "Escape" && currentValue.length > 0) {
|
|
6259
|
+
event.preventDefault();
|
|
6260
|
+
event.stopPropagation();
|
|
6261
|
+
clear();
|
|
6262
|
+
}
|
|
6263
|
+
};
|
|
6264
|
+
const showClear = clearable && currentValue.length > 0;
|
|
6265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6266
|
+
Input,
|
|
6267
|
+
{
|
|
6268
|
+
...rest,
|
|
6269
|
+
ref: inputRef,
|
|
6270
|
+
type: "search",
|
|
6271
|
+
value: currentValue,
|
|
6272
|
+
onChange: handleChange,
|
|
6273
|
+
onKeyDown: handleKeyDown,
|
|
6274
|
+
className: cn("ddga-search-box", className),
|
|
6275
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Search, { "data-slot": "search-box-icon", "aria-hidden": "true" }),
|
|
6276
|
+
endAdornment: showClear ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6277
|
+
Button,
|
|
6278
|
+
{
|
|
6279
|
+
type: "button",
|
|
6280
|
+
variant: "ghost",
|
|
6281
|
+
size: "icon-sm",
|
|
6282
|
+
"aria-label": clearLabel,
|
|
6283
|
+
"data-slot": "search-box-clear",
|
|
6284
|
+
onClick: clear,
|
|
6285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Close, { "aria-hidden": "true" })
|
|
6286
|
+
}
|
|
6287
|
+
) : void 0
|
|
6288
|
+
}
|
|
6289
|
+
);
|
|
6290
|
+
}
|
|
6291
|
+
|
|
6292
|
+
// src/components/List/List.tsx
|
|
6293
|
+
var import_class_variance_authority45 = require("class-variance-authority");
|
|
6294
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
6295
|
+
var listVariants = (0, import_class_variance_authority45.cva)("ddga-list", {
|
|
6296
|
+
variants: {
|
|
6297
|
+
variant: {
|
|
6298
|
+
plain: "ddga-list--plain",
|
|
6299
|
+
bulleted: "ddga-list--bulleted",
|
|
6300
|
+
numbered: "ddga-list--numbered",
|
|
6301
|
+
lettered: "ddga-list--lettered"
|
|
6302
|
+
},
|
|
6303
|
+
divided: {
|
|
6304
|
+
true: "ddga-list--divided"
|
|
6305
|
+
}
|
|
6306
|
+
},
|
|
6307
|
+
defaultVariants: {
|
|
6308
|
+
variant: "plain"
|
|
6309
|
+
}
|
|
6310
|
+
});
|
|
6311
|
+
function List({ variant, divided, className, start, reversed, ...props }) {
|
|
6312
|
+
const classes = cn(listVariants({ variant, divided }), className);
|
|
6313
|
+
const ordered = variant === "numbered" || variant === "lettered";
|
|
6314
|
+
if (ordered) {
|
|
6315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6316
|
+
"ol",
|
|
6317
|
+
{
|
|
6318
|
+
"data-slot": "list",
|
|
6319
|
+
"data-variant": variant,
|
|
6320
|
+
className: classes,
|
|
6321
|
+
start,
|
|
6322
|
+
reversed,
|
|
6323
|
+
...props
|
|
6324
|
+
}
|
|
6325
|
+
);
|
|
6326
|
+
}
|
|
6327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { "data-slot": "list", "data-variant": variant ?? "plain", className: classes, ...props });
|
|
6328
|
+
}
|
|
6329
|
+
function ListItem({ className, ...props }) {
|
|
6330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { "data-slot": "list-item", className: cn("ddga-list__item", className), ...props });
|
|
6331
|
+
}
|
|
6332
|
+
function ListItemIcon({ className, ...props }) {
|
|
6333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "data-slot": "list-item-icon", className: cn("ddga-list__icon", className), ...props });
|
|
6334
|
+
}
|
|
6335
|
+
function ListItemContent({
|
|
6336
|
+
primary,
|
|
6337
|
+
secondary,
|
|
6338
|
+
className,
|
|
6339
|
+
children,
|
|
6340
|
+
...props
|
|
6341
|
+
}) {
|
|
6342
|
+
if (process.env.NODE_ENV === "development" && children != null && (primary != null || secondary != null)) {
|
|
6343
|
+
console.warn(
|
|
6344
|
+
"[@dev-dga/react] ListItemContent: `children` overrides `primary`/`secondary`. Pass one or the other, not both."
|
|
6345
|
+
);
|
|
6346
|
+
}
|
|
6347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { "data-slot": "list-item-content", className: cn("ddga-list__content", className), ...props, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
6348
|
+
primary != null && primary !== "" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "data-slot": "list-item-primary", className: "ddga-list__primary", children: primary }),
|
|
6349
|
+
secondary != null && secondary !== "" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "data-slot": "list-item-secondary", className: "ddga-list__secondary", children: secondary })
|
|
6350
|
+
] }) });
|
|
6351
|
+
}
|
|
6352
|
+
function ListItemAction({ className, ...props }) {
|
|
6353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { "data-slot": "list-item-action", className: cn("ddga-list__action", className), ...props });
|
|
6354
|
+
}
|
|
6355
|
+
|
|
6356
|
+
// src/components/Quote/Quote.tsx
|
|
6357
|
+
var import_react33 = require("react");
|
|
6358
|
+
var import_radix_ui32 = require("radix-ui");
|
|
6359
|
+
var import_class_variance_authority46 = require("class-variance-authority");
|
|
6360
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6361
|
+
var quoteVariants = (0, import_class_variance_authority46.cva)("ddga-quote", {
|
|
6362
|
+
variants: {
|
|
6363
|
+
variant: {
|
|
6364
|
+
/** Inline-start accent border (SA Green). The everyday blockquote. */
|
|
6365
|
+
default: "ddga-quote--default",
|
|
6366
|
+
/** Large editorial quote, centered, prominent mark — breaks up prose. */
|
|
6367
|
+
pullquote: "ddga-quote--pullquote",
|
|
6368
|
+
/** Card surface (border + bg + shadow), sized for an avatar + attribution. */
|
|
6369
|
+
testimonial: "ddga-quote--testimonial",
|
|
6370
|
+
/** Bare — no border, no surface. For inline / tightly-composed use. */
|
|
6371
|
+
plain: "ddga-quote--plain"
|
|
6372
|
+
}
|
|
6373
|
+
},
|
|
6374
|
+
defaultVariants: {
|
|
6375
|
+
variant: "default"
|
|
6376
|
+
}
|
|
6377
|
+
});
|
|
6378
|
+
function Quote({
|
|
6379
|
+
variant,
|
|
6380
|
+
quoteMark = false,
|
|
6381
|
+
avatar,
|
|
6382
|
+
author,
|
|
6383
|
+
byline,
|
|
6384
|
+
source,
|
|
6385
|
+
cite,
|
|
6386
|
+
className,
|
|
6387
|
+
children,
|
|
6388
|
+
...props
|
|
6389
|
+
}) {
|
|
6390
|
+
const hasAttribution = author != null || byline != null || source != null;
|
|
6391
|
+
const mark = quoteMark ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteMark, { "aria-hidden": "true", className: "ddga-quote__mark" }) : null;
|
|
6392
|
+
if (!hasAttribution) {
|
|
6393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
6394
|
+
"blockquote",
|
|
6395
|
+
{
|
|
6396
|
+
"data-slot": "quote",
|
|
6397
|
+
"data-variant": variant ?? "default",
|
|
6398
|
+
className: cn(quoteVariants({ variant }), className),
|
|
6399
|
+
cite,
|
|
6400
|
+
...props,
|
|
6401
|
+
children: [
|
|
6402
|
+
mark,
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteContent, { children })
|
|
6404
|
+
]
|
|
6405
|
+
}
|
|
6406
|
+
);
|
|
6407
|
+
}
|
|
6408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
6409
|
+
"figure",
|
|
6410
|
+
{
|
|
6411
|
+
"data-slot": "quote",
|
|
6412
|
+
"data-variant": variant ?? "default",
|
|
6413
|
+
className: cn(quoteVariants({ variant }), className),
|
|
6414
|
+
...props,
|
|
6415
|
+
children: [
|
|
6416
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("blockquote", { "data-slot": "quote-blockquote", className: "ddga-quote__blockquote", cite, children: [
|
|
6417
|
+
mark,
|
|
6418
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteContent, { children })
|
|
6419
|
+
] }),
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(QuoteCaption, { children: [
|
|
6421
|
+
avatar != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-slot": "quote-avatar", "aria-hidden": "true", className: "ddga-quote__avatar", children: avatar }) : null,
|
|
6422
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ddga-quote__attribution", children: [
|
|
6423
|
+
author != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteAuthor, { children: author }) : null,
|
|
6424
|
+
byline != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ddga-quote__byline", children: byline }) : null,
|
|
6425
|
+
source != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteSource, { children: source }) : null
|
|
6426
|
+
] })
|
|
6427
|
+
] })
|
|
6428
|
+
]
|
|
6429
|
+
}
|
|
6430
|
+
);
|
|
6431
|
+
}
|
|
6432
|
+
function QuoteContent({ asChild, className, ...props }) {
|
|
6433
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "div";
|
|
6434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-content", className: cn("ddga-quote__content", className), ...props });
|
|
6435
|
+
}
|
|
6436
|
+
function QuoteCaption({ asChild, className, ...props }) {
|
|
6437
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "figcaption";
|
|
6438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-caption", className: cn("ddga-quote__caption", className), ...props });
|
|
6439
|
+
}
|
|
6440
|
+
function QuoteAuthor({ asChild, className, ...props }) {
|
|
6441
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "span";
|
|
6442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-author", className: cn("ddga-quote__author", className), ...props });
|
|
6443
|
+
}
|
|
6444
|
+
function QuoteSource({ asChild, className, ...props }) {
|
|
6445
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "cite";
|
|
6446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-source", className: cn("ddga-quote__source", className), ...props });
|
|
6447
|
+
}
|
|
6448
|
+
|
|
6449
|
+
// src/components/Collapsible/Collapsible.tsx
|
|
6450
|
+
var import_radix_ui33 = require("radix-ui");
|
|
6451
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
6452
|
+
function Collapsible({ className, ...props }) {
|
|
6453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6454
|
+
import_radix_ui33.Collapsible.Root,
|
|
6455
|
+
{
|
|
6456
|
+
"data-slot": "collapsible",
|
|
6457
|
+
className: cn("ddga-collapsible", className),
|
|
6458
|
+
...props
|
|
6459
|
+
}
|
|
6460
|
+
);
|
|
6461
|
+
}
|
|
6462
|
+
function CollapsibleTrigger({ className, ...props }) {
|
|
6463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6464
|
+
import_radix_ui33.Collapsible.Trigger,
|
|
6465
|
+
{
|
|
6466
|
+
"data-slot": "collapsible-trigger",
|
|
6467
|
+
className: cn("ddga-collapsible__trigger", className),
|
|
6468
|
+
...props
|
|
6469
|
+
}
|
|
6470
|
+
);
|
|
6471
|
+
}
|
|
6472
|
+
function CollapsibleContent({ className, children, ...props }) {
|
|
6473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6474
|
+
import_radix_ui33.Collapsible.Content,
|
|
6475
|
+
{
|
|
6476
|
+
"data-slot": "collapsible-content",
|
|
6477
|
+
className: cn("ddga-collapsible__content", className),
|
|
6478
|
+
...props,
|
|
6479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ddga-collapsible__content-inner", children })
|
|
6480
|
+
}
|
|
6481
|
+
);
|
|
6482
|
+
}
|
|
6483
|
+
|
|
6484
|
+
// src/components/TagInput/TagInput.tsx
|
|
6485
|
+
var import_react34 = require("react");
|
|
6486
|
+
var import_class_variance_authority47 = require("class-variance-authority");
|
|
6487
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6488
|
+
var tagInputVariants = (0, import_class_variance_authority47.cva)("ddga-tag-input", {
|
|
6489
|
+
variants: {
|
|
6490
|
+
size: {
|
|
6491
|
+
sm: "ddga-tag-input--sm",
|
|
6492
|
+
md: "ddga-tag-input--md",
|
|
6493
|
+
lg: "ddga-tag-input--lg"
|
|
6494
|
+
},
|
|
6495
|
+
error: {
|
|
6496
|
+
true: "ddga-tag-input--error"
|
|
6497
|
+
}
|
|
6498
|
+
},
|
|
6499
|
+
defaultVariants: {
|
|
6500
|
+
size: "md"
|
|
6501
|
+
}
|
|
6502
|
+
});
|
|
6503
|
+
function TagInput({
|
|
6504
|
+
id: externalId,
|
|
6505
|
+
value,
|
|
6506
|
+
defaultValue,
|
|
6507
|
+
onChange,
|
|
6508
|
+
label,
|
|
6509
|
+
helperText,
|
|
6510
|
+
errorMessage,
|
|
6511
|
+
error,
|
|
6512
|
+
size,
|
|
6513
|
+
disabled,
|
|
6514
|
+
placeholder,
|
|
6515
|
+
max,
|
|
6516
|
+
allowDuplicates = false,
|
|
6517
|
+
caseSensitive = false,
|
|
6518
|
+
validate,
|
|
6519
|
+
delimiters = [","],
|
|
6520
|
+
chipVariant = "secondary",
|
|
6521
|
+
removeLabel = (tag) => `Remove ${tag}`,
|
|
6522
|
+
formatAnnouncement = (tag, action) => `${tag} ${action === "add" ? "added" : "removed"}`,
|
|
6523
|
+
className,
|
|
6524
|
+
...props
|
|
6525
|
+
}) {
|
|
6526
|
+
const isControlled = value !== void 0;
|
|
6527
|
+
const [uncontrolledTags, setUncontrolledTags] = (0, import_react34.useState)(defaultValue ?? []);
|
|
6528
|
+
const tags = isControlled ? value : uncontrolledTags;
|
|
6529
|
+
const [draft, setDraft] = (0, import_react34.useState)("");
|
|
6530
|
+
const [announcement, setAnnouncement] = (0, import_react34.useState)("");
|
|
6531
|
+
const inputRef = (0, import_react34.useRef)(null);
|
|
6532
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
6533
|
+
name: "TagInput",
|
|
6534
|
+
id: externalId,
|
|
6535
|
+
label,
|
|
6536
|
+
error,
|
|
6537
|
+
errorMessage,
|
|
6538
|
+
helperText,
|
|
6539
|
+
"aria-label": props["aria-label"],
|
|
6540
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
6541
|
+
});
|
|
6542
|
+
const commit = (next) => {
|
|
6543
|
+
if (!isControlled) setUncontrolledTags(next);
|
|
6544
|
+
onChange?.(next);
|
|
6545
|
+
};
|
|
6546
|
+
const norm = (t) => caseSensitive ? t : t.toLowerCase();
|
|
6547
|
+
const accept = (raw, current) => {
|
|
6548
|
+
let next = current;
|
|
6549
|
+
for (const fragment of raw) {
|
|
6550
|
+
const trimmed = fragment.trim();
|
|
6551
|
+
if (!trimmed) continue;
|
|
6552
|
+
if (max !== void 0 && next.length >= max) break;
|
|
6553
|
+
if (!allowDuplicates && next.some((t) => norm(t) === norm(trimmed))) continue;
|
|
6554
|
+
if (validate && !validate(trimmed, next)) continue;
|
|
6555
|
+
next = [...next, trimmed];
|
|
6556
|
+
}
|
|
6557
|
+
return next;
|
|
6558
|
+
};
|
|
6559
|
+
const announceAdded = (added) => {
|
|
6560
|
+
if (added.length > 0) {
|
|
6561
|
+
setAnnouncement(added.map((t) => formatAnnouncement(t, "add")).join(", "));
|
|
6562
|
+
}
|
|
6563
|
+
};
|
|
6564
|
+
const commitDraft = () => {
|
|
6565
|
+
const next = accept([draft], tags);
|
|
6566
|
+
if (next.length > tags.length) {
|
|
6567
|
+
commit(next);
|
|
6568
|
+
announceAdded(next.slice(tags.length));
|
|
6569
|
+
setDraft("");
|
|
6570
|
+
}
|
|
6571
|
+
};
|
|
6572
|
+
const splitPaste = (text) => {
|
|
6573
|
+
const escaped = delimiters.map((d) => d.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&"));
|
|
6574
|
+
const pattern = new RegExp(`[${escaped.join("")}\\n\\r]`);
|
|
6575
|
+
return text.split(pattern);
|
|
6576
|
+
};
|
|
6577
|
+
const removeTag = (index) => {
|
|
6578
|
+
const removed = tags[index];
|
|
6579
|
+
commit(tags.filter((_, i) => i !== index));
|
|
6580
|
+
setAnnouncement(formatAnnouncement(removed, "remove"));
|
|
6581
|
+
inputRef.current?.focus();
|
|
6582
|
+
};
|
|
6583
|
+
const handleKeyDown = (event) => {
|
|
6584
|
+
if (disabled) return;
|
|
6585
|
+
if (event.key === "Enter") {
|
|
6586
|
+
event.preventDefault();
|
|
6587
|
+
if (draft.trim()) commitDraft();
|
|
6588
|
+
} else if (delimiters.includes(event.key)) {
|
|
6589
|
+
event.preventDefault();
|
|
6590
|
+
if (draft.trim()) commitDraft();
|
|
6591
|
+
} else if (event.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
6592
|
+
event.preventDefault();
|
|
6593
|
+
removeTag(tags.length - 1);
|
|
6594
|
+
}
|
|
6595
|
+
};
|
|
6596
|
+
const handlePaste = (event) => {
|
|
6597
|
+
if (disabled) return;
|
|
6598
|
+
const text = event.clipboardData.getData("text");
|
|
6599
|
+
const fragments = splitPaste(text);
|
|
6600
|
+
if (fragments.length <= 1) return;
|
|
6601
|
+
event.preventDefault();
|
|
6602
|
+
const next = accept(fragments, tags);
|
|
6603
|
+
if (next.length > tags.length) {
|
|
6604
|
+
commit(next);
|
|
6605
|
+
announceAdded(next.slice(tags.length));
|
|
6606
|
+
setDraft("");
|
|
6607
|
+
}
|
|
6608
|
+
};
|
|
6609
|
+
const handleBoxMouseDown = (event) => {
|
|
6610
|
+
const target = event.target;
|
|
6611
|
+
if (target === inputRef.current || target.closest("button")) return;
|
|
6612
|
+
event.preventDefault();
|
|
6613
|
+
inputRef.current?.focus();
|
|
6614
|
+
};
|
|
6615
|
+
const chipSize = size === "lg" ? "md" : "sm";
|
|
6616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { "data-slot": "tag-input-field", className: "ddga-field", children: [
|
|
6617
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { htmlFor: fieldId, className: "ddga-tag-input__label", children: label }),
|
|
6618
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
6619
|
+
"div",
|
|
6620
|
+
{
|
|
6621
|
+
"data-slot": "tag-input-control",
|
|
6622
|
+
className: cn(tagInputVariants({ size, error: hasError }), className),
|
|
6623
|
+
"data-disabled": disabled || void 0,
|
|
6624
|
+
onMouseDown: disabled ? void 0 : handleBoxMouseDown,
|
|
6625
|
+
children: [
|
|
6626
|
+
tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { "data-slot": "tag-input-list", className: "ddga-tag-input__list", role: "list", children: tags.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6627
|
+
"li",
|
|
6628
|
+
{
|
|
6629
|
+
"data-slot": "tag-input-item",
|
|
6630
|
+
className: "ddga-tag-input__item",
|
|
6631
|
+
role: "listitem",
|
|
6632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6633
|
+
Badge,
|
|
6634
|
+
{
|
|
6635
|
+
variant: chipVariant,
|
|
6636
|
+
size: chipSize,
|
|
6637
|
+
open: true,
|
|
6638
|
+
dismissible: !disabled,
|
|
6639
|
+
onDismiss: () => removeTag(index),
|
|
6640
|
+
closeLabel: removeLabel(tag),
|
|
6641
|
+
children: tag
|
|
6642
|
+
}
|
|
6643
|
+
)
|
|
6644
|
+
},
|
|
6645
|
+
`${tag}-${index}`
|
|
6646
|
+
)) }),
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6648
|
+
"input",
|
|
6649
|
+
{
|
|
6650
|
+
...props,
|
|
6651
|
+
...controlProps,
|
|
6652
|
+
ref: inputRef,
|
|
6653
|
+
"data-slot": "tag-input",
|
|
6654
|
+
className: "ddga-tag-input__field",
|
|
6655
|
+
type: "text",
|
|
6656
|
+
value: draft,
|
|
6657
|
+
disabled,
|
|
6658
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
6659
|
+
onChange: (event) => setDraft(event.target.value),
|
|
6660
|
+
onKeyDown: handleKeyDown,
|
|
6661
|
+
onPaste: handlePaste
|
|
6662
|
+
}
|
|
6663
|
+
)
|
|
6664
|
+
]
|
|
6665
|
+
}
|
|
6666
|
+
),
|
|
6667
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { "data-slot": "tag-input-live", className: "ddga-sr-only", role: "status", "aria-live": "polite", children: announcement }),
|
|
6668
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
6669
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
6670
|
+
] });
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
// src/providers/DgaProvider.tsx
|
|
6674
|
+
var import_react35 = require("react");
|
|
6675
|
+
var import_radix_ui34 = require("radix-ui");
|
|
6676
|
+
var import_tokens = require("@dev-dga/tokens");
|
|
6677
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
6678
|
+
function DgaProvider({
|
|
6679
|
+
dir = "ltr",
|
|
6680
|
+
locale,
|
|
6681
|
+
mode = "light",
|
|
6682
|
+
theme,
|
|
6683
|
+
as: Component = "div",
|
|
6684
|
+
className,
|
|
6685
|
+
style: consumerStyle,
|
|
6686
|
+
children
|
|
6687
|
+
}) {
|
|
6688
|
+
const parentCtx = (0, import_react35.useContext)(DgaContext);
|
|
6689
|
+
const isNested = parentCtx !== null;
|
|
6690
|
+
const [rootEl, setRootEl] = (0, import_react35.useState)(null);
|
|
6691
|
+
const portalRef = (0, import_react35.useRef)(null);
|
|
6692
|
+
const [portalEl, setPortalEl] = (0, import_react35.useState)(null);
|
|
6693
|
+
const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
|
|
6694
|
+
const themeVars = (0, import_react35.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
|
|
6695
|
+
(0, import_react35.useEffect)(() => {
|
|
6696
|
+
if (typeof document === "undefined") return;
|
|
6697
|
+
const el = document.createElement("div");
|
|
6698
|
+
el.setAttribute("data-slot", "dga-portal");
|
|
6699
|
+
el.style.position = "relative";
|
|
6700
|
+
el.style.zIndex = "50";
|
|
6701
|
+
document.body.appendChild(el);
|
|
6702
|
+
portalRef.current = el;
|
|
6703
|
+
setPortalEl(el);
|
|
6704
|
+
return () => {
|
|
6705
|
+
el.remove();
|
|
6706
|
+
portalRef.current = null;
|
|
6707
|
+
setPortalEl(null);
|
|
6708
|
+
};
|
|
6709
|
+
}, []);
|
|
6710
|
+
(0, import_react35.useEffect)(() => {
|
|
6711
|
+
const el = portalRef.current;
|
|
6712
|
+
if (!el) return;
|
|
6713
|
+
el.setAttribute("data-theme", mode);
|
|
6714
|
+
el.setAttribute("dir", dir);
|
|
6715
|
+
el.style.colorScheme = mode;
|
|
6716
|
+
if (themeVars) {
|
|
6717
|
+
for (const [k, v] of Object.entries(themeVars)) {
|
|
6718
|
+
el.style.setProperty(k, String(v));
|
|
6719
|
+
}
|
|
6720
|
+
}
|
|
6721
|
+
}, [mode, dir, themeVars, portalEl]);
|
|
6722
|
+
const ctxValue = (0, import_react35.useMemo)(
|
|
6723
|
+
() => ({ dir, locale: resolvedLocale, mode, rootEl, portalEl }),
|
|
6724
|
+
[dir, resolvedLocale, mode, rootEl, portalEl]
|
|
6725
|
+
);
|
|
6726
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_radix_ui34.Direction.Provider, { dir, children });
|
|
6727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6728
|
+
Component,
|
|
6729
|
+
{
|
|
6730
|
+
ref: setRootEl,
|
|
6731
|
+
dir,
|
|
6732
|
+
lang: resolvedLocale,
|
|
6733
|
+
"data-slot": "dga-root",
|
|
6734
|
+
"data-theme": mode,
|
|
6735
|
+
className,
|
|
6736
|
+
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
6737
|
+
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_radix_ui34.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
6738
|
+
}
|
|
6739
|
+
) });
|
|
4245
6740
|
}
|
|
4246
6741
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4247
6742
|
0 && (module.exports = {
|
|
@@ -4274,10 +6769,21 @@ function useDir() {
|
|
|
4274
6769
|
CardTitle,
|
|
4275
6770
|
Checkbox,
|
|
4276
6771
|
CircularProgress,
|
|
6772
|
+
Collapsible,
|
|
6773
|
+
CollapsibleContent,
|
|
6774
|
+
CollapsibleTrigger,
|
|
4277
6775
|
Combobox,
|
|
4278
6776
|
ComboboxGroup,
|
|
4279
6777
|
ComboboxItem,
|
|
4280
6778
|
ComboboxSeparator,
|
|
6779
|
+
Command,
|
|
6780
|
+
CommandDialog,
|
|
6781
|
+
CommandEmpty,
|
|
6782
|
+
CommandGroup,
|
|
6783
|
+
CommandInput,
|
|
6784
|
+
CommandItem,
|
|
6785
|
+
CommandList,
|
|
6786
|
+
CommandSeparator,
|
|
4281
6787
|
DatePicker,
|
|
4282
6788
|
DescriptionDetails,
|
|
4283
6789
|
DescriptionItem,
|
|
@@ -4307,9 +6813,35 @@ function useDir() {
|
|
|
4307
6813
|
DropdownMenuSubContent,
|
|
4308
6814
|
DropdownMenuSubTrigger,
|
|
4309
6815
|
DropdownMenuTrigger,
|
|
6816
|
+
EmptyState,
|
|
6817
|
+
EmptyStateActions,
|
|
6818
|
+
EmptyStateDescription,
|
|
6819
|
+
EmptyStateMedia,
|
|
6820
|
+
EmptyStateTitle,
|
|
4310
6821
|
FieldMessage,
|
|
4311
6822
|
FileUpload,
|
|
4312
6823
|
Input,
|
|
6824
|
+
InputOTP,
|
|
6825
|
+
Link,
|
|
6826
|
+
List,
|
|
6827
|
+
ListItem,
|
|
6828
|
+
ListItemAction,
|
|
6829
|
+
ListItemContent,
|
|
6830
|
+
ListItemIcon,
|
|
6831
|
+
Menubar,
|
|
6832
|
+
MenubarCheckboxItem,
|
|
6833
|
+
MenubarContent,
|
|
6834
|
+
MenubarGroup,
|
|
6835
|
+
MenubarItem,
|
|
6836
|
+
MenubarLabel,
|
|
6837
|
+
MenubarMenu,
|
|
6838
|
+
MenubarRadioGroup,
|
|
6839
|
+
MenubarRadioItem,
|
|
6840
|
+
MenubarSeparator,
|
|
6841
|
+
MenubarSub,
|
|
6842
|
+
MenubarSubContent,
|
|
6843
|
+
MenubarSubTrigger,
|
|
6844
|
+
MenubarTrigger,
|
|
4313
6845
|
Modal,
|
|
4314
6846
|
ModalClose,
|
|
4315
6847
|
ModalContent,
|
|
@@ -4326,26 +6858,82 @@ function useDir() {
|
|
|
4326
6858
|
PaginationLink,
|
|
4327
6859
|
PaginationNext,
|
|
4328
6860
|
PaginationPrevious,
|
|
6861
|
+
Popover,
|
|
6862
|
+
PopoverAnchor,
|
|
6863
|
+
PopoverClose,
|
|
6864
|
+
PopoverContent,
|
|
6865
|
+
PopoverTrigger,
|
|
4329
6866
|
Progress,
|
|
6867
|
+
Quote,
|
|
6868
|
+
QuoteAuthor,
|
|
6869
|
+
QuoteCaption,
|
|
6870
|
+
QuoteContent,
|
|
6871
|
+
QuoteSource,
|
|
4330
6872
|
Radio,
|
|
4331
6873
|
RadioGroup,
|
|
4332
6874
|
Rating,
|
|
6875
|
+
ScrollArea,
|
|
6876
|
+
SearchBox,
|
|
4333
6877
|
Select,
|
|
4334
6878
|
SelectItem,
|
|
6879
|
+
Sidebar,
|
|
6880
|
+
SidebarContent,
|
|
6881
|
+
SidebarFooter,
|
|
6882
|
+
SidebarGroup,
|
|
6883
|
+
SidebarGroupAction,
|
|
6884
|
+
SidebarGroupContent,
|
|
6885
|
+
SidebarGroupLabel,
|
|
6886
|
+
SidebarHeader,
|
|
6887
|
+
SidebarInset,
|
|
6888
|
+
SidebarMenu,
|
|
6889
|
+
SidebarMenuAction,
|
|
6890
|
+
SidebarMenuBadge,
|
|
6891
|
+
SidebarMenuButton,
|
|
6892
|
+
SidebarMenuItem,
|
|
6893
|
+
SidebarMenuSkeleton,
|
|
6894
|
+
SidebarMenuSub,
|
|
6895
|
+
SidebarMenuSubButton,
|
|
6896
|
+
SidebarMenuSubItem,
|
|
6897
|
+
SidebarProvider,
|
|
6898
|
+
SidebarRail,
|
|
6899
|
+
SidebarSeparator,
|
|
6900
|
+
SidebarTrigger,
|
|
4335
6901
|
Skeleton,
|
|
4336
6902
|
Slider,
|
|
4337
6903
|
Spinner,
|
|
6904
|
+
Stat,
|
|
6905
|
+
StatChange,
|
|
6906
|
+
StatChart,
|
|
6907
|
+
StatGroup,
|
|
6908
|
+
StatLabel,
|
|
6909
|
+
StatValue,
|
|
4338
6910
|
Step,
|
|
4339
6911
|
StepDescription,
|
|
4340
6912
|
StepIndicator,
|
|
4341
6913
|
StepTitle,
|
|
4342
6914
|
Steps,
|
|
4343
6915
|
Switch,
|
|
6916
|
+
Table,
|
|
6917
|
+
TableBody,
|
|
6918
|
+
TableCaption,
|
|
6919
|
+
TableCell,
|
|
6920
|
+
TableFooter,
|
|
6921
|
+
TableHead,
|
|
6922
|
+
TableHeader,
|
|
6923
|
+
TableRow,
|
|
4344
6924
|
Tabs,
|
|
4345
6925
|
TabsContent,
|
|
4346
6926
|
TabsList,
|
|
4347
6927
|
TabsTrigger,
|
|
6928
|
+
TagInput,
|
|
4348
6929
|
Textarea,
|
|
6930
|
+
Timeline,
|
|
6931
|
+
TimelineContent,
|
|
6932
|
+
TimelineDescription,
|
|
6933
|
+
TimelineItem,
|
|
6934
|
+
TimelineMarker,
|
|
6935
|
+
TimelineTime,
|
|
6936
|
+
TimelineTitle,
|
|
4349
6937
|
Toaster,
|
|
4350
6938
|
Toggle,
|
|
4351
6939
|
ToggleGroup,
|
|
@@ -4365,6 +6953,7 @@ function useDir() {
|
|
|
4365
6953
|
cn,
|
|
4366
6954
|
comboboxTriggerVariants,
|
|
4367
6955
|
comboboxVariants,
|
|
6956
|
+
commandVariants,
|
|
4368
6957
|
createToast,
|
|
4369
6958
|
createToastStore,
|
|
4370
6959
|
datePickerVariants,
|
|
@@ -4372,25 +6961,42 @@ function useDir() {
|
|
|
4372
6961
|
dividerVariants,
|
|
4373
6962
|
drawerVariants,
|
|
4374
6963
|
dropdownMenuVariants,
|
|
6964
|
+
emptyStateVariants,
|
|
6965
|
+
inputOTPVariants,
|
|
4375
6966
|
inputVariants,
|
|
6967
|
+
linkVariants,
|
|
6968
|
+
listVariants,
|
|
6969
|
+
menubarContentVariants,
|
|
6970
|
+
menubarTriggerVariants,
|
|
4376
6971
|
modalContentVariants,
|
|
4377
6972
|
numberInputVariants,
|
|
4378
6973
|
paginationLinkVariants,
|
|
4379
6974
|
paginationVariants,
|
|
6975
|
+
popoverContentVariants,
|
|
4380
6976
|
progressVariants,
|
|
6977
|
+
quoteVariants,
|
|
4381
6978
|
radioGroupVariants,
|
|
4382
6979
|
radioVariants,
|
|
4383
6980
|
ratingVariants,
|
|
6981
|
+
scrollAreaVariants,
|
|
4384
6982
|
selectTriggerVariants,
|
|
6983
|
+
sidebarMenuButtonVariants,
|
|
6984
|
+
sidebarMenuSubButtonVariants,
|
|
4385
6985
|
skeletonVariants,
|
|
4386
6986
|
sliderVariants,
|
|
4387
6987
|
spinnerVariants,
|
|
6988
|
+
statGroupVariants,
|
|
6989
|
+
statVariants,
|
|
4388
6990
|
stepVariants,
|
|
4389
6991
|
stepsVariants,
|
|
4390
6992
|
switchVariants,
|
|
6993
|
+
tableVariants,
|
|
4391
6994
|
tabsListVariants,
|
|
4392
6995
|
tabsVariants,
|
|
6996
|
+
tagInputVariants,
|
|
4393
6997
|
textareaVariants,
|
|
6998
|
+
timelineMarkerVariants,
|
|
6999
|
+
timelineVariants,
|
|
4394
7000
|
toast,
|
|
4395
7001
|
toastStore,
|
|
4396
7002
|
toastVariants,
|
|
@@ -4400,6 +7006,8 @@ function useDir() {
|
|
|
4400
7006
|
tooltipContentVariants,
|
|
4401
7007
|
useDga,
|
|
4402
7008
|
useDir,
|
|
4403
|
-
useFieldA11y
|
|
7009
|
+
useFieldA11y,
|
|
7010
|
+
useIsMobile,
|
|
7011
|
+
useSidebar
|
|
4404
7012
|
});
|
|
4405
7013
|
//# sourceMappingURL=index.cjs.map
|