@dev-dga/react 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -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,
@@ -77,8 +82,28 @@ __export(src_exports, {
77
82
  DropdownMenuSubContent: () => DropdownMenuSubContent,
78
83
  DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
79
84
  DropdownMenuTrigger: () => DropdownMenuTrigger,
85
+ EmptyState: () => EmptyState,
86
+ EmptyStateActions: () => EmptyStateActions,
87
+ EmptyStateDescription: () => EmptyStateDescription,
88
+ EmptyStateMedia: () => EmptyStateMedia,
89
+ EmptyStateTitle: () => EmptyStateTitle,
80
90
  FieldMessage: () => FieldMessage,
91
+ FileUpload: () => FileUpload,
81
92
  Input: () => Input,
93
+ Menubar: () => Menubar,
94
+ MenubarCheckboxItem: () => MenubarCheckboxItem,
95
+ MenubarContent: () => MenubarContent,
96
+ MenubarGroup: () => MenubarGroup,
97
+ MenubarItem: () => MenubarItem,
98
+ MenubarLabel: () => MenubarLabel,
99
+ MenubarMenu: () => MenubarMenu,
100
+ MenubarRadioGroup: () => MenubarRadioGroup,
101
+ MenubarRadioItem: () => MenubarRadioItem,
102
+ MenubarSeparator: () => MenubarSeparator,
103
+ MenubarSub: () => MenubarSub,
104
+ MenubarSubContent: () => MenubarSubContent,
105
+ MenubarSubTrigger: () => MenubarSubTrigger,
106
+ MenubarTrigger: () => MenubarTrigger,
82
107
  Modal: () => Modal,
83
108
  ModalClose: () => ModalClose,
84
109
  ModalContent: () => ModalContent,
@@ -87,6 +112,7 @@ __export(src_exports, {
87
112
  ModalHeader: () => ModalHeader,
88
113
  ModalTitle: () => ModalTitle,
89
114
  ModalTrigger: () => ModalTrigger,
115
+ NumberInput: () => NumberInput,
90
116
  Pagination: () => Pagination,
91
117
  PaginationContent: () => PaginationContent,
92
118
  PaginationEllipsis: () => PaginationEllipsis,
@@ -94,13 +120,48 @@ __export(src_exports, {
94
120
  PaginationLink: () => PaginationLink,
95
121
  PaginationNext: () => PaginationNext,
96
122
  PaginationPrevious: () => PaginationPrevious,
123
+ Popover: () => Popover,
124
+ PopoverAnchor: () => PopoverAnchor,
125
+ PopoverClose: () => PopoverClose,
126
+ PopoverContent: () => PopoverContent,
127
+ PopoverTrigger: () => PopoverTrigger,
97
128
  Progress: () => Progress,
98
129
  Radio: () => Radio,
99
130
  RadioGroup: () => RadioGroup,
131
+ Rating: () => Rating,
132
+ ScrollArea: () => ScrollArea,
100
133
  Select: () => Select,
101
134
  SelectItem: () => SelectItem,
135
+ Sidebar: () => Sidebar,
136
+ SidebarContent: () => SidebarContent,
137
+ SidebarFooter: () => SidebarFooter,
138
+ SidebarGroup: () => SidebarGroup,
139
+ SidebarGroupAction: () => SidebarGroupAction,
140
+ SidebarGroupContent: () => SidebarGroupContent,
141
+ SidebarGroupLabel: () => SidebarGroupLabel,
142
+ SidebarHeader: () => SidebarHeader,
143
+ SidebarInset: () => SidebarInset,
144
+ SidebarMenu: () => SidebarMenu,
145
+ SidebarMenuAction: () => SidebarMenuAction,
146
+ SidebarMenuBadge: () => SidebarMenuBadge,
147
+ SidebarMenuButton: () => SidebarMenuButton,
148
+ SidebarMenuItem: () => SidebarMenuItem,
149
+ SidebarMenuSkeleton: () => SidebarMenuSkeleton,
150
+ SidebarMenuSub: () => SidebarMenuSub,
151
+ SidebarMenuSubButton: () => SidebarMenuSubButton,
152
+ SidebarMenuSubItem: () => SidebarMenuSubItem,
153
+ SidebarProvider: () => SidebarProvider,
154
+ SidebarRail: () => SidebarRail,
155
+ SidebarSeparator: () => SidebarSeparator,
156
+ SidebarTrigger: () => SidebarTrigger,
102
157
  Skeleton: () => Skeleton,
158
+ Slider: () => Slider,
103
159
  Spinner: () => Spinner,
160
+ Stat: () => Stat,
161
+ StatChange: () => StatChange,
162
+ StatGroup: () => StatGroup,
163
+ StatLabel: () => StatLabel,
164
+ StatValue: () => StatValue,
104
165
  Step: () => Step,
105
166
  StepDescription: () => StepDescription,
106
167
  StepIndicator: () => StepIndicator,
@@ -112,7 +173,17 @@ __export(src_exports, {
112
173
  TabsList: () => TabsList,
113
174
  TabsTrigger: () => TabsTrigger,
114
175
  Textarea: () => Textarea,
176
+ Timeline: () => Timeline,
177
+ TimelineContent: () => TimelineContent,
178
+ TimelineDescription: () => TimelineDescription,
179
+ TimelineItem: () => TimelineItem,
180
+ TimelineMarker: () => TimelineMarker,
181
+ TimelineTime: () => TimelineTime,
182
+ TimelineTitle: () => TimelineTitle,
115
183
  Toaster: () => Toaster,
184
+ Toggle: () => Toggle,
185
+ ToggleGroup: () => ToggleGroup,
186
+ ToggleGroupItem: () => ToggleGroupItem,
116
187
  Tooltip: () => Tooltip,
117
188
  TooltipContent: () => TooltipContent,
118
189
  TooltipTrigger: () => TooltipTrigger,
@@ -130,33 +201,53 @@ __export(src_exports, {
130
201
  comboboxVariants: () => comboboxVariants,
131
202
  createToast: () => createToast,
132
203
  createToastStore: () => createToastStore,
204
+ datePickerVariants: () => datePickerVariants,
205
+ descriptionListVariants: () => descriptionListVariants,
133
206
  dividerVariants: () => dividerVariants,
134
207
  drawerVariants: () => drawerVariants,
135
208
  dropdownMenuVariants: () => dropdownMenuVariants,
209
+ emptyStateVariants: () => emptyStateVariants,
136
210
  inputVariants: () => inputVariants,
211
+ menubarContentVariants: () => menubarContentVariants,
212
+ menubarTriggerVariants: () => menubarTriggerVariants,
137
213
  modalContentVariants: () => modalContentVariants,
214
+ numberInputVariants: () => numberInputVariants,
138
215
  paginationLinkVariants: () => paginationLinkVariants,
139
216
  paginationVariants: () => paginationVariants,
217
+ popoverContentVariants: () => popoverContentVariants,
140
218
  progressVariants: () => progressVariants,
141
219
  radioGroupVariants: () => radioGroupVariants,
142
220
  radioVariants: () => radioVariants,
221
+ ratingVariants: () => ratingVariants,
222
+ scrollAreaVariants: () => scrollAreaVariants,
143
223
  selectTriggerVariants: () => selectTriggerVariants,
224
+ sidebarMenuButtonVariants: () => sidebarMenuButtonVariants,
225
+ sidebarMenuSubButtonVariants: () => sidebarMenuSubButtonVariants,
144
226
  skeletonVariants: () => skeletonVariants,
227
+ sliderVariants: () => sliderVariants,
145
228
  spinnerVariants: () => spinnerVariants,
229
+ statGroupVariants: () => statGroupVariants,
230
+ statVariants: () => statVariants,
146
231
  stepVariants: () => stepVariants,
147
232
  stepsVariants: () => stepsVariants,
148
233
  switchVariants: () => switchVariants,
149
234
  tabsListVariants: () => tabsListVariants,
150
235
  tabsVariants: () => tabsVariants,
151
236
  textareaVariants: () => textareaVariants,
237
+ timelineMarkerVariants: () => timelineMarkerVariants,
238
+ timelineVariants: () => timelineVariants,
152
239
  toast: () => toast,
153
240
  toastStore: () => toastStore,
154
241
  toastVariants: () => toastVariants,
155
242
  toastViewportVariants: () => toastViewportVariants,
243
+ toggleGroupVariants: () => toggleGroupVariants,
244
+ toggleVariants: () => toggleVariants,
156
245
  tooltipContentVariants: () => tooltipContentVariants,
157
246
  useDga: () => useDga,
158
247
  useDir: () => useDir,
159
- useFieldA11y: () => useFieldA11y
248
+ useFieldA11y: () => useFieldA11y,
249
+ useIsMobile: () => useIsMobile,
250
+ useSidebar: () => useSidebar
160
251
  });
161
252
  module.exports = __toCommonJS(src_exports);
162
253
 
@@ -676,6 +767,47 @@ function ChevronRight(props) {
676
767
  }
677
768
  );
678
769
  }
770
+ function ChevronLeft(props) {
771
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
772
+ "svg",
773
+ {
774
+ xmlns: "http://www.w3.org/2000/svg",
775
+ width: "1em",
776
+ height: "1em",
777
+ viewBox: "0 0 24 24",
778
+ fill: "none",
779
+ stroke: "currentColor",
780
+ strokeWidth: "2",
781
+ strokeLinecap: "round",
782
+ strokeLinejoin: "round",
783
+ ...props,
784
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m15 18-6-6 6-6" })
785
+ }
786
+ );
787
+ }
788
+ function CalendarIcon(props) {
789
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
790
+ "svg",
791
+ {
792
+ xmlns: "http://www.w3.org/2000/svg",
793
+ width: "1em",
794
+ height: "1em",
795
+ viewBox: "0 0 24 24",
796
+ fill: "none",
797
+ stroke: "currentColor",
798
+ strokeWidth: "2",
799
+ strokeLinecap: "round",
800
+ strokeLinejoin: "round",
801
+ ...props,
802
+ children: [
803
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
804
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "16", x2: "16", y1: "2", y2: "6" }),
805
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "8", x2: "8", y1: "2", y2: "6" }),
806
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("line", { x1: "3", x2: "21", y1: "10", y2: "10" })
807
+ ]
808
+ }
809
+ );
810
+ }
679
811
  function MoreHorizontal(props) {
680
812
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
681
813
  "svg",
@@ -695,6 +827,157 @@ function MoreHorizontal(props) {
695
827
  }
696
828
  );
697
829
  }
830
+ function Plus(props) {
831
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
832
+ "svg",
833
+ {
834
+ xmlns: "http://www.w3.org/2000/svg",
835
+ width: "1em",
836
+ height: "1em",
837
+ viewBox: "0 0 24 24",
838
+ fill: "none",
839
+ stroke: "currentColor",
840
+ strokeWidth: "3",
841
+ strokeLinecap: "round",
842
+ strokeLinejoin: "round",
843
+ ...props,
844
+ children: [
845
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 5v14" }),
846
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5 12h14" })
847
+ ]
848
+ }
849
+ );
850
+ }
851
+ function Star(props) {
852
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
853
+ "svg",
854
+ {
855
+ xmlns: "http://www.w3.org/2000/svg",
856
+ width: "1em",
857
+ height: "1em",
858
+ viewBox: "0 0 24 24",
859
+ fill: "currentColor",
860
+ stroke: "none",
861
+ ...props,
862
+ 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" })
863
+ }
864
+ );
865
+ }
866
+ function Upload(props) {
867
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
868
+ "svg",
869
+ {
870
+ xmlns: "http://www.w3.org/2000/svg",
871
+ width: "1em",
872
+ height: "1em",
873
+ viewBox: "0 0 24 24",
874
+ fill: "none",
875
+ stroke: "currentColor",
876
+ strokeWidth: "2",
877
+ strokeLinecap: "round",
878
+ strokeLinejoin: "round",
879
+ ...props,
880
+ children: [
881
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
882
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M17 8l-5-5-5 5" }),
883
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 3v12" })
884
+ ]
885
+ }
886
+ );
887
+ }
888
+ function Inbox(props) {
889
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
890
+ "svg",
891
+ {
892
+ xmlns: "http://www.w3.org/2000/svg",
893
+ width: "1em",
894
+ height: "1em",
895
+ viewBox: "0 0 24 24",
896
+ fill: "none",
897
+ stroke: "currentColor",
898
+ strokeWidth: "2",
899
+ strokeLinecap: "round",
900
+ strokeLinejoin: "round",
901
+ ...props,
902
+ children: [
903
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M22 12h-6l-2 3h-4l-2-3H2" }),
904
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
905
+ ]
906
+ }
907
+ );
908
+ }
909
+ function Search(props) {
910
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
911
+ "svg",
912
+ {
913
+ xmlns: "http://www.w3.org/2000/svg",
914
+ width: "1em",
915
+ height: "1em",
916
+ viewBox: "0 0 24 24",
917
+ fill: "none",
918
+ stroke: "currentColor",
919
+ strokeWidth: "2",
920
+ strokeLinecap: "round",
921
+ strokeLinejoin: "round",
922
+ ...props,
923
+ children: [
924
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
925
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m21 21-4.3-4.3" })
926
+ ]
927
+ }
928
+ );
929
+ }
930
+ function CaretUp(props) {
931
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
932
+ "svg",
933
+ {
934
+ xmlns: "http://www.w3.org/2000/svg",
935
+ width: "1em",
936
+ height: "1em",
937
+ viewBox: "0 0 24 24",
938
+ fill: "currentColor",
939
+ stroke: "none",
940
+ ...props,
941
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m12 8-6 8h12z" })
942
+ }
943
+ );
944
+ }
945
+ function CaretDown(props) {
946
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
947
+ "svg",
948
+ {
949
+ xmlns: "http://www.w3.org/2000/svg",
950
+ width: "1em",
951
+ height: "1em",
952
+ viewBox: "0 0 24 24",
953
+ fill: "currentColor",
954
+ stroke: "none",
955
+ ...props,
956
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m12 16 6-8H6z" })
957
+ }
958
+ );
959
+ }
960
+ function PanelLeft(props) {
961
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
962
+ "svg",
963
+ {
964
+ xmlns: "http://www.w3.org/2000/svg",
965
+ width: "1em",
966
+ height: "1em",
967
+ viewBox: "0 0 24 24",
968
+ fill: "none",
969
+ stroke: "currentColor",
970
+ strokeWidth: "2",
971
+ strokeLinecap: "round",
972
+ strokeLinejoin: "round",
973
+ ...props,
974
+ children: [
975
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
976
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 3v18" })
977
+ ]
978
+ }
979
+ );
980
+ }
698
981
 
699
982
  // src/components/Checkbox/Checkbox.tsx
700
983
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -981,7 +1264,7 @@ function Select({
981
1264
  "aria-labelledby": rootProps["aria-labelledby"]
982
1265
  });
983
1266
  const ctx = (0, import_react5.useContext)(DgaContext);
984
- const portalContainer = ctx?.rootEl ?? void 0;
1267
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
985
1268
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-slot": "select-field", className: "ddga-field", children: [
986
1269
  label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { htmlFor: fieldId, className: "ddga-select__label", children: [
987
1270
  label,
@@ -1400,7 +1683,7 @@ function TooltipContent({
1400
1683
  ...props
1401
1684
  }) {
1402
1685
  const ctx = (0, import_react8.useContext)(DgaContext);
1403
- const portalContainer = ctx?.rootEl ?? void 0;
1686
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
1404
1687
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_radix_ui9.Tooltip.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1405
1688
  import_radix_ui9.Tooltip.Content,
1406
1689
  {
@@ -1543,7 +1826,7 @@ function ModalContent({
1543
1826
  ...props
1544
1827
  }) {
1545
1828
  const ctx = (0, import_react10.useContext)(DgaContext);
1546
- const portalContainer = ctx?.rootEl ?? void 0;
1829
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
1547
1830
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_radix_ui11.Dialog.Portal, { container: portalContainer, children: [
1548
1831
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_radix_ui11.Dialog.Overlay, { className: "ddga-modal__overlay", "data-slot": "modal-overlay" }),
1549
1832
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
@@ -2441,7 +2724,7 @@ function DropdownMenuContent({
2441
2724
  ...props
2442
2725
  }) {
2443
2726
  const ctx = (0, import_react13.useContext)(DgaContext);
2444
- const portalContainer = ctx?.rootEl ?? void 0;
2727
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
2445
2728
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2446
2729
  import_radix_ui18.DropdownMenu.Content,
2447
2730
  {
@@ -2572,7 +2855,7 @@ function DropdownMenuSubTrigger({
2572
2855
  }
2573
2856
  function DropdownMenuSubContent({ size, className, ...props }) {
2574
2857
  const ctx = (0, import_react13.useContext)(DgaContext);
2575
- const portalContainer = ctx?.rootEl ?? void 0;
2858
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
2576
2859
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_radix_ui18.DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2577
2860
  import_radix_ui18.DropdownMenu.SubContent,
2578
2861
  {
@@ -2624,7 +2907,7 @@ function DrawerContent({
2624
2907
  ...props
2625
2908
  }) {
2626
2909
  const ctx = (0, import_react14.useContext)(DgaContext);
2627
- const portalContainer = ctx?.rootEl ?? void 0;
2910
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
2628
2911
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_radix_ui19.Dialog.Portal, { container: portalContainer, children: [
2629
2912
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_radix_ui19.Dialog.Overlay, { className: "ddga-drawer__overlay", "data-slot": "drawer-overlay" }),
2630
2913
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
@@ -2789,7 +3072,7 @@ function Combobox({
2789
3072
  "aria-labelledby": ariaLabelledBy
2790
3073
  });
2791
3074
  const providerCtx = (0, import_react15.useContext)(DgaContext);
2792
- const portalContainer = providerCtx?.rootEl ?? void 0;
3075
+ const portalContainer = providerCtx?.portalEl ?? providerCtx?.rootEl ?? void 0;
2793
3076
  const triggerLabel = (0, import_react15.useMemo)(() => {
2794
3077
  if (value === void 0) return null;
2795
3078
  if (getLabel) return getLabel(value);
@@ -2914,50 +3197,2324 @@ function ComboboxSeparator({ className, ...props }) {
2914
3197
  );
2915
3198
  }
2916
3199
 
2917
- // src/providers/DgaProvider.tsx
3200
+ // src/components/DatePicker/DatePicker.tsx
2918
3201
  var import_react16 = require("react");
2919
- var import_radix_ui21 = require("radix-ui");
2920
- var import_tokens = require("@dev-dga/tokens");
3202
+ var import_react_aria_components = require("react-aria-components");
3203
+ var import_date = require("@internationalized/date");
3204
+ var import_class_variance_authority27 = require("class-variance-authority");
2921
3205
  var import_jsx_runtime29 = require("react/jsx-runtime");
2922
- function DgaProvider({
2923
- dir = "ltr",
2924
- locale,
2925
- mode = "light",
2926
- theme,
2927
- as: Component = "div",
3206
+ var datePickerTriggerVariants = (0, import_class_variance_authority27.cva)("ddga-date-picker-trigger", {
3207
+ variants: {
3208
+ size: {
3209
+ sm: "ddga-date-picker-trigger--sm",
3210
+ md: "ddga-date-picker-trigger--md"
3211
+ },
3212
+ error: {
3213
+ true: "ddga-date-picker-trigger--error"
3214
+ }
3215
+ },
3216
+ defaultVariants: {
3217
+ size: "md"
3218
+ }
3219
+ });
3220
+ var datePickerVariants = datePickerTriggerVariants;
3221
+ function dateToCalendarDate(date) {
3222
+ if (!date) return null;
3223
+ return new import_date.CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
3224
+ }
3225
+ function calendarDateToDate(value) {
3226
+ if (!value) return null;
3227
+ const greg = value.calendar.identifier === "gregory" ? value : (0, import_date.toCalendar)(value, new import_date.GregorianCalendar());
3228
+ return new Date(greg.year, greg.month - 1, greg.day);
3229
+ }
3230
+ function composeLocale(dgaLocale, calendar) {
3231
+ const base = dgaLocale === "ar" ? "ar-SA" : dgaLocale === "en" ? "en-US" : dgaLocale;
3232
+ const isArabic = base.startsWith("ar");
3233
+ if (calendar === "hijri") {
3234
+ return isArabic ? `${base}-u-ca-islamic-umalqura-nu-latn` : `${base}-u-ca-islamic-umalqura`;
3235
+ }
3236
+ return isArabic ? `${base}-u-nu-latn` : base;
3237
+ }
3238
+ var GREGORIAN = new import_date.GregorianCalendar();
3239
+ var ISLAMIC_UMALQURA = new import_date.IslamicUmalquraCalendar();
3240
+ function secondaryDayNumber(date, mainCalendar) {
3241
+ const other = mainCalendar === "hijri" ? GREGORIAN : ISLAMIC_UMALQURA;
3242
+ return (0, import_date.toCalendar)(date, other).day;
3243
+ }
3244
+ function CalendarNavHeader({ locale, monthLabel, yearLabel }) {
3245
+ const state = (0, import_react16.useContext)(import_react_aria_components.CalendarStateContext);
3246
+ const focusedDate = state?.focusedDate ?? null;
3247
+ const focusedYear = focusedDate?.year ?? 0;
3248
+ const focusedCalendar = focusedDate?.calendar ?? GREGORIAN;
3249
+ const minValue = state?.minValue ?? null;
3250
+ const maxValue = state?.maxValue ?? null;
3251
+ const monthNames = (0, import_react16.useMemo)(() => {
3252
+ if (!focusedDate) return [];
3253
+ const fmt = new Intl.DateTimeFormat(locale, { month: "long" });
3254
+ return Array.from({ length: 12 }, (_, i) => {
3255
+ const cd = new import_date.CalendarDate(focusedCalendar, focusedYear, i + 1, 1);
3256
+ const greg = (0, import_date.toCalendar)(cd, GREGORIAN);
3257
+ const js = new Date(greg.year, greg.month - 1, greg.day);
3258
+ return fmt.format(js);
3259
+ });
3260
+ }, [locale, focusedDate, focusedCalendar, focusedYear]);
3261
+ const yearOptions = (0, import_react16.useMemo)(() => {
3262
+ if (!focusedDate) return [];
3263
+ const minY = minValue ? (0, import_date.toCalendar)(minValue, focusedCalendar).year : focusedYear - 100;
3264
+ const maxY = maxValue ? (0, import_date.toCalendar)(maxValue, focusedCalendar).year : focusedYear + 30;
3265
+ const start = Math.min(minY, focusedYear);
3266
+ const end = Math.max(maxY, focusedYear);
3267
+ return Array.from({ length: end - start + 1 }, (_, i) => start + i);
3268
+ }, [focusedDate, focusedCalendar, focusedYear, minValue, maxValue]);
3269
+ if (!state || !focusedDate) return null;
3270
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "ddga-date-picker-calendar__nav-selects", "data-slot": "date-picker-calendar-nav", children: [
3271
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3272
+ "select",
3273
+ {
3274
+ "aria-label": monthLabel,
3275
+ className: "ddga-date-picker-calendar__select ddga-date-picker-calendar__month-select",
3276
+ "data-slot": "date-picker-month-select",
3277
+ value: focusedDate.month,
3278
+ onChange: (e) => state.setFocusedDate(focusedDate.set({ month: Number(e.target.value) })),
3279
+ children: monthNames.map((name, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: i + 1, children: name }, i + 1))
3280
+ }
3281
+ ),
3282
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3283
+ "select",
3284
+ {
3285
+ "aria-label": yearLabel,
3286
+ className: "ddga-date-picker-calendar__select ddga-date-picker-calendar__year-select",
3287
+ "data-slot": "date-picker-year-select",
3288
+ value: focusedDate.year,
3289
+ onChange: (e) => state.setFocusedDate(focusedDate.set({ year: Number(e.target.value) })),
3290
+ children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: y, children: y }, y))
3291
+ }
3292
+ )
3293
+ ] });
3294
+ }
3295
+ function CalendarDayCell({ date, showSecondary, calendarSystem }) {
3296
+ const state = (0, import_react16.useContext)(import_react_aria_components.CalendarStateContext);
3297
+ const start = state?.visibleRange.start;
3298
+ const isOutside = !!start && (date.year !== start.year || date.month !== start.month);
3299
+ const isOutOfBounds = state ? state.isInvalid(date) : false;
3300
+ if (state && isOutside && !isOutOfBounds) {
3301
+ const selected = state.value;
3302
+ const isSelected = !!selected && selected.year === date.year && selected.month === date.month && selected.day === date.day;
3303
+ const handleSelect = () => {
3304
+ state.setFocusedDate(date);
3305
+ state.selectDate(date);
3306
+ };
3307
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("td", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3308
+ "button",
3309
+ {
3310
+ type: "button",
3311
+ tabIndex: -1,
3312
+ className: "ddga-date-picker-calendar__cell",
3313
+ "data-outside-month": "",
3314
+ "data-selected": isSelected ? "" : void 0,
3315
+ "data-slot": "date-picker-day-cell",
3316
+ onClick: handleSelect,
3317
+ children: showSecondary ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
3318
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-date-picker-calendar__cell-primary", children: date.day }),
3319
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
3320
+ ] }) : String(date.day)
3321
+ }
3322
+ ) });
3323
+ }
3324
+ 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: [
3325
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ddga-date-picker-calendar__cell-primary", children: formattedDate }),
3326
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker-calendar__cell-secondary", children: secondaryDayNumber(date, calendarSystem) })
3327
+ ] }) : formattedDate });
3328
+ }
3329
+ function DatePicker({
3330
+ value: controlledValue,
3331
+ defaultValue,
3332
+ onChange,
3333
+ minValue,
3334
+ maxValue,
3335
+ label,
3336
+ helperText,
3337
+ errorMessage,
3338
+ error,
3339
+ required,
3340
+ disabled,
3341
+ size,
3342
+ id,
2928
3343
  className,
2929
- style: consumerStyle,
2930
- children
3344
+ "aria-label": ariaLabel,
3345
+ "aria-labelledby": ariaLabelledBy,
3346
+ calendar: controlledCalendar,
3347
+ defaultCalendar = "gregorian",
3348
+ onCalendarChange,
3349
+ showCalendarToggle = true,
3350
+ calendarLabels,
3351
+ showSecondaryCalendar = false
2931
3352
  }) {
2932
- const parentCtx = (0, import_react16.useContext)(DgaContext);
2933
- const isNested = parentCtx !== null;
2934
- const [rootEl, setRootEl] = (0, import_react16.useState)(null);
2935
- const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
2936
- const ctxValue = (0, import_react16.useMemo)(
2937
- () => ({ dir, locale: resolvedLocale, mode, rootEl }),
2938
- [dir, resolvedLocale, mode, rootEl]
3353
+ const isValueControlled = controlledValue !== void 0;
3354
+ const [internalValue, setInternalValue] = (0, import_react16.useState)(
3355
+ () => dateToCalendarDate(defaultValue)
2939
3356
  );
2940
- const themeVars = (0, import_react16.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
2941
- const inner = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_radix_ui21.Direction.Provider, { dir, children });
2942
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2943
- Component,
3357
+ const value = isValueControlled ? dateToCalendarDate(controlledValue) : internalValue;
3358
+ const handleAriaChange = (0, import_react16.useCallback)(
3359
+ (next) => {
3360
+ const nextCD = next ? new import_date.CalendarDate(next.year, next.month, next.day) : null;
3361
+ if (!isValueControlled) setInternalValue(nextCD);
3362
+ onChange?.(calendarDateToDate(nextCD));
3363
+ },
3364
+ [isValueControlled, onChange]
3365
+ );
3366
+ const isCalendarControlled = controlledCalendar !== void 0;
3367
+ const [internalCalendar, setInternalCalendar] = (0, import_react16.useState)(defaultCalendar);
3368
+ const calendarSystem = isCalendarControlled ? controlledCalendar : internalCalendar;
3369
+ const setCalendar = (0, import_react16.useCallback)(
3370
+ (next) => {
3371
+ if (!isCalendarControlled) setInternalCalendar(next);
3372
+ onCalendarChange?.(next);
3373
+ },
3374
+ [isCalendarControlled, onCalendarChange]
3375
+ );
3376
+ const dgaCtx = (0, import_react16.useContext)(DgaContext);
3377
+ const dgaLocale = dgaCtx?.locale ?? "en";
3378
+ const ariaLocale = (0, import_react16.useMemo)(
3379
+ () => composeLocale(dgaLocale, calendarSystem),
3380
+ [dgaLocale, calendarSystem]
3381
+ );
3382
+ const portalContainer = dgaCtx?.portalEl ?? dgaCtx?.rootEl ?? void 0;
3383
+ const dgaDir = dgaCtx?.dir ?? "ltr";
3384
+ const PrevChevron = dgaDir === "rtl" ? ChevronRight : ChevronLeft;
3385
+ const NextChevron = dgaDir === "rtl" ? ChevronLeft : ChevronRight;
3386
+ const resolvedLabels = (0, import_react16.useMemo)(() => {
3387
+ if (calendarLabels) return calendarLabels;
3388
+ const isArabic = dgaLocale.startsWith("ar");
3389
+ return isArabic ? { gregorian: "\u0645\u064A\u0644\u0627\u062F\u064A", hijri: "\u0647\u062C\u0631\u064A" } : { gregorian: "Gregorian", hijri: "Hijri" };
3390
+ }, [calendarLabels, dgaLocale]);
3391
+ const navLabels = (0, import_react16.useMemo)(
3392
+ () => dgaLocale.startsWith("ar") ? { month: "\u0627\u0644\u0634\u0647\u0631", year: "\u0627\u0644\u0633\u0646\u0629" } : { month: "Month", year: "Year" },
3393
+ [dgaLocale]
3394
+ );
3395
+ const ariaMinValue = (0, import_react16.useMemo)(() => dateToCalendarDate(minValue) ?? void 0, [minValue]);
3396
+ const ariaMaxValue = (0, import_react16.useMemo)(() => dateToCalendarDate(maxValue) ?? void 0, [maxValue]);
3397
+ const dialogAriaLabel = ariaLabel ?? (typeof label === "string" ? label : ariaLabelledBy ? void 0 : "Date");
3398
+ const showToggle = showCalendarToggle && !isCalendarControlled;
3399
+ const hasError = !!error;
3400
+ const hasErrorMessage = hasError && errorMessage != null && errorMessage !== "";
3401
+ const hasHelper = !hasErrorMessage && helperText != null && helperText !== "";
3402
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.I18nProvider, { locale: ariaLocale, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3403
+ import_react_aria_components.DatePicker,
2944
3404
  {
2945
- ref: setRootEl,
2946
- dir,
2947
- lang: resolvedLocale,
2948
- "data-slot": "dga-root",
2949
- "data-theme": mode,
2950
- className,
2951
- style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
2952
- children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_radix_ui21.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
3405
+ value,
3406
+ onChange: handleAriaChange,
3407
+ minValue: ariaMinValue,
3408
+ maxValue: ariaMaxValue,
3409
+ isRequired: required,
3410
+ isDisabled: disabled,
3411
+ isInvalid: hasError,
3412
+ shouldCloseOnSelect: true,
3413
+ id,
3414
+ "aria-label": ariaLabel,
3415
+ "aria-labelledby": ariaLabelledBy,
3416
+ className: "ddga-field",
3417
+ "data-slot": "date-picker-field",
3418
+ children: [
3419
+ label && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_aria_components.Label, { className: "ddga-date-picker__label", children: [
3420
+ label,
3421
+ required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-hidden": "true", className: "ddga-date-picker__required", children: "*" })
3422
+ ] }),
3423
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3424
+ import_react_aria_components.Group,
3425
+ {
3426
+ "data-slot": "date-picker-trigger",
3427
+ className: cn(datePickerTriggerVariants({ size, error: hasError }), className),
3428
+ children: [
3429
+ /* @__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)(
3430
+ import_react_aria_components.DateSegment,
3431
+ {
3432
+ segment,
3433
+ className: "ddga-date-picker__segment",
3434
+ "data-slot": "date-picker-segment"
3435
+ }
3436
+ ) }),
3437
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3438
+ import_react_aria_components.Button,
3439
+ {
3440
+ className: "ddga-date-picker__icon-button",
3441
+ "aria-label": "Open calendar",
3442
+ "data-slot": "date-picker-trigger-button",
3443
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CalendarIcon, { "aria-hidden": "true", className: "ddga-date-picker__icon" })
3444
+ }
3445
+ )
3446
+ ]
3447
+ }
3448
+ ),
3449
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3450
+ import_react_aria_components.Text,
3451
+ {
3452
+ slot: "description",
3453
+ className: "ddga-field__message ddga-field__message--helper",
3454
+ "data-slot": "field-helper",
3455
+ children: helperText
3456
+ }
3457
+ ),
3458
+ hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3459
+ import_react_aria_components.FieldError,
3460
+ {
3461
+ className: "ddga-field__message ddga-field__message--error",
3462
+ "data-slot": "field-error",
3463
+ children: errorMessage
3464
+ }
3465
+ ),
3466
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3467
+ import_react_aria_components.Popover,
3468
+ {
3469
+ UNSTABLE_portalContainer: portalContainer,
3470
+ className: "ddga-date-picker-popover",
3471
+ "data-slot": "date-picker-popover",
3472
+ offset: 6,
3473
+ containerPadding: 12,
3474
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3475
+ import_react_aria_components.Dialog,
3476
+ {
3477
+ className: "ddga-date-picker-dialog",
3478
+ "data-slot": "date-picker-dialog",
3479
+ "aria-label": dialogAriaLabel,
3480
+ "aria-labelledby": ariaLabelledBy,
3481
+ children: [
3482
+ showToggle && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3483
+ "div",
3484
+ {
3485
+ role: "tablist",
3486
+ "aria-label": "Calendar system",
3487
+ className: "ddga-date-picker-toggle",
3488
+ "data-slot": "date-picker-toggle",
3489
+ children: [
3490
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3491
+ "button",
3492
+ {
3493
+ type: "button",
3494
+ role: "tab",
3495
+ "aria-selected": calendarSystem === "gregorian",
3496
+ className: "ddga-date-picker-toggle__button",
3497
+ "data-active": calendarSystem === "gregorian" ? "" : void 0,
3498
+ onClick: () => setCalendar("gregorian"),
3499
+ children: resolvedLabels.gregorian
3500
+ }
3501
+ ),
3502
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3503
+ "button",
3504
+ {
3505
+ type: "button",
3506
+ role: "tab",
3507
+ "aria-selected": calendarSystem === "hijri",
3508
+ className: "ddga-date-picker-toggle__button",
3509
+ "data-active": calendarSystem === "hijri" ? "" : void 0,
3510
+ onClick: () => setCalendar("hijri"),
3511
+ children: resolvedLabels.hijri
3512
+ }
3513
+ )
3514
+ ]
3515
+ }
3516
+ ),
3517
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_aria_components.Calendar, { className: "ddga-date-picker-calendar", "data-slot": "date-picker-calendar", children: [
3518
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("header", { className: "ddga-date-picker-calendar__header", children: [
3519
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3520
+ import_react_aria_components.Button,
3521
+ {
3522
+ slot: "previous",
3523
+ className: "ddga-date-picker-calendar__nav",
3524
+ "data-slot": "date-picker-calendar-prev",
3525
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PrevChevron, { "aria-hidden": "true" })
3526
+ }
3527
+ ),
3528
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3529
+ CalendarNavHeader,
3530
+ {
3531
+ locale: ariaLocale,
3532
+ monthLabel: navLabels.month,
3533
+ yearLabel: navLabels.year
3534
+ }
3535
+ ),
3536
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3537
+ import_react_aria_components.Button,
3538
+ {
3539
+ slot: "next",
3540
+ className: "ddga-date-picker-calendar__nav",
3541
+ "data-slot": "date-picker-calendar-next",
3542
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NextChevron, { "aria-hidden": "true" })
3543
+ }
3544
+ )
3545
+ ] }),
3546
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_aria_components.CalendarGrid, { className: "ddga-date-picker-calendar__grid", children: [
3547
+ /* @__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 }) }),
3548
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3549
+ CalendarDayCell,
3550
+ {
3551
+ date,
3552
+ showSecondary: showSecondaryCalendar,
3553
+ calendarSystem
3554
+ }
3555
+ ) })
3556
+ ] })
3557
+ ] })
3558
+ ]
3559
+ }
3560
+ )
3561
+ }
3562
+ )
3563
+ ]
2953
3564
  }
2954
3565
  ) });
2955
3566
  }
2956
3567
 
3568
+ // src/components/FileUpload/FileUpload.tsx
3569
+ var import_react17 = require("react");
3570
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3571
+ function matchesAccept(file, accept) {
3572
+ if (!accept) return true;
3573
+ const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
3574
+ if (tokens.length === 0) return true;
3575
+ const name = file.name.toLowerCase();
3576
+ const type = file.type.toLowerCase();
3577
+ return tokens.some((token) => {
3578
+ if (token.startsWith(".")) return name.endsWith(token);
3579
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, token.indexOf("/") + 1));
3580
+ return type === token;
3581
+ });
3582
+ }
3583
+ function splitFiles(incoming, config) {
3584
+ const { accept, maxSize, maxFiles, currentCount } = config;
3585
+ const accepted = [];
3586
+ const rejections = [];
3587
+ for (const file of incoming) {
3588
+ const errors = [];
3589
+ if (!matchesAccept(file, accept)) errors.push("file-invalid-type");
3590
+ if (maxSize != null && file.size > maxSize) errors.push("file-too-large");
3591
+ if (errors.length > 0) {
3592
+ rejections.push({ file, errors });
3593
+ continue;
3594
+ }
3595
+ if (maxFiles != null && currentCount + accepted.length >= maxFiles) {
3596
+ rejections.push({ file, errors: ["too-many-files"] });
3597
+ continue;
3598
+ }
3599
+ accepted.push(file);
3600
+ }
3601
+ return { accepted, rejections };
3602
+ }
3603
+ var UNITS = ["B", "KB", "MB", "GB", "TB"];
3604
+ function formatBytes(bytes) {
3605
+ if (bytes === 0) return "0 B";
3606
+ const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), UNITS.length - 1);
3607
+ const value = bytes / 1024 ** exponent;
3608
+ return `${exponent === 0 ? value : value.toFixed(1)} ${UNITS[exponent]}`;
3609
+ }
3610
+ function FileUpload({
3611
+ files,
3612
+ onFilesAdded,
3613
+ onFilesRejected,
3614
+ onRemove,
3615
+ accept,
3616
+ maxSize,
3617
+ maxFiles,
3618
+ multiple = true,
3619
+ disabled = false,
3620
+ required,
3621
+ label,
3622
+ helperText,
3623
+ errorMessage,
3624
+ error,
3625
+ hint = "Drag files here, or click to browse",
3626
+ removeLabel = "Remove",
3627
+ id: externalId,
3628
+ className,
3629
+ ...props
3630
+ }) {
3631
+ const inputRef = (0, import_react17.useRef)(null);
3632
+ const [isDragging, setIsDragging] = (0, import_react17.useState)(false);
3633
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
3634
+ name: "FileUpload",
3635
+ id: externalId,
3636
+ label,
3637
+ error,
3638
+ errorMessage,
3639
+ helperText,
3640
+ "aria-label": props["aria-label"],
3641
+ "aria-labelledby": props["aria-labelledby"]
3642
+ });
3643
+ const effectiveMaxFiles = multiple ? maxFiles : 1;
3644
+ function process2(incoming) {
3645
+ if (disabled || incoming.length === 0) return;
3646
+ const { accepted, rejections } = splitFiles(incoming, {
3647
+ accept,
3648
+ maxSize,
3649
+ maxFiles: effectiveMaxFiles,
3650
+ currentCount: files.length
3651
+ });
3652
+ if (accepted.length > 0) onFilesAdded(accepted);
3653
+ if (rejections.length > 0) onFilesRejected?.(rejections);
3654
+ }
3655
+ function handleInputChange(event) {
3656
+ process2(Array.from(event.target.files ?? []));
3657
+ event.target.value = "";
3658
+ }
3659
+ function handleDrop(event) {
3660
+ event.preventDefault();
3661
+ setIsDragging(false);
3662
+ if (disabled) return;
3663
+ process2(Array.from(event.dataTransfer.files));
3664
+ }
3665
+ function handleDragOver(event) {
3666
+ event.preventDefault();
3667
+ if (!disabled) setIsDragging(true);
3668
+ }
3669
+ function handleDragLeave(event) {
3670
+ if (!event.currentTarget.contains(event.relatedTarget)) {
3671
+ setIsDragging(false);
3672
+ }
3673
+ }
3674
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-slot": "file-upload-field", className: cn("ddga-field", "ddga-file-upload", className), children: [
3675
+ label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { htmlFor: fieldId, className: "ddga-file-upload__label", children: [
3676
+ label,
3677
+ required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { "aria-hidden": "true", className: "ddga-file-upload__required", children: "*" })
3678
+ ] }),
3679
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3680
+ "div",
3681
+ {
3682
+ "data-slot": "file-upload-dropzone",
3683
+ className: cn(
3684
+ "ddga-file-upload__dropzone",
3685
+ hasError && "ddga-file-upload__dropzone--error"
3686
+ ),
3687
+ "data-dragging": isDragging || void 0,
3688
+ "data-disabled": disabled || void 0,
3689
+ "aria-disabled": disabled || void 0,
3690
+ onClick: () => {
3691
+ if (!disabled) inputRef.current?.click();
3692
+ },
3693
+ onDragOver: handleDragOver,
3694
+ onDragLeave: handleDragLeave,
3695
+ onDrop: handleDrop,
3696
+ children: [
3697
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Upload, { className: "ddga-file-upload__icon", "aria-hidden": "true" }),
3698
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__hint", children: hint }),
3699
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3700
+ "input",
3701
+ {
3702
+ ...controlProps,
3703
+ ref: inputRef,
3704
+ type: "file",
3705
+ className: "ddga-file-upload__input",
3706
+ accept,
3707
+ multiple,
3708
+ disabled,
3709
+ required,
3710
+ onChange: handleInputChange,
3711
+ onClick: (event) => event.stopPropagation(),
3712
+ "data-slot": "file-upload-input"
3713
+ }
3714
+ )
3715
+ ]
3716
+ }
3717
+ ),
3718
+ hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
3719
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText }),
3720
+ files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { "data-slot": "file-upload-list", className: "ddga-file-upload__list", children: files.map((item) => {
3721
+ const status = item.status ?? "pending";
3722
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3723
+ "li",
3724
+ {
3725
+ "data-slot": "file-upload-item",
3726
+ "data-status": status,
3727
+ className: "ddga-file-upload__item",
3728
+ children: [
3729
+ /* @__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, {}) }),
3730
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "ddga-file-upload__item-main", children: [
3731
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "ddga-file-upload__item-head", children: [
3732
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__item-name", title: item.file.name, children: item.file.name }),
3733
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "ddga-file-upload__item-meta", children: formatBytes(item.file.size) })
3734
+ ] }),
3735
+ status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3736
+ Progress,
3737
+ {
3738
+ size: "sm",
3739
+ value: item.progress ?? 0,
3740
+ "aria-label": `Uploading ${item.file.name}`,
3741
+ className: "ddga-file-upload__item-progress"
3742
+ }
3743
+ ),
3744
+ status === "error" && item.error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { role: "alert", className: "ddga-file-upload__item-error", children: item.error })
3745
+ ] }),
3746
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3747
+ Button,
3748
+ {
3749
+ type: "button",
3750
+ variant: "ghost",
3751
+ size: "icon-sm",
3752
+ "aria-label": `${removeLabel}: ${item.file.name}`,
3753
+ onClick: () => onRemove(item.id),
3754
+ className: "ddga-file-upload__item-remove",
3755
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Close, { "aria-hidden": "true" })
3756
+ }
3757
+ )
3758
+ ]
3759
+ },
3760
+ item.id
3761
+ );
3762
+ }) })
3763
+ ] });
3764
+ }
3765
+
3766
+ // src/components/Slider/Slider.tsx
3767
+ var import_react18 = require("react");
3768
+ var import_radix_ui21 = require("radix-ui");
3769
+ var import_class_variance_authority28 = require("class-variance-authority");
3770
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3771
+ var sliderVariants = (0, import_class_variance_authority28.cva)("ddga-slider", {
3772
+ variants: {
3773
+ size: {
3774
+ sm: "ddga-slider--sm",
3775
+ md: "ddga-slider--md"
3776
+ },
3777
+ error: {
3778
+ true: "ddga-slider--error"
3779
+ }
3780
+ },
3781
+ defaultVariants: {
3782
+ size: "md"
3783
+ }
3784
+ });
3785
+ var DEFAULT_THUMB_LABELS = ["Minimum", "Maximum"];
3786
+ function toArray(value) {
3787
+ if (value === void 0) return void 0;
3788
+ return Array.isArray(value) ? value : [value];
3789
+ }
3790
+ function Slider({
3791
+ id: externalId,
3792
+ value,
3793
+ defaultValue,
3794
+ onValueChange,
3795
+ onValueCommit,
3796
+ min = 0,
3797
+ max = 100,
3798
+ size,
3799
+ label,
3800
+ helperText,
3801
+ errorMessage,
3802
+ error,
3803
+ showValue = false,
3804
+ formatValue,
3805
+ thumbLabels = DEFAULT_THUMB_LABELS,
3806
+ className,
3807
+ ...props
3808
+ }) {
3809
+ const labelId = (0, import_react18.useId)();
3810
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
3811
+ name: "Slider",
3812
+ id: externalId,
3813
+ label,
3814
+ error,
3815
+ errorMessage,
3816
+ helperText,
3817
+ "aria-label": props["aria-label"],
3818
+ "aria-labelledby": props["aria-labelledby"] ?? (label ? labelId : void 0)
3819
+ });
3820
+ const isRange = Array.isArray(value ?? defaultValue);
3821
+ const valueArray = toArray(value);
3822
+ const defaultArray = toArray(defaultValue) ?? [min];
3823
+ const wrap = (next) => isRange ? next : next[0];
3824
+ const currentForRender = valueArray ?? defaultArray;
3825
+ const fmt = (n) => formatValue ? formatValue(n) : String(n);
3826
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-slot": "slider-field", className: "ddga-field", children: [
3827
+ (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "ddga-slider__header", children: [
3828
+ label && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { id: labelId, className: "ddga-slider__label", children: label }),
3829
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ddga-slider__value", "aria-hidden": "true", children: currentForRender.map(fmt).join(" \u2013 ") })
3830
+ ] }),
3831
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
3832
+ import_radix_ui21.Slider.Root,
3833
+ {
3834
+ ...props,
3835
+ id: fieldId,
3836
+ min,
3837
+ max,
3838
+ value: valueArray,
3839
+ defaultValue: value === void 0 ? defaultArray : void 0,
3840
+ onValueChange: onValueChange ? (next) => onValueChange(wrap(next)) : void 0,
3841
+ onValueCommit: onValueCommit ? (next) => onValueCommit(wrap(next)) : void 0,
3842
+ "aria-invalid": controlProps["aria-invalid"],
3843
+ "data-slot": "slider",
3844
+ className: cn(sliderVariants({ size, error: hasError }), className),
3845
+ children: [
3846
+ /* @__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" }) }),
3847
+ currentForRender.map((thumbValue, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3848
+ import_radix_ui21.Slider.Thumb,
3849
+ {
3850
+ "data-slot": "slider-thumb",
3851
+ className: "ddga-slider__thumb",
3852
+ "aria-label": isRange ? thumbLabels[index] : void 0,
3853
+ "aria-labelledby": !isRange && label ? labelId : void 0,
3854
+ "aria-valuetext": formatValue ? fmt(thumbValue) : void 0,
3855
+ "aria-describedby": controlProps["aria-describedby"]
3856
+ },
3857
+ index
3858
+ ))
3859
+ ]
3860
+ }
3861
+ ),
3862
+ hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
3863
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
3864
+ ] });
3865
+ }
3866
+
3867
+ // src/components/NumberInput/NumberInput.tsx
3868
+ var import_react19 = require("react");
3869
+ var import_class_variance_authority29 = require("class-variance-authority");
3870
+ var import_jsx_runtime32 = require("react/jsx-runtime");
3871
+ var numberInputVariants = (0, import_class_variance_authority29.cva)("ddga-number-input", {
3872
+ variants: {
3873
+ size: {
3874
+ sm: "ddga-number-input--sm",
3875
+ md: "ddga-number-input--md",
3876
+ lg: "ddga-number-input--lg"
3877
+ },
3878
+ error: {
3879
+ true: "ddga-number-input--error"
3880
+ }
3881
+ },
3882
+ defaultVariants: {
3883
+ size: "md"
3884
+ }
3885
+ });
3886
+ function clamp(value, min, max) {
3887
+ let next = value;
3888
+ if (min != null) next = Math.max(min, next);
3889
+ if (max != null) next = Math.min(max, next);
3890
+ return next;
3891
+ }
3892
+ function formatNumber(value) {
3893
+ if (!Number.isFinite(value)) return "";
3894
+ return value.toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 20 });
3895
+ }
3896
+ function NumberInput({
3897
+ id: externalId,
3898
+ value,
3899
+ defaultValue,
3900
+ onValueChange,
3901
+ min,
3902
+ max,
3903
+ step = 1,
3904
+ size,
3905
+ hideControls = false,
3906
+ decrementLabel = "Decrease",
3907
+ incrementLabel = "Increase",
3908
+ label,
3909
+ helperText,
3910
+ errorMessage,
3911
+ error,
3912
+ required,
3913
+ disabled,
3914
+ className,
3915
+ onBlur,
3916
+ onKeyDown,
3917
+ ...props
3918
+ }) {
3919
+ const isControlled = value !== void 0;
3920
+ const [internal, setInternal] = (0, import_react19.useState)(defaultValue ?? null);
3921
+ const numericValue = isControlled ? value : internal;
3922
+ const [draft, setDraft] = (0, import_react19.useState)(null);
3923
+ const allowDecimal = !Number.isInteger(step);
3924
+ const allowNegative = min == null || min < 0;
3925
+ const displayValue = draft ?? (numericValue == null ? "" : formatNumber(numericValue));
3926
+ const allowedPattern = new RegExp(
3927
+ `^${allowNegative ? "-?" : ""}\\d*${allowDecimal ? "(\\.\\d*)?" : ""}$`
3928
+ );
3929
+ function commit(next) {
3930
+ if (!isControlled) setInternal(next);
3931
+ onValueChange?.(next);
3932
+ }
3933
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
3934
+ name: "NumberInput",
3935
+ id: externalId,
3936
+ label,
3937
+ error,
3938
+ errorMessage,
3939
+ helperText,
3940
+ "aria-label": props["aria-label"],
3941
+ "aria-labelledby": props["aria-labelledby"]
3942
+ });
3943
+ function handleChange(event) {
3944
+ const raw = event.target.value;
3945
+ if (!allowedPattern.test(raw)) return;
3946
+ setDraft(raw);
3947
+ if (raw.trim() === "") {
3948
+ commit(null);
3949
+ return;
3950
+ }
3951
+ const parsed = Number(raw);
3952
+ if (Number.isFinite(parsed)) commit(parsed);
3953
+ }
3954
+ function handleBlur(event) {
3955
+ if (numericValue != null) commit(clamp(numericValue, min, max));
3956
+ setDraft(null);
3957
+ onBlur?.(event);
3958
+ }
3959
+ function stepBy(direction) {
3960
+ const base = numericValue ?? (direction > 0 ? min ?? 0 : max ?? 0);
3961
+ const next = clamp(base + direction * step, min, max);
3962
+ const rounded = allowDecimal ? Number(next.toFixed(10)) : next;
3963
+ commit(rounded);
3964
+ setDraft(null);
3965
+ }
3966
+ function handleKeyDown(event) {
3967
+ if (!disabled) {
3968
+ if (event.key === "ArrowUp") {
3969
+ event.preventDefault();
3970
+ stepBy(1);
3971
+ } else if (event.key === "ArrowDown") {
3972
+ event.preventDefault();
3973
+ stepBy(-1);
3974
+ }
3975
+ }
3976
+ onKeyDown?.(event);
3977
+ }
3978
+ const atMin = min != null && numericValue != null && numericValue <= min;
3979
+ const atMax = max != null && numericValue != null && numericValue >= max;
3980
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-slot": "number-input-field", className: "ddga-field", children: [
3981
+ label && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { htmlFor: fieldId, className: "ddga-number-input__label", children: [
3982
+ label,
3983
+ required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { "aria-hidden": "true", className: "ddga-number-input__required", children: "*" })
3984
+ ] }),
3985
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
3986
+ "div",
3987
+ {
3988
+ "data-slot": "number-input-control",
3989
+ className: cn(numberInputVariants({ size, error: hasError }), className),
3990
+ children: [
3991
+ !hideControls && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3992
+ "button",
3993
+ {
3994
+ type: "button",
3995
+ "data-slot": "number-input-decrement",
3996
+ className: "ddga-number-input__step ddga-number-input__step--decrement",
3997
+ "aria-label": decrementLabel,
3998
+ onClick: () => stepBy(-1),
3999
+ disabled: disabled || atMin,
4000
+ tabIndex: -1,
4001
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Minus, { "aria-hidden": "true" })
4002
+ }
4003
+ ),
4004
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4005
+ "input",
4006
+ {
4007
+ ...props,
4008
+ ...controlProps,
4009
+ type: "text",
4010
+ inputMode: allowDecimal ? "decimal" : "numeric",
4011
+ value: displayValue,
4012
+ required,
4013
+ disabled,
4014
+ onChange: handleChange,
4015
+ onBlur: handleBlur,
4016
+ onKeyDown: handleKeyDown,
4017
+ "data-slot": "number-input",
4018
+ className: "ddga-number-input__field"
4019
+ }
4020
+ ),
4021
+ !hideControls && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4022
+ "button",
4023
+ {
4024
+ type: "button",
4025
+ "data-slot": "number-input-increment",
4026
+ className: "ddga-number-input__step ddga-number-input__step--increment",
4027
+ "aria-label": incrementLabel,
4028
+ onClick: () => stepBy(1),
4029
+ disabled: disabled || atMax,
4030
+ tabIndex: -1,
4031
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Plus, { "aria-hidden": "true" })
4032
+ }
4033
+ )
4034
+ ]
4035
+ }
4036
+ ),
4037
+ hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
4038
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
4039
+ ] });
4040
+ }
4041
+
4042
+ // src/components/Rating/Rating.tsx
4043
+ var import_react20 = require("react");
4044
+ var import_class_variance_authority30 = require("class-variance-authority");
4045
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4046
+ var ratingVariants = (0, import_class_variance_authority30.cva)("ddga-rating", {
4047
+ variants: {
4048
+ size: {
4049
+ sm: "ddga-rating--sm",
4050
+ md: "ddga-rating--md",
4051
+ lg: "ddga-rating--lg"
4052
+ }
4053
+ },
4054
+ defaultVariants: {
4055
+ size: "md"
4056
+ }
4057
+ });
4058
+ function clamp2(value, min, max) {
4059
+ return Math.min(max, Math.max(min, value));
4060
+ }
4061
+ function defaultValueText(value, max) {
4062
+ return `${value} out of ${max} stars`;
4063
+ }
4064
+ function fillFor(index, value, allowHalf) {
4065
+ if (value >= index + 1) return "full";
4066
+ if (allowHalf && value >= index + 0.5) return "half";
4067
+ return "empty";
4068
+ }
4069
+ function Rating({
4070
+ id: externalId,
4071
+ value,
4072
+ defaultValue,
4073
+ onValueChange,
4074
+ max = 5,
4075
+ allowHalf = false,
4076
+ readOnly = false,
4077
+ disabled = false,
4078
+ size,
4079
+ label,
4080
+ helperText,
4081
+ errorMessage,
4082
+ error,
4083
+ formatValueText = defaultValueText,
4084
+ className,
4085
+ ...props
4086
+ }) {
4087
+ const rootRef = (0, import_react20.useRef)(null);
4088
+ const isControlled = value !== void 0;
4089
+ const [internal, setInternal] = (0, import_react20.useState)(defaultValue ?? 0);
4090
+ const currentValue = isControlled ? value : internal;
4091
+ const [hover, setHover] = (0, import_react20.useState)(null);
4092
+ const interactive = !readOnly && !disabled;
4093
+ const stepSize = allowHalf ? 0.5 : 1;
4094
+ const { fieldId, errorId, helperId, hasError, hasErrorMessage, hasHelper, controlProps } = useFieldA11y({
4095
+ name: "Rating",
4096
+ id: externalId,
4097
+ label,
4098
+ error,
4099
+ errorMessage,
4100
+ helperText,
4101
+ // role=slider / role=img always have an accessible name (label or the
4102
+ // value text), so suppress the no-label dev warning.
4103
+ "aria-label": props["aria-label"] ?? formatValueText(currentValue, max),
4104
+ "aria-labelledby": props["aria-labelledby"]
4105
+ });
4106
+ const displayValue = hover ?? currentValue;
4107
+ function commit(next) {
4108
+ if (!isControlled) setInternal(next);
4109
+ onValueChange?.(next);
4110
+ }
4111
+ function readDir() {
4112
+ const el = rootRef.current;
4113
+ if (!el || typeof getComputedStyle !== "function") return "ltr";
4114
+ return getComputedStyle(el).direction === "rtl" ? "rtl" : "ltr";
4115
+ }
4116
+ function pointerValue(event, index) {
4117
+ const rect = event.currentTarget.getBoundingClientRect();
4118
+ let fraction = rect.width ? (event.clientX - rect.left) / rect.width : 1;
4119
+ if (readDir() === "rtl") fraction = 1 - fraction;
4120
+ if (allowHalf) return index + (fraction <= 0.5 ? 0.5 : 1);
4121
+ return index + 1;
4122
+ }
4123
+ function handleKeyDown(event) {
4124
+ if (!interactive) return;
4125
+ const rtl = readDir() === "rtl";
4126
+ let next = null;
4127
+ switch (event.key) {
4128
+ case "ArrowUp":
4129
+ next = currentValue + stepSize;
4130
+ break;
4131
+ case "ArrowDown":
4132
+ next = currentValue - stepSize;
4133
+ break;
4134
+ case "ArrowRight":
4135
+ next = currentValue + (rtl ? -stepSize : stepSize);
4136
+ break;
4137
+ case "ArrowLeft":
4138
+ next = currentValue + (rtl ? stepSize : -stepSize);
4139
+ break;
4140
+ case "Home":
4141
+ next = 0;
4142
+ break;
4143
+ case "End":
4144
+ next = max;
4145
+ break;
4146
+ default:
4147
+ return;
4148
+ }
4149
+ event.preventDefault();
4150
+ commit(clamp2(next, 0, max));
4151
+ }
4152
+ const stars = Array.from({ length: max }, (_, index) => {
4153
+ const level = fillFor(index, displayValue, allowHalf);
4154
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4155
+ "span",
4156
+ {
4157
+ "data-slot": "rating-star",
4158
+ "data-fill": level,
4159
+ className: "ddga-rating__star",
4160
+ onPointerMove: interactive ? (event) => setHover(pointerValue(event, index)) : void 0,
4161
+ onClick: interactive ? (event) => commit(pointerValue(event, index)) : void 0,
4162
+ children: [
4163
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Star, { className: "ddga-rating__star-bg", "aria-hidden": "true" }),
4164
+ /* @__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" }) })
4165
+ ]
4166
+ },
4167
+ index
4168
+ );
4169
+ });
4170
+ const sharedProps = {
4171
+ ref: rootRef,
4172
+ "data-slot": "rating",
4173
+ "data-disabled": disabled || void 0,
4174
+ className: cn(ratingVariants({ size }), hasError && "ddga-rating--error", className),
4175
+ onPointerLeave: interactive ? () => setHover(null) : void 0
4176
+ };
4177
+ const labelledBy = label ? `${fieldId}-label` : props["aria-labelledby"];
4178
+ const ariaLabel = labelledBy ? void 0 : props["aria-label"] ?? "Rating";
4179
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { "data-slot": "rating-field", className: "ddga-field", children: [
4180
+ label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { id: `${fieldId}-label`, className: "ddga-rating__label", children: label }),
4181
+ readOnly ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ...sharedProps, role: "img", "aria-label": formatValueText(currentValue, max), children: stars }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4182
+ "div",
4183
+ {
4184
+ ...sharedProps,
4185
+ role: "slider",
4186
+ id: fieldId,
4187
+ tabIndex: disabled ? -1 : 0,
4188
+ "aria-valuemin": 0,
4189
+ "aria-valuemax": max,
4190
+ "aria-valuenow": currentValue,
4191
+ "aria-valuetext": formatValueText(currentValue, max),
4192
+ "aria-labelledby": labelledBy,
4193
+ "aria-label": ariaLabel,
4194
+ "aria-invalid": controlProps["aria-invalid"],
4195
+ "aria-describedby": controlProps["aria-describedby"],
4196
+ "aria-disabled": disabled || void 0,
4197
+ onKeyDown: handleKeyDown,
4198
+ children: stars
4199
+ }
4200
+ ),
4201
+ hasErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldMessage, { id: errorId, variant: "error", children: errorMessage }),
4202
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldMessage, { id: helperId, variant: "helper", children: helperText })
4203
+ ] });
4204
+ }
4205
+
4206
+ // src/components/Toggle/Toggle.tsx
4207
+ var import_radix_ui22 = require("radix-ui");
4208
+ var import_class_variance_authority31 = require("class-variance-authority");
4209
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4210
+ var toggleVariants = (0, import_class_variance_authority31.cva)("ddga-toggle", {
4211
+ variants: {
4212
+ variant: {
4213
+ default: "ddga-toggle--default",
4214
+ outline: "ddga-toggle--outline"
4215
+ },
4216
+ size: {
4217
+ sm: "ddga-toggle--sm",
4218
+ md: "ddga-toggle--md",
4219
+ lg: "ddga-toggle--lg"
4220
+ }
4221
+ },
4222
+ defaultVariants: {
4223
+ variant: "default",
4224
+ size: "md"
4225
+ }
4226
+ });
4227
+ var toggleGroupVariants = (0, import_class_variance_authority31.cva)("ddga-toggle-group", {
4228
+ variants: {
4229
+ variant: {
4230
+ default: "ddga-toggle-group--default",
4231
+ outline: "ddga-toggle-group--outline"
4232
+ },
4233
+ size: {
4234
+ sm: "ddga-toggle-group--sm",
4235
+ md: "ddga-toggle-group--md",
4236
+ lg: "ddga-toggle-group--lg"
4237
+ }
4238
+ },
4239
+ defaultVariants: {
4240
+ variant: "default",
4241
+ size: "md"
4242
+ }
4243
+ });
4244
+ function Toggle({ variant, size, className, ...props }) {
4245
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4246
+ import_radix_ui22.Toggle.Root,
4247
+ {
4248
+ "data-slot": "toggle",
4249
+ className: cn(toggleVariants({ variant, size }), className),
4250
+ ...props
4251
+ }
4252
+ );
4253
+ }
4254
+ function ToggleGroup({ variant, size, className, ...props }) {
4255
+ if (process.env.NODE_ENV === "development" && !props["aria-label"] && !props["aria-labelledby"]) {
4256
+ console.warn(
4257
+ "[@dev-dga/react] ToggleGroup should have an `aria-label` or `aria-labelledby` so the button group has an accessible name."
4258
+ );
4259
+ }
4260
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4261
+ import_radix_ui22.ToggleGroup.Root,
4262
+ {
4263
+ "data-slot": "toggle-group",
4264
+ className: cn(toggleGroupVariants({ variant, size }), className),
4265
+ ...props
4266
+ }
4267
+ );
4268
+ }
4269
+ function ToggleGroupItem({ className, ...props }) {
4270
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4271
+ import_radix_ui22.ToggleGroup.Item,
4272
+ {
4273
+ "data-slot": "toggle-group-item",
4274
+ className: cn("ddga-toggle-group__item", className),
4275
+ ...props
4276
+ }
4277
+ );
4278
+ }
4279
+
4280
+ // src/components/DescriptionList/DescriptionList.tsx
4281
+ var import_class_variance_authority32 = require("class-variance-authority");
4282
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4283
+ var descriptionListVariants = (0, import_class_variance_authority32.cva)("ddga-description-list", {
4284
+ variants: {
4285
+ orientation: {
4286
+ horizontal: "ddga-description-list--horizontal",
4287
+ vertical: "ddga-description-list--vertical"
4288
+ },
4289
+ divided: {
4290
+ true: "ddga-description-list--divided"
4291
+ }
4292
+ },
4293
+ defaultVariants: {
4294
+ orientation: "horizontal"
4295
+ }
4296
+ });
4297
+ function DescriptionList({ orientation, divided, className, ...props }) {
4298
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4299
+ "dl",
4300
+ {
4301
+ "data-slot": "description-list",
4302
+ className: cn(descriptionListVariants({ orientation, divided }), className),
4303
+ ...props
4304
+ }
4305
+ );
4306
+ }
4307
+ function DescriptionItem({ className, ...props }) {
4308
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4309
+ "div",
4310
+ {
4311
+ "data-slot": "description-item",
4312
+ className: cn("ddga-description-list__item", className),
4313
+ ...props
4314
+ }
4315
+ );
4316
+ }
4317
+ function DescriptionTerm({ className, ...props }) {
4318
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4319
+ "dt",
4320
+ {
4321
+ "data-slot": "description-term",
4322
+ className: cn("ddga-description-list__term", className),
4323
+ ...props
4324
+ }
4325
+ );
4326
+ }
4327
+ function DescriptionDetails({ className, ...props }) {
4328
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4329
+ "dd",
4330
+ {
4331
+ "data-slot": "description-details",
4332
+ className: cn("ddga-description-list__details", className),
4333
+ ...props
4334
+ }
4335
+ );
4336
+ }
4337
+
4338
+ // src/components/EmptyState/EmptyState.tsx
4339
+ var import_react21 = require("react");
4340
+ var import_radix_ui23 = require("radix-ui");
4341
+ var import_class_variance_authority33 = require("class-variance-authority");
4342
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4343
+ var emptyStateVariants = (0, import_class_variance_authority33.cva)("ddga-empty-state", {
4344
+ variants: {
4345
+ variant: {
4346
+ default: "ddga-empty-state--default",
4347
+ search: "ddga-empty-state--search",
4348
+ error: "ddga-empty-state--error",
4349
+ success: "ddga-empty-state--success"
4350
+ },
4351
+ size: {
4352
+ sm: "ddga-empty-state--sm",
4353
+ md: "ddga-empty-state--md",
4354
+ lg: "ddga-empty-state--lg"
4355
+ }
4356
+ },
4357
+ defaultVariants: {
4358
+ variant: "default",
4359
+ size: "md"
4360
+ }
4361
+ });
4362
+ var DEFAULT_ICONS3 = {
4363
+ default: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Inbox, { "aria-hidden": "true" }),
4364
+ search: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Search, { "aria-hidden": "true" }),
4365
+ error: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AlertCircle, { "aria-hidden": "true" }),
4366
+ success: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Check, { "aria-hidden": "true" })
4367
+ };
4368
+ function EmptyState({
4369
+ variant,
4370
+ size,
4371
+ icon,
4372
+ title,
4373
+ description,
4374
+ action,
4375
+ secondaryAction,
4376
+ className,
4377
+ children,
4378
+ ...props
4379
+ }) {
4380
+ const resolvedIcon = icon === false ? null : icon !== void 0 ? icon : DEFAULT_ICONS3[variant ?? "default"];
4381
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4382
+ "div",
4383
+ {
4384
+ "data-slot": "empty-state",
4385
+ "data-variant": variant ?? "default",
4386
+ "data-size": size ?? "md",
4387
+ className: cn(emptyStateVariants({ variant, size }), className),
4388
+ ...props,
4389
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
4390
+ resolvedIcon ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmptyStateMedia, { children: resolvedIcon }) : null,
4391
+ title ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmptyStateTitle, { children: title }) : null,
4392
+ description ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmptyStateDescription, { children: description }) : null,
4393
+ action || secondaryAction ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(EmptyStateActions, { children: [
4394
+ action,
4395
+ secondaryAction
4396
+ ] }) : null
4397
+ ] })
4398
+ }
4399
+ );
4400
+ }
4401
+ function EmptyStateMedia({ className, ...props }) {
4402
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4403
+ "div",
4404
+ {
4405
+ "data-slot": "empty-state-media",
4406
+ "aria-hidden": "true",
4407
+ className: cn("ddga-empty-state__media", className),
4408
+ ...props
4409
+ }
4410
+ );
4411
+ }
4412
+ function EmptyStateTitle({ asChild, className, ...props }) {
4413
+ const Comp = asChild ? import_radix_ui23.Slot.Slot : "h3";
4414
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4415
+ Comp,
4416
+ {
4417
+ "data-slot": "empty-state-title",
4418
+ className: cn("ddga-empty-state__title", className),
4419
+ ...props
4420
+ }
4421
+ );
4422
+ }
4423
+ function EmptyStateDescription({ asChild, className, ...props }) {
4424
+ const Comp = asChild ? import_radix_ui23.Slot.Slot : "p";
4425
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4426
+ Comp,
4427
+ {
4428
+ "data-slot": "empty-state-description",
4429
+ className: cn("ddga-empty-state__description", className),
4430
+ ...props
4431
+ }
4432
+ );
4433
+ }
4434
+ function EmptyStateActions({ asChild, className, ...props }) {
4435
+ const Comp = asChild ? import_radix_ui23.Slot.Slot : "div";
4436
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4437
+ Comp,
4438
+ {
4439
+ "data-slot": "empty-state-actions",
4440
+ className: cn("ddga-empty-state__actions", className),
4441
+ ...props
4442
+ }
4443
+ );
4444
+ }
4445
+
4446
+ // src/components/Stat/Stat.tsx
4447
+ var import_react22 = require("react");
4448
+ var import_class_variance_authority34 = require("class-variance-authority");
4449
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4450
+ var statVariants = (0, import_class_variance_authority34.cva)("ddga-stat", {
4451
+ variants: {
4452
+ variant: {
4453
+ flat: "ddga-stat--flat",
4454
+ elevated: "ddga-stat--elevated",
4455
+ accent: "ddga-stat--accent"
4456
+ },
4457
+ size: {
4458
+ sm: "ddga-stat--sm",
4459
+ md: "ddga-stat--md",
4460
+ lg: "ddga-stat--lg"
4461
+ }
4462
+ },
4463
+ defaultVariants: {
4464
+ variant: "flat",
4465
+ size: "md"
4466
+ }
4467
+ });
4468
+ var TREND_ICONS = {
4469
+ up: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CaretUp, { "aria-hidden": "true" }),
4470
+ down: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CaretDown, { "aria-hidden": "true" }),
4471
+ flat: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Minus, { "aria-hidden": "true" })
4472
+ };
4473
+ var TREND_SENTIMENT = {
4474
+ up: "positive",
4475
+ down: "negative",
4476
+ flat: "neutral"
4477
+ };
4478
+ function resolveSentiment(trend, sentiment) {
4479
+ if (sentiment) return sentiment;
4480
+ if (trend) return TREND_SENTIMENT[trend];
4481
+ return void 0;
4482
+ }
4483
+ function Stat({
4484
+ variant,
4485
+ size,
4486
+ label,
4487
+ value,
4488
+ change,
4489
+ changeLabel,
4490
+ trend,
4491
+ sentiment,
4492
+ icon,
4493
+ className,
4494
+ children,
4495
+ ...props
4496
+ }) {
4497
+ const resolvedSentiment = resolveSentiment(trend, sentiment);
4498
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4499
+ "div",
4500
+ {
4501
+ "data-slot": "stat",
4502
+ "data-variant": variant ?? "flat",
4503
+ "data-trend": trend,
4504
+ "data-sentiment": resolvedSentiment,
4505
+ className: cn(statVariants({ variant, size }), className),
4506
+ ...props,
4507
+ children: [
4508
+ label || icon ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ddga-stat__label-row", children: [
4509
+ label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatLabel, { children: label }) : null,
4510
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__icon", "aria-hidden": "true", children: icon }) : null
4511
+ ] }) : null,
4512
+ value ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StatValue, { children: value }) : null,
4513
+ 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,
4515
+ changeLabel ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__change-label", children: changeLabel }) : null
4516
+ ] }) : null,
4517
+ children
4518
+ ]
4519
+ }
4520
+ );
4521
+ }
4522
+ function StatLabel({ className, ...props }) {
4523
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-label", className: cn("ddga-stat__label", className), ...props });
4524
+ }
4525
+ function StatValue({ className, ...props }) {
4526
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-slot": "stat-value", className: cn("ddga-stat__value", className), ...props });
4527
+ }
4528
+ function StatChange({ trend, sentiment, className, children, ...props }) {
4529
+ const resolvedSentiment = resolveSentiment(trend, sentiment);
4530
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4531
+ "div",
4532
+ {
4533
+ "data-slot": "stat-change",
4534
+ "data-trend": trend,
4535
+ "data-sentiment": resolvedSentiment,
4536
+ className: cn(
4537
+ "ddga-stat__change",
4538
+ resolvedSentiment ? `ddga-stat__change--${resolvedSentiment}` : null,
4539
+ className
4540
+ ),
4541
+ ...props,
4542
+ children: [
4543
+ trend ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ddga-stat__change-icon", children: TREND_ICONS[trend] }) : null,
4544
+ children
4545
+ ]
4546
+ }
4547
+ );
4548
+ }
4549
+
4550
+ // src/components/Stat/StatGroup.tsx
4551
+ var import_class_variance_authority35 = require("class-variance-authority");
4552
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4553
+ var statGroupVariants = (0, import_class_variance_authority35.cva)("ddga-stat-group", {
4554
+ variants: {
4555
+ orientation: {
4556
+ horizontal: "ddga-stat-group--horizontal",
4557
+ vertical: "ddga-stat-group--vertical"
4558
+ },
4559
+ gap: {
4560
+ sm: "ddga-stat-group--gap-sm",
4561
+ md: "ddga-stat-group--gap-md",
4562
+ lg: "ddga-stat-group--gap-lg"
4563
+ }
4564
+ },
4565
+ defaultVariants: {
4566
+ orientation: "horizontal",
4567
+ gap: "md"
4568
+ }
4569
+ });
4570
+ function StatGroup({ orientation, gap, columns, className, style, ...props }) {
4571
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4572
+ "div",
4573
+ {
4574
+ "data-slot": "stat-group",
4575
+ className: cn(
4576
+ statGroupVariants({ orientation, gap }),
4577
+ columns != null && "ddga-stat-group--cols",
4578
+ className
4579
+ ),
4580
+ style: columns != null ? { "--ddga-stat-group-columns": columns, ...style } : style,
4581
+ ...props
4582
+ }
4583
+ );
4584
+ }
4585
+
4586
+ // src/components/Popover/Popover.tsx
4587
+ var import_react23 = require("react");
4588
+ var import_radix_ui24 = require("radix-ui");
4589
+ var import_class_variance_authority36 = require("class-variance-authority");
4590
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4591
+ var popoverContentVariants = (0, import_class_variance_authority36.cva)("ddga-popover", {
4592
+ variants: {
4593
+ size: {
4594
+ sm: "ddga-popover--sm",
4595
+ md: "ddga-popover--md"
4596
+ }
4597
+ },
4598
+ defaultVariants: {
4599
+ size: "md"
4600
+ }
4601
+ });
4602
+ function Popover(props) {
4603
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Root, { ...props });
4604
+ }
4605
+ function PopoverTrigger({ className, ...props }) {
4606
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Trigger, { "data-slot": "popover-trigger", className, ...props });
4607
+ }
4608
+ function PopoverAnchor(props) {
4609
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Anchor, { "data-slot": "popover-anchor", ...props });
4610
+ }
4611
+ function PopoverContent({
4612
+ size,
4613
+ arrow = false,
4614
+ sideOffset = 6,
4615
+ className,
4616
+ children,
4617
+ ...props
4618
+ }) {
4619
+ if (process.env.NODE_ENV === "development" && !props["aria-label"] && !props["aria-labelledby"]) {
4620
+ console.warn(
4621
+ '[@dev-dga/react] PopoverContent renders role="dialog" and should have an `aria-label` or `aria-labelledby` so the panel has an accessible name.'
4622
+ );
4623
+ }
4624
+ const ctx = (0, import_react23.useContext)(DgaContext);
4625
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
4626
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4627
+ import_radix_ui24.Popover.Content,
4628
+ {
4629
+ "data-slot": "popover-content",
4630
+ sideOffset,
4631
+ className: cn(popoverContentVariants({ size }), className),
4632
+ ...props,
4633
+ children: [
4634
+ children,
4635
+ arrow ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui24.Popover.Arrow, { className: "ddga-popover__arrow", width: 16, height: 8 }) : null
4636
+ ]
4637
+ }
4638
+ ) });
4639
+ }
4640
+ function PopoverClose({
4641
+ className,
4642
+ children,
4643
+ closeLabel = "Close",
4644
+ asChild,
4645
+ ...props
4646
+ }) {
4647
+ const hasRenderableChildren = children != null && children !== false;
4648
+ if (asChild || hasRenderableChildren) {
4649
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4650
+ import_radix_ui24.Popover.Close,
4651
+ {
4652
+ "data-slot": "popover-close",
4653
+ asChild,
4654
+ className,
4655
+ ...props,
4656
+ children
4657
+ }
4658
+ );
4659
+ }
4660
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4661
+ import_radix_ui24.Popover.Close,
4662
+ {
4663
+ "data-slot": "popover-close",
4664
+ "aria-label": closeLabel,
4665
+ className: cn("ddga-popover__close", className),
4666
+ ...props,
4667
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Close, { "aria-hidden": "true" })
4668
+ }
4669
+ );
4670
+ }
4671
+
4672
+ // src/components/Sidebar/Sidebar.tsx
4673
+ var import_react26 = require("react");
4674
+ var import_radix_ui25 = require("radix-ui");
4675
+
4676
+ // src/components/Sidebar/SidebarContext.ts
4677
+ var import_react24 = require("react");
4678
+ var SidebarContext = (0, import_react24.createContext)(null);
4679
+ function useSidebar() {
4680
+ const ctx = (0, import_react24.useContext)(SidebarContext);
4681
+ if (!ctx) {
4682
+ throw new Error("useSidebar must be used within a <SidebarProvider>");
4683
+ }
4684
+ return ctx;
4685
+ }
4686
+
4687
+ // src/components/Sidebar/useIsMobile.ts
4688
+ var import_react25 = require("react");
4689
+ function useIsMobile(breakpoint = 768) {
4690
+ const [isMobile, setIsMobile] = (0, import_react25.useState)(false);
4691
+ (0, import_react25.useEffect)(() => {
4692
+ const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
4693
+ const onChange = () => setIsMobile(mql.matches);
4694
+ onChange();
4695
+ mql.addEventListener("change", onChange);
4696
+ return () => mql.removeEventListener("change", onChange);
4697
+ }, [breakpoint]);
4698
+ return isMobile;
4699
+ }
4700
+
4701
+ // src/components/Sidebar/Sidebar.tsx
4702
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4703
+ function SidebarProvider({
4704
+ defaultOpen = true,
4705
+ open: openProp,
4706
+ onOpenChange,
4707
+ mobileBreakpoint = 768,
4708
+ keyboardShortcut = true,
4709
+ className,
4710
+ style,
4711
+ children,
4712
+ ...props
4713
+ }) {
4714
+ const isMobile = useIsMobile(mobileBreakpoint);
4715
+ const [openMobile, setOpenMobile] = (0, import_react26.useState)(false);
4716
+ const isControlled = openProp !== void 0;
4717
+ const [openInternal, setOpenInternal] = (0, import_react26.useState)(defaultOpen);
4718
+ const open = isControlled ? openProp : openInternal;
4719
+ const setOpen = (0, import_react26.useCallback)(
4720
+ (value2) => {
4721
+ if (!isControlled) setOpenInternal(value2);
4722
+ onOpenChange?.(value2);
4723
+ },
4724
+ [isControlled, onOpenChange]
4725
+ );
4726
+ const toggleSidebar = (0, import_react26.useCallback)(() => {
4727
+ if (isMobile) {
4728
+ setOpenMobile((v) => !v);
4729
+ return;
4730
+ }
4731
+ if (isControlled) {
4732
+ onOpenChange?.(!open);
4733
+ } else {
4734
+ setOpenInternal((v) => !v);
4735
+ }
4736
+ }, [isMobile, isControlled, onOpenChange, open]);
4737
+ (0, import_react26.useEffect)(() => {
4738
+ if (!keyboardShortcut) return;
4739
+ const onKeyDown = (e) => {
4740
+ if (e.key.toLowerCase() === "b" && (e.metaKey || e.ctrlKey)) {
4741
+ e.preventDefault();
4742
+ toggleSidebar();
4743
+ }
4744
+ };
4745
+ window.addEventListener("keydown", onKeyDown);
4746
+ return () => window.removeEventListener("keydown", onKeyDown);
4747
+ }, [keyboardShortcut, toggleSidebar]);
4748
+ const state = open ? "expanded" : "collapsed";
4749
+ const value = (0, import_react26.useMemo)(
4750
+ () => ({ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }),
4751
+ [state, open, setOpen, openMobile, isMobile, toggleSidebar]
4752
+ );
4753
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SidebarContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4754
+ "div",
4755
+ {
4756
+ "data-slot": "sidebar-wrapper",
4757
+ className: cn("ddga-sidebar-wrapper", className),
4758
+ style,
4759
+ ...props,
4760
+ children
4761
+ }
4762
+ ) });
4763
+ }
4764
+ function Sidebar({
4765
+ variant = "sidebar",
4766
+ collapsible = "icon",
4767
+ side = "start",
4768
+ className,
4769
+ children,
4770
+ "aria-label": ariaLabel = "Sidebar",
4771
+ ...props
4772
+ }) {
4773
+ const { isMobile, openMobile, setOpenMobile, state } = useSidebar();
4774
+ if (isMobile) {
4775
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Drawer, { open: openMobile, onOpenChange: setOpenMobile, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4776
+ DrawerContent,
4777
+ {
4778
+ side,
4779
+ size: "sm",
4780
+ "aria-label": ariaLabel,
4781
+ "data-mobile": "true",
4782
+ "data-variant": variant,
4783
+ "data-side": side,
4784
+ className: cn("ddga-sidebar", "ddga-sidebar--mobile", className),
4785
+ children
4786
+ }
4787
+ ) });
4788
+ }
4789
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4790
+ "aside",
4791
+ {
4792
+ "data-slot": "sidebar",
4793
+ "aria-label": ariaLabel,
4794
+ "data-state": state,
4795
+ "data-collapsible": collapsible,
4796
+ "data-variant": variant,
4797
+ "data-side": side,
4798
+ className: cn("ddga-sidebar", className),
4799
+ ...props,
4800
+ children
4801
+ }
4802
+ );
4803
+ }
4804
+ function SidebarTrigger({
4805
+ asChild,
4806
+ className,
4807
+ onClick,
4808
+ children,
4809
+ "aria-label": ariaLabel = "Toggle sidebar",
4810
+ ...props
4811
+ }) {
4812
+ const { toggleSidebar, open, openMobile, isMobile } = useSidebar();
4813
+ const Comp = asChild ? import_radix_ui25.Slot.Slot : "button";
4814
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4815
+ Comp,
4816
+ {
4817
+ type: asChild ? void 0 : "button",
4818
+ "data-slot": "sidebar-trigger",
4819
+ "aria-label": asChild ? void 0 : ariaLabel,
4820
+ "aria-haspopup": isMobile ? "dialog" : void 0,
4821
+ "aria-expanded": isMobile ? openMobile : open,
4822
+ className: cn("ddga-sidebar__trigger", className),
4823
+ onClick: (e) => {
4824
+ onClick?.(e);
4825
+ toggleSidebar();
4826
+ },
4827
+ ...props,
4828
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PanelLeft, { "aria-hidden": "true" })
4829
+ }
4830
+ );
4831
+ }
4832
+ function SidebarRail({
4833
+ className,
4834
+ "aria-label": ariaLabel = "Toggle sidebar",
4835
+ ...props
4836
+ }) {
4837
+ const { toggleSidebar } = useSidebar();
4838
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4839
+ "button",
4840
+ {
4841
+ type: "button",
4842
+ "data-slot": "sidebar-rail",
4843
+ "aria-label": ariaLabel,
4844
+ title: ariaLabel,
4845
+ tabIndex: -1,
4846
+ className: cn("ddga-sidebar__rail", className),
4847
+ onClick: toggleSidebar,
4848
+ ...props
4849
+ }
4850
+ );
4851
+ }
4852
+ function SidebarInset({ asChild, className, ...props }) {
4853
+ const Comp = asChild ? import_radix_ui25.Slot.Slot : "main";
4854
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { "data-slot": "sidebar-inset", className: cn("ddga-sidebar-inset", className), ...props });
4855
+ }
4856
+ function SidebarHeader({ asChild, className, ...props }) {
4857
+ const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
4858
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { "data-slot": "sidebar-header", className: cn("ddga-sidebar__header", className), ...props });
4859
+ }
4860
+ function SidebarContent({ asChild, className, ...props }) {
4861
+ const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
4862
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4863
+ Comp,
4864
+ {
4865
+ "data-slot": "sidebar-content",
4866
+ className: cn("ddga-sidebar__content", className),
4867
+ ...props
4868
+ }
4869
+ );
4870
+ }
4871
+ function SidebarFooter({ asChild, className, ...props }) {
4872
+ const Comp = asChild ? import_radix_ui25.Slot.Slot : "div";
4873
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { "data-slot": "sidebar-footer", className: cn("ddga-sidebar__footer", className), ...props });
4874
+ }
4875
+ function SidebarSeparator({ className, ...props }) {
4876
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4877
+ "hr",
4878
+ {
4879
+ "data-slot": "sidebar-separator",
4880
+ className: cn("ddga-sidebar__separator", className),
4881
+ ...props
4882
+ }
4883
+ );
4884
+ }
4885
+
4886
+ // src/components/Sidebar/SidebarGroup.tsx
4887
+ var import_radix_ui26 = require("radix-ui");
4888
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4889
+ function SidebarGroup({ asChild, className, ...props }) {
4890
+ const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
4891
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4892
+ Comp,
4893
+ {
4894
+ "data-slot": "sidebar-group",
4895
+ role: "group",
4896
+ className: cn("ddga-sidebar__group", className),
4897
+ ...props
4898
+ }
4899
+ );
4900
+ }
4901
+ function SidebarGroupLabel({ asChild, className, ...props }) {
4902
+ const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
4903
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4904
+ Comp,
4905
+ {
4906
+ "data-slot": "sidebar-group-label",
4907
+ className: cn("ddga-sidebar__group-label", className),
4908
+ ...props
4909
+ }
4910
+ );
4911
+ }
4912
+ function SidebarGroupAction({ asChild, className, ...props }) {
4913
+ const Comp = asChild ? import_radix_ui26.Slot.Slot : "button";
4914
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4915
+ Comp,
4916
+ {
4917
+ type: asChild ? void 0 : "button",
4918
+ "data-slot": "sidebar-group-action",
4919
+ className: cn("ddga-sidebar__group-action", className),
4920
+ ...props
4921
+ }
4922
+ );
4923
+ }
4924
+ function SidebarGroupContent({ asChild, className, ...props }) {
4925
+ const Comp = asChild ? import_radix_ui26.Slot.Slot : "div";
4926
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4927
+ Comp,
4928
+ {
4929
+ "data-slot": "sidebar-group-content",
4930
+ className: cn("ddga-sidebar__group-content", className),
4931
+ ...props
4932
+ }
4933
+ );
4934
+ }
4935
+
4936
+ // src/components/Sidebar/SidebarMenu.tsx
4937
+ var import_radix_ui27 = require("radix-ui");
4938
+ var import_class_variance_authority37 = require("class-variance-authority");
4939
+
2957
4940
  // src/hooks/useDir.ts
2958
4941
  function useDir() {
2959
4942
  return useDga().dir;
2960
4943
  }
4944
+
4945
+ // src/components/Sidebar/SidebarMenu.tsx
4946
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4947
+ function SidebarMenu({ className, ...props }) {
4948
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { "data-slot": "sidebar-menu", className: cn("ddga-sidebar__menu", className), ...props });
4949
+ }
4950
+ function SidebarMenuItem({ className, ...props }) {
4951
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4952
+ "li",
4953
+ {
4954
+ "data-slot": "sidebar-menu-item",
4955
+ className: cn("ddga-sidebar__menu-item", className),
4956
+ ...props
4957
+ }
4958
+ );
4959
+ }
4960
+ var sidebarMenuButtonVariants = (0, import_class_variance_authority37.cva)("ddga-sidebar__menu-button", {
4961
+ variants: {
4962
+ size: {
4963
+ sm: "ddga-sidebar__menu-button--sm",
4964
+ md: "ddga-sidebar__menu-button--md",
4965
+ lg: "ddga-sidebar__menu-button--lg"
4966
+ }
4967
+ },
4968
+ defaultVariants: { size: "md" }
4969
+ });
4970
+ function SidebarMenuButton({
4971
+ asChild,
4972
+ isActive,
4973
+ size,
4974
+ tooltip,
4975
+ className,
4976
+ ...props
4977
+ }) {
4978
+ const { state, isMobile } = useSidebar();
4979
+ const dir = useDir();
4980
+ const Comp = asChild ? import_radix_ui27.Slot.Slot : "button";
4981
+ const button = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4982
+ Comp,
4983
+ {
4984
+ type: asChild ? void 0 : "button",
4985
+ "data-slot": "sidebar-menu-button",
4986
+ "data-active": isActive || void 0,
4987
+ "data-size": size ?? "md",
4988
+ "aria-current": isActive ? "page" : void 0,
4989
+ className: cn(sidebarMenuButtonVariants({ size }), className),
4990
+ ...props
4991
+ }
4992
+ );
4993
+ if (!tooltip || state !== "collapsed" || isMobile) {
4994
+ return button;
4995
+ }
4996
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
4997
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-slot": "tooltip-trigger", style: { display: "contents" }, children: button }) }),
4998
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { side: dir === "rtl" ? "left" : "right", children: tooltip })
4999
+ ] });
5000
+ }
5001
+ function SidebarMenuAction({ asChild, showOnHover, className, ...props }) {
5002
+ const Comp = asChild ? import_radix_ui27.Slot.Slot : "button";
5003
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5004
+ Comp,
5005
+ {
5006
+ type: asChild ? void 0 : "button",
5007
+ "data-slot": "sidebar-menu-action",
5008
+ "data-show-on-hover": showOnHover || void 0,
5009
+ className: cn("ddga-sidebar__menu-action", className),
5010
+ ...props
5011
+ }
5012
+ );
5013
+ }
5014
+ function SidebarMenuBadge({ className, ...props }) {
5015
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5016
+ "span",
5017
+ {
5018
+ "data-slot": "sidebar-menu-badge",
5019
+ className: cn("ddga-sidebar__menu-badge", className),
5020
+ ...props
5021
+ }
5022
+ );
5023
+ }
5024
+ function SidebarMenuSkeleton({ showIcon, className, ...props }) {
5025
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
5026
+ "div",
5027
+ {
5028
+ "data-slot": "sidebar-menu-skeleton",
5029
+ className: cn("ddga-sidebar__menu-skeleton", className),
5030
+ ...props,
5031
+ children: [
5032
+ showIcon ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { shape: "circle", width: "1rem", height: "1rem" }) : null,
5033
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { shape: "text", className: "ddga-sidebar__menu-skeleton-text" })
5034
+ ]
5035
+ }
5036
+ );
5037
+ }
5038
+ function SidebarMenuSub({ className, ...props }) {
5039
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5040
+ "ul",
5041
+ {
5042
+ "data-slot": "sidebar-menu-sub",
5043
+ className: cn("ddga-sidebar__menu-sub", className),
5044
+ ...props
5045
+ }
5046
+ );
5047
+ }
5048
+ function SidebarMenuSubItem({ className, ...props }) {
5049
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5050
+ "li",
5051
+ {
5052
+ "data-slot": "sidebar-menu-sub-item",
5053
+ className: cn("ddga-sidebar__menu-sub-item", className),
5054
+ ...props
5055
+ }
5056
+ );
5057
+ }
5058
+ var sidebarMenuSubButtonVariants = (0, import_class_variance_authority37.cva)("ddga-sidebar__menu-sub-button", {
5059
+ variants: {
5060
+ size: {
5061
+ sm: "ddga-sidebar__menu-sub-button--sm",
5062
+ md: "ddga-sidebar__menu-sub-button--md"
5063
+ }
5064
+ },
5065
+ defaultVariants: { size: "md" }
5066
+ });
5067
+ function SidebarMenuSubButton({
5068
+ asChild,
5069
+ isActive,
5070
+ size,
5071
+ className,
5072
+ ...props
5073
+ }) {
5074
+ const Comp = asChild ? import_radix_ui27.Slot.Slot : "a";
5075
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5076
+ Comp,
5077
+ {
5078
+ "data-slot": "sidebar-menu-sub-button",
5079
+ "data-active": isActive || void 0,
5080
+ "data-size": size ?? "md",
5081
+ "aria-current": isActive ? "page" : void 0,
5082
+ className: cn(sidebarMenuSubButtonVariants({ size }), className),
5083
+ ...props
5084
+ }
5085
+ );
5086
+ }
5087
+
5088
+ // src/components/ScrollArea/ScrollArea.tsx
5089
+ var import_radix_ui28 = require("radix-ui");
5090
+ var import_class_variance_authority38 = require("class-variance-authority");
5091
+ var import_jsx_runtime43 = require("react/jsx-runtime");
5092
+ var scrollAreaVariants = (0, import_class_variance_authority38.cva)("ddga-scroll-area", {
5093
+ variants: {
5094
+ orientation: {
5095
+ vertical: "ddga-scroll-area--vertical",
5096
+ horizontal: "ddga-scroll-area--horizontal",
5097
+ both: "ddga-scroll-area--both"
5098
+ }
5099
+ },
5100
+ defaultVariants: {
5101
+ orientation: "vertical"
5102
+ }
5103
+ });
5104
+ function warnMissingLabel(ariaLabel, ariaLabelledby) {
5105
+ if (process.env.NODE_ENV === "production") return;
5106
+ if (ariaLabel || ariaLabelledby) return;
5107
+ console.warn(
5108
+ "[dga/ScrollArea] <ScrollArea> has no accessible name. The scroll viewport is keyboard-focusable; pass `aria-label` or `aria-labelledby` so screen-reader users know what region they are scrolling. If the content is itself focusable (e.g. a list of links) and you do not want a labelled region, pass `viewportProps={{ tabIndex: -1 }}`."
5109
+ );
5110
+ }
5111
+ function ScrollArea({
5112
+ className,
5113
+ orientation = "vertical",
5114
+ type = "hover",
5115
+ scrollHideDelay = 600,
5116
+ viewportRef,
5117
+ viewportProps,
5118
+ children,
5119
+ "aria-label": ariaLabel,
5120
+ "aria-labelledby": ariaLabelledby,
5121
+ ...props
5122
+ }) {
5123
+ warnMissingLabel(ariaLabel, ariaLabelledby);
5124
+ const hasLabel = Boolean(ariaLabel || ariaLabelledby);
5125
+ const showVertical = orientation === "vertical" || orientation === "both";
5126
+ const showHorizontal = orientation === "horizontal" || orientation === "both";
5127
+ const { className: viewportClassName, ...restViewportProps } = viewportProps ?? {};
5128
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
5129
+ import_radix_ui28.ScrollArea.Root,
5130
+ {
5131
+ "data-slot": "scroll-area",
5132
+ type,
5133
+ scrollHideDelay,
5134
+ className: cn(scrollAreaVariants({ orientation }), className),
5135
+ ...props,
5136
+ children: [
5137
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5138
+ import_radix_ui28.ScrollArea.Viewport,
5139
+ {
5140
+ "data-slot": "scroll-area-viewport",
5141
+ className: cn("ddga-scroll-area__viewport", viewportClassName),
5142
+ ref: viewportRef,
5143
+ tabIndex: 0,
5144
+ role: hasLabel ? "region" : void 0,
5145
+ "aria-label": ariaLabel,
5146
+ "aria-labelledby": ariaLabelledby,
5147
+ ...restViewportProps,
5148
+ children
5149
+ }
5150
+ ),
5151
+ showVertical ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5152
+ import_radix_ui28.ScrollArea.Scrollbar,
5153
+ {
5154
+ "data-slot": "scroll-area-scrollbar",
5155
+ orientation: "vertical",
5156
+ className: "ddga-scroll-area__scrollbar",
5157
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui28.ScrollArea.Thumb, { className: "ddga-scroll-area__thumb" })
5158
+ }
5159
+ ) : null,
5160
+ showHorizontal ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5161
+ import_radix_ui28.ScrollArea.Scrollbar,
5162
+ {
5163
+ "data-slot": "scroll-area-scrollbar",
5164
+ orientation: "horizontal",
5165
+ className: "ddga-scroll-area__scrollbar",
5166
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui28.ScrollArea.Thumb, { className: "ddga-scroll-area__thumb" })
5167
+ }
5168
+ ) : null,
5169
+ orientation === "both" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_radix_ui28.ScrollArea.Corner, { className: "ddga-scroll-area__corner" }) : null
5170
+ ]
5171
+ }
5172
+ );
5173
+ }
5174
+
5175
+ // src/components/Menubar/Menubar.tsx
5176
+ var import_react27 = require("react");
5177
+ var import_radix_ui29 = require("radix-ui");
5178
+ var import_class_variance_authority39 = require("class-variance-authority");
5179
+ var import_jsx_runtime44 = require("react/jsx-runtime");
5180
+ var menubarContentVariants = (0, import_class_variance_authority39.cva)("ddga-menubar-menu", {
5181
+ variants: {
5182
+ size: {
5183
+ sm: "ddga-menubar-menu--sm",
5184
+ md: "ddga-menubar-menu--md"
5185
+ }
5186
+ },
5187
+ defaultVariants: {
5188
+ size: "md"
5189
+ }
5190
+ });
5191
+ var menubarTriggerVariants = (0, import_class_variance_authority39.cva)("ddga-menubar__trigger", {
5192
+ variants: {
5193
+ variant: {
5194
+ default: "ddga-menubar__trigger--default",
5195
+ outline: "ddga-menubar__trigger--outline"
5196
+ }
5197
+ },
5198
+ defaultVariants: {
5199
+ variant: "default"
5200
+ }
5201
+ });
5202
+ function Menubar({ className, ...props }) {
5203
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5204
+ import_radix_ui29.Menubar.Root,
5205
+ {
5206
+ "data-slot": "menubar",
5207
+ className: cn("ddga-menubar", className),
5208
+ ...props
5209
+ }
5210
+ );
5211
+ }
5212
+ function MenubarMenu(props) {
5213
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Menu, { ...props });
5214
+ }
5215
+ function MenubarTrigger({ variant, className, ...props }) {
5216
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5217
+ import_radix_ui29.Menubar.Trigger,
5218
+ {
5219
+ "data-slot": "menubar-trigger",
5220
+ "data-variant": variant ?? "default",
5221
+ className: cn(menubarTriggerVariants({ variant }), className),
5222
+ ...props
5223
+ }
5224
+ );
5225
+ }
5226
+ function MenubarContent({ size, className, sideOffset = 6, ...props }) {
5227
+ const ctx = (0, import_react27.useContext)(DgaContext);
5228
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
5229
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5230
+ import_radix_ui29.Menubar.Content,
5231
+ {
5232
+ "data-slot": "menubar-content",
5233
+ sideOffset,
5234
+ className: cn(menubarContentVariants({ size }), className),
5235
+ ...props
5236
+ }
5237
+ ) });
5238
+ }
5239
+ function MenubarItem({
5240
+ className,
5241
+ destructive,
5242
+ startIcon,
5243
+ shortcut,
5244
+ children,
5245
+ ...props
5246
+ }) {
5247
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
5248
+ import_radix_ui29.Menubar.Item,
5249
+ {
5250
+ "data-slot": "menubar-item",
5251
+ "data-destructive": destructive ? "" : void 0,
5252
+ className: cn("ddga-menubar-menu__item", className),
5253
+ ...props,
5254
+ children: [
5255
+ startIcon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
5256
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children }),
5257
+ shortcut ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__shortcut", "aria-hidden": "true", children: shortcut }) : null
5258
+ ]
5259
+ }
5260
+ );
5261
+ }
5262
+ function MenubarCheckboxItem({
5263
+ className,
5264
+ children,
5265
+ onSelect,
5266
+ ...props
5267
+ }) {
5268
+ const handleSelect = onSelect ?? ((event) => {
5269
+ event.preventDefault();
5270
+ });
5271
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
5272
+ import_radix_ui29.Menubar.CheckboxItem,
5273
+ {
5274
+ "data-slot": "menubar-checkbox-item",
5275
+ className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--checkable", className),
5276
+ onSelect: handleSelect,
5277
+ ...props,
5278
+ children: [
5279
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Check, { className: "ddga-menubar-menu__indicator-icon" }) }) }),
5280
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children })
5281
+ ]
5282
+ }
5283
+ );
5284
+ }
5285
+ function MenubarRadioGroup(props) {
5286
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.RadioGroup, { "data-slot": "menubar-radio-group", ...props });
5287
+ }
5288
+ function MenubarRadioItem({ className, children, onSelect, ...props }) {
5289
+ const handleSelect = onSelect ?? ((event) => {
5290
+ event.preventDefault();
5291
+ });
5292
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
5293
+ import_radix_ui29.Menubar.RadioItem,
5294
+ {
5295
+ "data-slot": "menubar-radio-item",
5296
+ className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--checkable", className),
5297
+ onSelect: handleSelect,
5298
+ ...props,
5299
+ children: [
5300
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__indicator", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__radio-dot" }) }) }),
5301
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children })
5302
+ ]
5303
+ }
5304
+ );
5305
+ }
5306
+ function MenubarLabel({ className, ...props }) {
5307
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5308
+ import_radix_ui29.Menubar.Label,
5309
+ {
5310
+ "data-slot": "menubar-label",
5311
+ className: cn("ddga-menubar-menu__group-label", className),
5312
+ ...props
5313
+ }
5314
+ );
5315
+ }
5316
+ function MenubarSeparator({ className, ...props }) {
5317
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5318
+ import_radix_ui29.Menubar.Separator,
5319
+ {
5320
+ "data-slot": "menubar-separator",
5321
+ className: cn("ddga-menubar-menu__separator", className),
5322
+ ...props
5323
+ }
5324
+ );
5325
+ }
5326
+ function MenubarGroup(props) {
5327
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Group, { "data-slot": "menubar-group", ...props });
5328
+ }
5329
+ function MenubarSub(props) {
5330
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Sub, { ...props });
5331
+ }
5332
+ function MenubarSubTrigger({ className, startIcon, children, ...props }) {
5333
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
5334
+ import_radix_ui29.Menubar.SubTrigger,
5335
+ {
5336
+ "data-slot": "menubar-sub-trigger",
5337
+ className: cn("ddga-menubar-menu__item", "ddga-menubar-menu__item--sub", className),
5338
+ ...props,
5339
+ children: [
5340
+ startIcon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__icon", "aria-hidden": "true", children: startIcon }) : null,
5341
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ddga-menubar-menu__label", children }),
5342
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronRight, { className: "ddga-menubar-menu__sub-chevron", "aria-hidden": "true" })
5343
+ ]
5344
+ }
5345
+ );
5346
+ }
5347
+ function MenubarSubContent({ size, className, ...props }) {
5348
+ const ctx = (0, import_react27.useContext)(DgaContext);
5349
+ const portalContainer = ctx?.portalEl ?? ctx?.rootEl ?? void 0;
5350
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_radix_ui29.Menubar.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5351
+ import_radix_ui29.Menubar.SubContent,
5352
+ {
5353
+ "data-slot": "menubar-sub-content",
5354
+ className: cn(menubarContentVariants({ size }), className),
5355
+ ...props
5356
+ }
5357
+ ) });
5358
+ }
5359
+
5360
+ // src/components/Timeline/Timeline.tsx
5361
+ var import_class_variance_authority40 = require("class-variance-authority");
5362
+ var import_jsx_runtime45 = require("react/jsx-runtime");
5363
+ var timelineVariants = (0, import_class_variance_authority40.cva)("ddga-timeline", {
5364
+ variants: {
5365
+ size: {
5366
+ sm: "ddga-timeline--sm",
5367
+ md: "ddga-timeline--md"
5368
+ },
5369
+ orientation: {
5370
+ vertical: "ddga-timeline--vertical",
5371
+ horizontal: "ddga-timeline--horizontal"
5372
+ }
5373
+ },
5374
+ defaultVariants: {
5375
+ size: "md",
5376
+ orientation: "vertical"
5377
+ }
5378
+ });
5379
+ var timelineMarkerVariants = (0, import_class_variance_authority40.cva)("ddga-timeline__marker", {
5380
+ variants: {
5381
+ status: {
5382
+ default: "ddga-timeline__marker--default",
5383
+ success: "ddga-timeline__marker--success",
5384
+ error: "ddga-timeline__marker--error",
5385
+ warning: "ddga-timeline__marker--warning",
5386
+ info: "ddga-timeline__marker--info"
5387
+ }
5388
+ },
5389
+ defaultVariants: {
5390
+ status: "default"
5391
+ }
5392
+ });
5393
+ function Timeline({ size, orientation, className, ...props }) {
5394
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5395
+ "ol",
5396
+ {
5397
+ "data-slot": "timeline",
5398
+ "data-orientation": orientation ?? "vertical",
5399
+ className: cn(timelineVariants({ size, orientation }), className),
5400
+ ...props
5401
+ }
5402
+ );
5403
+ }
5404
+ function TimelineItem({ className, ...props }) {
5405
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("li", { "data-slot": "timeline-item", className: cn("ddga-timeline__item", className), ...props });
5406
+ }
5407
+ function TimelineMarker({ status, className, children, ...props }) {
5408
+ const resolved = status ?? "default";
5409
+ const reached = resolved !== "default";
5410
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5411
+ "span",
5412
+ {
5413
+ "aria-hidden": "true",
5414
+ "data-slot": "timeline-marker",
5415
+ "data-status": resolved,
5416
+ "data-reached": reached ? "" : void 0,
5417
+ className: cn(timelineMarkerVariants({ status }), className),
5418
+ ...props,
5419
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ddga-timeline__dot" })
5420
+ }
5421
+ );
5422
+ }
5423
+ function TimelineContent({ className, ...props }) {
5424
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5425
+ "div",
5426
+ {
5427
+ "data-slot": "timeline-content",
5428
+ className: cn("ddga-timeline__content", className),
5429
+ ...props
5430
+ }
5431
+ );
5432
+ }
5433
+ function TimelineTitle({ className, ...props }) {
5434
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-slot": "timeline-title", className: cn("ddga-timeline__title", className), ...props });
5435
+ }
5436
+ function TimelineDescription({ className, ...props }) {
5437
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5438
+ "span",
5439
+ {
5440
+ "data-slot": "timeline-description",
5441
+ className: cn("ddga-timeline__description", className),
5442
+ ...props
5443
+ }
5444
+ );
5445
+ }
5446
+ function TimelineTime({ className, ...props }) {
5447
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("time", { "data-slot": "timeline-time", className: cn("ddga-timeline__time", className), ...props });
5448
+ }
5449
+
5450
+ // src/providers/DgaProvider.tsx
5451
+ var import_react28 = require("react");
5452
+ var import_radix_ui30 = require("radix-ui");
5453
+ var import_tokens = require("@dev-dga/tokens");
5454
+ var import_jsx_runtime46 = require("react/jsx-runtime");
5455
+ function DgaProvider({
5456
+ dir = "ltr",
5457
+ locale,
5458
+ mode = "light",
5459
+ theme,
5460
+ as: Component = "div",
5461
+ className,
5462
+ style: consumerStyle,
5463
+ children
5464
+ }) {
5465
+ const parentCtx = (0, import_react28.useContext)(DgaContext);
5466
+ const isNested = parentCtx !== null;
5467
+ const [rootEl, setRootEl] = (0, import_react28.useState)(null);
5468
+ const portalRef = (0, import_react28.useRef)(null);
5469
+ const [portalEl, setPortalEl] = (0, import_react28.useState)(null);
5470
+ const resolvedLocale = locale ?? (dir === "rtl" ? "ar" : "en");
5471
+ const themeVars = (0, import_react28.useMemo)(() => theme ? (0, import_tokens.buildTheme)(theme) : null, [theme]);
5472
+ (0, import_react28.useEffect)(() => {
5473
+ if (typeof document === "undefined") return;
5474
+ const el = document.createElement("div");
5475
+ el.setAttribute("data-slot", "dga-portal");
5476
+ el.style.position = "relative";
5477
+ el.style.zIndex = "50";
5478
+ document.body.appendChild(el);
5479
+ portalRef.current = el;
5480
+ setPortalEl(el);
5481
+ return () => {
5482
+ el.remove();
5483
+ portalRef.current = null;
5484
+ setPortalEl(null);
5485
+ };
5486
+ }, []);
5487
+ (0, import_react28.useEffect)(() => {
5488
+ const el = portalRef.current;
5489
+ if (!el) return;
5490
+ el.setAttribute("data-theme", mode);
5491
+ el.setAttribute("dir", dir);
5492
+ el.style.colorScheme = mode;
5493
+ if (themeVars) {
5494
+ for (const [k, v] of Object.entries(themeVars)) {
5495
+ el.style.setProperty(k, String(v));
5496
+ }
5497
+ }
5498
+ }, [mode, dir, themeVars, portalEl]);
5499
+ const ctxValue = (0, import_react28.useMemo)(
5500
+ () => ({ dir, locale: resolvedLocale, mode, rootEl, portalEl }),
5501
+ [dir, resolvedLocale, mode, rootEl, portalEl]
5502
+ );
5503
+ const inner = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Direction.Provider, { dir, children });
5504
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DgaContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5505
+ Component,
5506
+ {
5507
+ ref: setRootEl,
5508
+ dir,
5509
+ lang: resolvedLocale,
5510
+ "data-slot": "dga-root",
5511
+ "data-theme": mode,
5512
+ className,
5513
+ style: { colorScheme: mode, ...themeVars ?? {}, ...consumerStyle },
5514
+ children: isNested ? inner : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_radix_ui30.Tooltip.Provider, { delayDuration: 300, skipDelayDuration: 100, children: inner })
5515
+ }
5516
+ ) });
5517
+ }
2961
5518
  // Annotate the CommonJS export names for ESM import in node:
2962
5519
  0 && (module.exports = {
2963
5520
  Accordion,
@@ -2993,6 +5550,11 @@ function useDir() {
2993
5550
  ComboboxGroup,
2994
5551
  ComboboxItem,
2995
5552
  ComboboxSeparator,
5553
+ DatePicker,
5554
+ DescriptionDetails,
5555
+ DescriptionItem,
5556
+ DescriptionList,
5557
+ DescriptionTerm,
2996
5558
  DgaProvider,
2997
5559
  Divider,
2998
5560
  Drawer,
@@ -3017,8 +5579,28 @@ function useDir() {
3017
5579
  DropdownMenuSubContent,
3018
5580
  DropdownMenuSubTrigger,
3019
5581
  DropdownMenuTrigger,
5582
+ EmptyState,
5583
+ EmptyStateActions,
5584
+ EmptyStateDescription,
5585
+ EmptyStateMedia,
5586
+ EmptyStateTitle,
3020
5587
  FieldMessage,
5588
+ FileUpload,
3021
5589
  Input,
5590
+ Menubar,
5591
+ MenubarCheckboxItem,
5592
+ MenubarContent,
5593
+ MenubarGroup,
5594
+ MenubarItem,
5595
+ MenubarLabel,
5596
+ MenubarMenu,
5597
+ MenubarRadioGroup,
5598
+ MenubarRadioItem,
5599
+ MenubarSeparator,
5600
+ MenubarSub,
5601
+ MenubarSubContent,
5602
+ MenubarSubTrigger,
5603
+ MenubarTrigger,
3022
5604
  Modal,
3023
5605
  ModalClose,
3024
5606
  ModalContent,
@@ -3027,6 +5609,7 @@ function useDir() {
3027
5609
  ModalHeader,
3028
5610
  ModalTitle,
3029
5611
  ModalTrigger,
5612
+ NumberInput,
3030
5613
  Pagination,
3031
5614
  PaginationContent,
3032
5615
  PaginationEllipsis,
@@ -3034,13 +5617,48 @@ function useDir() {
3034
5617
  PaginationLink,
3035
5618
  PaginationNext,
3036
5619
  PaginationPrevious,
5620
+ Popover,
5621
+ PopoverAnchor,
5622
+ PopoverClose,
5623
+ PopoverContent,
5624
+ PopoverTrigger,
3037
5625
  Progress,
3038
5626
  Radio,
3039
5627
  RadioGroup,
5628
+ Rating,
5629
+ ScrollArea,
3040
5630
  Select,
3041
5631
  SelectItem,
5632
+ Sidebar,
5633
+ SidebarContent,
5634
+ SidebarFooter,
5635
+ SidebarGroup,
5636
+ SidebarGroupAction,
5637
+ SidebarGroupContent,
5638
+ SidebarGroupLabel,
5639
+ SidebarHeader,
5640
+ SidebarInset,
5641
+ SidebarMenu,
5642
+ SidebarMenuAction,
5643
+ SidebarMenuBadge,
5644
+ SidebarMenuButton,
5645
+ SidebarMenuItem,
5646
+ SidebarMenuSkeleton,
5647
+ SidebarMenuSub,
5648
+ SidebarMenuSubButton,
5649
+ SidebarMenuSubItem,
5650
+ SidebarProvider,
5651
+ SidebarRail,
5652
+ SidebarSeparator,
5653
+ SidebarTrigger,
3042
5654
  Skeleton,
5655
+ Slider,
3043
5656
  Spinner,
5657
+ Stat,
5658
+ StatChange,
5659
+ StatGroup,
5660
+ StatLabel,
5661
+ StatValue,
3044
5662
  Step,
3045
5663
  StepDescription,
3046
5664
  StepIndicator,
@@ -3052,7 +5670,17 @@ function useDir() {
3052
5670
  TabsList,
3053
5671
  TabsTrigger,
3054
5672
  Textarea,
5673
+ Timeline,
5674
+ TimelineContent,
5675
+ TimelineDescription,
5676
+ TimelineItem,
5677
+ TimelineMarker,
5678
+ TimelineTime,
5679
+ TimelineTitle,
3055
5680
  Toaster,
5681
+ Toggle,
5682
+ ToggleGroup,
5683
+ ToggleGroupItem,
3056
5684
  Tooltip,
3057
5685
  TooltipContent,
3058
5686
  TooltipTrigger,
@@ -3070,32 +5698,52 @@ function useDir() {
3070
5698
  comboboxVariants,
3071
5699
  createToast,
3072
5700
  createToastStore,
5701
+ datePickerVariants,
5702
+ descriptionListVariants,
3073
5703
  dividerVariants,
3074
5704
  drawerVariants,
3075
5705
  dropdownMenuVariants,
5706
+ emptyStateVariants,
3076
5707
  inputVariants,
5708
+ menubarContentVariants,
5709
+ menubarTriggerVariants,
3077
5710
  modalContentVariants,
5711
+ numberInputVariants,
3078
5712
  paginationLinkVariants,
3079
5713
  paginationVariants,
5714
+ popoverContentVariants,
3080
5715
  progressVariants,
3081
5716
  radioGroupVariants,
3082
5717
  radioVariants,
5718
+ ratingVariants,
5719
+ scrollAreaVariants,
3083
5720
  selectTriggerVariants,
5721
+ sidebarMenuButtonVariants,
5722
+ sidebarMenuSubButtonVariants,
3084
5723
  skeletonVariants,
5724
+ sliderVariants,
3085
5725
  spinnerVariants,
5726
+ statGroupVariants,
5727
+ statVariants,
3086
5728
  stepVariants,
3087
5729
  stepsVariants,
3088
5730
  switchVariants,
3089
5731
  tabsListVariants,
3090
5732
  tabsVariants,
3091
5733
  textareaVariants,
5734
+ timelineMarkerVariants,
5735
+ timelineVariants,
3092
5736
  toast,
3093
5737
  toastStore,
3094
5738
  toastVariants,
3095
5739
  toastViewportVariants,
5740
+ toggleGroupVariants,
5741
+ toggleVariants,
3096
5742
  tooltipContentVariants,
3097
5743
  useDga,
3098
5744
  useDir,
3099
- useFieldA11y
5745
+ useFieldA11y,
5746
+ useIsMobile,
5747
+ useSidebar
3100
5748
  });
3101
5749
  //# sourceMappingURL=index.cjs.map