@dev-dga/react 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +2 -2
- package/dist/index.cjs +1322 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +302 -11
- package/dist/index.d.ts +302 -11
- package/dist/index.js +1327 -18
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
package/dist/index.cjs
CHANGED
|
@@ -53,6 +53,11 @@ __export(src_exports, {
|
|
|
53
53
|
ComboboxGroup: () => ComboboxGroup,
|
|
54
54
|
ComboboxItem: () => ComboboxItem,
|
|
55
55
|
ComboboxSeparator: () => ComboboxSeparator,
|
|
56
|
+
DatePicker: () => DatePicker,
|
|
57
|
+
DescriptionDetails: () => DescriptionDetails,
|
|
58
|
+
DescriptionItem: () => DescriptionItem,
|
|
59
|
+
DescriptionList: () => DescriptionList,
|
|
60
|
+
DescriptionTerm: () => DescriptionTerm,
|
|
56
61
|
DgaProvider: () => DgaProvider,
|
|
57
62
|
Divider: () => Divider,
|
|
58
63
|
Drawer: () => Drawer,
|
|
@@ -78,6 +83,7 @@ __export(src_exports, {
|
|
|
78
83
|
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
79
84
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
80
85
|
FieldMessage: () => FieldMessage,
|
|
86
|
+
FileUpload: () => FileUpload,
|
|
81
87
|
Input: () => Input,
|
|
82
88
|
Modal: () => Modal,
|
|
83
89
|
ModalClose: () => ModalClose,
|
|
@@ -87,6 +93,7 @@ __export(src_exports, {
|
|
|
87
93
|
ModalHeader: () => ModalHeader,
|
|
88
94
|
ModalTitle: () => ModalTitle,
|
|
89
95
|
ModalTrigger: () => ModalTrigger,
|
|
96
|
+
NumberInput: () => NumberInput,
|
|
90
97
|
Pagination: () => Pagination,
|
|
91
98
|
PaginationContent: () => PaginationContent,
|
|
92
99
|
PaginationEllipsis: () => PaginationEllipsis,
|
|
@@ -97,9 +104,11 @@ __export(src_exports, {
|
|
|
97
104
|
Progress: () => Progress,
|
|
98
105
|
Radio: () => Radio,
|
|
99
106
|
RadioGroup: () => RadioGroup,
|
|
107
|
+
Rating: () => Rating,
|
|
100
108
|
Select: () => Select,
|
|
101
109
|
SelectItem: () => SelectItem,
|
|
102
110
|
Skeleton: () => Skeleton,
|
|
111
|
+
Slider: () => Slider,
|
|
103
112
|
Spinner: () => Spinner,
|
|
104
113
|
Step: () => Step,
|
|
105
114
|
StepDescription: () => StepDescription,
|
|
@@ -113,6 +122,9 @@ __export(src_exports, {
|
|
|
113
122
|
TabsTrigger: () => TabsTrigger,
|
|
114
123
|
Textarea: () => Textarea,
|
|
115
124
|
Toaster: () => Toaster,
|
|
125
|
+
Toggle: () => Toggle,
|
|
126
|
+
ToggleGroup: () => ToggleGroup,
|
|
127
|
+
ToggleGroupItem: () => ToggleGroupItem,
|
|
116
128
|
Tooltip: () => Tooltip,
|
|
117
129
|
TooltipContent: () => TooltipContent,
|
|
118
130
|
TooltipTrigger: () => TooltipTrigger,
|
|
@@ -130,18 +142,23 @@ __export(src_exports, {
|
|
|
130
142
|
comboboxVariants: () => comboboxVariants,
|
|
131
143
|
createToast: () => createToast,
|
|
132
144
|
createToastStore: () => createToastStore,
|
|
145
|
+
datePickerVariants: () => datePickerVariants,
|
|
146
|
+
descriptionListVariants: () => descriptionListVariants,
|
|
133
147
|
dividerVariants: () => dividerVariants,
|
|
134
148
|
drawerVariants: () => drawerVariants,
|
|
135
149
|
dropdownMenuVariants: () => dropdownMenuVariants,
|
|
136
150
|
inputVariants: () => inputVariants,
|
|
137
151
|
modalContentVariants: () => modalContentVariants,
|
|
152
|
+
numberInputVariants: () => numberInputVariants,
|
|
138
153
|
paginationLinkVariants: () => paginationLinkVariants,
|
|
139
154
|
paginationVariants: () => paginationVariants,
|
|
140
155
|
progressVariants: () => progressVariants,
|
|
141
156
|
radioGroupVariants: () => radioGroupVariants,
|
|
142
157
|
radioVariants: () => radioVariants,
|
|
158
|
+
ratingVariants: () => ratingVariants,
|
|
143
159
|
selectTriggerVariants: () => selectTriggerVariants,
|
|
144
160
|
skeletonVariants: () => skeletonVariants,
|
|
161
|
+
sliderVariants: () => sliderVariants,
|
|
145
162
|
spinnerVariants: () => spinnerVariants,
|
|
146
163
|
stepVariants: () => stepVariants,
|
|
147
164
|
stepsVariants: () => stepsVariants,
|
|
@@ -153,6 +170,8 @@ __export(src_exports, {
|
|
|
153
170
|
toastStore: () => toastStore,
|
|
154
171
|
toastVariants: () => toastVariants,
|
|
155
172
|
toastViewportVariants: () => toastViewportVariants,
|
|
173
|
+
toggleGroupVariants: () => toggleGroupVariants,
|
|
174
|
+
toggleVariants: () => toggleVariants,
|
|
156
175
|
tooltipContentVariants: () => tooltipContentVariants,
|
|
157
176
|
useDga: () => useDga,
|
|
158
177
|
useDir: () => useDir,
|
|
@@ -676,6 +695,47 @@ function ChevronRight(props) {
|
|
|
676
695
|
}
|
|
677
696
|
);
|
|
678
697
|
}
|
|
698
|
+
function ChevronLeft(props) {
|
|
699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
700
|
+
"svg",
|
|
701
|
+
{
|
|
702
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
703
|
+
width: "1em",
|
|
704
|
+
height: "1em",
|
|
705
|
+
viewBox: "0 0 24 24",
|
|
706
|
+
fill: "none",
|
|
707
|
+
stroke: "currentColor",
|
|
708
|
+
strokeWidth: "2",
|
|
709
|
+
strokeLinecap: "round",
|
|
710
|
+
strokeLinejoin: "round",
|
|
711
|
+
...props,
|
|
712
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m15 18-6-6 6-6" })
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
function CalendarIcon(props) {
|
|
717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
718
|
+
"svg",
|
|
719
|
+
{
|
|
720
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
721
|
+
width: "1em",
|
|
722
|
+
height: "1em",
|
|
723
|
+
viewBox: "0 0 24 24",
|
|
724
|
+
fill: "none",
|
|
725
|
+
stroke: "currentColor",
|
|
726
|
+
strokeWidth: "2",
|
|
727
|
+
strokeLinecap: "round",
|
|
728
|
+
strokeLinejoin: "round",
|
|
729
|
+
...props,
|
|
730
|
+
children: [
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "16", x2: "16", y1: "2", y2: "6" }),
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "8", x2: "8", y1: "2", y2: "6" }),
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "3", x2: "21", y1: "10", y2: "10" })
|
|
735
|
+
]
|
|
736
|
+
}
|
|
737
|
+
);
|
|
738
|
+
}
|
|
679
739
|
function MoreHorizontal(props) {
|
|
680
740
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
681
741
|
"svg",
|
|
@@ -695,6 +755,64 @@ function MoreHorizontal(props) {
|
|
|
695
755
|
}
|
|
696
756
|
);
|
|
697
757
|
}
|
|
758
|
+
function Plus(props) {
|
|
759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
760
|
+
"svg",
|
|
761
|
+
{
|
|
762
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
763
|
+
width: "1em",
|
|
764
|
+
height: "1em",
|
|
765
|
+
viewBox: "0 0 24 24",
|
|
766
|
+
fill: "none",
|
|
767
|
+
stroke: "currentColor",
|
|
768
|
+
strokeWidth: "3",
|
|
769
|
+
strokeLinecap: "round",
|
|
770
|
+
strokeLinejoin: "round",
|
|
771
|
+
...props,
|
|
772
|
+
children: [
|
|
773
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 5v14" }),
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5 12h14" })
|
|
775
|
+
]
|
|
776
|
+
}
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
function Star(props) {
|
|
780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
781
|
+
"svg",
|
|
782
|
+
{
|
|
783
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
784
|
+
width: "1em",
|
|
785
|
+
height: "1em",
|
|
786
|
+
viewBox: "0 0 24 24",
|
|
787
|
+
fill: "currentColor",
|
|
788
|
+
stroke: "none",
|
|
789
|
+
...props,
|
|
790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
|
|
791
|
+
}
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
function Upload(props) {
|
|
795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
796
|
+
"svg",
|
|
797
|
+
{
|
|
798
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
799
|
+
width: "1em",
|
|
800
|
+
height: "1em",
|
|
801
|
+
viewBox: "0 0 24 24",
|
|
802
|
+
fill: "none",
|
|
803
|
+
stroke: "currentColor",
|
|
804
|
+
strokeWidth: "2",
|
|
805
|
+
strokeLinecap: "round",
|
|
806
|
+
strokeLinejoin: "round",
|
|
807
|
+
...props,
|
|
808
|
+
children: [
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M17 8l-5-5-5 5" }),
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 3v12" })
|
|
812
|
+
]
|
|
813
|
+
}
|
|
814
|
+
);
|
|
815
|
+
}
|
|
698
816
|
|
|
699
817
|
// src/components/Checkbox/Checkbox.tsx
|
|
700
818
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -981,7 +1099,7 @@ function Select({
|
|
|
981
1099
|
"aria-labelledby": rootProps["aria-labelledby"]
|
|
982
1100
|
});
|
|
983
1101
|
const ctx = (0, import_react5.useContext)(DgaContext);
|
|
984
|
-
const portalContainer = ctx?.rootEl ?? void 0;
|
|
1102
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
985
1103
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-slot": "select-field", className: "ddga-field", children: [
|
|
986
1104
|
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { htmlFor: fieldId, className: "ddga-select__label", children: [
|
|
987
1105
|
label,
|
|
@@ -1400,7 +1518,7 @@ function TooltipContent({
|
|
|
1400
1518
|
...props
|
|
1401
1519
|
}) {
|
|
1402
1520
|
const ctx = (0, import_react8.useContext)(DgaContext);
|
|
1403
|
-
const portalContainer = ctx?.rootEl ?? void 0;
|
|
1521
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
1404
1522
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_radix_ui9.Tooltip.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1405
1523
|
import_radix_ui9.Tooltip.Content,
|
|
1406
1524
|
{
|
|
@@ -1543,7 +1661,7 @@ function ModalContent({
|
|
|
1543
1661
|
...props
|
|
1544
1662
|
}) {
|
|
1545
1663
|
const ctx = (0, import_react10.useContext)(DgaContext);
|
|
1546
|
-
const portalContainer = ctx?.rootEl ?? void 0;
|
|
1664
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
1547
1665
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_radix_ui11.Dialog.Portal, { container: portalContainer, children: [
|
|
1548
1666
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_radix_ui11.Dialog.Overlay, { className: "ddga-modal__overlay", "data-slot": "modal-overlay" }),
|
|
1549
1667
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
@@ -2441,7 +2559,7 @@ function DropdownMenuContent({
|
|
|
2441
2559
|
...props
|
|
2442
2560
|
}) {
|
|
2443
2561
|
const ctx = (0, import_react13.useContext)(DgaContext);
|
|
2444
|
-
const portalContainer = ctx?.rootEl ?? void 0;
|
|
2562
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2445
2563
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2446
2564
|
import_radix_ui18.DropdownMenu.Content,
|
|
2447
2565
|
{
|
|
@@ -2572,7 +2690,7 @@ function DropdownMenuSubTrigger({
|
|
|
2572
2690
|
}
|
|
2573
2691
|
function DropdownMenuSubContent({ size, className, ...props }) {
|
|
2574
2692
|
const ctx = (0, import_react13.useContext)(DgaContext);
|
|
2575
|
-
const portalContainer = ctx?.rootEl ?? void 0;
|
|
2693
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2576
2694
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2577
2695
|
import_radix_ui18.DropdownMenu.SubContent,
|
|
2578
2696
|
{
|
|
@@ -2624,7 +2742,7 @@ function DrawerContent({
|
|
|
2624
2742
|
...props
|
|
2625
2743
|
}) {
|
|
2626
2744
|
const ctx = (0, import_react14.useContext)(DgaContext);
|
|
2627
|
-
const portalContainer = ctx?.rootEl ?? void 0;
|
|
2745
|
+
const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
|
|
2628
2746
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_radix_ui19.Dialog.Portal, { container: portalContainer, children: [
|
|
2629
2747
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_radix_ui19.Dialog.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
|
|
2630
2748
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
@@ -2789,7 +2907,7 @@ function Combobox({
|
|
|
2789
2907
|
"aria-labelledby": ariaLabelledBy
|
|
2790
2908
|
});
|
|
2791
2909
|
const providerCtx = (0, import_react15.useContext)(DgaContext);
|
|
2792
|
-
const portalContainer = providerCtx?.rootEl ?? void 0;
|
|
2910
|
+
const portalContainer = providerCtx?.portalEl ?? providerCtx?.rootEl ?? void 0;
|
|
2793
2911
|
const triggerLabel = (0, import_react15.useMemo)(() => {
|
|
2794
2912
|
if (value === void 0) return null;
|
|
2795
2913
|
if (getLabel) return getLabel(value);
|
|
@@ -2914,11 +3032,1149 @@ function ComboboxSeparator({ className, ...props }) {
|
|
|
2914
3032
|
);
|
|
2915
3033
|
}
|
|
2916
3034
|
|
|
2917
|
-
// src/
|
|
3035
|
+
// src/components/DatePicker/DatePicker.tsx
|
|
2918
3036
|
var import_react16 = require("react");
|
|
3037
|
+
var import_react_aria_components = require("react-aria-components");
|
|
3038
|
+
var import_date = require("@internationalized/date");
|
|
3039
|
+
var import_class_variance_authority27 = require("class-variance-authority");
|
|
3040
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3041
|
+
var datePickerTriggerVariants = (0, import_class_variance_authority27.cva)("ddga-date-picker-trigger", {
|
|
3042
|
+
variants: {
|
|
3043
|
+
size: {
|
|
3044
|
+
sm: "ddga-date-picker-trigger--sm",
|
|
3045
|
+
md: "ddga-date-picker-trigger--md"
|
|
3046
|
+
},
|
|
3047
|
+
error: {
|
|
3048
|
+
true: "ddga-date-picker-trigger--error"
|
|
3049
|
+
}
|
|
3050
|
+
},
|
|
3051
|
+
defaultVariants: {
|
|
3052
|
+
size: "md"
|
|
3053
|
+
}
|
|
3054
|
+
});
|
|
3055
|
+
var datePickerVariants = datePickerTriggerVariants;
|
|
3056
|
+
function dateToCalendarDate(date) {
|
|
3057
|
+
if (!date) return null;
|
|
3058
|
+
return new import_date.CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
3059
|
+
}
|
|
3060
|
+
function calendarDateToDate(value) {
|
|
3061
|
+
if (!value) return null;
|
|
3062
|
+
const greg = value.calendar.identifier === "gregory" ? value : (0, import_date.toCalendar)(value, new import_date.GregorianCalendar());
|
|
3063
|
+
return new Date(greg.year, greg.month - 1, greg.day);
|
|
3064
|
+
}
|
|
3065
|
+
function composeLocale(dgaLocale, calendar) {
|
|
3066
|
+
const base = dgaLocale === "ar" ? "ar-SA" : dgaLocale === "en" ? "en-US" : dgaLocale;
|
|
3067
|
+
const isArabic = base.startsWith("ar");
|
|
3068
|
+
if (calendar === "hijri") {
|
|
3069
|
+
return isArabic ? `${base}-u-ca-islamic-umalqura-nu-latn` : `${base}-u-ca-islamic-umalqura`;
|
|
3070
|
+
}
|
|
3071
|
+
return isArabic ? `${base}-u-nu-latn` : base;
|
|
3072
|
+
}
|
|
3073
|
+
var GREGORIAN = new import_date.GregorianCalendar();
|
|
3074
|
+
var ISLAMIC_UMALQURA = new import_date.IslamicUmalquraCalendar();
|
|
3075
|
+
function secondaryDayNumber(date, mainCalendar) {
|
|
3076
|
+
const other = mainCalendar === "hijri" ? GREGORIAN : ISLAMIC_UMALQURA;
|
|
3077
|
+
return (0, import_date.toCalendar)(date, other).day;
|
|
3078
|
+
}
|
|
3079
|
+
function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
|
|
3080
|
+
const state = (0, import_react16.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3081
|
+
const focusedDate = state?.focusedDate ?? null;
|
|
3082
|
+
const focusedYear = focusedDate?.year ?? 0;
|
|
3083
|
+
const focusedCalendar = focusedDate?.calendar ?? GREGORIAN;
|
|
3084
|
+
const minValue = state?.minValue ?? null;
|
|
3085
|
+
const maxValue = state?.maxValue ?? null;
|
|
3086
|
+
const monthNames = (0, import_react16.useMemo)(() => {
|
|
3087
|
+
if (!focusedDate) return [];
|
|
3088
|
+
const fmt = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
3089
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
3090
|
+
const cd = new import_date.CalendarDate(focusedCalendar, focusedYear, i + 1, 1);
|
|
3091
|
+
const greg = (0, import_date.toCalendar)(cd, GREGORIAN);
|
|
3092
|
+
const js = new Date(greg.year, greg.month - 1, greg.day);
|
|
3093
|
+
return fmt.format(js);
|
|
3094
|
+
});
|
|
3095
|
+
}, [locale, focusedDate, focusedCalendar, focusedYear]);
|
|
3096
|
+
const yearOptions = (0, import_react16.useMemo)(() => {
|
|
3097
|
+
if (!focusedDate) return [];
|
|
3098
|
+
const minY = minValue ? (0, import_date.toCalendar)(minValue, focusedCalendar).year : focusedYear - 100;
|
|
3099
|
+
const maxY = maxValue ? (0, import_date.toCalendar)(maxValue, focusedCalendar).year : focusedYear + 30;
|
|
3100
|
+
const start = Math.min(minY, focusedYear);
|
|
3101
|
+
const end = Math.max(maxY, focusedYear);
|
|
3102
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
3103
|
+
}, [focusedDate, focusedCalendar, focusedYear, minValue, maxValue]);
|
|
3104
|
+
if (!state || !focusedDate) return null;
|
|
3105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "ddga-date-picker-calendar__nav-selects", "data-slot": "date-picker-calendar-nav", children: [
|
|
3106
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3107
|
+
"select",
|
|
3108
|
+
{
|
|
3109
|
+
"aria-label": monthLabel,
|
|
3110
|
+
className: "ddga-date-picker-calendar__select ddga-date-picker-calendar__month-select",
|
|
3111
|
+
"data-slot": "date-picker-month-select",
|
|
3112
|
+
value: focusedDate.month,
|
|
3113
|
+
onChange: (e) => state.setFocusedDate(focusedDate.set({ month: Number(e.target.value) })),
|
|
3114
|
+
children: monthNames.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: i + 1, children: name }, i + 1))
|
|
3115
|
+
}
|
|
3116
|
+
),
|
|
3117
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3118
|
+
"select",
|
|
3119
|
+
{
|
|
3120
|
+
"aria-label": yearLabel,
|
|
3121
|
+
className: "ddga-date-picker-calendar__select ddga-date-picker-calendar__year-select",
|
|
3122
|
+
"data-slot": "date-picker-year-select",
|
|
3123
|
+
value: focusedDate.year,
|
|
3124
|
+
onChange: (e) => state.setFocusedDate(focusedDate.set({ year: Number(e.target.value) })),
|
|
3125
|
+
children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: y, children: y }, y))
|
|
3126
|
+
}
|
|
3127
|
+
)
|
|
3128
|
+
] });
|
|
3129
|
+
}
|
|
3130
|
+
function CalendarDayCell({ date, showSecondary, calendarSystem }) {
|
|
3131
|
+
const state = (0, import_react16.useContext)(import_react_aria_components.CalendarStateContext);
|
|
3132
|
+
const start = state?.visibleRange.start;
|
|
3133
|
+
const isOutside = !!start && (date.year !== start.year || date.month !== start.month);
|
|
3134
|
+
const isOutOfBounds = state ? state.isInvalid(date) : false;
|
|
3135
|
+
if (state && isOutside && !isOutOfBounds) {
|
|
3136
|
+
const selected = state.value;
|
|
3137
|
+
const isSelected = !!selected && selected.year === date.year && selected.month === date.month && selected.day === date.day;
|
|
3138
|
+
const handleSelect = () => {
|
|
3139
|
+
state.setFocusedDate(date);
|
|
3140
|
+
state.selectDate(date);
|
|
3141
|
+
};
|
|
3142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("td", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3143
|
+
"button",
|
|
3144
|
+
{
|
|
3145
|
+
type: "button",
|
|
3146
|
+
tabIndex: -1,
|
|
3147
|
+
className: "ddga-date-picker-calendar__cell",
|
|
3148
|
+
"data-outside-month": "",
|
|
3149
|
+
"data-selected": isSelected ? "" : void 0,
|
|
3150
|
+
"data-slot": "date-picker-day-cell",
|
|
3151
|
+
onClick: handleSelect,
|
|
3152
|
+
children: showSecondary ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-date-picker-calendar__cell-primary", children: date.day }),
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
|
|
3155
|
+
] }) : String(date.day)
|
|
3156
|
+
}
|
|
3157
|
+
) });
|
|
3158
|
+
}
|
|
3159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.CalendarCell, { date, className: "ddga-date-picker-calendar__cell", children: ({ formattedDate }) => showSecondary ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-date-picker-calendar__cell-primary", children: formattedDate }),
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
|
|
3162
|
+
] }) : formattedDate });
|
|
3163
|
+
}
|
|
3164
|
+
function DatePicker({
|
|
3165
|
+
value: controlledValue,
|
|
3166
|
+
defaultValue,
|
|
3167
|
+
onChange,
|
|
3168
|
+
minValue,
|
|
3169
|
+
maxValue,
|
|
3170
|
+
label,
|
|
3171
|
+
helperText,
|
|
3172
|
+
errorMessage,
|
|
3173
|
+
error,
|
|
3174
|
+
required,
|
|
3175
|
+
disabled,
|
|
3176
|
+
size,
|
|
3177
|
+
id,
|
|
3178
|
+
className,
|
|
3179
|
+
"aria-label": ariaLabel,
|
|
3180
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3181
|
+
calendar: controlledCalendar,
|
|
3182
|
+
defaultCalendar = "gregorian",
|
|
3183
|
+
onCalendarChange,
|
|
3184
|
+
showCalendarToggle = true,
|
|
3185
|
+
calendarLabels,
|
|
3186
|
+
showSecondaryCalendar = false
|
|
3187
|
+
}) {
|
|
3188
|
+
const isValueControlled = controlledValue !== void 0;
|
|
3189
|
+
const [internalValue, setInternalValue] = (0, import_react16.useState)(
|
|
3190
|
+
() => dateToCalendarDate(defaultValue)
|
|
3191
|
+
);
|
|
3192
|
+
const value = isValueControlled ? dateToCalendarDate(controlledValue) : internalValue;
|
|
3193
|
+
const handleAriaChange = (0, import_react16.useCallback)(
|
|
3194
|
+
(next) => {
|
|
3195
|
+
const nextCD = next ? new import_date.CalendarDate(next.year, next.month, next.day) : null;
|
|
3196
|
+
if (!isValueControlled) setInternalValue(nextCD);
|
|
3197
|
+
onChange?.(calendarDateToDate(nextCD));
|
|
3198
|
+
},
|
|
3199
|
+
[isValueControlled, onChange]
|
|
3200
|
+
);
|
|
3201
|
+
const isCalendarControlled = controlledCalendar !== void 0;
|
|
3202
|
+
const [internalCalendar, setInternalCalendar] = (0, import_react16.useState)(defaultCalendar);
|
|
3203
|
+
const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
|
|
3204
|
+
const setCalendar = (0, import_react16.useCallback)(
|
|
3205
|
+
(next) => {
|
|
3206
|
+
if (!isCalendarControlled) setInternalCalendar(next);
|
|
3207
|
+
onCalendarChange?.(next);
|
|
3208
|
+
},
|
|
3209
|
+
[isCalendarControlled, onCalendarChange]
|
|
3210
|
+
);
|
|
3211
|
+
const dgaCtx = (0, import_react16.useContext)(DgaContext);
|
|
3212
|
+
const dgaLocale = dgaCtx?.locale ?? "en";
|
|
3213
|
+
const ariaLocale = (0, import_react16.useMemo)(
|
|
3214
|
+
() => composeLocale(dgaLocale, calendarSystem),
|
|
3215
|
+
[dgaLocale, calendarSystem]
|
|
3216
|
+
);
|
|
3217
|
+
const portalContainer = dgaCtx?.portalEl ?? dgaCtx?.rootEl ?? void 0;
|
|
3218
|
+
const dgaDir = dgaCtx?.dir ?? "ltr";
|
|
3219
|
+
const PrevChevron = dgaDir === "rtl" ? ChevronRight : ChevronLeft;
|
|
3220
|
+
const NextChevron = dgaDir === "rtl" ? ChevronLeft : ChevronRight;
|
|
3221
|
+
const resolvedLabels = (0, import_react16.useMemo)(() => {
|
|
3222
|
+
if (calendarLabels) return calendarLabels;
|
|
3223
|
+
const isArabic = dgaLocale.startsWith("ar");
|
|
3224
|
+
return isArabic ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
|
|
3225
|
+
}, [calendarLabels, dgaLocale]);
|
|
3226
|
+
const navLabels = (0, import_react16.useMemo)(
|
|
3227
|
+
() => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
|
|
3228
|
+
[dgaLocale]
|
|
3229
|
+
);
|
|
3230
|
+
const ariaMinValue = (0, import_react16.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
|
|
3231
|
+
const ariaMaxValue = (0, import_react16.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
|
|
3232
|
+
const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : "Date");
|
|
3233
|
+
const showToggle = showCalendarToggle && !isCalendarControlled;
|
|
3234
|
+
const hasError = !!error;
|
|
3235
|
+
const hasErrorMessage = hasError && errorMessage != null && errorMessage !== "";
|
|
3236
|
+
const hasHelper = !hasErrorMessage && helperText != null && helperText !== "";
|
|
3237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.I18nProvider, { locale: ariaLocale, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3238
|
+
import_react_aria_components.DatePicker,
|
|
3239
|
+
{
|
|
3240
|
+
value,
|
|
3241
|
+
onChange: handleAriaChange,
|
|
3242
|
+
minValue: ariaMinValue,
|
|
3243
|
+
maxValue: ariaMaxValue,
|
|
3244
|
+
isRequired: required,
|
|
3245
|
+
isDisabled: disabled,
|
|
3246
|
+
isInvalid: hasError,
|
|
3247
|
+
shouldCloseOnSelect: true,
|
|
3248
|
+
id,
|
|
3249
|
+
"aria-label": ariaLabel,
|
|
3250
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3251
|
+
className: "ddga-field",
|
|
3252
|
+
"data-slot": "date-picker-field",
|
|
3253
|
+
children: [
|
|
3254
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_aria_components.Label, { className: "ddga-date-picker__label", children: [
|
|
3255
|
+
label,
|
|
3256
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker__required", children: "*" })
|
|
3257
|
+
] }),
|
|
3258
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3259
|
+
import_react_aria_components.Group,
|
|
3260
|
+
{
|
|
3261
|
+
"data-slot": "date-picker-trigger",
|
|
3262
|
+
className: cn(datePickerTriggerVariants({ size, error: hasError }), className),
|
|
3263
|
+
children: [
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.DateInput, { className: "ddga-date-picker__input", "data-slot": "date-picker-input", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3265
|
+
import_react_aria_components.DateSegment,
|
|
3266
|
+
{
|
|
3267
|
+
segment,
|
|
3268
|
+
className: "ddga-date-picker__segment",
|
|
3269
|
+
"data-slot": "date-picker-segment"
|
|
3270
|
+
}
|
|
3271
|
+
) }),
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3273
|
+
import_react_aria_components.Button,
|
|
3274
|
+
{
|
|
3275
|
+
className: "ddga-date-picker__icon-button",
|
|
3276
|
+
"aria-label": "Open calendar",
|
|
3277
|
+
"data-slot": "date-picker-trigger-button",
|
|
3278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CalendarIcon, { "aria-hidden": "true", className: "ddga-date-picker__icon" })
|
|
3279
|
+
}
|
|
3280
|
+
)
|
|
3281
|
+
]
|
|
3282
|
+
}
|
|
3283
|
+
),
|
|
3284
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3285
|
+
import_react_aria_components.Text,
|
|
3286
|
+
{
|
|
3287
|
+
slot: "description",
|
|
3288
|
+
className: "ddga-field__message ddga-field__message--helper",
|
|
3289
|
+
"data-slot": "field-helper",
|
|
3290
|
+
children: helperText
|
|
3291
|
+
}
|
|
3292
|
+
),
|
|
3293
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3294
|
+
import_react_aria_components.FieldError,
|
|
3295
|
+
{
|
|
3296
|
+
className: "ddga-field__message ddga-field__message--error",
|
|
3297
|
+
"data-slot": "field-error",
|
|
3298
|
+
children: errorMessage
|
|
3299
|
+
}
|
|
3300
|
+
),
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3302
|
+
import_react_aria_components.Popover,
|
|
3303
|
+
{
|
|
3304
|
+
UNSTABLE_portalContainer: portalContainer,
|
|
3305
|
+
className: "ddga-date-picker-popover",
|
|
3306
|
+
"data-slot": "date-picker-popover",
|
|
3307
|
+
offset: 6,
|
|
3308
|
+
containerPadding: 12,
|
|
3309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3310
|
+
import_react_aria_components.Dialog,
|
|
3311
|
+
{
|
|
3312
|
+
className: "ddga-date-picker-dialog",
|
|
3313
|
+
"data-slot": "date-picker-dialog",
|
|
3314
|
+
"aria-label": dialogAriaLabel,
|
|
3315
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3316
|
+
children: [
|
|
3317
|
+
showToggle && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3318
|
+
"div",
|
|
3319
|
+
{
|
|
3320
|
+
role: "tablist",
|
|
3321
|
+
"aria-label": "Calendar system",
|
|
3322
|
+
className: "ddga-date-picker-toggle",
|
|
3323
|
+
"data-slot": "date-picker-toggle",
|
|
3324
|
+
children: [
|
|
3325
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3326
|
+
"button",
|
|
3327
|
+
{
|
|
3328
|
+
type: "button",
|
|
3329
|
+
role: "tab",
|
|
3330
|
+
"aria-selected": calendarSystem === "gregorian",
|
|
3331
|
+
className: "ddga-date-picker-toggle__button",
|
|
3332
|
+
"data-active": calendarSystem === "gregorian" ? "" : void 0,
|
|
3333
|
+
onClick: () => setCalendar("gregorian"),
|
|
3334
|
+
children: resolvedLabels.gregorian
|
|
3335
|
+
}
|
|
3336
|
+
),
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3338
|
+
"button",
|
|
3339
|
+
{
|
|
3340
|
+
type: "button",
|
|
3341
|
+
role: "tab",
|
|
3342
|
+
"aria-selected": calendarSystem === "hijri",
|
|
3343
|
+
className: "ddga-date-picker-toggle__button",
|
|
3344
|
+
"data-active": calendarSystem === "hijri" ? "" : void 0,
|
|
3345
|
+
onClick: () => setCalendar("hijri"),
|
|
3346
|
+
children: resolvedLabels.hijri
|
|
3347
|
+
}
|
|
3348
|
+
)
|
|
3349
|
+
]
|
|
3350
|
+
}
|
|
3351
|
+
),
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_aria_components.Calendar, { className: "ddga-date-picker-calendar", "data-slot": "date-picker-calendar", children: [
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("header", { className: "ddga-date-picker-calendar__header", children: [
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3355
|
+
import_react_aria_components.Button,
|
|
3356
|
+
{
|
|
3357
|
+
slot: "previous",
|
|
3358
|
+
className: "ddga-date-picker-calendar__nav",
|
|
3359
|
+
"data-slot": "date-picker-calendar-prev",
|
|
3360
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PrevChevron, { "aria-hidden": "true" })
|
|
3361
|
+
}
|
|
3362
|
+
),
|
|
3363
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3364
|
+
CalendarNavHeader,
|
|
3365
|
+
{
|
|
3366
|
+
locale: ariaLocale,
|
|
3367
|
+
monthLabel: navLabels.month,
|
|
3368
|
+
yearLabel: navLabels.year
|
|
3369
|
+
}
|
|
3370
|
+
),
|
|
3371
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3372
|
+
import_react_aria_components.Button,
|
|
3373
|
+
{
|
|
3374
|
+
slot: "next",
|
|
3375
|
+
className: "ddga-date-picker-calendar__nav",
|
|
3376
|
+
"data-slot": "date-picker-calendar-next",
|
|
3377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NextChevron, { "aria-hidden": "true" })
|
|
3378
|
+
}
|
|
3379
|
+
)
|
|
3380
|
+
] }),
|
|
3381
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_aria_components.CalendarGrid, { className: "ddga-date-picker-calendar__grid", children: [
|
|
3382
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.CalendarHeaderCell, { className: "ddga-date-picker-calendar__weekday", children: day }) }),
|
|
3383
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3384
|
+
CalendarDayCell,
|
|
3385
|
+
{
|
|
3386
|
+
date,
|
|
3387
|
+
showSecondary: showSecondaryCalendar,
|
|
3388
|
+
calendarSystem
|
|
3389
|
+
}
|
|
3390
|
+
) })
|
|
3391
|
+
] })
|
|
3392
|
+
] })
|
|
3393
|
+
]
|
|
3394
|
+
}
|
|
3395
|
+
)
|
|
3396
|
+
}
|
|
3397
|
+
)
|
|
3398
|
+
]
|
|
3399
|
+
}
|
|
3400
|
+
) });
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
// src/components/FileUpload/FileUpload.tsx
|
|
3404
|
+
var import_react17 = require("react");
|
|
3405
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3406
|
+
function matchesAccept(file, accept) {
|
|
3407
|
+
if (!accept) return true;
|
|
3408
|
+
const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
|
|
3409
|
+
if (tokens.length === 0) return true;
|
|
3410
|
+
const name = file.name.toLowerCase();
|
|
3411
|
+
const type = file.type.toLowerCase();
|
|
3412
|
+
return tokens.some((token) => {
|
|
3413
|
+
if (token.startsWith(".")) return name.endsWith(token);
|
|
3414
|
+
if (token.endsWith("/*")) return type.startsWith(token.slice(0, token.indexOf("/") + 1));
|
|
3415
|
+
return type === token;
|
|
3416
|
+
});
|
|
3417
|
+
}
|
|
3418
|
+
function splitFiles(incoming, config) {
|
|
3419
|
+
const { accept, maxSize, maxFiles, currentCount } = config;
|
|
3420
|
+
const accepted = [];
|
|
3421
|
+
const rejections = [];
|
|
3422
|
+
for (const file of incoming) {
|
|
3423
|
+
const errors = [];
|
|
3424
|
+
if (!matchesAccept(file, accept)) errors.push("file-invalid-type");
|
|
3425
|
+
if (maxSize != null && file.size > maxSize) errors.push("file-too-large");
|
|
3426
|
+
if (errors.length > 0) {
|
|
3427
|
+
rejections.push({ file, errors });
|
|
3428
|
+
continue;
|
|
3429
|
+
}
|
|
3430
|
+
if (maxFiles != null && currentCount + accepted.length >= maxFiles) {
|
|
3431
|
+
rejections.push({ file, errors: ["too-many-files"] });
|
|
3432
|
+
continue;
|
|
3433
|
+
}
|
|
3434
|
+
accepted.push(file);
|
|
3435
|
+
}
|
|
3436
|
+
return { accepted, rejections };
|
|
3437
|
+
}
|
|
3438
|
+
var UNITS = ["B", "KB", "MB", "GB", "TB"];
|
|
3439
|
+
function formatBytes(bytes) {
|
|
3440
|
+
if (bytes === 0) return "0 B";
|
|
3441
|
+
const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), UNITS.length - 1);
|
|
3442
|
+
const value = bytes / 1024 ** exponent;
|
|
3443
|
+
return `${exponent === 0 ? value : value.toFixed(1)} ${UNITS[exponent]}`;
|
|
3444
|
+
}
|
|
3445
|
+
function FileUpload({
|
|
3446
|
+
files,
|
|
3447
|
+
onFilesAdded,
|
|
3448
|
+
onFilesRejected,
|
|
3449
|
+
onRemove,
|
|
3450
|
+
accept,
|
|
3451
|
+
maxSize,
|
|
3452
|
+
maxFiles,
|
|
3453
|
+
multiple = true,
|
|
3454
|
+
disabled = false,
|
|
3455
|
+
required,
|
|
3456
|
+
label,
|
|
3457
|
+
helperText,
|
|
3458
|
+
errorMessage,
|
|
3459
|
+
error,
|
|
3460
|
+
hint = "Drag files here, or click to browse",
|
|
3461
|
+
removeLabel = "Remove",
|
|
3462
|
+
id: externalId,
|
|
3463
|
+
className,
|
|
3464
|
+
...props
|
|
3465
|
+
}) {
|
|
3466
|
+
const inputRef = (0, import_react17.useRef)(null);
|
|
3467
|
+
const [isDragging, setIsDragging] = (0, import_react17.useState)(false);
|
|
3468
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3469
|
+
name: "FileUpload",
|
|
3470
|
+
id: externalId,
|
|
3471
|
+
label,
|
|
3472
|
+
error,
|
|
3473
|
+
errorMessage,
|
|
3474
|
+
helperText,
|
|
3475
|
+
"aria-label": props["aria-label"],
|
|
3476
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
3477
|
+
});
|
|
3478
|
+
const effectiveMaxFiles = multiple ? maxFiles : 1;
|
|
3479
|
+
function process2(incoming) {
|
|
3480
|
+
if (disabled || incoming.length === 0) return;
|
|
3481
|
+
const { accepted, rejections } = splitFiles(incoming, {
|
|
3482
|
+
accept,
|
|
3483
|
+
maxSize,
|
|
3484
|
+
maxFiles: effectiveMaxFiles,
|
|
3485
|
+
currentCount: files.length
|
|
3486
|
+
});
|
|
3487
|
+
if (accepted.length > 0) onFilesAdded(accepted);
|
|
3488
|
+
if (rejections.length > 0) onFilesRejected?.(rejections);
|
|
3489
|
+
}
|
|
3490
|
+
function handleInputChange(event) {
|
|
3491
|
+
process2(Array.from(event.target.files ?? []));
|
|
3492
|
+
event.target.value = "";
|
|
3493
|
+
}
|
|
3494
|
+
function handleDrop(event) {
|
|
3495
|
+
event.preventDefault();
|
|
3496
|
+
setIsDragging(false);
|
|
3497
|
+
if (disabled) return;
|
|
3498
|
+
process2(Array.from(event.dataTransfer.files));
|
|
3499
|
+
}
|
|
3500
|
+
function handleDragOver(event) {
|
|
3501
|
+
event.preventDefault();
|
|
3502
|
+
if (!disabled) setIsDragging(true);
|
|
3503
|
+
}
|
|
3504
|
+
function handleDragLeave(event) {
|
|
3505
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
3506
|
+
setIsDragging(false);
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-slot": "file-upload-field", className: cn("ddga-field", "ddga-file-upload", className), children: [
|
|
3510
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { htmlFor: fieldId, className: "ddga-file-upload__label", children: [
|
|
3511
|
+
label,
|
|
3512
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { "aria-hidden": "true", className: "ddga-file-upload__required", children: "*" })
|
|
3513
|
+
] }),
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3515
|
+
"div",
|
|
3516
|
+
{
|
|
3517
|
+
"data-slot": "file-upload-dropzone",
|
|
3518
|
+
className: cn(
|
|
3519
|
+
"ddga-file-upload__dropzone",
|
|
3520
|
+
hasError && "ddga-file-upload__dropzone--error"
|
|
3521
|
+
),
|
|
3522
|
+
"data-dragging": isDragging || void 0,
|
|
3523
|
+
"data-disabled": disabled || void 0,
|
|
3524
|
+
"aria-disabled": disabled || void 0,
|
|
3525
|
+
onClick: () => {
|
|
3526
|
+
if (!disabled) inputRef.current?.click();
|
|
3527
|
+
},
|
|
3528
|
+
onDragOver: handleDragOver,
|
|
3529
|
+
onDragLeave: handleDragLeave,
|
|
3530
|
+
onDrop: handleDrop,
|
|
3531
|
+
children: [
|
|
3532
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Upload, { className: "ddga-file-upload__icon", "aria-hidden": "true" }),
|
|
3533
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__hint", children: hint }),
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3535
|
+
"input",
|
|
3536
|
+
{
|
|
3537
|
+
...controlProps,
|
|
3538
|
+
ref: inputRef,
|
|
3539
|
+
type: "file",
|
|
3540
|
+
className: "ddga-file-upload__input",
|
|
3541
|
+
accept,
|
|
3542
|
+
multiple,
|
|
3543
|
+
disabled,
|
|
3544
|
+
required,
|
|
3545
|
+
onChange: handleInputChange,
|
|
3546
|
+
onClick: (event) => event.stopPropagation(),
|
|
3547
|
+
"data-slot": "file-upload-input"
|
|
3548
|
+
}
|
|
3549
|
+
)
|
|
3550
|
+
]
|
|
3551
|
+
}
|
|
3552
|
+
),
|
|
3553
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
3554
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText }),
|
|
3555
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { "data-slot": "file-upload-list", className: "ddga-file-upload__list", children: files.map((item) => {
|
|
3556
|
+
const status = item.status ?? "pending";
|
|
3557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3558
|
+
"li",
|
|
3559
|
+
{
|
|
3560
|
+
"data-slot": "file-upload-item",
|
|
3561
|
+
"data-status": status,
|
|
3562
|
+
className: "ddga-file-upload__item",
|
|
3563
|
+
children: [
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__item-icon", "aria-hidden": "true", children: status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Check, {}) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AlertCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Upload, {}) }),
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "ddga-file-upload__item-main", children: [
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "ddga-file-upload__item-head", children: [
|
|
3567
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__item-name", title: item.file.name, children: item.file.name }),
|
|
3568
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__item-meta", children: formatBytes(item.file.size) })
|
|
3569
|
+
] }),
|
|
3570
|
+
status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3571
|
+
Progress,
|
|
3572
|
+
{
|
|
3573
|
+
size: "sm",
|
|
3574
|
+
value: item.progress ?? 0,
|
|
3575
|
+
"aria-label": `Uploading ${item.file.name}`,
|
|
3576
|
+
className: "ddga-file-upload__item-progress"
|
|
3577
|
+
}
|
|
3578
|
+
),
|
|
3579
|
+
status === "error" && item.error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { role: "alert", className: "ddga-file-upload__item-error", children: item.error })
|
|
3580
|
+
] }),
|
|
3581
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3582
|
+
Button,
|
|
3583
|
+
{
|
|
3584
|
+
type: "button",
|
|
3585
|
+
variant: "ghost",
|
|
3586
|
+
size: "icon-sm",
|
|
3587
|
+
"aria-label": `${removeLabel}: ${item.file.name}`,
|
|
3588
|
+
onClick: () => onRemove(item.id),
|
|
3589
|
+
className: "ddga-file-upload__item-remove",
|
|
3590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Close, { "aria-hidden": "true" })
|
|
3591
|
+
}
|
|
3592
|
+
)
|
|
3593
|
+
]
|
|
3594
|
+
},
|
|
3595
|
+
item.id
|
|
3596
|
+
);
|
|
3597
|
+
}) })
|
|
3598
|
+
] });
|
|
3599
|
+
}
|
|
3600
|
+
|
|
3601
|
+
// src/components/Slider/Slider.tsx
|
|
3602
|
+
var import_react18 = require("react");
|
|
2919
3603
|
var import_radix_ui21 = require("radix-ui");
|
|
3604
|
+
var import_class_variance_authority28 = require("class-variance-authority");
|
|
3605
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3606
|
+
var sliderVariants = (0, import_class_variance_authority28.cva)("ddga-slider", {
|
|
3607
|
+
variants: {
|
|
3608
|
+
size: {
|
|
3609
|
+
sm: "ddga-slider--sm",
|
|
3610
|
+
md: "ddga-slider--md"
|
|
3611
|
+
},
|
|
3612
|
+
error: {
|
|
3613
|
+
true: "ddga-slider--error"
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3616
|
+
defaultVariants: {
|
|
3617
|
+
size: "md"
|
|
3618
|
+
}
|
|
3619
|
+
});
|
|
3620
|
+
var DEFAULT_THUMB_LABELS = ["Minimum", "Maximum"];
|
|
3621
|
+
function toArray(value) {
|
|
3622
|
+
if (value === void 0) return void 0;
|
|
3623
|
+
return Array.isArray(value) ? value : [value];
|
|
3624
|
+
}
|
|
3625
|
+
function Slider({
|
|
3626
|
+
id: externalId,
|
|
3627
|
+
value,
|
|
3628
|
+
defaultValue,
|
|
3629
|
+
onValueChange,
|
|
3630
|
+
onValueCommit,
|
|
3631
|
+
min = 0,
|
|
3632
|
+
max = 100,
|
|
3633
|
+
size,
|
|
3634
|
+
label,
|
|
3635
|
+
helperText,
|
|
3636
|
+
errorMessage,
|
|
3637
|
+
error,
|
|
3638
|
+
showValue = false,
|
|
3639
|
+
formatValue,
|
|
3640
|
+
thumbLabels = DEFAULT_THUMB_LABELS,
|
|
3641
|
+
className,
|
|
3642
|
+
...props
|
|
3643
|
+
}) {
|
|
3644
|
+
const labelId = (0, import_react18.useId)();
|
|
3645
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3646
|
+
name: "Slider",
|
|
3647
|
+
id: externalId,
|
|
3648
|
+
label,
|
|
3649
|
+
error,
|
|
3650
|
+
errorMessage,
|
|
3651
|
+
helperText,
|
|
3652
|
+
"aria-label": props["aria-label"],
|
|
3653
|
+
"aria-labelledby": props["aria-labelledby"] ?? (label ? labelId : void 0)
|
|
3654
|
+
});
|
|
3655
|
+
const isRange = Array.isArray(value ?? defaultValue);
|
|
3656
|
+
const valueArray = toArray(value);
|
|
3657
|
+
const defaultArray = toArray(defaultValue) ?? [min];
|
|
3658
|
+
const wrap = (next) => isRange ? next : next[0];
|
|
3659
|
+
const currentForRender = valueArray ?? defaultArray;
|
|
3660
|
+
const fmt = (n) => formatValue ? formatValue(n) : String(n);
|
|
3661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-slot": "slider-field", className: "ddga-field", children: [
|
|
3662
|
+
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "ddga-slider__header", children: [
|
|
3663
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { id: labelId, className: "ddga-slider__label", children: label }),
|
|
3664
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ddga-slider__value", "aria-hidden": "true", children: currentForRender.map(fmt).join(" \u2013 ") })
|
|
3665
|
+
] }),
|
|
3666
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3667
|
+
import_radix_ui21.Slider.Root,
|
|
3668
|
+
{
|
|
3669
|
+
...props,
|
|
3670
|
+
id: fieldId,
|
|
3671
|
+
min,
|
|
3672
|
+
max,
|
|
3673
|
+
value: valueArray,
|
|
3674
|
+
defaultValue: value === void 0 ? defaultArray : void 0,
|
|
3675
|
+
onValueChange: onValueChange ? (next) => onValueChange(wrap(next)) : void 0,
|
|
3676
|
+
onValueCommit: onValueCommit ? (next) => onValueCommit(wrap(next)) : void 0,
|
|
3677
|
+
"aria-invalid": controlProps["aria-invalid"],
|
|
3678
|
+
"data-slot": "slider",
|
|
3679
|
+
className: cn(sliderVariants({ size, error: hasError }), className),
|
|
3680
|
+
children: [
|
|
3681
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_radix_ui21.Slider.Track, { "data-slot": "slider-track", className: "ddga-slider__track", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_radix_ui21.Slider.Range, { "data-slot": "slider-range", className: "ddga-slider__range" }) }),
|
|
3682
|
+
currentForRender.map((thumbValue, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3683
|
+
import_radix_ui21.Slider.Thumb,
|
|
3684
|
+
{
|
|
3685
|
+
"data-slot": "slider-thumb",
|
|
3686
|
+
className: "ddga-slider__thumb",
|
|
3687
|
+
"aria-label": isRange ? thumbLabels[index] : void 0,
|
|
3688
|
+
"aria-labelledby": !isRange && label ? labelId : void 0,
|
|
3689
|
+
"aria-valuetext": formatValue ? fmt(thumbValue) : void 0,
|
|
3690
|
+
"aria-describedby": controlProps["aria-describedby"]
|
|
3691
|
+
},
|
|
3692
|
+
index
|
|
3693
|
+
))
|
|
3694
|
+
]
|
|
3695
|
+
}
|
|
3696
|
+
),
|
|
3697
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
3698
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
3699
|
+
] });
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3702
|
+
// src/components/NumberInput/NumberInput.tsx
|
|
3703
|
+
var import_react19 = require("react");
|
|
3704
|
+
var import_class_variance_authority29 = require("class-variance-authority");
|
|
3705
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3706
|
+
var numberInputVariants = (0, import_class_variance_authority29.cva)("ddga-number-input", {
|
|
3707
|
+
variants: {
|
|
3708
|
+
size: {
|
|
3709
|
+
sm: "ddga-number-input--sm",
|
|
3710
|
+
md: "ddga-number-input--md",
|
|
3711
|
+
lg: "ddga-number-input--lg"
|
|
3712
|
+
},
|
|
3713
|
+
error: {
|
|
3714
|
+
true: "ddga-number-input--error"
|
|
3715
|
+
}
|
|
3716
|
+
},
|
|
3717
|
+
defaultVariants: {
|
|
3718
|
+
size: "md"
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
function clamp(value, min, max) {
|
|
3722
|
+
let next = value;
|
|
3723
|
+
if (min != null) next = Math.max(min, next);
|
|
3724
|
+
if (max != null) next = Math.min(max, next);
|
|
3725
|
+
return next;
|
|
3726
|
+
}
|
|
3727
|
+
function formatNumber(value) {
|
|
3728
|
+
if (!Number.isFinite(value)) return "";
|
|
3729
|
+
return value.toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 20 });
|
|
3730
|
+
}
|
|
3731
|
+
function NumberInput({
|
|
3732
|
+
id: externalId,
|
|
3733
|
+
value,
|
|
3734
|
+
defaultValue,
|
|
3735
|
+
onValueChange,
|
|
3736
|
+
min,
|
|
3737
|
+
max,
|
|
3738
|
+
step = 1,
|
|
3739
|
+
size,
|
|
3740
|
+
hideControls = false,
|
|
3741
|
+
decrementLabel = "Decrease",
|
|
3742
|
+
incrementLabel = "Increase",
|
|
3743
|
+
label,
|
|
3744
|
+
helperText,
|
|
3745
|
+
errorMessage,
|
|
3746
|
+
error,
|
|
3747
|
+
required,
|
|
3748
|
+
disabled,
|
|
3749
|
+
className,
|
|
3750
|
+
onBlur,
|
|
3751
|
+
onKeyDown,
|
|
3752
|
+
...props
|
|
3753
|
+
}) {
|
|
3754
|
+
const isControlled = value !== void 0;
|
|
3755
|
+
const [internal, setInternal] = (0, import_react19.useState)(defaultValue ?? null);
|
|
3756
|
+
const numericValue = isControlled ? value : internal;
|
|
3757
|
+
const [draft, setDraft] = (0, import_react19.useState)(null);
|
|
3758
|
+
const allowDecimal = !Number.isInteger(step);
|
|
3759
|
+
const allowNegative = min == null || min < 0;
|
|
3760
|
+
const displayValue = draft ?? (numericValue == null ? "" : formatNumber(numericValue));
|
|
3761
|
+
const allowedPattern = new RegExp(
|
|
3762
|
+
`^${allowNegative ? "-?" : ""}\\d*${allowDecimal ? "(\\.\\d*)?" : ""}$`
|
|
3763
|
+
);
|
|
3764
|
+
function commit(next) {
|
|
3765
|
+
if (!isControlled) setInternal(next);
|
|
3766
|
+
onValueChange?.(next);
|
|
3767
|
+
}
|
|
3768
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3769
|
+
name: "NumberInput",
|
|
3770
|
+
id: externalId,
|
|
3771
|
+
label,
|
|
3772
|
+
error,
|
|
3773
|
+
errorMessage,
|
|
3774
|
+
helperText,
|
|
3775
|
+
"aria-label": props["aria-label"],
|
|
3776
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
3777
|
+
});
|
|
3778
|
+
function handleChange(event) {
|
|
3779
|
+
const raw = event.target.value;
|
|
3780
|
+
if (!allowedPattern.test(raw)) return;
|
|
3781
|
+
setDraft(raw);
|
|
3782
|
+
if (raw.trim() === "") {
|
|
3783
|
+
commit(null);
|
|
3784
|
+
return;
|
|
3785
|
+
}
|
|
3786
|
+
const parsed = Number(raw);
|
|
3787
|
+
if (Number.isFinite(parsed)) commit(parsed);
|
|
3788
|
+
}
|
|
3789
|
+
function handleBlur(event) {
|
|
3790
|
+
if (numericValue != null) commit(clamp(numericValue, min, max));
|
|
3791
|
+
setDraft(null);
|
|
3792
|
+
onBlur?.(event);
|
|
3793
|
+
}
|
|
3794
|
+
function stepBy(direction) {
|
|
3795
|
+
const base = numericValue ?? (direction > 0 ? min ?? 0 : max ?? 0);
|
|
3796
|
+
const next = clamp(base + direction * step, min, max);
|
|
3797
|
+
const rounded = allowDecimal ? Number(next.toFixed(10)) : next;
|
|
3798
|
+
commit(rounded);
|
|
3799
|
+
setDraft(null);
|
|
3800
|
+
}
|
|
3801
|
+
function handleKeyDown(event) {
|
|
3802
|
+
if (!disabled) {
|
|
3803
|
+
if (event.key === "ArrowUp") {
|
|
3804
|
+
event.preventDefault();
|
|
3805
|
+
stepBy(1);
|
|
3806
|
+
} else if (event.key === "ArrowDown") {
|
|
3807
|
+
event.preventDefault();
|
|
3808
|
+
stepBy(-1);
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
onKeyDown?.(event);
|
|
3812
|
+
}
|
|
3813
|
+
const atMin = min != null && numericValue != null && numericValue <= min;
|
|
3814
|
+
const atMax = max != null && numericValue != null && numericValue >= max;
|
|
3815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-slot": "number-input-field", className: "ddga-field", children: [
|
|
3816
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { htmlFor: fieldId, className: "ddga-number-input__label", children: [
|
|
3817
|
+
label,
|
|
3818
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { "aria-hidden": "true", className: "ddga-number-input__required", children: "*" })
|
|
3819
|
+
] }),
|
|
3820
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3821
|
+
"div",
|
|
3822
|
+
{
|
|
3823
|
+
"data-slot": "number-input-control",
|
|
3824
|
+
className: cn(numberInputVariants({ size, error: hasError }), className),
|
|
3825
|
+
children: [
|
|
3826
|
+
!hideControls && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3827
|
+
"button",
|
|
3828
|
+
{
|
|
3829
|
+
type: "button",
|
|
3830
|
+
"data-slot": "number-input-decrement",
|
|
3831
|
+
className: "ddga-number-input__step ddga-number-input__step--decrement",
|
|
3832
|
+
"aria-label": decrementLabel,
|
|
3833
|
+
onClick: () => stepBy(-1),
|
|
3834
|
+
disabled: disabled || atMin,
|
|
3835
|
+
tabIndex: -1,
|
|
3836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Minus, { "aria-hidden": "true" })
|
|
3837
|
+
}
|
|
3838
|
+
),
|
|
3839
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3840
|
+
"input",
|
|
3841
|
+
{
|
|
3842
|
+
...props,
|
|
3843
|
+
...controlProps,
|
|
3844
|
+
type: "text",
|
|
3845
|
+
inputMode: allowDecimal ? "decimal" : "numeric",
|
|
3846
|
+
value: displayValue,
|
|
3847
|
+
required,
|
|
3848
|
+
disabled,
|
|
3849
|
+
onChange: handleChange,
|
|
3850
|
+
onBlur: handleBlur,
|
|
3851
|
+
onKeyDown: handleKeyDown,
|
|
3852
|
+
"data-slot": "number-input",
|
|
3853
|
+
className: "ddga-number-input__field"
|
|
3854
|
+
}
|
|
3855
|
+
),
|
|
3856
|
+
!hideControls && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3857
|
+
"button",
|
|
3858
|
+
{
|
|
3859
|
+
type: "button",
|
|
3860
|
+
"data-slot": "number-input-increment",
|
|
3861
|
+
className: "ddga-number-input__step ddga-number-input__step--increment",
|
|
3862
|
+
"aria-label": incrementLabel,
|
|
3863
|
+
onClick: () => stepBy(1),
|
|
3864
|
+
disabled: disabled || atMax,
|
|
3865
|
+
tabIndex: -1,
|
|
3866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Plus, { "aria-hidden": "true" })
|
|
3867
|
+
}
|
|
3868
|
+
)
|
|
3869
|
+
]
|
|
3870
|
+
}
|
|
3871
|
+
),
|
|
3872
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
3873
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
3874
|
+
] });
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
// src/components/Rating/Rating.tsx
|
|
3878
|
+
var import_react20 = require("react");
|
|
3879
|
+
var import_class_variance_authority30 = require("class-variance-authority");
|
|
3880
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3881
|
+
var ratingVariants = (0, import_class_variance_authority30.cva)("ddga-rating", {
|
|
3882
|
+
variants: {
|
|
3883
|
+
size: {
|
|
3884
|
+
sm: "ddga-rating--sm",
|
|
3885
|
+
md: "ddga-rating--md",
|
|
3886
|
+
lg: "ddga-rating--lg"
|
|
3887
|
+
}
|
|
3888
|
+
},
|
|
3889
|
+
defaultVariants: {
|
|
3890
|
+
size: "md"
|
|
3891
|
+
}
|
|
3892
|
+
});
|
|
3893
|
+
function clamp2(value, min, max) {
|
|
3894
|
+
return Math.min(max, Math.max(min, value));
|
|
3895
|
+
}
|
|
3896
|
+
function defaultValueText(value, max) {
|
|
3897
|
+
return `${value} out of ${max} stars`;
|
|
3898
|
+
}
|
|
3899
|
+
function fillFor(index, value, allowHalf) {
|
|
3900
|
+
if (value >= index + 1) return "full";
|
|
3901
|
+
if (allowHalf && value >= index + 0.5) return "half";
|
|
3902
|
+
return "empty";
|
|
3903
|
+
}
|
|
3904
|
+
function Rating({
|
|
3905
|
+
id: externalId,
|
|
3906
|
+
value,
|
|
3907
|
+
defaultValue,
|
|
3908
|
+
onValueChange,
|
|
3909
|
+
max = 5,
|
|
3910
|
+
allowHalf = false,
|
|
3911
|
+
readOnly = false,
|
|
3912
|
+
disabled = false,
|
|
3913
|
+
size,
|
|
3914
|
+
label,
|
|
3915
|
+
helperText,
|
|
3916
|
+
errorMessage,
|
|
3917
|
+
error,
|
|
3918
|
+
formatValueText = defaultValueText,
|
|
3919
|
+
className,
|
|
3920
|
+
...props
|
|
3921
|
+
}) {
|
|
3922
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
3923
|
+
const isControlled = value !== void 0;
|
|
3924
|
+
const [internal, setInternal] = (0, import_react20.useState)(defaultValue ?? 0);
|
|
3925
|
+
const currentValue = isControlled ? value : internal;
|
|
3926
|
+
const [hover, setHover] = (0, import_react20.useState)(null);
|
|
3927
|
+
const interactive = !readOnly && !disabled;
|
|
3928
|
+
const stepSize = allowHalf ? 0.5 : 1;
|
|
3929
|
+
const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
|
|
3930
|
+
name: "Rating",
|
|
3931
|
+
id: externalId,
|
|
3932
|
+
label,
|
|
3933
|
+
error,
|
|
3934
|
+
errorMessage,
|
|
3935
|
+
helperText,
|
|
3936
|
+
// role=slider / role=img always have an accessible name (label or the
|
|
3937
|
+
// value text), so suppress the no-label dev warning.
|
|
3938
|
+
"aria-label": props["aria-label"] ?? formatValueText(currentValue, max),
|
|
3939
|
+
"aria-labelledby": props["aria-labelledby"]
|
|
3940
|
+
});
|
|
3941
|
+
const displayValue = hover ?? currentValue;
|
|
3942
|
+
function commit(next) {
|
|
3943
|
+
if (!isControlled) setInternal(next);
|
|
3944
|
+
onValueChange?.(next);
|
|
3945
|
+
}
|
|
3946
|
+
function readDir() {
|
|
3947
|
+
const el = rootRef.current;
|
|
3948
|
+
if (!el || typeof getComputedStyle !== "function") return "ltr";
|
|
3949
|
+
return getComputedStyle(el).direction === "rtl" ? "rtl" : "ltr";
|
|
3950
|
+
}
|
|
3951
|
+
function pointerValue(event, index) {
|
|
3952
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
3953
|
+
let fraction = rect.width ? (event.clientX - rect.left) / rect.width : 1;
|
|
3954
|
+
if (readDir() === "rtl") fraction = 1 - fraction;
|
|
3955
|
+
if (allowHalf) return index + (fraction <= 0.5 ? 0.5 : 1);
|
|
3956
|
+
return index + 1;
|
|
3957
|
+
}
|
|
3958
|
+
function handleKeyDown(event) {
|
|
3959
|
+
if (!interactive) return;
|
|
3960
|
+
const rtl = readDir() === "rtl";
|
|
3961
|
+
let next = null;
|
|
3962
|
+
switch (event.key) {
|
|
3963
|
+
case "ArrowUp":
|
|
3964
|
+
next = currentValue + stepSize;
|
|
3965
|
+
break;
|
|
3966
|
+
case "ArrowDown":
|
|
3967
|
+
next = currentValue - stepSize;
|
|
3968
|
+
break;
|
|
3969
|
+
case "ArrowRight":
|
|
3970
|
+
next = currentValue + (rtl ? -stepSize : stepSize);
|
|
3971
|
+
break;
|
|
3972
|
+
case "ArrowLeft":
|
|
3973
|
+
next = currentValue + (rtl ? stepSize : -stepSize);
|
|
3974
|
+
break;
|
|
3975
|
+
case "Home":
|
|
3976
|
+
next = 0;
|
|
3977
|
+
break;
|
|
3978
|
+
case "End":
|
|
3979
|
+
next = max;
|
|
3980
|
+
break;
|
|
3981
|
+
default:
|
|
3982
|
+
return;
|
|
3983
|
+
}
|
|
3984
|
+
event.preventDefault();
|
|
3985
|
+
commit(clamp2(next, 0, max));
|
|
3986
|
+
}
|
|
3987
|
+
const stars = Array.from({ length: max }, (_, index) => {
|
|
3988
|
+
const level = fillFor(index, displayValue, allowHalf);
|
|
3989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3990
|
+
"span",
|
|
3991
|
+
{
|
|
3992
|
+
"data-slot": "rating-star",
|
|
3993
|
+
"data-fill": level,
|
|
3994
|
+
className: "ddga-rating__star",
|
|
3995
|
+
onPointerMove: interactive ? (event) => setHover(pointerValue(event, index)) : void 0,
|
|
3996
|
+
onClick: interactive ? (event) => commit(pointerValue(event, index)) : void 0,
|
|
3997
|
+
children: [
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Star, { className: "ddga-rating__star-bg", "aria-hidden": "true" }),
|
|
3999
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ddga-rating__star-fill", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Star, { className: "ddga-rating__star-fg", "aria-hidden": "true" }) })
|
|
4000
|
+
]
|
|
4001
|
+
},
|
|
4002
|
+
index
|
|
4003
|
+
);
|
|
4004
|
+
});
|
|
4005
|
+
const sharedProps = {
|
|
4006
|
+
ref: rootRef,
|
|
4007
|
+
"data-slot": "rating",
|
|
4008
|
+
"data-disabled": disabled || void 0,
|
|
4009
|
+
className: cn(ratingVariants({ size }), hasError && "ddga-rating--error", className),
|
|
4010
|
+
onPointerLeave: interactive ? () => setHover(null) : void 0
|
|
4011
|
+
};
|
|
4012
|
+
const labelledBy = label ? `${fieldId}-label` : props["aria-labelledby"];
|
|
4013
|
+
const ariaLabel = labelledBy ? void 0 : props["aria-label"] ?? "Rating";
|
|
4014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-slot": "rating-field", className: "ddga-field", children: [
|
|
4015
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { id: `${fieldId}-label`, className: "ddga-rating__label", children: label }),
|
|
4016
|
+
readOnly ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ...sharedProps, role: "img", "aria-label": formatValueText(currentValue, max), children: stars }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4017
|
+
"div",
|
|
4018
|
+
{
|
|
4019
|
+
...sharedProps,
|
|
4020
|
+
role: "slider",
|
|
4021
|
+
id: fieldId,
|
|
4022
|
+
tabIndex: disabled ? -1 : 0,
|
|
4023
|
+
"aria-valuemin": 0,
|
|
4024
|
+
"aria-valuemax": max,
|
|
4025
|
+
"aria-valuenow": currentValue,
|
|
4026
|
+
"aria-valuetext": formatValueText(currentValue, max),
|
|
4027
|
+
"aria-labelledby": labelledBy,
|
|
4028
|
+
"aria-label": ariaLabel,
|
|
4029
|
+
"aria-invalid": controlProps["aria-invalid"],
|
|
4030
|
+
"aria-describedby": controlProps["aria-describedby"],
|
|
4031
|
+
"aria-disabled": disabled || void 0,
|
|
4032
|
+
onKeyDown: handleKeyDown,
|
|
4033
|
+
children: stars
|
|
4034
|
+
}
|
|
4035
|
+
),
|
|
4036
|
+
hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
|
|
4037
|
+
hasHelper && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
|
|
4038
|
+
] });
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
// src/components/Toggle/Toggle.tsx
|
|
4042
|
+
var import_radix_ui22 = require("radix-ui");
|
|
4043
|
+
var import_class_variance_authority31 = require("class-variance-authority");
|
|
4044
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4045
|
+
var toggleVariants = (0, import_class_variance_authority31.cva)("ddga-toggle", {
|
|
4046
|
+
variants: {
|
|
4047
|
+
variant: {
|
|
4048
|
+
default: "ddga-toggle--default",
|
|
4049
|
+
outline: "ddga-toggle--outline"
|
|
4050
|
+
},
|
|
4051
|
+
size: {
|
|
4052
|
+
sm: "ddga-toggle--sm",
|
|
4053
|
+
md: "ddga-toggle--md",
|
|
4054
|
+
lg: "ddga-toggle--lg"
|
|
4055
|
+
}
|
|
4056
|
+
},
|
|
4057
|
+
defaultVariants: {
|
|
4058
|
+
variant: "default",
|
|
4059
|
+
size: "md"
|
|
4060
|
+
}
|
|
4061
|
+
});
|
|
4062
|
+
var toggleGroupVariants = (0, import_class_variance_authority31.cva)("ddga-toggle-group", {
|
|
4063
|
+
variants: {
|
|
4064
|
+
variant: {
|
|
4065
|
+
default: "ddga-toggle-group--default",
|
|
4066
|
+
outline: "ddga-toggle-group--outline"
|
|
4067
|
+
},
|
|
4068
|
+
size: {
|
|
4069
|
+
sm: "ddga-toggle-group--sm",
|
|
4070
|
+
md: "ddga-toggle-group--md",
|
|
4071
|
+
lg: "ddga-toggle-group--lg"
|
|
4072
|
+
}
|
|
4073
|
+
},
|
|
4074
|
+
defaultVariants: {
|
|
4075
|
+
variant: "default",
|
|
4076
|
+
size: "md"
|
|
4077
|
+
}
|
|
4078
|
+
});
|
|
4079
|
+
function Toggle({ variant, size, className, ...props }) {
|
|
4080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4081
|
+
import_radix_ui22.Toggle.Root,
|
|
4082
|
+
{
|
|
4083
|
+
"data-slot": "toggle",
|
|
4084
|
+
className: cn(toggleVariants({ variant, size }), className),
|
|
4085
|
+
...props
|
|
4086
|
+
}
|
|
4087
|
+
);
|
|
4088
|
+
}
|
|
4089
|
+
function ToggleGroup({ variant, size, className, ...props }) {
|
|
4090
|
+
if (process.env.NODE_ENV === "development" && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
4091
|
+
console.warn(
|
|
4092
|
+
"[@dev-dga/react] ToggleGroup should have an `aria-label` or `aria-labelledby` so the button group has an accessible name."
|
|
4093
|
+
);
|
|
4094
|
+
}
|
|
4095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4096
|
+
import_radix_ui22.ToggleGroup.Root,
|
|
4097
|
+
{
|
|
4098
|
+
"data-slot": "toggle-group",
|
|
4099
|
+
className: cn(toggleGroupVariants({ variant, size }), className),
|
|
4100
|
+
...props
|
|
4101
|
+
}
|
|
4102
|
+
);
|
|
4103
|
+
}
|
|
4104
|
+
function ToggleGroupItem({ className, ...props }) {
|
|
4105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4106
|
+
import_radix_ui22.ToggleGroup.Item,
|
|
4107
|
+
{
|
|
4108
|
+
"data-slot": "toggle-group-item",
|
|
4109
|
+
className: cn("ddga-toggle-group__item", className),
|
|
4110
|
+
...props
|
|
4111
|
+
}
|
|
4112
|
+
);
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
// src/components/DescriptionList/DescriptionList.tsx
|
|
4116
|
+
var import_class_variance_authority32 = require("class-variance-authority");
|
|
4117
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4118
|
+
var descriptionListVariants = (0, import_class_variance_authority32.cva)("ddga-description-list", {
|
|
4119
|
+
variants: {
|
|
4120
|
+
orientation: {
|
|
4121
|
+
horizontal: "ddga-description-list--horizontal",
|
|
4122
|
+
vertical: "ddga-description-list--vertical"
|
|
4123
|
+
},
|
|
4124
|
+
divided: {
|
|
4125
|
+
true: "ddga-description-list--divided"
|
|
4126
|
+
}
|
|
4127
|
+
},
|
|
4128
|
+
defaultVariants: {
|
|
4129
|
+
orientation: "horizontal"
|
|
4130
|
+
}
|
|
4131
|
+
});
|
|
4132
|
+
function DescriptionList({ orientation, divided, className, ...props }) {
|
|
4133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4134
|
+
"dl",
|
|
4135
|
+
{
|
|
4136
|
+
"data-slot": "description-list",
|
|
4137
|
+
className: cn(descriptionListVariants({ orientation, divided }), className),
|
|
4138
|
+
...props
|
|
4139
|
+
}
|
|
4140
|
+
);
|
|
4141
|
+
}
|
|
4142
|
+
function DescriptionItem({ className, ...props }) {
|
|
4143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4144
|
+
"div",
|
|
4145
|
+
{
|
|
4146
|
+
"data-slot": "description-item",
|
|
4147
|
+
className: cn("ddga-description-list__item", className),
|
|
4148
|
+
...props
|
|
4149
|
+
}
|
|
4150
|
+
);
|
|
4151
|
+
}
|
|
4152
|
+
function DescriptionTerm({ className, ...props }) {
|
|
4153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4154
|
+
"dt",
|
|
4155
|
+
{
|
|
4156
|
+
"data-slot": "description-term",
|
|
4157
|
+
className: cn("ddga-description-list__term", className),
|
|
4158
|
+
...props
|
|
4159
|
+
}
|
|
4160
|
+
);
|
|
4161
|
+
}
|
|
4162
|
+
function DescriptionDetails({ className, ...props }) {
|
|
4163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4164
|
+
"dd",
|
|
4165
|
+
{
|
|
4166
|
+
"data-slot": "description-details",
|
|
4167
|
+
className: cn("ddga-description-list__details", className),
|
|
4168
|
+
...props
|
|
4169
|
+
}
|
|
4170
|
+
);
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
// src/providers/DgaProvider.tsx
|
|
4174
|
+
var import_react21 = require("react");
|
|
4175
|
+
var import_radix_ui23 = require("radix-ui");
|
|
2920
4176
|
var import_tokens = require("@dev-dga/tokens");
|
|
2921
|
-
var
|
|
4177
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2922
4178
|
function DgaProvider({
|
|
2923
4179
|
dir = "ltr",
|
|
2924
4180
|
locale,
|
|
@@ -2929,17 +4185,46 @@ function DgaProvider({
|
|
|
2929
4185
|
style: consumerStyle,
|
|
2930
4186
|
children
|
|
2931
4187
|
}) {
|
|
2932
|
-
const parentCtx = (0,
|
|
4188
|
+
const parentCtx = (0, import_react21.useContext)(DgaContext);
|
|
2933
4189
|
const isNested = parentCtx !== null;
|
|
2934
|
-
const [rootEl, setRootEl] = (0,
|
|
4190
|
+
const [rootEl, setRootEl] = (0, import_react21.useState)(null);
|
|
4191
|
+
const portalRef = (0, import_react21.useRef)(null);
|
|
4192
|
+
const [portalEl, setPortalEl] = (0, import_react21.useState)(null);
|
|
2935
4193
|
const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
|
|
2936
|
-
const
|
|
2937
|
-
|
|
2938
|
-
|
|
4194
|
+
const themeVars = (0, import_react21.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
|
|
4195
|
+
(0, import_react21.useEffect)(() => {
|
|
4196
|
+
if (typeof document === "undefined") return;
|
|
4197
|
+
const el = document.createElement("div");
|
|
4198
|
+
el.setAttribute("data-slot", "dga-portal");
|
|
4199
|
+
el.style.position = "relative";
|
|
4200
|
+
el.style.zIndex = "50";
|
|
4201
|
+
document.body.appendChild(el);
|
|
4202
|
+
portalRef.current = el;
|
|
4203
|
+
setPortalEl(el);
|
|
4204
|
+
return () => {
|
|
4205
|
+
el.remove();
|
|
4206
|
+
portalRef.current = null;
|
|
4207
|
+
setPortalEl(null);
|
|
4208
|
+
};
|
|
4209
|
+
}, []);
|
|
4210
|
+
(0, import_react21.useEffect)(() => {
|
|
4211
|
+
const el = portalRef.current;
|
|
4212
|
+
if (!el) return;
|
|
4213
|
+
el.setAttribute("data-theme", mode);
|
|
4214
|
+
el.setAttribute("dir", dir);
|
|
4215
|
+
el.style.colorScheme = mode;
|
|
4216
|
+
if (themeVars) {
|
|
4217
|
+
for (const [k, v] of Object.entries(themeVars)) {
|
|
4218
|
+
el.style.setProperty(k, String(v));
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
}, [mode, dir, themeVars, portalEl]);
|
|
4222
|
+
const ctxValue = (0, import_react21.useMemo)(
|
|
4223
|
+
() => ({ dir, locale: resolvedLocale, mode, rootEl, portalEl }),
|
|
4224
|
+
[dir, resolvedLocale, mode, rootEl, portalEl]
|
|
2939
4225
|
);
|
|
2940
|
-
const
|
|
2941
|
-
|
|
2942
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4226
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_radix_ui23.Direction.Provider, { dir, children });
|
|
4227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2943
4228
|
Component,
|
|
2944
4229
|
{
|
|
2945
4230
|
ref: setRootEl,
|
|
@@ -2949,7 +4234,7 @@ function DgaProvider({
|
|
|
2949
4234
|
"data-theme": mode,
|
|
2950
4235
|
className,
|
|
2951
4236
|
style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
|
|
2952
|
-
children: isNested ? inner : /* @__PURE__ */ (0,
|
|
4237
|
+
children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_radix_ui23.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
|
|
2953
4238
|
}
|
|
2954
4239
|
) });
|
|
2955
4240
|
}
|
|
@@ -2993,6 +4278,11 @@ function useDir() {
|
|
|
2993
4278
|
ComboboxGroup,
|
|
2994
4279
|
ComboboxItem,
|
|
2995
4280
|
ComboboxSeparator,
|
|
4281
|
+
DatePicker,
|
|
4282
|
+
DescriptionDetails,
|
|
4283
|
+
DescriptionItem,
|
|
4284
|
+
DescriptionList,
|
|
4285
|
+
DescriptionTerm,
|
|
2996
4286
|
DgaProvider,
|
|
2997
4287
|
Divider,
|
|
2998
4288
|
Drawer,
|
|
@@ -3018,6 +4308,7 @@ function useDir() {
|
|
|
3018
4308
|
DropdownMenuSubTrigger,
|
|
3019
4309
|
DropdownMenuTrigger,
|
|
3020
4310
|
FieldMessage,
|
|
4311
|
+
FileUpload,
|
|
3021
4312
|
Input,
|
|
3022
4313
|
Modal,
|
|
3023
4314
|
ModalClose,
|
|
@@ -3027,6 +4318,7 @@ function useDir() {
|
|
|
3027
4318
|
ModalHeader,
|
|
3028
4319
|
ModalTitle,
|
|
3029
4320
|
ModalTrigger,
|
|
4321
|
+
NumberInput,
|
|
3030
4322
|
Pagination,
|
|
3031
4323
|
PaginationContent,
|
|
3032
4324
|
PaginationEllipsis,
|
|
@@ -3037,9 +4329,11 @@ function useDir() {
|
|
|
3037
4329
|
Progress,
|
|
3038
4330
|
Radio,
|
|
3039
4331
|
RadioGroup,
|
|
4332
|
+
Rating,
|
|
3040
4333
|
Select,
|
|
3041
4334
|
SelectItem,
|
|
3042
4335
|
Skeleton,
|
|
4336
|
+
Slider,
|
|
3043
4337
|
Spinner,
|
|
3044
4338
|
Step,
|
|
3045
4339
|
StepDescription,
|
|
@@ -3053,6 +4347,9 @@ function useDir() {
|
|
|
3053
4347
|
TabsTrigger,
|
|
3054
4348
|
Textarea,
|
|
3055
4349
|
Toaster,
|
|
4350
|
+
Toggle,
|
|
4351
|
+
ToggleGroup,
|
|
4352
|
+
ToggleGroupItem,
|
|
3056
4353
|
Tooltip,
|
|
3057
4354
|
TooltipContent,
|
|
3058
4355
|
TooltipTrigger,
|
|
@@ -3070,18 +4367,23 @@ function useDir() {
|
|
|
3070
4367
|
comboboxVariants,
|
|
3071
4368
|
createToast,
|
|
3072
4369
|
createToastStore,
|
|
4370
|
+
datePickerVariants,
|
|
4371
|
+
descriptionListVariants,
|
|
3073
4372
|
dividerVariants,
|
|
3074
4373
|
drawerVariants,
|
|
3075
4374
|
dropdownMenuVariants,
|
|
3076
4375
|
inputVariants,
|
|
3077
4376
|
modalContentVariants,
|
|
4377
|
+
numberInputVariants,
|
|
3078
4378
|
paginationLinkVariants,
|
|
3079
4379
|
paginationVariants,
|
|
3080
4380
|
progressVariants,
|
|
3081
4381
|
radioGroupVariants,
|
|
3082
4382
|
radioVariants,
|
|
4383
|
+
ratingVariants,
|
|
3083
4384
|
selectTriggerVariants,
|
|
3084
4385
|
skeletonVariants,
|
|
4386
|
+
sliderVariants,
|
|
3085
4387
|
spinnerVariants,
|
|
3086
4388
|
stepVariants,
|
|
3087
4389
|
stepsVariants,
|
|
@@ -3093,6 +4395,8 @@ function useDir() {
|
|
|
3093
4395
|
toastStore,
|
|
3094
4396
|
toastVariants,
|
|
3095
4397
|
toastViewportVariants,
|
|
4398
|
+
toggleGroupVariants,
|
|
4399
|
+
toggleVariants,
|
|
3096
4400
|
tooltipContentVariants,
|
|
3097
4401
|
useDga,
|
|
3098
4402
|
useDir,
|