@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/client.js +7 -2
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +7 -2
- package/dist/client.mjs.map +1 -1
- package/dist/index.css +164 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +442 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +424 -123
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -27916,6 +27916,32 @@ function useLazyDropdown(config) {
|
|
|
27916
27916
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
27917
27917
|
};
|
|
27918
27918
|
}, []);
|
|
27919
|
+
const createNewOption = async (label) => {
|
|
27920
|
+
if (!configRef.current.apiUrl) return null;
|
|
27921
|
+
const axiosClient = configRef.current.axiosInstance ?? axios;
|
|
27922
|
+
const apiUrl = configRef.current.apiUrl;
|
|
27923
|
+
const urlObj = new URL(
|
|
27924
|
+
apiUrl,
|
|
27925
|
+
typeof window !== "undefined" ? window.location.origin : "http://localhost"
|
|
27926
|
+
);
|
|
27927
|
+
const queryParams = {};
|
|
27928
|
+
urlObj.searchParams.forEach((value, key) => {
|
|
27929
|
+
queryParams[key] = value;
|
|
27930
|
+
});
|
|
27931
|
+
const body = {
|
|
27932
|
+
...queryParams,
|
|
27933
|
+
[configRef.current.dataLabel]: label
|
|
27934
|
+
};
|
|
27935
|
+
const res = await axiosClient.post(urlObj.origin + urlObj.pathname, body, {
|
|
27936
|
+
withCredentials: true
|
|
27937
|
+
});
|
|
27938
|
+
if (res.data?.success && Array.isArray(res.data.data) && res.data.data.length > 0) {
|
|
27939
|
+
const fetched = transformToOptions(res.data.data);
|
|
27940
|
+
setOptions((prev) => uniqueOptions([...fetched, ...prev]));
|
|
27941
|
+
return fetched[0];
|
|
27942
|
+
}
|
|
27943
|
+
return null;
|
|
27944
|
+
};
|
|
27919
27945
|
return {
|
|
27920
27946
|
options,
|
|
27921
27947
|
loading,
|
|
@@ -27923,7 +27949,8 @@ function useLazyDropdown(config) {
|
|
|
27923
27949
|
loadMore,
|
|
27924
27950
|
search,
|
|
27925
27951
|
reset,
|
|
27926
|
-
loadPage
|
|
27952
|
+
loadPage,
|
|
27953
|
+
createNewOption
|
|
27927
27954
|
};
|
|
27928
27955
|
}
|
|
27929
27956
|
|
|
@@ -27944,7 +27971,8 @@ function LazySelectDropdown({
|
|
|
27944
27971
|
dataKey = "id",
|
|
27945
27972
|
dataLabel = "name",
|
|
27946
27973
|
errorMessage,
|
|
27947
|
-
axiosInstance
|
|
27974
|
+
axiosInstance,
|
|
27975
|
+
enableAddNewOption = false
|
|
27948
27976
|
}) {
|
|
27949
27977
|
const [isOpen, setIsOpen] = useState5(false);
|
|
27950
27978
|
const [searchTerm, setSearchTerm] = useState5("");
|
|
@@ -27957,7 +27985,8 @@ function LazySelectDropdown({
|
|
|
27957
27985
|
loadMore,
|
|
27958
27986
|
search,
|
|
27959
27987
|
reset,
|
|
27960
|
-
loadPage
|
|
27988
|
+
loadPage,
|
|
27989
|
+
createNewOption
|
|
27961
27990
|
} = useLazyDropdown({
|
|
27962
27991
|
enabled: true,
|
|
27963
27992
|
dataSource: source || "",
|
|
@@ -28015,6 +28044,15 @@ function LazySelectDropdown({
|
|
|
28015
28044
|
reset();
|
|
28016
28045
|
search("");
|
|
28017
28046
|
};
|
|
28047
|
+
const handleAddNewOption = async (newOption) => {
|
|
28048
|
+
const option = await createNewOption(newOption);
|
|
28049
|
+
if (option) {
|
|
28050
|
+
onChange?.(option.value, id || "");
|
|
28051
|
+
setIsOpen(false);
|
|
28052
|
+
setSearchTerm("");
|
|
28053
|
+
reset();
|
|
28054
|
+
}
|
|
28055
|
+
};
|
|
28018
28056
|
return /* @__PURE__ */ jsxs18("div", { ref: dropdownRef, className: "relative w-full", children: [
|
|
28019
28057
|
/* @__PURE__ */ jsx36(
|
|
28020
28058
|
"input",
|
|
@@ -28084,7 +28122,19 @@ function LazySelectDropdown({
|
|
|
28084
28122
|
] }) : "Scroll for more..."
|
|
28085
28123
|
}
|
|
28086
28124
|
)
|
|
28087
|
-
] }) : /* @__PURE__ */
|
|
28125
|
+
] }) : /* @__PURE__ */ jsxs18("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: [
|
|
28126
|
+
searchTerm ? `No results for "${searchTerm}"` : "No options available",
|
|
28127
|
+
enableAddNewOption && searchTerm && /* @__PURE__ */ jsx36(
|
|
28128
|
+
"div",
|
|
28129
|
+
{
|
|
28130
|
+
onClick: () => {
|
|
28131
|
+
handleAddNewOption(searchTerm);
|
|
28132
|
+
},
|
|
28133
|
+
className: "mt-2 px-3 py-2 bg-green-50 hover:bg-green-100 cursor-pointer text-green-700 rounded text-sm",
|
|
28134
|
+
children: `Add "${searchTerm}"`
|
|
28135
|
+
}
|
|
28136
|
+
)
|
|
28137
|
+
] })
|
|
28088
28138
|
}
|
|
28089
28139
|
) })
|
|
28090
28140
|
] });
|
|
@@ -28363,82 +28413,13 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
28363
28413
|
var FileInput_default = FileInput2;
|
|
28364
28414
|
|
|
28365
28415
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
28366
|
-
import
|
|
28367
|
-
import {
|
|
28368
|
-
function DatePicker({ className, style, ...props }) {
|
|
28369
|
-
const placeholder = props.placeholder ?? "Placeholder text";
|
|
28370
|
-
const minimumDate = props.minimumDate ?? "none";
|
|
28371
|
-
const customMinimumDate = props.customMinimumDate ?? "";
|
|
28372
|
-
const maximumDate = props.maximumDate ?? "none";
|
|
28373
|
-
const customMaximumDate = props.customMaximumDate ?? "";
|
|
28374
|
-
const isEditable = props.isEditable ?? true;
|
|
28375
|
-
const isDisabled = props.isDisabled ?? false;
|
|
28376
|
-
const isReadonly = props.isReadonly ?? false;
|
|
28377
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28378
|
-
const resolveDate = (option, customOption) => {
|
|
28379
|
-
if (!option) return void 0;
|
|
28380
|
-
switch (option) {
|
|
28381
|
-
case "today":
|
|
28382
|
-
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
28383
|
-
case "custom":
|
|
28384
|
-
return customOption ?? void 0;
|
|
28385
|
-
case "none":
|
|
28386
|
-
default:
|
|
28387
|
-
return void 0;
|
|
28388
|
-
}
|
|
28389
|
-
};
|
|
28390
|
-
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
28391
|
-
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
28392
|
-
useEffect20(() => {
|
|
28393
|
-
if (props.value !== void 0) {
|
|
28394
|
-
handleChange(props.value);
|
|
28395
|
-
}
|
|
28396
|
-
}, []);
|
|
28397
|
-
const handleChange = (e) => {
|
|
28398
|
-
props.onChange?.(e, props?.name || "");
|
|
28399
|
-
};
|
|
28400
|
-
const toDateInputValue = (value) => {
|
|
28401
|
-
if (!value) return "";
|
|
28402
|
-
return new Date(value).toISOString().split("T")[0];
|
|
28403
|
-
};
|
|
28404
|
-
return /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
28405
|
-
/* @__PURE__ */ jsx43("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx43(
|
|
28406
|
-
Input,
|
|
28407
|
-
{
|
|
28408
|
-
type: "date",
|
|
28409
|
-
id: "date",
|
|
28410
|
-
autoComplete: isAutocomplete ? "on" : "off",
|
|
28411
|
-
onChange: handleChange,
|
|
28412
|
-
disabled: isDisabled || !isEditable,
|
|
28413
|
-
name: props.name,
|
|
28414
|
-
value: toDateInputValue(props.value),
|
|
28415
|
-
className: cn(
|
|
28416
|
-
className,
|
|
28417
|
-
props.errorMessage ? "border-red-500" : "",
|
|
28418
|
-
"appearance-auto"
|
|
28419
|
-
),
|
|
28420
|
-
style: {
|
|
28421
|
-
...style,
|
|
28422
|
-
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
28423
|
-
},
|
|
28424
|
-
readOnly: isReadonly,
|
|
28425
|
-
placeholder,
|
|
28426
|
-
min: minDate,
|
|
28427
|
-
max: maxDate
|
|
28428
|
-
}
|
|
28429
|
-
) }),
|
|
28430
|
-
props.errorMessage && /* @__PURE__ */ jsx43("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28431
|
-
] });
|
|
28432
|
-
}
|
|
28433
|
-
|
|
28434
|
-
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28435
|
-
import React7, { useEffect as useEffect22 } from "react";
|
|
28436
|
-
import { addDays, format } from "date-fns";
|
|
28416
|
+
import * as React6 from "react";
|
|
28417
|
+
import { format } from "date-fns";
|
|
28437
28418
|
|
|
28438
28419
|
// src/components/ui/calendar.tsx
|
|
28439
|
-
import * as
|
|
28420
|
+
import * as React5 from "react";
|
|
28440
28421
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
28441
|
-
import { jsx as
|
|
28422
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
28442
28423
|
function Calendar2({
|
|
28443
28424
|
className,
|
|
28444
28425
|
classNames,
|
|
@@ -28450,7 +28431,7 @@ function Calendar2({
|
|
|
28450
28431
|
...props
|
|
28451
28432
|
}) {
|
|
28452
28433
|
const defaultClassNames = getDefaultClassNames();
|
|
28453
|
-
return /* @__PURE__ */
|
|
28434
|
+
return /* @__PURE__ */ jsx43(
|
|
28454
28435
|
DayPicker,
|
|
28455
28436
|
{
|
|
28456
28437
|
showOutsideDays,
|
|
@@ -28549,7 +28530,7 @@ function Calendar2({
|
|
|
28549
28530
|
},
|
|
28550
28531
|
components: {
|
|
28551
28532
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
28552
|
-
return /* @__PURE__ */
|
|
28533
|
+
return /* @__PURE__ */ jsx43(
|
|
28553
28534
|
"div",
|
|
28554
28535
|
{
|
|
28555
28536
|
"data-slot": "calendar",
|
|
@@ -28561,10 +28542,10 @@ function Calendar2({
|
|
|
28561
28542
|
},
|
|
28562
28543
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
28563
28544
|
if (orientation === "left") {
|
|
28564
|
-
return /* @__PURE__ */
|
|
28545
|
+
return /* @__PURE__ */ jsx43(ChevronLeft, { className: cn("size-4", className2), ...props2 });
|
|
28565
28546
|
}
|
|
28566
28547
|
if (orientation === "right") {
|
|
28567
|
-
return /* @__PURE__ */
|
|
28548
|
+
return /* @__PURE__ */ jsx43(
|
|
28568
28549
|
ChevronRight,
|
|
28569
28550
|
{
|
|
28570
28551
|
className: cn("size-4", className2),
|
|
@@ -28572,11 +28553,11 @@ function Calendar2({
|
|
|
28572
28553
|
}
|
|
28573
28554
|
);
|
|
28574
28555
|
}
|
|
28575
|
-
return /* @__PURE__ */
|
|
28556
|
+
return /* @__PURE__ */ jsx43(ChevronDown, { className: cn("size-4", className2), ...props2 });
|
|
28576
28557
|
},
|
|
28577
28558
|
DayButton: CalendarDayButton,
|
|
28578
28559
|
WeekNumber: ({ children, ...props2 }) => {
|
|
28579
|
-
return /* @__PURE__ */
|
|
28560
|
+
return /* @__PURE__ */ jsx43("td", { ...props2, children: /* @__PURE__ */ jsx43("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
28580
28561
|
},
|
|
28581
28562
|
...components
|
|
28582
28563
|
},
|
|
@@ -28591,11 +28572,11 @@ function CalendarDayButton({
|
|
|
28591
28572
|
...props
|
|
28592
28573
|
}) {
|
|
28593
28574
|
const defaultClassNames = getDefaultClassNames();
|
|
28594
|
-
const ref =
|
|
28595
|
-
|
|
28575
|
+
const ref = React5.useRef(null);
|
|
28576
|
+
React5.useEffect(() => {
|
|
28596
28577
|
if (modifiers.focused) ref.current?.focus();
|
|
28597
28578
|
}, [modifiers.focused]);
|
|
28598
|
-
return /* @__PURE__ */
|
|
28579
|
+
return /* @__PURE__ */ jsx43(
|
|
28599
28580
|
Button,
|
|
28600
28581
|
{
|
|
28601
28582
|
ref,
|
|
@@ -28618,16 +28599,16 @@ function CalendarDayButton({
|
|
|
28618
28599
|
|
|
28619
28600
|
// src/components/ui/popover.tsx
|
|
28620
28601
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
28621
|
-
import { jsx as
|
|
28602
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
28622
28603
|
function Popover({
|
|
28623
28604
|
...props
|
|
28624
28605
|
}) {
|
|
28625
|
-
return /* @__PURE__ */
|
|
28606
|
+
return /* @__PURE__ */ jsx44(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
28626
28607
|
}
|
|
28627
28608
|
function PopoverTrigger({
|
|
28628
28609
|
...props
|
|
28629
28610
|
}) {
|
|
28630
|
-
return /* @__PURE__ */
|
|
28611
|
+
return /* @__PURE__ */ jsx44(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
28631
28612
|
}
|
|
28632
28613
|
function PopoverContent({
|
|
28633
28614
|
className,
|
|
@@ -28635,7 +28616,7 @@ function PopoverContent({
|
|
|
28635
28616
|
sideOffset = 4,
|
|
28636
28617
|
...props
|
|
28637
28618
|
}) {
|
|
28638
|
-
return /* @__PURE__ */
|
|
28619
|
+
return /* @__PURE__ */ jsx44(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx44(
|
|
28639
28620
|
PopoverPrimitive.Content,
|
|
28640
28621
|
{
|
|
28641
28622
|
"data-slot": "popover-content",
|
|
@@ -28650,7 +28631,327 @@ function PopoverContent({
|
|
|
28650
28631
|
) });
|
|
28651
28632
|
}
|
|
28652
28633
|
|
|
28634
|
+
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
28635
|
+
import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
28636
|
+
function resolveDate(option, customOption) {
|
|
28637
|
+
if (!option) return void 0;
|
|
28638
|
+
switch (option) {
|
|
28639
|
+
case "today":
|
|
28640
|
+
return /* @__PURE__ */ new Date();
|
|
28641
|
+
case "custom":
|
|
28642
|
+
return customOption ? new Date(customOption) : void 0;
|
|
28643
|
+
case "none":
|
|
28644
|
+
default:
|
|
28645
|
+
return void 0;
|
|
28646
|
+
}
|
|
28647
|
+
}
|
|
28648
|
+
function DateTimePicker({
|
|
28649
|
+
className,
|
|
28650
|
+
style,
|
|
28651
|
+
mode = "date",
|
|
28652
|
+
...props
|
|
28653
|
+
}) {
|
|
28654
|
+
const placeholderMap = {
|
|
28655
|
+
date: "Select date",
|
|
28656
|
+
datetime: "Select date & time",
|
|
28657
|
+
time: "Select time"
|
|
28658
|
+
};
|
|
28659
|
+
const placeholder = props.placeholder ?? placeholderMap[mode];
|
|
28660
|
+
const minimumDate = props.minimumDate ?? "none";
|
|
28661
|
+
const customMinimumDate = props.customMinimumDate ?? "";
|
|
28662
|
+
const maximumDate = props.maximumDate ?? "none";
|
|
28663
|
+
const customMaximumDate = props.customMaximumDate ?? "";
|
|
28664
|
+
const isEditable = props.isEditable ?? true;
|
|
28665
|
+
const isDisabled = props.isDisabled ?? false;
|
|
28666
|
+
const isReadonly = props.isReadonly ?? false;
|
|
28667
|
+
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28668
|
+
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
28669
|
+
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
28670
|
+
const [date, setDate] = React6.useState(() => {
|
|
28671
|
+
if (!props.value) return void 0;
|
|
28672
|
+
const d = new Date(props.value);
|
|
28673
|
+
return isNaN(d.getTime()) ? void 0 : d;
|
|
28674
|
+
});
|
|
28675
|
+
const initialHours = date ? date.getHours() : 0;
|
|
28676
|
+
const initialMinutes = date ? date.getMinutes() : 0;
|
|
28677
|
+
const [hours, setHours] = React6.useState(initialHours);
|
|
28678
|
+
const [minutes, setMinutes] = React6.useState(initialMinutes);
|
|
28679
|
+
const [amPm, setAmPm] = React6.useState("AM");
|
|
28680
|
+
const displayHours = React6.useMemo(() => {
|
|
28681
|
+
if (hours === 0) return 12;
|
|
28682
|
+
if (hours > 12) return hours - 12;
|
|
28683
|
+
return hours;
|
|
28684
|
+
}, [hours]);
|
|
28685
|
+
React6.useEffect(() => {
|
|
28686
|
+
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
28687
|
+
}, [hours]);
|
|
28688
|
+
React6.useEffect(() => {
|
|
28689
|
+
if (!props.value) {
|
|
28690
|
+
setDate(void 0);
|
|
28691
|
+
return;
|
|
28692
|
+
}
|
|
28693
|
+
const d = new Date(props.value);
|
|
28694
|
+
if (!isNaN(d.getTime())) {
|
|
28695
|
+
setDate(d);
|
|
28696
|
+
setHours(d.getHours());
|
|
28697
|
+
setMinutes(d.getMinutes());
|
|
28698
|
+
}
|
|
28699
|
+
}, [props.value]);
|
|
28700
|
+
const [year, setYear] = React6.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
28701
|
+
React6.useEffect(() => {
|
|
28702
|
+
if (!date) return;
|
|
28703
|
+
const newDate = new Date(date);
|
|
28704
|
+
newDate.setFullYear(year);
|
|
28705
|
+
setDate(newDate);
|
|
28706
|
+
emitChange(newDate);
|
|
28707
|
+
}, [year]);
|
|
28708
|
+
const emitChange = (nextDate) => {
|
|
28709
|
+
if (!props.onChange) return;
|
|
28710
|
+
let valueString = "";
|
|
28711
|
+
if (!nextDate) {
|
|
28712
|
+
valueString = "";
|
|
28713
|
+
} else if (mode === "date") {
|
|
28714
|
+
valueString = format(nextDate, "yyyy-MM-dd");
|
|
28715
|
+
} else if (mode === "time") {
|
|
28716
|
+
valueString = format(nextDate, "HH:mm:ss");
|
|
28717
|
+
} else {
|
|
28718
|
+
valueString = nextDate.toISOString();
|
|
28719
|
+
}
|
|
28720
|
+
const target = {
|
|
28721
|
+
name: props.name || "",
|
|
28722
|
+
value: valueString
|
|
28723
|
+
};
|
|
28724
|
+
const event = {
|
|
28725
|
+
target
|
|
28726
|
+
};
|
|
28727
|
+
props.onChange(event, props.name || "");
|
|
28728
|
+
};
|
|
28729
|
+
const updateDateTime = (nextBaseDate, h = hours, m = minutes) => {
|
|
28730
|
+
if (!nextBaseDate) {
|
|
28731
|
+
setDate(void 0);
|
|
28732
|
+
emitChange(void 0);
|
|
28733
|
+
return;
|
|
28734
|
+
}
|
|
28735
|
+
const d = new Date(nextBaseDate);
|
|
28736
|
+
if (mode !== "date") {
|
|
28737
|
+
d.setHours(h);
|
|
28738
|
+
d.setMinutes(m);
|
|
28739
|
+
d.setSeconds(0);
|
|
28740
|
+
d.setMilliseconds(0);
|
|
28741
|
+
} else {
|
|
28742
|
+
d.setHours(0, 0, 0, 0);
|
|
28743
|
+
}
|
|
28744
|
+
if (minDate && d < minDate) return;
|
|
28745
|
+
if (maxDate && d > maxDate) return;
|
|
28746
|
+
setDate(d);
|
|
28747
|
+
setYear(d.getFullYear());
|
|
28748
|
+
emitChange(d);
|
|
28749
|
+
};
|
|
28750
|
+
const handleDaySelect = (next) => {
|
|
28751
|
+
if (!next) {
|
|
28752
|
+
setDate(void 0);
|
|
28753
|
+
emitChange(void 0);
|
|
28754
|
+
return;
|
|
28755
|
+
}
|
|
28756
|
+
const clickedDate = new Date(next);
|
|
28757
|
+
const selectedYearDate = new Date(year, clickedDate.getMonth(), clickedDate.getDate());
|
|
28758
|
+
updateDateTime(selectedYearDate);
|
|
28759
|
+
};
|
|
28760
|
+
const updateTimeInDate = (h, m) => {
|
|
28761
|
+
if (!date) {
|
|
28762
|
+
const fallbackDate = /* @__PURE__ */ new Date();
|
|
28763
|
+
fallbackDate.setHours(h);
|
|
28764
|
+
fallbackDate.setMinutes(m);
|
|
28765
|
+
fallbackDate.setSeconds(0);
|
|
28766
|
+
fallbackDate.setMilliseconds(0);
|
|
28767
|
+
setDate(fallbackDate);
|
|
28768
|
+
emitChange(fallbackDate);
|
|
28769
|
+
} else {
|
|
28770
|
+
const newDate = new Date(date);
|
|
28771
|
+
newDate.setHours(h);
|
|
28772
|
+
newDate.setMinutes(m);
|
|
28773
|
+
newDate.setSeconds(0);
|
|
28774
|
+
newDate.setMilliseconds(0);
|
|
28775
|
+
setDate(newDate);
|
|
28776
|
+
emitChange(newDate);
|
|
28777
|
+
}
|
|
28778
|
+
};
|
|
28779
|
+
const handleHoursChange = (e) => {
|
|
28780
|
+
let h = Number(e.target.value);
|
|
28781
|
+
if (amPm === "PM" && h < 12) h += 12;
|
|
28782
|
+
if (amPm === "AM" && h === 12) h = 0;
|
|
28783
|
+
setHours(h);
|
|
28784
|
+
updateTimeInDate(h, minutes);
|
|
28785
|
+
};
|
|
28786
|
+
const handleMinutesChange = (e) => {
|
|
28787
|
+
const m = Number(e.target.value);
|
|
28788
|
+
setMinutes(m);
|
|
28789
|
+
updateTimeInDate(hours, m);
|
|
28790
|
+
};
|
|
28791
|
+
const handleAmPmChange = (e) => {
|
|
28792
|
+
const val = e.target.value;
|
|
28793
|
+
setAmPm(val);
|
|
28794
|
+
let h = displayHours;
|
|
28795
|
+
if (val === "PM" && h < 12) h += 12;
|
|
28796
|
+
if (val === "AM" && h === 12) h = 0;
|
|
28797
|
+
setHours(h);
|
|
28798
|
+
updateTimeInDate(h, minutes);
|
|
28799
|
+
};
|
|
28800
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
28801
|
+
const yearOptions = [];
|
|
28802
|
+
for (let y = currentYear - 50; y <= currentYear + 10; y++) {
|
|
28803
|
+
yearOptions.push(y);
|
|
28804
|
+
}
|
|
28805
|
+
const displayValue = React6.useMemo(() => {
|
|
28806
|
+
if (!date) return "";
|
|
28807
|
+
try {
|
|
28808
|
+
if (mode === "date") return format(date, "yyyy-MM-dd");
|
|
28809
|
+
if (mode === "time") return format(date, "hh:mm aa");
|
|
28810
|
+
return format(date, "yyyy-MM-dd hh:mm aa");
|
|
28811
|
+
} catch {
|
|
28812
|
+
return "";
|
|
28813
|
+
}
|
|
28814
|
+
}, [date, mode]);
|
|
28815
|
+
const isInputDisabled = isDisabled || !isEditable;
|
|
28816
|
+
const [calendarMonthState, setCalendarMonthState] = React6.useState(() => {
|
|
28817
|
+
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
28818
|
+
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
28819
|
+
});
|
|
28820
|
+
React6.useEffect(() => {
|
|
28821
|
+
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
28822
|
+
}, [year]);
|
|
28823
|
+
const handleToday = () => {
|
|
28824
|
+
const today = /* @__PURE__ */ new Date();
|
|
28825
|
+
const selectedYearDate = new Date(year, today.getMonth(), today.getDate());
|
|
28826
|
+
updateDateTime(selectedYearDate);
|
|
28827
|
+
};
|
|
28828
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col", children: [
|
|
28829
|
+
/* @__PURE__ */ jsxs24(Popover, { children: [
|
|
28830
|
+
/* @__PURE__ */ jsx45(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs24(
|
|
28831
|
+
Button,
|
|
28832
|
+
{
|
|
28833
|
+
type: "button",
|
|
28834
|
+
variant: "outline",
|
|
28835
|
+
className: cn(
|
|
28836
|
+
"w-full justify-start text-left font-normal",
|
|
28837
|
+
!date && "text-muted-foreground",
|
|
28838
|
+
props.errorMessage && "border-red-500",
|
|
28839
|
+
className
|
|
28840
|
+
),
|
|
28841
|
+
style: {
|
|
28842
|
+
...style,
|
|
28843
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
28844
|
+
},
|
|
28845
|
+
disabled: isInputDisabled,
|
|
28846
|
+
children: [
|
|
28847
|
+
displayValue || placeholder,
|
|
28848
|
+
/* @__PURE__ */ jsx45(Calendar1, { className: "absolute right-2 top-2" })
|
|
28849
|
+
]
|
|
28850
|
+
}
|
|
28851
|
+
) }),
|
|
28852
|
+
/* @__PURE__ */ jsx45(PopoverContent, { className: "w-auto text-sm p-2", align: "start", children: /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
|
|
28853
|
+
(mode === "date" || mode === "datetime") && /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
28854
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-1", children: [
|
|
28855
|
+
/* @__PURE__ */ jsx45(
|
|
28856
|
+
"label",
|
|
28857
|
+
{
|
|
28858
|
+
className: "text-xs text-blue-600 font-bold cursor-pointer",
|
|
28859
|
+
role: "presentation",
|
|
28860
|
+
onClick: handleToday,
|
|
28861
|
+
children: "Today"
|
|
28862
|
+
}
|
|
28863
|
+
),
|
|
28864
|
+
/* @__PURE__ */ jsx45(
|
|
28865
|
+
"select",
|
|
28866
|
+
{
|
|
28867
|
+
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
28868
|
+
value: year,
|
|
28869
|
+
onChange: (e) => setYear(Number(e.target.value)),
|
|
28870
|
+
disabled: isInputDisabled || isReadonly,
|
|
28871
|
+
children: yearOptions.map((y) => /* @__PURE__ */ jsx45("option", { value: y, children: y }, y))
|
|
28872
|
+
}
|
|
28873
|
+
)
|
|
28874
|
+
] }),
|
|
28875
|
+
/* @__PURE__ */ jsx45("div", { className: "calendar-container", children: /* @__PURE__ */ jsx45(
|
|
28876
|
+
Calendar2,
|
|
28877
|
+
{
|
|
28878
|
+
mode: "single",
|
|
28879
|
+
selected: date,
|
|
28880
|
+
onSelect: handleDaySelect,
|
|
28881
|
+
month: calendarMonthState,
|
|
28882
|
+
onMonthChange: (newMonth) => setCalendarMonthState(newMonth),
|
|
28883
|
+
disabled: (d) => {
|
|
28884
|
+
if (minDate && d < minDate) return true;
|
|
28885
|
+
if (maxDate && d > maxDate) return true;
|
|
28886
|
+
return false;
|
|
28887
|
+
},
|
|
28888
|
+
className: "p-[10px]",
|
|
28889
|
+
autoFocus: true
|
|
28890
|
+
}
|
|
28891
|
+
) })
|
|
28892
|
+
] }),
|
|
28893
|
+
(mode === "time" || mode === "datetime") && /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 mt-0", children: [
|
|
28894
|
+
/* @__PURE__ */ jsx45("label", { className: "text-xs text-muted-foreground", children: "Time" }),
|
|
28895
|
+
/* @__PURE__ */ jsx45(
|
|
28896
|
+
"select",
|
|
28897
|
+
{
|
|
28898
|
+
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
28899
|
+
value: displayHours,
|
|
28900
|
+
onChange: handleHoursChange,
|
|
28901
|
+
disabled: isInputDisabled || isReadonly,
|
|
28902
|
+
children: Array.from({ length: 12 }, (_, i) => i + 1).map((hour) => /* @__PURE__ */ jsx45("option", { value: hour, children: hour.toString().padStart(2, "0") }, hour))
|
|
28903
|
+
}
|
|
28904
|
+
),
|
|
28905
|
+
/* @__PURE__ */ jsx45("span", { className: "text-sm", children: ":" }),
|
|
28906
|
+
/* @__PURE__ */ jsx45(
|
|
28907
|
+
"select",
|
|
28908
|
+
{
|
|
28909
|
+
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
28910
|
+
value: minutes,
|
|
28911
|
+
onChange: handleMinutesChange,
|
|
28912
|
+
disabled: isInputDisabled || isReadonly,
|
|
28913
|
+
children: Array.from({ length: 12 }).map((_, i) => {
|
|
28914
|
+
const val = i * 5;
|
|
28915
|
+
return /* @__PURE__ */ jsx45("option", { value: val, children: val.toString().padStart(2, "0") }, val);
|
|
28916
|
+
})
|
|
28917
|
+
}
|
|
28918
|
+
),
|
|
28919
|
+
/* @__PURE__ */ jsxs24(
|
|
28920
|
+
"select",
|
|
28921
|
+
{
|
|
28922
|
+
className: "h-8 rounded border bg-background px-2 text-xs",
|
|
28923
|
+
value: amPm,
|
|
28924
|
+
onChange: handleAmPmChange,
|
|
28925
|
+
disabled: isInputDisabled || isReadonly,
|
|
28926
|
+
children: [
|
|
28927
|
+
/* @__PURE__ */ jsx45("option", { value: "AM", children: "AM" }),
|
|
28928
|
+
/* @__PURE__ */ jsx45("option", { value: "PM", children: "PM" })
|
|
28929
|
+
]
|
|
28930
|
+
}
|
|
28931
|
+
)
|
|
28932
|
+
] })
|
|
28933
|
+
] }) })
|
|
28934
|
+
] }),
|
|
28935
|
+
/* @__PURE__ */ jsx45(
|
|
28936
|
+
Input,
|
|
28937
|
+
{
|
|
28938
|
+
type: "hidden",
|
|
28939
|
+
id: props.name,
|
|
28940
|
+
name: props.name,
|
|
28941
|
+
autoComplete: isAutocomplete ? "on" : "off",
|
|
28942
|
+
readOnly: isReadonly,
|
|
28943
|
+
value: !date ? "" : mode === "date" ? format(date, "yyyy-MM-dd") : mode === "time" ? format(date, "HH:mm:ss") : date.toISOString(),
|
|
28944
|
+
onChange: () => {
|
|
28945
|
+
}
|
|
28946
|
+
}
|
|
28947
|
+
),
|
|
28948
|
+
props.errorMessage && /* @__PURE__ */ jsx45("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28949
|
+
] });
|
|
28950
|
+
}
|
|
28951
|
+
|
|
28653
28952
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28953
|
+
import React7, { useEffect as useEffect22 } from "react";
|
|
28954
|
+
import { addDays, format as format2 } from "date-fns";
|
|
28654
28955
|
import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
28655
28956
|
var DateRange = ({ className, style, ...props }) => {
|
|
28656
28957
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
@@ -28683,11 +28984,11 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28683
28984
|
!date && "text-muted-foreground"
|
|
28684
28985
|
),
|
|
28685
28986
|
children: date?.from ? date.to ? /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
28686
|
-
|
|
28987
|
+
format2(date.from, "LLL dd, y"),
|
|
28687
28988
|
" -",
|
|
28688
28989
|
" ",
|
|
28689
|
-
|
|
28690
|
-
] }) :
|
|
28990
|
+
format2(date.to, "LLL dd, y")
|
|
28991
|
+
] }) : format2(date.from, "LLL dd, y") : /* @__PURE__ */ jsx46("span", { children: "Pick a date range" })
|
|
28691
28992
|
}
|
|
28692
28993
|
) }),
|
|
28693
28994
|
/* @__PURE__ */ jsx46(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx46(
|
|
@@ -28768,7 +29069,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28768
29069
|
var TextInputGroup_default = TextInputGroup;
|
|
28769
29070
|
|
|
28770
29071
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
28771
|
-
import { useState as
|
|
29072
|
+
import { useState as useState7, useRef as useRef6, useEffect as useEffect24, useMemo as useMemo5 } from "react";
|
|
28772
29073
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
28773
29074
|
function LazyMultiSelectDropdown({
|
|
28774
29075
|
options = [],
|
|
@@ -28788,8 +29089,8 @@ function LazyMultiSelectDropdown({
|
|
|
28788
29089
|
axiosInstance,
|
|
28789
29090
|
outputFormat = "array"
|
|
28790
29091
|
}) {
|
|
28791
|
-
const [isOpen, setIsOpen] =
|
|
28792
|
-
const [searchTerm, setSearchTerm] =
|
|
29092
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
29093
|
+
const [searchTerm, setSearchTerm] = useState7("");
|
|
28793
29094
|
const dropdownRef = useRef6(null);
|
|
28794
29095
|
const observerTarget = useRef6(null);
|
|
28795
29096
|
const ensureUnique = (arr) => {
|
|
@@ -28839,7 +29140,7 @@ function LazyMultiSelectDropdown({
|
|
|
28839
29140
|
return unique;
|
|
28840
29141
|
}
|
|
28841
29142
|
};
|
|
28842
|
-
const selectedOptions =
|
|
29143
|
+
const selectedOptions = useMemo5(() => {
|
|
28843
29144
|
return lazyOptions.filter((opt) => normalizedValue.includes(opt.value));
|
|
28844
29145
|
}, [lazyOptions, normalizedValue]);
|
|
28845
29146
|
useEffect24(() => {
|
|
@@ -29089,14 +29390,14 @@ dayjs.extend(utc);
|
|
|
29089
29390
|
var dayjs_setup_default = dayjs;
|
|
29090
29391
|
|
|
29091
29392
|
// src/lib/table/valueFormatter.ts
|
|
29092
|
-
var valueFormatter = (value,
|
|
29093
|
-
if (!
|
|
29393
|
+
var valueFormatter = (value, format3, customFormatters = {}) => {
|
|
29394
|
+
if (!format3) return value;
|
|
29094
29395
|
if (value == null || value === "" || value === void 0) return "-";
|
|
29095
|
-
if (
|
|
29096
|
-
const key =
|
|
29396
|
+
if (format3.startsWith("custom:")) {
|
|
29397
|
+
const key = format3.replace("custom:", "");
|
|
29097
29398
|
return customFormatters[key] ? customFormatters[key](value) : value;
|
|
29098
29399
|
}
|
|
29099
|
-
const [type, arg] =
|
|
29400
|
+
const [type, arg] = format3.split(":");
|
|
29100
29401
|
switch (type) {
|
|
29101
29402
|
case "date":
|
|
29102
29403
|
return dayjs_setup_default(value).format(arg || "YYYY-MM-DD");
|
|
@@ -29179,8 +29480,8 @@ var sanitizeValue = (val) => {
|
|
|
29179
29480
|
}
|
|
29180
29481
|
return String(val);
|
|
29181
29482
|
};
|
|
29182
|
-
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {},
|
|
29183
|
-
const formattedValue = valueFormatter(value,
|
|
29483
|
+
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format3, customFormatters = {}) => {
|
|
29484
|
+
const formattedValue = valueFormatter(value, format3, customFormatters);
|
|
29184
29485
|
const rowValue = row?.[rendererProps?.rowField];
|
|
29185
29486
|
switch (renderer) {
|
|
29186
29487
|
/* -------------------- BASIC -------------------- */
|
|
@@ -29189,7 +29490,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
29189
29490
|
case "number":
|
|
29190
29491
|
return /* @__PURE__ */ jsx50("span", { className: "tabular-nums text-right", children: valueFormatter(rowValue || value, "number:2") });
|
|
29191
29492
|
case "date":
|
|
29192
|
-
return /* @__PURE__ */ jsx50("span", { children: valueFormatter(rowValue || value,
|
|
29493
|
+
return /* @__PURE__ */ jsx50("span", { children: valueFormatter(rowValue || value, format3) });
|
|
29193
29494
|
case "link":
|
|
29194
29495
|
return /* @__PURE__ */ jsx50(
|
|
29195
29496
|
"a",
|
|
@@ -30002,7 +30303,7 @@ var CustomPagination = ({
|
|
|
30002
30303
|
var Pagination_default = CustomPagination;
|
|
30003
30304
|
|
|
30004
30305
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
30005
|
-
import { useCallback as useCallback3, useMemo as
|
|
30306
|
+
import { useCallback as useCallback3, useMemo as useMemo7, useState as useState9 } from "react";
|
|
30006
30307
|
import Link5 from "next/link";
|
|
30007
30308
|
import { usePathname, useRouter } from "next/navigation";
|
|
30008
30309
|
|
|
@@ -30160,7 +30461,7 @@ function showSonnerToast({
|
|
|
30160
30461
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
30161
30462
|
import { Fragment as Fragment22, jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
30162
30463
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
30163
|
-
const [openIndex, setOpenIndex] =
|
|
30464
|
+
const [openIndex, setOpenIndex] = useState9(null);
|
|
30164
30465
|
const currentPathname = usePathname();
|
|
30165
30466
|
function groupMenus(menus = []) {
|
|
30166
30467
|
const menuMap = /* @__PURE__ */ new Map();
|
|
@@ -30194,7 +30495,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30194
30495
|
});
|
|
30195
30496
|
return sortMenus(rootMenus);
|
|
30196
30497
|
}
|
|
30197
|
-
const rawTabs =
|
|
30498
|
+
const rawTabs = useMemo7(() => {
|
|
30198
30499
|
if (!Array.isArray(tabs)) return [];
|
|
30199
30500
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
30200
30501
|
return groupMenus(tabs);
|
|
@@ -30224,8 +30525,8 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30224
30525
|
return tab.children.some((child) => isActive(child.url));
|
|
30225
30526
|
};
|
|
30226
30527
|
const router = useRouter();
|
|
30227
|
-
const [showExitDialog, setShowExitDialog] =
|
|
30228
|
-
const [pendingUrl, setPendingUrl] =
|
|
30528
|
+
const [showExitDialog, setShowExitDialog] = useState9(false);
|
|
30529
|
+
const [pendingUrl, setPendingUrl] = useState9(null);
|
|
30229
30530
|
const handleBuilderExit = useCallback3(
|
|
30230
30531
|
(e, url) => {
|
|
30231
30532
|
if (isBuilder) {
|
|
@@ -30393,11 +30694,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30393
30694
|
var Tabs_default = Tabs;
|
|
30394
30695
|
|
|
30395
30696
|
// src/components/Navigation/Stages/Stages.tsx
|
|
30396
|
-
import React10, { useState as
|
|
30697
|
+
import React10, { useState as useState10 } from "react";
|
|
30397
30698
|
import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
30398
30699
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header", loading, saving, triggerOnClick = false }) => {
|
|
30399
|
-
const [activeStage, setActiveStage] =
|
|
30400
|
-
const [isCompleted, setIsCompleted] =
|
|
30700
|
+
const [activeStage, setActiveStage] = useState10(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
|
|
30701
|
+
const [isCompleted, setIsCompleted] = useState10(false);
|
|
30401
30702
|
const updateStage = (stageKey) => {
|
|
30402
30703
|
setActiveStage(stageKey);
|
|
30403
30704
|
onStageChange?.(stageKey);
|
|
@@ -30533,7 +30834,7 @@ import Link6 from "next/link";
|
|
|
30533
30834
|
import Image4 from "next/image";
|
|
30534
30835
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
30535
30836
|
import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
|
|
30536
|
-
import { useCallback as useCallback4, useMemo as
|
|
30837
|
+
import { useCallback as useCallback4, useMemo as useMemo8, useState as useState11 } from "react";
|
|
30537
30838
|
import { Fragment as Fragment23, jsx as jsx63, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
30538
30839
|
function Navbar({
|
|
30539
30840
|
style,
|
|
@@ -30554,8 +30855,8 @@ function Navbar({
|
|
|
30554
30855
|
}) {
|
|
30555
30856
|
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
30556
30857
|
const router = useRouter2();
|
|
30557
|
-
const [showExitDialog, setShowExitDialog] =
|
|
30558
|
-
const [pendingUrl, setPendingUrl] =
|
|
30858
|
+
const [showExitDialog, setShowExitDialog] = useState11(false);
|
|
30859
|
+
const [pendingUrl, setPendingUrl] = useState11(null);
|
|
30559
30860
|
const handleBuilderExit = useCallback4(
|
|
30560
30861
|
(e, url) => {
|
|
30561
30862
|
if (isBuilder) {
|
|
@@ -30572,7 +30873,7 @@ function Navbar({
|
|
|
30572
30873
|
router.push(pendingUrl);
|
|
30573
30874
|
}
|
|
30574
30875
|
};
|
|
30575
|
-
const formatedMenu =
|
|
30876
|
+
const formatedMenu = useMemo8(() => {
|
|
30576
30877
|
if (source === "state" && navList && navList.length) {
|
|
30577
30878
|
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
30578
30879
|
}
|
|
@@ -30750,7 +31051,7 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
30750
31051
|
var BarChart_default = React12.memo(ChartComponent);
|
|
30751
31052
|
|
|
30752
31053
|
// src/components/Chart/PieChart.tsx
|
|
30753
|
-
import React13, { useEffect as useEffect25, useMemo as
|
|
31054
|
+
import React13, { useEffect as useEffect25, useMemo as useMemo9, useState as useState12 } from "react";
|
|
30754
31055
|
import {
|
|
30755
31056
|
PieChart,
|
|
30756
31057
|
Pie,
|
|
@@ -30779,18 +31080,18 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
30779
31080
|
const showLegends = props.showLegends ?? true;
|
|
30780
31081
|
const labelType = props.labelType || "inside";
|
|
30781
31082
|
const canvasMode = props.canvasMode;
|
|
30782
|
-
const data =
|
|
31083
|
+
const data = useMemo9(() => {
|
|
30783
31084
|
if (!Array.isArray(props.data)) return [];
|
|
30784
31085
|
return props.data.map((item) => ({ ...item, color: getRandomColor() }));
|
|
30785
31086
|
}, [props.data]);
|
|
30786
|
-
const total =
|
|
31087
|
+
const total = useMemo9(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
|
|
30787
31088
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
30788
|
-
const [mounted, setMounted] =
|
|
31089
|
+
const [mounted, setMounted] = useState12(false);
|
|
30789
31090
|
useEffect25(() => {
|
|
30790
31091
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
30791
31092
|
return () => clearTimeout(timeout);
|
|
30792
31093
|
}, []);
|
|
30793
|
-
const renderLegends =
|
|
31094
|
+
const renderLegends = useMemo9(() => {
|
|
30794
31095
|
if (!showLegends) return null;
|
|
30795
31096
|
return /* @__PURE__ */ jsx65(Fragment24, { children: data.map((d) => /* @__PURE__ */ jsxs39(
|
|
30796
31097
|
"div",
|
|
@@ -30990,7 +31291,7 @@ export {
|
|
|
30990
31291
|
SplitButton as ButtonGroup,
|
|
30991
31292
|
Checkbox_default as Checkbox,
|
|
30992
31293
|
Container_default as Container,
|
|
30993
|
-
DatePicker,
|
|
31294
|
+
DateTimePicker as DatePicker,
|
|
30994
31295
|
DateRange_default as DateRange,
|
|
30995
31296
|
Dropdown_default as Dropdown,
|
|
30996
31297
|
EmailInput_default as Email,
|