@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.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
BarChart: () => BarChart_default,
|
|
37
37
|
Breadcrumb: () => Breadcrumb_default,
|
|
38
38
|
Button: () => Button_default,
|
|
39
|
-
ButtonGroup: () =>
|
|
39
|
+
ButtonGroup: () => ButtonGroup_default,
|
|
40
40
|
Checkbox: () => Checkbox_default,
|
|
41
41
|
Container: () => Container_default,
|
|
42
42
|
DatePicker: () => DateTimePicker,
|
|
@@ -675,6 +675,7 @@ var Breadcrumb = ({ list = [], className, style }) => {
|
|
|
675
675
|
var Breadcrumb_default = Breadcrumb;
|
|
676
676
|
|
|
677
677
|
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
678
|
+
var import_react8 = require("react");
|
|
678
679
|
var import_lucide_react3 = require("lucide-react");
|
|
679
680
|
var import_link2 = __toESM(require("next/link"));
|
|
680
681
|
|
|
@@ -796,53 +797,223 @@ function DropdownMenuSubContent({
|
|
|
796
797
|
|
|
797
798
|
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
798
799
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
800
|
+
var ButtonGroup = ({
|
|
801
|
+
textContent,
|
|
802
|
+
// Dropdown items
|
|
803
|
+
data = [],
|
|
804
|
+
dataKey = "id",
|
|
805
|
+
dataLabel = "name",
|
|
806
|
+
// Styling
|
|
807
|
+
className,
|
|
808
|
+
style,
|
|
809
|
+
variant = "default",
|
|
810
|
+
buttonSize = "default",
|
|
811
|
+
buttonVariant,
|
|
812
|
+
dropdownVariant,
|
|
813
|
+
// Layout
|
|
814
|
+
orientation = "horizontal",
|
|
815
|
+
showDropdownIcon = true,
|
|
816
|
+
dropdownIcon,
|
|
817
|
+
alignDropdown = "end",
|
|
818
|
+
// Behavior
|
|
819
|
+
onItemSelect,
|
|
820
|
+
onClick,
|
|
821
|
+
// Advanced
|
|
822
|
+
disabled = false,
|
|
823
|
+
loading = false,
|
|
824
|
+
emptyStateText = "No items available",
|
|
825
|
+
maxItems,
|
|
826
|
+
showSeparator = false,
|
|
827
|
+
...restProps
|
|
828
|
+
}) => {
|
|
829
|
+
const dataSource = (0, import_react8.useMemo)(() => {
|
|
830
|
+
if (data) {
|
|
831
|
+
if (Array.isArray(data)) {
|
|
832
|
+
return data.length > 0 ? data : [];
|
|
833
|
+
}
|
|
834
|
+
return [data];
|
|
835
|
+
}
|
|
836
|
+
return [];
|
|
837
|
+
}, [data]);
|
|
838
|
+
const formattedItems = (0, import_react8.useMemo)(() => {
|
|
839
|
+
if (!dataSource.length) return [];
|
|
840
|
+
return dataSource.map((item, index) => {
|
|
841
|
+
if (typeof item === "string") {
|
|
842
|
+
return {
|
|
843
|
+
id: index,
|
|
844
|
+
value: item,
|
|
845
|
+
label: item,
|
|
846
|
+
name: item
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
const value = item[dataKey] ?? item.id ?? item.value ?? index;
|
|
850
|
+
const label = item[dataLabel] ?? item.label ?? item.name ?? String(value);
|
|
851
|
+
const url = item.url ?? item.href;
|
|
852
|
+
return {
|
|
853
|
+
...item,
|
|
854
|
+
id: item.id ?? value,
|
|
855
|
+
value,
|
|
856
|
+
label,
|
|
857
|
+
name: label,
|
|
858
|
+
url
|
|
859
|
+
};
|
|
860
|
+
});
|
|
861
|
+
}, [dataSource, dataKey, dataLabel]);
|
|
862
|
+
const displayItems = (0, import_react8.useMemo)(() => {
|
|
863
|
+
if (maxItems && maxItems > 0) {
|
|
864
|
+
return formattedItems.slice(0, maxItems);
|
|
865
|
+
}
|
|
866
|
+
return formattedItems;
|
|
867
|
+
}, [formattedItems, maxItems]);
|
|
868
|
+
const buttonText = textContent || "Button";
|
|
869
|
+
const mainButtonVariant = buttonVariant ?? variant;
|
|
870
|
+
const dropdownButtonVariant = dropdownVariant ?? variant;
|
|
871
|
+
const handleMainButtonClick = (e) => {
|
|
872
|
+
if (disabled || loading) return;
|
|
873
|
+
onClick?.(e);
|
|
874
|
+
};
|
|
875
|
+
const handleItemClick = (item, index) => {
|
|
876
|
+
if (item.disabled) return;
|
|
877
|
+
if (item.onClick) {
|
|
878
|
+
item.onClick();
|
|
879
|
+
}
|
|
880
|
+
onItemSelect?.({
|
|
881
|
+
item,
|
|
882
|
+
index
|
|
883
|
+
});
|
|
884
|
+
};
|
|
885
|
+
const renderDropdownIcon = () => {
|
|
886
|
+
if (!showDropdownIcon) return null;
|
|
887
|
+
if (dropdownIcon) {
|
|
888
|
+
return dropdownIcon;
|
|
889
|
+
}
|
|
890
|
+
return orientation === "horizontal" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react3.ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react3.MoreVertical, { className: "w-4 h-4" });
|
|
891
|
+
};
|
|
892
|
+
const containerClasses = cn(
|
|
893
|
+
"inline-flex items-center",
|
|
894
|
+
orientation === "horizontal" ? "flex-row" : "flex-col h-full",
|
|
895
|
+
"rounded-md overflow-hidden",
|
|
896
|
+
"border border-border",
|
|
897
|
+
"bg-background",
|
|
898
|
+
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2"
|
|
899
|
+
);
|
|
900
|
+
const mainButtonClasses = cn(
|
|
901
|
+
className,
|
|
902
|
+
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",
|
|
903
|
+
"focus:ring-0 focus-visible:ring-0"
|
|
904
|
+
);
|
|
905
|
+
const dropdownButtonClasses = cn(
|
|
906
|
+
"rounded-none",
|
|
907
|
+
"focus:ring-0 focus-visible:ring-0",
|
|
908
|
+
"shadow-none"
|
|
909
|
+
);
|
|
910
|
+
if (!displayItems.length) {
|
|
911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: containerClasses, style, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
804
912
|
Button,
|
|
805
913
|
{
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
914
|
+
variant: mainButtonVariant,
|
|
915
|
+
size: buttonSize,
|
|
916
|
+
className: mainButtonClasses,
|
|
917
|
+
onClick: handleMainButtonClick,
|
|
918
|
+
disabled: disabled || loading,
|
|
919
|
+
style,
|
|
920
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react3.Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
922
|
+
buttonText
|
|
923
|
+
] }) : buttonText
|
|
810
924
|
}
|
|
811
|
-
)
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
925
|
+
) });
|
|
926
|
+
}
|
|
927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
928
|
+
"div",
|
|
929
|
+
{
|
|
930
|
+
className: containerClasses,
|
|
931
|
+
style,
|
|
932
|
+
...restProps,
|
|
933
|
+
children: [
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
935
|
+
Button,
|
|
936
|
+
{
|
|
937
|
+
variant: mainButtonVariant,
|
|
938
|
+
size: buttonSize,
|
|
939
|
+
className: mainButtonClasses,
|
|
940
|
+
onClick: handleMainButtonClick,
|
|
941
|
+
disabled: disabled || loading,
|
|
942
|
+
style,
|
|
943
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "animate-spin", children: "\u23F3" }),
|
|
945
|
+
buttonText
|
|
946
|
+
] }) : buttonText
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenu, { children: [
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
951
|
+
Button,
|
|
829
952
|
{
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
))
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
953
|
+
variant: dropdownButtonVariant,
|
|
954
|
+
size: buttonSize,
|
|
955
|
+
className: dropdownButtonClasses,
|
|
956
|
+
disabled: disabled || loading,
|
|
957
|
+
"aria-label": "Open dropdown menu",
|
|
958
|
+
children: renderDropdownIcon()
|
|
959
|
+
}
|
|
960
|
+
) }),
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
962
|
+
DropdownMenuContent,
|
|
963
|
+
{
|
|
964
|
+
align: alignDropdown,
|
|
965
|
+
className: "min-w-[120px] max-h-[300px] overflow-y-auto",
|
|
966
|
+
children: [
|
|
967
|
+
displayItems.map((item, index) => {
|
|
968
|
+
if (item.separator || showSeparator && index > 0 && index % 3 === 0) {
|
|
969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}, `separator-${index}`);
|
|
970
|
+
}
|
|
971
|
+
const itemContent = item.url || item.href ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
972
|
+
import_link2.default,
|
|
973
|
+
{
|
|
974
|
+
href: item.url || item.href || "#",
|
|
975
|
+
className: "flex items-center w-full",
|
|
976
|
+
onClick: (e) => {
|
|
977
|
+
if (item.disabled) {
|
|
978
|
+
e.preventDefault();
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
handleItemClick(item, index);
|
|
982
|
+
},
|
|
983
|
+
children: item.label || item.name || String(item.value)
|
|
984
|
+
}
|
|
985
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex items-center w-full", children: item.label || item.name || String(item.value) });
|
|
986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
987
|
+
DropdownMenuItem,
|
|
988
|
+
{
|
|
989
|
+
className: cn(
|
|
990
|
+
"cursor-pointer",
|
|
991
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
992
|
+
),
|
|
993
|
+
disabled: item.disabled,
|
|
994
|
+
onSelect: () => {
|
|
995
|
+
if (!item.disabled) {
|
|
996
|
+
handleItemClick(item, index);
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
children: itemContent
|
|
1000
|
+
},
|
|
1001
|
+
item.id ?? item.value ?? index
|
|
1002
|
+
);
|
|
1003
|
+
}),
|
|
1004
|
+
displayItems.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuItem, { disabled: true, className: "text-muted-foreground", children: emptyStateText })
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
)
|
|
1008
|
+
] })
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
);
|
|
1012
|
+
};
|
|
1013
|
+
var ButtonGroup_default = ButtonGroup;
|
|
843
1014
|
|
|
844
1015
|
// src/components/Basic/Icon/Icon.tsx
|
|
845
|
-
var
|
|
1016
|
+
var import_react9 = require("react");
|
|
846
1017
|
var SolidIcons = __toESM(require("@fortawesome/free-solid-svg-icons"));
|
|
847
1018
|
var RegularIcons = __toESM(require("@fortawesome/free-regular-svg-icons"));
|
|
848
1019
|
var BrandIcons = __toESM(require("@fortawesome/free-brands-svg-icons"));
|
|
@@ -863,7 +1034,7 @@ function Icon(props) {
|
|
|
863
1034
|
pulse = false,
|
|
864
1035
|
...rest
|
|
865
1036
|
} = props;
|
|
866
|
-
const [dynamicIcon, setDynamicIcon] = (0,
|
|
1037
|
+
const [dynamicIcon, setDynamicIcon] = (0, import_react9.useState)(icon || null);
|
|
867
1038
|
async function loadFAIcon(iconName, prefix2) {
|
|
868
1039
|
const pkgMap = {
|
|
869
1040
|
fas: SolidIcons,
|
|
@@ -873,7 +1044,7 @@ function Icon(props) {
|
|
|
873
1044
|
const basePackage = pkgMap[prefix2] ?? SolidIcons;
|
|
874
1045
|
return basePackage[iconName] ?? null;
|
|
875
1046
|
}
|
|
876
|
-
(0,
|
|
1047
|
+
(0, import_react9.useEffect)(() => {
|
|
877
1048
|
if (icon && iconSet === "fontawesome" && prefix) {
|
|
878
1049
|
loadFAIcon(icon, prefix).then((ico) => setDynamicIcon(ico));
|
|
879
1050
|
}
|
|
@@ -952,7 +1123,7 @@ function Icon(props) {
|
|
|
952
1123
|
}
|
|
953
1124
|
|
|
954
1125
|
// src/components/Inputs/TextInput/TextInput.tsx
|
|
955
|
-
var
|
|
1126
|
+
var import_react10 = require("react");
|
|
956
1127
|
|
|
957
1128
|
// src/components/ui/input.tsx
|
|
958
1129
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -981,7 +1152,7 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
981
1152
|
const isDisabled = props.isDisabled ?? false;
|
|
982
1153
|
const isReadonly = props.isReadonly ?? false;
|
|
983
1154
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
984
|
-
(0,
|
|
1155
|
+
(0, import_react10.useEffect)(() => {
|
|
985
1156
|
if (props.value !== void 0) {
|
|
986
1157
|
const e = { target: { value: props.value }, type: "change" };
|
|
987
1158
|
handleChange?.(e);
|
|
@@ -1023,7 +1194,7 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
1023
1194
|
var TextInput_default = TextInput;
|
|
1024
1195
|
|
|
1025
1196
|
// src/components/Inputs/NumberInput/NumberInput.tsx
|
|
1026
|
-
var
|
|
1197
|
+
var import_react11 = require("react");
|
|
1027
1198
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1028
1199
|
var NumberInput = ({ className, style, ...props }) => {
|
|
1029
1200
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1031,7 +1202,7 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
1031
1202
|
const isDisabled = props.isDisabled ?? false;
|
|
1032
1203
|
const isReadonly = props.isReadonly ?? false;
|
|
1033
1204
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1034
|
-
(0,
|
|
1205
|
+
(0, import_react11.useEffect)(() => {
|
|
1035
1206
|
if (props.value !== void 0) {
|
|
1036
1207
|
const e = { target: { value: props.value }, type: "change" };
|
|
1037
1208
|
handleChange?.(e);
|
|
@@ -1073,7 +1244,7 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
1073
1244
|
var NumberInput_default = NumberInput;
|
|
1074
1245
|
|
|
1075
1246
|
// src/components/Inputs/EmailInput/EmailInput.tsx
|
|
1076
|
-
var
|
|
1247
|
+
var import_react12 = require("react");
|
|
1077
1248
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1078
1249
|
var EmailInput = ({ className, style, ...props }) => {
|
|
1079
1250
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1081,7 +1252,7 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
1081
1252
|
const isDisabled = props.isDisabled ?? false;
|
|
1082
1253
|
const isReadonly = props.isReadonly ?? false;
|
|
1083
1254
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1084
|
-
(0,
|
|
1255
|
+
(0, import_react12.useEffect)(() => {
|
|
1085
1256
|
if (props.value !== void 0) {
|
|
1086
1257
|
const e = { target: { value: props.value }, type: "change" };
|
|
1087
1258
|
handleChange?.(e);
|
|
@@ -1123,7 +1294,7 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
1123
1294
|
var EmailInput_default = EmailInput;
|
|
1124
1295
|
|
|
1125
1296
|
// src/components/Inputs/PasswordInput/PasswordInput.tsx
|
|
1126
|
-
var
|
|
1297
|
+
var import_react13 = require("react");
|
|
1127
1298
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1128
1299
|
var PasswordInput = ({ className, style, ...props }) => {
|
|
1129
1300
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1131,7 +1302,7 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
1131
1302
|
const isDisabled = props.isDisabled ?? false;
|
|
1132
1303
|
const isReadonly = props.isReadonly ?? false;
|
|
1133
1304
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1134
|
-
(0,
|
|
1305
|
+
(0, import_react13.useEffect)(() => {
|
|
1135
1306
|
if (props.value !== void 0) {
|
|
1136
1307
|
const e = { target: { value: props.value }, type: "change" };
|
|
1137
1308
|
handleChange?.(e);
|
|
@@ -1173,7 +1344,7 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
1173
1344
|
var PasswordInput_default = PasswordInput;
|
|
1174
1345
|
|
|
1175
1346
|
// src/components/Inputs/Textarea/Textarea.tsx
|
|
1176
|
-
var
|
|
1347
|
+
var import_react14 = require("react");
|
|
1177
1348
|
|
|
1178
1349
|
// src/components/ui/textarea.tsx
|
|
1179
1350
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
@@ -1199,7 +1370,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
1199
1370
|
const isDisabled = props.isDisabled ?? false;
|
|
1200
1371
|
const isReadonly = props.isReadonly ?? false;
|
|
1201
1372
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1202
|
-
(0,
|
|
1373
|
+
(0, import_react14.useEffect)(() => {
|
|
1203
1374
|
if (props.value !== void 0) {
|
|
1204
1375
|
const e = { target: { value: props.value }, type: "change" };
|
|
1205
1376
|
handleChange?.(e);
|
|
@@ -1233,7 +1404,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
1233
1404
|
var Textarea_default = Textarea2;
|
|
1234
1405
|
|
|
1235
1406
|
// src/components/Inputs/UrlInput/UrlInput.tsx
|
|
1236
|
-
var
|
|
1407
|
+
var import_react15 = require("react");
|
|
1237
1408
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1238
1409
|
var UrlInput = ({ className, style, ...props }) => {
|
|
1239
1410
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1241,7 +1412,7 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
1241
1412
|
const isDisabled = props.isDisabled ?? false;
|
|
1242
1413
|
const isReadonly = props.isReadonly ?? false;
|
|
1243
1414
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1244
|
-
(0,
|
|
1415
|
+
(0, import_react15.useEffect)(() => {
|
|
1245
1416
|
if (props.value !== void 0) {
|
|
1246
1417
|
const e = { target: { value: props.value }, type: "change" };
|
|
1247
1418
|
handleChange?.(e);
|
|
@@ -1286,7 +1457,7 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
1286
1457
|
var UrlInput_default = UrlInput;
|
|
1287
1458
|
|
|
1288
1459
|
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
1289
|
-
var
|
|
1460
|
+
var import_react16 = require("react");
|
|
1290
1461
|
|
|
1291
1462
|
// src/components/ui/checkbox.tsx
|
|
1292
1463
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
@@ -1352,7 +1523,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1352
1523
|
}
|
|
1353
1524
|
return false;
|
|
1354
1525
|
};
|
|
1355
|
-
(0,
|
|
1526
|
+
(0, import_react16.useEffect)(() => {
|
|
1356
1527
|
if (props.value) {
|
|
1357
1528
|
handleChange(formatValue(props.value));
|
|
1358
1529
|
}
|
|
@@ -1379,7 +1550,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
1379
1550
|
var Checkbox_default = CheckboxInput;
|
|
1380
1551
|
|
|
1381
1552
|
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
1382
|
-
var
|
|
1553
|
+
var import_react17 = require("react");
|
|
1383
1554
|
|
|
1384
1555
|
// src/components/ui/radio-group.tsx
|
|
1385
1556
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
@@ -1440,7 +1611,7 @@ var RadioInput = ({
|
|
|
1440
1611
|
value: item[dataKey || "value"],
|
|
1441
1612
|
label: item[dataLabel || "label"]
|
|
1442
1613
|
}));
|
|
1443
|
-
(0,
|
|
1614
|
+
(0, import_react17.useEffect)(() => {
|
|
1444
1615
|
if (props.value !== void 0) {
|
|
1445
1616
|
handleChange?.(props.value);
|
|
1446
1617
|
}
|
|
@@ -1470,7 +1641,7 @@ var RadioInput = ({
|
|
|
1470
1641
|
var RadioInput_default = RadioInput;
|
|
1471
1642
|
|
|
1472
1643
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
1473
|
-
var
|
|
1644
|
+
var import_react18 = require("react");
|
|
1474
1645
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1475
1646
|
function MultiCheckbox({
|
|
1476
1647
|
apiUrl,
|
|
@@ -1489,11 +1660,11 @@ function MultiCheckbox({
|
|
|
1489
1660
|
onUncheckItems,
|
|
1490
1661
|
...props
|
|
1491
1662
|
}) {
|
|
1492
|
-
const [options, setOptions] = (0,
|
|
1493
|
-
const [page, setPage] = (0,
|
|
1494
|
-
const [hasMore, setHasMore] = (0,
|
|
1495
|
-
const [pageLoading, setPageLoading] = (0,
|
|
1496
|
-
const loadMoreRef = (0,
|
|
1663
|
+
const [options, setOptions] = (0, import_react18.useState)([]);
|
|
1664
|
+
const [page, setPage] = (0, import_react18.useState)(1);
|
|
1665
|
+
const [hasMore, setHasMore] = (0, import_react18.useState)(true);
|
|
1666
|
+
const [pageLoading, setPageLoading] = (0, import_react18.useState)(false);
|
|
1667
|
+
const loadMoreRef = (0, import_react18.useRef)(null);
|
|
1497
1668
|
const normalizeInput = (val) => {
|
|
1498
1669
|
if (!val) return [];
|
|
1499
1670
|
if (Array.isArray(val)) return val;
|
|
@@ -1515,7 +1686,7 @@ function MultiCheckbox({
|
|
|
1515
1686
|
return arr;
|
|
1516
1687
|
}
|
|
1517
1688
|
};
|
|
1518
|
-
const fetchApiPage = (0,
|
|
1689
|
+
const fetchApiPage = (0, import_react18.useCallback)(async () => {
|
|
1519
1690
|
if (!apiUrl) return [];
|
|
1520
1691
|
const client = axiosInstance || (await import("axios")).default;
|
|
1521
1692
|
const res = await client.get(apiUrl, {
|
|
@@ -1527,7 +1698,7 @@ function MultiCheckbox({
|
|
|
1527
1698
|
}
|
|
1528
1699
|
return Array.isArray(res.data) ? res.data : [];
|
|
1529
1700
|
}, [apiUrl, axiosInstance, page, pageSize]);
|
|
1530
|
-
const mapData = (0,
|
|
1701
|
+
const mapData = (0, import_react18.useCallback)(
|
|
1531
1702
|
(items) => {
|
|
1532
1703
|
if (Array.isArray(items) === false) return [];
|
|
1533
1704
|
return (items || []).map((item) => ({
|
|
@@ -1537,7 +1708,7 @@ function MultiCheckbox({
|
|
|
1537
1708
|
},
|
|
1538
1709
|
[dataKey, dataLabel]
|
|
1539
1710
|
);
|
|
1540
|
-
const loadPage = (0,
|
|
1711
|
+
const loadPage = (0, import_react18.useCallback)(async () => {
|
|
1541
1712
|
if (source !== "api") return;
|
|
1542
1713
|
if (pageLoading) return;
|
|
1543
1714
|
setPageLoading(true);
|
|
@@ -1552,7 +1723,7 @@ function MultiCheckbox({
|
|
|
1552
1723
|
setPageLoading(false);
|
|
1553
1724
|
}
|
|
1554
1725
|
}, [source, pageLoading, fetchApiPage, mapData, pageSize]);
|
|
1555
|
-
(0,
|
|
1726
|
+
(0, import_react18.useEffect)(() => {
|
|
1556
1727
|
if (source === "api") {
|
|
1557
1728
|
setOptions([]);
|
|
1558
1729
|
setPage(1);
|
|
@@ -1562,10 +1733,10 @@ function MultiCheckbox({
|
|
|
1562
1733
|
setHasMore(false);
|
|
1563
1734
|
}
|
|
1564
1735
|
}, [source, JSON.stringify(data)]);
|
|
1565
|
-
(0,
|
|
1736
|
+
(0, import_react18.useEffect)(() => {
|
|
1566
1737
|
if (source === "api") loadPage();
|
|
1567
1738
|
}, [page, source]);
|
|
1568
|
-
(0,
|
|
1739
|
+
(0, import_react18.useEffect)(() => {
|
|
1569
1740
|
if (source !== "api") return;
|
|
1570
1741
|
if (!hasMore || pageLoading) return;
|
|
1571
1742
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -1629,10 +1800,10 @@ function MultiCheckbox({
|
|
|
1629
1800
|
}
|
|
1630
1801
|
|
|
1631
1802
|
// src/components/Inputs/RichText/RichText.tsx
|
|
1632
|
-
var
|
|
1803
|
+
var import_react20 = require("react");
|
|
1633
1804
|
|
|
1634
1805
|
// src/components/Global/TinyMceEditor.tsx
|
|
1635
|
-
var
|
|
1806
|
+
var import_react19 = require("react");
|
|
1636
1807
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
1637
1808
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1638
1809
|
function MyEditor({
|
|
@@ -1640,7 +1811,7 @@ function MyEditor({
|
|
|
1640
1811
|
onChange,
|
|
1641
1812
|
isDefault
|
|
1642
1813
|
}) {
|
|
1643
|
-
const editorRef = (0,
|
|
1814
|
+
const editorRef = (0, import_react19.useRef)(null);
|
|
1644
1815
|
function stripOuterP(html) {
|
|
1645
1816
|
const trimmedHtml = html.trim();
|
|
1646
1817
|
if (!trimmedHtml) return "";
|
|
@@ -1652,7 +1823,7 @@ function MyEditor({
|
|
|
1652
1823
|
}
|
|
1653
1824
|
return trimmedHtml;
|
|
1654
1825
|
}
|
|
1655
|
-
const isDefaultToolbar = (0,
|
|
1826
|
+
const isDefaultToolbar = (0, import_react19.useMemo)(() => {
|
|
1656
1827
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
1657
1828
|
if (isDefault) {
|
|
1658
1829
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -1705,7 +1876,7 @@ function MyEditor({
|
|
|
1705
1876
|
// src/components/Inputs/RichText/RichText.tsx
|
|
1706
1877
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1707
1878
|
function RichText({ className, style, ...props }) {
|
|
1708
|
-
(0,
|
|
1879
|
+
(0, import_react20.useEffect)(() => {
|
|
1709
1880
|
if (props.value !== void 0) {
|
|
1710
1881
|
handleChange?.(props.value);
|
|
1711
1882
|
}
|
|
@@ -1730,7 +1901,7 @@ function RichText({ className, style, ...props }) {
|
|
|
1730
1901
|
}
|
|
1731
1902
|
|
|
1732
1903
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
1733
|
-
var
|
|
1904
|
+
var import_react23 = require("react");
|
|
1734
1905
|
|
|
1735
1906
|
// src/components/ui/select.tsx
|
|
1736
1907
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
@@ -1860,23 +2031,23 @@ function SelectScrollDownButton({
|
|
|
1860
2031
|
}
|
|
1861
2032
|
|
|
1862
2033
|
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
1863
|
-
var
|
|
2034
|
+
var import_react22 = require("react");
|
|
1864
2035
|
var import_lucide_react7 = require("lucide-react");
|
|
1865
2036
|
|
|
1866
2037
|
// src/hooks/useLazyDropdown.ts
|
|
1867
|
-
var
|
|
2038
|
+
var import_react21 = require("react");
|
|
1868
2039
|
var import_axios2 = __toESM(require("axios"));
|
|
1869
2040
|
function useLazyDropdown(config) {
|
|
1870
|
-
const [options, setOptions] = (0,
|
|
1871
|
-
const [page, setPage] = (0,
|
|
1872
|
-
const [hasMore, setHasMore] = (0,
|
|
1873
|
-
const [loading, setLoading] = (0,
|
|
1874
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
1875
|
-
const debounceTimer = (0,
|
|
1876
|
-
const allDataRef = (0,
|
|
1877
|
-
const configRef = (0,
|
|
2041
|
+
const [options, setOptions] = (0, import_react21.useState)([]);
|
|
2042
|
+
const [page, setPage] = (0, import_react21.useState)(1);
|
|
2043
|
+
const [hasMore, setHasMore] = (0, import_react21.useState)(true);
|
|
2044
|
+
const [loading, setLoading] = (0, import_react21.useState)(false);
|
|
2045
|
+
const [searchTerm, setSearchTerm] = (0, import_react21.useState)("");
|
|
2046
|
+
const debounceTimer = (0, import_react21.useRef)(null);
|
|
2047
|
+
const allDataRef = (0, import_react21.useRef)([]);
|
|
2048
|
+
const configRef = (0, import_react21.useRef)(config);
|
|
1878
2049
|
const PAGE_SIZE = config.pageSize || 10;
|
|
1879
|
-
(0,
|
|
2050
|
+
(0, import_react21.useEffect)(() => {
|
|
1880
2051
|
setOptions([]);
|
|
1881
2052
|
setPage(1);
|
|
1882
2053
|
setHasMore(true);
|
|
@@ -1889,7 +2060,7 @@ function useLazyDropdown(config) {
|
|
|
1889
2060
|
return true;
|
|
1890
2061
|
});
|
|
1891
2062
|
};
|
|
1892
|
-
(0,
|
|
2063
|
+
(0, import_react21.useEffect)(() => {
|
|
1893
2064
|
configRef.current = config;
|
|
1894
2065
|
}, [config]);
|
|
1895
2066
|
function getValueByPath2(obj, path) {
|
|
@@ -1897,7 +2068,7 @@ function useLazyDropdown(config) {
|
|
|
1897
2068
|
const parts = path.split(/\./);
|
|
1898
2069
|
return parts.reduce((acc, key) => acc?.[key], obj);
|
|
1899
2070
|
}
|
|
1900
|
-
const transformToOptions = (0,
|
|
2071
|
+
const transformToOptions = (0, import_react21.useCallback)((data) => {
|
|
1901
2072
|
if (!data || !Array.isArray(data)) return [];
|
|
1902
2073
|
const cfg = configRef.current;
|
|
1903
2074
|
return data.map((item) => {
|
|
@@ -1935,7 +2106,7 @@ function useLazyDropdown(config) {
|
|
|
1935
2106
|
params: cleaned
|
|
1936
2107
|
};
|
|
1937
2108
|
}
|
|
1938
|
-
const fetchApiData = (0,
|
|
2109
|
+
const fetchApiData = (0, import_react21.useCallback)(async (pageNum, term) => {
|
|
1939
2110
|
if (!configRef.current.apiUrl) return [];
|
|
1940
2111
|
const limit = PAGE_SIZE;
|
|
1941
2112
|
const params = { page: pageNum, limit };
|
|
@@ -1960,7 +2131,7 @@ function useLazyDropdown(config) {
|
|
|
1960
2131
|
}
|
|
1961
2132
|
return [];
|
|
1962
2133
|
}, [PAGE_SIZE, transformToOptions]);
|
|
1963
|
-
const loadPage = (0,
|
|
2134
|
+
const loadPage = (0, import_react21.useCallback)(async (pageNum, term) => {
|
|
1964
2135
|
const cfg = configRef.current;
|
|
1965
2136
|
if (!cfg.enabled) return;
|
|
1966
2137
|
setLoading(true);
|
|
@@ -2037,7 +2208,7 @@ function useLazyDropdown(config) {
|
|
|
2037
2208
|
setLoading(false);
|
|
2038
2209
|
}
|
|
2039
2210
|
};
|
|
2040
|
-
(0,
|
|
2211
|
+
(0, import_react21.useEffect)(() => {
|
|
2041
2212
|
const cfg = configRef.current;
|
|
2042
2213
|
if (!cfg.enabled || !cfg.value || cfg.dataSource !== "api" || !cfg.apiUrl) return;
|
|
2043
2214
|
if (cfg.isMultiSelect) {
|
|
@@ -2050,28 +2221,28 @@ function useLazyDropdown(config) {
|
|
|
2050
2221
|
}
|
|
2051
2222
|
fetchValueItem();
|
|
2052
2223
|
}, [JSON.stringify(config.value), config.dataKey, config.apiUrl, config.dataSource]);
|
|
2053
|
-
const loadMore = (0,
|
|
2224
|
+
const loadMore = (0, import_react21.useCallback)(() => {
|
|
2054
2225
|
if (!loading && hasMore) {
|
|
2055
2226
|
loadPage(page + 1, searchTerm);
|
|
2056
2227
|
}
|
|
2057
2228
|
}, [loading, hasMore, page, searchTerm]);
|
|
2058
|
-
const search = (0,
|
|
2229
|
+
const search = (0, import_react21.useCallback)((term) => {
|
|
2059
2230
|
setSearchTerm(term);
|
|
2060
2231
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
2061
2232
|
debounceTimer.current = setTimeout(() => {
|
|
2062
2233
|
loadPage(1, term);
|
|
2063
2234
|
}, 300);
|
|
2064
2235
|
}, []);
|
|
2065
|
-
const reset = (0,
|
|
2236
|
+
const reset = (0, import_react21.useCallback)(() => {
|
|
2066
2237
|
setSearchTerm("");
|
|
2067
2238
|
setPage(1);
|
|
2068
2239
|
}, []);
|
|
2069
|
-
(0,
|
|
2240
|
+
(0, import_react21.useEffect)(() => {
|
|
2070
2241
|
if (config.initialData?.length) {
|
|
2071
2242
|
allDataRef.current = config.initialData;
|
|
2072
2243
|
}
|
|
2073
2244
|
}, [config.initialData]);
|
|
2074
|
-
(0,
|
|
2245
|
+
(0, import_react21.useEffect)(() => {
|
|
2075
2246
|
if (config.fetchOnMount) loadPage(1, "");
|
|
2076
2247
|
return () => {
|
|
2077
2248
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
@@ -2137,10 +2308,10 @@ function LazySelectDropdown({
|
|
|
2137
2308
|
enforceStrictQueryParams = false,
|
|
2138
2309
|
...props
|
|
2139
2310
|
}) {
|
|
2140
|
-
const [isOpen, setIsOpen] = (0,
|
|
2141
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2142
|
-
const dropdownRef = (0,
|
|
2143
|
-
const observerTarget = (0,
|
|
2311
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
2312
|
+
const [searchTerm, setSearchTerm] = (0, import_react22.useState)("");
|
|
2313
|
+
const dropdownRef = (0, import_react22.useRef)(null);
|
|
2314
|
+
const observerTarget = (0, import_react22.useRef)(null);
|
|
2144
2315
|
const {
|
|
2145
2316
|
options: lazyOptions,
|
|
2146
2317
|
loading,
|
|
@@ -2162,8 +2333,8 @@ function LazySelectDropdown({
|
|
|
2162
2333
|
axiosInstance,
|
|
2163
2334
|
enforceStrictQueryParams
|
|
2164
2335
|
});
|
|
2165
|
-
const selectedOption = (0,
|
|
2166
|
-
(0,
|
|
2336
|
+
const selectedOption = (0, import_react22.useMemo)(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
2337
|
+
(0, import_react22.useEffect)(() => {
|
|
2167
2338
|
const handleClickOutside = (e) => {
|
|
2168
2339
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2169
2340
|
setIsOpen(false);
|
|
@@ -2173,7 +2344,7 @@ function LazySelectDropdown({
|
|
|
2173
2344
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2174
2345
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2175
2346
|
}, []);
|
|
2176
|
-
(0,
|
|
2347
|
+
(0, import_react22.useEffect)(() => {
|
|
2177
2348
|
if (!isOpen || !hasMore || loading) return;
|
|
2178
2349
|
const observer = new IntersectionObserver(
|
|
2179
2350
|
(entries) => {
|
|
@@ -2317,7 +2488,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2317
2488
|
const isEditable = props.isEditable ?? true;
|
|
2318
2489
|
const isDisabled = props.isDisabled ?? false;
|
|
2319
2490
|
const isReadonly = props.isReadonly ?? false;
|
|
2320
|
-
(0,
|
|
2491
|
+
(0, import_react23.useEffect)(() => {
|
|
2321
2492
|
if (props.value !== void 0) {
|
|
2322
2493
|
handleChange(props.value);
|
|
2323
2494
|
}
|
|
@@ -2376,7 +2547,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
2376
2547
|
var Dropdown_default = Dropdown;
|
|
2377
2548
|
|
|
2378
2549
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
2379
|
-
var
|
|
2550
|
+
var import_react24 = require("react");
|
|
2380
2551
|
|
|
2381
2552
|
// src/components/ui/switch.tsx
|
|
2382
2553
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
@@ -2412,7 +2583,7 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
|
2412
2583
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
2413
2584
|
const isEditable = props.isEditable ?? true;
|
|
2414
2585
|
const isDisabled = props.isDisabled ?? false;
|
|
2415
|
-
(0,
|
|
2586
|
+
(0, import_react24.useEffect)(() => {
|
|
2416
2587
|
if (props.value !== void 0) {
|
|
2417
2588
|
handleChange?.(props.value);
|
|
2418
2589
|
}
|
|
@@ -2439,7 +2610,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
2439
2610
|
var SwitchToggle_default = SwitchToggle;
|
|
2440
2611
|
|
|
2441
2612
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
2442
|
-
var
|
|
2613
|
+
var import_react25 = require("react");
|
|
2443
2614
|
var import_react_international_phone = require("react-international-phone");
|
|
2444
2615
|
var import_style = require("react-international-phone/style.css");
|
|
2445
2616
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
@@ -2454,7 +2625,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
2454
2625
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
2455
2626
|
const isEditable = props.isEditable ?? true;
|
|
2456
2627
|
const isDisabled = props.isDisabled ?? false;
|
|
2457
|
-
(0,
|
|
2628
|
+
(0, import_react25.useEffect)(() => {
|
|
2458
2629
|
if (props.value !== void 0) {
|
|
2459
2630
|
const normalized = ensureIndiaCode(props.value);
|
|
2460
2631
|
handleChange?.(normalized);
|
|
@@ -2501,7 +2672,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
2501
2672
|
var PhoneInput_default = PhoneInput;
|
|
2502
2673
|
|
|
2503
2674
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
2504
|
-
var
|
|
2675
|
+
var import_react26 = require("react");
|
|
2505
2676
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2506
2677
|
var SearchInput = ({ className, style, ...props }) => {
|
|
2507
2678
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -2509,7 +2680,7 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
2509
2680
|
const isDisabled = props.isDisabled ?? false;
|
|
2510
2681
|
const isReadonly = props.isReadonly ?? false;
|
|
2511
2682
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2512
|
-
(0,
|
|
2683
|
+
(0, import_react26.useEffect)(() => {
|
|
2513
2684
|
if (props.value !== void 0) {
|
|
2514
2685
|
const e = { target: { value: props.value }, type: "change" };
|
|
2515
2686
|
handleChange?.(e);
|
|
@@ -2551,11 +2722,11 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
2551
2722
|
var SearchInput_default = SearchInput;
|
|
2552
2723
|
|
|
2553
2724
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
2554
|
-
var
|
|
2725
|
+
var import_react27 = require("react");
|
|
2555
2726
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2556
2727
|
var FileInput = ({ className, style, ...props }) => {
|
|
2557
2728
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
2558
|
-
(0,
|
|
2729
|
+
(0, import_react27.useEffect)(() => {
|
|
2559
2730
|
if (props.value !== void 0) {
|
|
2560
2731
|
const e = { target: { value: props.value }, type: "change" };
|
|
2561
2732
|
handleChange?.(e);
|
|
@@ -2595,12 +2766,12 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
2595
2766
|
var FileInput_default = FileInput;
|
|
2596
2767
|
|
|
2597
2768
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
2598
|
-
var
|
|
2769
|
+
var React8 = __toESM(require("react"));
|
|
2599
2770
|
var import_date_fns = require("date-fns");
|
|
2600
2771
|
var import_lucide_react9 = require("lucide-react");
|
|
2601
2772
|
|
|
2602
2773
|
// src/components/ui/calendar.tsx
|
|
2603
|
-
var
|
|
2774
|
+
var React7 = __toESM(require("react"));
|
|
2604
2775
|
var import_lucide_react8 = require("lucide-react");
|
|
2605
2776
|
var import_react_day_picker = require("react-day-picker");
|
|
2606
2777
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
@@ -2756,8 +2927,8 @@ function CalendarDayButton({
|
|
|
2756
2927
|
...props
|
|
2757
2928
|
}) {
|
|
2758
2929
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
2759
|
-
const ref =
|
|
2760
|
-
|
|
2930
|
+
const ref = React7.useRef(null);
|
|
2931
|
+
React7.useEffect(() => {
|
|
2761
2932
|
if (modifiers.focused) ref.current?.focus();
|
|
2762
2933
|
}, [modifiers.focused]);
|
|
2763
2934
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -2851,25 +3022,25 @@ function DateTimePicker({
|
|
|
2851
3022
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
2852
3023
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
2853
3024
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
2854
|
-
const [date, setDate] =
|
|
3025
|
+
const [date, setDate] = React8.useState(() => {
|
|
2855
3026
|
if (!props.value) return void 0;
|
|
2856
3027
|
const d = new Date(props.value);
|
|
2857
3028
|
return isNaN(d.getTime()) ? void 0 : d;
|
|
2858
3029
|
});
|
|
2859
3030
|
const initialHours = date ? date.getHours() : 0;
|
|
2860
3031
|
const initialMinutes = date ? date.getMinutes() : 0;
|
|
2861
|
-
const [hours, setHours] =
|
|
2862
|
-
const [minutes, setMinutes] =
|
|
2863
|
-
const [amPm, setAmPm] =
|
|
2864
|
-
const displayHours =
|
|
3032
|
+
const [hours, setHours] = React8.useState(initialHours);
|
|
3033
|
+
const [minutes, setMinutes] = React8.useState(initialMinutes);
|
|
3034
|
+
const [amPm, setAmPm] = React8.useState("AM");
|
|
3035
|
+
const displayHours = React8.useMemo(() => {
|
|
2865
3036
|
if (hours === 0) return 12;
|
|
2866
3037
|
if (hours > 12) return hours - 12;
|
|
2867
3038
|
return hours;
|
|
2868
3039
|
}, [hours]);
|
|
2869
|
-
|
|
3040
|
+
React8.useEffect(() => {
|
|
2870
3041
|
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
2871
3042
|
}, [hours]);
|
|
2872
|
-
|
|
3043
|
+
React8.useEffect(() => {
|
|
2873
3044
|
if (!props.value) {
|
|
2874
3045
|
setDate(void 0);
|
|
2875
3046
|
return;
|
|
@@ -2881,8 +3052,8 @@ function DateTimePicker({
|
|
|
2881
3052
|
setMinutes(d.getMinutes());
|
|
2882
3053
|
}
|
|
2883
3054
|
}, [props.value]);
|
|
2884
|
-
const [year, setYear] =
|
|
2885
|
-
|
|
3055
|
+
const [year, setYear] = React8.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
3056
|
+
React8.useEffect(() => {
|
|
2886
3057
|
if (!date) return;
|
|
2887
3058
|
const newDate = new Date(date);
|
|
2888
3059
|
newDate.setFullYear(year);
|
|
@@ -2985,7 +3156,7 @@ function DateTimePicker({
|
|
|
2985
3156
|
for (let y = currentYear - 50; y <= currentYear + 10; y++) {
|
|
2986
3157
|
yearOptions.push(y);
|
|
2987
3158
|
}
|
|
2988
|
-
const displayValue =
|
|
3159
|
+
const displayValue = React8.useMemo(() => {
|
|
2989
3160
|
if (!date) return "";
|
|
2990
3161
|
try {
|
|
2991
3162
|
if (mode === "date") return (0, import_date_fns.format)(date, "dd-MM-yyyy");
|
|
@@ -2996,11 +3167,11 @@ function DateTimePicker({
|
|
|
2996
3167
|
}
|
|
2997
3168
|
}, [date, mode]);
|
|
2998
3169
|
const isInputDisabled = isDisabled || !isEditable;
|
|
2999
|
-
const [calendarMonthState, setCalendarMonthState] =
|
|
3170
|
+
const [calendarMonthState, setCalendarMonthState] = React8.useState(() => {
|
|
3000
3171
|
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
3001
3172
|
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
3002
3173
|
});
|
|
3003
|
-
|
|
3174
|
+
React8.useEffect(() => {
|
|
3004
3175
|
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
3005
3176
|
}, [year]);
|
|
3006
3177
|
const handleToday = () => {
|
|
@@ -3146,18 +3317,18 @@ function DateTimePicker({
|
|
|
3146
3317
|
}
|
|
3147
3318
|
|
|
3148
3319
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
3149
|
-
var
|
|
3320
|
+
var import_react28 = __toESM(require("react"));
|
|
3150
3321
|
var import_date_fns2 = require("date-fns");
|
|
3151
3322
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3152
3323
|
var DateRange = ({ className, style, ...props }) => {
|
|
3153
3324
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
3154
|
-
const [date, setDate] =
|
|
3325
|
+
const [date, setDate] = import_react28.default.useState(
|
|
3155
3326
|
isDateRange(props.value) ? props.value : {
|
|
3156
3327
|
from: /* @__PURE__ */ new Date(),
|
|
3157
3328
|
to: (0, import_date_fns2.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
3158
3329
|
}
|
|
3159
3330
|
);
|
|
3160
|
-
(0,
|
|
3331
|
+
(0, import_react28.useEffect)(() => {
|
|
3161
3332
|
if (props.value && isDateRange(props.value)) {
|
|
3162
3333
|
handleChange?.(props.value);
|
|
3163
3334
|
}
|
|
@@ -3204,7 +3375,7 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
3204
3375
|
var DateRange_default = DateRange;
|
|
3205
3376
|
|
|
3206
3377
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
3207
|
-
var
|
|
3378
|
+
var import_react29 = require("react");
|
|
3208
3379
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3209
3380
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
3210
3381
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -3212,7 +3383,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3212
3383
|
const isDisabled = props.isDisabled ?? false;
|
|
3213
3384
|
const isReadonly = props.isReadonly ?? false;
|
|
3214
3385
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
3215
|
-
(0,
|
|
3386
|
+
(0, import_react29.useEffect)(() => {
|
|
3216
3387
|
if (props.value !== void 0) {
|
|
3217
3388
|
const e = { target: { value: props.value }, type: "change" };
|
|
3218
3389
|
handleChange?.(e);
|
|
@@ -3265,7 +3436,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
3265
3436
|
var TextInputGroup_default = TextInputGroup;
|
|
3266
3437
|
|
|
3267
3438
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
3268
|
-
var
|
|
3439
|
+
var import_react30 = require("react");
|
|
3269
3440
|
var import_lucide_react10 = require("lucide-react");
|
|
3270
3441
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3271
3442
|
function LazyMultiSelectDropdown({
|
|
@@ -3286,10 +3457,10 @@ function LazyMultiSelectDropdown({
|
|
|
3286
3457
|
outputFormat = "array",
|
|
3287
3458
|
...props
|
|
3288
3459
|
}) {
|
|
3289
|
-
const [isOpen, setIsOpen] = (0,
|
|
3290
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
3291
|
-
const dropdownRef = (0,
|
|
3292
|
-
const observerTarget = (0,
|
|
3460
|
+
const [isOpen, setIsOpen] = (0, import_react30.useState)(false);
|
|
3461
|
+
const [searchTerm, setSearchTerm] = (0, import_react30.useState)("");
|
|
3462
|
+
const dropdownRef = (0, import_react30.useRef)(null);
|
|
3463
|
+
const observerTarget = (0, import_react30.useRef)(null);
|
|
3293
3464
|
const ensureUnique = (arr) => {
|
|
3294
3465
|
return Array.from(new Set(arr));
|
|
3295
3466
|
};
|
|
@@ -3338,14 +3509,14 @@ function LazyMultiSelectDropdown({
|
|
|
3338
3509
|
return unique;
|
|
3339
3510
|
}
|
|
3340
3511
|
};
|
|
3341
|
-
const selectedOptions = (0,
|
|
3512
|
+
const selectedOptions = (0, import_react30.useMemo)(() => {
|
|
3342
3513
|
return normalizedValue.map((id2) => {
|
|
3343
3514
|
const fromLazy = lazyOptions.find((opt) => opt.value === id2);
|
|
3344
3515
|
if (fromLazy) return fromLazy;
|
|
3345
3516
|
return { value: id2, label: id2 };
|
|
3346
3517
|
});
|
|
3347
3518
|
}, [normalizedValue, lazyOptions]);
|
|
3348
|
-
(0,
|
|
3519
|
+
(0, import_react30.useEffect)(() => {
|
|
3349
3520
|
const handleClick = (e) => {
|
|
3350
3521
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
3351
3522
|
setIsOpen(false);
|
|
@@ -3354,7 +3525,7 @@ function LazyMultiSelectDropdown({
|
|
|
3354
3525
|
document.addEventListener("mousedown", handleClick);
|
|
3355
3526
|
return () => document.removeEventListener("mousedown", handleClick);
|
|
3356
3527
|
}, []);
|
|
3357
|
-
(0,
|
|
3528
|
+
(0, import_react30.useEffect)(() => {
|
|
3358
3529
|
if (!isOpen || !hasMore || loading) return;
|
|
3359
3530
|
const obs = new IntersectionObserver(
|
|
3360
3531
|
(entries) => {
|
|
@@ -3488,7 +3659,7 @@ function LazyMultiSelectDropdown({
|
|
|
3488
3659
|
}
|
|
3489
3660
|
|
|
3490
3661
|
// src/components/ui/data-table.tsx
|
|
3491
|
-
var
|
|
3662
|
+
var React11 = __toESM(require("react"));
|
|
3492
3663
|
var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
|
|
3493
3664
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
3494
3665
|
var import_react_table2 = require("@tanstack/react-table");
|
|
@@ -3583,7 +3754,7 @@ function TableCell({ className, ...props }) {
|
|
|
3583
3754
|
var import_react_table = require("@tanstack/react-table");
|
|
3584
3755
|
|
|
3585
3756
|
// src/lib/table/cellRendererFactory.tsx
|
|
3586
|
-
var
|
|
3757
|
+
var import_react31 = __toESM(require("react"));
|
|
3587
3758
|
var LucideIcons2 = __toESM(require("lucide-react"));
|
|
3588
3759
|
var import_lucide_react11 = require("lucide-react");
|
|
3589
3760
|
var import_image = __toESM(require("next/image"));
|
|
@@ -3671,9 +3842,9 @@ var getContrastColor = (bg) => {
|
|
|
3671
3842
|
};
|
|
3672
3843
|
var sanitizeValue = (val) => {
|
|
3673
3844
|
if (val == null) return null;
|
|
3674
|
-
if (
|
|
3845
|
+
if (import_react31.default.isValidElement(val)) return val;
|
|
3675
3846
|
if (typeof val === "string" || typeof val === "number") return val;
|
|
3676
|
-
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3847
|
+
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react31.default.Fragment, { children: sanitizeValue(v) }, i));
|
|
3677
3848
|
if (typeof val === "object") {
|
|
3678
3849
|
if ("name" in val && typeof val.name === "string") return val.name;
|
|
3679
3850
|
if ("label" in val && typeof val.label === "string") return val.label;
|
|
@@ -3930,10 +4101,10 @@ function DataTable({
|
|
|
3930
4101
|
enableRowSelection = false,
|
|
3931
4102
|
getRowSelection
|
|
3932
4103
|
}) {
|
|
3933
|
-
const [columnFilters, setColumnFilters] =
|
|
3934
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3935
|
-
const [manualSort, setManualSort] =
|
|
3936
|
-
const [searchTerm, setSearchTerm] =
|
|
4104
|
+
const [columnFilters, setColumnFilters] = React11.useState([]);
|
|
4105
|
+
const [columnVisibility, setColumnVisibility] = React11.useState({});
|
|
4106
|
+
const [manualSort, setManualSort] = React11.useState(null);
|
|
4107
|
+
const [searchTerm, setSearchTerm] = React11.useState("");
|
|
3937
4108
|
const tableData = Array.isArray(data) ? data : [];
|
|
3938
4109
|
const finalCols = [...columns];
|
|
3939
4110
|
if (enableRowSelection) {
|
|
@@ -3959,8 +4130,8 @@ function DataTable({
|
|
|
3959
4130
|
});
|
|
3960
4131
|
}
|
|
3961
4132
|
const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
|
|
3962
|
-
const [rowSelection, setRowSelection] =
|
|
3963
|
-
const [localPageSize, setLocalPageSize] =
|
|
4133
|
+
const [rowSelection, setRowSelection] = React11.useState({});
|
|
4134
|
+
const [localPageSize, setLocalPageSize] = React11.useState(pageSize);
|
|
3964
4135
|
const table = (0, import_react_table2.useReactTable)({
|
|
3965
4136
|
data: tableData,
|
|
3966
4137
|
columns: dynamicCols,
|
|
@@ -4025,7 +4196,7 @@ function DataTable({
|
|
|
4025
4196
|
onPageChange?.(currentPageIndex, newSize);
|
|
4026
4197
|
setLocalPageSize(newSize);
|
|
4027
4198
|
};
|
|
4028
|
-
const pageSizeOptions =
|
|
4199
|
+
const pageSizeOptions = React11.useMemo(() => {
|
|
4029
4200
|
const options = [5, 10, 20, 50, 100].filter((size) => size < totalRecords);
|
|
4030
4201
|
if (options.length === 0) {
|
|
4031
4202
|
options.push(5);
|
|
@@ -4220,7 +4391,7 @@ function DataTable({
|
|
|
4220
4391
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
4221
4392
|
TableCell,
|
|
4222
4393
|
{
|
|
4223
|
-
className: `break-words whitespace-normal align-top ${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
|
|
4394
|
+
className: `break-words whitespace-normal align-top ${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2 `,
|
|
4224
4395
|
style: {
|
|
4225
4396
|
width: cell.column.getSize(),
|
|
4226
4397
|
minWidth: cell.column.columnDef.minSize,
|
|
@@ -4234,7 +4405,7 @@ function DataTable({
|
|
|
4234
4405
|
},
|
|
4235
4406
|
children: [
|
|
4236
4407
|
(0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
4237
|
-
isLastCell && rowActions && rowActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "absolute
|
|
4408
|
+
isLastCell && rowActions && rowActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "absolute p-1 px-2 inset-y-0 right-0 flex items-center transition-opacity duration-200", children: rowActions.map((action) => {
|
|
4238
4409
|
const isDelete = action.id === "delete" || action.icon === "delete";
|
|
4239
4410
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4240
4411
|
"button",
|
|
@@ -4369,7 +4540,7 @@ var Table2 = ({
|
|
|
4369
4540
|
onCellClick?.({ id: cell.id, column: cell, columnId });
|
|
4370
4541
|
},
|
|
4371
4542
|
onDeleteRow: (cell) => {
|
|
4372
|
-
onDeleteRow?.(cell.id);
|
|
4543
|
+
onDeleteRow?.({ id: cell.id });
|
|
4373
4544
|
}
|
|
4374
4545
|
}
|
|
4375
4546
|
) });
|
|
@@ -4584,7 +4755,7 @@ var CustomPagination = ({
|
|
|
4584
4755
|
var Pagination_default = CustomPagination;
|
|
4585
4756
|
|
|
4586
4757
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
4587
|
-
var
|
|
4758
|
+
var import_react32 = require("react");
|
|
4588
4759
|
var import_lucide_react15 = require("lucide-react");
|
|
4589
4760
|
|
|
4590
4761
|
// src/components/ui/accordion.tsx
|
|
@@ -4710,7 +4881,7 @@ var HistoryTimeline = ({
|
|
|
4710
4881
|
createdAtKey,
|
|
4711
4882
|
...props
|
|
4712
4883
|
}) => {
|
|
4713
|
-
const data = (0,
|
|
4884
|
+
const data = (0, import_react32.useMemo)(() => {
|
|
4714
4885
|
if (Array.isArray(props.data)) {
|
|
4715
4886
|
return props.data;
|
|
4716
4887
|
}
|
|
@@ -4787,7 +4958,7 @@ var HistoryTimeline = ({
|
|
|
4787
4958
|
var HistoryTimeline_default = HistoryTimeline;
|
|
4788
4959
|
|
|
4789
4960
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
4790
|
-
var
|
|
4961
|
+
var import_react33 = require("react");
|
|
4791
4962
|
var import_lucide_react17 = require("lucide-react");
|
|
4792
4963
|
var import_link3 = __toESM(require("next/link"));
|
|
4793
4964
|
var import_navigation2 = require("next/navigation");
|
|
@@ -4976,7 +5147,7 @@ function showConfirmToast({
|
|
|
4976
5147
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
4977
5148
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4978
5149
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
4979
|
-
const [openIndex, setOpenIndex] = (0,
|
|
5150
|
+
const [openIndex, setOpenIndex] = (0, import_react33.useState)(null);
|
|
4980
5151
|
const currentPathname = (0, import_navigation2.usePathname)();
|
|
4981
5152
|
function groupMenus(menus = []) {
|
|
4982
5153
|
const menuMap = /* @__PURE__ */ new Map();
|
|
@@ -5010,7 +5181,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5010
5181
|
});
|
|
5011
5182
|
return sortMenus(rootMenus);
|
|
5012
5183
|
}
|
|
5013
|
-
const rawTabs = (0,
|
|
5184
|
+
const rawTabs = (0, import_react33.useMemo)(() => {
|
|
5014
5185
|
if (!Array.isArray(tabs)) return [];
|
|
5015
5186
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
5016
5187
|
return groupMenus(tabs);
|
|
@@ -5040,9 +5211,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5040
5211
|
return tab.children.some((child) => isActive(child.url));
|
|
5041
5212
|
};
|
|
5042
5213
|
const router = (0, import_navigation2.useRouter)();
|
|
5043
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
5044
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
5045
|
-
const handleBuilderExit = (0,
|
|
5214
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react33.useState)(false);
|
|
5215
|
+
const [pendingUrl, setPendingUrl] = (0, import_react33.useState)(null);
|
|
5216
|
+
const handleBuilderExit = (0, import_react33.useCallback)(
|
|
5046
5217
|
(e, url) => {
|
|
5047
5218
|
if (isBuilder) {
|
|
5048
5219
|
e.preventDefault();
|
|
@@ -5209,7 +5380,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
5209
5380
|
var Tabs_default = Tabs;
|
|
5210
5381
|
|
|
5211
5382
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5212
|
-
var
|
|
5383
|
+
var import_react34 = __toESM(require("react"));
|
|
5213
5384
|
|
|
5214
5385
|
// src/components/ui/tooltip.tsx
|
|
5215
5386
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
@@ -5278,11 +5449,11 @@ var StagesComponent = ({
|
|
|
5278
5449
|
triggerOnClick = false,
|
|
5279
5450
|
canvasMode = "desktop"
|
|
5280
5451
|
}) => {
|
|
5281
|
-
const [activeStage, setActiveStage] = (0,
|
|
5282
|
-
const [isCompleted, setIsCompleted] = (0,
|
|
5283
|
-
const [activeChildStage, setActiveChildStage] = (0,
|
|
5284
|
-
const [activeRootStage, setActiveRootStage] = (0,
|
|
5285
|
-
(0,
|
|
5452
|
+
const [activeStage, setActiveStage] = (0, import_react34.useState)("");
|
|
5453
|
+
const [isCompleted, setIsCompleted] = (0, import_react34.useState)(false);
|
|
5454
|
+
const [activeChildStage, setActiveChildStage] = (0, import_react34.useState)(null);
|
|
5455
|
+
const [activeRootStage, setActiveRootStage] = (0, import_react34.useState)(null);
|
|
5456
|
+
(0, import_react34.useEffect)(() => {
|
|
5286
5457
|
if (currentStage) {
|
|
5287
5458
|
setActiveStage(currentStage);
|
|
5288
5459
|
} else {
|
|
@@ -5342,7 +5513,7 @@ var StagesComponent = ({
|
|
|
5342
5513
|
}
|
|
5343
5514
|
return { activeRoot: null, activeChild: null };
|
|
5344
5515
|
};
|
|
5345
|
-
(0,
|
|
5516
|
+
(0, import_react34.useEffect)(() => {
|
|
5346
5517
|
if (!currentStage || !Array.isArray(stages)) {
|
|
5347
5518
|
setActiveRootStage(null);
|
|
5348
5519
|
setActiveChildStage(null);
|
|
@@ -5404,7 +5575,7 @@ var StagesComponent = ({
|
|
|
5404
5575
|
}
|
|
5405
5576
|
}
|
|
5406
5577
|
const stageKey = typeof stage[dataKey] === "string" ? stage[dataKey] : JSON.stringify(stage[dataKey]);
|
|
5407
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_react34.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Tooltip, { delayDuration: 500, disableHoverableContent: true, children: [
|
|
5408
5579
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5409
5580
|
"button",
|
|
5410
5581
|
{
|
|
@@ -5473,17 +5644,17 @@ var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
|
5473
5644
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
5474
5645
|
|
|
5475
5646
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5476
|
-
var
|
|
5647
|
+
var import_react35 = require("react");
|
|
5477
5648
|
var import_lucide_react18 = require("lucide-react");
|
|
5478
5649
|
var import_image2 = __toESM(require("next/image"));
|
|
5479
5650
|
var import_link4 = __toESM(require("next/link"));
|
|
5480
5651
|
var import_navigation3 = require("next/navigation");
|
|
5481
5652
|
|
|
5482
5653
|
// src/components/ui/avatar.tsx
|
|
5483
|
-
var
|
|
5654
|
+
var React13 = __toESM(require("react"));
|
|
5484
5655
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
5485
5656
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
5486
|
-
var Avatar =
|
|
5657
|
+
var Avatar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5487
5658
|
AvatarPrimitive.Root,
|
|
5488
5659
|
{
|
|
5489
5660
|
ref,
|
|
@@ -5495,7 +5666,7 @@ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5495
5666
|
}
|
|
5496
5667
|
));
|
|
5497
5668
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
5498
|
-
var AvatarImage =
|
|
5669
|
+
var AvatarImage = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5499
5670
|
AvatarPrimitive.Image,
|
|
5500
5671
|
{
|
|
5501
5672
|
ref,
|
|
@@ -5504,7 +5675,7 @@ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5504
5675
|
}
|
|
5505
5676
|
));
|
|
5506
5677
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
5507
|
-
var AvatarFallback =
|
|
5678
|
+
var AvatarFallback = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5508
5679
|
AvatarPrimitive.Fallback,
|
|
5509
5680
|
{
|
|
5510
5681
|
ref,
|
|
@@ -5539,10 +5710,10 @@ function Navbar({
|
|
|
5539
5710
|
onSearch
|
|
5540
5711
|
}) {
|
|
5541
5712
|
const router = (0, import_navigation3.useRouter)();
|
|
5542
|
-
const [screenMode, setScreenMode] = (0,
|
|
5713
|
+
const [screenMode, setScreenMode] = (0, import_react35.useState)(
|
|
5543
5714
|
canvasMode
|
|
5544
5715
|
);
|
|
5545
|
-
(0,
|
|
5716
|
+
(0, import_react35.useEffect)(() => {
|
|
5546
5717
|
const detectMode = () => {
|
|
5547
5718
|
if (window.innerWidth < 640) setScreenMode("mobile");
|
|
5548
5719
|
else if (window.innerWidth < 1024) setScreenMode("tablet");
|
|
@@ -5556,7 +5727,7 @@ function Navbar({
|
|
|
5556
5727
|
const isMobile = mode === "mobile";
|
|
5557
5728
|
const isTablet = mode === "tablet";
|
|
5558
5729
|
const isDesktop = mode === "desktop";
|
|
5559
|
-
const handleBuilderExit = (0,
|
|
5730
|
+
const handleBuilderExit = (0, import_react35.useCallback)(
|
|
5560
5731
|
(e, url) => {
|
|
5561
5732
|
if (isBuilder) {
|
|
5562
5733
|
e.preventDefault();
|
|
@@ -5567,7 +5738,7 @@ function Navbar({
|
|
|
5567
5738
|
},
|
|
5568
5739
|
[isBuilder]
|
|
5569
5740
|
);
|
|
5570
|
-
const formattedMenu = (0,
|
|
5741
|
+
const formattedMenu = (0, import_react35.useMemo)(() => {
|
|
5571
5742
|
if (source === "state" && navList?.length) {
|
|
5572
5743
|
return navList.map((i) => ({
|
|
5573
5744
|
...i,
|
|
@@ -5649,7 +5820,7 @@ function Navbar({
|
|
|
5649
5820
|
}
|
|
5650
5821
|
|
|
5651
5822
|
// src/components/Chart/BarChart.tsx
|
|
5652
|
-
var
|
|
5823
|
+
var import_react36 = __toESM(require("react"));
|
|
5653
5824
|
var import_axios3 = __toESM(require("axios"));
|
|
5654
5825
|
var import_recharts = require("recharts");
|
|
5655
5826
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -5710,18 +5881,18 @@ var ChartComponent = ({
|
|
|
5710
5881
|
canvasMode,
|
|
5711
5882
|
...props
|
|
5712
5883
|
}) => {
|
|
5713
|
-
const [rawData, setRawData] = (0,
|
|
5714
|
-
const [rawMeta, setRawMeta] = (0,
|
|
5715
|
-
const [localLoading, setLocalLoading] = (0,
|
|
5716
|
-
const [currentPage, setCurrentPage] = (0,
|
|
5884
|
+
const [rawData, setRawData] = (0, import_react36.useState)([]);
|
|
5885
|
+
const [rawMeta, setRawMeta] = (0, import_react36.useState)(null);
|
|
5886
|
+
const [localLoading, setLocalLoading] = (0, import_react36.useState)(false);
|
|
5887
|
+
const [currentPage, setCurrentPage] = (0, import_react36.useState)(1);
|
|
5717
5888
|
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
5718
5889
|
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
5719
|
-
(0,
|
|
5890
|
+
(0, import_react36.useEffect)(() => {
|
|
5720
5891
|
if (apiUrl) {
|
|
5721
5892
|
setCurrentPage(1);
|
|
5722
5893
|
}
|
|
5723
5894
|
}, [apiUrl]);
|
|
5724
|
-
const fetchData = (0,
|
|
5895
|
+
const fetchData = (0, import_react36.useCallback)(async (page) => {
|
|
5725
5896
|
if (!apiUrl) return;
|
|
5726
5897
|
const cancelled = false;
|
|
5727
5898
|
try {
|
|
@@ -5758,7 +5929,7 @@ var ChartComponent = ({
|
|
|
5758
5929
|
if (!cancelled) setLocalLoading(false);
|
|
5759
5930
|
}
|
|
5760
5931
|
}, [apiUrl, limit]);
|
|
5761
|
-
(0,
|
|
5932
|
+
(0, import_react36.useEffect)(() => {
|
|
5762
5933
|
if (!apiUrl) return;
|
|
5763
5934
|
fetchData(currentPage);
|
|
5764
5935
|
}, [apiUrl, currentPage, fetchData]);
|
|
@@ -5766,7 +5937,7 @@ var ChartComponent = ({
|
|
|
5766
5937
|
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
5767
5938
|
setCurrentPage(newPage);
|
|
5768
5939
|
};
|
|
5769
|
-
const data = (0,
|
|
5940
|
+
const data = (0, import_react36.useMemo)(() => {
|
|
5770
5941
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
5771
5942
|
return [];
|
|
5772
5943
|
}
|
|
@@ -5954,10 +6125,10 @@ var ChartComponent = ({
|
|
|
5954
6125
|
] }) })
|
|
5955
6126
|
] });
|
|
5956
6127
|
};
|
|
5957
|
-
var BarChart_default =
|
|
6128
|
+
var BarChart_default = import_react36.default.memo(ChartComponent);
|
|
5958
6129
|
|
|
5959
6130
|
// src/components/Chart/PieChart.tsx
|
|
5960
|
-
var
|
|
6131
|
+
var import_react37 = __toESM(require("react"));
|
|
5961
6132
|
var import_axios4 = __toESM(require("axios"));
|
|
5962
6133
|
var import_recharts2 = require("recharts");
|
|
5963
6134
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
@@ -6037,11 +6208,11 @@ var DonutChart = ({
|
|
|
6037
6208
|
}) => {
|
|
6038
6209
|
const showLegends = props.showLegends ?? true;
|
|
6039
6210
|
const canvasMode = props.canvasMode;
|
|
6040
|
-
const [rawData, setRawData] = (0,
|
|
6041
|
-
const [localLoading, setLocalLoading] = (0,
|
|
6211
|
+
const [rawData, setRawData] = (0, import_react37.useState)([]);
|
|
6212
|
+
const [localLoading, setLocalLoading] = (0, import_react37.useState)(false);
|
|
6042
6213
|
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
6043
6214
|
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
6044
|
-
(0,
|
|
6215
|
+
(0, import_react37.useEffect)(() => {
|
|
6045
6216
|
if (!apiUrl) return;
|
|
6046
6217
|
let cancelled = false;
|
|
6047
6218
|
const fetchData = async () => {
|
|
@@ -6077,7 +6248,7 @@ var DonutChart = ({
|
|
|
6077
6248
|
cancelled = true;
|
|
6078
6249
|
};
|
|
6079
6250
|
}, [apiUrl]);
|
|
6080
|
-
const data = (0,
|
|
6251
|
+
const data = (0, import_react37.useMemo)(() => {
|
|
6081
6252
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
6082
6253
|
return effectiveData.map((item) => ({
|
|
6083
6254
|
...item,
|
|
@@ -6086,11 +6257,11 @@ var DonutChart = ({
|
|
|
6086
6257
|
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
6087
6258
|
}));
|
|
6088
6259
|
}, [effectiveData, dataKey, dataLabel]);
|
|
6089
|
-
const total = (0,
|
|
6260
|
+
const total = (0, import_react37.useMemo)(
|
|
6090
6261
|
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
6091
6262
|
[data, dataKey]
|
|
6092
6263
|
);
|
|
6093
|
-
const formattedTotal = (0,
|
|
6264
|
+
const formattedTotal = (0, import_react37.useMemo)(() => {
|
|
6094
6265
|
if (total >= 1e6) {
|
|
6095
6266
|
return `${(total / 1e6).toFixed(1)}M`;
|
|
6096
6267
|
}
|
|
@@ -6099,7 +6270,7 @@ var DonutChart = ({
|
|
|
6099
6270
|
}
|
|
6100
6271
|
return total.toString();
|
|
6101
6272
|
}, [total]);
|
|
6102
|
-
const chartData = (0,
|
|
6273
|
+
const chartData = (0, import_react37.useMemo)(() => {
|
|
6103
6274
|
if (total === 0) return data;
|
|
6104
6275
|
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
6105
6276
|
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
@@ -6122,12 +6293,12 @@ var DonutChart = ({
|
|
|
6122
6293
|
if (chartData.length <= 6) return { inner: 85, outer: 150 };
|
|
6123
6294
|
return { inner: 70, outer: 130 };
|
|
6124
6295
|
};
|
|
6125
|
-
const [mounted, setMounted] = (0,
|
|
6126
|
-
(0,
|
|
6296
|
+
const [mounted, setMounted] = (0, import_react37.useState)(false);
|
|
6297
|
+
(0, import_react37.useEffect)(() => {
|
|
6127
6298
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
6128
6299
|
return () => clearTimeout(timeout);
|
|
6129
6300
|
}, []);
|
|
6130
|
-
const renderLegends = (0,
|
|
6301
|
+
const renderLegends = (0, import_react37.useMemo)(() => {
|
|
6131
6302
|
if (!showLegends) return null;
|
|
6132
6303
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex flex-wrap justify-center gap-2 mt-4 w-full max-w-4xl", children: chartData.map((d, index) => {
|
|
6133
6304
|
const actualValue = data.find(
|
|
@@ -6255,7 +6426,7 @@ var DonutChart = ({
|
|
|
6255
6426
|
renderLegends
|
|
6256
6427
|
] });
|
|
6257
6428
|
};
|
|
6258
|
-
var PieChart_default =
|
|
6429
|
+
var PieChart_default = import_react37.default.memo(DonutChart);
|
|
6259
6430
|
|
|
6260
6431
|
// src/components/Blocks/EmailComposer.tsx
|
|
6261
6432
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|