@algorithm-shift/design-system 1.3.105 → 1.3.107
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.css +31 -19
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +45 -4
- package/dist/index.d.ts +45 -4
- package/dist/index.js +375 -202
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +272 -99
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -577,7 +577,8 @@ var Breadcrumb = ({ list = [], className, style }) => {
|
|
|
577
577
|
var Breadcrumb_default = Breadcrumb;
|
|
578
578
|
|
|
579
579
|
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
580
|
-
import {
|
|
580
|
+
import { useMemo as useMemo2 } from "react";
|
|
581
|
+
import { ChevronDown, MoreVertical, Loader2 } from "lucide-react";
|
|
581
582
|
import Link2 from "next/link";
|
|
582
583
|
|
|
583
584
|
// src/components/ui/dropdown-menu.tsx
|
|
@@ -698,50 +699,222 @@ function DropdownMenuSubContent({
|
|
|
698
699
|
|
|
699
700
|
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
700
701
|
import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
702
|
+
var ButtonGroup = ({
|
|
703
|
+
textContent,
|
|
704
|
+
// Dropdown items
|
|
705
|
+
data = [],
|
|
706
|
+
dataKey = "id",
|
|
707
|
+
dataLabel = "name",
|
|
708
|
+
// Styling
|
|
709
|
+
className,
|
|
710
|
+
style,
|
|
711
|
+
variant = "default",
|
|
712
|
+
buttonSize = "default",
|
|
713
|
+
buttonVariant,
|
|
714
|
+
dropdownVariant,
|
|
715
|
+
// Layout
|
|
716
|
+
orientation = "horizontal",
|
|
717
|
+
showDropdownIcon = true,
|
|
718
|
+
dropdownIcon,
|
|
719
|
+
alignDropdown = "end",
|
|
720
|
+
// Behavior
|
|
721
|
+
onItemSelect,
|
|
722
|
+
onClick,
|
|
723
|
+
// Advanced
|
|
724
|
+
disabled = false,
|
|
725
|
+
loading = false,
|
|
726
|
+
emptyStateText = "No items available",
|
|
727
|
+
maxItems,
|
|
728
|
+
showSeparator = false,
|
|
729
|
+
...restProps
|
|
730
|
+
}) => {
|
|
731
|
+
const dataSource = useMemo2(() => {
|
|
732
|
+
if (data) {
|
|
733
|
+
if (Array.isArray(data)) {
|
|
734
|
+
return data.length > 0 ? data : [];
|
|
735
|
+
}
|
|
736
|
+
return [data];
|
|
737
|
+
}
|
|
738
|
+
return [];
|
|
739
|
+
}, [data]);
|
|
740
|
+
const formattedItems = useMemo2(() => {
|
|
741
|
+
if (!dataSource.length) return [];
|
|
742
|
+
return dataSource.map((item, index) => {
|
|
743
|
+
if (typeof item === "string") {
|
|
744
|
+
return {
|
|
745
|
+
id: index,
|
|
746
|
+
value: item,
|
|
747
|
+
label: item,
|
|
748
|
+
name: item
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
const value = item[dataKey] ?? item.id ?? item.value ?? index;
|
|
752
|
+
const label = item[dataLabel] ?? item.label ?? item.name ?? String(value);
|
|
753
|
+
const url = item.url ?? item.href;
|
|
754
|
+
return {
|
|
755
|
+
...item,
|
|
756
|
+
id: item.id ?? value,
|
|
757
|
+
value,
|
|
758
|
+
label,
|
|
759
|
+
name: label,
|
|
760
|
+
url
|
|
761
|
+
};
|
|
762
|
+
});
|
|
763
|
+
}, [dataSource, dataKey, dataLabel]);
|
|
764
|
+
const displayItems = useMemo2(() => {
|
|
765
|
+
if (maxItems && maxItems > 0) {
|
|
766
|
+
return formattedItems.slice(0, maxItems);
|
|
767
|
+
}
|
|
768
|
+
return formattedItems;
|
|
769
|
+
}, [formattedItems, maxItems]);
|
|
770
|
+
const buttonText = textContent || "Button";
|
|
771
|
+
const mainButtonVariant = buttonVariant ?? variant;
|
|
772
|
+
const dropdownButtonVariant = dropdownVariant ?? variant;
|
|
773
|
+
const handleMainButtonClick = (e) => {
|
|
774
|
+
if (disabled || loading) return;
|
|
775
|
+
onClick?.(e);
|
|
776
|
+
};
|
|
777
|
+
const handleItemClick = (item, index) => {
|
|
778
|
+
if (item.disabled) return;
|
|
779
|
+
if (item.onClick) {
|
|
780
|
+
item.onClick();
|
|
781
|
+
}
|
|
782
|
+
onItemSelect?.({
|
|
783
|
+
item,
|
|
784
|
+
index
|
|
785
|
+
});
|
|
786
|
+
};
|
|
787
|
+
const renderDropdownIcon = () => {
|
|
788
|
+
if (!showDropdownIcon) return null;
|
|
789
|
+
if (dropdownIcon) {
|
|
790
|
+
return dropdownIcon;
|
|
791
|
+
}
|
|
792
|
+
return orientation === "horizontal" ? /* @__PURE__ */ jsx17(ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx17(MoreVertical, { className: "w-4 h-4" });
|
|
793
|
+
};
|
|
794
|
+
const containerClasses = cn(
|
|
795
|
+
"inline-flex items-center",
|
|
796
|
+
orientation === "horizontal" ? "flex-row" : "flex-col h-full",
|
|
797
|
+
"rounded-md overflow-hidden",
|
|
798
|
+
"border border-border",
|
|
799
|
+
"bg-background",
|
|
800
|
+
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
801
|
+
className,
|
|
802
|
+
"p-0"
|
|
803
|
+
);
|
|
804
|
+
const mainButtonClasses = cn(
|
|
805
|
+
className,
|
|
806
|
+
orientation === "horizontal" ? "rounded-none border-l-0 border-t-0 border-b-0 border-r last:border-r-0" : "rounded-none border-t-0 border-l-0 border-r-0 last:border-b-0",
|
|
807
|
+
"focus:ring-0 focus-visible:ring-0"
|
|
808
|
+
);
|
|
809
|
+
const dropdownButtonClasses = cn(
|
|
810
|
+
"rounded-none",
|
|
811
|
+
"focus:ring-0 focus-visible:ring-0",
|
|
812
|
+
"shadow-none"
|
|
813
|
+
);
|
|
814
|
+
if (!displayItems.length) {
|
|
815
|
+
return /* @__PURE__ */ jsx17("div", { className: containerClasses, style, children: /* @__PURE__ */ jsx17(
|
|
706
816
|
Button,
|
|
707
817
|
{
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
818
|
+
variant: mainButtonVariant,
|
|
819
|
+
size: buttonSize,
|
|
820
|
+
className: mainButtonClasses,
|
|
821
|
+
onClick: handleMainButtonClick,
|
|
822
|
+
disabled: disabled || loading,
|
|
823
|
+
style,
|
|
824
|
+
children: loading ? /* @__PURE__ */ jsxs7("span", { className: "flex items-center gap-2", children: [
|
|
825
|
+
/* @__PURE__ */ jsx17(Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
826
|
+
buttonText
|
|
827
|
+
] }) : buttonText
|
|
712
828
|
}
|
|
713
|
-
)
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
829
|
+
) });
|
|
830
|
+
}
|
|
831
|
+
return /* @__PURE__ */ jsxs7(
|
|
832
|
+
"div",
|
|
833
|
+
{
|
|
834
|
+
className: containerClasses,
|
|
835
|
+
style,
|
|
836
|
+
...restProps,
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ jsx17(
|
|
839
|
+
Button,
|
|
840
|
+
{
|
|
841
|
+
variant: mainButtonVariant,
|
|
842
|
+
size: buttonSize,
|
|
843
|
+
className: mainButtonClasses,
|
|
844
|
+
onClick: handleMainButtonClick,
|
|
845
|
+
disabled: disabled || loading,
|
|
846
|
+
style,
|
|
847
|
+
children: loading ? /* @__PURE__ */ jsxs7("span", { className: "flex items-center gap-2", children: [
|
|
848
|
+
/* @__PURE__ */ jsx17("span", { className: "animate-spin", children: "\u23F3" }),
|
|
849
|
+
buttonText
|
|
850
|
+
] }) : buttonText
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
/* @__PURE__ */ jsxs7(DropdownMenu, { children: [
|
|
854
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx17(
|
|
855
|
+
Button,
|
|
731
856
|
{
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
))
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
857
|
+
variant: dropdownButtonVariant,
|
|
858
|
+
size: buttonSize,
|
|
859
|
+
className: dropdownButtonClasses,
|
|
860
|
+
disabled: disabled || loading,
|
|
861
|
+
"aria-label": "Open dropdown menu",
|
|
862
|
+
children: renderDropdownIcon()
|
|
863
|
+
}
|
|
864
|
+
) }),
|
|
865
|
+
/* @__PURE__ */ jsxs7(
|
|
866
|
+
DropdownMenuContent,
|
|
867
|
+
{
|
|
868
|
+
align: alignDropdown,
|
|
869
|
+
className: "min-w-[120px] max-h-[300px] overflow-y-auto",
|
|
870
|
+
children: [
|
|
871
|
+
displayItems.map((item, index) => {
|
|
872
|
+
if (item.separator || showSeparator && index > 0 && index % 3 === 0) {
|
|
873
|
+
return /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}, `separator-${index}`);
|
|
874
|
+
}
|
|
875
|
+
const itemContent = item.url || item.href ? /* @__PURE__ */ jsx17(
|
|
876
|
+
Link2,
|
|
877
|
+
{
|
|
878
|
+
href: item.url || item.href || "#",
|
|
879
|
+
className: "flex items-center w-full",
|
|
880
|
+
onClick: (e) => {
|
|
881
|
+
if (item.disabled) {
|
|
882
|
+
e.preventDefault();
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
handleItemClick(item, index);
|
|
886
|
+
},
|
|
887
|
+
children: item.label || item.name || String(item.value)
|
|
888
|
+
}
|
|
889
|
+
) : /* @__PURE__ */ jsx17("span", { className: "flex items-center w-full", children: item.label || item.name || String(item.value) });
|
|
890
|
+
return /* @__PURE__ */ jsx17(
|
|
891
|
+
DropdownMenuItem,
|
|
892
|
+
{
|
|
893
|
+
className: cn(
|
|
894
|
+
"cursor-pointer",
|
|
895
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
896
|
+
),
|
|
897
|
+
disabled: item.disabled,
|
|
898
|
+
onSelect: () => {
|
|
899
|
+
if (!item.disabled) {
|
|
900
|
+
handleItemClick(item, index);
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
children: itemContent
|
|
904
|
+
},
|
|
905
|
+
item.id ?? item.value ?? index
|
|
906
|
+
);
|
|
907
|
+
}),
|
|
908
|
+
displayItems.length === 0 && /* @__PURE__ */ jsx17(DropdownMenuItem, { disabled: true, className: "text-muted-foreground", children: emptyStateText })
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
)
|
|
912
|
+
] })
|
|
913
|
+
]
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
};
|
|
917
|
+
var ButtonGroup_default = ButtonGroup;
|
|
745
918
|
|
|
746
919
|
// src/components/Basic/Icon/Icon.tsx
|
|
747
920
|
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
@@ -1534,7 +1707,7 @@ function MultiCheckbox({
|
|
|
1534
1707
|
import { useEffect as useEffect13 } from "react";
|
|
1535
1708
|
|
|
1536
1709
|
// src/components/Global/TinyMceEditor.tsx
|
|
1537
|
-
import { useMemo as
|
|
1710
|
+
import { useMemo as useMemo3, useRef as useRef3 } from "react";
|
|
1538
1711
|
import { Editor } from "@tinymce/tinymce-react";
|
|
1539
1712
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1540
1713
|
function MyEditor({
|
|
@@ -1554,7 +1727,7 @@ function MyEditor({
|
|
|
1554
1727
|
}
|
|
1555
1728
|
return trimmedHtml;
|
|
1556
1729
|
}
|
|
1557
|
-
const isDefaultToolbar =
|
|
1730
|
+
const isDefaultToolbar = useMemo3(() => {
|
|
1558
1731
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
1559
1732
|
if (isDefault) {
|
|
1560
1733
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -1762,7 +1935,7 @@ function SelectScrollDownButton({
|
|
|
1762
1935
|
}
|
|
1763
1936
|
|
|
1764
1937
|
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
1765
|
-
import { useState as useState8, useRef as useRef5, useEffect as useEffect15, useMemo as
|
|
1938
|
+
import { useState as useState8, useRef as useRef5, useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
1766
1939
|
import { XSquareIcon } from "lucide-react";
|
|
1767
1940
|
|
|
1768
1941
|
// src/hooks/useLazyDropdown.ts
|
|
@@ -2064,7 +2237,7 @@ function LazySelectDropdown({
|
|
|
2064
2237
|
axiosInstance,
|
|
2065
2238
|
enforceStrictQueryParams
|
|
2066
2239
|
});
|
|
2067
|
-
const selectedOption =
|
|
2240
|
+
const selectedOption = useMemo4(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
2068
2241
|
useEffect15(() => {
|
|
2069
2242
|
const handleClickOutside = (e) => {
|
|
2070
2243
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
@@ -2497,12 +2670,12 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2497
2670
|
var FileInput_default = FileInput;
|
|
2498
2671
|
|
|
2499
2672
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
2500
|
-
import * as
|
|
2673
|
+
import * as React8 from "react";
|
|
2501
2674
|
import { format } from "date-fns";
|
|
2502
2675
|
import { Calendar1Icon, XSquareIcon as XSquareIcon2 } from "lucide-react";
|
|
2503
2676
|
|
|
2504
2677
|
// src/components/ui/calendar.tsx
|
|
2505
|
-
import * as
|
|
2678
|
+
import * as React7 from "react";
|
|
2506
2679
|
import {
|
|
2507
2680
|
ChevronDownIcon as ChevronDownIcon2,
|
|
2508
2681
|
ChevronLeftIcon,
|
|
@@ -2662,8 +2835,8 @@ function CalendarDayButton({
|
|
|
2662
2835
|
...props
|
|
2663
2836
|
}) {
|
|
2664
2837
|
const defaultClassNames = getDefaultClassNames();
|
|
2665
|
-
const ref =
|
|
2666
|
-
|
|
2838
|
+
const ref = React7.useRef(null);
|
|
2839
|
+
React7.useEffect(() => {
|
|
2667
2840
|
if (modifiers.focused) ref.current?.focus();
|
|
2668
2841
|
}, [modifiers.focused]);
|
|
2669
2842
|
return /* @__PURE__ */ jsx43(
|
|
@@ -2757,25 +2930,25 @@ function DateTimePicker({
|
|
|
2757
2930
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2758
2931
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
2759
2932
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
2760
|
-
const [date, setDate] =
|
|
2933
|
+
const [date, setDate] = React8.useState(() => {
|
|
2761
2934
|
if (!props.value) return void 0;
|
|
2762
2935
|
const d = new Date(props.value);
|
|
2763
2936
|
return isNaN(d.getTime()) ? void 0 : d;
|
|
2764
2937
|
});
|
|
2765
2938
|
const initialHours = date ? date.getHours() : 0;
|
|
2766
2939
|
const initialMinutes = date ? date.getMinutes() : 0;
|
|
2767
|
-
const [hours, setHours] =
|
|
2768
|
-
const [minutes, setMinutes] =
|
|
2769
|
-
const [amPm, setAmPm] =
|
|
2770
|
-
const displayHours =
|
|
2940
|
+
const [hours, setHours] = React8.useState(initialHours);
|
|
2941
|
+
const [minutes, setMinutes] = React8.useState(initialMinutes);
|
|
2942
|
+
const [amPm, setAmPm] = React8.useState("AM");
|
|
2943
|
+
const displayHours = React8.useMemo(() => {
|
|
2771
2944
|
if (hours === 0) return 12;
|
|
2772
2945
|
if (hours > 12) return hours - 12;
|
|
2773
2946
|
return hours;
|
|
2774
2947
|
}, [hours]);
|
|
2775
|
-
|
|
2948
|
+
React8.useEffect(() => {
|
|
2776
2949
|
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
2777
2950
|
}, [hours]);
|
|
2778
|
-
|
|
2951
|
+
React8.useEffect(() => {
|
|
2779
2952
|
if (!props.value) {
|
|
2780
2953
|
setDate(void 0);
|
|
2781
2954
|
return;
|
|
@@ -2787,8 +2960,8 @@ function DateTimePicker({
|
|
|
2787
2960
|
setMinutes(d.getMinutes());
|
|
2788
2961
|
}
|
|
2789
2962
|
}, [props.value]);
|
|
2790
|
-
const [year, setYear] =
|
|
2791
|
-
|
|
2963
|
+
const [year, setYear] = React8.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
2964
|
+
React8.useEffect(() => {
|
|
2792
2965
|
if (!date) return;
|
|
2793
2966
|
const newDate = new Date(date);
|
|
2794
2967
|
newDate.setFullYear(year);
|
|
@@ -2891,7 +3064,7 @@ function DateTimePicker({
|
|
|
2891
3064
|
for (let y = currentYear - 50; y <= currentYear + 10; y++) {
|
|
2892
3065
|
yearOptions.push(y);
|
|
2893
3066
|
}
|
|
2894
|
-
const displayValue =
|
|
3067
|
+
const displayValue = React8.useMemo(() => {
|
|
2895
3068
|
if (!date) return "";
|
|
2896
3069
|
try {
|
|
2897
3070
|
if (mode === "date") return format(date, "dd-MM-yyyy");
|
|
@@ -2902,11 +3075,11 @@ function DateTimePicker({
|
|
|
2902
3075
|
}
|
|
2903
3076
|
}, [date, mode]);
|
|
2904
3077
|
const isInputDisabled = isDisabled || !isEditable;
|
|
2905
|
-
const [calendarMonthState, setCalendarMonthState] =
|
|
3078
|
+
const [calendarMonthState, setCalendarMonthState] = React8.useState(() => {
|
|
2906
3079
|
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
2907
3080
|
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
2908
3081
|
});
|
|
2909
|
-
|
|
3082
|
+
React8.useEffect(() => {
|
|
2910
3083
|
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
2911
3084
|
}, [year]);
|
|
2912
3085
|
const handleToday = () => {
|
|
@@ -3052,12 +3225,12 @@ function DateTimePicker({
|
|
|
3052
3225
|
}
|
|
3053
3226
|
|
|
3054
3227
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
3055
|
-
import
|
|
3228
|
+
import React9, { useEffect as useEffect23 } from "react";
|
|
3056
3229
|
import { addDays, format as format2 } from "date-fns";
|
|
3057
3230
|
import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3058
3231
|
var DateRange = ({ className, style, ...props }) => {
|
|
3059
3232
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
3060
|
-
const [date, setDate] =
|
|
3233
|
+
const [date, setDate] = React9.useState(
|
|
3061
3234
|
isDateRange(props.value) ? props.value : {
|
|
3062
3235
|
from: /* @__PURE__ */ new Date(),
|
|
3063
3236
|
to: addDays(/* @__PURE__ */ new Date(), 7)
|
|
@@ -3171,7 +3344,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3171
3344
|
var TextInputGroup_default = TextInputGroup;
|
|
3172
3345
|
|
|
3173
3346
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
3174
|
-
import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as
|
|
3347
|
+
import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as useMemo6 } from "react";
|
|
3175
3348
|
import { XIcon, XSquareIcon as XSquareIcon3 } from "lucide-react";
|
|
3176
3349
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3177
3350
|
function LazyMultiSelectDropdown({
|
|
@@ -3244,7 +3417,7 @@ function LazyMultiSelectDropdown({
|
|
|
3244
3417
|
return unique;
|
|
3245
3418
|
}
|
|
3246
3419
|
};
|
|
3247
|
-
const selectedOptions =
|
|
3420
|
+
const selectedOptions = useMemo6(() => {
|
|
3248
3421
|
return normalizedValue.map((id2) => {
|
|
3249
3422
|
const fromLazy = lazyOptions.find((opt) => opt.value === id2);
|
|
3250
3423
|
if (fromLazy) return fromLazy;
|
|
@@ -3394,7 +3567,7 @@ function LazyMultiSelectDropdown({
|
|
|
3394
3567
|
}
|
|
3395
3568
|
|
|
3396
3569
|
// src/components/ui/data-table.tsx
|
|
3397
|
-
import * as
|
|
3570
|
+
import * as React11 from "react";
|
|
3398
3571
|
import { faEllipsisH } from "@fortawesome/free-solid-svg-icons";
|
|
3399
3572
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
3400
3573
|
import {
|
|
@@ -3495,7 +3668,7 @@ function TableCell({ className, ...props }) {
|
|
|
3495
3668
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
3496
3669
|
|
|
3497
3670
|
// src/lib/table/cellRendererFactory.tsx
|
|
3498
|
-
import
|
|
3671
|
+
import React10 from "react";
|
|
3499
3672
|
import * as LucideIcons2 from "lucide-react";
|
|
3500
3673
|
import { Star as Star2 } from "lucide-react";
|
|
3501
3674
|
import Image from "next/image";
|
|
@@ -3583,9 +3756,9 @@ var getContrastColor = (bg) => {
|
|
|
3583
3756
|
};
|
|
3584
3757
|
var sanitizeValue = (val) => {
|
|
3585
3758
|
if (val == null) return null;
|
|
3586
|
-
if (
|
|
3759
|
+
if (React10.isValidElement(val)) return val;
|
|
3587
3760
|
if (typeof val === "string" || typeof val === "number") return val;
|
|
3588
|
-
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ jsx50(
|
|
3761
|
+
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ jsx50(React10.Fragment, { children: sanitizeValue(v) }, i));
|
|
3589
3762
|
if (typeof val === "object") {
|
|
3590
3763
|
if ("name" in val && typeof val.name === "string") return val.name;
|
|
3591
3764
|
if ("label" in val && typeof val.label === "string") return val.label;
|
|
@@ -3842,10 +4015,10 @@ function DataTable({
|
|
|
3842
4015
|
enableRowSelection = false,
|
|
3843
4016
|
getRowSelection
|
|
3844
4017
|
}) {
|
|
3845
|
-
const [columnFilters, setColumnFilters] =
|
|
3846
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3847
|
-
const [manualSort, setManualSort] =
|
|
3848
|
-
const [searchTerm, setSearchTerm] =
|
|
4018
|
+
const [columnFilters, setColumnFilters] = React11.useState([]);
|
|
4019
|
+
const [columnVisibility, setColumnVisibility] = React11.useState({});
|
|
4020
|
+
const [manualSort, setManualSort] = React11.useState(null);
|
|
4021
|
+
const [searchTerm, setSearchTerm] = React11.useState("");
|
|
3849
4022
|
const tableData = Array.isArray(data) ? data : [];
|
|
3850
4023
|
const finalCols = [...columns];
|
|
3851
4024
|
if (enableRowSelection) {
|
|
@@ -3871,8 +4044,8 @@ function DataTable({
|
|
|
3871
4044
|
});
|
|
3872
4045
|
}
|
|
3873
4046
|
const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
|
|
3874
|
-
const [rowSelection, setRowSelection] =
|
|
3875
|
-
const [localPageSize, setLocalPageSize] =
|
|
4047
|
+
const [rowSelection, setRowSelection] = React11.useState({});
|
|
4048
|
+
const [localPageSize, setLocalPageSize] = React11.useState(pageSize);
|
|
3876
4049
|
const table = useReactTable({
|
|
3877
4050
|
data: tableData,
|
|
3878
4051
|
columns: dynamicCols,
|
|
@@ -3937,7 +4110,7 @@ function DataTable({
|
|
|
3937
4110
|
onPageChange?.(currentPageIndex, newSize);
|
|
3938
4111
|
setLocalPageSize(newSize);
|
|
3939
4112
|
};
|
|
3940
|
-
const pageSizeOptions =
|
|
4113
|
+
const pageSizeOptions = React11.useMemo(() => {
|
|
3941
4114
|
const options = [5, 10, 20, 50, 100].filter((size) => size < totalRecords);
|
|
3942
4115
|
if (options.length === 0) {
|
|
3943
4116
|
options.push(5);
|
|
@@ -4500,7 +4673,7 @@ var CustomPagination = ({
|
|
|
4500
4673
|
var Pagination_default = CustomPagination;
|
|
4501
4674
|
|
|
4502
4675
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
4503
|
-
import { useMemo as
|
|
4676
|
+
import { useMemo as useMemo8 } from "react";
|
|
4504
4677
|
import { LoaderCircle, Info } from "lucide-react";
|
|
4505
4678
|
|
|
4506
4679
|
// src/components/ui/accordion.tsx
|
|
@@ -4626,7 +4799,7 @@ var HistoryTimeline = ({
|
|
|
4626
4799
|
createdAtKey,
|
|
4627
4800
|
...props
|
|
4628
4801
|
}) => {
|
|
4629
|
-
const data =
|
|
4802
|
+
const data = useMemo8(() => {
|
|
4630
4803
|
if (Array.isArray(props.data)) {
|
|
4631
4804
|
return props.data;
|
|
4632
4805
|
}
|
|
@@ -4703,7 +4876,7 @@ var HistoryTimeline = ({
|
|
|
4703
4876
|
var HistoryTimeline_default = HistoryTimeline;
|
|
4704
4877
|
|
|
4705
4878
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
4706
|
-
import { useCallback as useCallback4, useMemo as
|
|
4879
|
+
import { useCallback as useCallback4, useMemo as useMemo9, useState as useState12 } from "react";
|
|
4707
4880
|
import { ChevronDown as ChevronDown2, Menu } from "lucide-react";
|
|
4708
4881
|
import Link3 from "next/link";
|
|
4709
4882
|
import { usePathname, useRouter } from "next/navigation";
|
|
@@ -4926,7 +5099,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
4926
5099
|
});
|
|
4927
5100
|
return sortMenus(rootMenus);
|
|
4928
5101
|
}
|
|
4929
|
-
const rawTabs =
|
|
5102
|
+
const rawTabs = useMemo9(() => {
|
|
4930
5103
|
if (!Array.isArray(tabs)) return [];
|
|
4931
5104
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
4932
5105
|
return groupMenus(tabs);
|
|
@@ -5125,7 +5298,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5125
5298
|
var Tabs_default = Tabs;
|
|
5126
5299
|
|
|
5127
5300
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5128
|
-
import
|
|
5301
|
+
import React12, { useEffect as useEffect26, useState as useState13 } from "react";
|
|
5129
5302
|
|
|
5130
5303
|
// src/components/ui/tooltip.tsx
|
|
5131
5304
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
@@ -5320,7 +5493,7 @@ var StagesComponent = ({
|
|
|
5320
5493
|
}
|
|
5321
5494
|
}
|
|
5322
5495
|
const stageKey = typeof stage[dataKey] === "string" ? stage[dataKey] : JSON.stringify(stage[dataKey]);
|
|
5323
|
-
return /* @__PURE__ */ jsx61(
|
|
5496
|
+
return /* @__PURE__ */ jsx61(React12.Fragment, { children: /* @__PURE__ */ jsxs38(Tooltip, { delayDuration: 500, disableHoverableContent: true, children: [
|
|
5324
5497
|
/* @__PURE__ */ jsx61(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx61(
|
|
5325
5498
|
"button",
|
|
5326
5499
|
{
|
|
@@ -5389,17 +5562,17 @@ import { jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
|
5389
5562
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
5390
5563
|
|
|
5391
5564
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5392
|
-
import { useCallback as useCallback5, useMemo as
|
|
5565
|
+
import { useCallback as useCallback5, useMemo as useMemo10, useState as useState14, useEffect as useEffect27 } from "react";
|
|
5393
5566
|
import { Bell, Search as Search2, Menu as Menu2 } from "lucide-react";
|
|
5394
5567
|
import Image3 from "next/image";
|
|
5395
5568
|
import Link4 from "next/link";
|
|
5396
5569
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
5397
5570
|
|
|
5398
5571
|
// src/components/ui/avatar.tsx
|
|
5399
|
-
import * as
|
|
5572
|
+
import * as React13 from "react";
|
|
5400
5573
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
5401
5574
|
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
5402
|
-
var Avatar =
|
|
5575
|
+
var Avatar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx66(
|
|
5403
5576
|
AvatarPrimitive.Root,
|
|
5404
5577
|
{
|
|
5405
5578
|
ref,
|
|
@@ -5411,7 +5584,7 @@ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5411
5584
|
}
|
|
5412
5585
|
));
|
|
5413
5586
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
5414
|
-
var AvatarImage =
|
|
5587
|
+
var AvatarImage = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx66(
|
|
5415
5588
|
AvatarPrimitive.Image,
|
|
5416
5589
|
{
|
|
5417
5590
|
ref,
|
|
@@ -5420,7 +5593,7 @@ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5420
5593
|
}
|
|
5421
5594
|
));
|
|
5422
5595
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
5423
|
-
var AvatarFallback =
|
|
5596
|
+
var AvatarFallback = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx66(
|
|
5424
5597
|
AvatarPrimitive.Fallback,
|
|
5425
5598
|
{
|
|
5426
5599
|
ref,
|
|
@@ -5483,7 +5656,7 @@ function Navbar({
|
|
|
5483
5656
|
},
|
|
5484
5657
|
[isBuilder]
|
|
5485
5658
|
);
|
|
5486
|
-
const formattedMenu =
|
|
5659
|
+
const formattedMenu = useMemo10(() => {
|
|
5487
5660
|
if (source === "state" && navList?.length) {
|
|
5488
5661
|
return navList.map((i) => ({
|
|
5489
5662
|
...i,
|
|
@@ -5565,7 +5738,7 @@ function Navbar({
|
|
|
5565
5738
|
}
|
|
5566
5739
|
|
|
5567
5740
|
// src/components/Chart/BarChart.tsx
|
|
5568
|
-
import
|
|
5741
|
+
import React14, { useEffect as useEffect28, useMemo as useMemo11, useState as useState15, useCallback as useCallback6 } from "react";
|
|
5569
5742
|
import axios3 from "axios";
|
|
5570
5743
|
import {
|
|
5571
5744
|
BarChart,
|
|
@@ -5693,7 +5866,7 @@ var ChartComponent = ({
|
|
|
5693
5866
|
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
5694
5867
|
setCurrentPage(newPage);
|
|
5695
5868
|
};
|
|
5696
|
-
const data =
|
|
5869
|
+
const data = useMemo11(() => {
|
|
5697
5870
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
5698
5871
|
return [];
|
|
5699
5872
|
}
|
|
@@ -5881,10 +6054,10 @@ var ChartComponent = ({
|
|
|
5881
6054
|
] }) })
|
|
5882
6055
|
] });
|
|
5883
6056
|
};
|
|
5884
|
-
var BarChart_default =
|
|
6057
|
+
var BarChart_default = React14.memo(ChartComponent);
|
|
5885
6058
|
|
|
5886
6059
|
// src/components/Chart/PieChart.tsx
|
|
5887
|
-
import
|
|
6060
|
+
import React15, { useEffect as useEffect29, useMemo as useMemo12, useState as useState16 } from "react";
|
|
5888
6061
|
import axios4 from "axios";
|
|
5889
6062
|
import {
|
|
5890
6063
|
PieChart,
|
|
@@ -6010,7 +6183,7 @@ var DonutChart = ({
|
|
|
6010
6183
|
cancelled = true;
|
|
6011
6184
|
};
|
|
6012
6185
|
}, [apiUrl]);
|
|
6013
|
-
const data =
|
|
6186
|
+
const data = useMemo12(() => {
|
|
6014
6187
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
6015
6188
|
return effectiveData.map((item) => ({
|
|
6016
6189
|
...item,
|
|
@@ -6019,11 +6192,11 @@ var DonutChart = ({
|
|
|
6019
6192
|
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
6020
6193
|
}));
|
|
6021
6194
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6022
|
-
const total =
|
|
6195
|
+
const total = useMemo12(
|
|
6023
6196
|
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
6024
6197
|
[data, dataKey]
|
|
6025
6198
|
);
|
|
6026
|
-
const formattedTotal =
|
|
6199
|
+
const formattedTotal = useMemo12(() => {
|
|
6027
6200
|
if (total >= 1e6) {
|
|
6028
6201
|
return `${(total / 1e6).toFixed(1)}M`;
|
|
6029
6202
|
}
|
|
@@ -6032,7 +6205,7 @@ var DonutChart = ({
|
|
|
6032
6205
|
}
|
|
6033
6206
|
return total.toString();
|
|
6034
6207
|
}, [total]);
|
|
6035
|
-
const chartData =
|
|
6208
|
+
const chartData = useMemo12(() => {
|
|
6036
6209
|
if (total === 0) return data;
|
|
6037
6210
|
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
6038
6211
|
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
@@ -6060,7 +6233,7 @@ var DonutChart = ({
|
|
|
6060
6233
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
6061
6234
|
return () => clearTimeout(timeout);
|
|
6062
6235
|
}, []);
|
|
6063
|
-
const renderLegends =
|
|
6236
|
+
const renderLegends = useMemo12(() => {
|
|
6064
6237
|
if (!showLegends) return null;
|
|
6065
6238
|
return /* @__PURE__ */ jsx69("div", { className: "flex flex-wrap justify-center gap-2 mt-4 w-full max-w-4xl", children: chartData.map((d, index) => {
|
|
6066
6239
|
const actualValue = data.find(
|
|
@@ -6188,7 +6361,7 @@ var DonutChart = ({
|
|
|
6188
6361
|
renderLegends
|
|
6189
6362
|
] });
|
|
6190
6363
|
};
|
|
6191
|
-
var PieChart_default =
|
|
6364
|
+
var PieChart_default = React15.memo(DonutChart);
|
|
6192
6365
|
|
|
6193
6366
|
// src/components/Blocks/EmailComposer.tsx
|
|
6194
6367
|
import { jsx as jsx70, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
@@ -6297,7 +6470,7 @@ export {
|
|
|
6297
6470
|
BarChart_default as BarChart,
|
|
6298
6471
|
Breadcrumb_default as Breadcrumb,
|
|
6299
6472
|
Button_default as Button,
|
|
6300
|
-
ButtonGroup,
|
|
6473
|
+
ButtonGroup_default as ButtonGroup,
|
|
6301
6474
|
Checkbox_default as Checkbox,
|
|
6302
6475
|
Container_default as Container,
|
|
6303
6476
|
DateTimePicker as DatePicker,
|