@dev-dga/react 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +5 -5
- package/dist/index.cjs +1364 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +403 -15
- package/dist/index.d.ts +403 -15
- package/dist/index.js +1356 -133
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -49,10 +49,21 @@ __export(src_exports, {
|
|
|
49
49
|
CardTitle: () => CardTitle,
|
|
50
50
|
Checkbox: () => Checkbox,
|
|
51
51
|
CircularProgress: () => CircularProgress,
|
|
52
|
+
Collapsible: () => Collapsible,
|
|
53
|
+
CollapsibleContent: () => CollapsibleContent,
|
|
54
|
+
CollapsibleTrigger: () => CollapsibleTrigger,
|
|
52
55
|
Combobox: () => Combobox,
|
|
53
56
|
ComboboxGroup: () => ComboboxGroup,
|
|
54
57
|
ComboboxItem: () => ComboboxItem,
|
|
55
58
|
ComboboxSeparator: () => ComboboxSeparator,
|
|
59
|
+
Command: () => Command2,
|
|
60
|
+
CommandDialog: () => CommandDialog,
|
|
61
|
+
CommandEmpty: () => CommandEmpty,
|
|
62
|
+
CommandGroup: () => CommandGroup,
|
|
63
|
+
CommandInput: () => CommandInput,
|
|
64
|
+
CommandItem: () => CommandItem,
|
|
65
|
+
CommandList: () => CommandList,
|
|
66
|
+
CommandSeparator: () => CommandSeparator,
|
|
56
67
|
DatePicker: () => DatePicker,
|
|
57
68
|
DescriptionDetails: () => DescriptionDetails,
|
|
58
69
|
DescriptionItem: () => DescriptionItem,
|
|
@@ -90,6 +101,13 @@ __export(src_exports, {
|
|
|
90
101
|
FieldMessage: () => FieldMessage,
|
|
91
102
|
FileUpload: () => FileUpload,
|
|
92
103
|
Input: () => Input,
|
|
104
|
+
InputOTP: () => InputOTP,
|
|
105
|
+
Link: () => Link,
|
|
106
|
+
List: () => List,
|
|
107
|
+
ListItem: () => ListItem,
|
|
108
|
+
ListItemAction: () => ListItemAction,
|
|
109
|
+
ListItemContent: () => ListItemContent,
|
|
110
|
+
ListItemIcon: () => ListItemIcon,
|
|
93
111
|
Menubar: () => Menubar,
|
|
94
112
|
MenubarCheckboxItem: () => MenubarCheckboxItem,
|
|
95
113
|
MenubarContent: () => MenubarContent,
|
|
@@ -126,10 +144,16 @@ __export(src_exports, {
|
|
|
126
144
|
PopoverContent: () => PopoverContent,
|
|
127
145
|
PopoverTrigger: () => PopoverTrigger,
|
|
128
146
|
Progress: () => Progress,
|
|
147
|
+
Quote: () => Quote,
|
|
148
|
+
QuoteAuthor: () => QuoteAuthor,
|
|
149
|
+
QuoteCaption: () => QuoteCaption,
|
|
150
|
+
QuoteContent: () => QuoteContent,
|
|
151
|
+
QuoteSource: () => QuoteSource,
|
|
129
152
|
Radio: () => Radio,
|
|
130
153
|
RadioGroup: () => RadioGroup,
|
|
131
154
|
Rating: () => Rating,
|
|
132
155
|
ScrollArea: () => ScrollArea,
|
|
156
|
+
SearchBox: () => SearchBox,
|
|
133
157
|
Select: () => Select,
|
|
134
158
|
SelectItem: () => SelectItem,
|
|
135
159
|
Sidebar: () => Sidebar,
|
|
@@ -159,6 +183,7 @@ __export(src_exports, {
|
|
|
159
183
|
Spinner: () => Spinner,
|
|
160
184
|
Stat: () => Stat,
|
|
161
185
|
StatChange: () => StatChange,
|
|
186
|
+
StatChart: () => StatChart,
|
|
162
187
|
StatGroup: () => StatGroup,
|
|
163
188
|
StatLabel: () => StatLabel,
|
|
164
189
|
StatValue: () => StatValue,
|
|
@@ -168,10 +193,19 @@ __export(src_exports, {
|
|
|
168
193
|
StepTitle: () => StepTitle,
|
|
169
194
|
Steps: () => Steps,
|
|
170
195
|
Switch: () => Switch,
|
|
196
|
+
Table: () => Table,
|
|
197
|
+
TableBody: () => TableBody,
|
|
198
|
+
TableCaption: () => TableCaption,
|
|
199
|
+
TableCell: () => TableCell,
|
|
200
|
+
TableFooter: () => TableFooter,
|
|
201
|
+
TableHead: () => TableHead,
|
|
202
|
+
TableHeader: () => TableHeader,
|
|
203
|
+
TableRow: () => TableRow,
|
|
171
204
|
Tabs: () => Tabs,
|
|
172
205
|
TabsContent: () => TabsContent,
|
|
173
206
|
TabsList: () => TabsList,
|
|
174
207
|
TabsTrigger: () => TabsTrigger,
|
|
208
|
+
TagInput: () => TagInput,
|
|
175
209
|
Textarea: () => Textarea,
|
|
176
210
|
Timeline: () => Timeline,
|
|
177
211
|
TimelineContent: () => TimelineContent,
|
|
@@ -199,6 +233,7 @@ __export(src_exports, {
|
|
|
199
233
|
cn: () => cn,
|
|
200
234
|
comboboxTriggerVariants: () => comboboxTriggerVariants,
|
|
201
235
|
comboboxVariants: () => comboboxVariants,
|
|
236
|
+
commandVariants: () => commandVariants,
|
|
202
237
|
createToast: () => createToast,
|
|
203
238
|
createToastStore: () => createToastStore,
|
|
204
239
|
datePickerVariants: () => datePickerVariants,
|
|
@@ -207,7 +242,10 @@ __export(src_exports, {
|
|
|
207
242
|
drawerVariants: () => drawerVariants,
|
|
208
243
|
dropdownMenuVariants: () => dropdownMenuVariants,
|
|
209
244
|
emptyStateVariants: () => emptyStateVariants,
|
|
245
|
+
inputOTPVariants: () => inputOTPVariants,
|
|
210
246
|
inputVariants: () => inputVariants,
|
|
247
|
+
linkVariants: () => linkVariants,
|
|
248
|
+
listVariants: () => listVariants,
|
|
211
249
|
menubarContentVariants: () => menubarContentVariants,
|
|
212
250
|
menubarTriggerVariants: () => menubarTriggerVariants,
|
|
213
251
|
modalContentVariants: () => modalContentVariants,
|
|
@@ -216,6 +254,7 @@ __export(src_exports, {
|
|
|
216
254
|
paginationVariants: () => paginationVariants,
|
|
217
255
|
popoverContentVariants: () => popoverContentVariants,
|
|
218
256
|
progressVariants: () => progressVariants,
|
|
257
|
+
quoteVariants: () => quoteVariants,
|
|
219
258
|
radioGroupVariants: () => radioGroupVariants,
|
|
220
259
|
radioVariants: () => radioVariants,
|
|
221
260
|
ratingVariants: () => ratingVariants,
|
|
@@ -231,8 +270,10 @@ __export(src_exports, {
|
|
|
231
270
|
stepVariants: () => stepVariants,
|
|
232
271
|
stepsVariants: () => stepsVariants,
|
|
233
272
|
switchVariants: () => switchVariants,
|
|
273
|
+
tableVariants: () => tableVariants,
|
|
234
274
|
tabsListVariants: () => tabsListVariants,
|
|
235
275
|
tabsVariants: () => tabsVariants,
|
|
276
|
+
tagInputVariants: () => tagInputVariants,
|
|
236
277
|
textareaVariants: () => textareaVariants,
|
|
237
278
|
timelineMarkerVariants: () => timelineMarkerVariants,
|
|
238
279
|
timelineVariants: () => timelineVariants,
|
|
@@ -333,6 +374,16 @@ var buttonVariants = (0, import_class_variance_authority2.cva)("ddga-button", {
|
|
|
333
374
|
*/
|
|
334
375
|
inverted: {
|
|
335
376
|
true: "ddga-button--inverted"
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* Floating action button: fully-rounded + elevated. Orthogonal to `variant`
|
|
380
|
+
* (color) and `size` — pair with `size="icon"` for a circular FAB, or a text
|
|
381
|
+
* size for an extended pill FAB. Positioning (`position: fixed`, safe-area
|
|
382
|
+
* insets) is the consumer's responsibility — see the placement recipe in the
|
|
383
|
+
* stories. Keep it a modifier, not a `Fab` wrapper component.
|
|
384
|
+
*/
|
|
385
|
+
fab: {
|
|
386
|
+
true: "ddga-button--fab"
|
|
336
387
|
}
|
|
337
388
|
},
|
|
338
389
|
compoundVariants: [],
|
|
@@ -346,6 +397,7 @@ function Button({
|
|
|
346
397
|
size,
|
|
347
398
|
fullWidth,
|
|
348
399
|
inverted,
|
|
400
|
+
fab,
|
|
349
401
|
loading,
|
|
350
402
|
disabled,
|
|
351
403
|
startIcon,
|
|
@@ -375,7 +427,7 @@ function Button({
|
|
|
375
427
|
"aria-busy": loading || void 0,
|
|
376
428
|
"data-slot": "button",
|
|
377
429
|
className: cn(
|
|
378
|
-
buttonVariants({ variant, size, fullWidth, inverted }),
|
|
430
|
+
buttonVariants({ variant, size, fullWidth, inverted, fab }),
|
|
379
431
|
loading && "ddga-button--loading",
|
|
380
432
|
className
|
|
381
433
|
),
|
|
@@ -957,6 +1009,43 @@ function CaretDown(props) {
|
|
|
957
1009
|
}
|
|
958
1010
|
);
|
|
959
1011
|
}
|
|
1012
|
+
function ExternalLink(props) {
|
|
1013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1014
|
+
"svg",
|
|
1015
|
+
{
|
|
1016
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1017
|
+
width: "1em",
|
|
1018
|
+
height: "1em",
|
|
1019
|
+
viewBox: "0 0 24 24",
|
|
1020
|
+
fill: "none",
|
|
1021
|
+
stroke: "currentColor",
|
|
1022
|
+
strokeWidth: "2",
|
|
1023
|
+
strokeLinecap: "round",
|
|
1024
|
+
strokeLinejoin: "round",
|
|
1025
|
+
...props,
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M15 3h6v6" }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M10 14 21 3" }),
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
1030
|
+
]
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
function QuoteMark(props) {
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1036
|
+
"svg",
|
|
1037
|
+
{
|
|
1038
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1039
|
+
width: "1em",
|
|
1040
|
+
height: "1em",
|
|
1041
|
+
viewBox: "0 0 24 24",
|
|
1042
|
+
fill: "currentColor",
|
|
1043
|
+
stroke: "none",
|
|
1044
|
+
...props,
|
|
1045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M7 7C4.8 7 3 8.8 3 11s1.8 4 4 4c.2 0 .4 0 .6-.1C7.2 16.4 6 17.5 4.2 17.7L4 17.7V20c3.6-.3 6-3.2 6-7v-1.2C10 8.7 8.4 7 7 7zM18 7c-2.2 0-4 1.8-4 4s1.8 4 4 4c.2 0 .4 0 .6-.1-.4 1.5-1.6 2.6-3.4 2.8l-.2 0V20c3.6-.3 6-3.2 6-7v-1.2C21 8.7 19.4 7 18 7z" })
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
960
1049
|
function PanelLeft(props) {
|
|
961
1050
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
962
1051
|
"svg",
|
|
@@ -2093,6 +2182,7 @@ function ToastItem({ toast: t, store, closeButton, closeLabel, hideIcon }) {
|
|
|
2093
2182
|
}
|
|
2094
2183
|
|
|
2095
2184
|
// src/components/Tabs/Tabs.tsx
|
|
2185
|
+
var import_react13 = require("react");
|
|
2096
2186
|
var import_radix_ui13 = require("radix-ui");
|
|
2097
2187
|
var import_class_variance_authority17 = require("class-variance-authority");
|
|
2098
2188
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -2139,13 +2229,49 @@ function TabsList({ fullWidth, className, ...props }) {
|
|
|
2139
2229
|
}
|
|
2140
2230
|
);
|
|
2141
2231
|
}
|
|
2142
|
-
function TabsTrigger({
|
|
2232
|
+
function TabsTrigger({
|
|
2233
|
+
className,
|
|
2234
|
+
startIcon,
|
|
2235
|
+
endIcon,
|
|
2236
|
+
children,
|
|
2237
|
+
asChild,
|
|
2238
|
+
...props
|
|
2239
|
+
}) {
|
|
2240
|
+
const hasIcon = startIcon != null || endIcon != null;
|
|
2241
|
+
const hasText = children != null && children !== "" && typeof children !== "boolean";
|
|
2242
|
+
const isIconOnly = !asChild && hasIcon && !hasText;
|
|
2243
|
+
if (process.env.NODE_ENV === "development") {
|
|
2244
|
+
if (isIconOnly && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
2245
|
+
console.warn(
|
|
2246
|
+
"[@dev-dga/react] An icon-only TabsTrigger (icon with no text label) requires an aria-label or aria-labelledby for screen reader accessibility."
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
if (asChild && hasIcon) {
|
|
2250
|
+
console.warn(
|
|
2251
|
+
"[@dev-dga/react] TabsTrigger `startIcon`/`endIcon` are ignored when `asChild` is set \u2014 render the icons inside your child element instead."
|
|
2252
|
+
);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2143
2255
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2144
2256
|
import_radix_ui13.Tabs.Trigger,
|
|
2145
2257
|
{
|
|
2146
2258
|
"data-slot": "tabs-trigger",
|
|
2147
|
-
|
|
2148
|
-
|
|
2259
|
+
asChild,
|
|
2260
|
+
className: cn("ddga-tabs__trigger", isIconOnly && "ddga-tabs__trigger--icon-only", className),
|
|
2261
|
+
...props,
|
|
2262
|
+
children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2263
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2264
|
+
"span",
|
|
2265
|
+
{
|
|
2266
|
+
className: "ddga-tabs__icon",
|
|
2267
|
+
"data-slot": "tabs-trigger-start-icon",
|
|
2268
|
+
"aria-hidden": "true",
|
|
2269
|
+
children: startIcon
|
|
2270
|
+
}
|
|
2271
|
+
),
|
|
2272
|
+
children,
|
|
2273
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ddga-tabs__icon", "data-slot": "tabs-trigger-end-icon", "aria-hidden": "true", children: endIcon })
|
|
2274
|
+
] })
|
|
2149
2275
|
}
|
|
2150
2276
|
);
|
|
2151
2277
|
}
|
|
@@ -2615,30 +2741,60 @@ function Progress({ value = null, max = 100, size, color, className, ...props })
|
|
|
2615
2741
|
}
|
|
2616
2742
|
var CIRCULAR_SIZES = { sm: 32, md: 48, lg: 72 };
|
|
2617
2743
|
var CIRCULAR_DEFAULT_THICKNESS = { sm: 4, md: 5, lg: 6 };
|
|
2744
|
+
var SEGMENT_GAP_FRACTION = 0.16;
|
|
2618
2745
|
function CircularProgress({
|
|
2619
2746
|
value = null,
|
|
2620
2747
|
max = 100,
|
|
2621
2748
|
size,
|
|
2622
2749
|
color,
|
|
2623
2750
|
thickness,
|
|
2751
|
+
segments,
|
|
2624
2752
|
showLabel = false,
|
|
2625
2753
|
className,
|
|
2626
2754
|
...props
|
|
2627
2755
|
}) {
|
|
2628
2756
|
const isIndeterminate = value === null;
|
|
2757
|
+
const isSegmented = typeof segments === "number" && segments >= 2;
|
|
2629
2758
|
const sizeKey = size ?? "md";
|
|
2630
2759
|
const diameter = CIRCULAR_SIZES[sizeKey];
|
|
2631
2760
|
const strokeWidth = thickness ?? CIRCULAR_DEFAULT_THICKNESS[sizeKey];
|
|
2632
2761
|
const radius = (diameter - strokeWidth) / 2;
|
|
2633
2762
|
const circumference = 2 * Math.PI * radius;
|
|
2763
|
+
const center = diameter / 2;
|
|
2634
2764
|
const pct = isIndeterminate ? 0 : Math.min(100, Math.max(0, value / max * 100));
|
|
2635
2765
|
const dashOffset = isIndeterminate ? circumference * 0.75 : circumference * (1 - pct / 100);
|
|
2636
2766
|
const state = isIndeterminate ? "indeterminate" : value >= max ? "complete" : "loading";
|
|
2767
|
+
const segmentEls = isSegmented && segments ? (() => {
|
|
2768
|
+
const filled = isIndeterminate ? 0 : Math.round(pct / 100 * segments);
|
|
2769
|
+
const segAngle = 360 / segments;
|
|
2770
|
+
const gapAngle = segAngle * SEGMENT_GAP_FRACTION;
|
|
2771
|
+
const segLen = circumference * ((1 - SEGMENT_GAP_FRACTION) / segments);
|
|
2772
|
+
return Array.from({ length: segments }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2773
|
+
"circle",
|
|
2774
|
+
{
|
|
2775
|
+
className: cn(
|
|
2776
|
+
"ddga-circular-progress__segment",
|
|
2777
|
+
i < filled && "ddga-circular-progress__segment--filled"
|
|
2778
|
+
),
|
|
2779
|
+
cx: center,
|
|
2780
|
+
cy: center,
|
|
2781
|
+
r: radius,
|
|
2782
|
+
fill: "none",
|
|
2783
|
+
strokeWidth,
|
|
2784
|
+
strokeLinecap: "butt",
|
|
2785
|
+
strokeDasharray: `${segLen} ${circumference}`,
|
|
2786
|
+
transform: `rotate(${-90 + i * segAngle + gapAngle / 2} ${center} ${center})`
|
|
2787
|
+
},
|
|
2788
|
+
i
|
|
2789
|
+
));
|
|
2790
|
+
})() : null;
|
|
2791
|
+
const labelText = isSegmented ? `${segments ? Math.round(pct / 100 * segments) : 0}/${segments}` : `${Math.round(pct)}%`;
|
|
2637
2792
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2638
2793
|
"div",
|
|
2639
2794
|
{
|
|
2640
2795
|
"data-slot": "circular-progress",
|
|
2641
2796
|
"data-state": state,
|
|
2797
|
+
"data-segmented": isSegmented ? "" : void 0,
|
|
2642
2798
|
role: "progressbar",
|
|
2643
2799
|
"aria-valuemin": 0,
|
|
2644
2800
|
"aria-valuemax": max,
|
|
@@ -2647,7 +2803,7 @@ function CircularProgress({
|
|
|
2647
2803
|
style: { inlineSize: diameter, blockSize: diameter },
|
|
2648
2804
|
...props,
|
|
2649
2805
|
children: [
|
|
2650
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2651
2807
|
"svg",
|
|
2652
2808
|
{
|
|
2653
2809
|
className: "ddga-circular-progress__svg",
|
|
@@ -2656,13 +2812,13 @@ function CircularProgress({
|
|
|
2656
2812
|
height: diameter,
|
|
2657
2813
|
"aria-hidden": "true",
|
|
2658
2814
|
focusable: "false",
|
|
2659
|
-
children: [
|
|
2815
|
+
children: isSegmented ? segmentEls : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2660
2816
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2661
2817
|
"circle",
|
|
2662
2818
|
{
|
|
2663
2819
|
className: "ddga-circular-progress__track",
|
|
2664
|
-
cx:
|
|
2665
|
-
cy:
|
|
2820
|
+
cx: center,
|
|
2821
|
+
cy: center,
|
|
2666
2822
|
r: radius,
|
|
2667
2823
|
fill: "none",
|
|
2668
2824
|
strokeWidth
|
|
@@ -2672,31 +2828,28 @@ function CircularProgress({
|
|
|
2672
2828
|
"circle",
|
|
2673
2829
|
{
|
|
2674
2830
|
className: "ddga-circular-progress__indicator",
|
|
2675
|
-
cx:
|
|
2676
|
-
cy:
|
|
2831
|
+
cx: center,
|
|
2832
|
+
cy: center,
|
|
2677
2833
|
r: radius,
|
|
2678
2834
|
fill: "none",
|
|
2679
2835
|
strokeWidth,
|
|
2680
2836
|
strokeLinecap: "round",
|
|
2681
2837
|
strokeDasharray: circumference,
|
|
2682
2838
|
strokeDashoffset: dashOffset,
|
|
2683
|
-
transform: `rotate(-90 ${
|
|
2839
|
+
transform: `rotate(-90 ${center} ${center})`
|
|
2684
2840
|
}
|
|
2685
2841
|
)
|
|
2686
|
-
]
|
|
2842
|
+
] })
|
|
2687
2843
|
}
|
|
2688
2844
|
),
|
|
2689
|
-
showLabel && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2690
|
-
Math.round(pct),
|
|
2691
|
-
"%"
|
|
2692
|
-
] }) : null
|
|
2845
|
+
showLabel && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ddga-circular-progress__label", "aria-hidden": "true", children: labelText }) : null
|
|
2693
2846
|
]
|
|
2694
2847
|
}
|
|
2695
2848
|
);
|
|
2696
2849
|
}
|
|
2697
2850
|
|
|
2698
2851
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
2699
|
-
var
|
|
2852
|
+
var import_react14 = require("react");
|
|
2700
2853
|
var import_radix_ui18 = require("radix-ui");
|
|
2701
2854
|
var import_class_variance_authority24 = require("class-variance-authority");
|
|
2702
2855
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -2723,7 +2876,7 @@ function DropdownMenuContent({
|
|
|
2723
2876
|
sideOffset = 6,
|
|
2724
2877
|
...props
|
|
2725
2878
|
}) {
|
|
2726
|
-
const ctx = (0,
|
|
2879
|
+
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2727
2880
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2728
2881
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2729
2882
|
import_radix_ui18.DropdownMenu.Content,
|
|
@@ -2854,7 +3007,7 @@ function DropdownMenuSubTrigger({
|
|
|
2854
3007
|
);
|
|
2855
3008
|
}
|
|
2856
3009
|
function DropdownMenuSubContent({ size, className, ...props }) {
|
|
2857
|
-
const ctx = (0,
|
|
3010
|
+
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2858
3011
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2859
3012
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2860
3013
|
import_radix_ui18.DropdownMenu.SubContent,
|
|
@@ -2867,7 +3020,7 @@ function DropdownMenuSubContent({ size, className, ...props }) {
|
|
|
2867
3020
|
}
|
|
2868
3021
|
|
|
2869
3022
|
// src/components/Drawer/Drawer.tsx
|
|
2870
|
-
var
|
|
3023
|
+
var import_react15 = require("react");
|
|
2871
3024
|
var import_radix_ui19 = require("radix-ui");
|
|
2872
3025
|
var import_class_variance_authority25 = require("class-variance-authority");
|
|
2873
3026
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -2906,7 +3059,7 @@ function DrawerContent({
|
|
|
2906
3059
|
children,
|
|
2907
3060
|
...props
|
|
2908
3061
|
}) {
|
|
2909
|
-
const ctx = (0,
|
|
3062
|
+
const ctx = (0, import_react15.useContext)(DgaContext);
|
|
2910
3063
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2911
3064
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_radix_ui19.Dialog.Portal, { container: portalContainer, children: [
|
|
2912
3065
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_radix_ui19.Dialog.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
|
|
@@ -2971,7 +3124,7 @@ function DrawerClose({ className, ...props }) {
|
|
|
2971
3124
|
}
|
|
2972
3125
|
|
|
2973
3126
|
// src/components/Combobox/Combobox.tsx
|
|
2974
|
-
var
|
|
3127
|
+
var import_react16 = require("react");
|
|
2975
3128
|
var import_cmdk = require("cmdk");
|
|
2976
3129
|
var import_radix_ui20 = require("radix-ui");
|
|
2977
3130
|
var import_class_variance_authority26 = require("class-variance-authority");
|
|
@@ -2991,9 +3144,9 @@ var comboboxTriggerVariants = (0, import_class_variance_authority26.cva)("ddga-c
|
|
|
2991
3144
|
}
|
|
2992
3145
|
});
|
|
2993
3146
|
var comboboxVariants = comboboxTriggerVariants;
|
|
2994
|
-
var ComboboxContext = (0,
|
|
3147
|
+
var ComboboxContext = (0, import_react16.createContext)(null);
|
|
2995
3148
|
function useComboboxContext(component) {
|
|
2996
|
-
const ctx = (0,
|
|
3149
|
+
const ctx = (0, import_react16.useContext)(ComboboxContext);
|
|
2997
3150
|
if (!ctx) {
|
|
2998
3151
|
throw new Error(`<${component}> must be rendered inside <Combobox>.`);
|
|
2999
3152
|
}
|
|
@@ -3023,20 +3176,20 @@ function Combobox({
|
|
|
3023
3176
|
"aria-label": ariaLabel,
|
|
3024
3177
|
"aria-labelledby": ariaLabelledBy
|
|
3025
3178
|
}) {
|
|
3026
|
-
const [internalValue, setInternalValue] = (0,
|
|
3179
|
+
const [internalValue, setInternalValue] = (0, import_react16.useState)(defaultValue);
|
|
3027
3180
|
const isControlled = controlledValue !== void 0;
|
|
3028
3181
|
const value = isControlled ? controlledValue : internalValue;
|
|
3029
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
3182
|
+
const [internalOpen, setInternalOpen] = (0, import_react16.useState)(defaultOpen ?? false);
|
|
3030
3183
|
const isOpenControlled = controlledOpen !== void 0;
|
|
3031
3184
|
const open = isOpenControlled ? controlledOpen : internalOpen;
|
|
3032
|
-
const setOpen = (0,
|
|
3185
|
+
const setOpen = (0, import_react16.useCallback)(
|
|
3033
3186
|
(next) => {
|
|
3034
3187
|
if (!isOpenControlled) setInternalOpen(next);
|
|
3035
3188
|
onOpenChange?.(next);
|
|
3036
3189
|
},
|
|
3037
3190
|
[isOpenControlled, onOpenChange]
|
|
3038
3191
|
);
|
|
3039
|
-
const select = (0,
|
|
3192
|
+
const select = (0, import_react16.useCallback)(
|
|
3040
3193
|
(next) => {
|
|
3041
3194
|
if (!isControlled) setInternalValue(next);
|
|
3042
3195
|
onValueChange?.(next);
|
|
@@ -3044,12 +3197,12 @@ function Combobox({
|
|
|
3044
3197
|
},
|
|
3045
3198
|
[isControlled, onValueChange, setOpen]
|
|
3046
3199
|
);
|
|
3047
|
-
const ctx = (0,
|
|
3048
|
-
const itemLabels = (0,
|
|
3200
|
+
const ctx = (0, import_react16.useMemo)(() => ({ value, select }), [value, select]);
|
|
3201
|
+
const itemLabels = (0, import_react16.useMemo)(() => {
|
|
3049
3202
|
const map = /* @__PURE__ */ new Map();
|
|
3050
3203
|
const visit = (nodes) => {
|
|
3051
|
-
|
|
3052
|
-
if (!(0,
|
|
3204
|
+
import_react16.Children.forEach(nodes, (child) => {
|
|
3205
|
+
if (!(0, import_react16.isValidElement)(child)) return;
|
|
3053
3206
|
const childProps = child.props;
|
|
3054
3207
|
if (typeof childProps.value === "string") {
|
|
3055
3208
|
map.set(childProps.value, childProps.children);
|
|
@@ -3071,14 +3224,14 @@ function Combobox({
|
|
|
3071
3224
|
"aria-label": ariaLabel,
|
|
3072
3225
|
"aria-labelledby": ariaLabelledBy
|
|
3073
3226
|
});
|
|
3074
|
-
const providerCtx = (0,
|
|
3227
|
+
const providerCtx = (0, import_react16.useContext)(DgaContext);
|
|
3075
3228
|
const portalContainer = providerCtx?.portalEl ?? providerCtx?.rootEl ?? void 0;
|
|
3076
|
-
const triggerLabel = (0,
|
|
3229
|
+
const triggerLabel = (0, import_react16.useMemo)(() => {
|
|
3077
3230
|
if (value === void 0) return null;
|
|
3078
3231
|
if (getLabel) return getLabel(value);
|
|
3079
3232
|
return itemLabels.get(value) ?? null;
|
|
3080
3233
|
}, [value, getLabel, itemLabels]);
|
|
3081
|
-
const searchId = (0,
|
|
3234
|
+
const searchId = (0, import_react16.useId)();
|
|
3082
3235
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComboboxContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { "data-slot": "combobox-field", className: "ddga-field", children: [
|
|
3083
3236
|
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { htmlFor: fieldId, className: "ddga-combobox__label", children: [
|
|
3084
3237
|
label,
|
|
@@ -3198,7 +3351,7 @@ function ComboboxSeparator({ className, ...props }) {
|
|
|
3198
3351
|
}
|
|
3199
3352
|
|
|
3200
3353
|
// src/components/DatePicker/DatePicker.tsx
|
|
3201
|
-
var
|
|
3354
|
+
var import_react17 = require("react");
|
|
3202
3355
|
var import_react_aria_components = require("react-aria-components");
|
|
3203
3356
|
var import_date = require("@internationalized/date");
|
|
3204
3357
|
var import_class_variance_authority27 = require("class-variance-authority");
|
|
@@ -3242,13 +3395,13 @@ function secondaryDayNumber(date, mainCalendar) {
|
|
|
3242
3395
|
return (0, import_date.toCalendar)(date, other).day;
|
|
3243
3396
|
}
|
|
3244
3397
|
function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
3245
|
-
const state = (0,
|
|
3398
|
+
const state = (0, import_react17.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3246
3399
|
const focusedDate = state?.focusedDate ?? null;
|
|
3247
3400
|
const focusedYear = focusedDate?.year ?? 0;
|
|
3248
3401
|
const focusedCalendar = focusedDate?.calendar ?? GREGORIAN;
|
|
3249
3402
|
const minValue = state?.minValue ?? null;
|
|
3250
3403
|
const maxValue = state?.maxValue ?? null;
|
|
3251
|
-
const monthNames = (0,
|
|
3404
|
+
const monthNames = (0, import_react17.useMemo)(() => {
|
|
3252
3405
|
if (!focusedDate) return [];
|
|
3253
3406
|
const fmt = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
3254
3407
|
return Array.from({ length: 12 }, (_, i) => {
|
|
@@ -3258,7 +3411,7 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3258
3411
|
return fmt.format(js);
|
|
3259
3412
|
});
|
|
3260
3413
|
}, [locale, focusedDate, focusedCalendar, focusedYear]);
|
|
3261
|
-
const yearOptions = (0,
|
|
3414
|
+
const yearOptions = (0, import_react17.useMemo)(() => {
|
|
3262
3415
|
if (!focusedDate) return [];
|
|
3263
3416
|
const minY = minValue ? (0, import_date.toCalendar)(minValue, focusedCalendar).year : focusedYear - 100;
|
|
3264
3417
|
const maxY = maxValue ? (0, import_date.toCalendar)(maxValue, focusedCalendar).year : focusedYear + 30;
|
|
@@ -3293,7 +3446,7 @@ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
|
3293
3446
|
] });
|
|
3294
3447
|
}
|
|
3295
3448
|
function CalendarDayCell({ date, showSecondary, calendarSystem }) {
|
|
3296
|
-
const state = (0,
|
|
3449
|
+
const state = (0, import_react17.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3297
3450
|
const start = state?.visibleRange.start;
|
|
3298
3451
|
const isOutside = !!start && (date.year !== start.year || date.month !== start.month);
|
|
3299
3452
|
const isOutOfBounds = state ? state.isInvalid(date) : false;
|
|
@@ -3351,11 +3504,11 @@ function DatePicker({
|
|
|
3351
3504
|
showSecondaryCalendar = false
|
|
3352
3505
|
}) {
|
|
3353
3506
|
const isValueControlled = controlledValue !== void 0;
|
|
3354
|
-
const [internalValue, setInternalValue] = (0,
|
|
3507
|
+
const [internalValue, setInternalValue] = (0, import_react17.useState)(
|
|
3355
3508
|
() => dateToCalendarDate(defaultValue)
|
|
3356
3509
|
);
|
|
3357
3510
|
const value = isValueControlled ? dateToCalendarDate(controlledValue) : internalValue;
|
|
3358
|
-
const handleAriaChange = (0,
|
|
3511
|
+
const handleAriaChange = (0, import_react17.useCallback)(
|
|
3359
3512
|
(next) => {
|
|
3360
3513
|
const nextCD = next ? new import_date.CalendarDate(next.year, next.month, next.day) : null;
|
|
3361
3514
|
if (!isValueControlled) setInternalValue(nextCD);
|
|
@@ -3364,18 +3517,18 @@ function DatePicker({
|
|
|
3364
3517
|
[isValueControlled, onChange]
|
|
3365
3518
|
);
|
|
3366
3519
|
const isCalendarControlled = controlledCalendar !== void 0;
|
|
3367
|
-
const [internalCalendar, setInternalCalendar] = (0,
|
|
3520
|
+
const [internalCalendar, setInternalCalendar] = (0, import_react17.useState)(defaultCalendar);
|
|
3368
3521
|
const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
|
|
3369
|
-
const setCalendar = (0,
|
|
3522
|
+
const setCalendar = (0, import_react17.useCallback)(
|
|
3370
3523
|
(next) => {
|
|
3371
3524
|
if (!isCalendarControlled) setInternalCalendar(next);
|
|
3372
3525
|
onCalendarChange?.(next);
|
|
3373
3526
|
},
|
|
3374
3527
|
[isCalendarControlled, onCalendarChange]
|
|
3375
3528
|
);
|
|
3376
|
-
const dgaCtx = (0,
|
|
3529
|
+
const dgaCtx = (0, import_react17.useContext)(DgaContext);
|
|
3377
3530
|
const dgaLocale = dgaCtx?.locale ?? "en";
|
|
3378
|
-
const ariaLocale = (0,
|
|
3531
|
+
const ariaLocale = (0, import_react17.useMemo)(
|
|
3379
3532
|
() => composeLocale(dgaLocale, calendarSystem),
|
|
3380
3533
|
[dgaLocale, calendarSystem]
|
|
3381
3534
|
);
|
|
@@ -3383,17 +3536,17 @@ function DatePicker({
|
|
|
3383
3536
|
const dgaDir = dgaCtx?.dir ?? "ltr";
|
|
3384
3537
|
const PrevChevron = dgaDir === "rtl" ? ChevronRight : ChevronLeft;
|
|
3385
3538
|
const NextChevron = dgaDir === "rtl" ? ChevronLeft : ChevronRight;
|
|
3386
|
-
const resolvedLabels = (0,
|
|
3539
|
+
const resolvedLabels = (0, import_react17.useMemo)(() => {
|
|
3387
3540
|
if (calendarLabels) return calendarLabels;
|
|
3388
3541
|
const isArabic = dgaLocale.startsWith("ar");
|
|
3389
3542
|
return isArabic ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
|
|
3390
3543
|
}, [calendarLabels, dgaLocale]);
|
|
3391
|
-
const navLabels = (0,
|
|
3544
|
+
const navLabels = (0, import_react17.useMemo)(
|
|
3392
3545
|
() => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
|
|
3393
3546
|
[dgaLocale]
|
|
3394
3547
|
);
|
|
3395
|
-
const ariaMinValue = (0,
|
|
3396
|
-
const ariaMaxValue = (0,
|
|
3548
|
+
const ariaMinValue = (0, import_react17.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
|
|
3549
|
+
const ariaMaxValue = (0, import_react17.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
|
|
3397
3550
|
const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : "Date");
|
|
3398
3551
|
const showToggle = showCalendarToggle && !isCalendarControlled;
|
|
3399
3552
|
const hasError = !!error;
|
|
@@ -3566,7 +3719,7 @@ function DatePicker({
|
|
|
3566
3719
|
}
|
|
3567
3720
|
|
|
3568
3721
|
// src/components/FileUpload/FileUpload.tsx
|
|
3569
|
-
var
|
|
3722
|
+
var import_react18 = require("react");
|
|
3570
3723
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3571
3724
|
function matchesAccept(file, accept) {
|
|
3572
3725
|
if (!accept) return true;
|
|
@@ -3628,8 +3781,8 @@ function FileUpload({
|
|
|
3628
3781
|
className,
|
|
3629
3782
|
...props
|
|
3630
3783
|
}) {
|
|
3631
|
-
const inputRef = (0,
|
|
3632
|
-
const [isDragging, setIsDragging] = (0,
|
|
3784
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
3785
|
+
const [isDragging, setIsDragging] = (0, import_react18.useState)(false);
|
|
3633
3786
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3634
3787
|
name: "FileUpload",
|
|
3635
3788
|
id: externalId,
|
|
@@ -3764,7 +3917,7 @@ function FileUpload({
|
|
|
3764
3917
|
}
|
|
3765
3918
|
|
|
3766
3919
|
// src/components/Slider/Slider.tsx
|
|
3767
|
-
var
|
|
3920
|
+
var import_react19 = require("react");
|
|
3768
3921
|
var import_radix_ui21 = require("radix-ui");
|
|
3769
3922
|
var import_class_variance_authority28 = require("class-variance-authority");
|
|
3770
3923
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -3806,7 +3959,7 @@ function Slider({
|
|
|
3806
3959
|
className,
|
|
3807
3960
|
...props
|
|
3808
3961
|
}) {
|
|
3809
|
-
const labelId = (0,
|
|
3962
|
+
const labelId = (0, import_react19.useId)();
|
|
3810
3963
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3811
3964
|
name: "Slider",
|
|
3812
3965
|
id: externalId,
|
|
@@ -3865,7 +4018,7 @@ function Slider({
|
|
|
3865
4018
|
}
|
|
3866
4019
|
|
|
3867
4020
|
// src/components/NumberInput/NumberInput.tsx
|
|
3868
|
-
var
|
|
4021
|
+
var import_react20 = require("react");
|
|
3869
4022
|
var import_class_variance_authority29 = require("class-variance-authority");
|
|
3870
4023
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3871
4024
|
var numberInputVariants = (0, import_class_variance_authority29.cva)("ddga-number-input", {
|
|
@@ -3917,9 +4070,9 @@ function NumberInput({
|
|
|
3917
4070
|
...props
|
|
3918
4071
|
}) {
|
|
3919
4072
|
const isControlled = value !== void 0;
|
|
3920
|
-
const [internal, setInternal] = (0,
|
|
4073
|
+
const [internal, setInternal] = (0, import_react20.useState)(defaultValue ?? null);
|
|
3921
4074
|
const numericValue = isControlled ? value : internal;
|
|
3922
|
-
const [draft, setDraft] = (0,
|
|
4075
|
+
const [draft, setDraft] = (0, import_react20.useState)(null);
|
|
3923
4076
|
const allowDecimal = !Number.isInteger(step);
|
|
3924
4077
|
const allowNegative = min == null || min < 0;
|
|
3925
4078
|
const displayValue = draft ?? (numericValue == null ? "" : formatNumber(numericValue));
|
|
@@ -4040,7 +4193,7 @@ function NumberInput({
|
|
|
4040
4193
|
}
|
|
4041
4194
|
|
|
4042
4195
|
// src/components/Rating/Rating.tsx
|
|
4043
|
-
var
|
|
4196
|
+
var import_react21 = require("react");
|
|
4044
4197
|
var import_class_variance_authority30 = require("class-variance-authority");
|
|
4045
4198
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4046
4199
|
var ratingVariants = (0, import_class_variance_authority30.cva)("ddga-rating", {
|
|
@@ -4084,11 +4237,11 @@ function Rating({
|
|
|
4084
4237
|
className,
|
|
4085
4238
|
...props
|
|
4086
4239
|
}) {
|
|
4087
|
-
const rootRef = (0,
|
|
4240
|
+
const rootRef = (0, import_react21.useRef)(null);
|
|
4088
4241
|
const isControlled = value !== void 0;
|
|
4089
|
-
const [internal, setInternal] = (0,
|
|
4242
|
+
const [internal, setInternal] = (0, import_react21.useState)(defaultValue ?? 0);
|
|
4090
4243
|
const currentValue = isControlled ? value : internal;
|
|
4091
|
-
const [hover, setHover] = (0,
|
|
4244
|
+
const [hover, setHover] = (0, import_react21.useState)(null);
|
|
4092
4245
|
const interactive = !readOnly && !disabled;
|
|
4093
4246
|
const stepSize = allowHalf ? 0.5 : 1;
|
|
4094
4247
|
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
@@ -4336,7 +4489,7 @@ function DescriptionDetails({ className, ...props }) {
|
|
|
4336
4489
|
}
|
|
4337
4490
|
|
|
4338
4491
|
// src/components/EmptyState/EmptyState.tsx
|
|
4339
|
-
var
|
|
4492
|
+
var import_react22 = require("react");
|
|
4340
4493
|
var import_radix_ui23 = require("radix-ui");
|
|
4341
4494
|
var import_class_variance_authority33 = require("class-variance-authority");
|
|
4342
4495
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -4444,7 +4597,7 @@ function EmptyStateActions({ asChild, className, ...props }) {
|
|
|
4444
4597
|
}
|
|
4445
4598
|
|
|
4446
4599
|
// src/components/Stat/Stat.tsx
|
|
4447
|
-
var
|
|
4600
|
+
var import_react23 = require("react");
|
|
4448
4601
|
var import_class_variance_authority34 = require("class-variance-authority");
|
|
4449
4602
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4450
4603
|
var statVariants = (0, import_class_variance_authority34.cva)("ddga-stat", {
|
|
@@ -4452,12 +4605,16 @@ var statVariants = (0, import_class_variance_authority34.cva)("ddga-stat", {
|
|
|
4452
4605
|
variant: {
|
|
4453
4606
|
flat: "ddga-stat--flat",
|
|
4454
4607
|
elevated: "ddga-stat--elevated",
|
|
4455
|
-
accent: "ddga-stat--accent"
|
|
4608
|
+
accent: "ddga-stat--accent",
|
|
4609
|
+
// Soft sentiment-tinted gradient surface (reuses the accent tint vars).
|
|
4610
|
+
gradient: "ddga-stat--gradient"
|
|
4456
4611
|
},
|
|
4457
4612
|
size: {
|
|
4458
4613
|
sm: "ddga-stat--sm",
|
|
4459
4614
|
md: "ddga-stat--md",
|
|
4460
|
-
lg: "ddga-stat--lg"
|
|
4615
|
+
lg: "ddga-stat--lg",
|
|
4616
|
+
// Hero/display size for headline KPIs (display-scale value).
|
|
4617
|
+
xl: "ddga-stat--xl"
|
|
4461
4618
|
}
|
|
4462
4619
|
},
|
|
4463
4620
|
defaultVariants: {
|
|
@@ -4489,6 +4646,7 @@ function Stat({
|
|
|
4489
4646
|
changeLabel,
|
|
4490
4647
|
trend,
|
|
4491
4648
|
sentiment,
|
|
4649
|
+
changeVariant,
|
|
4492
4650
|
icon,
|
|
4493
4651
|
className,
|
|
4494
4652
|
children,
|
|
@@ -4511,7 +4669,7 @@ function Stat({
|
|
|
4511
4669
|
] }) : null,
|
|
4512
4670
|
value ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatValue, { children: value }) : null,
|
|
4513
4671
|
change || changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ddga-stat__change-row", children: [
|
|
4514
|
-
change ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatChange, { trend, sentiment, children: change }) : null,
|
|
4672
|
+
change ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatChange, { trend, sentiment, variant: changeVariant, children: change }) : null,
|
|
4515
4673
|
changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__change-label", children: changeLabel }) : null
|
|
4516
4674
|
] }) : null,
|
|
4517
4675
|
children
|
|
@@ -4525,7 +4683,10 @@ function StatLabel({ className, ...props }) {
|
|
|
4525
4683
|
function StatValue({ className, ...props }) {
|
|
4526
4684
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-value", className: cn("ddga-stat__value", className), ...props });
|
|
4527
4685
|
}
|
|
4528
|
-
function
|
|
4686
|
+
function StatChart({ className, ...props }) {
|
|
4687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-chart", className: cn("ddga-stat__chart", className), ...props });
|
|
4688
|
+
}
|
|
4689
|
+
function StatChange({ trend, sentiment, variant, className, children, ...props }) {
|
|
4529
4690
|
const resolvedSentiment = resolveSentiment(trend, sentiment);
|
|
4530
4691
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4531
4692
|
"div",
|
|
@@ -4536,6 +4697,7 @@ function StatChange({ trend, sentiment, className, children, ...props }) {
|
|
|
4536
4697
|
className: cn(
|
|
4537
4698
|
"ddga-stat__change",
|
|
4538
4699
|
resolvedSentiment ? `ddga-stat__change--${resolvedSentiment}` : null,
|
|
4700
|
+
variant === "chip" && "ddga-stat__change--chip",
|
|
4539
4701
|
className
|
|
4540
4702
|
),
|
|
4541
4703
|
...props,
|
|
@@ -4584,7 +4746,7 @@ function StatGroup({ orientation, gap, columns, className, style, ...props }) {
|
|
|
4584
4746
|
}
|
|
4585
4747
|
|
|
4586
4748
|
// src/components/Popover/Popover.tsx
|
|
4587
|
-
var
|
|
4749
|
+
var import_react24 = require("react");
|
|
4588
4750
|
var import_radix_ui24 = require("radix-ui");
|
|
4589
4751
|
var import_class_variance_authority36 = require("class-variance-authority");
|
|
4590
4752
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
@@ -4621,7 +4783,7 @@ function PopoverContent({
|
|
|
4621
4783
|
'[@dev-dga/react] PopoverContent renders role="dialog" and should have an `aria-label` or `aria-labelledby` so the panel has an accessible name.'
|
|
4622
4784
|
);
|
|
4623
4785
|
}
|
|
4624
|
-
const ctx = (0,
|
|
4786
|
+
const ctx = (0, import_react24.useContext)(DgaContext);
|
|
4625
4787
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
4626
4788
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
4627
4789
|
import_radix_ui24.Popover.Content,
|
|
@@ -4670,14 +4832,14 @@ function PopoverClose({
|
|
|
4670
4832
|
}
|
|
4671
4833
|
|
|
4672
4834
|
// src/components/Sidebar/Sidebar.tsx
|
|
4673
|
-
var
|
|
4835
|
+
var import_react27 = require("react");
|
|
4674
4836
|
var import_radix_ui25 = require("radix-ui");
|
|
4675
4837
|
|
|
4676
4838
|
// src/components/Sidebar/SidebarContext.ts
|
|
4677
|
-
var
|
|
4678
|
-
var SidebarContext = (0,
|
|
4839
|
+
var import_react25 = require("react");
|
|
4840
|
+
var SidebarContext = (0, import_react25.createContext)(null);
|
|
4679
4841
|
function useSidebar() {
|
|
4680
|
-
const ctx = (0,
|
|
4842
|
+
const ctx = (0, import_react25.useContext)(SidebarContext);
|
|
4681
4843
|
if (!ctx) {
|
|
4682
4844
|
throw new Error("useSidebar must be used within a <SidebarProvider>");
|
|
4683
4845
|
}
|
|
@@ -4685,10 +4847,10 @@ function useSidebar() {
|
|
|
4685
4847
|
}
|
|
4686
4848
|
|
|
4687
4849
|
// src/components/Sidebar/useIsMobile.ts
|
|
4688
|
-
var
|
|
4850
|
+
var import_react26 = require("react");
|
|
4689
4851
|
function useIsMobile(breakpoint = 768) {
|
|
4690
|
-
const [isMobile, setIsMobile] = (0,
|
|
4691
|
-
(0,
|
|
4852
|
+
const [isMobile, setIsMobile] = (0, import_react26.useState)(false);
|
|
4853
|
+
(0, import_react26.useEffect)(() => {
|
|
4692
4854
|
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
4693
4855
|
const onChange = () => setIsMobile(mql.matches);
|
|
4694
4856
|
onChange();
|
|
@@ -4712,18 +4874,18 @@ function SidebarProvider({
|
|
|
4712
4874
|
...props
|
|
4713
4875
|
}) {
|
|
4714
4876
|
const isMobile = useIsMobile(mobileBreakpoint);
|
|
4715
|
-
const [openMobile, setOpenMobile] = (0,
|
|
4877
|
+
const [openMobile, setOpenMobile] = (0, import_react27.useState)(false);
|
|
4716
4878
|
const isControlled = openProp !== void 0;
|
|
4717
|
-
const [openInternal, setOpenInternal] = (0,
|
|
4879
|
+
const [openInternal, setOpenInternal] = (0, import_react27.useState)(defaultOpen);
|
|
4718
4880
|
const open = isControlled ? openProp : openInternal;
|
|
4719
|
-
const setOpen = (0,
|
|
4881
|
+
const setOpen = (0, import_react27.useCallback)(
|
|
4720
4882
|
(value2) => {
|
|
4721
4883
|
if (!isControlled) setOpenInternal(value2);
|
|
4722
4884
|
onOpenChange?.(value2);
|
|
4723
4885
|
},
|
|
4724
4886
|
[isControlled, onOpenChange]
|
|
4725
4887
|
);
|
|
4726
|
-
const toggleSidebar = (0,
|
|
4888
|
+
const toggleSidebar = (0, import_react27.useCallback)(() => {
|
|
4727
4889
|
if (isMobile) {
|
|
4728
4890
|
setOpenMobile((v) => !v);
|
|
4729
4891
|
return;
|
|
@@ -4734,7 +4896,7 @@ function SidebarProvider({
|
|
|
4734
4896
|
setOpenInternal((v) => !v);
|
|
4735
4897
|
}
|
|
4736
4898
|
}, [isMobile, isControlled, onOpenChange, open]);
|
|
4737
|
-
(0,
|
|
4899
|
+
(0, import_react27.useEffect)(() => {
|
|
4738
4900
|
if (!keyboardShortcut) return;
|
|
4739
4901
|
const onKeyDown = (e) => {
|
|
4740
4902
|
if (e.key.toLowerCase() === "b" && (e.metaKey || e.ctrlKey)) {
|
|
@@ -4746,7 +4908,7 @@ function SidebarProvider({
|
|
|
4746
4908
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
4747
4909
|
}, [keyboardShortcut, toggleSidebar]);
|
|
4748
4910
|
const state = open ? "expanded" : "collapsed";
|
|
4749
|
-
const value = (0,
|
|
4911
|
+
const value = (0, import_react27.useMemo)(
|
|
4750
4912
|
() => ({ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }),
|
|
4751
4913
|
[state, open, setOpen, openMobile, isMobile, toggleSidebar]
|
|
4752
4914
|
);
|
|
@@ -5173,7 +5335,7 @@ function ScrollArea({
|
|
|
5173
5335
|
}
|
|
5174
5336
|
|
|
5175
5337
|
// src/components/Menubar/Menubar.tsx
|
|
5176
|
-
var
|
|
5338
|
+
var import_react28 = require("react");
|
|
5177
5339
|
var import_radix_ui29 = require("radix-ui");
|
|
5178
5340
|
var import_class_variance_authority39 = require("class-variance-authority");
|
|
5179
5341
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
@@ -5224,7 +5386,7 @@ function MenubarTrigger({ variant, className, ...props }) {
|
|
|
5224
5386
|
);
|
|
5225
5387
|
}
|
|
5226
5388
|
function MenubarContent({ size, className, sideOffset = 6, ...props }) {
|
|
5227
|
-
const ctx = (0,
|
|
5389
|
+
const ctx = (0, import_react28.useContext)(DgaContext);
|
|
5228
5390
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5229
5391
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5230
5392
|
import_radix_ui29.Menubar.Content,
|
|
@@ -5345,7 +5507,7 @@ function MenubarSubTrigger({ className, startIcon, children, ...props }) {
|
|
|
5345
5507
|
);
|
|
5346
5508
|
}
|
|
5347
5509
|
function MenubarSubContent({ size, className, ...props }) {
|
|
5348
|
-
const ctx = (0,
|
|
5510
|
+
const ctx = (0, import_react28.useContext)(DgaContext);
|
|
5349
5511
|
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5350
5512
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5351
5513
|
import_radix_ui29.Menubar.SubContent,
|
|
@@ -5447,11 +5609,1072 @@ function TimelineTime({ className, ...props }) {
|
|
|
5447
5609
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("time", { "data-slot": "timeline-time", className: cn("ddga-timeline__time", className), ...props });
|
|
5448
5610
|
}
|
|
5449
5611
|
|
|
5450
|
-
// src/
|
|
5451
|
-
var
|
|
5612
|
+
// src/components/Command/Command.tsx
|
|
5613
|
+
var import_react29 = require("react");
|
|
5614
|
+
var import_cmdk2 = require("cmdk");
|
|
5452
5615
|
var import_radix_ui30 = require("radix-ui");
|
|
5453
|
-
var
|
|
5616
|
+
var import_class_variance_authority41 = require("class-variance-authority");
|
|
5454
5617
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5618
|
+
var commandVariants = (0, import_class_variance_authority41.cva)("ddga-command");
|
|
5619
|
+
function Command2({ className, ...props }) {
|
|
5620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_cmdk2.Command, { "data-slot": "command", className: cn(commandVariants(), className), ...props });
|
|
5621
|
+
}
|
|
5622
|
+
function CommandInput({
|
|
5623
|
+
className,
|
|
5624
|
+
placeholder,
|
|
5625
|
+
"aria-label": ariaLabel,
|
|
5626
|
+
...props
|
|
5627
|
+
}) {
|
|
5628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "ddga-command__input-wrapper", "data-slot": "command-input-wrapper", children: [
|
|
5629
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Search, { className: "ddga-command__search-icon", "aria-hidden": "true" }),
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5631
|
+
import_cmdk2.Command.Input,
|
|
5632
|
+
{
|
|
5633
|
+
"data-slot": "command-input",
|
|
5634
|
+
className: cn("ddga-command__input", className),
|
|
5635
|
+
placeholder,
|
|
5636
|
+
"aria-label": ariaLabel ?? (typeof placeholder === "string" ? placeholder : void 0),
|
|
5637
|
+
...props
|
|
5638
|
+
}
|
|
5639
|
+
)
|
|
5640
|
+
] });
|
|
5641
|
+
}
|
|
5642
|
+
function CommandList({ className, ...props }) {
|
|
5643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5644
|
+
import_cmdk2.Command.List,
|
|
5645
|
+
{
|
|
5646
|
+
"data-slot": "command-list",
|
|
5647
|
+
className: cn("ddga-command__list", className),
|
|
5648
|
+
...props
|
|
5649
|
+
}
|
|
5650
|
+
);
|
|
5651
|
+
}
|
|
5652
|
+
function CommandEmpty({ className, ...props }) {
|
|
5653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5654
|
+
import_cmdk2.Command.Empty,
|
|
5655
|
+
{
|
|
5656
|
+
"data-slot": "command-empty",
|
|
5657
|
+
className: cn("ddga-command__empty", className),
|
|
5658
|
+
...props
|
|
5659
|
+
}
|
|
5660
|
+
);
|
|
5661
|
+
}
|
|
5662
|
+
function CommandGroup({ className, ...props }) {
|
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5664
|
+
import_cmdk2.Command.Group,
|
|
5665
|
+
{
|
|
5666
|
+
"data-slot": "command-group",
|
|
5667
|
+
className: cn("ddga-command__group", className),
|
|
5668
|
+
...props
|
|
5669
|
+
}
|
|
5670
|
+
);
|
|
5671
|
+
}
|
|
5672
|
+
function CommandSeparator({
|
|
5673
|
+
className,
|
|
5674
|
+
"aria-hidden": ariaHidden = true,
|
|
5675
|
+
...props
|
|
5676
|
+
}) {
|
|
5677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5678
|
+
import_cmdk2.Command.Separator,
|
|
5679
|
+
{
|
|
5680
|
+
"aria-hidden": ariaHidden,
|
|
5681
|
+
"data-slot": "command-separator",
|
|
5682
|
+
className: cn("ddga-command__separator", className),
|
|
5683
|
+
...props
|
|
5684
|
+
}
|
|
5685
|
+
);
|
|
5686
|
+
}
|
|
5687
|
+
function CommandItem({
|
|
5688
|
+
startIcon,
|
|
5689
|
+
shortcut,
|
|
5690
|
+
className,
|
|
5691
|
+
children,
|
|
5692
|
+
keywords,
|
|
5693
|
+
...props
|
|
5694
|
+
}) {
|
|
5695
|
+
const labelText = typeof children === "string" ? children : void 0;
|
|
5696
|
+
const mergedKeywords = labelText && !keywords?.includes(labelText) ? [...keywords ?? [], labelText] : keywords;
|
|
5697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5698
|
+
import_cmdk2.Command.Item,
|
|
5699
|
+
{
|
|
5700
|
+
"data-slot": "command-item",
|
|
5701
|
+
className: cn("ddga-command__item", className),
|
|
5702
|
+
keywords: mergedKeywords,
|
|
5703
|
+
...props,
|
|
5704
|
+
children: [
|
|
5705
|
+
startIcon != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-command__item-icon", "aria-hidden": "true", children: startIcon }),
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-command__item-label", children }),
|
|
5707
|
+
shortcut != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "ddga-command__item-shortcut", children: shortcut })
|
|
5708
|
+
]
|
|
5709
|
+
}
|
|
5710
|
+
);
|
|
5711
|
+
}
|
|
5712
|
+
function CommandDialog({
|
|
5713
|
+
open: controlledOpen,
|
|
5714
|
+
defaultOpen,
|
|
5715
|
+
onOpenChange,
|
|
5716
|
+
shortcut = "k",
|
|
5717
|
+
label = "Command palette",
|
|
5718
|
+
description,
|
|
5719
|
+
className,
|
|
5720
|
+
filter,
|
|
5721
|
+
shouldFilter,
|
|
5722
|
+
loop,
|
|
5723
|
+
children
|
|
5724
|
+
}) {
|
|
5725
|
+
const [internalOpen, setInternalOpen] = (0, import_react29.useState)(defaultOpen ?? false);
|
|
5726
|
+
const isControlled = controlledOpen !== void 0;
|
|
5727
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
5728
|
+
const setOpen = (0, import_react29.useCallback)(
|
|
5729
|
+
(next) => {
|
|
5730
|
+
if (!isControlled) setInternalOpen(next);
|
|
5731
|
+
onOpenChange?.(next);
|
|
5732
|
+
},
|
|
5733
|
+
[isControlled, onOpenChange]
|
|
5734
|
+
);
|
|
5735
|
+
const openRef = (0, import_react29.useRef)(open);
|
|
5736
|
+
(0, import_react29.useEffect)(() => {
|
|
5737
|
+
openRef.current = open;
|
|
5738
|
+
});
|
|
5739
|
+
(0, import_react29.useEffect)(() => {
|
|
5740
|
+
if (typeof shortcut !== "string") return;
|
|
5741
|
+
const key = shortcut.toLowerCase();
|
|
5742
|
+
const onKeyDown = (event) => {
|
|
5743
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === key) {
|
|
5744
|
+
event.preventDefault();
|
|
5745
|
+
setOpen(!openRef.current);
|
|
5746
|
+
}
|
|
5747
|
+
};
|
|
5748
|
+
document.addEventListener("keydown", onKeyDown);
|
|
5749
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5750
|
+
}, [shortcut, setOpen]);
|
|
5751
|
+
const ctx = (0, import_react29.useContext)(DgaContext);
|
|
5752
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
5753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_radix_ui30.Dialog.Portal, { container: portalContainer, children: [
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Overlay, { className: "ddga-command__overlay", "data-slot": "command-overlay" }),
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5756
|
+
import_radix_ui30.Dialog.Content,
|
|
5757
|
+
{
|
|
5758
|
+
"data-slot": "command-dialog",
|
|
5759
|
+
className: cn("ddga-command-dialog", className),
|
|
5760
|
+
...description == null ? { "aria-describedby": void 0 } : {},
|
|
5761
|
+
children: [
|
|
5762
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Title, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.VisuallyHidden.Root, { children: label }) }),
|
|
5763
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Dialog.Description, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.VisuallyHidden.Root, { children: description }) }),
|
|
5764
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5765
|
+
Command2,
|
|
5766
|
+
{
|
|
5767
|
+
"data-slot": "command-dialog-command",
|
|
5768
|
+
className: "ddga-command--dialog",
|
|
5769
|
+
label: typeof label === "string" ? label : "Command palette",
|
|
5770
|
+
filter,
|
|
5771
|
+
shouldFilter,
|
|
5772
|
+
loop,
|
|
5773
|
+
children
|
|
5774
|
+
}
|
|
5775
|
+
)
|
|
5776
|
+
]
|
|
5777
|
+
}
|
|
5778
|
+
)
|
|
5779
|
+
] }) });
|
|
5780
|
+
}
|
|
5781
|
+
|
|
5782
|
+
// src/components/Table/Table.tsx
|
|
5783
|
+
var import_class_variance_authority42 = require("class-variance-authority");
|
|
5784
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5785
|
+
var tableVariants = (0, import_class_variance_authority42.cva)("ddga-table", {
|
|
5786
|
+
variants: {
|
|
5787
|
+
size: {
|
|
5788
|
+
sm: "ddga-table--sm",
|
|
5789
|
+
md: "ddga-table--md",
|
|
5790
|
+
lg: "ddga-table--lg"
|
|
5791
|
+
},
|
|
5792
|
+
striped: { true: "ddga-table--striped" },
|
|
5793
|
+
divided: { true: "ddga-table--divided" },
|
|
5794
|
+
bordered: { true: "ddga-table--bordered" },
|
|
5795
|
+
stickyHeader: { true: "ddga-table--sticky" }
|
|
5796
|
+
},
|
|
5797
|
+
defaultVariants: {
|
|
5798
|
+
size: "md"
|
|
5799
|
+
}
|
|
5800
|
+
});
|
|
5801
|
+
function Table({
|
|
5802
|
+
size,
|
|
5803
|
+
striped,
|
|
5804
|
+
divided,
|
|
5805
|
+
bordered,
|
|
5806
|
+
stickyHeader,
|
|
5807
|
+
className,
|
|
5808
|
+
maxHeight,
|
|
5809
|
+
"aria-label": ariaLabel,
|
|
5810
|
+
"aria-labelledby": ariaLabelledby,
|
|
5811
|
+
...props
|
|
5812
|
+
}) {
|
|
5813
|
+
const named = Boolean(ariaLabel || ariaLabelledby);
|
|
5814
|
+
if (process.env.NODE_ENV !== "production" && !named) {
|
|
5815
|
+
console.warn(
|
|
5816
|
+
"[ddga] <Table> wraps its table in a horizontally scrollable container. Pass `aria-label` (or `aria-labelledby`) so keyboard and screen-reader users can identify and scroll it. Without a name it degrades to a plain scroll container with no landmark."
|
|
5817
|
+
);
|
|
5818
|
+
}
|
|
5819
|
+
if (process.env.NODE_ENV !== "production" && ariaLabel && ariaLabelledby) {
|
|
5820
|
+
console.warn(
|
|
5821
|
+
"[ddga] <Table> received both `aria-label` and `aria-labelledby`. `aria-labelledby` takes precedence; `aria-label` will be ignored by assistive technology."
|
|
5822
|
+
);
|
|
5823
|
+
}
|
|
5824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5825
|
+
"div",
|
|
5826
|
+
{
|
|
5827
|
+
"data-slot": "table-region",
|
|
5828
|
+
className: "ddga-table__region",
|
|
5829
|
+
style: maxHeight != null ? { maxBlockSize: maxHeight, overflowY: "auto" } : void 0,
|
|
5830
|
+
...named ? {
|
|
5831
|
+
role: "region",
|
|
5832
|
+
tabIndex: 0,
|
|
5833
|
+
"aria-label": ariaLabel,
|
|
5834
|
+
"aria-labelledby": ariaLabelledby
|
|
5835
|
+
} : {},
|
|
5836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5837
|
+
"table",
|
|
5838
|
+
{
|
|
5839
|
+
"data-slot": "table",
|
|
5840
|
+
className: cn(tableVariants({ size, striped, divided, bordered, stickyHeader }), className),
|
|
5841
|
+
...props
|
|
5842
|
+
}
|
|
5843
|
+
)
|
|
5844
|
+
}
|
|
5845
|
+
);
|
|
5846
|
+
}
|
|
5847
|
+
function TableHeader({ className, ...props }) {
|
|
5848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("thead", { "data-slot": "table-header", className: cn("ddga-table__header", className), ...props });
|
|
5849
|
+
}
|
|
5850
|
+
function TableBody({ className, ...props }) {
|
|
5851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tbody", { "data-slot": "table-body", className: cn("ddga-table__body", className), ...props });
|
|
5852
|
+
}
|
|
5853
|
+
function TableFooter({ className, ...props }) {
|
|
5854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tfoot", { "data-slot": "table-footer", className: cn("ddga-table__footer", className), ...props });
|
|
5855
|
+
}
|
|
5856
|
+
function TableRow({ className, selected, ...props }) {
|
|
5857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5858
|
+
"tr",
|
|
5859
|
+
{
|
|
5860
|
+
"data-slot": "table-row",
|
|
5861
|
+
"data-state": selected ? "selected" : void 0,
|
|
5862
|
+
className: cn("ddga-table__row", className),
|
|
5863
|
+
...props
|
|
5864
|
+
}
|
|
5865
|
+
);
|
|
5866
|
+
}
|
|
5867
|
+
function TableHead({
|
|
5868
|
+
className,
|
|
5869
|
+
align,
|
|
5870
|
+
sortable,
|
|
5871
|
+
sortDirection = false,
|
|
5872
|
+
sortLabel,
|
|
5873
|
+
onClick,
|
|
5874
|
+
children,
|
|
5875
|
+
...props
|
|
5876
|
+
}) {
|
|
5877
|
+
const headClass = cn("ddga-table__head", align && `ddga-table__head--align-${align}`, className);
|
|
5878
|
+
if (process.env.NODE_ENV !== "production" && sortable && !sortLabel) {
|
|
5879
|
+
console.warn(
|
|
5880
|
+
'[ddga] <TableHead sortable> has no `sortLabel`. `aria-sort` conveys the sort state, but pass a localized cue (e.g. "activate to sort") so a focused sort button announces its action to screen-reader users.'
|
|
5881
|
+
);
|
|
5882
|
+
}
|
|
5883
|
+
if (!sortable) {
|
|
5884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("th", { scope: "col", "data-slot": "table-head", className: headClass, ...props, children });
|
|
5885
|
+
}
|
|
5886
|
+
const ariaSort = sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none";
|
|
5887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("th", { scope: "col", "data-slot": "table-head", "aria-sort": ariaSort, className: headClass, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
5888
|
+
"button",
|
|
5889
|
+
{
|
|
5890
|
+
type: "button",
|
|
5891
|
+
"data-slot": "table-sort-button",
|
|
5892
|
+
className: "ddga-table__sort-button",
|
|
5893
|
+
onClick,
|
|
5894
|
+
children: [
|
|
5895
|
+
children,
|
|
5896
|
+
sortLabel ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-sr-only", children: sortLabel }) : null,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ddga-table__sort-icon", "data-slot": "table-sort-icon", "aria-hidden": "true", children: sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretUp, {}) : sortDirection === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretDown, {}) : (
|
|
5898
|
+
// Neutral affordance: stacked carets, dimmed via CSS.
|
|
5899
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretUp, {}),
|
|
5901
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretDown, {})
|
|
5902
|
+
] })
|
|
5903
|
+
) })
|
|
5904
|
+
]
|
|
5905
|
+
}
|
|
5906
|
+
) });
|
|
5907
|
+
}
|
|
5908
|
+
function TableCell({ className, align, ...props }) {
|
|
5909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5910
|
+
"td",
|
|
5911
|
+
{
|
|
5912
|
+
"data-slot": "table-cell",
|
|
5913
|
+
className: cn("ddga-table__cell", align && `ddga-table__cell--align-${align}`, className),
|
|
5914
|
+
...props
|
|
5915
|
+
}
|
|
5916
|
+
);
|
|
5917
|
+
}
|
|
5918
|
+
function TableCaption({ className, ...props }) {
|
|
5919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5920
|
+
"caption",
|
|
5921
|
+
{
|
|
5922
|
+
"data-slot": "table-caption",
|
|
5923
|
+
className: cn("ddga-table__caption", className),
|
|
5924
|
+
...props
|
|
5925
|
+
}
|
|
5926
|
+
);
|
|
5927
|
+
}
|
|
5928
|
+
|
|
5929
|
+
// src/components/InputOTP/InputOTP.tsx
|
|
5930
|
+
var import_react30 = require("react");
|
|
5931
|
+
var import_class_variance_authority43 = require("class-variance-authority");
|
|
5932
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5933
|
+
var DEFAULT_PATTERN = "^[0-9]*$";
|
|
5934
|
+
var inputOTPVariants = (0, import_class_variance_authority43.cva)("ddga-input-otp", {
|
|
5935
|
+
variants: {
|
|
5936
|
+
size: {
|
|
5937
|
+
sm: "ddga-input-otp--sm",
|
|
5938
|
+
md: "ddga-input-otp--md",
|
|
5939
|
+
lg: "ddga-input-otp--lg"
|
|
5940
|
+
},
|
|
5941
|
+
error: {
|
|
5942
|
+
true: "ddga-input-otp--error"
|
|
5943
|
+
}
|
|
5944
|
+
},
|
|
5945
|
+
defaultVariants: {
|
|
5946
|
+
size: "md"
|
|
5947
|
+
}
|
|
5948
|
+
});
|
|
5949
|
+
function resolveGroups(length, groupSizes) {
|
|
5950
|
+
if (!groupSizes || groupSizes.length === 0) return [length];
|
|
5951
|
+
const sum = groupSizes.reduce((total, n) => total + n, 0);
|
|
5952
|
+
if (sum !== length) {
|
|
5953
|
+
if (process.env.NODE_ENV === "development") {
|
|
5954
|
+
console.warn(
|
|
5955
|
+
`[@dev-dga/react] InputOTP: groupSizes must sum to length (${length}); got ${sum}. Falling back to a single group.`
|
|
5956
|
+
);
|
|
5957
|
+
}
|
|
5958
|
+
return [length];
|
|
5959
|
+
}
|
|
5960
|
+
return groupSizes;
|
|
5961
|
+
}
|
|
5962
|
+
function Slot({
|
|
5963
|
+
char,
|
|
5964
|
+
active,
|
|
5965
|
+
caret,
|
|
5966
|
+
mask
|
|
5967
|
+
}) {
|
|
5968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
5969
|
+
"div",
|
|
5970
|
+
{
|
|
5971
|
+
"data-slot": "input-otp-slot",
|
|
5972
|
+
"data-active": active || void 0,
|
|
5973
|
+
"data-filled": char != null || void 0,
|
|
5974
|
+
className: "ddga-input-otp__slot",
|
|
5975
|
+
children: [
|
|
5976
|
+
char != null ? mask ? "\u2022" : char : null,
|
|
5977
|
+
caret && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "aria-hidden": "true", "data-slot": "input-otp-caret", className: "ddga-input-otp__caret" })
|
|
5978
|
+
]
|
|
5979
|
+
}
|
|
5980
|
+
);
|
|
5981
|
+
}
|
|
5982
|
+
function InputOTP({
|
|
5983
|
+
id: externalId,
|
|
5984
|
+
length = 6,
|
|
5985
|
+
groupSizes,
|
|
5986
|
+
value,
|
|
5987
|
+
defaultValue,
|
|
5988
|
+
onChange,
|
|
5989
|
+
onComplete,
|
|
5990
|
+
pattern = DEFAULT_PATTERN,
|
|
5991
|
+
mask = false,
|
|
5992
|
+
separator,
|
|
5993
|
+
size,
|
|
5994
|
+
disabled,
|
|
5995
|
+
autoFocus,
|
|
5996
|
+
name,
|
|
5997
|
+
required,
|
|
5998
|
+
label,
|
|
5999
|
+
helperText,
|
|
6000
|
+
errorMessage,
|
|
6001
|
+
error,
|
|
6002
|
+
className,
|
|
6003
|
+
"aria-label": ariaLabel,
|
|
6004
|
+
"aria-labelledby": ariaLabelledby,
|
|
6005
|
+
...props
|
|
6006
|
+
}) {
|
|
6007
|
+
const inputRef = (0, import_react30.useRef)(null);
|
|
6008
|
+
const [focused, setFocused] = (0, import_react30.useState)(false);
|
|
6009
|
+
const isControlled = value !== void 0;
|
|
6010
|
+
const [internal, setInternal] = (0, import_react30.useState)(defaultValue ?? "");
|
|
6011
|
+
const current = isControlled ? value : internal;
|
|
6012
|
+
const compiledPattern = (0, import_react30.useMemo)(() => {
|
|
6013
|
+
try {
|
|
6014
|
+
return new RegExp(pattern);
|
|
6015
|
+
} catch {
|
|
6016
|
+
if (process.env.NODE_ENV === "development") {
|
|
6017
|
+
console.warn(
|
|
6018
|
+
`[@dev-dga/react] InputOTP: invalid \`pattern\` regex "${pattern}". Falling back to digits-only.`
|
|
6019
|
+
);
|
|
6020
|
+
}
|
|
6021
|
+
return new RegExp(DEFAULT_PATTERN);
|
|
6022
|
+
}
|
|
6023
|
+
}, [pattern]);
|
|
6024
|
+
const completedRef = (0, import_react30.useRef)(null);
|
|
6025
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
6026
|
+
name: "InputOTP",
|
|
6027
|
+
id: externalId,
|
|
6028
|
+
label,
|
|
6029
|
+
error,
|
|
6030
|
+
errorMessage,
|
|
6031
|
+
helperText,
|
|
6032
|
+
"aria-label": ariaLabel,
|
|
6033
|
+
"aria-labelledby": ariaLabelledby
|
|
6034
|
+
});
|
|
6035
|
+
function handleChange(event) {
|
|
6036
|
+
const next = event.target.value.replace(/[\s-]/g, "").slice(0, length);
|
|
6037
|
+
if (!compiledPattern.test(next)) return;
|
|
6038
|
+
if (!isControlled) setInternal(next);
|
|
6039
|
+
onChange?.(next);
|
|
6040
|
+
if (next.length === length) {
|
|
6041
|
+
if (completedRef.current !== next) {
|
|
6042
|
+
completedRef.current = next;
|
|
6043
|
+
onComplete?.(next);
|
|
6044
|
+
}
|
|
6045
|
+
} else {
|
|
6046
|
+
completedRef.current = null;
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
function moveCaretToEnd() {
|
|
6050
|
+
const el = inputRef.current;
|
|
6051
|
+
if (el) el.setSelectionRange(el.value.length, el.value.length);
|
|
6052
|
+
}
|
|
6053
|
+
const groups = resolveGroups(length, groupSizes);
|
|
6054
|
+
const lastGroup = groups.length - 1;
|
|
6055
|
+
const activeIndex = focused ? Math.min(current.length, length - 1) : -1;
|
|
6056
|
+
const inputMode = pattern === DEFAULT_PATTERN ? "numeric" : "text";
|
|
6057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { "data-slot": "input-otp-field", className: "ddga-field", ...props, children: [
|
|
6058
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { htmlFor: fieldId, className: "ddga-input-otp__label", children: [
|
|
6059
|
+
label,
|
|
6060
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { "aria-hidden": "true", className: "ddga-input-otp__required", children: "*" })
|
|
6061
|
+
] }),
|
|
6062
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
6063
|
+
"div",
|
|
6064
|
+
{
|
|
6065
|
+
className: cn(inputOTPVariants({ size, error: hasError }), className),
|
|
6066
|
+
"data-slot": "input-otp",
|
|
6067
|
+
children: [
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6069
|
+
"input",
|
|
6070
|
+
{
|
|
6071
|
+
...controlProps,
|
|
6072
|
+
ref: inputRef,
|
|
6073
|
+
type: "text",
|
|
6074
|
+
inputMode,
|
|
6075
|
+
autoComplete: "one-time-code",
|
|
6076
|
+
value: current,
|
|
6077
|
+
maxLength: length,
|
|
6078
|
+
disabled,
|
|
6079
|
+
autoFocus,
|
|
6080
|
+
name,
|
|
6081
|
+
required,
|
|
6082
|
+
"aria-label": ariaLabel,
|
|
6083
|
+
"aria-labelledby": ariaLabelledby,
|
|
6084
|
+
onChange: handleChange,
|
|
6085
|
+
onFocus: () => {
|
|
6086
|
+
setFocused(true);
|
|
6087
|
+
moveCaretToEnd();
|
|
6088
|
+
},
|
|
6089
|
+
onBlur: () => setFocused(false),
|
|
6090
|
+
onPointerUp: moveCaretToEnd,
|
|
6091
|
+
className: "ddga-input-otp__input",
|
|
6092
|
+
"data-slot": "input-otp-input"
|
|
6093
|
+
}
|
|
6094
|
+
),
|
|
6095
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { dir: "ltr", "aria-hidden": "true", "data-slot": "input-otp-row", className: "ddga-input-otp__row", children: groups.map((count, groupIndex) => {
|
|
6096
|
+
const start = groups.slice(0, groupIndex).reduce((total, n) => total + n, 0);
|
|
6097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react30.Fragment, { children: [
|
|
6098
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "data-slot": "input-otp-group", className: "ddga-input-otp__group", children: Array.from({ length: count }, (_, offset) => {
|
|
6099
|
+
const index = start + offset;
|
|
6100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6101
|
+
Slot,
|
|
6102
|
+
{
|
|
6103
|
+
char: current[index],
|
|
6104
|
+
active: index === activeIndex,
|
|
6105
|
+
caret: index === activeIndex && current.length < length,
|
|
6106
|
+
mask
|
|
6107
|
+
},
|
|
6108
|
+
index
|
|
6109
|
+
);
|
|
6110
|
+
}) }),
|
|
6111
|
+
groupIndex < lastGroup && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6112
|
+
"span",
|
|
6113
|
+
{
|
|
6114
|
+
"aria-hidden": "true",
|
|
6115
|
+
"data-slot": "input-otp-separator",
|
|
6116
|
+
className: "ddga-input-otp__separator",
|
|
6117
|
+
children: separator ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ddga-input-otp__separator-dash" })
|
|
6118
|
+
}
|
|
6119
|
+
)
|
|
6120
|
+
] }, groupIndex);
|
|
6121
|
+
}) })
|
|
6122
|
+
]
|
|
6123
|
+
}
|
|
6124
|
+
),
|
|
6125
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
6126
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
6127
|
+
] });
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
// src/components/Link/Link.tsx
|
|
6131
|
+
var import_react31 = require("react");
|
|
6132
|
+
var import_radix_ui31 = require("radix-ui");
|
|
6133
|
+
var import_class_variance_authority44 = require("class-variance-authority");
|
|
6134
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6135
|
+
var linkVariants = (0, import_class_variance_authority44.cva)("ddga-link", {
|
|
6136
|
+
variants: {
|
|
6137
|
+
variant: {
|
|
6138
|
+
// Inline links in running prose. Underlined always — color alone fails
|
|
6139
|
+
// WCAG 1.4.1 when a link sits inside a block of text.
|
|
6140
|
+
default: "ddga-link--default",
|
|
6141
|
+
// Links in UI chrome (footers, meta rows) where context makes them
|
|
6142
|
+
// obviously links: no underline until hover.
|
|
6143
|
+
subtle: "ddga-link--subtle",
|
|
6144
|
+
// Block-level CTAs ("Learn more →"): inline-flex with gapped icons,
|
|
6145
|
+
// no underline. Not for mid-sentence use.
|
|
6146
|
+
standalone: "ddga-link--standalone"
|
|
6147
|
+
}
|
|
6148
|
+
},
|
|
6149
|
+
defaultVariants: {
|
|
6150
|
+
variant: "default"
|
|
6151
|
+
}
|
|
6152
|
+
});
|
|
6153
|
+
function Link({
|
|
6154
|
+
variant,
|
|
6155
|
+
external,
|
|
6156
|
+
startIcon,
|
|
6157
|
+
endIcon,
|
|
6158
|
+
iconFlip,
|
|
6159
|
+
asChild,
|
|
6160
|
+
className,
|
|
6161
|
+
children,
|
|
6162
|
+
rel,
|
|
6163
|
+
...props
|
|
6164
|
+
}) {
|
|
6165
|
+
if (process.env.NODE_ENV === "development" && !asChild && props.href == null) {
|
|
6166
|
+
console.warn(
|
|
6167
|
+
'[@dev-dga/react] Link rendered without an `href`. A link needs an href to be focusable and exposed as a link to assistive tech. Provide `href`, use `asChild` to render your own element (e.g. a router Link), or use `Button variant="ghost"` for an action that is not navigation.'
|
|
6168
|
+
);
|
|
6169
|
+
}
|
|
6170
|
+
const Comp = asChild ? import_radix_ui31.Slot.Slot : "a";
|
|
6171
|
+
const relValue = external ? Array.from(
|
|
6172
|
+
/* @__PURE__ */ new Set([...rel ? rel.split(/\s+/).filter(Boolean) : [], "noopener", "noreferrer"])
|
|
6173
|
+
).join(" ") : rel;
|
|
6174
|
+
const showExternalIcon = external && !endIcon;
|
|
6175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
6176
|
+
Comp,
|
|
6177
|
+
{
|
|
6178
|
+
"data-slot": "link",
|
|
6179
|
+
className: cn(linkVariants({ variant }), className),
|
|
6180
|
+
rel: relValue,
|
|
6181
|
+
...props,
|
|
6182
|
+
children: [
|
|
6183
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6184
|
+
"span",
|
|
6185
|
+
{
|
|
6186
|
+
className: cn("ddga-link__icon", iconFlip && "ddga-icon-flip"),
|
|
6187
|
+
"data-slot": "link-start-icon",
|
|
6188
|
+
"aria-hidden": "true",
|
|
6189
|
+
children: startIcon
|
|
6190
|
+
}
|
|
6191
|
+
),
|
|
6192
|
+
asChild ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui31.Slot.Slottable, { children }) : children,
|
|
6193
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6194
|
+
"span",
|
|
6195
|
+
{
|
|
6196
|
+
className: cn("ddga-link__icon", iconFlip && "ddga-icon-flip"),
|
|
6197
|
+
"data-slot": "link-end-icon",
|
|
6198
|
+
"aria-hidden": "true",
|
|
6199
|
+
children: endIcon
|
|
6200
|
+
}
|
|
6201
|
+
),
|
|
6202
|
+
showExternalIcon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6203
|
+
"span",
|
|
6204
|
+
{
|
|
6205
|
+
className: "ddga-link__icon ddga-link__icon--external",
|
|
6206
|
+
"data-slot": "link-external-icon",
|
|
6207
|
+
"aria-hidden": "true",
|
|
6208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ExternalLink, {})
|
|
6209
|
+
}
|
|
6210
|
+
)
|
|
6211
|
+
]
|
|
6212
|
+
}
|
|
6213
|
+
);
|
|
6214
|
+
}
|
|
6215
|
+
|
|
6216
|
+
// src/components/SearchBox/SearchBox.tsx
|
|
6217
|
+
var import_react32 = require("react");
|
|
6218
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
6219
|
+
function setNativeInputValue(el, value) {
|
|
6220
|
+
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
6221
|
+
setter?.call(el, value);
|
|
6222
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
6223
|
+
}
|
|
6224
|
+
function SearchBox({
|
|
6225
|
+
value,
|
|
6226
|
+
defaultValue,
|
|
6227
|
+
onChange,
|
|
6228
|
+
onKeyDown,
|
|
6229
|
+
onSearch,
|
|
6230
|
+
onClear,
|
|
6231
|
+
clearable = true,
|
|
6232
|
+
clearLabel = "Clear search",
|
|
6233
|
+
className,
|
|
6234
|
+
...rest
|
|
6235
|
+
}) {
|
|
6236
|
+
const inputRef = (0, import_react32.useRef)(null);
|
|
6237
|
+
const isControlled = value !== void 0;
|
|
6238
|
+
const [internal, setInternal] = (0, import_react32.useState)(
|
|
6239
|
+
defaultValue != null ? String(defaultValue) : ""
|
|
6240
|
+
);
|
|
6241
|
+
const currentValue = isControlled ? String(value ?? "") : internal;
|
|
6242
|
+
const handleChange = (event) => {
|
|
6243
|
+
if (!isControlled) setInternal(event.target.value);
|
|
6244
|
+
onChange?.(event);
|
|
6245
|
+
};
|
|
6246
|
+
const clear = () => {
|
|
6247
|
+
const el = inputRef.current;
|
|
6248
|
+
if (!el) return;
|
|
6249
|
+
setNativeInputValue(el, "");
|
|
6250
|
+
el.focus();
|
|
6251
|
+
onClear?.();
|
|
6252
|
+
};
|
|
6253
|
+
const handleKeyDown = (event) => {
|
|
6254
|
+
onKeyDown?.(event);
|
|
6255
|
+
if (event.defaultPrevented) return;
|
|
6256
|
+
if (event.key === "Enter") {
|
|
6257
|
+
onSearch?.(currentValue);
|
|
6258
|
+
} else if (event.key === "Escape" && currentValue.length > 0) {
|
|
6259
|
+
event.preventDefault();
|
|
6260
|
+
event.stopPropagation();
|
|
6261
|
+
clear();
|
|
6262
|
+
}
|
|
6263
|
+
};
|
|
6264
|
+
const showClear = clearable && currentValue.length > 0;
|
|
6265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6266
|
+
Input,
|
|
6267
|
+
{
|
|
6268
|
+
...rest,
|
|
6269
|
+
ref: inputRef,
|
|
6270
|
+
type: "search",
|
|
6271
|
+
value: currentValue,
|
|
6272
|
+
onChange: handleChange,
|
|
6273
|
+
onKeyDown: handleKeyDown,
|
|
6274
|
+
className: cn("ddga-search-box", className),
|
|
6275
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Search, { "data-slot": "search-box-icon", "aria-hidden": "true" }),
|
|
6276
|
+
endAdornment: showClear ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6277
|
+
Button,
|
|
6278
|
+
{
|
|
6279
|
+
type: "button",
|
|
6280
|
+
variant: "ghost",
|
|
6281
|
+
size: "icon-sm",
|
|
6282
|
+
"aria-label": clearLabel,
|
|
6283
|
+
"data-slot": "search-box-clear",
|
|
6284
|
+
onClick: clear,
|
|
6285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Close, { "aria-hidden": "true" })
|
|
6286
|
+
}
|
|
6287
|
+
) : void 0
|
|
6288
|
+
}
|
|
6289
|
+
);
|
|
6290
|
+
}
|
|
6291
|
+
|
|
6292
|
+
// src/components/List/List.tsx
|
|
6293
|
+
var import_class_variance_authority45 = require("class-variance-authority");
|
|
6294
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
6295
|
+
var listVariants = (0, import_class_variance_authority45.cva)("ddga-list", {
|
|
6296
|
+
variants: {
|
|
6297
|
+
variant: {
|
|
6298
|
+
plain: "ddga-list--plain",
|
|
6299
|
+
bulleted: "ddga-list--bulleted",
|
|
6300
|
+
numbered: "ddga-list--numbered",
|
|
6301
|
+
lettered: "ddga-list--lettered"
|
|
6302
|
+
},
|
|
6303
|
+
divided: {
|
|
6304
|
+
true: "ddga-list--divided"
|
|
6305
|
+
}
|
|
6306
|
+
},
|
|
6307
|
+
defaultVariants: {
|
|
6308
|
+
variant: "plain"
|
|
6309
|
+
}
|
|
6310
|
+
});
|
|
6311
|
+
function List({ variant, divided, className, start, reversed, ...props }) {
|
|
6312
|
+
const classes = cn(listVariants({ variant, divided }), className);
|
|
6313
|
+
const ordered = variant === "numbered" || variant === "lettered";
|
|
6314
|
+
if (ordered) {
|
|
6315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6316
|
+
"ol",
|
|
6317
|
+
{
|
|
6318
|
+
"data-slot": "list",
|
|
6319
|
+
"data-variant": variant,
|
|
6320
|
+
className: classes,
|
|
6321
|
+
start,
|
|
6322
|
+
reversed,
|
|
6323
|
+
...props
|
|
6324
|
+
}
|
|
6325
|
+
);
|
|
6326
|
+
}
|
|
6327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { "data-slot": "list", "data-variant": variant ?? "plain", className: classes, ...props });
|
|
6328
|
+
}
|
|
6329
|
+
function ListItem({ className, ...props }) {
|
|
6330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { "data-slot": "list-item", className: cn("ddga-list__item", className), ...props });
|
|
6331
|
+
}
|
|
6332
|
+
function ListItemIcon({ className, ...props }) {
|
|
6333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "data-slot": "list-item-icon", className: cn("ddga-list__icon", className), ...props });
|
|
6334
|
+
}
|
|
6335
|
+
function ListItemContent({
|
|
6336
|
+
primary,
|
|
6337
|
+
secondary,
|
|
6338
|
+
className,
|
|
6339
|
+
children,
|
|
6340
|
+
...props
|
|
6341
|
+
}) {
|
|
6342
|
+
if (process.env.NODE_ENV === "development" && children != null && (primary != null || secondary != null)) {
|
|
6343
|
+
console.warn(
|
|
6344
|
+
"[@dev-dga/react] ListItemContent: `children` overrides `primary`/`secondary`. Pass one or the other, not both."
|
|
6345
|
+
);
|
|
6346
|
+
}
|
|
6347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { "data-slot": "list-item-content", className: cn("ddga-list__content", className), ...props, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
6348
|
+
primary != null && primary !== "" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "data-slot": "list-item-primary", className: "ddga-list__primary", children: primary }),
|
|
6349
|
+
secondary != null && secondary !== "" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "data-slot": "list-item-secondary", className: "ddga-list__secondary", children: secondary })
|
|
6350
|
+
] }) });
|
|
6351
|
+
}
|
|
6352
|
+
function ListItemAction({ className, ...props }) {
|
|
6353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { "data-slot": "list-item-action", className: cn("ddga-list__action", className), ...props });
|
|
6354
|
+
}
|
|
6355
|
+
|
|
6356
|
+
// src/components/Quote/Quote.tsx
|
|
6357
|
+
var import_react33 = require("react");
|
|
6358
|
+
var import_radix_ui32 = require("radix-ui");
|
|
6359
|
+
var import_class_variance_authority46 = require("class-variance-authority");
|
|
6360
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6361
|
+
var quoteVariants = (0, import_class_variance_authority46.cva)("ddga-quote", {
|
|
6362
|
+
variants: {
|
|
6363
|
+
variant: {
|
|
6364
|
+
/** Inline-start accent border (SA Green). The everyday blockquote. */
|
|
6365
|
+
default: "ddga-quote--default",
|
|
6366
|
+
/** Large editorial quote, centered, prominent mark — breaks up prose. */
|
|
6367
|
+
pullquote: "ddga-quote--pullquote",
|
|
6368
|
+
/** Card surface (border + bg + shadow), sized for an avatar + attribution. */
|
|
6369
|
+
testimonial: "ddga-quote--testimonial",
|
|
6370
|
+
/** Bare — no border, no surface. For inline / tightly-composed use. */
|
|
6371
|
+
plain: "ddga-quote--plain"
|
|
6372
|
+
}
|
|
6373
|
+
},
|
|
6374
|
+
defaultVariants: {
|
|
6375
|
+
variant: "default"
|
|
6376
|
+
}
|
|
6377
|
+
});
|
|
6378
|
+
function Quote({
|
|
6379
|
+
variant,
|
|
6380
|
+
quoteMark = false,
|
|
6381
|
+
avatar,
|
|
6382
|
+
author,
|
|
6383
|
+
byline,
|
|
6384
|
+
source,
|
|
6385
|
+
cite,
|
|
6386
|
+
className,
|
|
6387
|
+
children,
|
|
6388
|
+
...props
|
|
6389
|
+
}) {
|
|
6390
|
+
const hasAttribution = author != null || byline != null || source != null;
|
|
6391
|
+
const mark = quoteMark ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteMark, { "aria-hidden": "true", className: "ddga-quote__mark" }) : null;
|
|
6392
|
+
if (!hasAttribution) {
|
|
6393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
6394
|
+
"blockquote",
|
|
6395
|
+
{
|
|
6396
|
+
"data-slot": "quote",
|
|
6397
|
+
"data-variant": variant ?? "default",
|
|
6398
|
+
className: cn(quoteVariants({ variant }), className),
|
|
6399
|
+
cite,
|
|
6400
|
+
...props,
|
|
6401
|
+
children: [
|
|
6402
|
+
mark,
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteContent, { children })
|
|
6404
|
+
]
|
|
6405
|
+
}
|
|
6406
|
+
);
|
|
6407
|
+
}
|
|
6408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
6409
|
+
"figure",
|
|
6410
|
+
{
|
|
6411
|
+
"data-slot": "quote",
|
|
6412
|
+
"data-variant": variant ?? "default",
|
|
6413
|
+
className: cn(quoteVariants({ variant }), className),
|
|
6414
|
+
...props,
|
|
6415
|
+
children: [
|
|
6416
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("blockquote", { "data-slot": "quote-blockquote", className: "ddga-quote__blockquote", cite, children: [
|
|
6417
|
+
mark,
|
|
6418
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteContent, { children })
|
|
6419
|
+
] }),
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(QuoteCaption, { children: [
|
|
6421
|
+
avatar != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "data-slot": "quote-avatar", "aria-hidden": "true", className: "ddga-quote__avatar", children: avatar }) : null,
|
|
6422
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ddga-quote__attribution", children: [
|
|
6423
|
+
author != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteAuthor, { children: author }) : null,
|
|
6424
|
+
byline != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ddga-quote__byline", children: byline }) : null,
|
|
6425
|
+
source != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(QuoteSource, { children: source }) : null
|
|
6426
|
+
] })
|
|
6427
|
+
] })
|
|
6428
|
+
]
|
|
6429
|
+
}
|
|
6430
|
+
);
|
|
6431
|
+
}
|
|
6432
|
+
function QuoteContent({ asChild, className, ...props }) {
|
|
6433
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "div";
|
|
6434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-content", className: cn("ddga-quote__content", className), ...props });
|
|
6435
|
+
}
|
|
6436
|
+
function QuoteCaption({ asChild, className, ...props }) {
|
|
6437
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "figcaption";
|
|
6438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-caption", className: cn("ddga-quote__caption", className), ...props });
|
|
6439
|
+
}
|
|
6440
|
+
function QuoteAuthor({ asChild, className, ...props }) {
|
|
6441
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "span";
|
|
6442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-author", className: cn("ddga-quote__author", className), ...props });
|
|
6443
|
+
}
|
|
6444
|
+
function QuoteSource({ asChild, className, ...props }) {
|
|
6445
|
+
const Comp = asChild ? import_radix_ui32.Slot.Slot : "cite";
|
|
6446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Comp, { "data-slot": "quote-source", className: cn("ddga-quote__source", className), ...props });
|
|
6447
|
+
}
|
|
6448
|
+
|
|
6449
|
+
// src/components/Collapsible/Collapsible.tsx
|
|
6450
|
+
var import_radix_ui33 = require("radix-ui");
|
|
6451
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
6452
|
+
function Collapsible({ className, ...props }) {
|
|
6453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6454
|
+
import_radix_ui33.Collapsible.Root,
|
|
6455
|
+
{
|
|
6456
|
+
"data-slot": "collapsible",
|
|
6457
|
+
className: cn("ddga-collapsible", className),
|
|
6458
|
+
...props
|
|
6459
|
+
}
|
|
6460
|
+
);
|
|
6461
|
+
}
|
|
6462
|
+
function CollapsibleTrigger({ className, ...props }) {
|
|
6463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6464
|
+
import_radix_ui33.Collapsible.Trigger,
|
|
6465
|
+
{
|
|
6466
|
+
"data-slot": "collapsible-trigger",
|
|
6467
|
+
className: cn("ddga-collapsible__trigger", className),
|
|
6468
|
+
...props
|
|
6469
|
+
}
|
|
6470
|
+
);
|
|
6471
|
+
}
|
|
6472
|
+
function CollapsibleContent({ className, children, ...props }) {
|
|
6473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6474
|
+
import_radix_ui33.Collapsible.Content,
|
|
6475
|
+
{
|
|
6476
|
+
"data-slot": "collapsible-content",
|
|
6477
|
+
className: cn("ddga-collapsible__content", className),
|
|
6478
|
+
...props,
|
|
6479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ddga-collapsible__content-inner", children })
|
|
6480
|
+
}
|
|
6481
|
+
);
|
|
6482
|
+
}
|
|
6483
|
+
|
|
6484
|
+
// src/components/TagInput/TagInput.tsx
|
|
6485
|
+
var import_react34 = require("react");
|
|
6486
|
+
var import_class_variance_authority47 = require("class-variance-authority");
|
|
6487
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6488
|
+
var tagInputVariants = (0, import_class_variance_authority47.cva)("ddga-tag-input", {
|
|
6489
|
+
variants: {
|
|
6490
|
+
size: {
|
|
6491
|
+
sm: "ddga-tag-input--sm",
|
|
6492
|
+
md: "ddga-tag-input--md",
|
|
6493
|
+
lg: "ddga-tag-input--lg"
|
|
6494
|
+
},
|
|
6495
|
+
error: {
|
|
6496
|
+
true: "ddga-tag-input--error"
|
|
6497
|
+
}
|
|
6498
|
+
},
|
|
6499
|
+
defaultVariants: {
|
|
6500
|
+
size: "md"
|
|
6501
|
+
}
|
|
6502
|
+
});
|
|
6503
|
+
function TagInput({
|
|
6504
|
+
id: externalId,
|
|
6505
|
+
value,
|
|
6506
|
+
defaultValue,
|
|
6507
|
+
onChange,
|
|
6508
|
+
label,
|
|
6509
|
+
helperText,
|
|
6510
|
+
errorMessage,
|
|
6511
|
+
error,
|
|
6512
|
+
size,
|
|
6513
|
+
disabled,
|
|
6514
|
+
placeholder,
|
|
6515
|
+
max,
|
|
6516
|
+
allowDuplicates = false,
|
|
6517
|
+
caseSensitive = false,
|
|
6518
|
+
validate,
|
|
6519
|
+
delimiters = [","],
|
|
6520
|
+
chipVariant = "secondary",
|
|
6521
|
+
removeLabel = (tag) => `Remove ${tag}`,
|
|
6522
|
+
formatAnnouncement = (tag, action) => `${tag} ${action === "add" ? "added" : "removed"}`,
|
|
6523
|
+
className,
|
|
6524
|
+
...props
|
|
6525
|
+
}) {
|
|
6526
|
+
const isControlled = value !== void 0;
|
|
6527
|
+
const [uncontrolledTags, setUncontrolledTags] = (0, import_react34.useState)(defaultValue ?? []);
|
|
6528
|
+
const tags = isControlled ? value : uncontrolledTags;
|
|
6529
|
+
const [draft, setDraft] = (0, import_react34.useState)("");
|
|
6530
|
+
const [announcement, setAnnouncement] = (0, import_react34.useState)("");
|
|
6531
|
+
const inputRef = (0, import_react34.useRef)(null);
|
|
6532
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
6533
|
+
name: "TagInput",
|
|
6534
|
+
id: externalId,
|
|
6535
|
+
label,
|
|
6536
|
+
error,
|
|
6537
|
+
errorMessage,
|
|
6538
|
+
helperText,
|
|
6539
|
+
"aria-label": props["aria-label"],
|
|
6540
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
6541
|
+
});
|
|
6542
|
+
const commit = (next) => {
|
|
6543
|
+
if (!isControlled) setUncontrolledTags(next);
|
|
6544
|
+
onChange?.(next);
|
|
6545
|
+
};
|
|
6546
|
+
const norm = (t) => caseSensitive ? t : t.toLowerCase();
|
|
6547
|
+
const accept = (raw, current) => {
|
|
6548
|
+
let next = current;
|
|
6549
|
+
for (const fragment of raw) {
|
|
6550
|
+
const trimmed = fragment.trim();
|
|
6551
|
+
if (!trimmed) continue;
|
|
6552
|
+
if (max !== void 0 && next.length >= max) break;
|
|
6553
|
+
if (!allowDuplicates && next.some((t) => norm(t) === norm(trimmed))) continue;
|
|
6554
|
+
if (validate && !validate(trimmed, next)) continue;
|
|
6555
|
+
next = [...next, trimmed];
|
|
6556
|
+
}
|
|
6557
|
+
return next;
|
|
6558
|
+
};
|
|
6559
|
+
const announceAdded = (added) => {
|
|
6560
|
+
if (added.length > 0) {
|
|
6561
|
+
setAnnouncement(added.map((t) => formatAnnouncement(t, "add")).join(", "));
|
|
6562
|
+
}
|
|
6563
|
+
};
|
|
6564
|
+
const commitDraft = () => {
|
|
6565
|
+
const next = accept([draft], tags);
|
|
6566
|
+
if (next.length > tags.length) {
|
|
6567
|
+
commit(next);
|
|
6568
|
+
announceAdded(next.slice(tags.length));
|
|
6569
|
+
setDraft("");
|
|
6570
|
+
}
|
|
6571
|
+
};
|
|
6572
|
+
const splitPaste = (text) => {
|
|
6573
|
+
const escaped = delimiters.map((d) => d.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&"));
|
|
6574
|
+
const pattern = new RegExp(`[${escaped.join("")}\\n\\r]`);
|
|
6575
|
+
return text.split(pattern);
|
|
6576
|
+
};
|
|
6577
|
+
const removeTag = (index) => {
|
|
6578
|
+
const removed = tags[index];
|
|
6579
|
+
commit(tags.filter((_, i) => i !== index));
|
|
6580
|
+
setAnnouncement(formatAnnouncement(removed, "remove"));
|
|
6581
|
+
inputRef.current?.focus();
|
|
6582
|
+
};
|
|
6583
|
+
const handleKeyDown = (event) => {
|
|
6584
|
+
if (disabled) return;
|
|
6585
|
+
if (event.key === "Enter") {
|
|
6586
|
+
event.preventDefault();
|
|
6587
|
+
if (draft.trim()) commitDraft();
|
|
6588
|
+
} else if (delimiters.includes(event.key)) {
|
|
6589
|
+
event.preventDefault();
|
|
6590
|
+
if (draft.trim()) commitDraft();
|
|
6591
|
+
} else if (event.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
6592
|
+
event.preventDefault();
|
|
6593
|
+
removeTag(tags.length - 1);
|
|
6594
|
+
}
|
|
6595
|
+
};
|
|
6596
|
+
const handlePaste = (event) => {
|
|
6597
|
+
if (disabled) return;
|
|
6598
|
+
const text = event.clipboardData.getData("text");
|
|
6599
|
+
const fragments = splitPaste(text);
|
|
6600
|
+
if (fragments.length <= 1) return;
|
|
6601
|
+
event.preventDefault();
|
|
6602
|
+
const next = accept(fragments, tags);
|
|
6603
|
+
if (next.length > tags.length) {
|
|
6604
|
+
commit(next);
|
|
6605
|
+
announceAdded(next.slice(tags.length));
|
|
6606
|
+
setDraft("");
|
|
6607
|
+
}
|
|
6608
|
+
};
|
|
6609
|
+
const handleBoxMouseDown = (event) => {
|
|
6610
|
+
const target = event.target;
|
|
6611
|
+
if (target === inputRef.current || target.closest("button")) return;
|
|
6612
|
+
event.preventDefault();
|
|
6613
|
+
inputRef.current?.focus();
|
|
6614
|
+
};
|
|
6615
|
+
const chipSize = size === "lg" ? "md" : "sm";
|
|
6616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { "data-slot": "tag-input-field", className: "ddga-field", children: [
|
|
6617
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { htmlFor: fieldId, className: "ddga-tag-input__label", children: label }),
|
|
6618
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
6619
|
+
"div",
|
|
6620
|
+
{
|
|
6621
|
+
"data-slot": "tag-input-control",
|
|
6622
|
+
className: cn(tagInputVariants({ size, error: hasError }), className),
|
|
6623
|
+
"data-disabled": disabled || void 0,
|
|
6624
|
+
onMouseDown: disabled ? void 0 : handleBoxMouseDown,
|
|
6625
|
+
children: [
|
|
6626
|
+
tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { "data-slot": "tag-input-list", className: "ddga-tag-input__list", role: "list", children: tags.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6627
|
+
"li",
|
|
6628
|
+
{
|
|
6629
|
+
"data-slot": "tag-input-item",
|
|
6630
|
+
className: "ddga-tag-input__item",
|
|
6631
|
+
role: "listitem",
|
|
6632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6633
|
+
Badge,
|
|
6634
|
+
{
|
|
6635
|
+
variant: chipVariant,
|
|
6636
|
+
size: chipSize,
|
|
6637
|
+
open: true,
|
|
6638
|
+
dismissible: !disabled,
|
|
6639
|
+
onDismiss: () => removeTag(index),
|
|
6640
|
+
closeLabel: removeLabel(tag),
|
|
6641
|
+
children: tag
|
|
6642
|
+
}
|
|
6643
|
+
)
|
|
6644
|
+
},
|
|
6645
|
+
`${tag}-${index}`
|
|
6646
|
+
)) }),
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6648
|
+
"input",
|
|
6649
|
+
{
|
|
6650
|
+
...props,
|
|
6651
|
+
...controlProps,
|
|
6652
|
+
ref: inputRef,
|
|
6653
|
+
"data-slot": "tag-input",
|
|
6654
|
+
className: "ddga-tag-input__field",
|
|
6655
|
+
type: "text",
|
|
6656
|
+
value: draft,
|
|
6657
|
+
disabled,
|
|
6658
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
6659
|
+
onChange: (event) => setDraft(event.target.value),
|
|
6660
|
+
onKeyDown: handleKeyDown,
|
|
6661
|
+
onPaste: handlePaste
|
|
6662
|
+
}
|
|
6663
|
+
)
|
|
6664
|
+
]
|
|
6665
|
+
}
|
|
6666
|
+
),
|
|
6667
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { "data-slot": "tag-input-live", className: "ddga-sr-only", role: "status", "aria-live": "polite", children: announcement }),
|
|
6668
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
6669
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
6670
|
+
] });
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
// src/providers/DgaProvider.tsx
|
|
6674
|
+
var import_react35 = require("react");
|
|
6675
|
+
var import_radix_ui34 = require("radix-ui");
|
|
6676
|
+
var import_tokens = require("@dev-dga/tokens");
|
|
6677
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5455
6678
|
function DgaProvider({
|
|
5456
6679
|
dir = "ltr",
|
|
5457
6680
|
locale,
|
|
@@ -5462,14 +6685,14 @@ function DgaProvider({
|
|
|
5462
6685
|
style: consumerStyle,
|
|
5463
6686
|
children
|
|
5464
6687
|
}) {
|
|
5465
|
-
const parentCtx = (0,
|
|
6688
|
+
const parentCtx = (0, import_react35.useContext)(DgaContext);
|
|
5466
6689
|
const isNested = parentCtx !== null;
|
|
5467
|
-
const [rootEl, setRootEl] = (0,
|
|
5468
|
-
const portalRef = (0,
|
|
5469
|
-
const [portalEl, setPortalEl] = (0,
|
|
6690
|
+
const [rootEl, setRootEl] = (0, import_react35.useState)(null);
|
|
6691
|
+
const portalRef = (0, import_react35.useRef)(null);
|
|
6692
|
+
const [portalEl, setPortalEl] = (0, import_react35.useState)(null);
|
|
5470
6693
|
const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
|
|
5471
|
-
const themeVars = (0,
|
|
5472
|
-
(0,
|
|
6694
|
+
const themeVars = (0, import_react35.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
|
|
6695
|
+
(0, import_react35.useEffect)(() => {
|
|
5473
6696
|
if (typeof document === "undefined") return;
|
|
5474
6697
|
const el = document.createElement("div");
|
|
5475
6698
|
el.setAttribute("data-slot", "dga-portal");
|
|
@@ -5484,7 +6707,7 @@ function DgaProvider({
|
|
|
5484
6707
|
setPortalEl(null);
|
|
5485
6708
|
};
|
|
5486
6709
|
}, []);
|
|
5487
|
-
(0,
|
|
6710
|
+
(0, import_react35.useEffect)(() => {
|
|
5488
6711
|
const el = portalRef.current;
|
|
5489
6712
|
if (!el) return;
|
|
5490
6713
|
el.setAttribute("data-theme", mode);
|
|
@@ -5496,12 +6719,12 @@ function DgaProvider({
|
|
|
5496
6719
|
}
|
|
5497
6720
|
}
|
|
5498
6721
|
}, [mode, dir, themeVars, portalEl]);
|
|
5499
|
-
const ctxValue = (0,
|
|
6722
|
+
const ctxValue = (0, import_react35.useMemo)(
|
|
5500
6723
|
() => ({ dir, locale: resolvedLocale, mode, rootEl, portalEl }),
|
|
5501
6724
|
[dir, resolvedLocale, mode, rootEl, portalEl]
|
|
5502
6725
|
);
|
|
5503
|
-
const inner = /* @__PURE__ */ (0,
|
|
5504
|
-
return /* @__PURE__ */ (0,
|
|
6726
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_radix_ui34.Direction.Provider, { dir, children });
|
|
6727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5505
6728
|
Component,
|
|
5506
6729
|
{
|
|
5507
6730
|
ref: setRootEl,
|
|
@@ -5511,7 +6734,7 @@ function DgaProvider({
|
|
|
5511
6734
|
"data-theme": mode,
|
|
5512
6735
|
className,
|
|
5513
6736
|
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
5514
|
-
children: isNested ? inner : /* @__PURE__ */ (0,
|
|
6737
|
+
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_radix_ui34.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
5515
6738
|
}
|
|
5516
6739
|
) });
|
|
5517
6740
|
}
|
|
@@ -5546,10 +6769,21 @@ function DgaProvider({
|
|
|
5546
6769
|
CardTitle,
|
|
5547
6770
|
Checkbox,
|
|
5548
6771
|
CircularProgress,
|
|
6772
|
+
Collapsible,
|
|
6773
|
+
CollapsibleContent,
|
|
6774
|
+
CollapsibleTrigger,
|
|
5549
6775
|
Combobox,
|
|
5550
6776
|
ComboboxGroup,
|
|
5551
6777
|
ComboboxItem,
|
|
5552
6778
|
ComboboxSeparator,
|
|
6779
|
+
Command,
|
|
6780
|
+
CommandDialog,
|
|
6781
|
+
CommandEmpty,
|
|
6782
|
+
CommandGroup,
|
|
6783
|
+
CommandInput,
|
|
6784
|
+
CommandItem,
|
|
6785
|
+
CommandList,
|
|
6786
|
+
CommandSeparator,
|
|
5553
6787
|
DatePicker,
|
|
5554
6788
|
DescriptionDetails,
|
|
5555
6789
|
DescriptionItem,
|
|
@@ -5587,6 +6821,13 @@ function DgaProvider({
|
|
|
5587
6821
|
FieldMessage,
|
|
5588
6822
|
FileUpload,
|
|
5589
6823
|
Input,
|
|
6824
|
+
InputOTP,
|
|
6825
|
+
Link,
|
|
6826
|
+
List,
|
|
6827
|
+
ListItem,
|
|
6828
|
+
ListItemAction,
|
|
6829
|
+
ListItemContent,
|
|
6830
|
+
ListItemIcon,
|
|
5590
6831
|
Menubar,
|
|
5591
6832
|
MenubarCheckboxItem,
|
|
5592
6833
|
MenubarContent,
|
|
@@ -5623,10 +6864,16 @@ function DgaProvider({
|
|
|
5623
6864
|
PopoverContent,
|
|
5624
6865
|
PopoverTrigger,
|
|
5625
6866
|
Progress,
|
|
6867
|
+
Quote,
|
|
6868
|
+
QuoteAuthor,
|
|
6869
|
+
QuoteCaption,
|
|
6870
|
+
QuoteContent,
|
|
6871
|
+
QuoteSource,
|
|
5626
6872
|
Radio,
|
|
5627
6873
|
RadioGroup,
|
|
5628
6874
|
Rating,
|
|
5629
6875
|
ScrollArea,
|
|
6876
|
+
SearchBox,
|
|
5630
6877
|
Select,
|
|
5631
6878
|
SelectItem,
|
|
5632
6879
|
Sidebar,
|
|
@@ -5656,6 +6903,7 @@ function DgaProvider({
|
|
|
5656
6903
|
Spinner,
|
|
5657
6904
|
Stat,
|
|
5658
6905
|
StatChange,
|
|
6906
|
+
StatChart,
|
|
5659
6907
|
StatGroup,
|
|
5660
6908
|
StatLabel,
|
|
5661
6909
|
StatValue,
|
|
@@ -5665,10 +6913,19 @@ function DgaProvider({
|
|
|
5665
6913
|
StepTitle,
|
|
5666
6914
|
Steps,
|
|
5667
6915
|
Switch,
|
|
6916
|
+
Table,
|
|
6917
|
+
TableBody,
|
|
6918
|
+
TableCaption,
|
|
6919
|
+
TableCell,
|
|
6920
|
+
TableFooter,
|
|
6921
|
+
TableHead,
|
|
6922
|
+
TableHeader,
|
|
6923
|
+
TableRow,
|
|
5668
6924
|
Tabs,
|
|
5669
6925
|
TabsContent,
|
|
5670
6926
|
TabsList,
|
|
5671
6927
|
TabsTrigger,
|
|
6928
|
+
TagInput,
|
|
5672
6929
|
Textarea,
|
|
5673
6930
|
Timeline,
|
|
5674
6931
|
TimelineContent,
|
|
@@ -5696,6 +6953,7 @@ function DgaProvider({
|
|
|
5696
6953
|
cn,
|
|
5697
6954
|
comboboxTriggerVariants,
|
|
5698
6955
|
comboboxVariants,
|
|
6956
|
+
commandVariants,
|
|
5699
6957
|
createToast,
|
|
5700
6958
|
createToastStore,
|
|
5701
6959
|
datePickerVariants,
|
|
@@ -5704,7 +6962,10 @@ function DgaProvider({
|
|
|
5704
6962
|
drawerVariants,
|
|
5705
6963
|
dropdownMenuVariants,
|
|
5706
6964
|
emptyStateVariants,
|
|
6965
|
+
inputOTPVariants,
|
|
5707
6966
|
inputVariants,
|
|
6967
|
+
linkVariants,
|
|
6968
|
+
listVariants,
|
|
5708
6969
|
menubarContentVariants,
|
|
5709
6970
|
menubarTriggerVariants,
|
|
5710
6971
|
modalContentVariants,
|
|
@@ -5713,6 +6974,7 @@ function DgaProvider({
|
|
|
5713
6974
|
paginationVariants,
|
|
5714
6975
|
popoverContentVariants,
|
|
5715
6976
|
progressVariants,
|
|
6977
|
+
quoteVariants,
|
|
5716
6978
|
radioGroupVariants,
|
|
5717
6979
|
radioVariants,
|
|
5718
6980
|
ratingVariants,
|
|
@@ -5728,8 +6990,10 @@ function DgaProvider({
|
|
|
5728
6990
|
stepVariants,
|
|
5729
6991
|
stepsVariants,
|
|
5730
6992
|
switchVariants,
|
|
6993
|
+
tableVariants,
|
|
5731
6994
|
tabsListVariants,
|
|
5732
6995
|
tabsVariants,
|
|
6996
|
+
tagInputVariants,
|
|
5733
6997
|
textareaVariants,
|
|
5734
6998
|
timelineMarkerVariants,
|
|
5735
6999
|
timelineVariants,
|