@algorithm-shift/design-system 1.3.104 → 1.3.106
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 +23 -26
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +46 -5
- package/dist/index.d.ts +46 -5
- package/dist/index.js +376 -205
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +273 -102
- 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,220 @@ 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
|
+
);
|
|
802
|
+
const mainButtonClasses = cn(
|
|
803
|
+
className,
|
|
804
|
+
orientation === "horizontal" ? "rounded-none border-l-0 border-t-0 border-r last:border-r-0" : "rounded-none border-t-0 border-b last:border-b-0",
|
|
805
|
+
"focus:ring-0 focus-visible:ring-0"
|
|
806
|
+
);
|
|
807
|
+
const dropdownButtonClasses = cn(
|
|
808
|
+
"rounded-none",
|
|
809
|
+
"focus:ring-0 focus-visible:ring-0",
|
|
810
|
+
"shadow-none"
|
|
811
|
+
);
|
|
812
|
+
if (!displayItems.length) {
|
|
813
|
+
return /* @__PURE__ */ jsx17("div", { className: containerClasses, style, children: /* @__PURE__ */ jsx17(
|
|
706
814
|
Button,
|
|
707
815
|
{
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
816
|
+
variant: mainButtonVariant,
|
|
817
|
+
size: buttonSize,
|
|
818
|
+
className: mainButtonClasses,
|
|
819
|
+
onClick: handleMainButtonClick,
|
|
820
|
+
disabled: disabled || loading,
|
|
821
|
+
style,
|
|
822
|
+
children: loading ? /* @__PURE__ */ jsxs7("span", { className: "flex items-center gap-2", children: [
|
|
823
|
+
/* @__PURE__ */ jsx17(Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
824
|
+
buttonText
|
|
825
|
+
] }) : buttonText
|
|
712
826
|
}
|
|
713
|
-
)
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
827
|
+
) });
|
|
828
|
+
}
|
|
829
|
+
return /* @__PURE__ */ jsxs7(
|
|
830
|
+
"div",
|
|
831
|
+
{
|
|
832
|
+
className: containerClasses,
|
|
833
|
+
style,
|
|
834
|
+
...restProps,
|
|
835
|
+
children: [
|
|
836
|
+
/* @__PURE__ */ jsx17(
|
|
837
|
+
Button,
|
|
838
|
+
{
|
|
839
|
+
variant: mainButtonVariant,
|
|
840
|
+
size: buttonSize,
|
|
841
|
+
className: mainButtonClasses,
|
|
842
|
+
onClick: handleMainButtonClick,
|
|
843
|
+
disabled: disabled || loading,
|
|
844
|
+
style,
|
|
845
|
+
children: loading ? /* @__PURE__ */ jsxs7("span", { className: "flex items-center gap-2", children: [
|
|
846
|
+
/* @__PURE__ */ jsx17("span", { className: "animate-spin", children: "\u23F3" }),
|
|
847
|
+
buttonText
|
|
848
|
+
] }) : buttonText
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
/* @__PURE__ */ jsxs7(DropdownMenu, { children: [
|
|
852
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx17(
|
|
853
|
+
Button,
|
|
731
854
|
{
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
))
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
855
|
+
variant: dropdownButtonVariant,
|
|
856
|
+
size: buttonSize,
|
|
857
|
+
className: dropdownButtonClasses,
|
|
858
|
+
disabled: disabled || loading,
|
|
859
|
+
"aria-label": "Open dropdown menu",
|
|
860
|
+
children: renderDropdownIcon()
|
|
861
|
+
}
|
|
862
|
+
) }),
|
|
863
|
+
/* @__PURE__ */ jsxs7(
|
|
864
|
+
DropdownMenuContent,
|
|
865
|
+
{
|
|
866
|
+
align: alignDropdown,
|
|
867
|
+
className: "min-w-[120px] max-h-[300px] overflow-y-auto",
|
|
868
|
+
children: [
|
|
869
|
+
displayItems.map((item, index) => {
|
|
870
|
+
if (item.separator || showSeparator && index > 0 && index % 3 === 0) {
|
|
871
|
+
return /* @__PURE__ */ jsx17(DropdownMenuSeparator, {}, `separator-${index}`);
|
|
872
|
+
}
|
|
873
|
+
const itemContent = item.url || item.href ? /* @__PURE__ */ jsx17(
|
|
874
|
+
Link2,
|
|
875
|
+
{
|
|
876
|
+
href: item.url || item.href || "#",
|
|
877
|
+
className: "flex items-center w-full",
|
|
878
|
+
onClick: (e) => {
|
|
879
|
+
if (item.disabled) {
|
|
880
|
+
e.preventDefault();
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
handleItemClick(item, index);
|
|
884
|
+
},
|
|
885
|
+
children: item.label || item.name || String(item.value)
|
|
886
|
+
}
|
|
887
|
+
) : /* @__PURE__ */ jsx17("span", { className: "flex items-center w-full", children: item.label || item.name || String(item.value) });
|
|
888
|
+
return /* @__PURE__ */ jsx17(
|
|
889
|
+
DropdownMenuItem,
|
|
890
|
+
{
|
|
891
|
+
className: cn(
|
|
892
|
+
"cursor-pointer",
|
|
893
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
894
|
+
),
|
|
895
|
+
disabled: item.disabled,
|
|
896
|
+
onSelect: () => {
|
|
897
|
+
if (!item.disabled) {
|
|
898
|
+
handleItemClick(item, index);
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
children: itemContent
|
|
902
|
+
},
|
|
903
|
+
item.id ?? item.value ?? index
|
|
904
|
+
);
|
|
905
|
+
}),
|
|
906
|
+
displayItems.length === 0 && /* @__PURE__ */ jsx17(DropdownMenuItem, { disabled: true, className: "text-muted-foreground", children: emptyStateText })
|
|
907
|
+
]
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] })
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
};
|
|
915
|
+
var ButtonGroup_default = ButtonGroup;
|
|
745
916
|
|
|
746
917
|
// src/components/Basic/Icon/Icon.tsx
|
|
747
918
|
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
@@ -1534,7 +1705,7 @@ function MultiCheckbox({
|
|
|
1534
1705
|
import { useEffect as useEffect13 } from "react";
|
|
1535
1706
|
|
|
1536
1707
|
// src/components/Global/TinyMceEditor.tsx
|
|
1537
|
-
import { useMemo as
|
|
1708
|
+
import { useMemo as useMemo3, useRef as useRef3 } from "react";
|
|
1538
1709
|
import { Editor } from "@tinymce/tinymce-react";
|
|
1539
1710
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1540
1711
|
function MyEditor({
|
|
@@ -1554,7 +1725,7 @@ function MyEditor({
|
|
|
1554
1725
|
}
|
|
1555
1726
|
return trimmedHtml;
|
|
1556
1727
|
}
|
|
1557
|
-
const isDefaultToolbar =
|
|
1728
|
+
const isDefaultToolbar = useMemo3(() => {
|
|
1558
1729
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
1559
1730
|
if (isDefault) {
|
|
1560
1731
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -1762,7 +1933,7 @@ function SelectScrollDownButton({
|
|
|
1762
1933
|
}
|
|
1763
1934
|
|
|
1764
1935
|
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
1765
|
-
import { useState as useState8, useRef as useRef5, useEffect as useEffect15, useMemo as
|
|
1936
|
+
import { useState as useState8, useRef as useRef5, useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
1766
1937
|
import { XSquareIcon } from "lucide-react";
|
|
1767
1938
|
|
|
1768
1939
|
// src/hooks/useLazyDropdown.ts
|
|
@@ -2064,7 +2235,7 @@ function LazySelectDropdown({
|
|
|
2064
2235
|
axiosInstance,
|
|
2065
2236
|
enforceStrictQueryParams
|
|
2066
2237
|
});
|
|
2067
|
-
const selectedOption =
|
|
2238
|
+
const selectedOption = useMemo4(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
2068
2239
|
useEffect15(() => {
|
|
2069
2240
|
const handleClickOutside = (e) => {
|
|
2070
2241
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
@@ -2497,12 +2668,12 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2497
2668
|
var FileInput_default = FileInput;
|
|
2498
2669
|
|
|
2499
2670
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
2500
|
-
import * as
|
|
2671
|
+
import * as React8 from "react";
|
|
2501
2672
|
import { format } from "date-fns";
|
|
2502
2673
|
import { Calendar1Icon, XSquareIcon as XSquareIcon2 } from "lucide-react";
|
|
2503
2674
|
|
|
2504
2675
|
// src/components/ui/calendar.tsx
|
|
2505
|
-
import * as
|
|
2676
|
+
import * as React7 from "react";
|
|
2506
2677
|
import {
|
|
2507
2678
|
ChevronDownIcon as ChevronDownIcon2,
|
|
2508
2679
|
ChevronLeftIcon,
|
|
@@ -2662,8 +2833,8 @@ function CalendarDayButton({
|
|
|
2662
2833
|
...props
|
|
2663
2834
|
}) {
|
|
2664
2835
|
const defaultClassNames = getDefaultClassNames();
|
|
2665
|
-
const ref =
|
|
2666
|
-
|
|
2836
|
+
const ref = React7.useRef(null);
|
|
2837
|
+
React7.useEffect(() => {
|
|
2667
2838
|
if (modifiers.focused) ref.current?.focus();
|
|
2668
2839
|
}, [modifiers.focused]);
|
|
2669
2840
|
return /* @__PURE__ */ jsx43(
|
|
@@ -2757,25 +2928,25 @@ function DateTimePicker({
|
|
|
2757
2928
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2758
2929
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
2759
2930
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
2760
|
-
const [date, setDate] =
|
|
2931
|
+
const [date, setDate] = React8.useState(() => {
|
|
2761
2932
|
if (!props.value) return void 0;
|
|
2762
2933
|
const d = new Date(props.value);
|
|
2763
2934
|
return isNaN(d.getTime()) ? void 0 : d;
|
|
2764
2935
|
});
|
|
2765
2936
|
const initialHours = date ? date.getHours() : 0;
|
|
2766
2937
|
const initialMinutes = date ? date.getMinutes() : 0;
|
|
2767
|
-
const [hours, setHours] =
|
|
2768
|
-
const [minutes, setMinutes] =
|
|
2769
|
-
const [amPm, setAmPm] =
|
|
2770
|
-
const displayHours =
|
|
2938
|
+
const [hours, setHours] = React8.useState(initialHours);
|
|
2939
|
+
const [minutes, setMinutes] = React8.useState(initialMinutes);
|
|
2940
|
+
const [amPm, setAmPm] = React8.useState("AM");
|
|
2941
|
+
const displayHours = React8.useMemo(() => {
|
|
2771
2942
|
if (hours === 0) return 12;
|
|
2772
2943
|
if (hours > 12) return hours - 12;
|
|
2773
2944
|
return hours;
|
|
2774
2945
|
}, [hours]);
|
|
2775
|
-
|
|
2946
|
+
React8.useEffect(() => {
|
|
2776
2947
|
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
2777
2948
|
}, [hours]);
|
|
2778
|
-
|
|
2949
|
+
React8.useEffect(() => {
|
|
2779
2950
|
if (!props.value) {
|
|
2780
2951
|
setDate(void 0);
|
|
2781
2952
|
return;
|
|
@@ -2787,8 +2958,8 @@ function DateTimePicker({
|
|
|
2787
2958
|
setMinutes(d.getMinutes());
|
|
2788
2959
|
}
|
|
2789
2960
|
}, [props.value]);
|
|
2790
|
-
const [year, setYear] =
|
|
2791
|
-
|
|
2961
|
+
const [year, setYear] = React8.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
2962
|
+
React8.useEffect(() => {
|
|
2792
2963
|
if (!date) return;
|
|
2793
2964
|
const newDate = new Date(date);
|
|
2794
2965
|
newDate.setFullYear(year);
|
|
@@ -2891,7 +3062,7 @@ function DateTimePicker({
|
|
|
2891
3062
|
for (let y = currentYear - 50; y <= currentYear + 10; y++) {
|
|
2892
3063
|
yearOptions.push(y);
|
|
2893
3064
|
}
|
|
2894
|
-
const displayValue =
|
|
3065
|
+
const displayValue = React8.useMemo(() => {
|
|
2895
3066
|
if (!date) return "";
|
|
2896
3067
|
try {
|
|
2897
3068
|
if (mode === "date") return format(date, "dd-MM-yyyy");
|
|
@@ -2902,11 +3073,11 @@ function DateTimePicker({
|
|
|
2902
3073
|
}
|
|
2903
3074
|
}, [date, mode]);
|
|
2904
3075
|
const isInputDisabled = isDisabled || !isEditable;
|
|
2905
|
-
const [calendarMonthState, setCalendarMonthState] =
|
|
3076
|
+
const [calendarMonthState, setCalendarMonthState] = React8.useState(() => {
|
|
2906
3077
|
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
2907
3078
|
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
2908
3079
|
});
|
|
2909
|
-
|
|
3080
|
+
React8.useEffect(() => {
|
|
2910
3081
|
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
2911
3082
|
}, [year]);
|
|
2912
3083
|
const handleToday = () => {
|
|
@@ -3052,12 +3223,12 @@ function DateTimePicker({
|
|
|
3052
3223
|
}
|
|
3053
3224
|
|
|
3054
3225
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
3055
|
-
import
|
|
3226
|
+
import React9, { useEffect as useEffect23 } from "react";
|
|
3056
3227
|
import { addDays, format as format2 } from "date-fns";
|
|
3057
3228
|
import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3058
3229
|
var DateRange = ({ className, style, ...props }) => {
|
|
3059
3230
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
3060
|
-
const [date, setDate] =
|
|
3231
|
+
const [date, setDate] = React9.useState(
|
|
3061
3232
|
isDateRange(props.value) ? props.value : {
|
|
3062
3233
|
from: /* @__PURE__ */ new Date(),
|
|
3063
3234
|
to: addDays(/* @__PURE__ */ new Date(), 7)
|
|
@@ -3171,7 +3342,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3171
3342
|
var TextInputGroup_default = TextInputGroup;
|
|
3172
3343
|
|
|
3173
3344
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
3174
|
-
import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as
|
|
3345
|
+
import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as useMemo6 } from "react";
|
|
3175
3346
|
import { XIcon, XSquareIcon as XSquareIcon3 } from "lucide-react";
|
|
3176
3347
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3177
3348
|
function LazyMultiSelectDropdown({
|
|
@@ -3244,7 +3415,7 @@ function LazyMultiSelectDropdown({
|
|
|
3244
3415
|
return unique;
|
|
3245
3416
|
}
|
|
3246
3417
|
};
|
|
3247
|
-
const selectedOptions =
|
|
3418
|
+
const selectedOptions = useMemo6(() => {
|
|
3248
3419
|
return normalizedValue.map((id2) => {
|
|
3249
3420
|
const fromLazy = lazyOptions.find((opt) => opt.value === id2);
|
|
3250
3421
|
if (fromLazy) return fromLazy;
|
|
@@ -3394,7 +3565,7 @@ function LazyMultiSelectDropdown({
|
|
|
3394
3565
|
}
|
|
3395
3566
|
|
|
3396
3567
|
// src/components/ui/data-table.tsx
|
|
3397
|
-
import * as
|
|
3568
|
+
import * as React11 from "react";
|
|
3398
3569
|
import { faEllipsisH } from "@fortawesome/free-solid-svg-icons";
|
|
3399
3570
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
3400
3571
|
import {
|
|
@@ -3495,7 +3666,7 @@ function TableCell({ className, ...props }) {
|
|
|
3495
3666
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
3496
3667
|
|
|
3497
3668
|
// src/lib/table/cellRendererFactory.tsx
|
|
3498
|
-
import
|
|
3669
|
+
import React10 from "react";
|
|
3499
3670
|
import * as LucideIcons2 from "lucide-react";
|
|
3500
3671
|
import { Star as Star2 } from "lucide-react";
|
|
3501
3672
|
import Image from "next/image";
|
|
@@ -3583,9 +3754,9 @@ var getContrastColor = (bg) => {
|
|
|
3583
3754
|
};
|
|
3584
3755
|
var sanitizeValue = (val) => {
|
|
3585
3756
|
if (val == null) return null;
|
|
3586
|
-
if (
|
|
3757
|
+
if (React10.isValidElement(val)) return val;
|
|
3587
3758
|
if (typeof val === "string" || typeof val === "number") return val;
|
|
3588
|
-
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ jsx50(
|
|
3759
|
+
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ jsx50(React10.Fragment, { children: sanitizeValue(v) }, i));
|
|
3589
3760
|
if (typeof val === "object") {
|
|
3590
3761
|
if ("name" in val && typeof val.name === "string") return val.name;
|
|
3591
3762
|
if ("label" in val && typeof val.label === "string") return val.label;
|
|
@@ -3842,10 +4013,10 @@ function DataTable({
|
|
|
3842
4013
|
enableRowSelection = false,
|
|
3843
4014
|
getRowSelection
|
|
3844
4015
|
}) {
|
|
3845
|
-
const [columnFilters, setColumnFilters] =
|
|
3846
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3847
|
-
const [manualSort, setManualSort] =
|
|
3848
|
-
const [searchTerm, setSearchTerm] =
|
|
4016
|
+
const [columnFilters, setColumnFilters] = React11.useState([]);
|
|
4017
|
+
const [columnVisibility, setColumnVisibility] = React11.useState({});
|
|
4018
|
+
const [manualSort, setManualSort] = React11.useState(null);
|
|
4019
|
+
const [searchTerm, setSearchTerm] = React11.useState("");
|
|
3849
4020
|
const tableData = Array.isArray(data) ? data : [];
|
|
3850
4021
|
const finalCols = [...columns];
|
|
3851
4022
|
if (enableRowSelection) {
|
|
@@ -3871,8 +4042,8 @@ function DataTable({
|
|
|
3871
4042
|
});
|
|
3872
4043
|
}
|
|
3873
4044
|
const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
|
|
3874
|
-
const [rowSelection, setRowSelection] =
|
|
3875
|
-
const [localPageSize, setLocalPageSize] =
|
|
4045
|
+
const [rowSelection, setRowSelection] = React11.useState({});
|
|
4046
|
+
const [localPageSize, setLocalPageSize] = React11.useState(pageSize);
|
|
3876
4047
|
const table = useReactTable({
|
|
3877
4048
|
data: tableData,
|
|
3878
4049
|
columns: dynamicCols,
|
|
@@ -3937,7 +4108,7 @@ function DataTable({
|
|
|
3937
4108
|
onPageChange?.(currentPageIndex, newSize);
|
|
3938
4109
|
setLocalPageSize(newSize);
|
|
3939
4110
|
};
|
|
3940
|
-
const pageSizeOptions =
|
|
4111
|
+
const pageSizeOptions = React11.useMemo(() => {
|
|
3941
4112
|
const options = [5, 10, 20, 50, 100].filter((size) => size < totalRecords);
|
|
3942
4113
|
if (options.length === 0) {
|
|
3943
4114
|
options.push(5);
|
|
@@ -4132,7 +4303,7 @@ function DataTable({
|
|
|
4132
4303
|
return /* @__PURE__ */ jsxs30(
|
|
4133
4304
|
TableCell,
|
|
4134
4305
|
{
|
|
4135
|
-
className: `break-words whitespace-normal align-top ${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
|
|
4306
|
+
className: `break-words whitespace-normal align-top ${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2 `,
|
|
4136
4307
|
style: {
|
|
4137
4308
|
width: cell.column.getSize(),
|
|
4138
4309
|
minWidth: cell.column.columnDef.minSize,
|
|
@@ -4146,7 +4317,7 @@ function DataTable({
|
|
|
4146
4317
|
},
|
|
4147
4318
|
children: [
|
|
4148
4319
|
flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
4149
|
-
isLastCell && rowActions && rowActions.length > 0 && /* @__PURE__ */ jsx51("div", { className: "absolute
|
|
4320
|
+
isLastCell && rowActions && rowActions.length > 0 && /* @__PURE__ */ jsx51("div", { className: "absolute p-1 px-2 inset-y-0 right-0 flex items-center transition-opacity duration-200", children: rowActions.map((action) => {
|
|
4150
4321
|
const isDelete = action.id === "delete" || action.icon === "delete";
|
|
4151
4322
|
return /* @__PURE__ */ jsx51(
|
|
4152
4323
|
"button",
|
|
@@ -4281,7 +4452,7 @@ var Table2 = ({
|
|
|
4281
4452
|
onCellClick?.({ id: cell.id, column: cell, columnId });
|
|
4282
4453
|
},
|
|
4283
4454
|
onDeleteRow: (cell) => {
|
|
4284
|
-
onDeleteRow?.(cell.id);
|
|
4455
|
+
onDeleteRow?.({ id: cell.id });
|
|
4285
4456
|
}
|
|
4286
4457
|
}
|
|
4287
4458
|
) });
|
|
@@ -4500,7 +4671,7 @@ var CustomPagination = ({
|
|
|
4500
4671
|
var Pagination_default = CustomPagination;
|
|
4501
4672
|
|
|
4502
4673
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
4503
|
-
import { useMemo as
|
|
4674
|
+
import { useMemo as useMemo8 } from "react";
|
|
4504
4675
|
import { LoaderCircle, Info } from "lucide-react";
|
|
4505
4676
|
|
|
4506
4677
|
// src/components/ui/accordion.tsx
|
|
@@ -4626,7 +4797,7 @@ var HistoryTimeline = ({
|
|
|
4626
4797
|
createdAtKey,
|
|
4627
4798
|
...props
|
|
4628
4799
|
}) => {
|
|
4629
|
-
const data =
|
|
4800
|
+
const data = useMemo8(() => {
|
|
4630
4801
|
if (Array.isArray(props.data)) {
|
|
4631
4802
|
return props.data;
|
|
4632
4803
|
}
|
|
@@ -4703,7 +4874,7 @@ var HistoryTimeline = ({
|
|
|
4703
4874
|
var HistoryTimeline_default = HistoryTimeline;
|
|
4704
4875
|
|
|
4705
4876
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
4706
|
-
import { useCallback as useCallback4, useMemo as
|
|
4877
|
+
import { useCallback as useCallback4, useMemo as useMemo9, useState as useState12 } from "react";
|
|
4707
4878
|
import { ChevronDown as ChevronDown2, Menu } from "lucide-react";
|
|
4708
4879
|
import Link3 from "next/link";
|
|
4709
4880
|
import { usePathname, useRouter } from "next/navigation";
|
|
@@ -4926,7 +5097,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
4926
5097
|
});
|
|
4927
5098
|
return sortMenus(rootMenus);
|
|
4928
5099
|
}
|
|
4929
|
-
const rawTabs =
|
|
5100
|
+
const rawTabs = useMemo9(() => {
|
|
4930
5101
|
if (!Array.isArray(tabs)) return [];
|
|
4931
5102
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
4932
5103
|
return groupMenus(tabs);
|
|
@@ -5125,7 +5296,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5125
5296
|
var Tabs_default = Tabs;
|
|
5126
5297
|
|
|
5127
5298
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5128
|
-
import
|
|
5299
|
+
import React12, { useEffect as useEffect26, useState as useState13 } from "react";
|
|
5129
5300
|
|
|
5130
5301
|
// src/components/ui/tooltip.tsx
|
|
5131
5302
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
@@ -5320,7 +5491,7 @@ var StagesComponent = ({
|
|
|
5320
5491
|
}
|
|
5321
5492
|
}
|
|
5322
5493
|
const stageKey = typeof stage[dataKey] === "string" ? stage[dataKey] : JSON.stringify(stage[dataKey]);
|
|
5323
|
-
return /* @__PURE__ */ jsx61(
|
|
5494
|
+
return /* @__PURE__ */ jsx61(React12.Fragment, { children: /* @__PURE__ */ jsxs38(Tooltip, { delayDuration: 500, disableHoverableContent: true, children: [
|
|
5324
5495
|
/* @__PURE__ */ jsx61(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx61(
|
|
5325
5496
|
"button",
|
|
5326
5497
|
{
|
|
@@ -5389,17 +5560,17 @@ import { jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
|
5389
5560
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
5390
5561
|
|
|
5391
5562
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5392
|
-
import { useCallback as useCallback5, useMemo as
|
|
5563
|
+
import { useCallback as useCallback5, useMemo as useMemo10, useState as useState14, useEffect as useEffect27 } from "react";
|
|
5393
5564
|
import { Bell, Search as Search2, Menu as Menu2 } from "lucide-react";
|
|
5394
5565
|
import Image3 from "next/image";
|
|
5395
5566
|
import Link4 from "next/link";
|
|
5396
5567
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
5397
5568
|
|
|
5398
5569
|
// src/components/ui/avatar.tsx
|
|
5399
|
-
import * as
|
|
5570
|
+
import * as React13 from "react";
|
|
5400
5571
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
5401
5572
|
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
5402
|
-
var Avatar =
|
|
5573
|
+
var Avatar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx66(
|
|
5403
5574
|
AvatarPrimitive.Root,
|
|
5404
5575
|
{
|
|
5405
5576
|
ref,
|
|
@@ -5411,7 +5582,7 @@ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5411
5582
|
}
|
|
5412
5583
|
));
|
|
5413
5584
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
5414
|
-
var AvatarImage =
|
|
5585
|
+
var AvatarImage = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx66(
|
|
5415
5586
|
AvatarPrimitive.Image,
|
|
5416
5587
|
{
|
|
5417
5588
|
ref,
|
|
@@ -5420,7 +5591,7 @@ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5420
5591
|
}
|
|
5421
5592
|
));
|
|
5422
5593
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
5423
|
-
var AvatarFallback =
|
|
5594
|
+
var AvatarFallback = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx66(
|
|
5424
5595
|
AvatarPrimitive.Fallback,
|
|
5425
5596
|
{
|
|
5426
5597
|
ref,
|
|
@@ -5483,7 +5654,7 @@ function Navbar({
|
|
|
5483
5654
|
},
|
|
5484
5655
|
[isBuilder]
|
|
5485
5656
|
);
|
|
5486
|
-
const formattedMenu =
|
|
5657
|
+
const formattedMenu = useMemo10(() => {
|
|
5487
5658
|
if (source === "state" && navList?.length) {
|
|
5488
5659
|
return navList.map((i) => ({
|
|
5489
5660
|
...i,
|
|
@@ -5565,7 +5736,7 @@ function Navbar({
|
|
|
5565
5736
|
}
|
|
5566
5737
|
|
|
5567
5738
|
// src/components/Chart/BarChart.tsx
|
|
5568
|
-
import
|
|
5739
|
+
import React14, { useEffect as useEffect28, useMemo as useMemo11, useState as useState15, useCallback as useCallback6 } from "react";
|
|
5569
5740
|
import axios3 from "axios";
|
|
5570
5741
|
import {
|
|
5571
5742
|
BarChart,
|
|
@@ -5693,7 +5864,7 @@ var ChartComponent = ({
|
|
|
5693
5864
|
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
5694
5865
|
setCurrentPage(newPage);
|
|
5695
5866
|
};
|
|
5696
|
-
const data =
|
|
5867
|
+
const data = useMemo11(() => {
|
|
5697
5868
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
5698
5869
|
return [];
|
|
5699
5870
|
}
|
|
@@ -5881,10 +6052,10 @@ var ChartComponent = ({
|
|
|
5881
6052
|
] }) })
|
|
5882
6053
|
] });
|
|
5883
6054
|
};
|
|
5884
|
-
var BarChart_default =
|
|
6055
|
+
var BarChart_default = React14.memo(ChartComponent);
|
|
5885
6056
|
|
|
5886
6057
|
// src/components/Chart/PieChart.tsx
|
|
5887
|
-
import
|
|
6058
|
+
import React15, { useEffect as useEffect29, useMemo as useMemo12, useState as useState16 } from "react";
|
|
5888
6059
|
import axios4 from "axios";
|
|
5889
6060
|
import {
|
|
5890
6061
|
PieChart,
|
|
@@ -6010,7 +6181,7 @@ var DonutChart = ({
|
|
|
6010
6181
|
cancelled = true;
|
|
6011
6182
|
};
|
|
6012
6183
|
}, [apiUrl]);
|
|
6013
|
-
const data =
|
|
6184
|
+
const data = useMemo12(() => {
|
|
6014
6185
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
6015
6186
|
return effectiveData.map((item) => ({
|
|
6016
6187
|
...item,
|
|
@@ -6019,11 +6190,11 @@ var DonutChart = ({
|
|
|
6019
6190
|
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
6020
6191
|
}));
|
|
6021
6192
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6022
|
-
const total =
|
|
6193
|
+
const total = useMemo12(
|
|
6023
6194
|
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
6024
6195
|
[data, dataKey]
|
|
6025
6196
|
);
|
|
6026
|
-
const formattedTotal =
|
|
6197
|
+
const formattedTotal = useMemo12(() => {
|
|
6027
6198
|
if (total >= 1e6) {
|
|
6028
6199
|
return `${(total / 1e6).toFixed(1)}M`;
|
|
6029
6200
|
}
|
|
@@ -6032,7 +6203,7 @@ var DonutChart = ({
|
|
|
6032
6203
|
}
|
|
6033
6204
|
return total.toString();
|
|
6034
6205
|
}, [total]);
|
|
6035
|
-
const chartData =
|
|
6206
|
+
const chartData = useMemo12(() => {
|
|
6036
6207
|
if (total === 0) return data;
|
|
6037
6208
|
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
6038
6209
|
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
@@ -6060,7 +6231,7 @@ var DonutChart = ({
|
|
|
6060
6231
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
6061
6232
|
return () => clearTimeout(timeout);
|
|
6062
6233
|
}, []);
|
|
6063
|
-
const renderLegends =
|
|
6234
|
+
const renderLegends = useMemo12(() => {
|
|
6064
6235
|
if (!showLegends) return null;
|
|
6065
6236
|
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
6237
|
const actualValue = data.find(
|
|
@@ -6188,7 +6359,7 @@ var DonutChart = ({
|
|
|
6188
6359
|
renderLegends
|
|
6189
6360
|
] });
|
|
6190
6361
|
};
|
|
6191
|
-
var PieChart_default =
|
|
6362
|
+
var PieChart_default = React15.memo(DonutChart);
|
|
6192
6363
|
|
|
6193
6364
|
// src/components/Blocks/EmailComposer.tsx
|
|
6194
6365
|
import { jsx as jsx70, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
@@ -6297,7 +6468,7 @@ export {
|
|
|
6297
6468
|
BarChart_default as BarChart,
|
|
6298
6469
|
Breadcrumb_default as Breadcrumb,
|
|
6299
6470
|
Button_default as Button,
|
|
6300
|
-
ButtonGroup,
|
|
6471
|
+
ButtonGroup_default as ButtonGroup,
|
|
6301
6472
|
Checkbox_default as Checkbox,
|
|
6302
6473
|
Container_default as Container,
|
|
6303
6474
|
DateTimePicker as DatePicker,
|