@dev-dga/react 0.7.0 → 0.8.1
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 +46 -0
- package/README.md +5 -5
- package/dist/index.cjs +2054 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +507 -25
- package/dist/index.d.ts +507 -25
- package/dist/index.js +2000 -391
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(src_exports, {
|
|
|
27
27
|
Alert: () => Alert,
|
|
28
28
|
AlertDescription: () => AlertDescription,
|
|
29
29
|
AlertTitle: () => AlertTitle,
|
|
30
|
+
AspectRatio: () => AspectRatio,
|
|
30
31
|
Avatar: () => Avatar,
|
|
31
32
|
AvatarFallback: () => AvatarFallback,
|
|
32
33
|
AvatarGroup: () => AvatarGroup,
|
|
@@ -49,11 +50,23 @@ __export(src_exports, {
|
|
|
49
50
|
CardTitle: () => CardTitle,
|
|
50
51
|
Checkbox: () => Checkbox,
|
|
51
52
|
CircularProgress: () => CircularProgress,
|
|
53
|
+
Collapsible: () => Collapsible,
|
|
54
|
+
CollapsibleContent: () => CollapsibleContent,
|
|
55
|
+
CollapsibleTrigger: () => CollapsibleTrigger,
|
|
52
56
|
Combobox: () => Combobox,
|
|
53
57
|
ComboboxGroup: () => ComboboxGroup,
|
|
54
58
|
ComboboxItem: () => ComboboxItem,
|
|
55
59
|
ComboboxSeparator: () => ComboboxSeparator,
|
|
60
|
+
Command: () => Command2,
|
|
61
|
+
CommandDialog: () => CommandDialog,
|
|
62
|
+
CommandEmpty: () => CommandEmpty,
|
|
63
|
+
CommandGroup: () => CommandGroup,
|
|
64
|
+
CommandInput: () => CommandInput,
|
|
65
|
+
CommandItem: () => CommandItem,
|
|
66
|
+
CommandList: () => CommandList,
|
|
67
|
+
CommandSeparator: () => CommandSeparator,
|
|
56
68
|
DatePicker: () => DatePicker,
|
|
69
|
+
DateRangePicker: () => DateRangePicker,
|
|
57
70
|
DescriptionDetails: () => DescriptionDetails,
|
|
58
71
|
DescriptionItem: () => DescriptionItem,
|
|
59
72
|
DescriptionList: () => DescriptionList,
|
|
@@ -90,6 +103,13 @@ __export(src_exports, {
|
|
|
90
103
|
FieldMessage: () => FieldMessage,
|
|
91
104
|
FileUpload: () => FileUpload,
|
|
92
105
|
Input: () => Input,
|
|
106
|
+
InputOTP: () => InputOTP,
|
|
107
|
+
Link: () => Link,
|
|
108
|
+
List: () => List,
|
|
109
|
+
ListItem: () => ListItem,
|
|
110
|
+
ListItemAction: () => ListItemAction,
|
|
111
|
+
ListItemContent: () => ListItemContent,
|
|
112
|
+
ListItemIcon: () => ListItemIcon,
|
|
93
113
|
Menubar: () => Menubar,
|
|
94
114
|
MenubarCheckboxItem: () => MenubarCheckboxItem,
|
|
95
115
|
MenubarContent: () => MenubarContent,
|
|
@@ -126,10 +146,16 @@ __export(src_exports, {
|
|
|
126
146
|
PopoverContent: () => PopoverContent,
|
|
127
147
|
PopoverTrigger: () => PopoverTrigger,
|
|
128
148
|
Progress: () => Progress,
|
|
149
|
+
Quote: () => Quote,
|
|
150
|
+
QuoteAuthor: () => QuoteAuthor,
|
|
151
|
+
QuoteCaption: () => QuoteCaption,
|
|
152
|
+
QuoteContent: () => QuoteContent,
|
|
153
|
+
QuoteSource: () => QuoteSource,
|
|
129
154
|
Radio: () => Radio,
|
|
130
155
|
RadioGroup: () => RadioGroup,
|
|
131
156
|
Rating: () => Rating,
|
|
132
157
|
ScrollArea: () => ScrollArea,
|
|
158
|
+
SearchBox: () => SearchBox,
|
|
133
159
|
Select: () => Select,
|
|
134
160
|
SelectItem: () => SelectItem,
|
|
135
161
|
Sidebar: () => Sidebar,
|
|
@@ -159,6 +185,7 @@ __export(src_exports, {
|
|
|
159
185
|
Spinner: () => Spinner,
|
|
160
186
|
Stat: () => Stat,
|
|
161
187
|
StatChange: () => StatChange,
|
|
188
|
+
StatChart: () => StatChart,
|
|
162
189
|
StatGroup: () => StatGroup,
|
|
163
190
|
StatLabel: () => StatLabel,
|
|
164
191
|
StatValue: () => StatValue,
|
|
@@ -168,10 +195,19 @@ __export(src_exports, {
|
|
|
168
195
|
StepTitle: () => StepTitle,
|
|
169
196
|
Steps: () => Steps,
|
|
170
197
|
Switch: () => Switch,
|
|
198
|
+
Table: () => Table,
|
|
199
|
+
TableBody: () => TableBody,
|
|
200
|
+
TableCaption: () => TableCaption,
|
|
201
|
+
TableCell: () => TableCell,
|
|
202
|
+
TableFooter: () => TableFooter,
|
|
203
|
+
TableHead: () => TableHead,
|
|
204
|
+
TableHeader: () => TableHeader,
|
|
205
|
+
TableRow: () => TableRow,
|
|
171
206
|
Tabs: () => Tabs,
|
|
172
207
|
TabsContent: () => TabsContent,
|
|
173
208
|
TabsList: () => TabsList,
|
|
174
209
|
TabsTrigger: () => TabsTrigger,
|
|
210
|
+
TagInput: () => TagInput,
|
|
175
211
|
Textarea: () => Textarea,
|
|
176
212
|
Timeline: () => Timeline,
|
|
177
213
|
TimelineContent: () => TimelineContent,
|
|
@@ -199,15 +235,21 @@ __export(src_exports, {
|
|
|
199
235
|
cn: () => cn,
|
|
200
236
|
comboboxTriggerVariants: () => comboboxTriggerVariants,
|
|
201
237
|
comboboxVariants: () => comboboxVariants,
|
|
238
|
+
commandVariants: () => commandVariants,
|
|
202
239
|
createToast: () => createToast,
|
|
203
240
|
createToastStore: () => createToastStore,
|
|
204
241
|
datePickerVariants: () => datePickerVariants,
|
|
242
|
+
dateRangePickerTriggerVariants: () => dateRangePickerTriggerVariants,
|
|
243
|
+
dateRangePickerVariants: () => dateRangePickerVariants,
|
|
205
244
|
descriptionListVariants: () => descriptionListVariants,
|
|
206
245
|
dividerVariants: () => dividerVariants,
|
|
207
246
|
drawerVariants: () => drawerVariants,
|
|
208
247
|
dropdownMenuVariants: () => dropdownMenuVariants,
|
|
209
248
|
emptyStateVariants: () => emptyStateVariants,
|
|
249
|
+
inputOTPVariants: () => inputOTPVariants,
|
|
210
250
|
inputVariants: () => inputVariants,
|
|
251
|
+
linkVariants: () => linkVariants,
|
|
252
|
+
listVariants: () => listVariants,
|
|
211
253
|
menubarContentVariants: () => menubarContentVariants,
|
|
212
254
|
menubarTriggerVariants: () => menubarTriggerVariants,
|
|
213
255
|
modalContentVariants: () => modalContentVariants,
|
|
@@ -216,6 +258,7 @@ __export(src_exports, {
|
|
|
216
258
|
paginationVariants: () => paginationVariants,
|
|
217
259
|
popoverContentVariants: () => popoverContentVariants,
|
|
218
260
|
progressVariants: () => progressVariants,
|
|
261
|
+
quoteVariants: () => quoteVariants,
|
|
219
262
|
radioGroupVariants: () => radioGroupVariants,
|
|
220
263
|
radioVariants: () => radioVariants,
|
|
221
264
|
ratingVariants: () => ratingVariants,
|
|
@@ -231,8 +274,10 @@ __export(src_exports, {
|
|
|
231
274
|
stepVariants: () => stepVariants,
|
|
232
275
|
stepsVariants: () => stepsVariants,
|
|
233
276
|
switchVariants: () => switchVariants,
|
|
277
|
+
tableVariants: () => tableVariants,
|
|
234
278
|
tabsListVariants: () => tabsListVariants,
|
|
235
279
|
tabsVariants: () => tabsVariants,
|
|
280
|
+
tagInputVariants: () => tagInputVariants,
|
|
236
281
|
textareaVariants: () => textareaVariants,
|
|
237
282
|
timelineMarkerVariants: () => timelineMarkerVariants,
|
|
238
283
|
timelineVariants: () => timelineVariants,
|
|
@@ -333,6 +378,16 @@ var buttonVariants = (0, import_class_variance_authority2.cva)("ddga-button", {
|
|
|
333
378
|
*/
|
|
334
379
|
inverted: {
|
|
335
380
|
true: "ddga-button--inverted"
|
|
381
|
+
},
|
|
382
|
+
/**
|
|
383
|
+
* Floating action button: fully-rounded + elevated. Orthogonal to `variant`
|
|
384
|
+
* (color) and `size` — pair with `size="icon"` for a circular FAB, or a text
|
|
385
|
+
* size for an extended pill FAB. Positioning (`position: fixed`, safe-area
|
|
386
|
+
* insets) is the consumer's responsibility — see the placement recipe in the
|
|
387
|
+
* stories. Keep it a modifier, not a `Fab` wrapper component.
|
|
388
|
+
*/
|
|
389
|
+
fab: {
|
|
390
|
+
true: "ddga-button--fab"
|
|
336
391
|
}
|
|
337
392
|
},
|
|
338
393
|
compoundVariants: [],
|
|
@@ -346,6 +401,7 @@ function Button({
|
|
|
346
401
|
size,
|
|
347
402
|
fullWidth,
|
|
348
403
|
inverted,
|
|
404
|
+
fab,
|
|
349
405
|
loading,
|
|
350
406
|
disabled,
|
|
351
407
|
startIcon,
|
|
@@ -375,7 +431,7 @@ function Button({
|
|
|
375
431
|
"aria-busy": loading || void 0,
|
|
376
432
|
"data-slot": "button",
|
|
377
433
|
className: cn(
|
|
378
|
-
buttonVariants({ variant, size, fullWidth, inverted }),
|
|
434
|
+
buttonVariants({ variant, size, fullWidth, inverted, fab }),
|
|
379
435
|
loading && "ddga-button--loading",
|
|
380
436
|
className
|
|
381
437
|
),
|
|
@@ -957,6 +1013,43 @@ function CaretDown(props) {
|
|
|
957
1013
|
}
|
|
958
1014
|
);
|
|
959
1015
|
}
|
|
1016
|
+
function ExternalLink(props) {
|
|
1017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1018
|
+
"svg",
|
|
1019
|
+
{
|
|
1020
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1021
|
+
width: "1em",
|
|
1022
|
+
height: "1em",
|
|
1023
|
+
viewBox: "0 0 24 24",
|
|
1024
|
+
fill: "none",
|
|
1025
|
+
stroke: "currentColor",
|
|
1026
|
+
strokeWidth: "2",
|
|
1027
|
+
strokeLinecap: "round",
|
|
1028
|
+
strokeLinejoin: "round",
|
|
1029
|
+
...props,
|
|
1030
|
+
children: [
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M15 3h6v6" }),
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M10 14 21 3" }),
|
|
1033
|
+
/* @__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" })
|
|
1034
|
+
]
|
|
1035
|
+
}
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
function QuoteMark(props) {
|
|
1039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1040
|
+
"svg",
|
|
1041
|
+
{
|
|
1042
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1043
|
+
width: "1em",
|
|
1044
|
+
height: "1em",
|
|
1045
|
+
viewBox: "0 0 24 24",
|
|
1046
|
+
fill: "currentColor",
|
|
1047
|
+
stroke: "none",
|
|
1048
|
+
...props,
|
|
1049
|
+
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" })
|
|
1050
|
+
}
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
960
1053
|
function PanelLeft(props) {
|
|
961
1054
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
962
1055
|
"svg",
|
|
@@ -1251,6 +1344,8 @@ function Select({
|
|
|
1251
1344
|
placeholder,
|
|
1252
1345
|
className,
|
|
1253
1346
|
children,
|
|
1347
|
+
"aria-label": ariaLabel,
|
|
1348
|
+
"aria-labelledby": ariaLabelledby,
|
|
1254
1349
|
...rootProps
|
|
1255
1350
|
}) {
|
|
1256
1351
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
@@ -1260,8 +1355,8 @@ function Select({
|
|
|
1260
1355
|
error,
|
|
1261
1356
|
errorMessage,
|
|
1262
1357
|
helperText,
|
|
1263
|
-
"aria-label":
|
|
1264
|
-
"aria-labelledby":
|
|
1358
|
+
"aria-label": ariaLabel,
|
|
1359
|
+
"aria-labelledby": ariaLabelledby
|
|
1265
1360
|
});
|
|
1266
1361
|
const ctx = (0, import_react5.useContext)(DgaContext);
|
|
1267
1362
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
@@ -1275,6 +1370,8 @@ function Select({
|
|
|
1275
1370
|
import_radix_ui5.Select.Trigger,
|
|
1276
1371
|
{
|
|
1277
1372
|
...controlProps,
|
|
1373
|
+
"aria-label": ariaLabel,
|
|
1374
|
+
"aria-labelledby": ariaLabelledby,
|
|
1278
1375
|
"data-slot": "select-trigger",
|
|
1279
1376
|
className: cn(selectTriggerVariants({ size, error: hasError }), className),
|
|
1280
1377
|
children: [
|
|
@@ -1603,7 +1700,7 @@ function Avatar({ size, shape, status, statusLabel, className, children, ...prop
|
|
|
1603
1700
|
"span",
|
|
1604
1701
|
{
|
|
1605
1702
|
className: cn("ddga-avatar__status", `ddga-avatar__status--${status}`),
|
|
1606
|
-
role: "
|
|
1703
|
+
role: "img",
|
|
1607
1704
|
"aria-label": statusLabel ?? status
|
|
1608
1705
|
}
|
|
1609
1706
|
) : null
|
|
@@ -2093,6 +2190,7 @@ function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
|
|
|
2093
2190
|
}
|
|
2094
2191
|
|
|
2095
2192
|
// src/components/Tabs/Tabs.tsx
|
|
2193
|
+
var import_react13 = require("react");
|
|
2096
2194
|
var import_radix_ui13 = require("radix-ui");
|
|
2097
2195
|
var import_class_variance_authority17 = require("class-variance-authority");
|
|
2098
2196
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -2139,13 +2237,49 @@ function TabsList({ fullWidth, className, ...props }) {
|
|
|
2139
2237
|
}
|
|
2140
2238
|
);
|
|
2141
2239
|
}
|
|
2142
|
-
function TabsTrigger({
|
|
2240
|
+
function TabsTrigger({
|
|
2241
|
+
className,
|
|
2242
|
+
startIcon,
|
|
2243
|
+
endIcon,
|
|
2244
|
+
children,
|
|
2245
|
+
asChild,
|
|
2246
|
+
...props
|
|
2247
|
+
}) {
|
|
2248
|
+
const hasIcon = startIcon != null || endIcon != null;
|
|
2249
|
+
const hasText = children != null && children !== "" && typeof children !== "boolean";
|
|
2250
|
+
const isIconOnly = !asChild && hasIcon && !hasText;
|
|
2251
|
+
if (process.env.NODE_ENV === "development") {
|
|
2252
|
+
if (isIconOnly && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
2253
|
+
console.warn(
|
|
2254
|
+
"[@dev-dga/react] An icon-only TabsTrigger (icon with no text label) requires an aria-label or aria-labelledby for screen reader accessibility."
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
if (asChild && hasIcon) {
|
|
2258
|
+
console.warn(
|
|
2259
|
+
"[@dev-dga/react] TabsTrigger `startIcon`/`endIcon` are ignored when `asChild` is set \u2014 render the icons inside your child element instead."
|
|
2260
|
+
);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2143
2263
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2144
2264
|
import_radix_ui13.Tabs.Trigger,
|
|
2145
2265
|
{
|
|
2146
2266
|
"data-slot": "tabs-trigger",
|
|
2147
|
-
|
|
2148
|
-
|
|
2267
|
+
asChild,
|
|
2268
|
+
className: cn("ddga-tabs__trigger", isIconOnly && "ddga-tabs__trigger--icon-only", className),
|
|
2269
|
+
...props,
|
|
2270
|
+
children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2271
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2272
|
+
"span",
|
|
2273
|
+
{
|
|
2274
|
+
className: "ddga-tabs__icon",
|
|
2275
|
+
"data-slot": "tabs-trigger-start-icon",
|
|
2276
|
+
"aria-hidden": "true",
|
|
2277
|
+
children: startIcon
|
|
2278
|
+
}
|
|
2279
|
+
),
|
|
2280
|
+
children,
|
|
2281
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ddga-tabs__icon", "data-slot": "tabs-trigger-end-icon", "aria-hidden": "true", children: endIcon })
|
|
2282
|
+
] })
|
|
2149
2283
|
}
|
|
2150
2284
|
);
|
|
2151
2285
|
}
|
|
@@ -2615,30 +2749,65 @@ function Progress({ value = null, max = 100, size, color, className, ...props })
|
|
|
2615
2749
|
}
|
|
2616
2750
|
var CIRCULAR_SIZES = { sm: 32, md: 48, lg: 72 };
|
|
2617
2751
|
var CIRCULAR_DEFAULT_THICKNESS = { sm: 4, md: 5, lg: 6 };
|
|
2752
|
+
var SEGMENT_GAP_FRACTION = 0.16;
|
|
2618
2753
|
function CircularProgress({
|
|
2619
2754
|
value = null,
|
|
2620
2755
|
max = 100,
|
|
2621
2756
|
size,
|
|
2622
2757
|
color,
|
|
2623
2758
|
thickness,
|
|
2759
|
+
segments,
|
|
2624
2760
|
showLabel = false,
|
|
2625
2761
|
className,
|
|
2626
2762
|
...props
|
|
2627
2763
|
}) {
|
|
2764
|
+
if (process.env.NODE_ENV === "development" && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
2765
|
+
console.warn(
|
|
2766
|
+
"[dga/Progress] <CircularProgress> has no accessible name. Pass `aria-label` or `aria-labelledby` so screen-reader users know what the progress represents."
|
|
2767
|
+
);
|
|
2768
|
+
}
|
|
2628
2769
|
const isIndeterminate = value === null;
|
|
2770
|
+
const isSegmented = typeof segments === "number" && segments >= 2;
|
|
2629
2771
|
const sizeKey = size ?? "md";
|
|
2630
2772
|
const diameter = CIRCULAR_SIZES[sizeKey];
|
|
2631
2773
|
const strokeWidth = thickness ?? CIRCULAR_DEFAULT_THICKNESS[sizeKey];
|
|
2632
2774
|
const radius = (diameter - strokeWidth) / 2;
|
|
2633
2775
|
const circumference = 2 * Math.PI * radius;
|
|
2776
|
+
const center = diameter / 2;
|
|
2634
2777
|
const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
2635
2778
|
const dashOffset = isIndeterminate ? circumference * 0.75 : circumference * (1 - pct / 100);
|
|
2636
2779
|
const state = isIndeterminate ? "indeterminate" : value >= max ? "complete" : "loading";
|
|
2780
|
+
const segmentEls = isSegmented && segments ? (() => {
|
|
2781
|
+
const filled = isIndeterminate ? 0 : Math.round(pct / 100 * segments);
|
|
2782
|
+
const segAngle = 360 / segments;
|
|
2783
|
+
const gapAngle = segAngle * SEGMENT_GAP_FRACTION;
|
|
2784
|
+
const segLen = circumference * ((1 - SEGMENT_GAP_FRACTION) / segments);
|
|
2785
|
+
return Array.from({ length: segments }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2786
|
+
"circle",
|
|
2787
|
+
{
|
|
2788
|
+
className: cn(
|
|
2789
|
+
"ddga-circular-progress__segment",
|
|
2790
|
+
i < filled && "ddga-circular-progress__segment--filled"
|
|
2791
|
+
),
|
|
2792
|
+
cx: center,
|
|
2793
|
+
cy: center,
|
|
2794
|
+
r: radius,
|
|
2795
|
+
fill: "none",
|
|
2796
|
+
strokeWidth,
|
|
2797
|
+
strokeLinecap: "butt",
|
|
2798
|
+
strokeDasharray: `${segLen} ${circumference}`,
|
|
2799
|
+
transform: `rotate(${-90 + i * segAngle + gapAngle / 2} ${center} ${center})`
|
|
2800
|
+
},
|
|
2801
|
+
i
|
|
2802
|
+
));
|
|
2803
|
+
})() : null;
|
|
2804
|
+
const labelText = isSegmented ? `${segments ? Math.round(pct / 100 * segments) : 0}/${segments}` : `${Math.round(pct)}%`;
|
|
2637
2805
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2638
2806
|
"div",
|
|
2639
2807
|
{
|
|
2640
2808
|
"data-slot": "circular-progress",
|
|
2641
2809
|
"data-state": state,
|
|
2810
|
+
"data-segmented": isSegmented ? "" : void 0,
|
|
2642
2811
|
role: "progressbar",
|
|
2643
2812
|
"aria-valuemin": 0,
|
|
2644
2813
|
"aria-valuemax": max,
|
|
@@ -2647,7 +2816,7 @@ function CircularProgress({
|
|
|
2647
2816
|
style: { inlineSize: diameter, blockSize: diameter },
|
|
2648
2817
|
...props,
|
|
2649
2818
|
children: [
|
|
2650
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2651
2820
|
"svg",
|
|
2652
2821
|
{
|
|
2653
2822
|
className: "ddga-circular-progress__svg",
|
|
@@ -2656,13 +2825,13 @@ function CircularProgress({
|
|
|
2656
2825
|
height: diameter,
|
|
2657
2826
|
"aria-hidden": "true",
|
|
2658
2827
|
focusable: "false",
|
|
2659
|
-
children: [
|
|
2828
|
+
children: isSegmented ? segmentEls : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2660
2829
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2661
2830
|
"circle",
|
|
2662
2831
|
{
|
|
2663
2832
|
className: "ddga-circular-progress__track",
|
|
2664
|
-
cx:
|
|
2665
|
-
cy:
|
|
2833
|
+
cx: center,
|
|
2834
|
+
cy: center,
|
|
2666
2835
|
r: radius,
|
|
2667
2836
|
fill: "none",
|
|
2668
2837
|
strokeWidth
|
|
@@ -2672,31 +2841,28 @@ function CircularProgress({
|
|
|
2672
2841
|
"circle",
|
|
2673
2842
|
{
|
|
2674
2843
|
className: "ddga-circular-progress__indicator",
|
|
2675
|
-
cx:
|
|
2676
|
-
cy:
|
|
2844
|
+
cx: center,
|
|
2845
|
+
cy: center,
|
|
2677
2846
|
r: radius,
|
|
2678
2847
|
fill: "none",
|
|
2679
2848
|
strokeWidth,
|
|
2680
2849
|
strokeLinecap: "round",
|
|
2681
2850
|
strokeDasharray: circumference,
|
|
2682
2851
|
strokeDashoffset: dashOffset,
|
|
2683
|
-
transform: `rotate(-90 ${
|
|
2852
|
+
transform: `rotate(-90 ${center} ${center})`
|
|
2684
2853
|
}
|
|
2685
2854
|
)
|
|
2686
|
-
]
|
|
2855
|
+
] })
|
|
2687
2856
|
}
|
|
2688
2857
|
),
|
|
2689
|
-
showLabel && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2690
|
-
Math.round(pct),
|
|
2691
|
-
"%"
|
|
2692
|
-
] }) : null
|
|
2858
|
+
showLabel && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ddga-circular-progress__label", "aria-hidden": "true", children: labelText }) : null
|
|
2693
2859
|
]
|
|
2694
2860
|
}
|
|
2695
2861
|
);
|
|
2696
2862
|
}
|
|
2697
2863
|
|
|
2698
2864
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
2699
|
-
var
|
|
2865
|
+
var import_react14 = require("react");
|
|
2700
2866
|
var import_radix_ui18 = require("radix-ui");
|
|
2701
2867
|
var import_class_variance_authority24 = require("class-variance-authority");
|
|
2702
2868
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -2723,7 +2889,7 @@ function DropdownMenuContent({
|
|
|
2723
2889
|
sideOffset = 6,
|
|
2724
2890
|
...props
|
|
2725
2891
|
}) {
|
|
2726
|
-
const ctx = (0,
|
|
2892
|
+
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2727
2893
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2728
2894
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2729
2895
|
import_radix_ui18.DropdownMenu.Content,
|
|
@@ -2854,7 +3020,7 @@ function DropdownMenuSubTrigger({
|
|
|
2854
3020
|
);
|
|
2855
3021
|
}
|
|
2856
3022
|
function DropdownMenuSubContent({ size, className, ...props }) {
|
|
2857
|
-
const ctx = (0,
|
|
3023
|
+
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2858
3024
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2859
3025
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2860
3026
|
import_radix_ui18.DropdownMenu.SubContent,
|
|
@@ -2867,7 +3033,7 @@ function DropdownMenuSubContent({ size, className, ...props }) {
|
|
|
2867
3033
|
}
|
|
2868
3034
|
|
|
2869
3035
|
// src/components/Drawer/Drawer.tsx
|
|
2870
|
-
var
|
|
3036
|
+
var import_react15 = require("react");
|
|
2871
3037
|
var import_radix_ui19 = require("radix-ui");
|
|
2872
3038
|
var import_class_variance_authority25 = require("class-variance-authority");
|
|
2873
3039
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -2906,7 +3072,7 @@ function DrawerContent({
|
|
|
2906
3072
|
children,
|
|
2907
3073
|
...props
|
|
2908
3074
|
}) {
|
|
2909
|
-
const ctx = (0,
|
|
3075
|
+
const ctx = (0, import_react15.useContext)(DgaContext);
|
|
2910
3076
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2911
3077
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_radix_ui19.Dialog.Portal, { container: portalContainer, children: [
|
|
2912
3078
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_radix_ui19.Dialog.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
|
|
@@ -2971,7 +3137,7 @@ function DrawerClose({ className, ...props }) {
|
|
|
2971
3137
|
}
|
|
2972
3138
|
|
|
2973
3139
|
// src/components/Combobox/Combobox.tsx
|
|
2974
|
-
var
|
|
3140
|
+
var import_react16 = require("react");
|
|
2975
3141
|
var import_cmdk = require("cmdk");
|
|
2976
3142
|
var import_radix_ui20 = require("radix-ui");
|
|
2977
3143
|
var import_class_variance_authority26 = require("class-variance-authority");
|
|
@@ -2991,9 +3157,9 @@ var comboboxTriggerVariants = (0, import_class_variance_authority26.cva)("ddga-c
|
|
|
2991
3157
|
}
|
|
2992
3158
|
});
|
|
2993
3159
|
var comboboxVariants = comboboxTriggerVariants;
|
|
2994
|
-
var ComboboxContext = (0,
|
|
3160
|
+
var ComboboxContext = (0, import_react16.createContext)(null);
|
|
2995
3161
|
function useComboboxContext(component) {
|
|
2996
|
-
const ctx = (0,
|
|
3162
|
+
const ctx = (0, import_react16.useContext)(ComboboxContext);
|
|
2997
3163
|
if (!ctx) {
|
|
2998
3164
|
throw new Error(`<${component}> must be rendered inside <Combobox>.`);
|
|
2999
3165
|
}
|
|
@@ -3023,20 +3189,20 @@ function Combobox({
|
|
|
3023
3189
|
"aria-label": ariaLabel,
|
|
3024
3190
|
"aria-labelledby": ariaLabelledBy
|
|
3025
3191
|
}) {
|
|
3026
|
-
const [internalValue, setInternalValue] = (0,
|
|
3192
|
+
const [internalValue, setInternalValue] = (0, import_react16.useState)(defaultValue);
|
|
3027
3193
|
const isControlled = controlledValue !== void 0;
|
|
3028
3194
|
const value = isControlled ? controlledValue : internalValue;
|
|
3029
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
3195
|
+
const [internalOpen, setInternalOpen] = (0, import_react16.useState)(defaultOpen ?? false);
|
|
3030
3196
|
const isOpenControlled = controlledOpen !== void 0;
|
|
3031
3197
|
const open = isOpenControlled ? controlledOpen : internalOpen;
|
|
3032
|
-
const setOpen = (0,
|
|
3198
|
+
const setOpen = (0, import_react16.useCallback)(
|
|
3033
3199
|
(next) => {
|
|
3034
3200
|
if (!isOpenControlled) setInternalOpen(next);
|
|
3035
3201
|
onOpenChange?.(next);
|
|
3036
3202
|
},
|
|
3037
3203
|
[isOpenControlled, onOpenChange]
|
|
3038
3204
|
);
|
|
3039
|
-
const select = (0,
|
|
3205
|
+
const select = (0, import_react16.useCallback)(
|
|
3040
3206
|
(next) => {
|
|
3041
3207
|
if (!isControlled) setInternalValue(next);
|
|
3042
3208
|
onValueChange?.(next);
|
|
@@ -3044,12 +3210,12 @@ function Combobox({
|
|
|
3044
3210
|
},
|
|
3045
3211
|
[isControlled, onValueChange, setOpen]
|
|
3046
3212
|
);
|
|
3047
|
-
const ctx = (0,
|
|
3048
|
-
const itemLabels = (0,
|
|
3213
|
+
const ctx = (0, import_react16.useMemo)(() => ({ value, select }), [value, select]);
|
|
3214
|
+
const itemLabels = (0, import_react16.useMemo)(() => {
|
|
3049
3215
|
const map = /* @__PURE__ */ new Map();
|
|
3050
3216
|
const visit = (nodes) => {
|
|
3051
|
-
|
|
3052
|
-
if (!(0,
|
|
3217
|
+
import_react16.Children.forEach(nodes, (child) => {
|
|
3218
|
+
if (!(0, import_react16.isValidElement)(child)) return;
|
|
3053
3219
|
const childProps = child.props;
|
|
3054
3220
|
if (typeof childProps.value === "string") {
|
|
3055
3221
|
map.set(childProps.value, childProps.children);
|
|
@@ -3071,14 +3237,14 @@ function Combobox({
|
|
|
3071
3237
|
"aria-label": ariaLabel,
|
|
3072
3238
|
"aria-labelledby": ariaLabelledBy
|
|
3073
3239
|
});
|
|
3074
|
-
const providerCtx = (0,
|
|
3240
|
+
const providerCtx = (0, import_react16.useContext)(DgaContext);
|
|
3075
3241
|
const portalContainer = providerCtx?.portalEl ?? providerCtx?.rootEl ?? void 0;
|
|
3076
|
-
const triggerLabel = (0,
|
|
3242
|
+
const triggerLabel = (0, import_react16.useMemo)(() => {
|
|
3077
3243
|
if (value === void 0) return null;
|
|
3078
3244
|
if (getLabel) return getLabel(value);
|
|
3079
3245
|
return itemLabels.get(value) ?? null;
|
|
3080
3246
|
}, [value, getLabel, itemLabels]);
|
|
3081
|
-
const searchId = (0,
|
|
3247
|
+
const searchId = (0, import_react16.useId)();
|
|
3082
3248
|
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: [
|
|
3083
3249
|
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { htmlFor: fieldId, className: "ddga-combobox__label", children: [
|
|
3084
3250
|
label,
|
|
@@ -3198,26 +3364,18 @@ function ComboboxSeparator({ className, ...props }) {
|
|
|
3198
3364
|
}
|
|
3199
3365
|
|
|
3200
3366
|
// src/components/DatePicker/DatePicker.tsx
|
|
3201
|
-
var
|
|
3367
|
+
var import_react18 = require("react");
|
|
3368
|
+
var import_react_aria_components2 = require("react-aria-components");
|
|
3369
|
+
var import_date2 = require("@internationalized/date");
|
|
3370
|
+
var import_class_variance_authority27 = require("class-variance-authority");
|
|
3371
|
+
|
|
3372
|
+
// src/internal/calendar/calendar-core.tsx
|
|
3373
|
+
var import_react17 = require("react");
|
|
3202
3374
|
var import_react_aria_components = require("react-aria-components");
|
|
3203
3375
|
var import_date = require("@internationalized/date");
|
|
3204
|
-
var import_class_variance_authority27 = require("class-variance-authority");
|
|
3205
3376
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3206
|
-
var
|
|
3207
|
-
|
|
3208
|
-
size: {
|
|
3209
|
-
sm: "ddga-date-picker-trigger--sm",
|
|
3210
|
-
md: "ddga-date-picker-trigger--md"
|
|
3211
|
-
},
|
|
3212
|
-
error: {
|
|
3213
|
-
true: "ddga-date-picker-trigger--error"
|
|
3214
|
-
}
|
|
3215
|
-
},
|
|
3216
|
-
defaultVariants: {
|
|
3217
|
-
size: "md"
|
|
3218
|
-
}
|
|
3219
|
-
});
|
|
3220
|
-
var datePickerVariants = datePickerTriggerVariants;
|
|
3377
|
+
var GREGORIAN = new import_date.GregorianCalendar();
|
|
3378
|
+
var ISLAMIC_UMALQURA = new import_date.IslamicUmalquraCalendar();
|
|
3221
3379
|
function dateToCalendarDate(date) {
|
|
3222
3380
|
if (!date) return null;
|
|
3223
3381
|
return new import_date.CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
@@ -3235,20 +3393,97 @@ function composeLocale(dgaLocale, calendar) {
|
|
|
3235
3393
|
}
|
|
3236
3394
|
return isArabic ? `${base}-u-nu-latn` : base;
|
|
3237
3395
|
}
|
|
3238
|
-
var GREGORIAN = new import_date.GregorianCalendar();
|
|
3239
|
-
var ISLAMIC_UMALQURA = new import_date.IslamicUmalquraCalendar();
|
|
3240
3396
|
function secondaryDayNumber(date, mainCalendar) {
|
|
3241
3397
|
const other = mainCalendar === "hijri" ? GREGORIAN : ISLAMIC_UMALQURA;
|
|
3242
3398
|
return (0, import_date.toCalendar)(date, other).day;
|
|
3243
3399
|
}
|
|
3400
|
+
function useCalendarChrome(calendarSystem, calendarLabels) {
|
|
3401
|
+
const dgaCtx = (0, import_react17.useContext)(DgaContext);
|
|
3402
|
+
const dgaLocale = dgaCtx?.locale ?? "en";
|
|
3403
|
+
const dir = dgaCtx?.dir ?? "ltr";
|
|
3404
|
+
const locale = (0, import_react17.useMemo)(
|
|
3405
|
+
() => composeLocale(dgaLocale, calendarSystem),
|
|
3406
|
+
[dgaLocale, calendarSystem]
|
|
3407
|
+
);
|
|
3408
|
+
const portalContainer = dgaCtx?.portalEl ?? dgaCtx?.rootEl ?? void 0;
|
|
3409
|
+
const PrevChevron = dir === "rtl" ? ChevronRight : ChevronLeft;
|
|
3410
|
+
const NextChevron = dir === "rtl" ? ChevronLeft : ChevronRight;
|
|
3411
|
+
const resolvedLabels = (0, import_react17.useMemo)(() => {
|
|
3412
|
+
if (calendarLabels) return calendarLabels;
|
|
3413
|
+
return dgaLocale.startsWith("ar") ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
|
|
3414
|
+
}, [calendarLabels, dgaLocale]);
|
|
3415
|
+
const navLabels = (0, import_react17.useMemo)(
|
|
3416
|
+
() => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
|
|
3417
|
+
[dgaLocale]
|
|
3418
|
+
);
|
|
3419
|
+
const a11yLabels = (0, import_react17.useMemo)(
|
|
3420
|
+
() => dgaLocale.startsWith("ar") ? { openCalendar: "\u0641\u062A\u062D \u0627\u0644\u062A\u0642\u0648\u064A\u0645", calendarSystem: "\u0646\u0638\u0627\u0645 \u0627\u0644\u062A\u0642\u0648\u064A\u0645" } : { openCalendar: "Open calendar", calendarSystem: "Calendar system" },
|
|
3421
|
+
[dgaLocale]
|
|
3422
|
+
);
|
|
3423
|
+
return {
|
|
3424
|
+
dgaLocale,
|
|
3425
|
+
dir,
|
|
3426
|
+
locale,
|
|
3427
|
+
portalContainer,
|
|
3428
|
+
PrevChevron,
|
|
3429
|
+
NextChevron,
|
|
3430
|
+
resolvedLabels,
|
|
3431
|
+
navLabels,
|
|
3432
|
+
a11yLabels
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
function CalendarSystemToggle({
|
|
3436
|
+
value,
|
|
3437
|
+
onChange,
|
|
3438
|
+
labels,
|
|
3439
|
+
groupLabel
|
|
3440
|
+
}) {
|
|
3441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3442
|
+
"div",
|
|
3443
|
+
{
|
|
3444
|
+
role: "tablist",
|
|
3445
|
+
"aria-label": groupLabel,
|
|
3446
|
+
className: "ddga-calendar-toggle",
|
|
3447
|
+
"data-slot": "calendar-toggle",
|
|
3448
|
+
children: [
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3450
|
+
"button",
|
|
3451
|
+
{
|
|
3452
|
+
type: "button",
|
|
3453
|
+
role: "tab",
|
|
3454
|
+
"aria-selected": value === "gregorian",
|
|
3455
|
+
className: "ddga-calendar-toggle__button",
|
|
3456
|
+
"data-active": value === "gregorian" ? "" : void 0,
|
|
3457
|
+
onClick: () => onChange("gregorian"),
|
|
3458
|
+
children: labels.gregorian
|
|
3459
|
+
}
|
|
3460
|
+
),
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3462
|
+
"button",
|
|
3463
|
+
{
|
|
3464
|
+
type: "button",
|
|
3465
|
+
role: "tab",
|
|
3466
|
+
"aria-selected": value === "hijri",
|
|
3467
|
+
className: "ddga-calendar-toggle__button",
|
|
3468
|
+
"data-active": value === "hijri" ? "" : void 0,
|
|
3469
|
+
onClick: () => onChange("hijri"),
|
|
3470
|
+
children: labels.hijri
|
|
3471
|
+
}
|
|
3472
|
+
)
|
|
3473
|
+
]
|
|
3474
|
+
}
|
|
3475
|
+
);
|
|
3476
|
+
}
|
|
3244
3477
|
function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
3245
|
-
const
|
|
3478
|
+
const rangeState = (0, import_react17.useContext)(import_react_aria_components.RangeCalendarStateContext);
|
|
3479
|
+
const singleState = (0, import_react17.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3480
|
+
const state = rangeState ?? singleState;
|
|
3246
3481
|
const focusedDate = state?.focusedDate ?? null;
|
|
3247
3482
|
const focusedYear = focusedDate?.year ?? 0;
|
|
3248
3483
|
const focusedCalendar = focusedDate?.calendar ?? GREGORIAN;
|
|
3249
3484
|
const minValue = state?.minValue ?? null;
|
|
3250
3485
|
const maxValue = state?.maxValue ?? null;
|
|
3251
|
-
const monthNames = (0,
|
|
3486
|
+
const monthNames = (0, import_react17.useMemo)(() => {
|
|
3252
3487
|
if (!focusedDate) return [];
|
|
3253
3488
|
const fmt = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
3254
3489
|
return Array.from({ length: 12 }, (_, i) => {
|
|
@@ -3258,7 +3493,7 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3258
3493
|
return fmt.format(js);
|
|
3259
3494
|
});
|
|
3260
3495
|
}, [locale, focusedDate, focusedCalendar, focusedYear]);
|
|
3261
|
-
const yearOptions = (0,
|
|
3496
|
+
const yearOptions = (0, import_react17.useMemo)(() => {
|
|
3262
3497
|
if (!focusedDate) return [];
|
|
3263
3498
|
const minY = minValue ? (0, import_date.toCalendar)(minValue, focusedCalendar).year : focusedYear - 100;
|
|
3264
3499
|
const maxY = maxValue ? (0, import_date.toCalendar)(maxValue, focusedCalendar).year : focusedYear + 30;
|
|
@@ -3267,13 +3502,13 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3267
3502
|
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
3268
3503
|
}, [focusedDate, focusedCalendar, focusedYear, minValue, maxValue]);
|
|
3269
3504
|
if (!state || !focusedDate) return null;
|
|
3270
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "ddga-
|
|
3505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "ddga-calendar__nav-selects", "data-slot": "calendar-nav", children: [
|
|
3271
3506
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3272
3507
|
"select",
|
|
3273
3508
|
{
|
|
3274
3509
|
"aria-label": monthLabel,
|
|
3275
|
-
className: "ddga-
|
|
3276
|
-
"data-slot": "
|
|
3510
|
+
className: "ddga-calendar__select ddga-calendar__month-select",
|
|
3511
|
+
"data-slot": "calendar-month-select",
|
|
3277
3512
|
value: focusedDate.month,
|
|
3278
3513
|
onChange: (e) => state.setFocusedDate(focusedDate.set({ month: Number(e.target.value) })),
|
|
3279
3514
|
children: monthNames.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: i + 1, children: name }, i + 1))
|
|
@@ -3283,8 +3518,8 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3283
3518
|
"select",
|
|
3284
3519
|
{
|
|
3285
3520
|
"aria-label": yearLabel,
|
|
3286
|
-
className: "ddga-
|
|
3287
|
-
"data-slot": "
|
|
3521
|
+
className: "ddga-calendar__select ddga-calendar__year-select",
|
|
3522
|
+
"data-slot": "calendar-year-select",
|
|
3288
3523
|
value: focusedDate.year,
|
|
3289
3524
|
onChange: (e) => state.setFocusedDate(focusedDate.set({ year: Number(e.target.value) })),
|
|
3290
3525
|
children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: y, children: y }, y))
|
|
@@ -3292,8 +3527,33 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3292
3527
|
)
|
|
3293
3528
|
] });
|
|
3294
3529
|
}
|
|
3530
|
+
function renderDayContent(primary, opts) {
|
|
3531
|
+
if (!opts.showSecondary) return primary;
|
|
3532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3533
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-calendar__cell-primary", children: primary }),
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-calendar__cell-secondary", children: secondaryDayNumber(opts.date, opts.calendarSystem) })
|
|
3535
|
+
] });
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
// src/components/DatePicker/DatePicker.tsx
|
|
3539
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3540
|
+
var datePickerTriggerVariants = (0, import_class_variance_authority27.cva)("ddga-date-picker-trigger", {
|
|
3541
|
+
variants: {
|
|
3542
|
+
size: {
|
|
3543
|
+
sm: "ddga-date-picker-trigger--sm",
|
|
3544
|
+
md: "ddga-date-picker-trigger--md"
|
|
3545
|
+
},
|
|
3546
|
+
error: {
|
|
3547
|
+
true: "ddga-date-picker-trigger--error"
|
|
3548
|
+
}
|
|
3549
|
+
},
|
|
3550
|
+
defaultVariants: {
|
|
3551
|
+
size: "md"
|
|
3552
|
+
}
|
|
3553
|
+
});
|
|
3554
|
+
var datePickerVariants = datePickerTriggerVariants;
|
|
3295
3555
|
function CalendarDayCell({ date, showSecondary, calendarSystem }) {
|
|
3296
|
-
const state = (0,
|
|
3556
|
+
const state = (0, import_react18.useContext)(import_react_aria_components2.CalendarStateContext);
|
|
3297
3557
|
const start = state?.visibleRange.start;
|
|
3298
3558
|
const isOutside = !!start && (date.year !== start.year || date.month !== start.month);
|
|
3299
3559
|
const isOutOfBounds = state ? state.isInvalid(date) : false;
|
|
@@ -3304,27 +3564,21 @@ function CalendarDayCell({ date, showSecondary, calendarSystem }) {
|
|
|
3304
3564
|
state.setFocusedDate(date);
|
|
3305
3565
|
state.selectDate(date);
|
|
3306
3566
|
};
|
|
3307
|
-
return /* @__PURE__ */ (0,
|
|
3567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3308
3568
|
"button",
|
|
3309
3569
|
{
|
|
3310
3570
|
type: "button",
|
|
3311
3571
|
tabIndex: -1,
|
|
3312
|
-
className: "ddga-
|
|
3572
|
+
className: "ddga-calendar__cell",
|
|
3313
3573
|
"data-outside-month": "",
|
|
3314
3574
|
"data-selected": isSelected ? "" : void 0,
|
|
3315
3575
|
"data-slot": "date-picker-day-cell",
|
|
3316
3576
|
onClick: handleSelect,
|
|
3317
|
-
children:
|
|
3318
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-date-picker-calendar__cell-primary", children: date.day }),
|
|
3319
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
|
|
3320
|
-
] }) : String(date.day)
|
|
3577
|
+
children: renderDayContent(date.day, { showSecondary, date, calendarSystem })
|
|
3321
3578
|
}
|
|
3322
3579
|
) });
|
|
3323
3580
|
}
|
|
3324
|
-
return /* @__PURE__ */ (0,
|
|
3325
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-date-picker-calendar__cell-primary", children: formattedDate }),
|
|
3326
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
|
|
3327
|
-
] }) : formattedDate });
|
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components2.CalendarCell, { date, className: "ddga-calendar__cell", children: ({ formattedDate }) => renderDayContent(formattedDate, { showSecondary, date, calendarSystem }) });
|
|
3328
3582
|
}
|
|
3329
3583
|
function DatePicker({
|
|
3330
3584
|
value: controlledValue,
|
|
@@ -3351,56 +3605,47 @@ function DatePicker({
|
|
|
3351
3605
|
showSecondaryCalendar = false
|
|
3352
3606
|
}) {
|
|
3353
3607
|
const isValueControlled = controlledValue !== void 0;
|
|
3354
|
-
const [internalValue, setInternalValue] = (0,
|
|
3608
|
+
const [internalValue, setInternalValue] = (0, import_react18.useState)(
|
|
3355
3609
|
() => dateToCalendarDate(defaultValue)
|
|
3356
3610
|
);
|
|
3357
3611
|
const value = isValueControlled ? dateToCalendarDate(controlledValue) : internalValue;
|
|
3358
|
-
const handleAriaChange = (0,
|
|
3612
|
+
const handleAriaChange = (0, import_react18.useCallback)(
|
|
3359
3613
|
(next) => {
|
|
3360
|
-
const nextCD = next ? new
|
|
3614
|
+
const nextCD = next ? new import_date2.CalendarDate(next.year, next.month, next.day) : null;
|
|
3361
3615
|
if (!isValueControlled) setInternalValue(nextCD);
|
|
3362
3616
|
onChange?.(calendarDateToDate(nextCD));
|
|
3363
3617
|
},
|
|
3364
3618
|
[isValueControlled, onChange]
|
|
3365
3619
|
);
|
|
3366
3620
|
const isCalendarControlled = controlledCalendar !== void 0;
|
|
3367
|
-
const [internalCalendar, setInternalCalendar] = (0,
|
|
3621
|
+
const [internalCalendar, setInternalCalendar] = (0, import_react18.useState)(defaultCalendar);
|
|
3368
3622
|
const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
|
|
3369
|
-
const setCalendar = (0,
|
|
3623
|
+
const setCalendar = (0, import_react18.useCallback)(
|
|
3370
3624
|
(next) => {
|
|
3371
3625
|
if (!isCalendarControlled) setInternalCalendar(next);
|
|
3372
3626
|
onCalendarChange?.(next);
|
|
3373
3627
|
},
|
|
3374
3628
|
[isCalendarControlled, onCalendarChange]
|
|
3375
3629
|
);
|
|
3376
|
-
const
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
const
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
return isArabic ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
|
|
3390
|
-
}, [calendarLabels, dgaLocale]);
|
|
3391
|
-
const navLabels = (0, import_react16.useMemo)(
|
|
3392
|
-
() => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
|
|
3393
|
-
[dgaLocale]
|
|
3394
|
-
);
|
|
3395
|
-
const ariaMinValue = (0, import_react16.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
|
|
3396
|
-
const ariaMaxValue = (0, import_react16.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
|
|
3397
|
-
const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : "Date");
|
|
3630
|
+
const {
|
|
3631
|
+
dgaLocale,
|
|
3632
|
+
locale: ariaLocale,
|
|
3633
|
+
portalContainer,
|
|
3634
|
+
PrevChevron,
|
|
3635
|
+
NextChevron,
|
|
3636
|
+
resolvedLabels,
|
|
3637
|
+
navLabels,
|
|
3638
|
+
a11yLabels
|
|
3639
|
+
} = useCalendarChrome(calendarSystem, calendarLabels);
|
|
3640
|
+
const ariaMinValue = (0, import_react18.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
|
|
3641
|
+
const ariaMaxValue = (0, import_react18.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
|
|
3642
|
+
const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : dgaLocale.startsWith("ar") ? "\u0627\u0644\u062A\u0627\u0631\u064A\u062E" : "Date");
|
|
3398
3643
|
const showToggle = showCalendarToggle && !isCalendarControlled;
|
|
3399
3644
|
const hasError = !!error;
|
|
3400
3645
|
const hasErrorMessage = hasError && errorMessage != null && errorMessage !== "";
|
|
3401
3646
|
const hasHelper = !hasErrorMessage && helperText != null && helperText !== "";
|
|
3402
|
-
return /* @__PURE__ */ (0,
|
|
3403
|
-
|
|
3647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components2.I18nProvider, { locale: ariaLocale, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3648
|
+
import_react_aria_components2.DatePicker,
|
|
3404
3649
|
{
|
|
3405
3650
|
value,
|
|
3406
3651
|
onChange: handleAriaChange,
|
|
@@ -3416,38 +3661,38 @@ function DatePicker({
|
|
|
3416
3661
|
className: "ddga-field",
|
|
3417
3662
|
"data-slot": "date-picker-field",
|
|
3418
3663
|
children: [
|
|
3419
|
-
label && /* @__PURE__ */ (0,
|
|
3664
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_aria_components2.Label, { className: "ddga-date-picker__label", children: [
|
|
3420
3665
|
label,
|
|
3421
|
-
required && /* @__PURE__ */ (0,
|
|
3666
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker__required", children: "*" })
|
|
3422
3667
|
] }),
|
|
3423
|
-
/* @__PURE__ */ (0,
|
|
3424
|
-
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3669
|
+
import_react_aria_components2.Group,
|
|
3425
3670
|
{
|
|
3426
3671
|
"data-slot": "date-picker-trigger",
|
|
3427
3672
|
className: cn(datePickerTriggerVariants({ size, error: hasError }), className),
|
|
3428
3673
|
children: [
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3430
|
-
|
|
3674
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components2.DateInput, { className: "ddga-date-picker__input", "data-slot": "date-picker-input", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3675
|
+
import_react_aria_components2.DateSegment,
|
|
3431
3676
|
{
|
|
3432
3677
|
segment,
|
|
3433
3678
|
className: "ddga-date-picker__segment",
|
|
3434
3679
|
"data-slot": "date-picker-segment"
|
|
3435
3680
|
}
|
|
3436
3681
|
) }),
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
3438
|
-
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3683
|
+
import_react_aria_components2.Button,
|
|
3439
3684
|
{
|
|
3440
3685
|
className: "ddga-date-picker__icon-button",
|
|
3441
|
-
"aria-label":
|
|
3686
|
+
"aria-label": a11yLabels.openCalendar,
|
|
3442
3687
|
"data-slot": "date-picker-trigger-button",
|
|
3443
|
-
children: /* @__PURE__ */ (0,
|
|
3688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CalendarIcon, { "aria-hidden": "true", className: "ddga-date-picker__icon" })
|
|
3444
3689
|
}
|
|
3445
3690
|
)
|
|
3446
3691
|
]
|
|
3447
3692
|
}
|
|
3448
3693
|
),
|
|
3449
|
-
hasHelper && /* @__PURE__ */ (0,
|
|
3450
|
-
|
|
3694
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3695
|
+
import_react_aria_components2.Text,
|
|
3451
3696
|
{
|
|
3452
3697
|
slot: "description",
|
|
3453
3698
|
className: "ddga-field__message ddga-field__message--helper",
|
|
@@ -3455,77 +3700,51 @@ function DatePicker({
|
|
|
3455
3700
|
children: helperText
|
|
3456
3701
|
}
|
|
3457
3702
|
),
|
|
3458
|
-
hasErrorMessage && /* @__PURE__ */ (0,
|
|
3459
|
-
|
|
3703
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3704
|
+
import_react_aria_components2.FieldError,
|
|
3460
3705
|
{
|
|
3461
3706
|
className: "ddga-field__message ddga-field__message--error",
|
|
3462
3707
|
"data-slot": "field-error",
|
|
3463
3708
|
children: errorMessage
|
|
3464
3709
|
}
|
|
3465
3710
|
),
|
|
3466
|
-
/* @__PURE__ */ (0,
|
|
3467
|
-
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3712
|
+
import_react_aria_components2.Popover,
|
|
3468
3713
|
{
|
|
3469
3714
|
UNSTABLE_portalContainer: portalContainer,
|
|
3470
|
-
className: "ddga-
|
|
3715
|
+
className: "ddga-calendar-popover",
|
|
3471
3716
|
"data-slot": "date-picker-popover",
|
|
3472
3717
|
offset: 6,
|
|
3473
3718
|
containerPadding: 12,
|
|
3474
|
-
children: /* @__PURE__ */ (0,
|
|
3475
|
-
|
|
3719
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3720
|
+
import_react_aria_components2.Dialog,
|
|
3476
3721
|
{
|
|
3477
|
-
className: "ddga-
|
|
3722
|
+
className: "ddga-calendar-dialog",
|
|
3478
3723
|
"data-slot": "date-picker-dialog",
|
|
3479
3724
|
"aria-label": dialogAriaLabel,
|
|
3480
3725
|
"aria-labelledby": ariaLabelledBy,
|
|
3481
3726
|
children: [
|
|
3482
|
-
showToggle && /* @__PURE__ */ (0,
|
|
3483
|
-
|
|
3727
|
+
showToggle && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3728
|
+
CalendarSystemToggle,
|
|
3484
3729
|
{
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
children: [
|
|
3490
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3491
|
-
"button",
|
|
3492
|
-
{
|
|
3493
|
-
type: "button",
|
|
3494
|
-
role: "tab",
|
|
3495
|
-
"aria-selected": calendarSystem === "gregorian",
|
|
3496
|
-
className: "ddga-date-picker-toggle__button",
|
|
3497
|
-
"data-active": calendarSystem === "gregorian" ? "" : void 0,
|
|
3498
|
-
onClick: () => setCalendar("gregorian"),
|
|
3499
|
-
children: resolvedLabels.gregorian
|
|
3500
|
-
}
|
|
3501
|
-
),
|
|
3502
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3503
|
-
"button",
|
|
3504
|
-
{
|
|
3505
|
-
type: "button",
|
|
3506
|
-
role: "tab",
|
|
3507
|
-
"aria-selected": calendarSystem === "hijri",
|
|
3508
|
-
className: "ddga-date-picker-toggle__button",
|
|
3509
|
-
"data-active": calendarSystem === "hijri" ? "" : void 0,
|
|
3510
|
-
onClick: () => setCalendar("hijri"),
|
|
3511
|
-
children: resolvedLabels.hijri
|
|
3512
|
-
}
|
|
3513
|
-
)
|
|
3514
|
-
]
|
|
3730
|
+
value: calendarSystem,
|
|
3731
|
+
onChange: setCalendar,
|
|
3732
|
+
labels: resolvedLabels,
|
|
3733
|
+
groupLabel: a11yLabels.calendarSystem
|
|
3515
3734
|
}
|
|
3516
3735
|
),
|
|
3517
|
-
/* @__PURE__ */ (0,
|
|
3518
|
-
/* @__PURE__ */ (0,
|
|
3519
|
-
/* @__PURE__ */ (0,
|
|
3520
|
-
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_aria_components2.Calendar, { className: "ddga-calendar", "data-slot": "date-picker-calendar", children: [
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("header", { className: "ddga-calendar__header", children: [
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3739
|
+
import_react_aria_components2.Button,
|
|
3521
3740
|
{
|
|
3522
3741
|
slot: "previous",
|
|
3523
|
-
className: "ddga-
|
|
3742
|
+
className: "ddga-calendar__nav",
|
|
3524
3743
|
"data-slot": "date-picker-calendar-prev",
|
|
3525
|
-
children: /* @__PURE__ */ (0,
|
|
3744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PrevChevron, { "aria-hidden": "true" })
|
|
3526
3745
|
}
|
|
3527
3746
|
),
|
|
3528
|
-
/* @__PURE__ */ (0,
|
|
3747
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3529
3748
|
CalendarNavHeader,
|
|
3530
3749
|
{
|
|
3531
3750
|
locale: ariaLocale,
|
|
@@ -3533,19 +3752,19 @@ function DatePicker({
|
|
|
3533
3752
|
yearLabel: navLabels.year
|
|
3534
3753
|
}
|
|
3535
3754
|
),
|
|
3536
|
-
/* @__PURE__ */ (0,
|
|
3537
|
-
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3756
|
+
import_react_aria_components2.Button,
|
|
3538
3757
|
{
|
|
3539
3758
|
slot: "next",
|
|
3540
|
-
className: "ddga-
|
|
3759
|
+
className: "ddga-calendar__nav",
|
|
3541
3760
|
"data-slot": "date-picker-calendar-next",
|
|
3542
|
-
children: /* @__PURE__ */ (0,
|
|
3761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(NextChevron, { "aria-hidden": "true" })
|
|
3543
3762
|
}
|
|
3544
3763
|
)
|
|
3545
3764
|
] }),
|
|
3546
|
-
/* @__PURE__ */ (0,
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
3548
|
-
/* @__PURE__ */ (0,
|
|
3765
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_aria_components2.CalendarGrid, { className: "ddga-calendar__grid", children: [
|
|
3766
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components2.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components2.CalendarHeaderCell, { className: "ddga-calendar__weekday", children: day }) }),
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components2.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3549
3768
|
CalendarDayCell,
|
|
3550
3769
|
{
|
|
3551
3770
|
date,
|
|
@@ -3566,8 +3785,8 @@ function DatePicker({
|
|
|
3566
3785
|
}
|
|
3567
3786
|
|
|
3568
3787
|
// src/components/FileUpload/FileUpload.tsx
|
|
3569
|
-
var
|
|
3570
|
-
var
|
|
3788
|
+
var import_react19 = require("react");
|
|
3789
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3571
3790
|
function matchesAccept(file, accept) {
|
|
3572
3791
|
if (!accept) return true;
|
|
3573
3792
|
const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
|
|
@@ -3628,8 +3847,8 @@ function FileUpload({
|
|
|
3628
3847
|
className,
|
|
3629
3848
|
...props
|
|
3630
3849
|
}) {
|
|
3631
|
-
const inputRef = (0,
|
|
3632
|
-
const [isDragging, setIsDragging] = (0,
|
|
3850
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
3851
|
+
const [isDragging, setIsDragging] = (0, import_react19.useState)(false);
|
|
3633
3852
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3634
3853
|
name: "FileUpload",
|
|
3635
3854
|
id: externalId,
|
|
@@ -3671,12 +3890,12 @@ function FileUpload({
|
|
|
3671
3890
|
setIsDragging(false);
|
|
3672
3891
|
}
|
|
3673
3892
|
}
|
|
3674
|
-
return /* @__PURE__ */ (0,
|
|
3675
|
-
label && /* @__PURE__ */ (0,
|
|
3893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-slot": "file-upload-field", className: cn("ddga-field", "ddga-file-upload", className), children: [
|
|
3894
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { htmlFor: fieldId, className: "ddga-file-upload__label", children: [
|
|
3676
3895
|
label,
|
|
3677
|
-
required && /* @__PURE__ */ (0,
|
|
3896
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { "aria-hidden": "true", className: "ddga-file-upload__required", children: "*" })
|
|
3678
3897
|
] }),
|
|
3679
|
-
/* @__PURE__ */ (0,
|
|
3898
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3680
3899
|
"div",
|
|
3681
3900
|
{
|
|
3682
3901
|
"data-slot": "file-upload-dropzone",
|
|
@@ -3694,9 +3913,9 @@ function FileUpload({
|
|
|
3694
3913
|
onDragLeave: handleDragLeave,
|
|
3695
3914
|
onDrop: handleDrop,
|
|
3696
3915
|
children: [
|
|
3697
|
-
/* @__PURE__ */ (0,
|
|
3698
|
-
/* @__PURE__ */ (0,
|
|
3699
|
-
/* @__PURE__ */ (0,
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Upload, { className: "ddga-file-upload__icon", "aria-hidden": "true" }),
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ddga-file-upload__hint", children: hint }),
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3700
3919
|
"input",
|
|
3701
3920
|
{
|
|
3702
3921
|
...controlProps,
|
|
@@ -3715,24 +3934,24 @@ function FileUpload({
|
|
|
3715
3934
|
]
|
|
3716
3935
|
}
|
|
3717
3936
|
),
|
|
3718
|
-
hasErrorMessage && /* @__PURE__ */ (0,
|
|
3719
|
-
hasHelper && /* @__PURE__ */ (0,
|
|
3720
|
-
files.length > 0 && /* @__PURE__ */ (0,
|
|
3937
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
3938
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText }),
|
|
3939
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { "data-slot": "file-upload-list", className: "ddga-file-upload__list", children: files.map((item) => {
|
|
3721
3940
|
const status = item.status ?? "pending";
|
|
3722
|
-
return /* @__PURE__ */ (0,
|
|
3941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3723
3942
|
"li",
|
|
3724
3943
|
{
|
|
3725
3944
|
"data-slot": "file-upload-item",
|
|
3726
3945
|
"data-status": status,
|
|
3727
3946
|
className: "ddga-file-upload__item",
|
|
3728
3947
|
children: [
|
|
3729
|
-
/* @__PURE__ */ (0,
|
|
3730
|
-
/* @__PURE__ */ (0,
|
|
3731
|
-
/* @__PURE__ */ (0,
|
|
3732
|
-
/* @__PURE__ */ (0,
|
|
3733
|
-
/* @__PURE__ */ (0,
|
|
3948
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ddga-file-upload__item-icon", "aria-hidden": "true", children: status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Check, {}) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AlertCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Upload, {}) }),
|
|
3949
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "ddga-file-upload__item-main", children: [
|
|
3950
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "ddga-file-upload__item-head", children: [
|
|
3951
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ddga-file-upload__item-name", title: item.file.name, children: item.file.name }),
|
|
3952
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ddga-file-upload__item-meta", children: formatBytes(item.file.size) })
|
|
3734
3953
|
] }),
|
|
3735
|
-
status === "uploading" && /* @__PURE__ */ (0,
|
|
3954
|
+
status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3736
3955
|
Progress,
|
|
3737
3956
|
{
|
|
3738
3957
|
size: "sm",
|
|
@@ -3741,9 +3960,9 @@ function FileUpload({
|
|
|
3741
3960
|
className: "ddga-file-upload__item-progress"
|
|
3742
3961
|
}
|
|
3743
3962
|
),
|
|
3744
|
-
status === "error" && item.error && /* @__PURE__ */ (0,
|
|
3963
|
+
status === "error" && item.error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { role: "alert", className: "ddga-file-upload__item-error", children: item.error })
|
|
3745
3964
|
] }),
|
|
3746
|
-
onRemove && /* @__PURE__ */ (0,
|
|
3965
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3747
3966
|
Button,
|
|
3748
3967
|
{
|
|
3749
3968
|
type: "button",
|
|
@@ -3752,7 +3971,7 @@ function FileUpload({
|
|
|
3752
3971
|
"aria-label": `${removeLabel}: ${item.file.name}`,
|
|
3753
3972
|
onClick: () => onRemove(item.id),
|
|
3754
3973
|
className: "ddga-file-upload__item-remove",
|
|
3755
|
-
children: /* @__PURE__ */ (0,
|
|
3974
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Close, { "aria-hidden": "true" })
|
|
3756
3975
|
}
|
|
3757
3976
|
)
|
|
3758
3977
|
]
|
|
@@ -3764,10 +3983,10 @@ function FileUpload({
|
|
|
3764
3983
|
}
|
|
3765
3984
|
|
|
3766
3985
|
// src/components/Slider/Slider.tsx
|
|
3767
|
-
var
|
|
3986
|
+
var import_react20 = require("react");
|
|
3768
3987
|
var import_radix_ui21 = require("radix-ui");
|
|
3769
3988
|
var import_class_variance_authority28 = require("class-variance-authority");
|
|
3770
|
-
var
|
|
3989
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3771
3990
|
var sliderVariants = (0, import_class_variance_authority28.cva)("ddga-slider", {
|
|
3772
3991
|
variants: {
|
|
3773
3992
|
size: {
|
|
@@ -3806,7 +4025,7 @@ function Slider({
|
|
|
3806
4025
|
className,
|
|
3807
4026
|
...props
|
|
3808
4027
|
}) {
|
|
3809
|
-
const labelId = (0,
|
|
4028
|
+
const labelId = (0, import_react20.useId)();
|
|
3810
4029
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3811
4030
|
name: "Slider",
|
|
3812
4031
|
id: externalId,
|
|
@@ -3823,12 +4042,12 @@ function Slider({
|
|
|
3823
4042
|
const wrap = (next) => isRange ? next : next[0];
|
|
3824
4043
|
const currentForRender = valueArray ?? defaultArray;
|
|
3825
4044
|
const fmt = (n) => formatValue ? formatValue(n) : String(n);
|
|
3826
|
-
return /* @__PURE__ */ (0,
|
|
3827
|
-
(label || showValue) && /* @__PURE__ */ (0,
|
|
3828
|
-
label && /* @__PURE__ */ (0,
|
|
3829
|
-
showValue && /* @__PURE__ */ (0,
|
|
4045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-slot": "slider-field", className: "ddga-field", children: [
|
|
4046
|
+
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ddga-slider__header", children: [
|
|
4047
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { id: labelId, className: "ddga-slider__label", children: label }),
|
|
4048
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ddga-slider__value", "aria-hidden": "true", children: currentForRender.map(fmt).join(" \u2013 ") })
|
|
3830
4049
|
] }),
|
|
3831
|
-
/* @__PURE__ */ (0,
|
|
4050
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3832
4051
|
import_radix_ui21.Slider.Root,
|
|
3833
4052
|
{
|
|
3834
4053
|
...props,
|
|
@@ -3843,8 +4062,8 @@ function Slider({
|
|
|
3843
4062
|
"data-slot": "slider",
|
|
3844
4063
|
className: cn(sliderVariants({ size, error: hasError }), className),
|
|
3845
4064
|
children: [
|
|
3846
|
-
/* @__PURE__ */ (0,
|
|
3847
|
-
currentForRender.map((thumbValue, index) => /* @__PURE__ */ (0,
|
|
4065
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_radix_ui21.Slider.Track, { "data-slot": "slider-track", className: "ddga-slider__track", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_radix_ui21.Slider.Range, { "data-slot": "slider-range", className: "ddga-slider__range" }) }),
|
|
4066
|
+
currentForRender.map((thumbValue, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3848
4067
|
import_radix_ui21.Slider.Thumb,
|
|
3849
4068
|
{
|
|
3850
4069
|
"data-slot": "slider-thumb",
|
|
@@ -3859,15 +4078,15 @@ function Slider({
|
|
|
3859
4078
|
]
|
|
3860
4079
|
}
|
|
3861
4080
|
),
|
|
3862
|
-
hasErrorMessage && /* @__PURE__ */ (0,
|
|
3863
|
-
hasHelper && /* @__PURE__ */ (0,
|
|
4081
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
4082
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
3864
4083
|
] });
|
|
3865
4084
|
}
|
|
3866
4085
|
|
|
3867
4086
|
// src/components/NumberInput/NumberInput.tsx
|
|
3868
|
-
var
|
|
4087
|
+
var import_react21 = require("react");
|
|
3869
4088
|
var import_class_variance_authority29 = require("class-variance-authority");
|
|
3870
|
-
var
|
|
4089
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3871
4090
|
var numberInputVariants = (0, import_class_variance_authority29.cva)("ddga-number-input", {
|
|
3872
4091
|
variants: {
|
|
3873
4092
|
size: {
|
|
@@ -3917,9 +4136,9 @@ function NumberInput({
|
|
|
3917
4136
|
...props
|
|
3918
4137
|
}) {
|
|
3919
4138
|
const isControlled = value !== void 0;
|
|
3920
|
-
const [internal, setInternal] = (0,
|
|
4139
|
+
const [internal, setInternal] = (0, import_react21.useState)(defaultValue ?? null);
|
|
3921
4140
|
const numericValue = isControlled ? value : internal;
|
|
3922
|
-
const [draft, setDraft] = (0,
|
|
4141
|
+
const [draft, setDraft] = (0, import_react21.useState)(null);
|
|
3923
4142
|
const allowDecimal = !Number.isInteger(step);
|
|
3924
4143
|
const allowNegative = min == null || min < 0;
|
|
3925
4144
|
const displayValue = draft ?? (numericValue == null ? "" : formatNumber(numericValue));
|
|
@@ -3977,18 +4196,18 @@ function NumberInput({
|
|
|
3977
4196
|
}
|
|
3978
4197
|
const atMin = min != null && numericValue != null && numericValue <= min;
|
|
3979
4198
|
const atMax = max != null && numericValue != null && numericValue >= max;
|
|
3980
|
-
return /* @__PURE__ */ (0,
|
|
3981
|
-
label && /* @__PURE__ */ (0,
|
|
4199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-slot": "number-input-field", className: "ddga-field", children: [
|
|
4200
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { htmlFor: fieldId, className: "ddga-number-input__label", children: [
|
|
3982
4201
|
label,
|
|
3983
|
-
required && /* @__PURE__ */ (0,
|
|
4202
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-hidden": "true", className: "ddga-number-input__required", children: "*" })
|
|
3984
4203
|
] }),
|
|
3985
|
-
/* @__PURE__ */ (0,
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3986
4205
|
"div",
|
|
3987
4206
|
{
|
|
3988
4207
|
"data-slot": "number-input-control",
|
|
3989
4208
|
className: cn(numberInputVariants({ size, error: hasError }), className),
|
|
3990
4209
|
children: [
|
|
3991
|
-
!hideControls && /* @__PURE__ */ (0,
|
|
4210
|
+
!hideControls && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3992
4211
|
"button",
|
|
3993
4212
|
{
|
|
3994
4213
|
type: "button",
|
|
@@ -3998,10 +4217,10 @@ function NumberInput({
|
|
|
3998
4217
|
onClick: () => stepBy(-1),
|
|
3999
4218
|
disabled: disabled || atMin,
|
|
4000
4219
|
tabIndex: -1,
|
|
4001
|
-
children: /* @__PURE__ */ (0,
|
|
4220
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Minus, { "aria-hidden": "true" })
|
|
4002
4221
|
}
|
|
4003
4222
|
),
|
|
4004
|
-
/* @__PURE__ */ (0,
|
|
4223
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4005
4224
|
"input",
|
|
4006
4225
|
{
|
|
4007
4226
|
...props,
|
|
@@ -4018,7 +4237,7 @@ function NumberInput({
|
|
|
4018
4237
|
className: "ddga-number-input__field"
|
|
4019
4238
|
}
|
|
4020
4239
|
),
|
|
4021
|
-
!hideControls && /* @__PURE__ */ (0,
|
|
4240
|
+
!hideControls && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4022
4241
|
"button",
|
|
4023
4242
|
{
|
|
4024
4243
|
type: "button",
|
|
@@ -4028,21 +4247,21 @@ function NumberInput({
|
|
|
4028
4247
|
onClick: () => stepBy(1),
|
|
4029
4248
|
disabled: disabled || atMax,
|
|
4030
4249
|
tabIndex: -1,
|
|
4031
|
-
children: /* @__PURE__ */ (0,
|
|
4250
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Plus, { "aria-hidden": "true" })
|
|
4032
4251
|
}
|
|
4033
4252
|
)
|
|
4034
4253
|
]
|
|
4035
4254
|
}
|
|
4036
4255
|
),
|
|
4037
|
-
hasErrorMessage && /* @__PURE__ */ (0,
|
|
4038
|
-
hasHelper && /* @__PURE__ */ (0,
|
|
4256
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
4257
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
4039
4258
|
] });
|
|
4040
4259
|
}
|
|
4041
4260
|
|
|
4042
4261
|
// src/components/Rating/Rating.tsx
|
|
4043
|
-
var
|
|
4262
|
+
var import_react22 = require("react");
|
|
4044
4263
|
var import_class_variance_authority30 = require("class-variance-authority");
|
|
4045
|
-
var
|
|
4264
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4046
4265
|
var ratingVariants = (0, import_class_variance_authority30.cva)("ddga-rating", {
|
|
4047
4266
|
variants: {
|
|
4048
4267
|
size: {
|
|
@@ -4084,11 +4303,11 @@ function Rating({
|
|
|
4084
4303
|
className,
|
|
4085
4304
|
...props
|
|
4086
4305
|
}) {
|
|
4087
|
-
const rootRef = (0,
|
|
4306
|
+
const rootRef = (0, import_react22.useRef)(null);
|
|
4088
4307
|
const isControlled = value !== void 0;
|
|
4089
|
-
const [internal, setInternal] = (0,
|
|
4308
|
+
const [internal, setInternal] = (0, import_react22.useState)(defaultValue ?? 0);
|
|
4090
4309
|
const currentValue = isControlled ? value : internal;
|
|
4091
|
-
const [hover, setHover] = (0,
|
|
4310
|
+
const [hover, setHover] = (0, import_react22.useState)(null);
|
|
4092
4311
|
const interactive = !readOnly && !disabled;
|
|
4093
4312
|
const stepSize = allowHalf ? 0.5 : 1;
|
|
4094
4313
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
@@ -4151,7 +4370,7 @@ function Rating({
|
|
|
4151
4370
|
}
|
|
4152
4371
|
const stars = Array.from({ length: max }, (_, index) => {
|
|
4153
4372
|
const level = fillFor(index, displayValue, allowHalf);
|
|
4154
|
-
return /* @__PURE__ */ (0,
|
|
4373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4155
4374
|
"span",
|
|
4156
4375
|
{
|
|
4157
4376
|
"data-slot": "rating-star",
|
|
@@ -4160,8 +4379,8 @@ function Rating({
|
|
|
4160
4379
|
onPointerMove: interactive ? (event) => setHover(pointerValue(event, index)) : void 0,
|
|
4161
4380
|
onClick: interactive ? (event) => commit(pointerValue(event, index)) : void 0,
|
|
4162
4381
|
children: [
|
|
4163
|
-
/* @__PURE__ */ (0,
|
|
4164
|
-
/* @__PURE__ */ (0,
|
|
4382
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Star, { className: "ddga-rating__star-bg", "aria-hidden": "true" }),
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "ddga-rating__star-fill", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Star, { className: "ddga-rating__star-fg", "aria-hidden": "true" }) })
|
|
4165
4384
|
]
|
|
4166
4385
|
},
|
|
4167
4386
|
index
|
|
@@ -4176,9 +4395,9 @@ function Rating({
|
|
|
4176
4395
|
};
|
|
4177
4396
|
const labelledBy = label ? `${fieldId}-label` : props["aria-labelledby"];
|
|
4178
4397
|
const ariaLabel = labelledBy ? void 0 : props["aria-label"] ?? "Rating";
|
|
4179
|
-
return /* @__PURE__ */ (0,
|
|
4180
|
-
label && /* @__PURE__ */ (0,
|
|
4181
|
-
readOnly ? /* @__PURE__ */ (0,
|
|
4398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { "data-slot": "rating-field", className: "ddga-field", children: [
|
|
4399
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { id: `${fieldId}-label`, className: "ddga-rating__label", children: label }),
|
|
4400
|
+
readOnly ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ...sharedProps, role: "img", "aria-label": formatValueText(currentValue, max), children: stars }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4182
4401
|
"div",
|
|
4183
4402
|
{
|
|
4184
4403
|
...sharedProps,
|
|
@@ -4198,15 +4417,15 @@ function Rating({
|
|
|
4198
4417
|
children: stars
|
|
4199
4418
|
}
|
|
4200
4419
|
),
|
|
4201
|
-
hasErrorMessage && /* @__PURE__ */ (0,
|
|
4202
|
-
hasHelper && /* @__PURE__ */ (0,
|
|
4420
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
4421
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
4203
4422
|
] });
|
|
4204
4423
|
}
|
|
4205
4424
|
|
|
4206
4425
|
// src/components/Toggle/Toggle.tsx
|
|
4207
4426
|
var import_radix_ui22 = require("radix-ui");
|
|
4208
4427
|
var import_class_variance_authority31 = require("class-variance-authority");
|
|
4209
|
-
var
|
|
4428
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4210
4429
|
var toggleVariants = (0, import_class_variance_authority31.cva)("ddga-toggle", {
|
|
4211
4430
|
variants: {
|
|
4212
4431
|
variant: {
|
|
@@ -4242,7 +4461,7 @@ var toggleGroupVariants = (0, import_class_variance_authority31.cva)("ddga-toggl
|
|
|
4242
4461
|
}
|
|
4243
4462
|
});
|
|
4244
4463
|
function Toggle({ variant, size, className, ...props }) {
|
|
4245
|
-
return /* @__PURE__ */ (0,
|
|
4464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4246
4465
|
import_radix_ui22.Toggle.Root,
|
|
4247
4466
|
{
|
|
4248
4467
|
"data-slot": "toggle",
|
|
@@ -4257,7 +4476,7 @@ function ToggleGroup({ variant, size, className, ...props }) {
|
|
|
4257
4476
|
"[@dev-dga/react] ToggleGroup should have an `aria-label` or `aria-labelledby` so the button group has an accessible name."
|
|
4258
4477
|
);
|
|
4259
4478
|
}
|
|
4260
|
-
return /* @__PURE__ */ (0,
|
|
4479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4261
4480
|
import_radix_ui22.ToggleGroup.Root,
|
|
4262
4481
|
{
|
|
4263
4482
|
"data-slot": "toggle-group",
|
|
@@ -4267,7 +4486,7 @@ function ToggleGroup({ variant, size, className, ...props }) {
|
|
|
4267
4486
|
);
|
|
4268
4487
|
}
|
|
4269
4488
|
function ToggleGroupItem({ className, ...props }) {
|
|
4270
|
-
return /* @__PURE__ */ (0,
|
|
4489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4271
4490
|
import_radix_ui22.ToggleGroup.Item,
|
|
4272
4491
|
{
|
|
4273
4492
|
"data-slot": "toggle-group-item",
|
|
@@ -4279,7 +4498,7 @@ function ToggleGroupItem({ className, ...props }) {
|
|
|
4279
4498
|
|
|
4280
4499
|
// src/components/DescriptionList/DescriptionList.tsx
|
|
4281
4500
|
var import_class_variance_authority32 = require("class-variance-authority");
|
|
4282
|
-
var
|
|
4501
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4283
4502
|
var descriptionListVariants = (0, import_class_variance_authority32.cva)("ddga-description-list", {
|
|
4284
4503
|
variants: {
|
|
4285
4504
|
orientation: {
|
|
@@ -4295,7 +4514,7 @@ var descriptionListVariants = (0, import_class_variance_authority32.cva)("ddga-d
|
|
|
4295
4514
|
}
|
|
4296
4515
|
});
|
|
4297
4516
|
function DescriptionList({ orientation, divided, className, ...props }) {
|
|
4298
|
-
return /* @__PURE__ */ (0,
|
|
4517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4299
4518
|
"dl",
|
|
4300
4519
|
{
|
|
4301
4520
|
"data-slot": "description-list",
|
|
@@ -4305,7 +4524,7 @@ function DescriptionList({ orientation, divided, className, ...props }) {
|
|
|
4305
4524
|
);
|
|
4306
4525
|
}
|
|
4307
4526
|
function DescriptionItem({ className, ...props }) {
|
|
4308
|
-
return /* @__PURE__ */ (0,
|
|
4527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4309
4528
|
"div",
|
|
4310
4529
|
{
|
|
4311
4530
|
"data-slot": "description-item",
|
|
@@ -4315,7 +4534,7 @@ function DescriptionItem({ className, ...props }) {
|
|
|
4315
4534
|
);
|
|
4316
4535
|
}
|
|
4317
4536
|
function DescriptionTerm({ className, ...props }) {
|
|
4318
|
-
return /* @__PURE__ */ (0,
|
|
4537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4319
4538
|
"dt",
|
|
4320
4539
|
{
|
|
4321
4540
|
"data-slot": "description-term",
|
|
@@ -4325,7 +4544,7 @@ function DescriptionTerm({ className, ...props }) {
|
|
|
4325
4544
|
);
|
|
4326
4545
|
}
|
|
4327
4546
|
function DescriptionDetails({ className, ...props }) {
|
|
4328
|
-
return /* @__PURE__ */ (0,
|
|
4547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4329
4548
|
"dd",
|
|
4330
4549
|
{
|
|
4331
4550
|
"data-slot": "description-details",
|
|
@@ -4336,10 +4555,10 @@ function DescriptionDetails({ className, ...props }) {
|
|
|
4336
4555
|
}
|
|
4337
4556
|
|
|
4338
4557
|
// src/components/EmptyState/EmptyState.tsx
|
|
4339
|
-
var
|
|
4558
|
+
var import_react23 = require("react");
|
|
4340
4559
|
var import_radix_ui23 = require("radix-ui");
|
|
4341
4560
|
var import_class_variance_authority33 = require("class-variance-authority");
|
|
4342
|
-
var
|
|
4561
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4343
4562
|
var emptyStateVariants = (0, import_class_variance_authority33.cva)("ddga-empty-state", {
|
|
4344
4563
|
variants: {
|
|
4345
4564
|
variant: {
|
|
@@ -4360,10 +4579,10 @@ var emptyStateVariants = (0, import_class_variance_authority33.cva)("ddga-empty-
|
|
|
4360
4579
|
}
|
|
4361
4580
|
});
|
|
4362
4581
|
var DEFAULT_ICONS3 = {
|
|
4363
|
-
default: /* @__PURE__ */ (0,
|
|
4364
|
-
search: /* @__PURE__ */ (0,
|
|
4365
|
-
error: /* @__PURE__ */ (0,
|
|
4366
|
-
success: /* @__PURE__ */ (0,
|
|
4582
|
+
default: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Inbox, { "aria-hidden": "true" }),
|
|
4583
|
+
search: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Search, { "aria-hidden": "true" }),
|
|
4584
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AlertCircle, { "aria-hidden": "true" }),
|
|
4585
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Check, { "aria-hidden": "true" })
|
|
4367
4586
|
};
|
|
4368
4587
|
function EmptyState({
|
|
4369
4588
|
variant,
|
|
@@ -4373,24 +4592,26 @@ function EmptyState({
|
|
|
4373
4592
|
description,
|
|
4374
4593
|
action,
|
|
4375
4594
|
secondaryAction,
|
|
4595
|
+
asChild,
|
|
4376
4596
|
className,
|
|
4377
4597
|
children,
|
|
4378
4598
|
...props
|
|
4379
4599
|
}) {
|
|
4380
4600
|
const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS3[variant ?? "default"];
|
|
4381
|
-
|
|
4382
|
-
|
|
4601
|
+
const Comp = asChild ? import_radix_ui23.Slot.Slot : "div";
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4603
|
+
Comp,
|
|
4383
4604
|
{
|
|
4384
4605
|
"data-slot": "empty-state",
|
|
4385
4606
|
"data-variant": variant ?? "default",
|
|
4386
4607
|
"data-size": size ?? "md",
|
|
4387
4608
|
className: cn(emptyStateVariants({ variant, size }), className),
|
|
4388
4609
|
...props,
|
|
4389
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
4390
|
-
resolvedIcon ? /* @__PURE__ */ (0,
|
|
4391
|
-
title ? /* @__PURE__ */ (0,
|
|
4392
|
-
description ? /* @__PURE__ */ (0,
|
|
4393
|
-
action || secondaryAction ? /* @__PURE__ */ (0,
|
|
4610
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
4611
|
+
resolvedIcon ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(EmptyStateMedia, { children: resolvedIcon }) : null,
|
|
4612
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(EmptyStateTitle, { children: title }) : null,
|
|
4613
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(EmptyStateDescription, { children: description }) : null,
|
|
4614
|
+
action || secondaryAction ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(EmptyStateActions, { children: [
|
|
4394
4615
|
action,
|
|
4395
4616
|
secondaryAction
|
|
4396
4617
|
] }) : null
|
|
@@ -4399,7 +4620,7 @@ function EmptyState({
|
|
|
4399
4620
|
);
|
|
4400
4621
|
}
|
|
4401
4622
|
function EmptyStateMedia({ className, ...props }) {
|
|
4402
|
-
return /* @__PURE__ */ (0,
|
|
4623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4403
4624
|
"div",
|
|
4404
4625
|
{
|
|
4405
4626
|
"data-slot": "empty-state-media",
|
|
@@ -4411,7 +4632,7 @@ function EmptyStateMedia({ className, ...props }) {
|
|
|
4411
4632
|
}
|
|
4412
4633
|
function EmptyStateTitle({ asChild, className, ...props }) {
|
|
4413
4634
|
const Comp = asChild ? import_radix_ui23.Slot.Slot : "h3";
|
|
4414
|
-
return /* @__PURE__ */ (0,
|
|
4635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4415
4636
|
Comp,
|
|
4416
4637
|
{
|
|
4417
4638
|
"data-slot": "empty-state-title",
|
|
@@ -4422,7 +4643,7 @@ function EmptyStateTitle({ asChild, className, ...props }) {
|
|
|
4422
4643
|
}
|
|
4423
4644
|
function EmptyStateDescription({ asChild, className, ...props }) {
|
|
4424
4645
|
const Comp = asChild ? import_radix_ui23.Slot.Slot : "p";
|
|
4425
|
-
return /* @__PURE__ */ (0,
|
|
4646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4426
4647
|
Comp,
|
|
4427
4648
|
{
|
|
4428
4649
|
"data-slot": "empty-state-description",
|
|
@@ -4433,7 +4654,7 @@ function EmptyStateDescription({ asChild, className, ...props }) {
|
|
|
4433
4654
|
}
|
|
4434
4655
|
function EmptyStateActions({ asChild, className, ...props }) {
|
|
4435
4656
|
const Comp = asChild ? import_radix_ui23.Slot.Slot : "div";
|
|
4436
|
-
return /* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4437
4658
|
Comp,
|
|
4438
4659
|
{
|
|
4439
4660
|
"data-slot": "empty-state-actions",
|
|
@@ -4444,20 +4665,24 @@ function EmptyStateActions({ asChild, className, ...props }) {
|
|
|
4444
4665
|
}
|
|
4445
4666
|
|
|
4446
4667
|
// src/components/Stat/Stat.tsx
|
|
4447
|
-
var
|
|
4668
|
+
var import_react24 = require("react");
|
|
4448
4669
|
var import_class_variance_authority34 = require("class-variance-authority");
|
|
4449
|
-
var
|
|
4670
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4450
4671
|
var statVariants = (0, import_class_variance_authority34.cva)("ddga-stat", {
|
|
4451
4672
|
variants: {
|
|
4452
4673
|
variant: {
|
|
4453
4674
|
flat: "ddga-stat--flat",
|
|
4454
4675
|
elevated: "ddga-stat--elevated",
|
|
4455
|
-
accent: "ddga-stat--accent"
|
|
4676
|
+
accent: "ddga-stat--accent",
|
|
4677
|
+
// Soft sentiment-tinted gradient surface (reuses the accent tint vars).
|
|
4678
|
+
gradient: "ddga-stat--gradient"
|
|
4456
4679
|
},
|
|
4457
4680
|
size: {
|
|
4458
4681
|
sm: "ddga-stat--sm",
|
|
4459
4682
|
md: "ddga-stat--md",
|
|
4460
|
-
lg: "ddga-stat--lg"
|
|
4683
|
+
lg: "ddga-stat--lg",
|
|
4684
|
+
// Hero/display size for headline KPIs (display-scale value).
|
|
4685
|
+
xl: "ddga-stat--xl"
|
|
4461
4686
|
}
|
|
4462
4687
|
},
|
|
4463
4688
|
defaultVariants: {
|
|
@@ -4466,9 +4691,9 @@ var statVariants = (0, import_class_variance_authority34.cva)("ddga-stat", {
|
|
|
4466
4691
|
}
|
|
4467
4692
|
});
|
|
4468
4693
|
var TREND_ICONS = {
|
|
4469
|
-
up: /* @__PURE__ */ (0,
|
|
4470
|
-
down: /* @__PURE__ */ (0,
|
|
4471
|
-
flat: /* @__PURE__ */ (0,
|
|
4694
|
+
up: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CaretUp, { "aria-hidden": "true" }),
|
|
4695
|
+
down: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CaretDown, { "aria-hidden": "true" }),
|
|
4696
|
+
flat: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Minus, { "aria-hidden": "true" })
|
|
4472
4697
|
};
|
|
4473
4698
|
var TREND_SENTIMENT = {
|
|
4474
4699
|
up: "positive",
|
|
@@ -4489,13 +4714,14 @@ function Stat({
|
|
|
4489
4714
|
changeLabel,
|
|
4490
4715
|
trend,
|
|
4491
4716
|
sentiment,
|
|
4717
|
+
changeVariant,
|
|
4492
4718
|
icon,
|
|
4493
4719
|
className,
|
|
4494
4720
|
children,
|
|
4495
4721
|
...props
|
|
4496
4722
|
}) {
|
|
4497
4723
|
const resolvedSentiment = resolveSentiment(trend, sentiment);
|
|
4498
|
-
return /* @__PURE__ */ (0,
|
|
4724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
4499
4725
|
"div",
|
|
4500
4726
|
{
|
|
4501
4727
|
"data-slot": "stat",
|
|
@@ -4505,14 +4731,14 @@ function Stat({
|
|
|
4505
4731
|
className: cn(statVariants({ variant, size }), className),
|
|
4506
4732
|
...props,
|
|
4507
4733
|
children: [
|
|
4508
|
-
label || icon ? /* @__PURE__ */ (0,
|
|
4509
|
-
label ? /* @__PURE__ */ (0,
|
|
4510
|
-
icon ? /* @__PURE__ */ (0,
|
|
4734
|
+
label || icon ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ddga-stat__label-row", children: [
|
|
4735
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StatLabel, { children: label }) : null,
|
|
4736
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ddga-stat__icon", "aria-hidden": "true", children: icon }) : null
|
|
4511
4737
|
] }) : null,
|
|
4512
|
-
value ? /* @__PURE__ */ (0,
|
|
4513
|
-
change || changeLabel ? /* @__PURE__ */ (0,
|
|
4514
|
-
change ? /* @__PURE__ */ (0,
|
|
4515
|
-
changeLabel ? /* @__PURE__ */ (0,
|
|
4738
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StatValue, { children: value }) : null,
|
|
4739
|
+
change || changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ddga-stat__change-row", children: [
|
|
4740
|
+
change ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StatChange, { trend, sentiment, variant: changeVariant, children: change }) : null,
|
|
4741
|
+
changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ddga-stat__change-label", children: changeLabel }) : null
|
|
4516
4742
|
] }) : null,
|
|
4517
4743
|
children
|
|
4518
4744
|
]
|
|
@@ -4520,14 +4746,17 @@ function Stat({
|
|
|
4520
4746
|
);
|
|
4521
4747
|
}
|
|
4522
4748
|
function StatLabel({ className, ...props }) {
|
|
4523
|
-
return /* @__PURE__ */ (0,
|
|
4749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-slot": "stat-label", className: cn("ddga-stat__label", className), ...props });
|
|
4524
4750
|
}
|
|
4525
4751
|
function StatValue({ className, ...props }) {
|
|
4526
|
-
return /* @__PURE__ */ (0,
|
|
4752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-slot": "stat-value", className: cn("ddga-stat__value", className), ...props });
|
|
4753
|
+
}
|
|
4754
|
+
function StatChart({ className, ...props }) {
|
|
4755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-slot": "stat-chart", className: cn("ddga-stat__chart", className), ...props });
|
|
4527
4756
|
}
|
|
4528
|
-
function StatChange({ trend, sentiment, className, children, ...props }) {
|
|
4757
|
+
function StatChange({ trend, sentiment, variant, className, children, ...props }) {
|
|
4529
4758
|
const resolvedSentiment = resolveSentiment(trend, sentiment);
|
|
4530
|
-
return /* @__PURE__ */ (0,
|
|
4759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
4531
4760
|
"div",
|
|
4532
4761
|
{
|
|
4533
4762
|
"data-slot": "stat-change",
|
|
@@ -4536,11 +4765,12 @@ function StatChange({ trend, sentiment, className, children, ...props }) {
|
|
|
4536
4765
|
className: cn(
|
|
4537
4766
|
"ddga-stat__change",
|
|
4538
4767
|
resolvedSentiment ? `ddga-stat__change--${resolvedSentiment}` : null,
|
|
4768
|
+
variant === "chip" && "ddga-stat__change--chip",
|
|
4539
4769
|
className
|
|
4540
4770
|
),
|
|
4541
4771
|
...props,
|
|
4542
4772
|
children: [
|
|
4543
|
-
trend ? /* @__PURE__ */ (0,
|
|
4773
|
+
trend ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ddga-stat__change-icon", children: TREND_ICONS[trend] }) : null,
|
|
4544
4774
|
children
|
|
4545
4775
|
]
|
|
4546
4776
|
}
|
|
@@ -4549,7 +4779,7 @@ function StatChange({ trend, sentiment, className, children, ...props }) {
|
|
|
4549
4779
|
|
|
4550
4780
|
// src/components/Stat/StatGroup.tsx
|
|
4551
4781
|
var import_class_variance_authority35 = require("class-variance-authority");
|
|
4552
|
-
var
|
|
4782
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4553
4783
|
var statGroupVariants = (0, import_class_variance_authority35.cva)("ddga-stat-group", {
|
|
4554
4784
|
variants: {
|
|
4555
4785
|
orientation: {
|
|
@@ -4568,7 +4798,7 @@ var statGroupVariants = (0, import_class_variance_authority35.cva)("ddga-stat-gr
|
|
|
4568
4798
|
}
|
|
4569
4799
|
});
|
|
4570
4800
|
function StatGroup({ orientation, gap, columns, className, style, ...props }) {
|
|
4571
|
-
return /* @__PURE__ */ (0,
|
|
4801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4572
4802
|
"div",
|
|
4573
4803
|
{
|
|
4574
4804
|
"data-slot": "stat-group",
|
|
@@ -4584,10 +4814,10 @@ function StatGroup({ orientation, gap, columns, className, style, ...props }) {
|
|
|
4584
4814
|
}
|
|
4585
4815
|
|
|
4586
4816
|
// src/components/Popover/Popover.tsx
|
|
4587
|
-
var
|
|
4817
|
+
var import_react25 = require("react");
|
|
4588
4818
|
var import_radix_ui24 = require("radix-ui");
|
|
4589
4819
|
var import_class_variance_authority36 = require("class-variance-authority");
|
|
4590
|
-
var
|
|
4820
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4591
4821
|
var popoverContentVariants = (0, import_class_variance_authority36.cva)("ddga-popover", {
|
|
4592
4822
|
variants: {
|
|
4593
4823
|
size: {
|
|
@@ -4600,13 +4830,13 @@ var popoverContentVariants = (0, import_class_variance_authority36.cva)("ddga-po
|
|
|
4600
4830
|
}
|
|
4601
4831
|
});
|
|
4602
4832
|
function Popover(props) {
|
|
4603
|
-
return /* @__PURE__ */ (0,
|
|
4833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui24.Popover.Root, { ...props });
|
|
4604
4834
|
}
|
|
4605
4835
|
function PopoverTrigger({ className, ...props }) {
|
|
4606
|
-
return /* @__PURE__ */ (0,
|
|
4836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui24.Popover.Trigger, { "data-slot": "popover-trigger", className, ...props });
|
|
4607
4837
|
}
|
|
4608
4838
|
function PopoverAnchor(props) {
|
|
4609
|
-
return /* @__PURE__ */ (0,
|
|
4839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui24.Popover.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
4610
4840
|
}
|
|
4611
4841
|
function PopoverContent({
|
|
4612
4842
|
size,
|
|
@@ -4621,9 +4851,9 @@ function PopoverContent({
|
|
|
4621
4851
|
'[@dev-dga/react] PopoverContent renders role="dialog" and should have an `aria-label` or `aria-labelledby` so the panel has an accessible name.'
|
|
4622
4852
|
);
|
|
4623
4853
|
}
|
|
4624
|
-
const ctx = (0,
|
|
4854
|
+
const ctx = (0, import_react25.useContext)(DgaContext);
|
|
4625
4855
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
4626
|
-
return /* @__PURE__ */ (0,
|
|
4856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui24.Popover.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4627
4857
|
import_radix_ui24.Popover.Content,
|
|
4628
4858
|
{
|
|
4629
4859
|
"data-slot": "popover-content",
|
|
@@ -4632,7 +4862,7 @@ function PopoverContent({
|
|
|
4632
4862
|
...props,
|
|
4633
4863
|
children: [
|
|
4634
4864
|
children,
|
|
4635
|
-
arrow ? /* @__PURE__ */ (0,
|
|
4865
|
+
arrow ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui24.Popover.Arrow, { className: "ddga-popover__arrow", width: 16, height: 8 }) : null
|
|
4636
4866
|
]
|
|
4637
4867
|
}
|
|
4638
4868
|
) });
|
|
@@ -4646,7 +4876,7 @@ function PopoverClose({
|
|
|
4646
4876
|
}) {
|
|
4647
4877
|
const hasRenderableChildren = children != null && children !== false;
|
|
4648
4878
|
if (asChild || hasRenderableChildren) {
|
|
4649
|
-
return /* @__PURE__ */ (0,
|
|
4879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4650
4880
|
import_radix_ui24.Popover.Close,
|
|
4651
4881
|
{
|
|
4652
4882
|
"data-slot": "popover-close",
|
|
@@ -4657,27 +4887,27 @@ function PopoverClose({
|
|
|
4657
4887
|
}
|
|
4658
4888
|
);
|
|
4659
4889
|
}
|
|
4660
|
-
return /* @__PURE__ */ (0,
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4661
4891
|
import_radix_ui24.Popover.Close,
|
|
4662
4892
|
{
|
|
4663
4893
|
"data-slot": "popover-close",
|
|
4664
4894
|
"aria-label": closeLabel,
|
|
4665
4895
|
className: cn("ddga-popover__close", className),
|
|
4666
4896
|
...props,
|
|
4667
|
-
children: /* @__PURE__ */ (0,
|
|
4897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Close, { "aria-hidden": "true" })
|
|
4668
4898
|
}
|
|
4669
4899
|
);
|
|
4670
4900
|
}
|
|
4671
4901
|
|
|
4672
4902
|
// src/components/Sidebar/Sidebar.tsx
|
|
4673
|
-
var
|
|
4903
|
+
var import_react28 = require("react");
|
|
4674
4904
|
var import_radix_ui25 = require("radix-ui");
|
|
4675
4905
|
|
|
4676
4906
|
// src/components/Sidebar/SidebarContext.ts
|
|
4677
|
-
var
|
|
4678
|
-
var SidebarContext = (0,
|
|
4907
|
+
var import_react26 = require("react");
|
|
4908
|
+
var SidebarContext = (0, import_react26.createContext)(null);
|
|
4679
4909
|
function useSidebar() {
|
|
4680
|
-
const ctx = (0,
|
|
4910
|
+
const ctx = (0, import_react26.useContext)(SidebarContext);
|
|
4681
4911
|
if (!ctx) {
|
|
4682
4912
|
throw new Error("useSidebar must be used within a <SidebarProvider>");
|
|
4683
4913
|
}
|
|
@@ -4685,10 +4915,10 @@ function useSidebar() {
|
|
|
4685
4915
|
}
|
|
4686
4916
|
|
|
4687
4917
|
// src/components/Sidebar/useIsMobile.ts
|
|
4688
|
-
var
|
|
4918
|
+
var import_react27 = require("react");
|
|
4689
4919
|
function useIsMobile(breakpoint = 768) {
|
|
4690
|
-
const [isMobile, setIsMobile] = (0,
|
|
4691
|
-
(0,
|
|
4920
|
+
const [isMobile, setIsMobile] = (0, import_react27.useState)(false);
|
|
4921
|
+
(0, import_react27.useEffect)(() => {
|
|
4692
4922
|
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
4693
4923
|
const onChange = () => setIsMobile(mql.matches);
|
|
4694
4924
|
onChange();
|
|
@@ -4699,7 +4929,7 @@ function useIsMobile(breakpoint = 768) {
|
|
|
4699
4929
|
}
|
|
4700
4930
|
|
|
4701
4931
|
// src/components/Sidebar/Sidebar.tsx
|
|
4702
|
-
var
|
|
4932
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4703
4933
|
function SidebarProvider({
|
|
4704
4934
|
defaultOpen = true,
|
|
4705
4935
|
open: openProp,
|
|
@@ -4712,18 +4942,18 @@ function SidebarProvider({
|
|
|
4712
4942
|
...props
|
|
4713
4943
|
}) {
|
|
4714
4944
|
const isMobile = useIsMobile(mobileBreakpoint);
|
|
4715
|
-
const [openMobile, setOpenMobile] = (0,
|
|
4945
|
+
const [openMobile, setOpenMobile] = (0, import_react28.useState)(false);
|
|
4716
4946
|
const isControlled = openProp !== void 0;
|
|
4717
|
-
const [openInternal, setOpenInternal] = (0,
|
|
4947
|
+
const [openInternal, setOpenInternal] = (0, import_react28.useState)(defaultOpen);
|
|
4718
4948
|
const open = isControlled ? openProp : openInternal;
|
|
4719
|
-
const setOpen = (0,
|
|
4949
|
+
const setOpen = (0, import_react28.useCallback)(
|
|
4720
4950
|
(value2) => {
|
|
4721
4951
|
if (!isControlled) setOpenInternal(value2);
|
|
4722
4952
|
onOpenChange?.(value2);
|
|
4723
4953
|
},
|
|
4724
4954
|
[isControlled, onOpenChange]
|
|
4725
4955
|
);
|
|
4726
|
-
const toggleSidebar = (0,
|
|
4956
|
+
const toggleSidebar = (0, import_react28.useCallback)(() => {
|
|
4727
4957
|
if (isMobile) {
|
|
4728
4958
|
setOpenMobile((v) => !v);
|
|
4729
4959
|
return;
|
|
@@ -4734,7 +4964,7 @@ function SidebarProvider({
|
|
|
4734
4964
|
setOpenInternal((v) => !v);
|
|
4735
4965
|
}
|
|
4736
4966
|
}, [isMobile, isControlled, onOpenChange, open]);
|
|
4737
|
-
(0,
|
|
4967
|
+
(0, import_react28.useEffect)(() => {
|
|
4738
4968
|
if (!keyboardShortcut) return;
|
|
4739
4969
|
const onKeyDown = (e) => {
|
|
4740
4970
|
if (e.key.toLowerCase() === "b" && (e.metaKey || e.ctrlKey)) {
|
|
@@ -4746,11 +4976,11 @@ function SidebarProvider({
|
|
|
4746
4976
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
4747
4977
|
}, [keyboardShortcut, toggleSidebar]);
|
|
4748
4978
|
const state = open ? "expanded" : "collapsed";
|
|
4749
|
-
const value = (0,
|
|
4979
|
+
const value = (0, import_react28.useMemo)(
|
|
4750
4980
|
() => ({ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }),
|
|
4751
4981
|
[state, open, setOpen, openMobile, isMobile, toggleSidebar]
|
|
4752
4982
|
);
|
|
4753
|
-
return /* @__PURE__ */ (0,
|
|
4983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4754
4984
|
"div",
|
|
4755
4985
|
{
|
|
4756
4986
|
"data-slot": "sidebar-wrapper",
|
|
@@ -4772,7 +5002,7 @@ function Sidebar({
|
|
|
4772
5002
|
}) {
|
|
4773
5003
|
const { isMobile, openMobile, setOpenMobile, state } = useSidebar();
|
|
4774
5004
|
if (isMobile) {
|
|
4775
|
-
return /* @__PURE__ */ (0,
|
|
5005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Drawer, { open: openMobile, onOpenChange: setOpenMobile, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4776
5006
|
DrawerContent,
|
|
4777
5007
|
{
|
|
4778
5008
|
side,
|
|
@@ -4782,11 +5012,12 @@ function Sidebar({
|
|
|
4782
5012
|
"data-variant": variant,
|
|
4783
5013
|
"data-side": side,
|
|
4784
5014
|
className: cn("ddga-sidebar", "ddga-sidebar--mobile", className),
|
|
5015
|
+
...props,
|
|
4785
5016
|
children
|
|
4786
5017
|
}
|
|
4787
5018
|
) });
|
|
4788
5019
|
}
|
|
4789
|
-
return /* @__PURE__ */ (0,
|
|
5020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4790
5021
|
"aside",
|
|
4791
5022
|
{
|
|
4792
5023
|
"data-slot": "sidebar",
|
|
@@ -4811,7 +5042,7 @@ function SidebarTrigger({
|
|
|
4811
5042
|
}) {
|
|
4812
5043
|
const { toggleSidebar, open, openMobile, isMobile } = useSidebar();
|
|
4813
5044
|
const Comp = asChild ? import_radix_ui25.Slot.Slot : "button";
|
|
4814
|
-
return /* @__PURE__ */ (0,
|
|
5045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4815
5046
|
Comp,
|
|
4816
5047
|
{
|
|
4817
5048
|
type: asChild ? void 0 : "button",
|
|
@@ -4825,7 +5056,7 @@ function SidebarTrigger({
|
|
|
4825
5056
|
toggleSidebar();
|
|
4826
5057
|
},
|
|
4827
5058
|
...props,
|
|
4828
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
5059
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { "aria-hidden": "true" })
|
|
4829
5060
|
}
|
|
4830
5061
|
);
|
|
4831
5062
|
}
|
|
@@ -4835,7 +5066,7 @@ function SidebarRail({
|
|
|
4835
5066
|
...props
|
|
4836
5067
|
}) {
|
|
4837
5068
|
const { toggleSidebar } = useSidebar();
|
|
4838
|
-
return /* @__PURE__ */ (0,
|
|
5069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4839
5070
|
"button",
|
|
4840
5071
|
{
|
|
4841
5072
|
type: "button",
|
|
@@ -4851,15 +5082,15 @@ function SidebarRail({
|
|
|
4851
5082
|
}
|
|
4852
5083
|
function SidebarInset({ asChild, className, ...props }) {
|
|
4853
5084
|
const Comp = asChild ? import_radix_ui25.Slot.Slot : "main";
|
|
4854
|
-
return /* @__PURE__ */ (0,
|
|
5085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { "data-slot": "sidebar-inset", className: cn("ddga-sidebar-inset", className), ...props });
|
|
4855
5086
|
}
|
|
4856
5087
|
function SidebarHeader({ asChild, className, ...props }) {
|
|
4857
5088
|
const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
|
|
4858
|
-
return /* @__PURE__ */ (0,
|
|
5089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { "data-slot": "sidebar-header", className: cn("ddga-sidebar__header", className), ...props });
|
|
4859
5090
|
}
|
|
4860
5091
|
function SidebarContent({ asChild, className, ...props }) {
|
|
4861
5092
|
const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
|
|
4862
|
-
return /* @__PURE__ */ (0,
|
|
5093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4863
5094
|
Comp,
|
|
4864
5095
|
{
|
|
4865
5096
|
"data-slot": "sidebar-content",
|
|
@@ -4870,10 +5101,10 @@ function SidebarContent({ asChild, className, ...props }) {
|
|
|
4870
5101
|
}
|
|
4871
5102
|
function SidebarFooter({ asChild, className, ...props }) {
|
|
4872
5103
|
const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
|
|
4873
|
-
return /* @__PURE__ */ (0,
|
|
5104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { "data-slot": "sidebar-footer", className: cn("ddga-sidebar__footer", className), ...props });
|
|
4874
5105
|
}
|
|
4875
5106
|
function SidebarSeparator({ className, ...props }) {
|
|
4876
|
-
return /* @__PURE__ */ (0,
|
|
5107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4877
5108
|
"hr",
|
|
4878
5109
|
{
|
|
4879
5110
|
"data-slot": "sidebar-separator",
|
|
@@ -4885,10 +5116,10 @@ function SidebarSeparator({ className, ...props }) {
|
|
|
4885
5116
|
|
|
4886
5117
|
// src/components/Sidebar/SidebarGroup.tsx
|
|
4887
5118
|
var import_radix_ui26 = require("radix-ui");
|
|
4888
|
-
var
|
|
5119
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4889
5120
|
function SidebarGroup({ asChild, className, ...props }) {
|
|
4890
5121
|
const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
|
|
4891
|
-
return /* @__PURE__ */ (0,
|
|
5122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4892
5123
|
Comp,
|
|
4893
5124
|
{
|
|
4894
5125
|
"data-slot": "sidebar-group",
|
|
@@ -4900,7 +5131,7 @@ function SidebarGroup({ asChild, className, ...props }) {
|
|
|
4900
5131
|
}
|
|
4901
5132
|
function SidebarGroupLabel({ asChild, className, ...props }) {
|
|
4902
5133
|
const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
|
|
4903
|
-
return /* @__PURE__ */ (0,
|
|
5134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4904
5135
|
Comp,
|
|
4905
5136
|
{
|
|
4906
5137
|
"data-slot": "sidebar-group-label",
|
|
@@ -4911,7 +5142,7 @@ function SidebarGroupLabel({ asChild, className, ...props }) {
|
|
|
4911
5142
|
}
|
|
4912
5143
|
function SidebarGroupAction({ asChild, className, ...props }) {
|
|
4913
5144
|
const Comp = asChild ? import_radix_ui26.Slot.Slot : "button";
|
|
4914
|
-
return /* @__PURE__ */ (0,
|
|
5145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4915
5146
|
Comp,
|
|
4916
5147
|
{
|
|
4917
5148
|
type: asChild ? void 0 : "button",
|
|
@@ -4923,7 +5154,7 @@ function SidebarGroupAction({ asChild, className, ...props }) {
|
|
|
4923
5154
|
}
|
|
4924
5155
|
function SidebarGroupContent({ asChild, className, ...props }) {
|
|
4925
5156
|
const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
|
|
4926
|
-
return /* @__PURE__ */ (0,
|
|
5157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4927
5158
|
Comp,
|
|
4928
5159
|
{
|
|
4929
5160
|
"data-slot": "sidebar-group-content",
|
|
@@ -4943,12 +5174,12 @@ function useDir() {
|
|
|
4943
5174
|
}
|
|
4944
5175
|
|
|
4945
5176
|
// src/components/Sidebar/SidebarMenu.tsx
|
|
4946
|
-
var
|
|
5177
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4947
5178
|
function SidebarMenu({ className, ...props }) {
|
|
4948
|
-
return /* @__PURE__ */ (0,
|
|
5179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { "data-slot": "sidebar-menu", className: cn("ddga-sidebar__menu", className), ...props });
|
|
4949
5180
|
}
|
|
4950
5181
|
function SidebarMenuItem({ className, ...props }) {
|
|
4951
|
-
return /* @__PURE__ */ (0,
|
|
5182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4952
5183
|
"li",
|
|
4953
5184
|
{
|
|
4954
5185
|
"data-slot": "sidebar-menu-item",
|
|
@@ -4978,7 +5209,7 @@ function SidebarMenuButton({
|
|
|
4978
5209
|
const { state, isMobile } = useSidebar();
|
|
4979
5210
|
const dir = useDir();
|
|
4980
5211
|
const Comp = asChild ? import_radix_ui27.Slot.Slot : "button";
|
|
4981
|
-
const button = /* @__PURE__ */ (0,
|
|
5212
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4982
5213
|
Comp,
|
|
4983
5214
|
{
|
|
4984
5215
|
type: asChild ? void 0 : "button",
|
|
@@ -4993,14 +5224,14 @@ function SidebarMenuButton({
|
|
|
4993
5224
|
if (!tooltip || state !== "collapsed" || isMobile) {
|
|
4994
5225
|
return button;
|
|
4995
5226
|
}
|
|
4996
|
-
return /* @__PURE__ */ (0,
|
|
4997
|
-
/* @__PURE__ */ (0,
|
|
4998
|
-
/* @__PURE__ */ (0,
|
|
5227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Tooltip, { children: [
|
|
5228
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { "data-slot": "tooltip-trigger", style: { display: "contents" }, children: button }) }),
|
|
5229
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipContent, { side: dir === "rtl" ? "left" : "right", children: tooltip })
|
|
4999
5230
|
] });
|
|
5000
5231
|
}
|
|
5001
5232
|
function SidebarMenuAction({ asChild, showOnHover, className, ...props }) {
|
|
5002
5233
|
const Comp = asChild ? import_radix_ui27.Slot.Slot : "button";
|
|
5003
|
-
return /* @__PURE__ */ (0,
|
|
5234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5004
5235
|
Comp,
|
|
5005
5236
|
{
|
|
5006
5237
|
type: asChild ? void 0 : "button",
|
|
@@ -5012,7 +5243,7 @@ function SidebarMenuAction({ asChild, showOnHover, className, ...props }) {
|
|
|
5012
5243
|
);
|
|
5013
5244
|
}
|
|
5014
5245
|
function SidebarMenuBadge({ className, ...props }) {
|
|
5015
|
-
return /* @__PURE__ */ (0,
|
|
5246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5016
5247
|
"span",
|
|
5017
5248
|
{
|
|
5018
5249
|
"data-slot": "sidebar-menu-badge",
|
|
@@ -5022,21 +5253,21 @@ function SidebarMenuBadge({ className, ...props }) {
|
|
|
5022
5253
|
);
|
|
5023
5254
|
}
|
|
5024
5255
|
function SidebarMenuSkeleton({ showIcon, className, ...props }) {
|
|
5025
|
-
return /* @__PURE__ */ (0,
|
|
5256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5026
5257
|
"div",
|
|
5027
5258
|
{
|
|
5028
5259
|
"data-slot": "sidebar-menu-skeleton",
|
|
5029
5260
|
className: cn("ddga-sidebar__menu-skeleton", className),
|
|
5030
5261
|
...props,
|
|
5031
5262
|
children: [
|
|
5032
|
-
showIcon ? /* @__PURE__ */ (0,
|
|
5033
|
-
/* @__PURE__ */ (0,
|
|
5263
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Skeleton, { shape: "circle", width: "1rem", height: "1rem" }) : null,
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Skeleton, { shape: "text", className: "ddga-sidebar__menu-skeleton-text" })
|
|
5034
5265
|
]
|
|
5035
5266
|
}
|
|
5036
5267
|
);
|
|
5037
5268
|
}
|
|
5038
5269
|
function SidebarMenuSub({ className, ...props }) {
|
|
5039
|
-
return /* @__PURE__ */ (0,
|
|
5270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5040
5271
|
"ul",
|
|
5041
5272
|
{
|
|
5042
5273
|
"data-slot": "sidebar-menu-sub",
|
|
@@ -5046,7 +5277,7 @@ function SidebarMenuSub({ className, ...props }) {
|
|
|
5046
5277
|
);
|
|
5047
5278
|
}
|
|
5048
5279
|
function SidebarMenuSubItem({ className, ...props }) {
|
|
5049
|
-
return /* @__PURE__ */ (0,
|
|
5280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5050
5281
|
"li",
|
|
5051
5282
|
{
|
|
5052
5283
|
"data-slot": "sidebar-menu-sub-item",
|
|
@@ -5072,7 +5303,7 @@ function SidebarMenuSubButton({
|
|
|
5072
5303
|
...props
|
|
5073
5304
|
}) {
|
|
5074
5305
|
const Comp = asChild ? import_radix_ui27.Slot.Slot : "a";
|
|
5075
|
-
return /* @__PURE__ */ (0,
|
|
5306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5076
5307
|
Comp,
|
|
5077
5308
|
{
|
|
5078
5309
|
"data-slot": "sidebar-menu-sub-button",
|
|
@@ -5088,7 +5319,7 @@ function SidebarMenuSubButton({
|
|
|
5088
5319
|
// src/components/ScrollArea/ScrollArea.tsx
|
|
5089
5320
|
var import_radix_ui28 = require("radix-ui");
|
|
5090
5321
|
var import_class_variance_authority38 = require("class-variance-authority");
|
|
5091
|
-
var
|
|
5322
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5092
5323
|
var scrollAreaVariants = (0, import_class_variance_authority38.cva)("ddga-scroll-area", {
|
|
5093
5324
|
variants: {
|
|
5094
5325
|
orientation: {
|
|
@@ -5125,7 +5356,7 @@ function ScrollArea({
|
|
|
5125
5356
|
const showVertical = orientation === "vertical" || orientation === "both";
|
|
5126
5357
|
const showHorizontal = orientation === "horizontal" || orientation === "both";
|
|
5127
5358
|
const { className: viewportClassName, ...restViewportProps } = viewportProps ?? {};
|
|
5128
|
-
return /* @__PURE__ */ (0,
|
|
5359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5129
5360
|
import_radix_ui28.ScrollArea.Root,
|
|
5130
5361
|
{
|
|
5131
5362
|
"data-slot": "scroll-area",
|
|
@@ -5134,7 +5365,7 @@ function ScrollArea({
|
|
|
5134
5365
|
className: cn(scrollAreaVariants({ orientation }), className),
|
|
5135
5366
|
...props,
|
|
5136
5367
|
children: [
|
|
5137
|
-
/* @__PURE__ */ (0,
|
|
5368
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5138
5369
|
import_radix_ui28.ScrollArea.Viewport,
|
|
5139
5370
|
{
|
|
5140
5371
|
"data-slot": "scroll-area-viewport",
|
|
@@ -5148,35 +5379,35 @@ function ScrollArea({
|
|
|
5148
5379
|
children
|
|
5149
5380
|
}
|
|
5150
5381
|
),
|
|
5151
|
-
showVertical ? /* @__PURE__ */ (0,
|
|
5382
|
+
showVertical ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5152
5383
|
import_radix_ui28.ScrollArea.Scrollbar,
|
|
5153
5384
|
{
|
|
5154
5385
|
"data-slot": "scroll-area-scrollbar",
|
|
5155
5386
|
orientation: "vertical",
|
|
5156
5387
|
className: "ddga-scroll-area__scrollbar",
|
|
5157
|
-
children: /* @__PURE__ */ (0,
|
|
5388
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui28.ScrollArea.Thumb, { className: "ddga-scroll-area__thumb" })
|
|
5158
5389
|
}
|
|
5159
5390
|
) : null,
|
|
5160
|
-
showHorizontal ? /* @__PURE__ */ (0,
|
|
5391
|
+
showHorizontal ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5161
5392
|
import_radix_ui28.ScrollArea.Scrollbar,
|
|
5162
5393
|
{
|
|
5163
5394
|
"data-slot": "scroll-area-scrollbar",
|
|
5164
5395
|
orientation: "horizontal",
|
|
5165
5396
|
className: "ddga-scroll-area__scrollbar",
|
|
5166
|
-
children: /* @__PURE__ */ (0,
|
|
5397
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui28.ScrollArea.Thumb, { className: "ddga-scroll-area__thumb" })
|
|
5167
5398
|
}
|
|
5168
5399
|
) : null,
|
|
5169
|
-
orientation === "both" ? /* @__PURE__ */ (0,
|
|
5400
|
+
orientation === "both" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui28.ScrollArea.Corner, { className: "ddga-scroll-area__corner" }) : null
|
|
5170
5401
|
]
|
|
5171
5402
|
}
|
|
5172
5403
|
);
|
|
5173
5404
|
}
|
|
5174
5405
|
|
|
5175
5406
|
// src/components/Menubar/Menubar.tsx
|
|
5176
|
-
var
|
|
5407
|
+
var import_react29 = require("react");
|
|
5177
5408
|
var import_radix_ui29 = require("radix-ui");
|
|
5178
5409
|
var import_class_variance_authority39 = require("class-variance-authority");
|
|
5179
|
-
var
|
|
5410
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5180
5411
|
var menubarContentVariants = (0, import_class_variance_authority39.cva)("ddga-menubar-menu", {
|
|
5181
5412
|
variants: {
|
|
5182
5413
|
size: {
|
|
@@ -5200,7 +5431,7 @@ var menubarTriggerVariants = (0, import_class_variance_authority39.cva)("ddga-me
|
|
|
5200
5431
|
}
|
|
5201
5432
|
});
|
|
5202
5433
|
function Menubar({ className, ...props }) {
|
|
5203
|
-
return /* @__PURE__ */ (0,
|
|
5434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5204
5435
|
import_radix_ui29.Menubar.Root,
|
|
5205
5436
|
{
|
|
5206
5437
|
"data-slot": "menubar",
|
|
@@ -5210,10 +5441,10 @@ function Menubar({ className, ...props }) {
|
|
|
5210
5441
|
);
|
|
5211
5442
|
}
|
|
5212
5443
|
function MenubarMenu(props) {
|
|
5213
|
-
return /* @__PURE__ */ (0,
|
|
5444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.Menu, { ...props });
|
|
5214
5445
|
}
|
|
5215
5446
|
function MenubarTrigger({ variant, className, ...props }) {
|
|
5216
|
-
return /* @__PURE__ */ (0,
|
|
5447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5217
5448
|
import_radix_ui29.Menubar.Trigger,
|
|
5218
5449
|
{
|
|
5219
5450
|
"data-slot": "menubar-trigger",
|
|
@@ -5224,9 +5455,9 @@ function MenubarTrigger({ variant, className, ...props }) {
|
|
|
5224
5455
|
);
|
|
5225
5456
|
}
|
|
5226
5457
|
function MenubarContent({ size, className, sideOffset = 6, ...props }) {
|
|
5227
|
-
const ctx = (0,
|
|
5458
|
+
const ctx = (0, import_react29.useContext)(DgaContext);
|
|
5228
5459
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5229
|
-
return /* @__PURE__ */ (0,
|
|
5460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5230
5461
|
import_radix_ui29.Menubar.Content,
|
|
5231
5462
|
{
|
|
5232
5463
|
"data-slot": "menubar-content",
|
|
@@ -5244,7 +5475,7 @@ function MenubarItem({
|
|
|
5244
5475
|
children,
|
|
5245
5476
|
...props
|
|
5246
5477
|
}) {
|
|
5247
|
-
return /* @__PURE__ */ (0,
|
|
5478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
5248
5479
|
import_radix_ui29.Menubar.Item,
|
|
5249
5480
|
{
|
|
5250
5481
|
"data-slot": "menubar-item",
|
|
@@ -5252,9 +5483,9 @@ function MenubarItem({
|
|
|
5252
5483
|
className: cn("ddga-menubar-menu__item", className),
|
|
5253
5484
|
...props,
|
|
5254
5485
|
children: [
|
|
5255
|
-
startIcon ? /* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5257
|
-
shortcut ? /* @__PURE__ */ (0,
|
|
5486
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
5487
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__label", children }),
|
|
5488
|
+
shortcut ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__shortcut", "aria-hidden": "true", children: shortcut }) : null
|
|
5258
5489
|
]
|
|
5259
5490
|
}
|
|
5260
5491
|
);
|
|
@@ -5268,7 +5499,7 @@ function MenubarCheckboxItem({
|
|
|
5268
5499
|
const handleSelect = onSelect ?? ((event) => {
|
|
5269
5500
|
event.preventDefault();
|
|
5270
5501
|
});
|
|
5271
|
-
return /* @__PURE__ */ (0,
|
|
5502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
5272
5503
|
import_radix_ui29.Menubar.CheckboxItem,
|
|
5273
5504
|
{
|
|
5274
5505
|
"data-slot": "menubar-checkbox-item",
|
|
@@ -5276,20 +5507,20 @@ function MenubarCheckboxItem({
|
|
|
5276
5507
|
onSelect: handleSelect,
|
|
5277
5508
|
...props,
|
|
5278
5509
|
children: [
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
5280
|
-
/* @__PURE__ */ (0,
|
|
5510
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Check, { className: "ddga-menubar-menu__indicator-icon" }) }) }),
|
|
5511
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__label", children })
|
|
5281
5512
|
]
|
|
5282
5513
|
}
|
|
5283
5514
|
);
|
|
5284
5515
|
}
|
|
5285
5516
|
function MenubarRadioGroup(props) {
|
|
5286
|
-
return /* @__PURE__ */ (0,
|
|
5517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.RadioGroup, { "data-slot": "menubar-radio-group", ...props });
|
|
5287
5518
|
}
|
|
5288
5519
|
function MenubarRadioItem({ className, children, onSelect, ...props }) {
|
|
5289
5520
|
const handleSelect = onSelect ?? ((event) => {
|
|
5290
5521
|
event.preventDefault();
|
|
5291
5522
|
});
|
|
5292
|
-
return /* @__PURE__ */ (0,
|
|
5523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
5293
5524
|
import_radix_ui29.Menubar.RadioItem,
|
|
5294
5525
|
{
|
|
5295
5526
|
"data-slot": "menubar-radio-item",
|
|
@@ -5297,14 +5528,14 @@ function MenubarRadioItem({ className, children, onSelect, ...props }) {
|
|
|
5297
5528
|
onSelect: handleSelect,
|
|
5298
5529
|
...props,
|
|
5299
5530
|
children: [
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5531
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__radio-dot" }) }) }),
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__label", children })
|
|
5302
5533
|
]
|
|
5303
5534
|
}
|
|
5304
5535
|
);
|
|
5305
5536
|
}
|
|
5306
5537
|
function MenubarLabel({ className, ...props }) {
|
|
5307
|
-
return /* @__PURE__ */ (0,
|
|
5538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5308
5539
|
import_radix_ui29.Menubar.Label,
|
|
5309
5540
|
{
|
|
5310
5541
|
"data-slot": "menubar-label",
|
|
@@ -5314,7 +5545,7 @@ function MenubarLabel({ className, ...props }) {
|
|
|
5314
5545
|
);
|
|
5315
5546
|
}
|
|
5316
5547
|
function MenubarSeparator({ className, ...props }) {
|
|
5317
|
-
return /* @__PURE__ */ (0,
|
|
5548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5318
5549
|
import_radix_ui29.Menubar.Separator,
|
|
5319
5550
|
{
|
|
5320
5551
|
"data-slot": "menubar-separator",
|
|
@@ -5324,30 +5555,30 @@ function MenubarSeparator({ className, ...props }) {
|
|
|
5324
5555
|
);
|
|
5325
5556
|
}
|
|
5326
5557
|
function MenubarGroup(props) {
|
|
5327
|
-
return /* @__PURE__ */ (0,
|
|
5558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.Group, { "data-slot": "menubar-group", ...props });
|
|
5328
5559
|
}
|
|
5329
5560
|
function MenubarSub(props) {
|
|
5330
|
-
return /* @__PURE__ */ (0,
|
|
5561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.Sub, { ...props });
|
|
5331
5562
|
}
|
|
5332
5563
|
function MenubarSubTrigger({ className, startIcon, children, ...props }) {
|
|
5333
|
-
return /* @__PURE__ */ (0,
|
|
5564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
5334
5565
|
import_radix_ui29.Menubar.SubTrigger,
|
|
5335
5566
|
{
|
|
5336
5567
|
"data-slot": "menubar-sub-trigger",
|
|
5337
5568
|
className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--sub", className),
|
|
5338
5569
|
...props,
|
|
5339
5570
|
children: [
|
|
5340
|
-
startIcon ? /* @__PURE__ */ (0,
|
|
5341
|
-
/* @__PURE__ */ (0,
|
|
5342
|
-
/* @__PURE__ */ (0,
|
|
5571
|
+
startIcon ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-menubar-menu__label", children }),
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ChevronRight, { className: "ddga-menubar-menu__sub-chevron", "aria-hidden": "true" })
|
|
5343
5574
|
]
|
|
5344
5575
|
}
|
|
5345
5576
|
);
|
|
5346
5577
|
}
|
|
5347
5578
|
function MenubarSubContent({ size, className, ...props }) {
|
|
5348
|
-
const ctx = (0,
|
|
5579
|
+
const ctx = (0, import_react29.useContext)(DgaContext);
|
|
5349
5580
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5350
|
-
return /* @__PURE__ */ (0,
|
|
5581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5351
5582
|
import_radix_ui29.Menubar.SubContent,
|
|
5352
5583
|
{
|
|
5353
5584
|
"data-slot": "menubar-sub-content",
|
|
@@ -5359,7 +5590,7 @@ function MenubarSubContent({ size, className, ...props }) {
|
|
|
5359
5590
|
|
|
5360
5591
|
// src/components/Timeline/Timeline.tsx
|
|
5361
5592
|
var import_class_variance_authority40 = require("class-variance-authority");
|
|
5362
|
-
var
|
|
5593
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5363
5594
|
var timelineVariants = (0, import_class_variance_authority40.cva)("ddga-timeline", {
|
|
5364
5595
|
variants: {
|
|
5365
5596
|
size: {
|
|
@@ -5391,7 +5622,7 @@ var timelineMarkerVariants = (0, import_class_variance_authority40.cva)("ddga-ti
|
|
|
5391
5622
|
}
|
|
5392
5623
|
});
|
|
5393
5624
|
function Timeline({ size, orientation, className, ...props }) {
|
|
5394
|
-
return /* @__PURE__ */ (0,
|
|
5625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5395
5626
|
"ol",
|
|
5396
5627
|
{
|
|
5397
5628
|
"data-slot": "timeline",
|
|
@@ -5402,12 +5633,12 @@ function Timeline({ size, orientation, className, ...props }) {
|
|
|
5402
5633
|
);
|
|
5403
5634
|
}
|
|
5404
5635
|
function TimelineItem({ className, ...props }) {
|
|
5405
|
-
return /* @__PURE__ */ (0,
|
|
5636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { "data-slot": "timeline-item", className: cn("ddga-timeline__item", className), ...props });
|
|
5406
5637
|
}
|
|
5407
5638
|
function TimelineMarker({ status, className, children, ...props }) {
|
|
5408
5639
|
const resolved = status ?? "default";
|
|
5409
5640
|
const reached = resolved !== "default";
|
|
5410
|
-
return /* @__PURE__ */ (0,
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5411
5642
|
"span",
|
|
5412
5643
|
{
|
|
5413
5644
|
"aria-hidden": "true",
|
|
@@ -5416,12 +5647,12 @@ function TimelineMarker({ status, className, children, ...props }) {
|
|
|
5416
5647
|
"data-reached": reached ? "" : void 0,
|
|
5417
5648
|
className: cn(timelineMarkerVariants({ status }), className),
|
|
5418
5649
|
...props,
|
|
5419
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
5650
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-timeline__dot" })
|
|
5420
5651
|
}
|
|
5421
5652
|
);
|
|
5422
5653
|
}
|
|
5423
5654
|
function TimelineContent({ className, ...props }) {
|
|
5424
|
-
return /* @__PURE__ */ (0,
|
|
5655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5425
5656
|
"div",
|
|
5426
5657
|
{
|
|
5427
5658
|
"data-slot": "timeline-content",
|
|
@@ -5431,10 +5662,10 @@ function TimelineContent({ className, ...props }) {
|
|
|
5431
5662
|
);
|
|
5432
5663
|
}
|
|
5433
5664
|
function TimelineTitle({ className, ...props }) {
|
|
5434
|
-
return /* @__PURE__ */ (0,
|
|
5665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { "data-slot": "timeline-title", className: cn("ddga-timeline__title", className), ...props });
|
|
5435
5666
|
}
|
|
5436
5667
|
function TimelineDescription({ className, ...props }) {
|
|
5437
|
-
return /* @__PURE__ */ (0,
|
|
5668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5438
5669
|
"span",
|
|
5439
5670
|
{
|
|
5440
5671
|
"data-slot": "timeline-description",
|
|
@@ -5444,47 +5675,1404 @@ function TimelineDescription({ className, ...props }) {
|
|
|
5444
5675
|
);
|
|
5445
5676
|
}
|
|
5446
5677
|
function TimelineTime({ className, ...props }) {
|
|
5447
|
-
return /* @__PURE__ */ (0,
|
|
5678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("time", { "data-slot": "timeline-time", className: cn("ddga-timeline__time", className), ...props });
|
|
5448
5679
|
}
|
|
5449
5680
|
|
|
5450
|
-
// src/
|
|
5451
|
-
var
|
|
5681
|
+
// src/components/Command/Command.tsx
|
|
5682
|
+
var import_react30 = require("react");
|
|
5683
|
+
var import_cmdk2 = require("cmdk");
|
|
5452
5684
|
var import_radix_ui30 = require("radix-ui");
|
|
5453
|
-
var
|
|
5454
|
-
var
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
as: Component = "div",
|
|
5685
|
+
var import_class_variance_authority41 = require("class-variance-authority");
|
|
5686
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5687
|
+
var commandVariants = (0, import_class_variance_authority41.cva)("ddga-command");
|
|
5688
|
+
function Command2({ className, ...props }) {
|
|
5689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_cmdk2.Command, { "data-slot": "command", className: cn(commandVariants(), className), ...props });
|
|
5690
|
+
}
|
|
5691
|
+
function CommandInput({
|
|
5461
5692
|
className,
|
|
5462
|
-
|
|
5693
|
+
placeholder,
|
|
5694
|
+
"aria-label": ariaLabel,
|
|
5695
|
+
...props
|
|
5696
|
+
}) {
|
|
5697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "ddga-command__input-wrapper", "data-slot": "command-input-wrapper", children: [
|
|
5698
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Search, { className: "ddga-command__search-icon", "aria-hidden": "true" }),
|
|
5699
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5700
|
+
import_cmdk2.Command.Input,
|
|
5701
|
+
{
|
|
5702
|
+
"data-slot": "command-input",
|
|
5703
|
+
className: cn("ddga-command__input", className),
|
|
5704
|
+
placeholder,
|
|
5705
|
+
"aria-label": ariaLabel ?? (typeof placeholder === "string" ? placeholder : void 0),
|
|
5706
|
+
...props
|
|
5707
|
+
}
|
|
5708
|
+
)
|
|
5709
|
+
] });
|
|
5710
|
+
}
|
|
5711
|
+
function CommandList({ className, ...props }) {
|
|
5712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5713
|
+
import_cmdk2.Command.List,
|
|
5714
|
+
{
|
|
5715
|
+
"data-slot": "command-list",
|
|
5716
|
+
className: cn("ddga-command__list", className),
|
|
5717
|
+
...props
|
|
5718
|
+
}
|
|
5719
|
+
);
|
|
5720
|
+
}
|
|
5721
|
+
function CommandEmpty({ className, ...props }) {
|
|
5722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5723
|
+
import_cmdk2.Command.Empty,
|
|
5724
|
+
{
|
|
5725
|
+
"data-slot": "command-empty",
|
|
5726
|
+
className: cn("ddga-command__empty", className),
|
|
5727
|
+
...props
|
|
5728
|
+
}
|
|
5729
|
+
);
|
|
5730
|
+
}
|
|
5731
|
+
function CommandGroup({ className, ...props }) {
|
|
5732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5733
|
+
import_cmdk2.Command.Group,
|
|
5734
|
+
{
|
|
5735
|
+
"data-slot": "command-group",
|
|
5736
|
+
className: cn("ddga-command__group", className),
|
|
5737
|
+
...props
|
|
5738
|
+
}
|
|
5739
|
+
);
|
|
5740
|
+
}
|
|
5741
|
+
function CommandSeparator({
|
|
5742
|
+
className,
|
|
5743
|
+
"aria-hidden": ariaHidden = true,
|
|
5744
|
+
...props
|
|
5745
|
+
}) {
|
|
5746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5747
|
+
import_cmdk2.Command.Separator,
|
|
5748
|
+
{
|
|
5749
|
+
"aria-hidden": ariaHidden,
|
|
5750
|
+
"data-slot": "command-separator",
|
|
5751
|
+
className: cn("ddga-command__separator", className),
|
|
5752
|
+
...props
|
|
5753
|
+
}
|
|
5754
|
+
);
|
|
5755
|
+
}
|
|
5756
|
+
function CommandItem({
|
|
5757
|
+
startIcon,
|
|
5758
|
+
shortcut,
|
|
5759
|
+
className,
|
|
5760
|
+
children,
|
|
5761
|
+
keywords,
|
|
5762
|
+
...props
|
|
5763
|
+
}) {
|
|
5764
|
+
const labelText = typeof children === "string" ? children : void 0;
|
|
5765
|
+
const mergedKeywords = labelText && !keywords?.includes(labelText) ? [...keywords ?? [], labelText] : keywords;
|
|
5766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
5767
|
+
import_cmdk2.Command.Item,
|
|
5768
|
+
{
|
|
5769
|
+
"data-slot": "command-item",
|
|
5770
|
+
className: cn("ddga-command__item", className),
|
|
5771
|
+
keywords: mergedKeywords,
|
|
5772
|
+
...props,
|
|
5773
|
+
children: [
|
|
5774
|
+
startIcon != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-command__item-icon", "aria-hidden": "true", children: startIcon }),
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-command__item-label", children }),
|
|
5776
|
+
shortcut != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-command__item-shortcut", children: shortcut })
|
|
5777
|
+
]
|
|
5778
|
+
}
|
|
5779
|
+
);
|
|
5780
|
+
}
|
|
5781
|
+
function CommandDialog({
|
|
5782
|
+
open: controlledOpen,
|
|
5783
|
+
defaultOpen,
|
|
5784
|
+
onOpenChange,
|
|
5785
|
+
shortcut = "k",
|
|
5786
|
+
label = "Command palette",
|
|
5787
|
+
description,
|
|
5788
|
+
className,
|
|
5789
|
+
filter,
|
|
5790
|
+
shouldFilter,
|
|
5791
|
+
loop,
|
|
5463
5792
|
children
|
|
5464
5793
|
}) {
|
|
5465
|
-
const
|
|
5466
|
-
const
|
|
5467
|
-
const
|
|
5468
|
-
const
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5794
|
+
const [internalOpen, setInternalOpen] = (0, import_react30.useState)(defaultOpen ?? false);
|
|
5795
|
+
const isControlled = controlledOpen !== void 0;
|
|
5796
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
5797
|
+
const setOpen = (0, import_react30.useCallback)(
|
|
5798
|
+
(next) => {
|
|
5799
|
+
if (!isControlled) setInternalOpen(next);
|
|
5800
|
+
onOpenChange?.(next);
|
|
5801
|
+
},
|
|
5802
|
+
[isControlled, onOpenChange]
|
|
5803
|
+
);
|
|
5804
|
+
const openRef = (0, import_react30.useRef)(open);
|
|
5805
|
+
(0, import_react30.useEffect)(() => {
|
|
5806
|
+
openRef.current = open;
|
|
5807
|
+
});
|
|
5808
|
+
(0, import_react30.useEffect)(() => {
|
|
5809
|
+
if (typeof shortcut !== "string") return;
|
|
5810
|
+
const key = shortcut.toLowerCase();
|
|
5811
|
+
const onKeyDown = (event) => {
|
|
5812
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === key) {
|
|
5813
|
+
event.preventDefault();
|
|
5814
|
+
setOpen(!openRef.current);
|
|
5815
|
+
}
|
|
5485
5816
|
};
|
|
5486
|
-
|
|
5487
|
-
|
|
5817
|
+
document.addEventListener("keydown", onKeyDown);
|
|
5818
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5819
|
+
}, [shortcut, setOpen]);
|
|
5820
|
+
const ctx = (0, import_react30.useContext)(DgaContext);
|
|
5821
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_radix_ui30.Dialog.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_radix_ui30.Dialog.Portal, { container: portalContainer, children: [
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_radix_ui30.Dialog.Overlay, { className: "ddga-command__overlay", "data-slot": "command-overlay" }),
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
5825
|
+
import_radix_ui30.Dialog.Content,
|
|
5826
|
+
{
|
|
5827
|
+
"data-slot": "command-dialog",
|
|
5828
|
+
className: cn("ddga-command-dialog", className),
|
|
5829
|
+
...description == null ? { "aria-describedby": void 0 } : {},
|
|
5830
|
+
children: [
|
|
5831
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_radix_ui30.Dialog.Title, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_radix_ui30.VisuallyHidden.Root, { children: label }) }),
|
|
5832
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_radix_ui30.Dialog.Description, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_radix_ui30.VisuallyHidden.Root, { children: description }) }),
|
|
5833
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5834
|
+
Command2,
|
|
5835
|
+
{
|
|
5836
|
+
"data-slot": "command-dialog-command",
|
|
5837
|
+
className: "ddga-command--dialog",
|
|
5838
|
+
label: typeof label === "string" ? label : "Command palette",
|
|
5839
|
+
filter,
|
|
5840
|
+
shouldFilter,
|
|
5841
|
+
loop,
|
|
5842
|
+
children
|
|
5843
|
+
}
|
|
5844
|
+
)
|
|
5845
|
+
]
|
|
5846
|
+
}
|
|
5847
|
+
)
|
|
5848
|
+
] }) });
|
|
5849
|
+
}
|
|
5850
|
+
|
|
5851
|
+
// src/components/Table/Table.tsx
|
|
5852
|
+
var import_class_variance_authority42 = require("class-variance-authority");
|
|
5853
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5854
|
+
var tableVariants = (0, import_class_variance_authority42.cva)("ddga-table", {
|
|
5855
|
+
variants: {
|
|
5856
|
+
size: {
|
|
5857
|
+
sm: "ddga-table--sm",
|
|
5858
|
+
md: "ddga-table--md",
|
|
5859
|
+
lg: "ddga-table--lg"
|
|
5860
|
+
},
|
|
5861
|
+
striped: { true: "ddga-table--striped" },
|
|
5862
|
+
divided: { true: "ddga-table--divided" },
|
|
5863
|
+
bordered: { true: "ddga-table--bordered" },
|
|
5864
|
+
stickyHeader: { true: "ddga-table--sticky" }
|
|
5865
|
+
},
|
|
5866
|
+
defaultVariants: {
|
|
5867
|
+
size: "md"
|
|
5868
|
+
}
|
|
5869
|
+
});
|
|
5870
|
+
function Table({
|
|
5871
|
+
size,
|
|
5872
|
+
striped,
|
|
5873
|
+
divided,
|
|
5874
|
+
bordered,
|
|
5875
|
+
stickyHeader,
|
|
5876
|
+
className,
|
|
5877
|
+
maxHeight,
|
|
5878
|
+
"aria-label": ariaLabel,
|
|
5879
|
+
"aria-labelledby": ariaLabelledby,
|
|
5880
|
+
...props
|
|
5881
|
+
}) {
|
|
5882
|
+
const named = Boolean(ariaLabel || ariaLabelledby);
|
|
5883
|
+
if (process.env.NODE_ENV !== "production" && !named) {
|
|
5884
|
+
console.warn(
|
|
5885
|
+
"[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."
|
|
5886
|
+
);
|
|
5887
|
+
}
|
|
5888
|
+
if (process.env.NODE_ENV !== "production" && ariaLabel && ariaLabelledby) {
|
|
5889
|
+
console.warn(
|
|
5890
|
+
"[ddga] <Table> received both `aria-label` and `aria-labelledby`. `aria-labelledby` takes precedence; `aria-label` will be ignored by assistive technology."
|
|
5891
|
+
);
|
|
5892
|
+
}
|
|
5893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5894
|
+
"div",
|
|
5895
|
+
{
|
|
5896
|
+
"data-slot": "table-region",
|
|
5897
|
+
className: "ddga-table__region",
|
|
5898
|
+
style: maxHeight != null ? { maxBlockSize: maxHeight, overflowY: "auto" } : void 0,
|
|
5899
|
+
...named ? {
|
|
5900
|
+
role: "region",
|
|
5901
|
+
tabIndex: 0,
|
|
5902
|
+
"aria-label": ariaLabel,
|
|
5903
|
+
"aria-labelledby": ariaLabelledby
|
|
5904
|
+
} : {},
|
|
5905
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5906
|
+
"table",
|
|
5907
|
+
{
|
|
5908
|
+
"data-slot": "table",
|
|
5909
|
+
className: cn(tableVariants({ size, striped, divided, bordered, stickyHeader }), className),
|
|
5910
|
+
...props
|
|
5911
|
+
}
|
|
5912
|
+
)
|
|
5913
|
+
}
|
|
5914
|
+
);
|
|
5915
|
+
}
|
|
5916
|
+
function TableHeader({ className, ...props }) {
|
|
5917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("thead", { "data-slot": "table-header", className: cn("ddga-table__header", className), ...props });
|
|
5918
|
+
}
|
|
5919
|
+
function TableBody({ className, ...props }) {
|
|
5920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("tbody", { "data-slot": "table-body", className: cn("ddga-table__body", className), ...props });
|
|
5921
|
+
}
|
|
5922
|
+
function TableFooter({ className, ...props }) {
|
|
5923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("tfoot", { "data-slot": "table-footer", className: cn("ddga-table__footer", className), ...props });
|
|
5924
|
+
}
|
|
5925
|
+
function TableRow({ className, selected, ...props }) {
|
|
5926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5927
|
+
"tr",
|
|
5928
|
+
{
|
|
5929
|
+
"data-slot": "table-row",
|
|
5930
|
+
"data-state": selected ? "selected" : void 0,
|
|
5931
|
+
className: cn("ddga-table__row", className),
|
|
5932
|
+
...props
|
|
5933
|
+
}
|
|
5934
|
+
);
|
|
5935
|
+
}
|
|
5936
|
+
function TableHead({
|
|
5937
|
+
className,
|
|
5938
|
+
align,
|
|
5939
|
+
sortable,
|
|
5940
|
+
sortDirection = false,
|
|
5941
|
+
sortLabel,
|
|
5942
|
+
onClick,
|
|
5943
|
+
children,
|
|
5944
|
+
...props
|
|
5945
|
+
}) {
|
|
5946
|
+
const headClass = cn("ddga-table__head", align && `ddga-table__head--align-${align}`, className);
|
|
5947
|
+
if (process.env.NODE_ENV !== "production" && sortable && !sortLabel) {
|
|
5948
|
+
console.warn(
|
|
5949
|
+
'[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.'
|
|
5950
|
+
);
|
|
5951
|
+
}
|
|
5952
|
+
if (!sortable) {
|
|
5953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("th", { scope: "col", "data-slot": "table-head", className: headClass, ...props, children });
|
|
5954
|
+
}
|
|
5955
|
+
const ariaSort = sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none";
|
|
5956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("th", { scope: "col", "data-slot": "table-head", "aria-sort": ariaSort, className: headClass, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
5957
|
+
"button",
|
|
5958
|
+
{
|
|
5959
|
+
type: "button",
|
|
5960
|
+
"data-slot": "table-sort-button",
|
|
5961
|
+
className: "ddga-table__sort-button",
|
|
5962
|
+
onClick,
|
|
5963
|
+
children: [
|
|
5964
|
+
children,
|
|
5965
|
+
sortLabel ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ddga-sr-only", children: sortLabel }) : null,
|
|
5966
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ddga-table__sort-icon", "data-slot": "table-sort-icon", "aria-hidden": "true", children: sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CaretUp, {}) : sortDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CaretDown, {}) : (
|
|
5967
|
+
// Neutral affordance: stacked carets, dimmed via CSS.
|
|
5968
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
5969
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CaretUp, {}),
|
|
5970
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CaretDown, {})
|
|
5971
|
+
] })
|
|
5972
|
+
) })
|
|
5973
|
+
]
|
|
5974
|
+
}
|
|
5975
|
+
) });
|
|
5976
|
+
}
|
|
5977
|
+
function TableCell({ className, align, ...props }) {
|
|
5978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5979
|
+
"td",
|
|
5980
|
+
{
|
|
5981
|
+
"data-slot": "table-cell",
|
|
5982
|
+
className: cn("ddga-table__cell", align && `ddga-table__cell--align-${align}`, className),
|
|
5983
|
+
...props
|
|
5984
|
+
}
|
|
5985
|
+
);
|
|
5986
|
+
}
|
|
5987
|
+
function TableCaption({ className, ...props }) {
|
|
5988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5989
|
+
"caption",
|
|
5990
|
+
{
|
|
5991
|
+
"data-slot": "table-caption",
|
|
5992
|
+
className: cn("ddga-table__caption", className),
|
|
5993
|
+
...props
|
|
5994
|
+
}
|
|
5995
|
+
);
|
|
5996
|
+
}
|
|
5997
|
+
|
|
5998
|
+
// src/components/InputOTP/InputOTP.tsx
|
|
5999
|
+
var import_react31 = require("react");
|
|
6000
|
+
var import_class_variance_authority43 = require("class-variance-authority");
|
|
6001
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6002
|
+
var DEFAULT_PATTERN = "^[0-9]*$";
|
|
6003
|
+
var inputOTPVariants = (0, import_class_variance_authority43.cva)("ddga-input-otp", {
|
|
6004
|
+
variants: {
|
|
6005
|
+
size: {
|
|
6006
|
+
sm: "ddga-input-otp--sm",
|
|
6007
|
+
md: "ddga-input-otp--md",
|
|
6008
|
+
lg: "ddga-input-otp--lg"
|
|
6009
|
+
},
|
|
6010
|
+
error: {
|
|
6011
|
+
true: "ddga-input-otp--error"
|
|
6012
|
+
}
|
|
6013
|
+
},
|
|
6014
|
+
defaultVariants: {
|
|
6015
|
+
size: "md"
|
|
6016
|
+
}
|
|
6017
|
+
});
|
|
6018
|
+
function resolveGroups(length, groupSizes) {
|
|
6019
|
+
if (!groupSizes || groupSizes.length === 0) return [length];
|
|
6020
|
+
const sum = groupSizes.reduce((total, n) => total + n, 0);
|
|
6021
|
+
if (sum !== length) {
|
|
6022
|
+
if (process.env.NODE_ENV === "development") {
|
|
6023
|
+
console.warn(
|
|
6024
|
+
`[@dev-dga/react] InputOTP: groupSizes must sum to length (${length}); got ${sum}. Falling back to a single group.`
|
|
6025
|
+
);
|
|
6026
|
+
}
|
|
6027
|
+
return [length];
|
|
6028
|
+
}
|
|
6029
|
+
return groupSizes;
|
|
6030
|
+
}
|
|
6031
|
+
function Slot({
|
|
6032
|
+
char,
|
|
6033
|
+
active,
|
|
6034
|
+
caret,
|
|
6035
|
+
mask
|
|
6036
|
+
}) {
|
|
6037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
6038
|
+
"div",
|
|
6039
|
+
{
|
|
6040
|
+
"data-slot": "input-otp-slot",
|
|
6041
|
+
"data-active": active || void 0,
|
|
6042
|
+
"data-filled": char != null || void 0,
|
|
6043
|
+
className: "ddga-input-otp__slot",
|
|
6044
|
+
children: [
|
|
6045
|
+
char != null ? mask ? "\u2022" : char : null,
|
|
6046
|
+
caret && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "aria-hidden": "true", "data-slot": "input-otp-caret", className: "ddga-input-otp__caret" })
|
|
6047
|
+
]
|
|
6048
|
+
}
|
|
6049
|
+
);
|
|
6050
|
+
}
|
|
6051
|
+
function InputOTP({
|
|
6052
|
+
id: externalId,
|
|
6053
|
+
length = 6,
|
|
6054
|
+
groupSizes,
|
|
6055
|
+
value,
|
|
6056
|
+
defaultValue,
|
|
6057
|
+
onChange,
|
|
6058
|
+
onComplete,
|
|
6059
|
+
pattern = DEFAULT_PATTERN,
|
|
6060
|
+
mask = false,
|
|
6061
|
+
separator,
|
|
6062
|
+
size,
|
|
6063
|
+
disabled,
|
|
6064
|
+
autoFocus,
|
|
6065
|
+
name,
|
|
6066
|
+
required,
|
|
6067
|
+
label,
|
|
6068
|
+
helperText,
|
|
6069
|
+
errorMessage,
|
|
6070
|
+
error,
|
|
6071
|
+
className,
|
|
6072
|
+
"aria-label": ariaLabel,
|
|
6073
|
+
"aria-labelledby": ariaLabelledby,
|
|
6074
|
+
...props
|
|
6075
|
+
}) {
|
|
6076
|
+
const inputRef = (0, import_react31.useRef)(null);
|
|
6077
|
+
const [focused, setFocused] = (0, import_react31.useState)(false);
|
|
6078
|
+
const isControlled = value !== void 0;
|
|
6079
|
+
const [internal, setInternal] = (0, import_react31.useState)(defaultValue ?? "");
|
|
6080
|
+
const current = isControlled ? value : internal;
|
|
6081
|
+
const compiledPattern = (0, import_react31.useMemo)(() => {
|
|
6082
|
+
try {
|
|
6083
|
+
return new RegExp(pattern);
|
|
6084
|
+
} catch {
|
|
6085
|
+
if (process.env.NODE_ENV === "development") {
|
|
6086
|
+
console.warn(
|
|
6087
|
+
`[@dev-dga/react] InputOTP: invalid \`pattern\` regex "${pattern}". Falling back to digits-only.`
|
|
6088
|
+
);
|
|
6089
|
+
}
|
|
6090
|
+
return new RegExp(DEFAULT_PATTERN);
|
|
6091
|
+
}
|
|
6092
|
+
}, [pattern]);
|
|
6093
|
+
const completedRef = (0, import_react31.useRef)(null);
|
|
6094
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
6095
|
+
name: "InputOTP",
|
|
6096
|
+
id: externalId,
|
|
6097
|
+
label,
|
|
6098
|
+
error,
|
|
6099
|
+
errorMessage,
|
|
6100
|
+
helperText,
|
|
6101
|
+
"aria-label": ariaLabel,
|
|
6102
|
+
"aria-labelledby": ariaLabelledby
|
|
6103
|
+
});
|
|
6104
|
+
function handleChange(event) {
|
|
6105
|
+
const next = event.target.value.replace(/[\s-]/g, "").slice(0, length);
|
|
6106
|
+
if (!compiledPattern.test(next)) return;
|
|
6107
|
+
if (!isControlled) setInternal(next);
|
|
6108
|
+
onChange?.(next);
|
|
6109
|
+
if (next.length === length) {
|
|
6110
|
+
if (completedRef.current !== next) {
|
|
6111
|
+
completedRef.current = next;
|
|
6112
|
+
onComplete?.(next);
|
|
6113
|
+
}
|
|
6114
|
+
} else {
|
|
6115
|
+
completedRef.current = null;
|
|
6116
|
+
}
|
|
6117
|
+
}
|
|
6118
|
+
function moveCaretToEnd() {
|
|
6119
|
+
const el = inputRef.current;
|
|
6120
|
+
if (el) el.setSelectionRange(el.value.length, el.value.length);
|
|
6121
|
+
}
|
|
6122
|
+
const groups = resolveGroups(length, groupSizes);
|
|
6123
|
+
const lastGroup = groups.length - 1;
|
|
6124
|
+
const activeIndex = focused ? Math.min(current.length, length - 1) : -1;
|
|
6125
|
+
const inputMode = pattern === DEFAULT_PATTERN ? "numeric" : "text";
|
|
6126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-slot": "input-otp-field", className: "ddga-field", ...props, children: [
|
|
6127
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { htmlFor: fieldId, className: "ddga-input-otp__label", children: [
|
|
6128
|
+
label,
|
|
6129
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", className: "ddga-input-otp__required", children: "*" })
|
|
6130
|
+
] }),
|
|
6131
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
6132
|
+
"div",
|
|
6133
|
+
{
|
|
6134
|
+
className: cn(inputOTPVariants({ size, error: hasError }), className),
|
|
6135
|
+
"data-slot": "input-otp",
|
|
6136
|
+
children: [
|
|
6137
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6138
|
+
"input",
|
|
6139
|
+
{
|
|
6140
|
+
...controlProps,
|
|
6141
|
+
ref: inputRef,
|
|
6142
|
+
type: "text",
|
|
6143
|
+
inputMode,
|
|
6144
|
+
autoComplete: "one-time-code",
|
|
6145
|
+
value: current,
|
|
6146
|
+
maxLength: length,
|
|
6147
|
+
disabled,
|
|
6148
|
+
autoFocus,
|
|
6149
|
+
name,
|
|
6150
|
+
required,
|
|
6151
|
+
"aria-label": ariaLabel,
|
|
6152
|
+
"aria-labelledby": ariaLabelledby,
|
|
6153
|
+
onChange: handleChange,
|
|
6154
|
+
onFocus: () => {
|
|
6155
|
+
setFocused(true);
|
|
6156
|
+
moveCaretToEnd();
|
|
6157
|
+
},
|
|
6158
|
+
onBlur: () => setFocused(false),
|
|
6159
|
+
onPointerUp: moveCaretToEnd,
|
|
6160
|
+
className: "ddga-input-otp__input",
|
|
6161
|
+
"data-slot": "input-otp-input"
|
|
6162
|
+
}
|
|
6163
|
+
),
|
|
6164
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { dir: "ltr", "aria-hidden": "true", "data-slot": "input-otp-row", className: "ddga-input-otp__row", children: groups.map((count, groupIndex) => {
|
|
6165
|
+
const start = groups.slice(0, groupIndex).reduce((total, n) => total + n, 0);
|
|
6166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react31.Fragment, { children: [
|
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "data-slot": "input-otp-group", className: "ddga-input-otp__group", children: Array.from({ length: count }, (_, offset) => {
|
|
6168
|
+
const index = start + offset;
|
|
6169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6170
|
+
Slot,
|
|
6171
|
+
{
|
|
6172
|
+
char: current[index],
|
|
6173
|
+
active: index === activeIndex,
|
|
6174
|
+
caret: index === activeIndex && current.length < length,
|
|
6175
|
+
mask
|
|
6176
|
+
},
|
|
6177
|
+
index
|
|
6178
|
+
);
|
|
6179
|
+
}) }),
|
|
6180
|
+
groupIndex < lastGroup && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6181
|
+
"span",
|
|
6182
|
+
{
|
|
6183
|
+
"aria-hidden": "true",
|
|
6184
|
+
"data-slot": "input-otp-separator",
|
|
6185
|
+
className: "ddga-input-otp__separator",
|
|
6186
|
+
children: separator ?? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "ddga-input-otp__separator-dash" })
|
|
6187
|
+
}
|
|
6188
|
+
)
|
|
6189
|
+
] }, groupIndex);
|
|
6190
|
+
}) })
|
|
6191
|
+
]
|
|
6192
|
+
}
|
|
6193
|
+
),
|
|
6194
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
6195
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
6196
|
+
] });
|
|
6197
|
+
}
|
|
6198
|
+
|
|
6199
|
+
// src/components/Link/Link.tsx
|
|
6200
|
+
var import_react32 = require("react");
|
|
6201
|
+
var import_radix_ui31 = require("radix-ui");
|
|
6202
|
+
var import_class_variance_authority44 = require("class-variance-authority");
|
|
6203
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
6204
|
+
var linkVariants = (0, import_class_variance_authority44.cva)("ddga-link", {
|
|
6205
|
+
variants: {
|
|
6206
|
+
variant: {
|
|
6207
|
+
// Inline links in running prose. Underlined always — color alone fails
|
|
6208
|
+
// WCAG 1.4.1 when a link sits inside a block of text.
|
|
6209
|
+
default: "ddga-link--default",
|
|
6210
|
+
// Links in UI chrome (footers, meta rows) where context makes them
|
|
6211
|
+
// obviously links: no underline until hover.
|
|
6212
|
+
subtle: "ddga-link--subtle",
|
|
6213
|
+
// Block-level CTAs ("Learn more →"): inline-flex with gapped icons,
|
|
6214
|
+
// no underline. Not for mid-sentence use.
|
|
6215
|
+
standalone: "ddga-link--standalone"
|
|
6216
|
+
}
|
|
6217
|
+
},
|
|
6218
|
+
defaultVariants: {
|
|
6219
|
+
variant: "default"
|
|
6220
|
+
}
|
|
6221
|
+
});
|
|
6222
|
+
function Link({
|
|
6223
|
+
variant,
|
|
6224
|
+
external,
|
|
6225
|
+
startIcon,
|
|
6226
|
+
endIcon,
|
|
6227
|
+
iconFlip,
|
|
6228
|
+
asChild,
|
|
6229
|
+
className,
|
|
6230
|
+
children,
|
|
6231
|
+
rel,
|
|
6232
|
+
...props
|
|
6233
|
+
}) {
|
|
6234
|
+
if (process.env.NODE_ENV === "development" && !asChild && props.href == null) {
|
|
6235
|
+
console.warn(
|
|
6236
|
+
'[@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.'
|
|
6237
|
+
);
|
|
6238
|
+
}
|
|
6239
|
+
const Comp = asChild ? import_radix_ui31.Slot.Slot : "a";
|
|
6240
|
+
const relValue = external ? Array.from(
|
|
6241
|
+
/* @__PURE__ */ new Set([...rel ? rel.split(/\s+/).filter(Boolean) : [], "noopener", "noreferrer"])
|
|
6242
|
+
).join(" ") : rel;
|
|
6243
|
+
const showExternalIcon = external && !endIcon;
|
|
6244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
6245
|
+
Comp,
|
|
6246
|
+
{
|
|
6247
|
+
"data-slot": "link",
|
|
6248
|
+
className: cn(linkVariants({ variant }), className),
|
|
6249
|
+
rel: relValue,
|
|
6250
|
+
...props,
|
|
6251
|
+
children: [
|
|
6252
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6253
|
+
"span",
|
|
6254
|
+
{
|
|
6255
|
+
className: cn("ddga-link__icon", iconFlip && "ddga-icon-flip"),
|
|
6256
|
+
"data-slot": "link-start-icon",
|
|
6257
|
+
"aria-hidden": "true",
|
|
6258
|
+
children: startIcon
|
|
6259
|
+
}
|
|
6260
|
+
),
|
|
6261
|
+
asChild ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui31.Slot.Slottable, { children }) : children,
|
|
6262
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6263
|
+
"span",
|
|
6264
|
+
{
|
|
6265
|
+
className: cn("ddga-link__icon", iconFlip && "ddga-icon-flip"),
|
|
6266
|
+
"data-slot": "link-end-icon",
|
|
6267
|
+
"aria-hidden": "true",
|
|
6268
|
+
children: endIcon
|
|
6269
|
+
}
|
|
6270
|
+
),
|
|
6271
|
+
showExternalIcon && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6272
|
+
"span",
|
|
6273
|
+
{
|
|
6274
|
+
className: "ddga-link__icon ddga-link__icon--external",
|
|
6275
|
+
"data-slot": "link-external-icon",
|
|
6276
|
+
"aria-hidden": "true",
|
|
6277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ExternalLink, {})
|
|
6278
|
+
}
|
|
6279
|
+
)
|
|
6280
|
+
]
|
|
6281
|
+
}
|
|
6282
|
+
);
|
|
6283
|
+
}
|
|
6284
|
+
|
|
6285
|
+
// src/components/SearchBox/SearchBox.tsx
|
|
6286
|
+
var import_react33 = require("react");
|
|
6287
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
6288
|
+
function setNativeInputValue(el, value) {
|
|
6289
|
+
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
6290
|
+
setter?.call(el, value);
|
|
6291
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
6292
|
+
}
|
|
6293
|
+
function SearchBox({
|
|
6294
|
+
value,
|
|
6295
|
+
defaultValue,
|
|
6296
|
+
onChange,
|
|
6297
|
+
onKeyDown,
|
|
6298
|
+
onSearch,
|
|
6299
|
+
onClear,
|
|
6300
|
+
clearable = true,
|
|
6301
|
+
clearLabel = "Clear search",
|
|
6302
|
+
className,
|
|
6303
|
+
ref,
|
|
6304
|
+
...rest
|
|
6305
|
+
}) {
|
|
6306
|
+
const inputRef = (0, import_react33.useRef)(null);
|
|
6307
|
+
const setRefs = (0, import_react33.useCallback)(
|
|
6308
|
+
(node) => {
|
|
6309
|
+
inputRef.current = node;
|
|
6310
|
+
if (typeof ref === "function") ref(node);
|
|
6311
|
+
else if (ref) ref.current = node;
|
|
6312
|
+
},
|
|
6313
|
+
[ref]
|
|
6314
|
+
);
|
|
6315
|
+
const isControlled = value !== void 0;
|
|
6316
|
+
const [internal, setInternal] = (0, import_react33.useState)(
|
|
6317
|
+
defaultValue != null ? String(defaultValue) : ""
|
|
6318
|
+
);
|
|
6319
|
+
const currentValue = isControlled ? String(value ?? "") : internal;
|
|
6320
|
+
const handleChange = (event) => {
|
|
6321
|
+
if (!isControlled) setInternal(event.target.value);
|
|
6322
|
+
onChange?.(event);
|
|
6323
|
+
};
|
|
6324
|
+
const clear = () => {
|
|
6325
|
+
const el = inputRef.current;
|
|
6326
|
+
if (!el) return;
|
|
6327
|
+
setNativeInputValue(el, "");
|
|
6328
|
+
el.focus();
|
|
6329
|
+
onClear?.();
|
|
6330
|
+
};
|
|
6331
|
+
const handleKeyDown = (event) => {
|
|
6332
|
+
onKeyDown?.(event);
|
|
6333
|
+
if (event.defaultPrevented) return;
|
|
6334
|
+
if (event.key === "Enter") {
|
|
6335
|
+
onSearch?.(currentValue);
|
|
6336
|
+
} else if (event.key === "Escape" && currentValue.length > 0) {
|
|
6337
|
+
event.preventDefault();
|
|
6338
|
+
event.stopPropagation();
|
|
6339
|
+
clear();
|
|
6340
|
+
}
|
|
6341
|
+
};
|
|
6342
|
+
const showClear = clearable && currentValue.length > 0;
|
|
6343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6344
|
+
Input,
|
|
6345
|
+
{
|
|
6346
|
+
...rest,
|
|
6347
|
+
ref: setRefs,
|
|
6348
|
+
type: "search",
|
|
6349
|
+
value: currentValue,
|
|
6350
|
+
onChange: handleChange,
|
|
6351
|
+
onKeyDown: handleKeyDown,
|
|
6352
|
+
className: cn("ddga-search-box", className),
|
|
6353
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Search, { "data-slot": "search-box-icon", "aria-hidden": "true" }),
|
|
6354
|
+
endAdornment: showClear ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6355
|
+
Button,
|
|
6356
|
+
{
|
|
6357
|
+
type: "button",
|
|
6358
|
+
variant: "ghost",
|
|
6359
|
+
size: "icon-sm",
|
|
6360
|
+
"aria-label": clearLabel,
|
|
6361
|
+
"data-slot": "search-box-clear",
|
|
6362
|
+
onClick: clear,
|
|
6363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Close, { "aria-hidden": "true" })
|
|
6364
|
+
}
|
|
6365
|
+
) : void 0
|
|
6366
|
+
}
|
|
6367
|
+
);
|
|
6368
|
+
}
|
|
6369
|
+
|
|
6370
|
+
// src/components/List/List.tsx
|
|
6371
|
+
var import_class_variance_authority45 = require("class-variance-authority");
|
|
6372
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6373
|
+
var listVariants = (0, import_class_variance_authority45.cva)("ddga-list", {
|
|
6374
|
+
variants: {
|
|
6375
|
+
variant: {
|
|
6376
|
+
plain: "ddga-list--plain",
|
|
6377
|
+
bulleted: "ddga-list--bulleted",
|
|
6378
|
+
numbered: "ddga-list--numbered",
|
|
6379
|
+
lettered: "ddga-list--lettered"
|
|
6380
|
+
},
|
|
6381
|
+
divided: {
|
|
6382
|
+
true: "ddga-list--divided"
|
|
6383
|
+
}
|
|
6384
|
+
},
|
|
6385
|
+
defaultVariants: {
|
|
6386
|
+
variant: "plain"
|
|
6387
|
+
}
|
|
6388
|
+
});
|
|
6389
|
+
function List({ variant, divided, className, start, reversed, ...props }) {
|
|
6390
|
+
const classes = cn(listVariants({ variant, divided }), className);
|
|
6391
|
+
const ordered = variant === "numbered" || variant === "lettered";
|
|
6392
|
+
if (ordered) {
|
|
6393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
6394
|
+
"ol",
|
|
6395
|
+
{
|
|
6396
|
+
"data-slot": "list",
|
|
6397
|
+
"data-variant": variant,
|
|
6398
|
+
className: classes,
|
|
6399
|
+
start,
|
|
6400
|
+
reversed,
|
|
6401
|
+
...props
|
|
6402
|
+
}
|
|
6403
|
+
);
|
|
6404
|
+
}
|
|
6405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ul", { "data-slot": "list", "data-variant": variant ?? "plain", className: classes, ...props });
|
|
6406
|
+
}
|
|
6407
|
+
function ListItem({ className, ...props }) {
|
|
6408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("li", { "data-slot": "list-item", className: cn("ddga-list__item", className), ...props });
|
|
6409
|
+
}
|
|
6410
|
+
function ListItemIcon({ className, ...props }) {
|
|
6411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-slot": "list-item-icon", className: cn("ddga-list__icon", className), ...props });
|
|
6412
|
+
}
|
|
6413
|
+
function ListItemContent({
|
|
6414
|
+
primary,
|
|
6415
|
+
secondary,
|
|
6416
|
+
className,
|
|
6417
|
+
children,
|
|
6418
|
+
...props
|
|
6419
|
+
}) {
|
|
6420
|
+
if (process.env.NODE_ENV === "development" && children != null && (primary != null || secondary != null)) {
|
|
6421
|
+
console.warn(
|
|
6422
|
+
"[@dev-dga/react] ListItemContent: `children` overrides `primary`/`secondary`. Pass one or the other, not both."
|
|
6423
|
+
);
|
|
6424
|
+
}
|
|
6425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "data-slot": "list-item-content", className: cn("ddga-list__content", className), ...props, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
6426
|
+
primary != null && primary !== "" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-slot": "list-item-primary", className: "ddga-list__primary", children: primary }),
|
|
6427
|
+
secondary != null && secondary !== "" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-slot": "list-item-secondary", className: "ddga-list__secondary", children: secondary })
|
|
6428
|
+
] }) });
|
|
6429
|
+
}
|
|
6430
|
+
function ListItemAction({ className, ...props }) {
|
|
6431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "data-slot": "list-item-action", className: cn("ddga-list__action", className), ...props });
|
|
6432
|
+
}
|
|
6433
|
+
|
|
6434
|
+
// src/components/Quote/Quote.tsx
|
|
6435
|
+
var import_react34 = require("react");
|
|
6436
|
+
var import_radix_ui32 = require("radix-ui");
|
|
6437
|
+
var import_class_variance_authority46 = require("class-variance-authority");
|
|
6438
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
6439
|
+
var quoteVariants = (0, import_class_variance_authority46.cva)("ddga-quote", {
|
|
6440
|
+
variants: {
|
|
6441
|
+
variant: {
|
|
6442
|
+
/** Inline-start accent border (SA Green). The everyday blockquote. */
|
|
6443
|
+
default: "ddga-quote--default",
|
|
6444
|
+
/** Large editorial quote, centered, prominent mark — breaks up prose. */
|
|
6445
|
+
pullquote: "ddga-quote--pullquote",
|
|
6446
|
+
/** Card surface (border + bg + shadow), sized for an avatar + attribution. */
|
|
6447
|
+
testimonial: "ddga-quote--testimonial",
|
|
6448
|
+
/** Bare — no border, no surface. For inline / tightly-composed use. */
|
|
6449
|
+
plain: "ddga-quote--plain"
|
|
6450
|
+
}
|
|
6451
|
+
},
|
|
6452
|
+
defaultVariants: {
|
|
6453
|
+
variant: "default"
|
|
6454
|
+
}
|
|
6455
|
+
});
|
|
6456
|
+
function Quote({
|
|
6457
|
+
variant,
|
|
6458
|
+
quoteMark = false,
|
|
6459
|
+
avatar,
|
|
6460
|
+
author,
|
|
6461
|
+
byline,
|
|
6462
|
+
source,
|
|
6463
|
+
cite,
|
|
6464
|
+
className,
|
|
6465
|
+
children,
|
|
6466
|
+
...props
|
|
6467
|
+
}) {
|
|
6468
|
+
const hasAttribution = author != null || byline != null || source != null;
|
|
6469
|
+
const mark = quoteMark ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(QuoteMark, { "aria-hidden": "true", className: "ddga-quote__mark" }) : null;
|
|
6470
|
+
if (!hasAttribution) {
|
|
6471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
6472
|
+
"blockquote",
|
|
6473
|
+
{
|
|
6474
|
+
"data-slot": "quote",
|
|
6475
|
+
"data-variant": variant ?? "default",
|
|
6476
|
+
className: cn(quoteVariants({ variant }), className),
|
|
6477
|
+
cite,
|
|
6478
|
+
...props,
|
|
6479
|
+
children: [
|
|
6480
|
+
mark,
|
|
6481
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(QuoteContent, { children })
|
|
6482
|
+
]
|
|
6483
|
+
}
|
|
6484
|
+
);
|
|
6485
|
+
}
|
|
6486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
6487
|
+
"figure",
|
|
6488
|
+
{
|
|
6489
|
+
"data-slot": "quote",
|
|
6490
|
+
"data-variant": variant ?? "default",
|
|
6491
|
+
className: cn(quoteVariants({ variant }), className),
|
|
6492
|
+
...props,
|
|
6493
|
+
children: [
|
|
6494
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("blockquote", { "data-slot": "quote-blockquote", className: "ddga-quote__blockquote", cite, children: [
|
|
6495
|
+
mark,
|
|
6496
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(QuoteContent, { children })
|
|
6497
|
+
] }),
|
|
6498
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(QuoteCaption, { children: [
|
|
6499
|
+
avatar != null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "data-slot": "quote-avatar", "aria-hidden": "true", className: "ddga-quote__avatar", children: avatar }) : null,
|
|
6500
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "ddga-quote__attribution", children: [
|
|
6501
|
+
author != null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(QuoteAuthor, { children: author }) : null,
|
|
6502
|
+
byline != null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ddga-quote__byline", children: byline }) : null,
|
|
6503
|
+
source != null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(QuoteSource, { children: source }) : null
|
|
6504
|
+
] })
|
|
6505
|
+
] })
|
|
6506
|
+
]
|
|
6507
|
+
}
|
|
6508
|
+
);
|
|
6509
|
+
}
|
|
6510
|
+
function QuoteContent({ asChild, className, ...props }) {
|
|
6511
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "div";
|
|
6512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Comp, { "data-slot": "quote-content", className: cn("ddga-quote__content", className), ...props });
|
|
6513
|
+
}
|
|
6514
|
+
function QuoteCaption({ asChild, className, ...props }) {
|
|
6515
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "figcaption";
|
|
6516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Comp, { "data-slot": "quote-caption", className: cn("ddga-quote__caption", className), ...props });
|
|
6517
|
+
}
|
|
6518
|
+
function QuoteAuthor({ asChild, className, ...props }) {
|
|
6519
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "span";
|
|
6520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Comp, { "data-slot": "quote-author", className: cn("ddga-quote__author", className), ...props });
|
|
6521
|
+
}
|
|
6522
|
+
function QuoteSource({ asChild, className, ...props }) {
|
|
6523
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "cite";
|
|
6524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Comp, { "data-slot": "quote-source", className: cn("ddga-quote__source", className), ...props });
|
|
6525
|
+
}
|
|
6526
|
+
|
|
6527
|
+
// src/components/Collapsible/Collapsible.tsx
|
|
6528
|
+
var import_radix_ui33 = require("radix-ui");
|
|
6529
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6530
|
+
function Collapsible({ className, ...props }) {
|
|
6531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6532
|
+
import_radix_ui33.Collapsible.Root,
|
|
6533
|
+
{
|
|
6534
|
+
"data-slot": "collapsible",
|
|
6535
|
+
className: cn("ddga-collapsible", className),
|
|
6536
|
+
...props
|
|
6537
|
+
}
|
|
6538
|
+
);
|
|
6539
|
+
}
|
|
6540
|
+
function CollapsibleTrigger({ className, ...props }) {
|
|
6541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6542
|
+
import_radix_ui33.Collapsible.Trigger,
|
|
6543
|
+
{
|
|
6544
|
+
"data-slot": "collapsible-trigger",
|
|
6545
|
+
className: cn("ddga-collapsible__trigger", className),
|
|
6546
|
+
...props
|
|
6547
|
+
}
|
|
6548
|
+
);
|
|
6549
|
+
}
|
|
6550
|
+
function CollapsibleContent({ className, children, ...props }) {
|
|
6551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6552
|
+
import_radix_ui33.Collapsible.Content,
|
|
6553
|
+
{
|
|
6554
|
+
"data-slot": "collapsible-content",
|
|
6555
|
+
className: cn("ddga-collapsible__content", className),
|
|
6556
|
+
...props,
|
|
6557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ddga-collapsible__content-inner", children })
|
|
6558
|
+
}
|
|
6559
|
+
);
|
|
6560
|
+
}
|
|
6561
|
+
|
|
6562
|
+
// src/components/TagInput/TagInput.tsx
|
|
6563
|
+
var import_react35 = require("react");
|
|
6564
|
+
var import_class_variance_authority47 = require("class-variance-authority");
|
|
6565
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
6566
|
+
var tagInputVariants = (0, import_class_variance_authority47.cva)("ddga-tag-input", {
|
|
6567
|
+
variants: {
|
|
6568
|
+
size: {
|
|
6569
|
+
sm: "ddga-tag-input--sm",
|
|
6570
|
+
md: "ddga-tag-input--md",
|
|
6571
|
+
lg: "ddga-tag-input--lg"
|
|
6572
|
+
},
|
|
6573
|
+
error: {
|
|
6574
|
+
true: "ddga-tag-input--error"
|
|
6575
|
+
}
|
|
6576
|
+
},
|
|
6577
|
+
defaultVariants: {
|
|
6578
|
+
size: "md"
|
|
6579
|
+
}
|
|
6580
|
+
});
|
|
6581
|
+
function TagInput({
|
|
6582
|
+
id: externalId,
|
|
6583
|
+
value,
|
|
6584
|
+
defaultValue,
|
|
6585
|
+
onChange,
|
|
6586
|
+
label,
|
|
6587
|
+
helperText,
|
|
6588
|
+
errorMessage,
|
|
6589
|
+
error,
|
|
6590
|
+
size,
|
|
6591
|
+
disabled,
|
|
6592
|
+
placeholder,
|
|
6593
|
+
max,
|
|
6594
|
+
allowDuplicates = false,
|
|
6595
|
+
caseSensitive = false,
|
|
6596
|
+
validate,
|
|
6597
|
+
delimiters = [","],
|
|
6598
|
+
chipVariant = "secondary",
|
|
6599
|
+
removeLabel = (tag) => `Remove ${tag}`,
|
|
6600
|
+
formatAnnouncement = (tag, action) => `${tag} ${action === "add" ? "added" : "removed"}`,
|
|
6601
|
+
className,
|
|
6602
|
+
...props
|
|
6603
|
+
}) {
|
|
6604
|
+
const isControlled = value !== void 0;
|
|
6605
|
+
const [uncontrolledTags, setUncontrolledTags] = (0, import_react35.useState)(defaultValue ?? []);
|
|
6606
|
+
const tags = isControlled ? value : uncontrolledTags;
|
|
6607
|
+
const [draft, setDraft] = (0, import_react35.useState)("");
|
|
6608
|
+
const [announcement, setAnnouncement] = (0, import_react35.useState)("");
|
|
6609
|
+
const inputRef = (0, import_react35.useRef)(null);
|
|
6610
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
6611
|
+
name: "TagInput",
|
|
6612
|
+
id: externalId,
|
|
6613
|
+
label,
|
|
6614
|
+
error,
|
|
6615
|
+
errorMessage,
|
|
6616
|
+
helperText,
|
|
6617
|
+
"aria-label": props["aria-label"],
|
|
6618
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
6619
|
+
});
|
|
6620
|
+
const commit = (next) => {
|
|
6621
|
+
if (!isControlled) setUncontrolledTags(next);
|
|
6622
|
+
onChange?.(next);
|
|
6623
|
+
};
|
|
6624
|
+
const norm = (t) => caseSensitive ? t : t.toLowerCase();
|
|
6625
|
+
const accept = (raw, current) => {
|
|
6626
|
+
let next = current;
|
|
6627
|
+
for (const fragment of raw) {
|
|
6628
|
+
const trimmed = fragment.trim();
|
|
6629
|
+
if (!trimmed) continue;
|
|
6630
|
+
if (max !== void 0 && next.length >= max) break;
|
|
6631
|
+
if (!allowDuplicates && next.some((t) => norm(t) === norm(trimmed))) continue;
|
|
6632
|
+
if (validate && !validate(trimmed, next)) continue;
|
|
6633
|
+
next = [...next, trimmed];
|
|
6634
|
+
}
|
|
6635
|
+
return next;
|
|
6636
|
+
};
|
|
6637
|
+
const announceAdded = (added) => {
|
|
6638
|
+
if (added.length > 0) {
|
|
6639
|
+
setAnnouncement(added.map((t) => formatAnnouncement(t, "add")).join(", "));
|
|
6640
|
+
}
|
|
6641
|
+
};
|
|
6642
|
+
const commitDraft = () => {
|
|
6643
|
+
const next = accept([draft], tags);
|
|
6644
|
+
if (next.length > tags.length) {
|
|
6645
|
+
commit(next);
|
|
6646
|
+
announceAdded(next.slice(tags.length));
|
|
6647
|
+
setDraft("");
|
|
6648
|
+
}
|
|
6649
|
+
};
|
|
6650
|
+
const splitPaste = (text) => {
|
|
6651
|
+
const escaped = delimiters.map((d) => d.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&"));
|
|
6652
|
+
const pattern = new RegExp(`[${escaped.join("")}\\n\\r]`);
|
|
6653
|
+
return text.split(pattern);
|
|
6654
|
+
};
|
|
6655
|
+
const removeTag = (index) => {
|
|
6656
|
+
const removed = tags[index];
|
|
6657
|
+
commit(tags.filter((_, i) => i !== index));
|
|
6658
|
+
setAnnouncement(formatAnnouncement(removed, "remove"));
|
|
6659
|
+
inputRef.current?.focus();
|
|
6660
|
+
};
|
|
6661
|
+
const handleKeyDown = (event) => {
|
|
6662
|
+
if (disabled) return;
|
|
6663
|
+
if (event.key === "Enter") {
|
|
6664
|
+
event.preventDefault();
|
|
6665
|
+
if (draft.trim()) commitDraft();
|
|
6666
|
+
} else if (delimiters.includes(event.key)) {
|
|
6667
|
+
event.preventDefault();
|
|
6668
|
+
if (draft.trim()) commitDraft();
|
|
6669
|
+
} else if (event.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
6670
|
+
event.preventDefault();
|
|
6671
|
+
removeTag(tags.length - 1);
|
|
6672
|
+
}
|
|
6673
|
+
};
|
|
6674
|
+
const handlePaste = (event) => {
|
|
6675
|
+
if (disabled) return;
|
|
6676
|
+
const text = event.clipboardData.getData("text");
|
|
6677
|
+
const fragments = splitPaste(text);
|
|
6678
|
+
if (fragments.length <= 1) return;
|
|
6679
|
+
event.preventDefault();
|
|
6680
|
+
const next = accept(fragments, tags);
|
|
6681
|
+
if (next.length > tags.length) {
|
|
6682
|
+
commit(next);
|
|
6683
|
+
announceAdded(next.slice(tags.length));
|
|
6684
|
+
setDraft("");
|
|
6685
|
+
}
|
|
6686
|
+
};
|
|
6687
|
+
const handleBoxMouseDown = (event) => {
|
|
6688
|
+
const target = event.target;
|
|
6689
|
+
if (target === inputRef.current || target.closest("button")) return;
|
|
6690
|
+
event.preventDefault();
|
|
6691
|
+
inputRef.current?.focus();
|
|
6692
|
+
};
|
|
6693
|
+
const chipSize = size === "lg" ? "md" : "sm";
|
|
6694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { "data-slot": "tag-input-field", className: "ddga-field", children: [
|
|
6695
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("label", { htmlFor: fieldId, className: "ddga-tag-input__label", children: label }),
|
|
6696
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
6697
|
+
"div",
|
|
6698
|
+
{
|
|
6699
|
+
"data-slot": "tag-input-control",
|
|
6700
|
+
className: cn(tagInputVariants({ size, error: hasError }), className),
|
|
6701
|
+
"data-disabled": disabled || void 0,
|
|
6702
|
+
onMouseDown: disabled ? void 0 : handleBoxMouseDown,
|
|
6703
|
+
children: [
|
|
6704
|
+
tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { "data-slot": "tag-input-list", className: "ddga-tag-input__list", role: "list", children: tags.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6705
|
+
"li",
|
|
6706
|
+
{
|
|
6707
|
+
"data-slot": "tag-input-item",
|
|
6708
|
+
className: "ddga-tag-input__item",
|
|
6709
|
+
role: "listitem",
|
|
6710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6711
|
+
Badge,
|
|
6712
|
+
{
|
|
6713
|
+
variant: chipVariant,
|
|
6714
|
+
size: chipSize,
|
|
6715
|
+
open: true,
|
|
6716
|
+
dismissible: !disabled,
|
|
6717
|
+
onDismiss: () => removeTag(index),
|
|
6718
|
+
closeLabel: removeLabel(tag),
|
|
6719
|
+
children: tag
|
|
6720
|
+
}
|
|
6721
|
+
)
|
|
6722
|
+
},
|
|
6723
|
+
`${tag}-${index}`
|
|
6724
|
+
)) }),
|
|
6725
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6726
|
+
"input",
|
|
6727
|
+
{
|
|
6728
|
+
...props,
|
|
6729
|
+
...controlProps,
|
|
6730
|
+
ref: inputRef,
|
|
6731
|
+
"data-slot": "tag-input",
|
|
6732
|
+
className: "ddga-tag-input__field",
|
|
6733
|
+
type: "text",
|
|
6734
|
+
value: draft,
|
|
6735
|
+
disabled,
|
|
6736
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
6737
|
+
onChange: (event) => setDraft(event.target.value),
|
|
6738
|
+
onKeyDown: handleKeyDown,
|
|
6739
|
+
onPaste: handlePaste
|
|
6740
|
+
}
|
|
6741
|
+
)
|
|
6742
|
+
]
|
|
6743
|
+
}
|
|
6744
|
+
),
|
|
6745
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { "data-slot": "tag-input-live", className: "ddga-sr-only", role: "status", "aria-live": "polite", children: announcement }),
|
|
6746
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
6747
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
6748
|
+
] });
|
|
6749
|
+
}
|
|
6750
|
+
|
|
6751
|
+
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
6752
|
+
var import_react36 = require("react");
|
|
6753
|
+
var import_react_aria_components3 = require("react-aria-components");
|
|
6754
|
+
var import_date3 = require("@internationalized/date");
|
|
6755
|
+
var import_class_variance_authority48 = require("class-variance-authority");
|
|
6756
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6757
|
+
var dateRangePickerTriggerVariants = (0, import_class_variance_authority48.cva)("ddga-date-range-picker-trigger", {
|
|
6758
|
+
variants: {
|
|
6759
|
+
size: {
|
|
6760
|
+
sm: "ddga-date-range-picker-trigger--sm",
|
|
6761
|
+
md: "ddga-date-range-picker-trigger--md"
|
|
6762
|
+
},
|
|
6763
|
+
error: {
|
|
6764
|
+
true: "ddga-date-range-picker-trigger--error"
|
|
6765
|
+
}
|
|
6766
|
+
},
|
|
6767
|
+
defaultVariants: {
|
|
6768
|
+
size: "md"
|
|
6769
|
+
}
|
|
6770
|
+
});
|
|
6771
|
+
var dateRangePickerVariants = dateRangePickerTriggerVariants;
|
|
6772
|
+
function toAriaRange(range) {
|
|
6773
|
+
if (!range) return null;
|
|
6774
|
+
const start = dateToCalendarDate(range.start);
|
|
6775
|
+
const end = dateToCalendarDate(range.end);
|
|
6776
|
+
if (!start || !end) return null;
|
|
6777
|
+
return { start, end };
|
|
6778
|
+
}
|
|
6779
|
+
function fromAriaRange(value) {
|
|
6780
|
+
if (!value) return null;
|
|
6781
|
+
const start = calendarDateToDate(value.start);
|
|
6782
|
+
const end = calendarDateToDate(value.end);
|
|
6783
|
+
if (!start || !end) return null;
|
|
6784
|
+
return { start, end };
|
|
6785
|
+
}
|
|
6786
|
+
function DateRangePicker({
|
|
6787
|
+
value: controlledValue,
|
|
6788
|
+
defaultValue,
|
|
6789
|
+
onChange,
|
|
6790
|
+
minValue,
|
|
6791
|
+
maxValue,
|
|
6792
|
+
label,
|
|
6793
|
+
helperText,
|
|
6794
|
+
errorMessage,
|
|
6795
|
+
error,
|
|
6796
|
+
required,
|
|
6797
|
+
disabled,
|
|
6798
|
+
size,
|
|
6799
|
+
id,
|
|
6800
|
+
className,
|
|
6801
|
+
"aria-label": ariaLabel,
|
|
6802
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6803
|
+
calendar: controlledCalendar,
|
|
6804
|
+
defaultCalendar = "gregorian",
|
|
6805
|
+
onCalendarChange,
|
|
6806
|
+
showCalendarToggle = true,
|
|
6807
|
+
calendarLabels,
|
|
6808
|
+
showSecondaryCalendar = false
|
|
6809
|
+
}) {
|
|
6810
|
+
const isValueControlled = controlledValue !== void 0;
|
|
6811
|
+
const [internalValue, setInternalValue] = (0, import_react36.useState)(
|
|
6812
|
+
() => toAriaRange(defaultValue)
|
|
6813
|
+
);
|
|
6814
|
+
const value = isValueControlled ? toAriaRange(controlledValue) : internalValue;
|
|
6815
|
+
const handleAriaChange = (0, import_react36.useCallback)(
|
|
6816
|
+
(next) => {
|
|
6817
|
+
const nextRange = next ? {
|
|
6818
|
+
start: new import_date3.CalendarDate(next.start.year, next.start.month, next.start.day),
|
|
6819
|
+
end: new import_date3.CalendarDate(next.end.year, next.end.month, next.end.day)
|
|
6820
|
+
} : null;
|
|
6821
|
+
if (!isValueControlled) setInternalValue(nextRange);
|
|
6822
|
+
onChange?.(fromAriaRange(nextRange));
|
|
6823
|
+
},
|
|
6824
|
+
[isValueControlled, onChange]
|
|
6825
|
+
);
|
|
6826
|
+
const isCalendarControlled = controlledCalendar !== void 0;
|
|
6827
|
+
const [internalCalendar, setInternalCalendar] = (0, import_react36.useState)(defaultCalendar);
|
|
6828
|
+
const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
|
|
6829
|
+
const setCalendar = (0, import_react36.useCallback)(
|
|
6830
|
+
(next) => {
|
|
6831
|
+
if (!isCalendarControlled) setInternalCalendar(next);
|
|
6832
|
+
onCalendarChange?.(next);
|
|
6833
|
+
},
|
|
6834
|
+
[isCalendarControlled, onCalendarChange]
|
|
6835
|
+
);
|
|
6836
|
+
const {
|
|
6837
|
+
dgaLocale,
|
|
6838
|
+
locale: ariaLocale,
|
|
6839
|
+
portalContainer,
|
|
6840
|
+
PrevChevron,
|
|
6841
|
+
NextChevron,
|
|
6842
|
+
resolvedLabels,
|
|
6843
|
+
navLabels,
|
|
6844
|
+
a11yLabels
|
|
6845
|
+
} = useCalendarChrome(calendarSystem, calendarLabels);
|
|
6846
|
+
const ariaMinValue = (0, import_react36.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
|
|
6847
|
+
const ariaMaxValue = (0, import_react36.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
|
|
6848
|
+
const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : dgaLocale.startsWith("ar") ? "\u0646\u0637\u0627\u0642 \u0627\u0644\u062A\u0627\u0631\u064A\u062E" : "Date range");
|
|
6849
|
+
const showToggle = showCalendarToggle && !isCalendarControlled;
|
|
6850
|
+
const hasError = !!error;
|
|
6851
|
+
const hasErrorMessage = hasError && errorMessage != null && errorMessage !== "";
|
|
6852
|
+
const hasHelper = !hasErrorMessage && helperText != null && helperText !== "";
|
|
6853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_aria_components3.I18nProvider, { locale: ariaLocale, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6854
|
+
import_react_aria_components3.DateRangePicker,
|
|
6855
|
+
{
|
|
6856
|
+
value,
|
|
6857
|
+
onChange: handleAriaChange,
|
|
6858
|
+
minValue: ariaMinValue,
|
|
6859
|
+
maxValue: ariaMaxValue,
|
|
6860
|
+
isRequired: required,
|
|
6861
|
+
isDisabled: disabled,
|
|
6862
|
+
isInvalid: hasError,
|
|
6863
|
+
shouldCloseOnSelect: true,
|
|
6864
|
+
id,
|
|
6865
|
+
"aria-label": ariaLabel,
|
|
6866
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6867
|
+
className: "ddga-field",
|
|
6868
|
+
"data-slot": "date-range-picker-field",
|
|
6869
|
+
children: [
|
|
6870
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_aria_components3.Label, { className: "ddga-date-range-picker__label", children: [
|
|
6871
|
+
label,
|
|
6872
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { "aria-hidden": "true", className: "ddga-date-range-picker__required", children: "*" })
|
|
6873
|
+
] }),
|
|
6874
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6875
|
+
import_react_aria_components3.Group,
|
|
6876
|
+
{
|
|
6877
|
+
"data-slot": "date-range-picker-trigger",
|
|
6878
|
+
className: cn(dateRangePickerTriggerVariants({ size, error: hasError }), className),
|
|
6879
|
+
children: [
|
|
6880
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6881
|
+
import_react_aria_components3.DateInput,
|
|
6882
|
+
{
|
|
6883
|
+
slot: "start",
|
|
6884
|
+
className: "ddga-date-range-picker__input",
|
|
6885
|
+
"data-slot": "date-range-picker-input-start",
|
|
6886
|
+
children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6887
|
+
import_react_aria_components3.DateSegment,
|
|
6888
|
+
{
|
|
6889
|
+
segment,
|
|
6890
|
+
className: "ddga-date-range-picker__segment",
|
|
6891
|
+
"data-slot": "date-range-picker-segment"
|
|
6892
|
+
}
|
|
6893
|
+
)
|
|
6894
|
+
}
|
|
6895
|
+
),
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { "aria-hidden": "true", className: "ddga-date-range-picker__separator", children: "\u2013" }),
|
|
6897
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6898
|
+
import_react_aria_components3.DateInput,
|
|
6899
|
+
{
|
|
6900
|
+
slot: "end",
|
|
6901
|
+
className: "ddga-date-range-picker__input",
|
|
6902
|
+
"data-slot": "date-range-picker-input-end",
|
|
6903
|
+
children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6904
|
+
import_react_aria_components3.DateSegment,
|
|
6905
|
+
{
|
|
6906
|
+
segment,
|
|
6907
|
+
className: "ddga-date-range-picker__segment",
|
|
6908
|
+
"data-slot": "date-range-picker-segment"
|
|
6909
|
+
}
|
|
6910
|
+
)
|
|
6911
|
+
}
|
|
6912
|
+
),
|
|
6913
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6914
|
+
import_react_aria_components3.Button,
|
|
6915
|
+
{
|
|
6916
|
+
className: "ddga-date-range-picker__icon-button",
|
|
6917
|
+
"aria-label": a11yLabels.openCalendar,
|
|
6918
|
+
"data-slot": "date-range-picker-trigger-button",
|
|
6919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(CalendarIcon, { "aria-hidden": "true", className: "ddga-date-range-picker__icon" })
|
|
6920
|
+
}
|
|
6921
|
+
)
|
|
6922
|
+
]
|
|
6923
|
+
}
|
|
6924
|
+
),
|
|
6925
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6926
|
+
import_react_aria_components3.Text,
|
|
6927
|
+
{
|
|
6928
|
+
slot: "description",
|
|
6929
|
+
className: "ddga-field__message ddga-field__message--helper",
|
|
6930
|
+
"data-slot": "field-helper",
|
|
6931
|
+
children: helperText
|
|
6932
|
+
}
|
|
6933
|
+
),
|
|
6934
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6935
|
+
import_react_aria_components3.FieldError,
|
|
6936
|
+
{
|
|
6937
|
+
className: "ddga-field__message ddga-field__message--error",
|
|
6938
|
+
"data-slot": "field-error",
|
|
6939
|
+
children: errorMessage
|
|
6940
|
+
}
|
|
6941
|
+
),
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6943
|
+
import_react_aria_components3.Popover,
|
|
6944
|
+
{
|
|
6945
|
+
UNSTABLE_portalContainer: portalContainer,
|
|
6946
|
+
className: "ddga-calendar-popover",
|
|
6947
|
+
"data-slot": "date-range-picker-popover",
|
|
6948
|
+
offset: 6,
|
|
6949
|
+
containerPadding: 12,
|
|
6950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6951
|
+
import_react_aria_components3.Dialog,
|
|
6952
|
+
{
|
|
6953
|
+
className: "ddga-calendar-dialog",
|
|
6954
|
+
"data-slot": "date-range-picker-dialog",
|
|
6955
|
+
"aria-label": dialogAriaLabel,
|
|
6956
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6957
|
+
children: [
|
|
6958
|
+
showToggle && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6959
|
+
CalendarSystemToggle,
|
|
6960
|
+
{
|
|
6961
|
+
value: calendarSystem,
|
|
6962
|
+
onChange: setCalendar,
|
|
6963
|
+
labels: resolvedLabels,
|
|
6964
|
+
groupLabel: a11yLabels.calendarSystem
|
|
6965
|
+
}
|
|
6966
|
+
),
|
|
6967
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6968
|
+
import_react_aria_components3.RangeCalendar,
|
|
6969
|
+
{
|
|
6970
|
+
className: "ddga-calendar ddga-calendar--range",
|
|
6971
|
+
"data-slot": "date-range-picker-calendar",
|
|
6972
|
+
children: [
|
|
6973
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("header", { className: "ddga-calendar__header", children: [
|
|
6974
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6975
|
+
import_react_aria_components3.Button,
|
|
6976
|
+
{
|
|
6977
|
+
slot: "previous",
|
|
6978
|
+
className: "ddga-calendar__nav",
|
|
6979
|
+
"data-slot": "date-range-picker-calendar-prev",
|
|
6980
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PrevChevron, { "aria-hidden": "true" })
|
|
6981
|
+
}
|
|
6982
|
+
),
|
|
6983
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6984
|
+
CalendarNavHeader,
|
|
6985
|
+
{
|
|
6986
|
+
locale: ariaLocale,
|
|
6987
|
+
monthLabel: navLabels.month,
|
|
6988
|
+
yearLabel: navLabels.year
|
|
6989
|
+
}
|
|
6990
|
+
),
|
|
6991
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6992
|
+
import_react_aria_components3.Button,
|
|
6993
|
+
{
|
|
6994
|
+
slot: "next",
|
|
6995
|
+
className: "ddga-calendar__nav",
|
|
6996
|
+
"data-slot": "date-range-picker-calendar-next",
|
|
6997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(NextChevron, { "aria-hidden": "true" })
|
|
6998
|
+
}
|
|
6999
|
+
)
|
|
7000
|
+
] }),
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_aria_components3.CalendarGrid, { className: "ddga-calendar__grid", children: [
|
|
7002
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_aria_components3.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_aria_components3.CalendarHeaderCell, { className: "ddga-calendar__weekday", children: day }) }),
|
|
7003
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_aria_components3.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_aria_components3.CalendarCell, { date, className: "ddga-calendar__cell", children: ({ formattedDate }) => renderDayContent(formattedDate, {
|
|
7004
|
+
showSecondary: showSecondaryCalendar,
|
|
7005
|
+
date,
|
|
7006
|
+
calendarSystem
|
|
7007
|
+
}) }) })
|
|
7008
|
+
] })
|
|
7009
|
+
]
|
|
7010
|
+
}
|
|
7011
|
+
)
|
|
7012
|
+
]
|
|
7013
|
+
}
|
|
7014
|
+
)
|
|
7015
|
+
}
|
|
7016
|
+
)
|
|
7017
|
+
]
|
|
7018
|
+
}
|
|
7019
|
+
) });
|
|
7020
|
+
}
|
|
7021
|
+
|
|
7022
|
+
// src/components/AspectRatio/AspectRatio.tsx
|
|
7023
|
+
var import_radix_ui34 = require("radix-ui");
|
|
7024
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7025
|
+
function AspectRatio({ ratio = 1, asChild, className, style, ...props }) {
|
|
7026
|
+
const Comp = asChild ? import_radix_ui34.Slot.Slot : "div";
|
|
7027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
7028
|
+
Comp,
|
|
7029
|
+
{
|
|
7030
|
+
"data-slot": "aspect-ratio",
|
|
7031
|
+
className: cn("ddga-aspect-ratio", className),
|
|
7032
|
+
style: { "--ddga-aspect-ratio": ratio, ...style },
|
|
7033
|
+
...props
|
|
7034
|
+
}
|
|
7035
|
+
);
|
|
7036
|
+
}
|
|
7037
|
+
|
|
7038
|
+
// src/providers/DgaProvider.tsx
|
|
7039
|
+
var import_react37 = require("react");
|
|
7040
|
+
var import_radix_ui35 = require("radix-ui");
|
|
7041
|
+
var import_tokens = require("@dev-dga/tokens");
|
|
7042
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7043
|
+
function DgaProvider({
|
|
7044
|
+
dir = "ltr",
|
|
7045
|
+
locale,
|
|
7046
|
+
mode = "light",
|
|
7047
|
+
theme,
|
|
7048
|
+
as: Component = "div",
|
|
7049
|
+
className,
|
|
7050
|
+
style: consumerStyle,
|
|
7051
|
+
children
|
|
7052
|
+
}) {
|
|
7053
|
+
const parentCtx = (0, import_react37.useContext)(DgaContext);
|
|
7054
|
+
const isNested = parentCtx !== null;
|
|
7055
|
+
const [rootEl, setRootEl] = (0, import_react37.useState)(null);
|
|
7056
|
+
const portalRef = (0, import_react37.useRef)(null);
|
|
7057
|
+
const [portalEl, setPortalEl] = (0, import_react37.useState)(null);
|
|
7058
|
+
const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
|
|
7059
|
+
const themeVars = (0, import_react37.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
|
|
7060
|
+
(0, import_react37.useEffect)(() => {
|
|
7061
|
+
if (typeof document === "undefined") return;
|
|
7062
|
+
const el = document.createElement("div");
|
|
7063
|
+
el.setAttribute("data-slot", "dga-portal");
|
|
7064
|
+
el.style.position = "relative";
|
|
7065
|
+
el.style.zIndex = "50";
|
|
7066
|
+
document.body.appendChild(el);
|
|
7067
|
+
portalRef.current = el;
|
|
7068
|
+
setPortalEl(el);
|
|
7069
|
+
return () => {
|
|
7070
|
+
el.remove();
|
|
7071
|
+
portalRef.current = null;
|
|
7072
|
+
setPortalEl(null);
|
|
7073
|
+
};
|
|
7074
|
+
}, []);
|
|
7075
|
+
(0, import_react37.useEffect)(() => {
|
|
5488
7076
|
const el = portalRef.current;
|
|
5489
7077
|
if (!el) return;
|
|
5490
7078
|
el.setAttribute("data-theme", mode);
|
|
@@ -5496,12 +7084,12 @@ function DgaProvider({
|
|
|
5496
7084
|
}
|
|
5497
7085
|
}
|
|
5498
7086
|
}, [mode, dir, themeVars, portalEl]);
|
|
5499
|
-
const ctxValue = (0,
|
|
7087
|
+
const ctxValue = (0, import_react37.useMemo)(
|
|
5500
7088
|
() => ({ dir, locale: resolvedLocale, mode, rootEl, portalEl }),
|
|
5501
7089
|
[dir, resolvedLocale, mode, rootEl, portalEl]
|
|
5502
7090
|
);
|
|
5503
|
-
const inner = /* @__PURE__ */ (0,
|
|
5504
|
-
return /* @__PURE__ */ (0,
|
|
7091
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_radix_ui35.Direction.Provider, { dir, children });
|
|
7092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5505
7093
|
Component,
|
|
5506
7094
|
{
|
|
5507
7095
|
ref: setRootEl,
|
|
@@ -5511,7 +7099,7 @@ function DgaProvider({
|
|
|
5511
7099
|
"data-theme": mode,
|
|
5512
7100
|
className,
|
|
5513
7101
|
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
5514
|
-
children: isNested ? inner : /* @__PURE__ */ (0,
|
|
7102
|
+
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_radix_ui35.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
5515
7103
|
}
|
|
5516
7104
|
) });
|
|
5517
7105
|
}
|
|
@@ -5524,6 +7112,7 @@ function DgaProvider({
|
|
|
5524
7112
|
Alert,
|
|
5525
7113
|
AlertDescription,
|
|
5526
7114
|
AlertTitle,
|
|
7115
|
+
AspectRatio,
|
|
5527
7116
|
Avatar,
|
|
5528
7117
|
AvatarFallback,
|
|
5529
7118
|
AvatarGroup,
|
|
@@ -5546,11 +7135,23 @@ function DgaProvider({
|
|
|
5546
7135
|
CardTitle,
|
|
5547
7136
|
Checkbox,
|
|
5548
7137
|
CircularProgress,
|
|
7138
|
+
Collapsible,
|
|
7139
|
+
CollapsibleContent,
|
|
7140
|
+
CollapsibleTrigger,
|
|
5549
7141
|
Combobox,
|
|
5550
7142
|
ComboboxGroup,
|
|
5551
7143
|
ComboboxItem,
|
|
5552
7144
|
ComboboxSeparator,
|
|
7145
|
+
Command,
|
|
7146
|
+
CommandDialog,
|
|
7147
|
+
CommandEmpty,
|
|
7148
|
+
CommandGroup,
|
|
7149
|
+
CommandInput,
|
|
7150
|
+
CommandItem,
|
|
7151
|
+
CommandList,
|
|
7152
|
+
CommandSeparator,
|
|
5553
7153
|
DatePicker,
|
|
7154
|
+
DateRangePicker,
|
|
5554
7155
|
DescriptionDetails,
|
|
5555
7156
|
DescriptionItem,
|
|
5556
7157
|
DescriptionList,
|
|
@@ -5587,6 +7188,13 @@ function DgaProvider({
|
|
|
5587
7188
|
FieldMessage,
|
|
5588
7189
|
FileUpload,
|
|
5589
7190
|
Input,
|
|
7191
|
+
InputOTP,
|
|
7192
|
+
Link,
|
|
7193
|
+
List,
|
|
7194
|
+
ListItem,
|
|
7195
|
+
ListItemAction,
|
|
7196
|
+
ListItemContent,
|
|
7197
|
+
ListItemIcon,
|
|
5590
7198
|
Menubar,
|
|
5591
7199
|
MenubarCheckboxItem,
|
|
5592
7200
|
MenubarContent,
|
|
@@ -5623,10 +7231,16 @@ function DgaProvider({
|
|
|
5623
7231
|
PopoverContent,
|
|
5624
7232
|
PopoverTrigger,
|
|
5625
7233
|
Progress,
|
|
7234
|
+
Quote,
|
|
7235
|
+
QuoteAuthor,
|
|
7236
|
+
QuoteCaption,
|
|
7237
|
+
QuoteContent,
|
|
7238
|
+
QuoteSource,
|
|
5626
7239
|
Radio,
|
|
5627
7240
|
RadioGroup,
|
|
5628
7241
|
Rating,
|
|
5629
7242
|
ScrollArea,
|
|
7243
|
+
SearchBox,
|
|
5630
7244
|
Select,
|
|
5631
7245
|
SelectItem,
|
|
5632
7246
|
Sidebar,
|
|
@@ -5656,6 +7270,7 @@ function DgaProvider({
|
|
|
5656
7270
|
Spinner,
|
|
5657
7271
|
Stat,
|
|
5658
7272
|
StatChange,
|
|
7273
|
+
StatChart,
|
|
5659
7274
|
StatGroup,
|
|
5660
7275
|
StatLabel,
|
|
5661
7276
|
StatValue,
|
|
@@ -5665,10 +7280,19 @@ function DgaProvider({
|
|
|
5665
7280
|
StepTitle,
|
|
5666
7281
|
Steps,
|
|
5667
7282
|
Switch,
|
|
7283
|
+
Table,
|
|
7284
|
+
TableBody,
|
|
7285
|
+
TableCaption,
|
|
7286
|
+
TableCell,
|
|
7287
|
+
TableFooter,
|
|
7288
|
+
TableHead,
|
|
7289
|
+
TableHeader,
|
|
7290
|
+
TableRow,
|
|
5668
7291
|
Tabs,
|
|
5669
7292
|
TabsContent,
|
|
5670
7293
|
TabsList,
|
|
5671
7294
|
TabsTrigger,
|
|
7295
|
+
TagInput,
|
|
5672
7296
|
Textarea,
|
|
5673
7297
|
Timeline,
|
|
5674
7298
|
TimelineContent,
|
|
@@ -5696,15 +7320,21 @@ function DgaProvider({
|
|
|
5696
7320
|
cn,
|
|
5697
7321
|
comboboxTriggerVariants,
|
|
5698
7322
|
comboboxVariants,
|
|
7323
|
+
commandVariants,
|
|
5699
7324
|
createToast,
|
|
5700
7325
|
createToastStore,
|
|
5701
7326
|
datePickerVariants,
|
|
7327
|
+
dateRangePickerTriggerVariants,
|
|
7328
|
+
dateRangePickerVariants,
|
|
5702
7329
|
descriptionListVariants,
|
|
5703
7330
|
dividerVariants,
|
|
5704
7331
|
drawerVariants,
|
|
5705
7332
|
dropdownMenuVariants,
|
|
5706
7333
|
emptyStateVariants,
|
|
7334
|
+
inputOTPVariants,
|
|
5707
7335
|
inputVariants,
|
|
7336
|
+
linkVariants,
|
|
7337
|
+
listVariants,
|
|
5708
7338
|
menubarContentVariants,
|
|
5709
7339
|
menubarTriggerVariants,
|
|
5710
7340
|
modalContentVariants,
|
|
@@ -5713,6 +7343,7 @@ function DgaProvider({
|
|
|
5713
7343
|
paginationVariants,
|
|
5714
7344
|
popoverContentVariants,
|
|
5715
7345
|
progressVariants,
|
|
7346
|
+
quoteVariants,
|
|
5716
7347
|
radioGroupVariants,
|
|
5717
7348
|
radioVariants,
|
|
5718
7349
|
ratingVariants,
|
|
@@ -5728,8 +7359,10 @@ function DgaProvider({
|
|
|
5728
7359
|
stepVariants,
|
|
5729
7360
|
stepsVariants,
|
|
5730
7361
|
switchVariants,
|
|
7362
|
+
tableVariants,
|
|
5731
7363
|
tabsListVariants,
|
|
5732
7364
|
tabsVariants,
|
|
7365
|
+
tagInputVariants,
|
|
5733
7366
|
textareaVariants,
|
|
5734
7367
|
timelineMarkerVariants,
|
|
5735
7368
|
timelineVariants,
|