@algorithm-shift/design-system 1.2.968 → 1.2.970

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.js CHANGED
@@ -39,7 +39,7 @@ __export(src_exports, {
39
39
  ButtonGroup: () => SplitButton,
40
40
  Checkbox: () => Checkbox_default,
41
41
  Container: () => Container_default,
42
- DatePicker: () => DatePicker,
42
+ DatePicker: () => DateTimePicker,
43
43
  DateRange: () => DateRange_default,
44
44
  Dropdown: () => Dropdown_default,
45
45
  Email: () => EmailInput_default,
@@ -28011,6 +28011,32 @@ function useLazyDropdown(config) {
28011
28011
  if (debounceTimer.current) clearTimeout(debounceTimer.current);
28012
28012
  };
28013
28013
  }, []);
28014
+ const createNewOption = async (label) => {
28015
+ if (!configRef.current.apiUrl) return null;
28016
+ const axiosClient = configRef.current.axiosInstance ?? import_axios.default;
28017
+ const apiUrl = configRef.current.apiUrl;
28018
+ const urlObj = new URL(
28019
+ apiUrl,
28020
+ typeof window !== "undefined" ? window.location.origin : "http://localhost"
28021
+ );
28022
+ const queryParams = {};
28023
+ urlObj.searchParams.forEach((value, key) => {
28024
+ queryParams[key] = value;
28025
+ });
28026
+ const body = {
28027
+ ...queryParams,
28028
+ [configRef.current.dataLabel]: label
28029
+ };
28030
+ const res = await axiosClient.post(urlObj.origin + urlObj.pathname, body, {
28031
+ withCredentials: true
28032
+ });
28033
+ if (res.data?.success && Array.isArray(res.data.data) && res.data.data.length > 0) {
28034
+ const fetched = transformToOptions(res.data.data);
28035
+ setOptions((prev) => uniqueOptions([...fetched, ...prev]));
28036
+ return fetched[0];
28037
+ }
28038
+ return null;
28039
+ };
28014
28040
  return {
28015
28041
  options,
28016
28042
  loading,
@@ -28018,7 +28044,8 @@ function useLazyDropdown(config) {
28018
28044
  loadMore,
28019
28045
  search,
28020
28046
  reset,
28021
- loadPage
28047
+ loadPage,
28048
+ createNewOption
28022
28049
  };
28023
28050
  }
28024
28051
 
@@ -28039,7 +28066,8 @@ function LazySelectDropdown({
28039
28066
  dataKey = "id",
28040
28067
  dataLabel = "name",
28041
28068
  errorMessage,
28042
- axiosInstance
28069
+ axiosInstance,
28070
+ enableAddNewOption = false
28043
28071
  }) {
28044
28072
  const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
28045
28073
  const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
@@ -28052,7 +28080,8 @@ function LazySelectDropdown({
28052
28080
  loadMore,
28053
28081
  search,
28054
28082
  reset,
28055
- loadPage
28083
+ loadPage,
28084
+ createNewOption
28056
28085
  } = useLazyDropdown({
28057
28086
  enabled: true,
28058
28087
  dataSource: source || "",
@@ -28110,6 +28139,15 @@ function LazySelectDropdown({
28110
28139
  reset();
28111
28140
  search("");
28112
28141
  };
28142
+ const handleAddNewOption = async (newOption) => {
28143
+ const option = await createNewOption(newOption);
28144
+ if (option) {
28145
+ onChange?.(option.value, id || "");
28146
+ setIsOpen(false);
28147
+ setSearchTerm("");
28148
+ reset();
28149
+ }
28150
+ };
28113
28151
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { ref: dropdownRef, className: "relative w-full", children: [
28114
28152
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
28115
28153
  "input",
@@ -28179,7 +28217,19 @@ function LazySelectDropdown({
28179
28217
  ] }) : "Scroll for more..."
28180
28218
  }
28181
28219
  )
28182
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
28220
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: [
28221
+ searchTerm ? `No results for "${searchTerm}"` : "No options available",
28222
+ enableAddNewOption && searchTerm && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
28223
+ "div",
28224
+ {
28225
+ onClick: () => {
28226
+ handleAddNewOption(searchTerm);
28227
+ },
28228
+ className: "mt-2 px-3 py-2 bg-green-50 hover:bg-green-100 cursor-pointer text-green-700 rounded text-sm",
28229
+ children: `Add "${searchTerm}"`
28230
+ }
28231
+ )
28232
+ ] })
28183
28233
  }
28184
28234
  ) })
28185
28235
  ] });
@@ -28458,82 +28508,13 @@ var FileInput2 = ({ className, style, ...props }) => {
28458
28508
  var FileInput_default = FileInput2;
28459
28509
 
28460
28510
  // src/components/Inputs/DatePicker/DatePicker.tsx
28461
- var import_react26 = require("react");
28462
- var import_jsx_runtime43 = require("react/jsx-runtime");
28463
- function DatePicker({ className, style, ...props }) {
28464
- const placeholder = props.placeholder ?? "Placeholder text";
28465
- const minimumDate = props.minimumDate ?? "none";
28466
- const customMinimumDate = props.customMinimumDate ?? "";
28467
- const maximumDate = props.maximumDate ?? "none";
28468
- const customMaximumDate = props.customMaximumDate ?? "";
28469
- const isEditable = props.isEditable ?? true;
28470
- const isDisabled = props.isDisabled ?? false;
28471
- const isReadonly = props.isReadonly ?? false;
28472
- const isAutocomplete = props.isAutocomplete ?? false;
28473
- const resolveDate = (option, customOption) => {
28474
- if (!option) return void 0;
28475
- switch (option) {
28476
- case "today":
28477
- return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
28478
- case "custom":
28479
- return customOption ?? void 0;
28480
- case "none":
28481
- default:
28482
- return void 0;
28483
- }
28484
- };
28485
- const minDate = resolveDate(minimumDate, customMinimumDate);
28486
- const maxDate = resolveDate(maximumDate, customMaximumDate);
28487
- (0, import_react26.useEffect)(() => {
28488
- if (props.value !== void 0) {
28489
- handleChange(props.value);
28490
- }
28491
- }, []);
28492
- const handleChange = (e) => {
28493
- props.onChange?.(e, props?.name || "");
28494
- };
28495
- const toDateInputValue = (value) => {
28496
- if (!value) return "";
28497
- return new Date(value).toISOString().split("T")[0];
28498
- };
28499
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
28500
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
28501
- Input,
28502
- {
28503
- type: "date",
28504
- id: "date",
28505
- autoComplete: isAutocomplete ? "on" : "off",
28506
- onChange: handleChange,
28507
- disabled: isDisabled || !isEditable,
28508
- name: props.name,
28509
- value: toDateInputValue(props.value),
28510
- className: cn(
28511
- className,
28512
- props.errorMessage ? "border-red-500" : "",
28513
- "appearance-auto"
28514
- ),
28515
- style: {
28516
- ...style,
28517
- borderColor: props.errorMessage ? "#f87171" : style?.borderColor
28518
- },
28519
- readOnly: isReadonly,
28520
- placeholder,
28521
- min: minDate,
28522
- max: maxDate
28523
- }
28524
- ) }),
28525
- props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
28526
- ] });
28527
- }
28528
-
28529
- // src/components/Inputs/DateRange/DateRange.tsx
28530
- var import_react27 = __toESM(require("react"));
28511
+ var React6 = __toESM(require("react"));
28531
28512
  var import_date_fns = require("date-fns");
28532
28513
 
28533
28514
  // src/components/ui/calendar.tsx
28534
- var React6 = __toESM(require("react"));
28515
+ var React5 = __toESM(require("react"));
28535
28516
  var import_react_day_picker = require("react-day-picker");
28536
- var import_jsx_runtime44 = require("react/jsx-runtime");
28517
+ var import_jsx_runtime43 = require("react/jsx-runtime");
28537
28518
  function Calendar2({
28538
28519
  className,
28539
28520
  classNames,
@@ -28545,7 +28526,7 @@ function Calendar2({
28545
28526
  ...props
28546
28527
  }) {
28547
28528
  const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
28548
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
28529
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
28549
28530
  import_react_day_picker.DayPicker,
28550
28531
  {
28551
28532
  showOutsideDays,
@@ -28644,7 +28625,7 @@ function Calendar2({
28644
28625
  },
28645
28626
  components: {
28646
28627
  Root: ({ className: className2, rootRef, ...props2 }) => {
28647
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
28628
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
28648
28629
  "div",
28649
28630
  {
28650
28631
  "data-slot": "calendar",
@@ -28656,10 +28637,10 @@ function Calendar2({
28656
28637
  },
28657
28638
  Chevron: ({ className: className2, orientation, ...props2 }) => {
28658
28639
  if (orientation === "left") {
28659
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronLeft, { className: cn("size-4", className2), ...props2 });
28640
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChevronLeft, { className: cn("size-4", className2), ...props2 });
28660
28641
  }
28661
28642
  if (orientation === "right") {
28662
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
28643
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
28663
28644
  ChevronRight,
28664
28645
  {
28665
28646
  className: cn("size-4", className2),
@@ -28667,11 +28648,11 @@ function Calendar2({
28667
28648
  }
28668
28649
  );
28669
28650
  }
28670
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { className: cn("size-4", className2), ...props2 });
28651
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChevronDown, { className: cn("size-4", className2), ...props2 });
28671
28652
  },
28672
28653
  DayButton: CalendarDayButton,
28673
28654
  WeekNumber: ({ children, ...props2 }) => {
28674
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { ...props2, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
28655
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { ...props2, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
28675
28656
  },
28676
28657
  ...components
28677
28658
  },
@@ -28686,11 +28667,11 @@ function CalendarDayButton({
28686
28667
  ...props
28687
28668
  }) {
28688
28669
  const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
28689
- const ref = React6.useRef(null);
28690
- React6.useEffect(() => {
28670
+ const ref = React5.useRef(null);
28671
+ React5.useEffect(() => {
28691
28672
  if (modifiers.focused) ref.current?.focus();
28692
28673
  }, [modifiers.focused]);
28693
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
28674
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
28694
28675
  Button,
28695
28676
  {
28696
28677
  ref,
@@ -28713,16 +28694,16 @@ function CalendarDayButton({
28713
28694
 
28714
28695
  // src/components/ui/popover.tsx
28715
28696
  var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
28716
- var import_jsx_runtime45 = require("react/jsx-runtime");
28697
+ var import_jsx_runtime44 = require("react/jsx-runtime");
28717
28698
  function Popover({
28718
28699
  ...props
28719
28700
  }) {
28720
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
28701
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
28721
28702
  }
28722
28703
  function PopoverTrigger({
28723
28704
  ...props
28724
28705
  }) {
28725
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
28706
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
28726
28707
  }
28727
28708
  function PopoverContent({
28728
28709
  className,
@@ -28730,7 +28711,7 @@ function PopoverContent({
28730
28711
  sideOffset = 4,
28731
28712
  ...props
28732
28713
  }) {
28733
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
28714
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
28734
28715
  PopoverPrimitive.Content,
28735
28716
  {
28736
28717
  "data-slot": "popover-content",
@@ -28745,17 +28726,337 @@ function PopoverContent({
28745
28726
  ) });
28746
28727
  }
28747
28728
 
28729
+ // src/components/Inputs/DatePicker/DatePicker.tsx
28730
+ var import_jsx_runtime45 = require("react/jsx-runtime");
28731
+ function resolveDate(option, customOption) {
28732
+ if (!option) return void 0;
28733
+ switch (option) {
28734
+ case "today":
28735
+ return /* @__PURE__ */ new Date();
28736
+ case "custom":
28737
+ return customOption ? new Date(customOption) : void 0;
28738
+ case "none":
28739
+ default:
28740
+ return void 0;
28741
+ }
28742
+ }
28743
+ function DateTimePicker({
28744
+ className,
28745
+ style,
28746
+ mode = "date",
28747
+ ...props
28748
+ }) {
28749
+ const placeholderMap = {
28750
+ date: "Select date",
28751
+ datetime: "Select date & time",
28752
+ time: "Select time"
28753
+ };
28754
+ const placeholder = props.placeholder ?? placeholderMap[mode];
28755
+ const minimumDate = props.minimumDate ?? "none";
28756
+ const customMinimumDate = props.customMinimumDate ?? "";
28757
+ const maximumDate = props.maximumDate ?? "none";
28758
+ const customMaximumDate = props.customMaximumDate ?? "";
28759
+ const isEditable = props.isEditable ?? true;
28760
+ const isDisabled = props.isDisabled ?? false;
28761
+ const isReadonly = props.isReadonly ?? false;
28762
+ const isAutocomplete = props.isAutocomplete ?? false;
28763
+ const minDate = resolveDate(minimumDate, customMinimumDate);
28764
+ const maxDate = resolveDate(maximumDate, customMaximumDate);
28765
+ const [date, setDate] = React6.useState(() => {
28766
+ if (!props.value) return void 0;
28767
+ const d = new Date(props.value);
28768
+ return isNaN(d.getTime()) ? void 0 : d;
28769
+ });
28770
+ const initialHours = date ? date.getHours() : 0;
28771
+ const initialMinutes = date ? date.getMinutes() : 0;
28772
+ const [hours, setHours] = React6.useState(initialHours);
28773
+ const [minutes, setMinutes] = React6.useState(initialMinutes);
28774
+ const [amPm, setAmPm] = React6.useState("AM");
28775
+ const displayHours = React6.useMemo(() => {
28776
+ if (hours === 0) return 12;
28777
+ if (hours > 12) return hours - 12;
28778
+ return hours;
28779
+ }, [hours]);
28780
+ React6.useEffect(() => {
28781
+ setAmPm(hours >= 12 ? "PM" : "AM");
28782
+ }, [hours]);
28783
+ React6.useEffect(() => {
28784
+ if (!props.value) {
28785
+ setDate(void 0);
28786
+ return;
28787
+ }
28788
+ const d = new Date(props.value);
28789
+ if (!isNaN(d.getTime())) {
28790
+ setDate(d);
28791
+ setHours(d.getHours());
28792
+ setMinutes(d.getMinutes());
28793
+ }
28794
+ }, [props.value]);
28795
+ const [year, setYear] = React6.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
28796
+ React6.useEffect(() => {
28797
+ if (!date) return;
28798
+ const newDate = new Date(date);
28799
+ newDate.setFullYear(year);
28800
+ setDate(newDate);
28801
+ emitChange(newDate);
28802
+ }, [year]);
28803
+ const emitChange = (nextDate) => {
28804
+ if (!props.onChange) return;
28805
+ let valueString = "";
28806
+ if (!nextDate) {
28807
+ valueString = "";
28808
+ } else if (mode === "date") {
28809
+ valueString = (0, import_date_fns.format)(nextDate, "yyyy-MM-dd");
28810
+ } else if (mode === "time") {
28811
+ valueString = (0, import_date_fns.format)(nextDate, "HH:mm:ss");
28812
+ } else {
28813
+ valueString = nextDate.toISOString();
28814
+ }
28815
+ const target = {
28816
+ name: props.name || "",
28817
+ value: valueString
28818
+ };
28819
+ const event = {
28820
+ target
28821
+ };
28822
+ props.onChange(event, props.name || "");
28823
+ };
28824
+ const updateDateTime = (nextBaseDate, h = hours, m = minutes) => {
28825
+ if (!nextBaseDate) {
28826
+ setDate(void 0);
28827
+ emitChange(void 0);
28828
+ return;
28829
+ }
28830
+ const d = new Date(nextBaseDate);
28831
+ if (mode !== "date") {
28832
+ d.setHours(h);
28833
+ d.setMinutes(m);
28834
+ d.setSeconds(0);
28835
+ d.setMilliseconds(0);
28836
+ } else {
28837
+ d.setHours(0, 0, 0, 0);
28838
+ }
28839
+ if (minDate && d < minDate) return;
28840
+ if (maxDate && d > maxDate) return;
28841
+ setDate(d);
28842
+ setYear(d.getFullYear());
28843
+ emitChange(d);
28844
+ };
28845
+ const handleDaySelect = (next) => {
28846
+ if (!next) {
28847
+ setDate(void 0);
28848
+ emitChange(void 0);
28849
+ return;
28850
+ }
28851
+ const clickedDate = new Date(next);
28852
+ const selectedYearDate = new Date(year, clickedDate.getMonth(), clickedDate.getDate());
28853
+ updateDateTime(selectedYearDate);
28854
+ };
28855
+ const updateTimeInDate = (h, m) => {
28856
+ if (!date) {
28857
+ const fallbackDate = /* @__PURE__ */ new Date();
28858
+ fallbackDate.setHours(h);
28859
+ fallbackDate.setMinutes(m);
28860
+ fallbackDate.setSeconds(0);
28861
+ fallbackDate.setMilliseconds(0);
28862
+ setDate(fallbackDate);
28863
+ emitChange(fallbackDate);
28864
+ } else {
28865
+ const newDate = new Date(date);
28866
+ newDate.setHours(h);
28867
+ newDate.setMinutes(m);
28868
+ newDate.setSeconds(0);
28869
+ newDate.setMilliseconds(0);
28870
+ setDate(newDate);
28871
+ emitChange(newDate);
28872
+ }
28873
+ };
28874
+ const handleHoursChange = (e) => {
28875
+ let h = Number(e.target.value);
28876
+ if (amPm === "PM" && h < 12) h += 12;
28877
+ if (amPm === "AM" && h === 12) h = 0;
28878
+ setHours(h);
28879
+ updateTimeInDate(h, minutes);
28880
+ };
28881
+ const handleMinutesChange = (e) => {
28882
+ const m = Number(e.target.value);
28883
+ setMinutes(m);
28884
+ updateTimeInDate(hours, m);
28885
+ };
28886
+ const handleAmPmChange = (e) => {
28887
+ const val = e.target.value;
28888
+ setAmPm(val);
28889
+ let h = displayHours;
28890
+ if (val === "PM" && h < 12) h += 12;
28891
+ if (val === "AM" && h === 12) h = 0;
28892
+ setHours(h);
28893
+ updateTimeInDate(h, minutes);
28894
+ };
28895
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
28896
+ const yearOptions = [];
28897
+ for (let y = currentYear - 50; y <= currentYear + 10; y++) {
28898
+ yearOptions.push(y);
28899
+ }
28900
+ const displayValue = React6.useMemo(() => {
28901
+ if (!date) return "";
28902
+ try {
28903
+ if (mode === "date") return (0, import_date_fns.format)(date, "yyyy-MM-dd");
28904
+ if (mode === "time") return (0, import_date_fns.format)(date, "hh:mm aa");
28905
+ return (0, import_date_fns.format)(date, "yyyy-MM-dd hh:mm aa");
28906
+ } catch {
28907
+ return "";
28908
+ }
28909
+ }, [date, mode]);
28910
+ const isInputDisabled = isDisabled || !isEditable;
28911
+ const [calendarMonthState, setCalendarMonthState] = React6.useState(() => {
28912
+ const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
28913
+ return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
28914
+ });
28915
+ React6.useEffect(() => {
28916
+ setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
28917
+ }, [year]);
28918
+ const handleToday = () => {
28919
+ const today = /* @__PURE__ */ new Date();
28920
+ const selectedYearDate = new Date(year, today.getMonth(), today.getDate());
28921
+ updateDateTime(selectedYearDate);
28922
+ };
28923
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col", children: [
28924
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Popover, { children: [
28925
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
28926
+ Button,
28927
+ {
28928
+ type: "button",
28929
+ variant: "outline",
28930
+ className: cn(
28931
+ "w-full justify-start text-left font-normal",
28932
+ !date && "text-muted-foreground",
28933
+ props.errorMessage && "border-red-500",
28934
+ className
28935
+ ),
28936
+ style: {
28937
+ ...style,
28938
+ borderColor: props.errorMessage ? "#f87171" : style?.borderColor
28939
+ },
28940
+ disabled: isInputDisabled,
28941
+ children: [
28942
+ displayValue || placeholder,
28943
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Calendar1, { className: "absolute right-2 top-2" })
28944
+ ]
28945
+ }
28946
+ ) }),
28947
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverContent, { className: "w-auto text-sm p-2", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-1", children: [
28948
+ (mode === "date" || mode === "datetime") && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
28949
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center justify-between gap-1", children: [
28950
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
28951
+ "label",
28952
+ {
28953
+ className: "text-xs text-blue-600 font-bold cursor-pointer",
28954
+ role: "presentation",
28955
+ onClick: handleToday,
28956
+ children: "Today"
28957
+ }
28958
+ ),
28959
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
28960
+ "select",
28961
+ {
28962
+ className: "h-8 rounded border bg-background px-2 text-xs",
28963
+ value: year,
28964
+ onChange: (e) => setYear(Number(e.target.value)),
28965
+ disabled: isInputDisabled || isReadonly,
28966
+ children: yearOptions.map((y) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: y, children: y }, y))
28967
+ }
28968
+ )
28969
+ ] }),
28970
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "calendar-container", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
28971
+ Calendar2,
28972
+ {
28973
+ mode: "single",
28974
+ selected: date,
28975
+ onSelect: handleDaySelect,
28976
+ month: calendarMonthState,
28977
+ onMonthChange: (newMonth) => setCalendarMonthState(newMonth),
28978
+ disabled: (d) => {
28979
+ if (minDate && d < minDate) return true;
28980
+ if (maxDate && d > maxDate) return true;
28981
+ return false;
28982
+ },
28983
+ className: "p-[10px]",
28984
+ autoFocus: true
28985
+ }
28986
+ ) })
28987
+ ] }),
28988
+ (mode === "time" || mode === "datetime") && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center gap-2 mt-0", children: [
28989
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("label", { className: "text-xs text-muted-foreground", children: "Time" }),
28990
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
28991
+ "select",
28992
+ {
28993
+ className: "h-8 rounded border bg-background px-2 text-xs",
28994
+ value: displayHours,
28995
+ onChange: handleHoursChange,
28996
+ disabled: isInputDisabled || isReadonly,
28997
+ children: Array.from({ length: 12 }, (_, i) => i + 1).map((hour) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: hour, children: hour.toString().padStart(2, "0") }, hour))
28998
+ }
28999
+ ),
29000
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-sm", children: ":" }),
29001
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
29002
+ "select",
29003
+ {
29004
+ className: "h-8 rounded border bg-background px-2 text-xs",
29005
+ value: minutes,
29006
+ onChange: handleMinutesChange,
29007
+ disabled: isInputDisabled || isReadonly,
29008
+ children: Array.from({ length: 12 }).map((_, i) => {
29009
+ const val = i * 5;
29010
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: val, children: val.toString().padStart(2, "0") }, val);
29011
+ })
29012
+ }
29013
+ ),
29014
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
29015
+ "select",
29016
+ {
29017
+ className: "h-8 rounded border bg-background px-2 text-xs",
29018
+ value: amPm,
29019
+ onChange: handleAmPmChange,
29020
+ disabled: isInputDisabled || isReadonly,
29021
+ children: [
29022
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "AM", children: "AM" }),
29023
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: "PM", children: "PM" })
29024
+ ]
29025
+ }
29026
+ )
29027
+ ] })
29028
+ ] }) })
29029
+ ] }),
29030
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
29031
+ Input,
29032
+ {
29033
+ type: "hidden",
29034
+ id: props.name,
29035
+ name: props.name,
29036
+ autoComplete: isAutocomplete ? "on" : "off",
29037
+ readOnly: isReadonly,
29038
+ value: !date ? "" : mode === "date" ? (0, import_date_fns.format)(date, "yyyy-MM-dd") : mode === "time" ? (0, import_date_fns.format)(date, "HH:mm:ss") : date.toISOString(),
29039
+ onChange: () => {
29040
+ }
29041
+ }
29042
+ ),
29043
+ props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
29044
+ ] });
29045
+ }
29046
+
28748
29047
  // src/components/Inputs/DateRange/DateRange.tsx
29048
+ var import_react26 = __toESM(require("react"));
29049
+ var import_date_fns2 = require("date-fns");
28749
29050
  var import_jsx_runtime46 = require("react/jsx-runtime");
28750
29051
  var DateRange = ({ className, style, ...props }) => {
28751
29052
  const isDateRange = (val) => !!val && val.from instanceof Date;
28752
- const [date, setDate] = import_react27.default.useState(
29053
+ const [date, setDate] = import_react26.default.useState(
28753
29054
  isDateRange(props.value) ? props.value : {
28754
29055
  from: /* @__PURE__ */ new Date(),
28755
- to: (0, import_date_fns.addDays)(/* @__PURE__ */ new Date(), 7)
29056
+ to: (0, import_date_fns2.addDays)(/* @__PURE__ */ new Date(), 7)
28756
29057
  }
28757
29058
  );
28758
- (0, import_react27.useEffect)(() => {
29059
+ (0, import_react26.useEffect)(() => {
28759
29060
  if (props.value && isDateRange(props.value)) {
28760
29061
  handleChange?.(props.value);
28761
29062
  }
@@ -28778,11 +29079,11 @@ var DateRange = ({ className, style, ...props }) => {
28778
29079
  !date && "text-muted-foreground"
28779
29080
  ),
28780
29081
  children: date?.from ? date.to ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
28781
- (0, import_date_fns.format)(date.from, "LLL dd, y"),
29082
+ (0, import_date_fns2.format)(date.from, "LLL dd, y"),
28782
29083
  " -",
28783
29084
  " ",
28784
- (0, import_date_fns.format)(date.to, "LLL dd, y")
28785
- ] }) : (0, import_date_fns.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Pick a date range" })
29085
+ (0, import_date_fns2.format)(date.to, "LLL dd, y")
29086
+ ] }) : (0, import_date_fns2.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Pick a date range" })
28786
29087
  }
28787
29088
  ) }),
28788
29089
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
@@ -28802,7 +29103,7 @@ var DateRange = ({ className, style, ...props }) => {
28802
29103
  var DateRange_default = DateRange;
28803
29104
 
28804
29105
  // src/components/Inputs/TextInputGroup/TextInputGroup.tsx
28805
- var import_react28 = require("react");
29106
+ var import_react27 = require("react");
28806
29107
  var import_jsx_runtime47 = require("react/jsx-runtime");
28807
29108
  var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28808
29109
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -28810,7 +29111,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28810
29111
  const isDisabled = props.isDisabled ?? false;
28811
29112
  const isReadonly = props.isReadonly ?? false;
28812
29113
  const isAutocomplete = props.isAutocomplete ?? false;
28813
- (0, import_react28.useEffect)(() => {
29114
+ (0, import_react27.useEffect)(() => {
28814
29115
  if (props.value !== void 0) {
28815
29116
  const e = { target: { value: props.value } };
28816
29117
  handleChange?.(e);
@@ -28863,7 +29164,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28863
29164
  var TextInputGroup_default = TextInputGroup;
28864
29165
 
28865
29166
  // src/components/Inputs/Multiselect/MultiSelect.tsx
28866
- var import_react29 = require("react");
29167
+ var import_react28 = require("react");
28867
29168
  var import_jsx_runtime48 = require("react/jsx-runtime");
28868
29169
  function LazyMultiSelectDropdown({
28869
29170
  options = [],
@@ -28883,10 +29184,10 @@ function LazyMultiSelectDropdown({
28883
29184
  axiosInstance,
28884
29185
  outputFormat = "array"
28885
29186
  }) {
28886
- const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
28887
- const [searchTerm, setSearchTerm] = (0, import_react29.useState)("");
28888
- const dropdownRef = (0, import_react29.useRef)(null);
28889
- const observerTarget = (0, import_react29.useRef)(null);
29187
+ const [isOpen, setIsOpen] = (0, import_react28.useState)(false);
29188
+ const [searchTerm, setSearchTerm] = (0, import_react28.useState)("");
29189
+ const dropdownRef = (0, import_react28.useRef)(null);
29190
+ const observerTarget = (0, import_react28.useRef)(null);
28890
29191
  const ensureUnique = (arr) => {
28891
29192
  return Array.from(new Set(arr));
28892
29193
  };
@@ -28934,10 +29235,10 @@ function LazyMultiSelectDropdown({
28934
29235
  return unique;
28935
29236
  }
28936
29237
  };
28937
- const selectedOptions = (0, import_react29.useMemo)(() => {
29238
+ const selectedOptions = (0, import_react28.useMemo)(() => {
28938
29239
  return lazyOptions.filter((opt) => normalizedValue.includes(opt.value));
28939
29240
  }, [lazyOptions, normalizedValue]);
28940
- (0, import_react29.useEffect)(() => {
29241
+ (0, import_react28.useEffect)(() => {
28941
29242
  const handleClick = (e) => {
28942
29243
  if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
28943
29244
  setIsOpen(false);
@@ -28946,7 +29247,7 @@ function LazyMultiSelectDropdown({
28946
29247
  document.addEventListener("mousedown", handleClick);
28947
29248
  return () => document.removeEventListener("mousedown", handleClick);
28948
29249
  }, []);
28949
- (0, import_react29.useEffect)(() => {
29250
+ (0, import_react28.useEffect)(() => {
28950
29251
  if (!isOpen || !hasMore || loading) return;
28951
29252
  const obs = new IntersectionObserver(
28952
29253
  (entries) => {
@@ -29168,7 +29469,7 @@ function TableCell({ className, ...props }) {
29168
29469
  var import_react_table = require("@tanstack/react-table");
29169
29470
 
29170
29471
  // src/lib/table/cellRendererFactory.tsx
29171
- var import_react30 = __toESM(require("react"));
29472
+ var import_react29 = __toESM(require("react"));
29172
29473
  var import_image3 = __toESM(require("next/image"));
29173
29474
 
29174
29475
  // src/lib/dayjs-setup.ts
@@ -29178,14 +29479,14 @@ import_dayjs.default.extend(import_utc.default);
29178
29479
  var dayjs_setup_default = import_dayjs.default;
29179
29480
 
29180
29481
  // src/lib/table/valueFormatter.ts
29181
- var valueFormatter = (value, format2, customFormatters = {}) => {
29182
- if (!format2) return value;
29482
+ var valueFormatter = (value, format3, customFormatters = {}) => {
29483
+ if (!format3) return value;
29183
29484
  if (value == null || value === "" || value === void 0) return "-";
29184
- if (format2.startsWith("custom:")) {
29185
- const key = format2.replace("custom:", "");
29485
+ if (format3.startsWith("custom:")) {
29486
+ const key = format3.replace("custom:", "");
29186
29487
  return customFormatters[key] ? customFormatters[key](value) : value;
29187
29488
  }
29188
- const [type, arg] = format2.split(":");
29489
+ const [type, arg] = format3.split(":");
29189
29490
  switch (type) {
29190
29491
  case "date":
29191
29492
  return dayjs_setup_default(value).format(arg || "YYYY-MM-DD");
@@ -29254,9 +29555,9 @@ var getContrastColor = (bg) => {
29254
29555
  };
29255
29556
  var sanitizeValue = (val) => {
29256
29557
  if (val == null) return null;
29257
- if (import_react30.default.isValidElement(val)) return val;
29558
+ if (import_react29.default.isValidElement(val)) return val;
29258
29559
  if (typeof val === "string" || typeof val === "number") return val;
29259
- if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react30.default.Fragment, { children: sanitizeValue(v) }, i));
29560
+ if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react29.default.Fragment, { children: sanitizeValue(v) }, i));
29260
29561
  if (typeof val === "object") {
29261
29562
  if ("name" in val && typeof val.name === "string") return val.name;
29262
29563
  if ("label" in val && typeof val.label === "string") return val.label;
@@ -29268,8 +29569,8 @@ var sanitizeValue = (val) => {
29268
29569
  }
29269
29570
  return String(val);
29270
29571
  };
29271
- var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format2, customFormatters = {}) => {
29272
- const formattedValue = valueFormatter(value, format2, customFormatters);
29572
+ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format3, customFormatters = {}) => {
29573
+ const formattedValue = valueFormatter(value, format3, customFormatters);
29273
29574
  const rowValue = row?.[rendererProps?.rowField];
29274
29575
  switch (renderer) {
29275
29576
  /* -------------------- BASIC -------------------- */
@@ -29278,7 +29579,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
29278
29579
  case "number":
29279
29580
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "tabular-nums text-right", children: valueFormatter(rowValue || value, "number:2") });
29280
29581
  case "date":
29281
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: valueFormatter(rowValue || value, format2) });
29582
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: valueFormatter(rowValue || value, format3) });
29282
29583
  case "link":
29283
29584
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
29284
29585
  "a",
@@ -30091,7 +30392,7 @@ var CustomPagination = ({
30091
30392
  var Pagination_default = CustomPagination;
30092
30393
 
30093
30394
  // src/components/Navigation/Tabs/Tabs.tsx
30094
- var import_react31 = require("react");
30395
+ var import_react30 = require("react");
30095
30396
  var import_link5 = __toESM(require("next/link"));
30096
30397
  var import_navigation3 = require("next/navigation");
30097
30398
 
@@ -30249,7 +30550,7 @@ function showSonnerToast({
30249
30550
  // src/components/Navigation/Tabs/Tabs.tsx
30250
30551
  var import_jsx_runtime56 = require("react/jsx-runtime");
30251
30552
  var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
30252
- const [openIndex, setOpenIndex] = (0, import_react31.useState)(null);
30553
+ const [openIndex, setOpenIndex] = (0, import_react30.useState)(null);
30253
30554
  const currentPathname = (0, import_navigation3.usePathname)();
30254
30555
  function groupMenus(menus = []) {
30255
30556
  const menuMap = /* @__PURE__ */ new Map();
@@ -30283,7 +30584,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30283
30584
  });
30284
30585
  return sortMenus(rootMenus);
30285
30586
  }
30286
- const rawTabs = (0, import_react31.useMemo)(() => {
30587
+ const rawTabs = (0, import_react30.useMemo)(() => {
30287
30588
  if (!Array.isArray(tabs)) return [];
30288
30589
  if (source === "manual") return Array.isArray(tabs) ? tabs : [];
30289
30590
  return groupMenus(tabs);
@@ -30313,9 +30614,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30313
30614
  return tab.children.some((child) => isActive(child.url));
30314
30615
  };
30315
30616
  const router = (0, import_navigation3.useRouter)();
30316
- const [showExitDialog, setShowExitDialog] = (0, import_react31.useState)(false);
30317
- const [pendingUrl, setPendingUrl] = (0, import_react31.useState)(null);
30318
- const handleBuilderExit = (0, import_react31.useCallback)(
30617
+ const [showExitDialog, setShowExitDialog] = (0, import_react30.useState)(false);
30618
+ const [pendingUrl, setPendingUrl] = (0, import_react30.useState)(null);
30619
+ const handleBuilderExit = (0, import_react30.useCallback)(
30319
30620
  (e, url) => {
30320
30621
  if (isBuilder) {
30321
30622
  e.preventDefault();
@@ -30482,11 +30783,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30482
30783
  var Tabs_default = Tabs;
30483
30784
 
30484
30785
  // src/components/Navigation/Stages/Stages.tsx
30485
- var import_react32 = __toESM(require("react"));
30786
+ var import_react31 = __toESM(require("react"));
30486
30787
  var import_jsx_runtime57 = require("react/jsx-runtime");
30487
30788
  var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header", loading, saving, triggerOnClick = false }) => {
30488
- const [activeStage, setActiveStage] = (0, import_react32.useState)(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
30489
- const [isCompleted, setIsCompleted] = (0, import_react32.useState)(false);
30789
+ const [activeStage, setActiveStage] = (0, import_react31.useState)(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
30790
+ const [isCompleted, setIsCompleted] = (0, import_react31.useState)(false);
30490
30791
  const updateStage = (stageKey) => {
30491
30792
  setActiveStage(stageKey);
30492
30793
  onStageChange?.(stageKey);
@@ -30531,7 +30832,7 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
30531
30832
  const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
30532
30833
  const isCompleted2 = isAllStagesCompleted || index < currentIndex;
30533
30834
  const isActive = !isAllStagesCompleted && index === currentIndex;
30534
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react32.default.Fragment, { children: [
30835
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react31.default.Fragment, { children: [
30535
30836
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30536
30837
  "button",
30537
30838
  {
@@ -30622,7 +30923,7 @@ var import_link6 = __toESM(require("next/link"));
30622
30923
  var import_image4 = __toESM(require("next/image"));
30623
30924
  var import_navigation4 = require("next/navigation");
30624
30925
  var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
30625
- var import_react33 = require("react");
30926
+ var import_react32 = require("react");
30626
30927
  var import_jsx_runtime63 = require("react/jsx-runtime");
30627
30928
  function Navbar({
30628
30929
  style,
@@ -30643,9 +30944,9 @@ function Navbar({
30643
30944
  }) {
30644
30945
  const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
30645
30946
  const router = (0, import_navigation4.useRouter)();
30646
- const [showExitDialog, setShowExitDialog] = (0, import_react33.useState)(false);
30647
- const [pendingUrl, setPendingUrl] = (0, import_react33.useState)(null);
30648
- const handleBuilderExit = (0, import_react33.useCallback)(
30947
+ const [showExitDialog, setShowExitDialog] = (0, import_react32.useState)(false);
30948
+ const [pendingUrl, setPendingUrl] = (0, import_react32.useState)(null);
30949
+ const handleBuilderExit = (0, import_react32.useCallback)(
30649
30950
  (e, url) => {
30650
30951
  if (isBuilder) {
30651
30952
  e.preventDefault();
@@ -30661,7 +30962,7 @@ function Navbar({
30661
30962
  router.push(pendingUrl);
30662
30963
  }
30663
30964
  };
30664
- const formatedMenu = (0, import_react33.useMemo)(() => {
30965
+ const formatedMenu = (0, import_react32.useMemo)(() => {
30665
30966
  if (source === "state" && navList && navList.length) {
30666
30967
  return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
30667
30968
  }
@@ -30764,7 +31065,7 @@ function Navbar({
30764
31065
  }
30765
31066
 
30766
31067
  // src/components/Chart/BarChart.tsx
30767
- var import_react34 = __toESM(require("react"));
31068
+ var import_react33 = __toESM(require("react"));
30768
31069
  var import_recharts = require("recharts");
30769
31070
  var import_jsx_runtime64 = require("react/jsx-runtime");
30770
31071
  var ChartComponent = ({ className, style, loading, ...props }) => {
@@ -30825,10 +31126,10 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
30825
31126
  )
30826
31127
  ] }) }) });
30827
31128
  };
30828
- var BarChart_default = import_react34.default.memo(ChartComponent);
31129
+ var BarChart_default = import_react33.default.memo(ChartComponent);
30829
31130
 
30830
31131
  // src/components/Chart/PieChart.tsx
30831
- var import_react35 = __toESM(require("react"));
31132
+ var import_react34 = __toESM(require("react"));
30832
31133
  var import_recharts2 = require("recharts");
30833
31134
  var import_jsx_runtime65 = require("react/jsx-runtime");
30834
31135
  var getRandomColor = () => {
@@ -30850,18 +31151,18 @@ var DonutChart = ({ className, style, loading, ...props }) => {
30850
31151
  const showLegends = props.showLegends ?? true;
30851
31152
  const labelType = props.labelType || "inside";
30852
31153
  const canvasMode = props.canvasMode;
30853
- const data = (0, import_react35.useMemo)(() => {
31154
+ const data = (0, import_react34.useMemo)(() => {
30854
31155
  if (!Array.isArray(props.data)) return [];
30855
31156
  return props.data.map((item) => ({ ...item, color: getRandomColor() }));
30856
31157
  }, [props.data]);
30857
- const total = (0, import_react35.useMemo)(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
31158
+ const total = (0, import_react34.useMemo)(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
30858
31159
  const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
30859
- const [mounted, setMounted] = (0, import_react35.useState)(false);
30860
- (0, import_react35.useEffect)(() => {
31160
+ const [mounted, setMounted] = (0, import_react34.useState)(false);
31161
+ (0, import_react34.useEffect)(() => {
30861
31162
  const timeout = setTimeout(() => setMounted(true), 100);
30862
31163
  return () => clearTimeout(timeout);
30863
31164
  }, []);
30864
- const renderLegends = (0, import_react35.useMemo)(() => {
31165
+ const renderLegends = (0, import_react34.useMemo)(() => {
30865
31166
  if (!showLegends) return null;
30866
31167
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: data.map((d) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
30867
31168
  "div",
@@ -30949,7 +31250,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
30949
31250
  }
30950
31251
  );
30951
31252
  };
30952
- var PieChart_default = import_react35.default.memo(DonutChart);
31253
+ var PieChart_default = import_react34.default.memo(DonutChart);
30953
31254
 
30954
31255
  // src/components/Blocks/EmailComposer.tsx
30955
31256
  var import_jsx_runtime66 = require("react/jsx-runtime");