@algorithm-shift/design-system 1.2.91 → 1.2.93
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.d.mts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +90 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27012,7 +27012,7 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
27012
27012
|
}
|
|
27013
27013
|
}, []);
|
|
27014
27014
|
const handleChange = (e) => {
|
|
27015
|
-
props.onChange?.(e);
|
|
27015
|
+
props.onChange?.(e, e.target.name || "");
|
|
27016
27016
|
};
|
|
27017
27017
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
27018
27018
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -27054,7 +27054,7 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
27054
27054
|
}
|
|
27055
27055
|
}, []);
|
|
27056
27056
|
const handleChange = (e) => {
|
|
27057
|
-
props.onChange?.(e);
|
|
27057
|
+
props.onChange?.(e, e.target.name || "");
|
|
27058
27058
|
};
|
|
27059
27059
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
27060
27060
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -27097,7 +27097,7 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
27097
27097
|
}
|
|
27098
27098
|
}, []);
|
|
27099
27099
|
const handleChange = (e) => {
|
|
27100
|
-
props.onChange?.(e);
|
|
27100
|
+
props.onChange?.(e, props.name || "");
|
|
27101
27101
|
};
|
|
27102
27102
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
27103
27103
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -27139,7 +27139,7 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
27139
27139
|
}
|
|
27140
27140
|
}, []);
|
|
27141
27141
|
const handleChange = (e) => {
|
|
27142
|
-
props.onChange?.(e);
|
|
27142
|
+
props.onChange?.(e, e.target.name || "");
|
|
27143
27143
|
};
|
|
27144
27144
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
27145
27145
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -27200,7 +27200,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
27200
27200
|
}
|
|
27201
27201
|
}, []);
|
|
27202
27202
|
const handleChange = (e) => {
|
|
27203
|
-
props.onChange?.(e);
|
|
27203
|
+
props.onChange?.(e, e.target.name || "");
|
|
27204
27204
|
};
|
|
27205
27205
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
27206
27206
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -27242,7 +27242,7 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
27242
27242
|
}
|
|
27243
27243
|
}, []);
|
|
27244
27244
|
const handleChange = (e) => {
|
|
27245
|
-
props.onChange?.(e);
|
|
27245
|
+
props.onChange?.(e, e.target.name || "");
|
|
27246
27246
|
};
|
|
27247
27247
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
27248
27248
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex justify-start items-center relative", children: [
|
|
@@ -27335,7 +27335,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
27335
27335
|
}
|
|
27336
27336
|
}, []);
|
|
27337
27337
|
const handleChange = (value) => {
|
|
27338
|
-
props.onChange?.(value);
|
|
27338
|
+
props.onChange?.(value, props.name || "");
|
|
27339
27339
|
};
|
|
27340
27340
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
27341
27341
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
@@ -27422,7 +27422,7 @@ var RadioInput = ({
|
|
|
27422
27422
|
}
|
|
27423
27423
|
}, []);
|
|
27424
27424
|
const handleChange = (value) => {
|
|
27425
|
-
onChange?.(value);
|
|
27425
|
+
onChange?.(value, props.name || "");
|
|
27426
27426
|
};
|
|
27427
27427
|
const resolvedDefaultValue = (typeof defaultValue === "string" ? defaultValue : void 0) ?? options[0]?.value;
|
|
27428
27428
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
@@ -27457,7 +27457,8 @@ var MultiCheckbox = ({
|
|
|
27457
27457
|
value: propValue = {},
|
|
27458
27458
|
onChange,
|
|
27459
27459
|
isEditable = true,
|
|
27460
|
-
isDisabled = false
|
|
27460
|
+
isDisabled = false,
|
|
27461
|
+
...props
|
|
27461
27462
|
}) => {
|
|
27462
27463
|
const list = Array.isArray(data) ? data : [];
|
|
27463
27464
|
const [value, setValue] = (0, import_react16.useState)(propValue);
|
|
@@ -27467,14 +27468,14 @@ var MultiCheckbox = ({
|
|
|
27467
27468
|
}));
|
|
27468
27469
|
(0, import_react16.useEffect)(() => {
|
|
27469
27470
|
if (propValue !== void 0) {
|
|
27470
|
-
onChange?.(propValue);
|
|
27471
|
+
onChange?.(propValue, props.name || "");
|
|
27471
27472
|
}
|
|
27472
27473
|
}, []);
|
|
27473
27474
|
const handleChange = (0, import_react16.useCallback)(
|
|
27474
27475
|
(key, checked) => {
|
|
27475
27476
|
setValue((prev) => {
|
|
27476
27477
|
const newValue = { ...prev, [key]: checked };
|
|
27477
|
-
onChange?.(newValue);
|
|
27478
|
+
onChange?.(newValue, props.name || "");
|
|
27478
27479
|
return newValue;
|
|
27479
27480
|
});
|
|
27480
27481
|
},
|
|
@@ -27588,7 +27589,7 @@ function RichText({ className, style, ...props }) {
|
|
|
27588
27589
|
}
|
|
27589
27590
|
}, []);
|
|
27590
27591
|
const handleChange = (content) => {
|
|
27591
|
-
props.onChange?.(content);
|
|
27592
|
+
props.onChange?.(content, props.name || "");
|
|
27592
27593
|
};
|
|
27593
27594
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
27594
27595
|
"div",
|
|
@@ -27775,7 +27776,8 @@ function useLazyDropdown(config) {
|
|
|
27775
27776
|
const limit = PAGE_SIZE;
|
|
27776
27777
|
const params = { page: pageNum, limit };
|
|
27777
27778
|
if (term) params[configRef.current.dataLabel ?? "search"] = term;
|
|
27778
|
-
const
|
|
27779
|
+
const axiosClient = configRef.current.axiosInstance ?? import_axios.default;
|
|
27780
|
+
const res = await axiosClient.get(configRef.current.apiUrl, {
|
|
27779
27781
|
params,
|
|
27780
27782
|
withCredentials: true
|
|
27781
27783
|
});
|
|
@@ -27823,7 +27825,8 @@ function useLazyDropdown(config) {
|
|
|
27823
27825
|
if (!configRef.current.apiUrl) return [];
|
|
27824
27826
|
try {
|
|
27825
27827
|
setLoading(true);
|
|
27826
|
-
const
|
|
27828
|
+
const axiosClient = configRef.current.axiosInstance ?? import_axios.default;
|
|
27829
|
+
const res = await axiosClient.get(configRef.current.apiUrl, {
|
|
27827
27830
|
params: { [configRef.current.dataKey]: configRef.current.value },
|
|
27828
27831
|
withCredentials: true
|
|
27829
27832
|
});
|
|
@@ -27859,8 +27862,7 @@ function useLazyDropdown(config) {
|
|
|
27859
27862
|
const reset = (0, import_react19.useCallback)(() => {
|
|
27860
27863
|
setSearchTerm("");
|
|
27861
27864
|
setPage(1);
|
|
27862
|
-
|
|
27863
|
-
}, [loadPage]);
|
|
27865
|
+
}, []);
|
|
27864
27866
|
(0, import_react19.useEffect)(() => {
|
|
27865
27867
|
if (config.initialData?.length) {
|
|
27866
27868
|
allDataRef.current = config.initialData;
|
|
@@ -27899,7 +27901,8 @@ function LazySelectDropdown({
|
|
|
27899
27901
|
pageSize,
|
|
27900
27902
|
dataKey = "id",
|
|
27901
27903
|
dataLabel = "name",
|
|
27902
|
-
errorMessage
|
|
27904
|
+
errorMessage,
|
|
27905
|
+
axiosInstance
|
|
27903
27906
|
}) {
|
|
27904
27907
|
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
27905
27908
|
const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
|
|
@@ -27921,7 +27924,8 @@ function LazySelectDropdown({
|
|
|
27921
27924
|
dataKey,
|
|
27922
27925
|
dataLabel,
|
|
27923
27926
|
initialData: options || [],
|
|
27924
|
-
value
|
|
27927
|
+
value,
|
|
27928
|
+
axiosInstance
|
|
27925
27929
|
});
|
|
27926
27930
|
const selectedOption = lazyOptions.find((opt) => opt.value === value);
|
|
27927
27931
|
(0, import_react20.useEffect)(() => {
|
|
@@ -27951,7 +27955,7 @@ function LazySelectDropdown({
|
|
|
27951
27955
|
search(term);
|
|
27952
27956
|
};
|
|
27953
27957
|
const handleSelect = (optValue) => {
|
|
27954
|
-
onChange?.(optValue);
|
|
27958
|
+
onChange?.(optValue, id || "");
|
|
27955
27959
|
setIsOpen(false);
|
|
27956
27960
|
setSearchTerm("");
|
|
27957
27961
|
reset();
|
|
@@ -28040,7 +28044,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
28040
28044
|
}
|
|
28041
28045
|
}, []);
|
|
28042
28046
|
const handleChange = (value) => {
|
|
28043
|
-
props.onChange?.(value);
|
|
28047
|
+
props.onChange?.(value, props.name ?? "");
|
|
28044
28048
|
};
|
|
28045
28049
|
const dataKey = props.dataKey || "value";
|
|
28046
28050
|
const dataLabel = props.dataLabel || "label";
|
|
@@ -28135,7 +28139,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
28135
28139
|
}
|
|
28136
28140
|
}, []);
|
|
28137
28141
|
const handleChange = (value) => {
|
|
28138
|
-
props.onChange?.(value);
|
|
28142
|
+
props.onChange?.(value, props.name || "");
|
|
28139
28143
|
};
|
|
28140
28144
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
28141
28145
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center space-x-2 mb-2", children: [
|
|
@@ -28170,7 +28174,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
28170
28174
|
}
|
|
28171
28175
|
}, []);
|
|
28172
28176
|
const handleChange = (val) => {
|
|
28173
|
-
props.onChange?.(val);
|
|
28177
|
+
props.onChange?.(val, props.name || "");
|
|
28174
28178
|
};
|
|
28175
28179
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
28176
28180
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
@@ -28218,7 +28222,7 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
28218
28222
|
}
|
|
28219
28223
|
}, []);
|
|
28220
28224
|
const handleChange = (e) => {
|
|
28221
|
-
props.onChange?.(e);
|
|
28225
|
+
props.onChange?.(e, e.target.name || "");
|
|
28222
28226
|
};
|
|
28223
28227
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
28224
28228
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -28257,7 +28261,7 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
28257
28261
|
}
|
|
28258
28262
|
}, []);
|
|
28259
28263
|
const handleChange = (e) => {
|
|
28260
|
-
props.onChange?.(e);
|
|
28264
|
+
props.onChange?.(e, props.name || "");
|
|
28261
28265
|
};
|
|
28262
28266
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "d-flex items-center relative align-middle", children: [
|
|
28263
28267
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
@@ -28315,7 +28319,7 @@ function DatePicker({ className, style, ...props }) {
|
|
|
28315
28319
|
}
|
|
28316
28320
|
}, []);
|
|
28317
28321
|
const handleChange = (e) => {
|
|
28318
|
-
props.onChange?.(e);
|
|
28322
|
+
props.onChange?.(e, e.target.name || "");
|
|
28319
28323
|
};
|
|
28320
28324
|
const toDateInputValue = (value) => {
|
|
28321
28325
|
if (!value) return "";
|
|
@@ -28588,7 +28592,7 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28588
28592
|
const handleChange = (value) => {
|
|
28589
28593
|
setDate(value);
|
|
28590
28594
|
if (value) {
|
|
28591
|
-
props.onChange?.(value);
|
|
28595
|
+
props.onChange?.(value, props.name || "");
|
|
28592
28596
|
}
|
|
28593
28597
|
};
|
|
28594
28598
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
@@ -28642,7 +28646,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28642
28646
|
}
|
|
28643
28647
|
}, []);
|
|
28644
28648
|
const handleChange = (e) => {
|
|
28645
|
-
props.onChange?.(e);
|
|
28649
|
+
props.onChange?.(e, e.target.name || "");
|
|
28646
28650
|
};
|
|
28647
28651
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
28648
28652
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
@@ -28929,12 +28933,13 @@ var MultiSelect = ({
|
|
|
28929
28933
|
const [open, setOpen] = React8.useState(false);
|
|
28930
28934
|
React8.useEffect(() => {
|
|
28931
28935
|
if (value) {
|
|
28932
|
-
onChange(value);
|
|
28936
|
+
onChange(value, props.name || "");
|
|
28933
28937
|
}
|
|
28934
28938
|
}, []);
|
|
28935
28939
|
const toggleOption = (val) => {
|
|
28936
28940
|
onChange(
|
|
28937
|
-
value?.includes(val) ? value.filter((v) => v !== val) : [...value || [], val]
|
|
28941
|
+
value?.includes(val) ? value.filter((v) => v !== val) : [...value || [], val],
|
|
28942
|
+
props.name || ""
|
|
28938
28943
|
);
|
|
28939
28944
|
};
|
|
28940
28945
|
const selectedLabels = React8.useMemo(
|
|
@@ -29010,7 +29015,7 @@ var MultiSelect = ({
|
|
|
29010
29015
|
var MultiSelect_default = MultiSelect;
|
|
29011
29016
|
|
|
29012
29017
|
// src/components/ui/data-table.tsx
|
|
29013
|
-
var
|
|
29018
|
+
var React10 = __toESM(require("react"));
|
|
29014
29019
|
var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
|
|
29015
29020
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
29016
29021
|
var import_react_table2 = require("@tanstack/react-table");
|
|
@@ -29104,6 +29109,7 @@ function TableCell({ className, ...props }) {
|
|
|
29104
29109
|
var import_react_table = require("@tanstack/react-table");
|
|
29105
29110
|
|
|
29106
29111
|
// src/lib/table/cellRendererFactory.tsx
|
|
29112
|
+
var import_react29 = __toESM(require("react"));
|
|
29107
29113
|
var import_image3 = __toESM(require("next/image"));
|
|
29108
29114
|
|
|
29109
29115
|
// src/lib/dayjs-setup.ts
|
|
@@ -29184,6 +29190,22 @@ var getContrastColor = (bg) => {
|
|
|
29184
29190
|
const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
29185
29191
|
return brightness > 160 ? "#000000" : "#FFFFFF";
|
|
29186
29192
|
};
|
|
29193
|
+
var sanitizeValue = (val) => {
|
|
29194
|
+
if (val == null) return null;
|
|
29195
|
+
if (import_react29.default.isValidElement(val)) return val;
|
|
29196
|
+
if (typeof val === "string" || typeof val === "number") return val;
|
|
29197
|
+
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react29.default.Fragment, { children: sanitizeValue(v) }, i));
|
|
29198
|
+
if (typeof val === "object") {
|
|
29199
|
+
if ("name" in val && typeof val.name === "string") return val.name;
|
|
29200
|
+
if ("label" in val && typeof val.label === "string") return val.label;
|
|
29201
|
+
try {
|
|
29202
|
+
return JSON.stringify(val);
|
|
29203
|
+
} catch {
|
|
29204
|
+
return "[object]";
|
|
29205
|
+
}
|
|
29206
|
+
}
|
|
29207
|
+
return String(val);
|
|
29208
|
+
};
|
|
29187
29209
|
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format2, customFormatters = {}) => {
|
|
29188
29210
|
const formattedValue = valueFormatter(value, format2, customFormatters);
|
|
29189
29211
|
switch (renderer) {
|
|
@@ -29335,13 +29357,15 @@ var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) =>
|
|
|
29335
29357
|
return config.columns.map((col) => {
|
|
29336
29358
|
const accessorKey = col.accessorKey ?? col.id;
|
|
29337
29359
|
const accessorFn = (row) => {
|
|
29360
|
+
if (!row) return null;
|
|
29338
29361
|
if (Object.prototype.hasOwnProperty.call(row, accessorKey)) {
|
|
29339
|
-
return row[accessorKey];
|
|
29362
|
+
return sanitizeValue(row[accessorKey]);
|
|
29340
29363
|
}
|
|
29341
29364
|
if (accessorKey.includes(".")) {
|
|
29342
|
-
|
|
29365
|
+
const val = getValueByPath(row, accessorKey);
|
|
29366
|
+
return sanitizeValue(val);
|
|
29343
29367
|
}
|
|
29344
|
-
return row[accessorKey];
|
|
29368
|
+
return sanitizeValue(row[accessorKey]);
|
|
29345
29369
|
};
|
|
29346
29370
|
return columnHelper.accessor(accessorFn, {
|
|
29347
29371
|
id: col.id ?? accessorKey,
|
|
@@ -29386,13 +29410,13 @@ function DataTable({
|
|
|
29386
29410
|
onDeleteRow,
|
|
29387
29411
|
rowActions
|
|
29388
29412
|
}) {
|
|
29389
|
-
const [columnFilters, setColumnFilters] =
|
|
29390
|
-
const [columnVisibility, setColumnVisibility] =
|
|
29391
|
-
const [manualSort, setManualSort] =
|
|
29392
|
-
const [searchTerm, setSearchTerm] =
|
|
29413
|
+
const [columnFilters, setColumnFilters] = React10.useState([]);
|
|
29414
|
+
const [columnVisibility, setColumnVisibility] = React10.useState({});
|
|
29415
|
+
const [manualSort, setManualSort] = React10.useState(null);
|
|
29416
|
+
const [searchTerm, setSearchTerm] = React10.useState("");
|
|
29393
29417
|
const dynamicCols = useDynamicColumns({ columns });
|
|
29394
29418
|
const table = (0, import_react_table2.useReactTable)({
|
|
29395
|
-
data,
|
|
29419
|
+
data: data ?? [],
|
|
29396
29420
|
columns: dynamicCols,
|
|
29397
29421
|
state: {
|
|
29398
29422
|
columnFilters,
|
|
@@ -29605,7 +29629,7 @@ function DataTable({
|
|
|
29605
29629
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
29606
29630
|
TableCell,
|
|
29607
29631
|
{
|
|
29608
|
-
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100" : ""} relative`,
|
|
29632
|
+
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative`,
|
|
29609
29633
|
style: meta?.cellStyle,
|
|
29610
29634
|
onClick: () => {
|
|
29611
29635
|
if (isClickable && onCellClick) {
|
|
@@ -29949,12 +29973,12 @@ var CustomPagination = ({
|
|
|
29949
29973
|
var Pagination_default = CustomPagination;
|
|
29950
29974
|
|
|
29951
29975
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
29952
|
-
var
|
|
29976
|
+
var import_react30 = require("react");
|
|
29953
29977
|
var import_link5 = __toESM(require("next/link"));
|
|
29954
29978
|
var import_navigation3 = require("next/navigation");
|
|
29955
29979
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
29956
29980
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
|
|
29957
|
-
const [openIndex, setOpenIndex] = (0,
|
|
29981
|
+
const [openIndex, setOpenIndex] = (0, import_react30.useState)(null);
|
|
29958
29982
|
function groupMenus(menus = []) {
|
|
29959
29983
|
const menuMap = /* @__PURE__ */ new Map();
|
|
29960
29984
|
menus.forEach((menu) => {
|
|
@@ -29987,7 +30011,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29987
30011
|
});
|
|
29988
30012
|
return sortMenus(rootMenus);
|
|
29989
30013
|
}
|
|
29990
|
-
const rawTabs = (0,
|
|
30014
|
+
const rawTabs = (0, import_react30.useMemo)(() => {
|
|
29991
30015
|
if (!Array.isArray(tabs)) return [];
|
|
29992
30016
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
29993
30017
|
return groupMenus(tabs);
|
|
@@ -30000,9 +30024,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30000
30024
|
return pathname === path || path !== "/" && pathname?.startsWith(path);
|
|
30001
30025
|
};
|
|
30002
30026
|
const router = (0, import_navigation3.useRouter)();
|
|
30003
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
30004
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
30005
|
-
const handleBuilderExit = (0,
|
|
30027
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react30.useState)(false);
|
|
30028
|
+
const [pendingUrl, setPendingUrl] = (0, import_react30.useState)(null);
|
|
30029
|
+
const handleBuilderExit = (0, import_react30.useCallback)(
|
|
30006
30030
|
(e, url) => {
|
|
30007
30031
|
if (isBuilder) {
|
|
30008
30032
|
e.preventDefault();
|
|
@@ -30157,10 +30181,10 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30157
30181
|
var Tabs_default = Tabs;
|
|
30158
30182
|
|
|
30159
30183
|
// src/components/Navigation/Stages/Stages.tsx
|
|
30160
|
-
var
|
|
30184
|
+
var import_react31 = __toESM(require("react"));
|
|
30161
30185
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
30162
30186
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header", loading }) => {
|
|
30163
|
-
const [activeStage, setActiveStage] = (0,
|
|
30187
|
+
const [activeStage, setActiveStage] = (0, import_react31.useState)(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
|
|
30164
30188
|
const nextStage = () => {
|
|
30165
30189
|
if (!stages || stages.length === 0) return;
|
|
30166
30190
|
const currentIndex = stages.findIndex((stage) => stage[dataKey] === activeStage);
|
|
@@ -30192,7 +30216,7 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
30192
30216
|
const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
|
|
30193
30217
|
const isCompleted = isAllStagesCompleted || index < currentIndex;
|
|
30194
30218
|
const isActive = !isAllStagesCompleted && index === currentIndex;
|
|
30195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
30219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react31.default.Fragment, { children: [
|
|
30196
30220
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
30197
30221
|
"button",
|
|
30198
30222
|
{
|
|
@@ -30240,10 +30264,10 @@ var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
|
30240
30264
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
30241
30265
|
|
|
30242
30266
|
// src/components/ui/avatar.tsx
|
|
30243
|
-
var
|
|
30267
|
+
var React12 = __toESM(require("react"));
|
|
30244
30268
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
30245
30269
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
30246
|
-
var Avatar =
|
|
30270
|
+
var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
30247
30271
|
AvatarPrimitive.Root,
|
|
30248
30272
|
{
|
|
30249
30273
|
ref,
|
|
@@ -30255,7 +30279,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
30255
30279
|
}
|
|
30256
30280
|
));
|
|
30257
30281
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
30258
|
-
var AvatarImage =
|
|
30282
|
+
var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
30259
30283
|
AvatarPrimitive.Image,
|
|
30260
30284
|
{
|
|
30261
30285
|
ref,
|
|
@@ -30264,7 +30288,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
30264
30288
|
}
|
|
30265
30289
|
));
|
|
30266
30290
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
30267
|
-
var AvatarFallback =
|
|
30291
|
+
var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
30268
30292
|
AvatarPrimitive.Fallback,
|
|
30269
30293
|
{
|
|
30270
30294
|
ref,
|
|
@@ -30282,7 +30306,7 @@ var import_link6 = __toESM(require("next/link"));
|
|
|
30282
30306
|
var import_image4 = __toESM(require("next/image"));
|
|
30283
30307
|
var import_navigation4 = require("next/navigation");
|
|
30284
30308
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
30285
|
-
var
|
|
30309
|
+
var import_react32 = require("react");
|
|
30286
30310
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
30287
30311
|
function Navbar({
|
|
30288
30312
|
style,
|
|
@@ -30303,9 +30327,9 @@ function Navbar({
|
|
|
30303
30327
|
}) {
|
|
30304
30328
|
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
30305
30329
|
const router = (0, import_navigation4.useRouter)();
|
|
30306
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
30307
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
30308
|
-
const handleBuilderExit = (0,
|
|
30330
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react32.useState)(false);
|
|
30331
|
+
const [pendingUrl, setPendingUrl] = (0, import_react32.useState)(null);
|
|
30332
|
+
const handleBuilderExit = (0, import_react32.useCallback)(
|
|
30309
30333
|
(e, url) => {
|
|
30310
30334
|
if (isBuilder) {
|
|
30311
30335
|
e.preventDefault();
|
|
@@ -30321,7 +30345,7 @@ function Navbar({
|
|
|
30321
30345
|
router.push(pendingUrl);
|
|
30322
30346
|
}
|
|
30323
30347
|
};
|
|
30324
|
-
const formatedMenu = (0,
|
|
30348
|
+
const formatedMenu = (0, import_react32.useMemo)(() => {
|
|
30325
30349
|
if (source === "state" && navList && navList.length) {
|
|
30326
30350
|
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
30327
30351
|
}
|
|
@@ -30424,7 +30448,7 @@ function Navbar({
|
|
|
30424
30448
|
}
|
|
30425
30449
|
|
|
30426
30450
|
// src/components/Chart/BarChart.tsx
|
|
30427
|
-
var
|
|
30451
|
+
var import_react33 = __toESM(require("react"));
|
|
30428
30452
|
var import_recharts = require("recharts");
|
|
30429
30453
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
30430
30454
|
var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
@@ -30485,10 +30509,10 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
30485
30509
|
)
|
|
30486
30510
|
] }) }) });
|
|
30487
30511
|
};
|
|
30488
|
-
var BarChart_default =
|
|
30512
|
+
var BarChart_default = import_react33.default.memo(ChartComponent);
|
|
30489
30513
|
|
|
30490
30514
|
// src/components/Chart/PieChart.tsx
|
|
30491
|
-
var
|
|
30515
|
+
var import_react34 = __toESM(require("react"));
|
|
30492
30516
|
var import_recharts2 = require("recharts");
|
|
30493
30517
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
30494
30518
|
var getRandomColor = () => {
|
|
@@ -30510,18 +30534,18 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
30510
30534
|
const showLegends = props.showLegends ?? true;
|
|
30511
30535
|
const labelType = props.labelType || "inside";
|
|
30512
30536
|
const canvasMode = props.canvasMode;
|
|
30513
|
-
const data = (0,
|
|
30537
|
+
const data = (0, import_react34.useMemo)(() => {
|
|
30514
30538
|
if (!Array.isArray(props.data)) return [];
|
|
30515
30539
|
return props.data.map((item) => ({ ...item, color: getRandomColor() }));
|
|
30516
30540
|
}, [props.data]);
|
|
30517
|
-
const total = (0,
|
|
30541
|
+
const total = (0, import_react34.useMemo)(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
|
|
30518
30542
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
30519
|
-
const [mounted, setMounted] = (0,
|
|
30520
|
-
(0,
|
|
30543
|
+
const [mounted, setMounted] = (0, import_react34.useState)(false);
|
|
30544
|
+
(0, import_react34.useEffect)(() => {
|
|
30521
30545
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
30522
30546
|
return () => clearTimeout(timeout);
|
|
30523
30547
|
}, []);
|
|
30524
|
-
const renderLegends = (0,
|
|
30548
|
+
const renderLegends = (0, import_react34.useMemo)(() => {
|
|
30525
30549
|
if (!showLegends) return null;
|
|
30526
30550
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: data.map((d) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
30527
30551
|
"div",
|
|
@@ -30609,7 +30633,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
30609
30633
|
}
|
|
30610
30634
|
);
|
|
30611
30635
|
};
|
|
30612
|
-
var PieChart_default =
|
|
30636
|
+
var PieChart_default = import_react34.default.memo(DonutChart);
|
|
30613
30637
|
|
|
30614
30638
|
// src/components/Blocks/EmailComposer.tsx
|
|
30615
30639
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|