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