@algorithm-shift/design-system 1.2.980 → 1.2.982
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 +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +30 -9
- package/dist/index.d.ts +30 -9
- package/dist/index.js +290 -198
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +255 -163
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ __export(src_exports, {
|
|
|
48
48
|
FlexLayout: () => Flex_default,
|
|
49
49
|
GridLayout: () => Grid_default,
|
|
50
50
|
HistoryTimeline: () => HistoryTimeline_default,
|
|
51
|
-
Icon: () =>
|
|
51
|
+
Icon: () => Icon2,
|
|
52
52
|
Image: () => Image_default,
|
|
53
53
|
Modal: () => Modal,
|
|
54
54
|
MultiCheckbox: () => MultiCheckbox,
|
|
@@ -478,7 +478,7 @@ var Typography = ({
|
|
|
478
478
|
import_react5.default.createElement("span", {
|
|
479
479
|
key: "html",
|
|
480
480
|
className: "pointer-events-none",
|
|
481
|
-
dangerouslySetInnerHTML: { __html: textContent }
|
|
481
|
+
dangerouslySetInnerHTML: { __html: textContent || "--" }
|
|
482
482
|
})
|
|
483
483
|
]
|
|
484
484
|
);
|
|
@@ -26952,39 +26952,117 @@ function SplitButton({ style, textContent, className, list = [] }) {
|
|
|
26952
26952
|
}
|
|
26953
26953
|
|
|
26954
26954
|
// src/components/Basic/Icon/Icon.tsx
|
|
26955
|
-
var
|
|
26955
|
+
var import_react8 = require("react");
|
|
26956
26956
|
var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
|
|
26957
26957
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
26958
|
-
|
|
26959
|
-
|
|
26960
|
-
|
|
26961
|
-
|
|
26962
|
-
|
|
26963
|
-
|
|
26958
|
+
async function loadFAIcon(iconName, prefix = "fas") {
|
|
26959
|
+
const pkgMap = {
|
|
26960
|
+
fas: "@fortawesome/free-solid-svg-icons",
|
|
26961
|
+
// Solid
|
|
26962
|
+
far: "@fortawesome/free-regular-svg-icons",
|
|
26963
|
+
// Regular
|
|
26964
|
+
fab: "@fortawesome/free-brands-svg-icons"
|
|
26965
|
+
// Brands
|
|
26966
|
+
};
|
|
26967
|
+
const basePackage = pkgMap[prefix] || pkgMap["fas"];
|
|
26968
|
+
const modulePath = `${basePackage}`;
|
|
26969
|
+
try {
|
|
26970
|
+
const mod = await import(modulePath);
|
|
26971
|
+
return mod[iconName] || Object.values(mod)[0];
|
|
26972
|
+
} catch {
|
|
26973
|
+
console.warn(`FA icon not found in ${modulePath}`);
|
|
26974
|
+
return null;
|
|
26975
|
+
}
|
|
26976
|
+
}
|
|
26977
|
+
function Icon2(props) {
|
|
26978
|
+
const {
|
|
26979
|
+
iconSet = "fontawesome",
|
|
26980
|
+
icon,
|
|
26981
|
+
prefix = "fas",
|
|
26982
|
+
iconSize = 16,
|
|
26983
|
+
className = "",
|
|
26984
|
+
style = {},
|
|
26985
|
+
title = "",
|
|
26986
|
+
spin = false,
|
|
26987
|
+
fixedWidth = false,
|
|
26988
|
+
pulse = false,
|
|
26989
|
+
...rest
|
|
26990
|
+
} = props;
|
|
26991
|
+
const [dynamicIcon, setDynamicIcon] = (0, import_react8.useState)(icon || null);
|
|
26992
|
+
(0, import_react8.useEffect)(() => {
|
|
26993
|
+
if (icon && iconSet === "fontawesome") {
|
|
26994
|
+
loadFAIcon(icon, prefix).then((ico) => setDynamicIcon(ico));
|
|
26995
|
+
}
|
|
26996
|
+
}, [iconSet, icon, prefix]);
|
|
26997
|
+
if (iconSet === "lucide") {
|
|
26998
|
+
const Comp = lucide_react_exports[icon];
|
|
26999
|
+
if (!Comp) {
|
|
27000
|
+
console.warn(`Lucide icon not found: ${icon}`);
|
|
26964
27001
|
return null;
|
|
26965
27002
|
}
|
|
26966
|
-
|
|
27003
|
+
const numericSize = typeof iconSize === "number" ? iconSize : parseInt(iconSize, 10) || 16;
|
|
27004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
27005
|
+
Comp,
|
|
27006
|
+
{
|
|
27007
|
+
size: numericSize,
|
|
27008
|
+
className,
|
|
27009
|
+
title,
|
|
27010
|
+
style,
|
|
27011
|
+
"aria-hidden": title ? void 0 : true,
|
|
27012
|
+
onClick: () => props.onClick?.(),
|
|
27013
|
+
...rest
|
|
27014
|
+
}
|
|
27015
|
+
);
|
|
27016
|
+
}
|
|
27017
|
+
if (iconSet === "fontawesome") {
|
|
27018
|
+
if (!dynamicIcon) return null;
|
|
27019
|
+
const tempStyle = { ...style };
|
|
27020
|
+
delete tempStyle.height;
|
|
27021
|
+
delete tempStyle.width;
|
|
27022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
26967
27023
|
import_react_fontawesome2.FontAwesomeIcon,
|
|
26968
27024
|
{
|
|
26969
|
-
icon:
|
|
26970
|
-
|
|
26971
|
-
|
|
27025
|
+
icon: dynamicIcon,
|
|
27026
|
+
size: typeof iconSize === "string" ? iconSize : void 0,
|
|
27027
|
+
spin,
|
|
27028
|
+
spinPulse: pulse,
|
|
27029
|
+
widthAuto: fixedWidth,
|
|
27030
|
+
className: cn(className),
|
|
27031
|
+
title,
|
|
27032
|
+
style: {
|
|
27033
|
+
...tempStyle
|
|
27034
|
+
},
|
|
27035
|
+
onClick: () => props.onClick?.()
|
|
26972
27036
|
}
|
|
26973
27037
|
);
|
|
26974
27038
|
}
|
|
26975
|
-
if (
|
|
26976
|
-
const
|
|
26977
|
-
|
|
26978
|
-
|
|
26979
|
-
|
|
26980
|
-
|
|
27039
|
+
if (iconSet === "fa" || iconSet === "fa-css") {
|
|
27040
|
+
const sizeStyle = typeof iconSize === "number" ? { fontSize: iconSize } : {};
|
|
27041
|
+
const cls = [
|
|
27042
|
+
`${prefix} fa-${icon}`,
|
|
27043
|
+
spin ? "fa-spin" : "",
|
|
27044
|
+
pulse ? "fa-pulse" : "",
|
|
27045
|
+
fixedWidth ? "fa-fw" : "",
|
|
27046
|
+
className
|
|
27047
|
+
].filter(Boolean).join(" ");
|
|
27048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
27049
|
+
"i",
|
|
27050
|
+
{
|
|
27051
|
+
className: cls,
|
|
27052
|
+
style: { ...sizeStyle, ...style },
|
|
27053
|
+
title,
|
|
27054
|
+
"aria-hidden": title ? void 0 : true,
|
|
27055
|
+
onClick: () => props.onClick?.(),
|
|
27056
|
+
...rest
|
|
27057
|
+
}
|
|
27058
|
+
);
|
|
26981
27059
|
}
|
|
26982
|
-
|
|
26983
|
-
|
|
26984
|
-
|
|
27060
|
+
console.warn("Unknown icon set:", iconSet);
|
|
27061
|
+
return null;
|
|
27062
|
+
}
|
|
26985
27063
|
|
|
26986
27064
|
// src/components/Inputs/TextInput/TextInput.tsx
|
|
26987
|
-
var
|
|
27065
|
+
var import_react9 = require("react");
|
|
26988
27066
|
|
|
26989
27067
|
// src/components/ui/input.tsx
|
|
26990
27068
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -27013,7 +27091,7 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
27013
27091
|
const isDisabled = props.isDisabled ?? false;
|
|
27014
27092
|
const isReadonly = props.isReadonly ?? false;
|
|
27015
27093
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27016
|
-
(0,
|
|
27094
|
+
(0, import_react9.useEffect)(() => {
|
|
27017
27095
|
if (props.value !== void 0) {
|
|
27018
27096
|
const e = { target: { value: props.value } };
|
|
27019
27097
|
handleChange?.(e);
|
|
@@ -27055,7 +27133,7 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
27055
27133
|
var TextInput_default = TextInput;
|
|
27056
27134
|
|
|
27057
27135
|
// src/components/Inputs/NumberInput/NumberInput.tsx
|
|
27058
|
-
var
|
|
27136
|
+
var import_react10 = require("react");
|
|
27059
27137
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
27060
27138
|
var NumberInput = ({ className, style, ...props }) => {
|
|
27061
27139
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -27063,7 +27141,7 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
27063
27141
|
const isDisabled = props.isDisabled ?? false;
|
|
27064
27142
|
const isReadonly = props.isReadonly ?? false;
|
|
27065
27143
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27066
|
-
(0,
|
|
27144
|
+
(0, import_react10.useEffect)(() => {
|
|
27067
27145
|
if (props.value !== void 0) {
|
|
27068
27146
|
const e = { target: { value: props.value } };
|
|
27069
27147
|
handleChange?.(e);
|
|
@@ -27105,7 +27183,7 @@ var NumberInput = ({ className, style, ...props }) => {
|
|
|
27105
27183
|
var NumberInput_default = NumberInput;
|
|
27106
27184
|
|
|
27107
27185
|
// src/components/Inputs/EmailInput/EmailInput.tsx
|
|
27108
|
-
var
|
|
27186
|
+
var import_react11 = require("react");
|
|
27109
27187
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
27110
27188
|
var EmailInput = ({ className, style, ...props }) => {
|
|
27111
27189
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -27113,7 +27191,7 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
27113
27191
|
const isDisabled = props.isDisabled ?? false;
|
|
27114
27192
|
const isReadonly = props.isReadonly ?? false;
|
|
27115
27193
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27116
|
-
(0,
|
|
27194
|
+
(0, import_react11.useEffect)(() => {
|
|
27117
27195
|
if (props.value !== void 0) {
|
|
27118
27196
|
const e = { target: { value: props.value } };
|
|
27119
27197
|
handleChange?.(e);
|
|
@@ -27155,7 +27233,7 @@ var EmailInput = ({ className, style, ...props }) => {
|
|
|
27155
27233
|
var EmailInput_default = EmailInput;
|
|
27156
27234
|
|
|
27157
27235
|
// src/components/Inputs/PasswordInput/PasswordInput.tsx
|
|
27158
|
-
var
|
|
27236
|
+
var import_react12 = require("react");
|
|
27159
27237
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
27160
27238
|
var PasswordInput = ({ className, style, ...props }) => {
|
|
27161
27239
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -27163,7 +27241,7 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
27163
27241
|
const isDisabled = props.isDisabled ?? false;
|
|
27164
27242
|
const isReadonly = props.isReadonly ?? false;
|
|
27165
27243
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27166
|
-
(0,
|
|
27244
|
+
(0, import_react12.useEffect)(() => {
|
|
27167
27245
|
if (props.value !== void 0) {
|
|
27168
27246
|
const e = { target: { value: props.value } };
|
|
27169
27247
|
handleChange?.(e);
|
|
@@ -27205,7 +27283,7 @@ var PasswordInput = ({ className, style, ...props }) => {
|
|
|
27205
27283
|
var PasswordInput_default = PasswordInput;
|
|
27206
27284
|
|
|
27207
27285
|
// src/components/Inputs/Textarea/Textarea.tsx
|
|
27208
|
-
var
|
|
27286
|
+
var import_react13 = require("react");
|
|
27209
27287
|
|
|
27210
27288
|
// src/components/ui/textarea.tsx
|
|
27211
27289
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
@@ -27231,7 +27309,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
27231
27309
|
const isDisabled = props.isDisabled ?? false;
|
|
27232
27310
|
const isReadonly = props.isReadonly ?? false;
|
|
27233
27311
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27234
|
-
(0,
|
|
27312
|
+
(0, import_react13.useEffect)(() => {
|
|
27235
27313
|
if (props.value !== void 0) {
|
|
27236
27314
|
const e = { target: { value: props.value } };
|
|
27237
27315
|
handleChange?.(e);
|
|
@@ -27265,7 +27343,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
27265
27343
|
var Textarea_default = Textarea2;
|
|
27266
27344
|
|
|
27267
27345
|
// src/components/Inputs/UrlInput/UrlInput.tsx
|
|
27268
|
-
var
|
|
27346
|
+
var import_react14 = require("react");
|
|
27269
27347
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
27270
27348
|
var UrlInput = ({ className, style, ...props }) => {
|
|
27271
27349
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -27273,7 +27351,7 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
27273
27351
|
const isDisabled = props.isDisabled ?? false;
|
|
27274
27352
|
const isReadonly = props.isReadonly ?? false;
|
|
27275
27353
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27276
|
-
(0,
|
|
27354
|
+
(0, import_react14.useEffect)(() => {
|
|
27277
27355
|
if (props.value !== void 0) {
|
|
27278
27356
|
const e = { target: { value: props.value } };
|
|
27279
27357
|
handleChange?.(e);
|
|
@@ -27318,7 +27396,7 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
27318
27396
|
var UrlInput_default = UrlInput;
|
|
27319
27397
|
|
|
27320
27398
|
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
27321
|
-
var
|
|
27399
|
+
var import_react15 = require("react");
|
|
27322
27400
|
|
|
27323
27401
|
// src/components/ui/checkbox.tsx
|
|
27324
27402
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
@@ -27383,7 +27461,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
27383
27461
|
}
|
|
27384
27462
|
return false;
|
|
27385
27463
|
};
|
|
27386
|
-
(0,
|
|
27464
|
+
(0, import_react15.useEffect)(() => {
|
|
27387
27465
|
if (props.value) {
|
|
27388
27466
|
handleChange(formatValue(props.value));
|
|
27389
27467
|
}
|
|
@@ -27410,7 +27488,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
|
|
|
27410
27488
|
var Checkbox_default = CheckboxInput;
|
|
27411
27489
|
|
|
27412
27490
|
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
27413
|
-
var
|
|
27491
|
+
var import_react16 = require("react");
|
|
27414
27492
|
|
|
27415
27493
|
// src/components/ui/radio-group.tsx
|
|
27416
27494
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
@@ -27470,7 +27548,7 @@ var RadioInput = ({
|
|
|
27470
27548
|
value: item[dataKey || "value"],
|
|
27471
27549
|
label: item[dataLabel || "label"]
|
|
27472
27550
|
}));
|
|
27473
|
-
(0,
|
|
27551
|
+
(0, import_react16.useEffect)(() => {
|
|
27474
27552
|
if (props.value !== void 0) {
|
|
27475
27553
|
handleChange?.(props.value);
|
|
27476
27554
|
}
|
|
@@ -27500,7 +27578,7 @@ var RadioInput = ({
|
|
|
27500
27578
|
var RadioInput_default = RadioInput;
|
|
27501
27579
|
|
|
27502
27580
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
27503
|
-
var
|
|
27581
|
+
var import_react17 = require("react");
|
|
27504
27582
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
27505
27583
|
function MultiCheckbox({
|
|
27506
27584
|
apiUrl,
|
|
@@ -27519,11 +27597,11 @@ function MultiCheckbox({
|
|
|
27519
27597
|
onUncheckItems,
|
|
27520
27598
|
...props
|
|
27521
27599
|
}) {
|
|
27522
|
-
const [options, setOptions] = (0,
|
|
27523
|
-
const [page, setPage] = (0,
|
|
27524
|
-
const [hasMore, setHasMore] = (0,
|
|
27525
|
-
const [pageLoading, setPageLoading] = (0,
|
|
27526
|
-
const loadMoreRef = (0,
|
|
27600
|
+
const [options, setOptions] = (0, import_react17.useState)([]);
|
|
27601
|
+
const [page, setPage] = (0, import_react17.useState)(1);
|
|
27602
|
+
const [hasMore, setHasMore] = (0, import_react17.useState)(true);
|
|
27603
|
+
const [pageLoading, setPageLoading] = (0, import_react17.useState)(false);
|
|
27604
|
+
const loadMoreRef = (0, import_react17.useRef)(null);
|
|
27527
27605
|
const normalizeInput = (val) => {
|
|
27528
27606
|
if (!val) return [];
|
|
27529
27607
|
if (Array.isArray(val)) return val;
|
|
@@ -27545,7 +27623,7 @@ function MultiCheckbox({
|
|
|
27545
27623
|
return arr;
|
|
27546
27624
|
}
|
|
27547
27625
|
};
|
|
27548
|
-
const fetchApiPage = (0,
|
|
27626
|
+
const fetchApiPage = (0, import_react17.useCallback)(async () => {
|
|
27549
27627
|
if (!apiUrl) return [];
|
|
27550
27628
|
const client = axiosInstance || (await import("axios")).default;
|
|
27551
27629
|
const res = await client.get(apiUrl, {
|
|
@@ -27557,7 +27635,7 @@ function MultiCheckbox({
|
|
|
27557
27635
|
}
|
|
27558
27636
|
return Array.isArray(res.data) ? res.data : [];
|
|
27559
27637
|
}, [apiUrl, axiosInstance, page, pageSize]);
|
|
27560
|
-
const mapData = (0,
|
|
27638
|
+
const mapData = (0, import_react17.useCallback)(
|
|
27561
27639
|
(items) => {
|
|
27562
27640
|
if (Array.isArray(items) === false) return [];
|
|
27563
27641
|
return (items || []).map((item) => ({
|
|
@@ -27567,7 +27645,7 @@ function MultiCheckbox({
|
|
|
27567
27645
|
},
|
|
27568
27646
|
[dataKey, dataLabel]
|
|
27569
27647
|
);
|
|
27570
|
-
const loadPage = (0,
|
|
27648
|
+
const loadPage = (0, import_react17.useCallback)(async () => {
|
|
27571
27649
|
if (source !== "api") return;
|
|
27572
27650
|
if (pageLoading) return;
|
|
27573
27651
|
setPageLoading(true);
|
|
@@ -27582,7 +27660,7 @@ function MultiCheckbox({
|
|
|
27582
27660
|
setPageLoading(false);
|
|
27583
27661
|
}
|
|
27584
27662
|
}, [source, pageLoading, fetchApiPage, mapData, pageSize]);
|
|
27585
|
-
(0,
|
|
27663
|
+
(0, import_react17.useEffect)(() => {
|
|
27586
27664
|
if (source === "api") {
|
|
27587
27665
|
setOptions([]);
|
|
27588
27666
|
setPage(1);
|
|
@@ -27592,10 +27670,10 @@ function MultiCheckbox({
|
|
|
27592
27670
|
setHasMore(false);
|
|
27593
27671
|
}
|
|
27594
27672
|
}, [source, JSON.stringify(data)]);
|
|
27595
|
-
(0,
|
|
27673
|
+
(0, import_react17.useEffect)(() => {
|
|
27596
27674
|
if (source === "api") loadPage();
|
|
27597
27675
|
}, [page, source]);
|
|
27598
|
-
(0,
|
|
27676
|
+
(0, import_react17.useEffect)(() => {
|
|
27599
27677
|
if (source !== "api") return;
|
|
27600
27678
|
if (!hasMore || pageLoading) return;
|
|
27601
27679
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -27658,10 +27736,10 @@ function MultiCheckbox({
|
|
|
27658
27736
|
}
|
|
27659
27737
|
|
|
27660
27738
|
// src/components/Inputs/RichText/RichText.tsx
|
|
27661
|
-
var
|
|
27739
|
+
var import_react19 = require("react");
|
|
27662
27740
|
|
|
27663
27741
|
// src/components/Global/TinyMceEditor.tsx
|
|
27664
|
-
var
|
|
27742
|
+
var import_react18 = require("react");
|
|
27665
27743
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
27666
27744
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
27667
27745
|
function MyEditor({
|
|
@@ -27669,7 +27747,7 @@ function MyEditor({
|
|
|
27669
27747
|
onChange,
|
|
27670
27748
|
isDefault
|
|
27671
27749
|
}) {
|
|
27672
|
-
const editorRef = (0,
|
|
27750
|
+
const editorRef = (0, import_react18.useRef)(null);
|
|
27673
27751
|
function stripOuterP(html) {
|
|
27674
27752
|
const trimmedHtml = html.trim();
|
|
27675
27753
|
if (!trimmedHtml) return "";
|
|
@@ -27681,7 +27759,7 @@ function MyEditor({
|
|
|
27681
27759
|
}
|
|
27682
27760
|
return trimmedHtml;
|
|
27683
27761
|
}
|
|
27684
|
-
const isDefaultToolbar = (0,
|
|
27762
|
+
const isDefaultToolbar = (0, import_react18.useMemo)(() => {
|
|
27685
27763
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
27686
27764
|
if (isDefault) {
|
|
27687
27765
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -27734,7 +27812,7 @@ function MyEditor({
|
|
|
27734
27812
|
// src/components/Inputs/RichText/RichText.tsx
|
|
27735
27813
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
27736
27814
|
function RichText({ className, style, ...props }) {
|
|
27737
|
-
(0,
|
|
27815
|
+
(0, import_react19.useEffect)(() => {
|
|
27738
27816
|
if (props.value !== void 0) {
|
|
27739
27817
|
handleChange?.(props.value);
|
|
27740
27818
|
}
|
|
@@ -27759,7 +27837,7 @@ function RichText({ className, style, ...props }) {
|
|
|
27759
27837
|
}
|
|
27760
27838
|
|
|
27761
27839
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
27762
|
-
var
|
|
27840
|
+
var import_react22 = require("react");
|
|
27763
27841
|
|
|
27764
27842
|
// src/components/ui/select.tsx
|
|
27765
27843
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
@@ -27888,20 +27966,20 @@ function SelectScrollDownButton({
|
|
|
27888
27966
|
}
|
|
27889
27967
|
|
|
27890
27968
|
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
27891
|
-
var
|
|
27969
|
+
var import_react21 = require("react");
|
|
27892
27970
|
|
|
27893
27971
|
// src/hooks/useLazyDropdown.ts
|
|
27894
|
-
var
|
|
27972
|
+
var import_react20 = require("react");
|
|
27895
27973
|
var import_axios = __toESM(require("axios"));
|
|
27896
27974
|
function useLazyDropdown(config) {
|
|
27897
|
-
const [options, setOptions] = (0,
|
|
27898
|
-
const [page, setPage] = (0,
|
|
27899
|
-
const [hasMore, setHasMore] = (0,
|
|
27900
|
-
const [loading, setLoading] = (0,
|
|
27901
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
27902
|
-
const debounceTimer = (0,
|
|
27903
|
-
const allDataRef = (0,
|
|
27904
|
-
const configRef = (0,
|
|
27975
|
+
const [options, setOptions] = (0, import_react20.useState)([]);
|
|
27976
|
+
const [page, setPage] = (0, import_react20.useState)(1);
|
|
27977
|
+
const [hasMore, setHasMore] = (0, import_react20.useState)(true);
|
|
27978
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
27979
|
+
const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
|
|
27980
|
+
const debounceTimer = (0, import_react20.useRef)(null);
|
|
27981
|
+
const allDataRef = (0, import_react20.useRef)([]);
|
|
27982
|
+
const configRef = (0, import_react20.useRef)(config);
|
|
27905
27983
|
const PAGE_SIZE = config.pageSize || 10;
|
|
27906
27984
|
const uniqueOptions = (items) => {
|
|
27907
27985
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -27911,7 +27989,7 @@ function useLazyDropdown(config) {
|
|
|
27911
27989
|
return true;
|
|
27912
27990
|
});
|
|
27913
27991
|
};
|
|
27914
|
-
(0,
|
|
27992
|
+
(0, import_react20.useEffect)(() => {
|
|
27915
27993
|
configRef.current = config;
|
|
27916
27994
|
}, [config]);
|
|
27917
27995
|
function getValueByPath2(obj, path) {
|
|
@@ -27919,7 +27997,7 @@ function useLazyDropdown(config) {
|
|
|
27919
27997
|
const parts = path.split(/\./);
|
|
27920
27998
|
return parts.reduce((acc, key) => acc?.[key], obj);
|
|
27921
27999
|
}
|
|
27922
|
-
const transformToOptions = (0,
|
|
28000
|
+
const transformToOptions = (0, import_react20.useCallback)((data) => {
|
|
27923
28001
|
if (!data || !Array.isArray(data)) return [];
|
|
27924
28002
|
const cfg = configRef.current;
|
|
27925
28003
|
return data.map((item) => {
|
|
@@ -27957,7 +28035,7 @@ function useLazyDropdown(config) {
|
|
|
27957
28035
|
params: cleaned
|
|
27958
28036
|
};
|
|
27959
28037
|
}
|
|
27960
|
-
const fetchApiData = (0,
|
|
28038
|
+
const fetchApiData = (0, import_react20.useCallback)(async (pageNum, term) => {
|
|
27961
28039
|
if (!configRef.current.apiUrl) return [];
|
|
27962
28040
|
const limit = PAGE_SIZE;
|
|
27963
28041
|
const params = { page: pageNum, limit };
|
|
@@ -27982,7 +28060,7 @@ function useLazyDropdown(config) {
|
|
|
27982
28060
|
}
|
|
27983
28061
|
return [];
|
|
27984
28062
|
}, [PAGE_SIZE, transformToOptions]);
|
|
27985
|
-
const loadPage = (0,
|
|
28063
|
+
const loadPage = (0, import_react20.useCallback)(async (pageNum, term) => {
|
|
27986
28064
|
const cfg = configRef.current;
|
|
27987
28065
|
if (!cfg.enabled) return;
|
|
27988
28066
|
setLoading(true);
|
|
@@ -28059,7 +28137,7 @@ function useLazyDropdown(config) {
|
|
|
28059
28137
|
setLoading(false);
|
|
28060
28138
|
}
|
|
28061
28139
|
};
|
|
28062
|
-
(0,
|
|
28140
|
+
(0, import_react20.useEffect)(() => {
|
|
28063
28141
|
const cfg = configRef.current;
|
|
28064
28142
|
if (!cfg.enabled || !cfg.value || cfg.dataSource !== "api" || !cfg.apiUrl) return;
|
|
28065
28143
|
if (cfg.isMultiSelect) {
|
|
@@ -28072,29 +28150,29 @@ function useLazyDropdown(config) {
|
|
|
28072
28150
|
}
|
|
28073
28151
|
fetchValueItem();
|
|
28074
28152
|
}, [JSON.stringify(config.value), config.dataKey, config.apiUrl, config.dataSource]);
|
|
28075
|
-
const loadMore = (0,
|
|
28153
|
+
const loadMore = (0, import_react20.useCallback)(() => {
|
|
28076
28154
|
if (!loading && hasMore) {
|
|
28077
28155
|
loadPage(page + 1, searchTerm);
|
|
28078
28156
|
}
|
|
28079
28157
|
}, [loading, hasMore, page, searchTerm]);
|
|
28080
|
-
const search = (0,
|
|
28158
|
+
const search = (0, import_react20.useCallback)((term) => {
|
|
28081
28159
|
setSearchTerm(term);
|
|
28082
28160
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
28083
28161
|
debounceTimer.current = setTimeout(() => {
|
|
28084
28162
|
loadPage(1, term);
|
|
28085
28163
|
}, 300);
|
|
28086
28164
|
}, []);
|
|
28087
|
-
const reset = (0,
|
|
28165
|
+
const reset = (0, import_react20.useCallback)(() => {
|
|
28088
28166
|
setSearchTerm("");
|
|
28089
28167
|
setPage(1);
|
|
28090
28168
|
}, []);
|
|
28091
|
-
(0,
|
|
28169
|
+
(0, import_react20.useEffect)(() => {
|
|
28092
28170
|
if (config.initialData?.length) {
|
|
28093
28171
|
allDataRef.current = config.initialData;
|
|
28094
28172
|
loadPage(1, "");
|
|
28095
28173
|
}
|
|
28096
28174
|
}, [config.initialData]);
|
|
28097
|
-
(0,
|
|
28175
|
+
(0, import_react20.useEffect)(() => {
|
|
28098
28176
|
return () => {
|
|
28099
28177
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
28100
28178
|
};
|
|
@@ -28155,12 +28233,13 @@ function LazySelectDropdown({
|
|
|
28155
28233
|
dataLabel = "name",
|
|
28156
28234
|
errorMessage,
|
|
28157
28235
|
axiosInstance,
|
|
28158
|
-
enableAddNewOption = false
|
|
28236
|
+
enableAddNewOption = false,
|
|
28237
|
+
enforceStrictQueryParams = false
|
|
28159
28238
|
}) {
|
|
28160
|
-
const [isOpen, setIsOpen] = (0,
|
|
28161
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
28162
|
-
const dropdownRef = (0,
|
|
28163
|
-
const observerTarget = (0,
|
|
28239
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
28240
|
+
const [searchTerm, setSearchTerm] = (0, import_react21.useState)("");
|
|
28241
|
+
const dropdownRef = (0, import_react21.useRef)(null);
|
|
28242
|
+
const observerTarget = (0, import_react21.useRef)(null);
|
|
28164
28243
|
const {
|
|
28165
28244
|
options: lazyOptions,
|
|
28166
28245
|
loading,
|
|
@@ -28179,10 +28258,11 @@ function LazySelectDropdown({
|
|
|
28179
28258
|
dataLabel,
|
|
28180
28259
|
initialData: options || [],
|
|
28181
28260
|
value,
|
|
28182
|
-
axiosInstance
|
|
28261
|
+
axiosInstance,
|
|
28262
|
+
enforceStrictQueryParams
|
|
28183
28263
|
});
|
|
28184
|
-
const selectedOption = (0,
|
|
28185
|
-
(0,
|
|
28264
|
+
const selectedOption = (0, import_react21.useMemo)(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
28265
|
+
(0, import_react21.useEffect)(() => {
|
|
28186
28266
|
const handleClickOutside = (e) => {
|
|
28187
28267
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
28188
28268
|
setIsOpen(false);
|
|
@@ -28192,7 +28272,7 @@ function LazySelectDropdown({
|
|
|
28192
28272
|
document.addEventListener("mousedown", handleClickOutside);
|
|
28193
28273
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
28194
28274
|
}, []);
|
|
28195
|
-
(0,
|
|
28275
|
+
(0, import_react21.useEffect)(() => {
|
|
28196
28276
|
if (!isOpen || !hasMore || loading) return;
|
|
28197
28277
|
const observer = new IntersectionObserver(
|
|
28198
28278
|
(entries) => {
|
|
@@ -28332,7 +28412,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
28332
28412
|
const isEditable = props.isEditable ?? true;
|
|
28333
28413
|
const isDisabled = props.isDisabled ?? false;
|
|
28334
28414
|
const isReadonly = props.isReadonly ?? false;
|
|
28335
|
-
(0,
|
|
28415
|
+
(0, import_react22.useEffect)(() => {
|
|
28336
28416
|
if (props.value !== void 0) {
|
|
28337
28417
|
handleChange(props.value);
|
|
28338
28418
|
}
|
|
@@ -28391,7 +28471,7 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
28391
28471
|
var Dropdown_default = Dropdown;
|
|
28392
28472
|
|
|
28393
28473
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
28394
|
-
var
|
|
28474
|
+
var import_react23 = require("react");
|
|
28395
28475
|
|
|
28396
28476
|
// src/components/ui/switch.tsx
|
|
28397
28477
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
@@ -28427,7 +28507,7 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
|
28427
28507
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
28428
28508
|
const isEditable = props.isEditable ?? true;
|
|
28429
28509
|
const isDisabled = props.isDisabled ?? false;
|
|
28430
|
-
(0,
|
|
28510
|
+
(0, import_react23.useEffect)(() => {
|
|
28431
28511
|
if (props.value !== void 0) {
|
|
28432
28512
|
handleChange?.(props.value);
|
|
28433
28513
|
}
|
|
@@ -28454,7 +28534,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
28454
28534
|
var SwitchToggle_default = SwitchToggle;
|
|
28455
28535
|
|
|
28456
28536
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
28457
|
-
var
|
|
28537
|
+
var import_react24 = require("react");
|
|
28458
28538
|
var import_react_international_phone = require("react-international-phone");
|
|
28459
28539
|
var import_style = require("react-international-phone/style.css");
|
|
28460
28540
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
@@ -28469,7 +28549,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
28469
28549
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
28470
28550
|
const isEditable = props.isEditable ?? true;
|
|
28471
28551
|
const isDisabled = props.isDisabled ?? false;
|
|
28472
|
-
(0,
|
|
28552
|
+
(0, import_react24.useEffect)(() => {
|
|
28473
28553
|
if (props.value !== void 0) {
|
|
28474
28554
|
const normalized = ensureIndiaCode(props.value);
|
|
28475
28555
|
handleChange?.(normalized);
|
|
@@ -28516,7 +28596,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
28516
28596
|
var PhoneInput_default = PhoneInput;
|
|
28517
28597
|
|
|
28518
28598
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
28519
|
-
var
|
|
28599
|
+
var import_react25 = require("react");
|
|
28520
28600
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
28521
28601
|
var SearchInput = ({ className, style, ...props }) => {
|
|
28522
28602
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -28524,7 +28604,7 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
28524
28604
|
const isDisabled = props.isDisabled ?? false;
|
|
28525
28605
|
const isReadonly = props.isReadonly ?? false;
|
|
28526
28606
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28527
|
-
(0,
|
|
28607
|
+
(0, import_react25.useEffect)(() => {
|
|
28528
28608
|
if (props.value !== void 0) {
|
|
28529
28609
|
const e = { target: { value: props.value } };
|
|
28530
28610
|
handleChange?.(e);
|
|
@@ -28566,11 +28646,11 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
28566
28646
|
var SearchInput_default = SearchInput;
|
|
28567
28647
|
|
|
28568
28648
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
28569
|
-
var
|
|
28649
|
+
var import_react26 = require("react");
|
|
28570
28650
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
28571
28651
|
var FileInput2 = ({ className, style, ...props }) => {
|
|
28572
28652
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
28573
|
-
(0,
|
|
28653
|
+
(0, import_react26.useEffect)(() => {
|
|
28574
28654
|
if (props.value !== void 0) {
|
|
28575
28655
|
const e = { target: { value: props.value } };
|
|
28576
28656
|
handleChange?.(e);
|
|
@@ -28610,11 +28690,11 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
28610
28690
|
var FileInput_default = FileInput2;
|
|
28611
28691
|
|
|
28612
28692
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
28613
|
-
var
|
|
28693
|
+
var React7 = __toESM(require("react"));
|
|
28614
28694
|
var import_date_fns = require("date-fns");
|
|
28615
28695
|
|
|
28616
28696
|
// src/components/ui/calendar.tsx
|
|
28617
|
-
var
|
|
28697
|
+
var React6 = __toESM(require("react"));
|
|
28618
28698
|
var import_react_day_picker = require("react-day-picker");
|
|
28619
28699
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
28620
28700
|
function Calendar2({
|
|
@@ -28769,8 +28849,8 @@ function CalendarDayButton({
|
|
|
28769
28849
|
...props
|
|
28770
28850
|
}) {
|
|
28771
28851
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
28772
|
-
const ref =
|
|
28773
|
-
|
|
28852
|
+
const ref = React6.useRef(null);
|
|
28853
|
+
React6.useEffect(() => {
|
|
28774
28854
|
if (modifiers.focused) ref.current?.focus();
|
|
28775
28855
|
}, [modifiers.focused]);
|
|
28776
28856
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -28864,25 +28944,25 @@ function DateTimePicker({
|
|
|
28864
28944
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28865
28945
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
28866
28946
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
28867
|
-
const [date, setDate] =
|
|
28947
|
+
const [date, setDate] = React7.useState(() => {
|
|
28868
28948
|
if (!props.value) return void 0;
|
|
28869
28949
|
const d = new Date(props.value);
|
|
28870
28950
|
return isNaN(d.getTime()) ? void 0 : d;
|
|
28871
28951
|
});
|
|
28872
28952
|
const initialHours = date ? date.getHours() : 0;
|
|
28873
28953
|
const initialMinutes = date ? date.getMinutes() : 0;
|
|
28874
|
-
const [hours, setHours] =
|
|
28875
|
-
const [minutes, setMinutes] =
|
|
28876
|
-
const [amPm, setAmPm] =
|
|
28877
|
-
const displayHours =
|
|
28954
|
+
const [hours, setHours] = React7.useState(initialHours);
|
|
28955
|
+
const [minutes, setMinutes] = React7.useState(initialMinutes);
|
|
28956
|
+
const [amPm, setAmPm] = React7.useState("AM");
|
|
28957
|
+
const displayHours = React7.useMemo(() => {
|
|
28878
28958
|
if (hours === 0) return 12;
|
|
28879
28959
|
if (hours > 12) return hours - 12;
|
|
28880
28960
|
return hours;
|
|
28881
28961
|
}, [hours]);
|
|
28882
|
-
|
|
28962
|
+
React7.useEffect(() => {
|
|
28883
28963
|
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
28884
28964
|
}, [hours]);
|
|
28885
|
-
|
|
28965
|
+
React7.useEffect(() => {
|
|
28886
28966
|
if (!props.value) {
|
|
28887
28967
|
setDate(void 0);
|
|
28888
28968
|
return;
|
|
@@ -28894,8 +28974,8 @@ function DateTimePicker({
|
|
|
28894
28974
|
setMinutes(d.getMinutes());
|
|
28895
28975
|
}
|
|
28896
28976
|
}, [props.value]);
|
|
28897
|
-
const [year, setYear] =
|
|
28898
|
-
|
|
28977
|
+
const [year, setYear] = React7.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
28978
|
+
React7.useEffect(() => {
|
|
28899
28979
|
if (!date) return;
|
|
28900
28980
|
const newDate = new Date(date);
|
|
28901
28981
|
newDate.setFullYear(year);
|
|
@@ -28998,7 +29078,7 @@ function DateTimePicker({
|
|
|
28998
29078
|
for (let y = currentYear - 50; y <= currentYear + 10; y++) {
|
|
28999
29079
|
yearOptions.push(y);
|
|
29000
29080
|
}
|
|
29001
|
-
const displayValue =
|
|
29081
|
+
const displayValue = React7.useMemo(() => {
|
|
29002
29082
|
if (!date) return "";
|
|
29003
29083
|
try {
|
|
29004
29084
|
if (mode === "date") return (0, import_date_fns.format)(date, "dd-MM-yyyy");
|
|
@@ -29009,11 +29089,11 @@ function DateTimePicker({
|
|
|
29009
29089
|
}
|
|
29010
29090
|
}, [date, mode]);
|
|
29011
29091
|
const isInputDisabled = isDisabled || !isEditable;
|
|
29012
|
-
const [calendarMonthState, setCalendarMonthState] =
|
|
29092
|
+
const [calendarMonthState, setCalendarMonthState] = React7.useState(() => {
|
|
29013
29093
|
const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
29014
29094
|
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
|
|
29015
29095
|
});
|
|
29016
|
-
|
|
29096
|
+
React7.useEffect(() => {
|
|
29017
29097
|
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
29018
29098
|
}, [year]);
|
|
29019
29099
|
const handleToday = () => {
|
|
@@ -29159,18 +29239,18 @@ function DateTimePicker({
|
|
|
29159
29239
|
}
|
|
29160
29240
|
|
|
29161
29241
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
29162
|
-
var
|
|
29242
|
+
var import_react27 = __toESM(require("react"));
|
|
29163
29243
|
var import_date_fns2 = require("date-fns");
|
|
29164
29244
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
29165
29245
|
var DateRange = ({ className, style, ...props }) => {
|
|
29166
29246
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
29167
|
-
const [date, setDate] =
|
|
29247
|
+
const [date, setDate] = import_react27.default.useState(
|
|
29168
29248
|
isDateRange(props.value) ? props.value : {
|
|
29169
29249
|
from: /* @__PURE__ */ new Date(),
|
|
29170
29250
|
to: (0, import_date_fns2.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
29171
29251
|
}
|
|
29172
29252
|
);
|
|
29173
|
-
(0,
|
|
29253
|
+
(0, import_react27.useEffect)(() => {
|
|
29174
29254
|
if (props.value && isDateRange(props.value)) {
|
|
29175
29255
|
handleChange?.(props.value);
|
|
29176
29256
|
}
|
|
@@ -29217,7 +29297,7 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
29217
29297
|
var DateRange_default = DateRange;
|
|
29218
29298
|
|
|
29219
29299
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
29220
|
-
var
|
|
29300
|
+
var import_react28 = require("react");
|
|
29221
29301
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
29222
29302
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
29223
29303
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -29225,7 +29305,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
29225
29305
|
const isDisabled = props.isDisabled ?? false;
|
|
29226
29306
|
const isReadonly = props.isReadonly ?? false;
|
|
29227
29307
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
29228
|
-
(0,
|
|
29308
|
+
(0, import_react28.useEffect)(() => {
|
|
29229
29309
|
if (props.value !== void 0) {
|
|
29230
29310
|
const e = { target: { value: props.value } };
|
|
29231
29311
|
handleChange?.(e);
|
|
@@ -29278,10 +29358,9 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
29278
29358
|
var TextInputGroup_default = TextInputGroup;
|
|
29279
29359
|
|
|
29280
29360
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
29281
|
-
var
|
|
29361
|
+
var import_react29 = require("react");
|
|
29282
29362
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
29283
29363
|
function LazyMultiSelectDropdown({
|
|
29284
|
-
options = [],
|
|
29285
29364
|
value = [],
|
|
29286
29365
|
onChange,
|
|
29287
29366
|
placeholder,
|
|
@@ -29296,12 +29375,13 @@ function LazyMultiSelectDropdown({
|
|
|
29296
29375
|
dataLabel = "name",
|
|
29297
29376
|
errorMessage,
|
|
29298
29377
|
axiosInstance,
|
|
29299
|
-
outputFormat = "array"
|
|
29378
|
+
outputFormat = "array",
|
|
29379
|
+
...props
|
|
29300
29380
|
}) {
|
|
29301
|
-
const [isOpen, setIsOpen] = (0,
|
|
29302
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
29303
|
-
const dropdownRef = (0,
|
|
29304
|
-
const observerTarget = (0,
|
|
29381
|
+
const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
|
|
29382
|
+
const [searchTerm, setSearchTerm] = (0, import_react29.useState)("");
|
|
29383
|
+
const dropdownRef = (0, import_react29.useRef)(null);
|
|
29384
|
+
const observerTarget = (0, import_react29.useRef)(null);
|
|
29305
29385
|
const ensureUnique = (arr) => {
|
|
29306
29386
|
return Array.from(new Set(arr));
|
|
29307
29387
|
};
|
|
@@ -29318,26 +29398,27 @@ function LazyMultiSelectDropdown({
|
|
|
29318
29398
|
return ensureUnique(arr);
|
|
29319
29399
|
};
|
|
29320
29400
|
const normalizedValue = normalizeInput(value);
|
|
29401
|
+
const list = Array.isArray(props?.data) ? props.data : [];
|
|
29321
29402
|
const {
|
|
29322
29403
|
options: lazyOptions,
|
|
29323
29404
|
loading,
|
|
29324
29405
|
hasMore,
|
|
29325
29406
|
loadMore,
|
|
29326
29407
|
search,
|
|
29327
|
-
reset,
|
|
29328
29408
|
loadPage
|
|
29329
29409
|
} = useLazyDropdown({
|
|
29330
29410
|
enabled: true,
|
|
29331
29411
|
dataSource: source || "",
|
|
29332
29412
|
apiUrl,
|
|
29333
|
-
pageSize: pageSize
|
|
29413
|
+
pageSize: pageSize ?? 10,
|
|
29334
29414
|
dataKey,
|
|
29335
29415
|
dataLabel,
|
|
29336
|
-
initialData:
|
|
29416
|
+
initialData: list || [],
|
|
29337
29417
|
value: normalizedValue,
|
|
29338
29418
|
axiosInstance,
|
|
29339
29419
|
isMultiSelect: true
|
|
29340
29420
|
});
|
|
29421
|
+
const dataLoading = props.loading || loading;
|
|
29341
29422
|
const convertOutput = (values) => {
|
|
29342
29423
|
const unique = ensureUnique(values);
|
|
29343
29424
|
switch (outputFormat) {
|
|
@@ -29349,10 +29430,10 @@ function LazyMultiSelectDropdown({
|
|
|
29349
29430
|
return unique;
|
|
29350
29431
|
}
|
|
29351
29432
|
};
|
|
29352
|
-
const selectedOptions = (0,
|
|
29433
|
+
const selectedOptions = (0, import_react29.useMemo)(() => {
|
|
29353
29434
|
return lazyOptions.filter((opt) => normalizedValue.includes(opt.value));
|
|
29354
29435
|
}, [lazyOptions, normalizedValue]);
|
|
29355
|
-
(0,
|
|
29436
|
+
(0, import_react29.useEffect)(() => {
|
|
29356
29437
|
const handleClick = (e) => {
|
|
29357
29438
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
29358
29439
|
setIsOpen(false);
|
|
@@ -29361,7 +29442,7 @@ function LazyMultiSelectDropdown({
|
|
|
29361
29442
|
document.addEventListener("mousedown", handleClick);
|
|
29362
29443
|
return () => document.removeEventListener("mousedown", handleClick);
|
|
29363
29444
|
}, []);
|
|
29364
|
-
(0,
|
|
29445
|
+
(0, import_react29.useEffect)(() => {
|
|
29365
29446
|
if (!isOpen || !hasMore || loading) return;
|
|
29366
29447
|
const obs = new IntersectionObserver(
|
|
29367
29448
|
(entries) => {
|
|
@@ -29400,10 +29481,11 @@ function LazyMultiSelectDropdown({
|
|
|
29400
29481
|
{
|
|
29401
29482
|
onClick: handleFocus,
|
|
29402
29483
|
className: cn(
|
|
29403
|
-
"
|
|
29484
|
+
"w-full flex items-center flex-wrap gap-1 border border-[#BDBDBD] rounded-md bg-white cursor-pointer",
|
|
29404
29485
|
disabled && "bg-gray-100 cursor-not-allowed",
|
|
29405
29486
|
errorMessage && "border-red-500",
|
|
29406
|
-
className
|
|
29487
|
+
className,
|
|
29488
|
+
"px-2 py-2 min-h-[35px]"
|
|
29407
29489
|
),
|
|
29408
29490
|
children: [
|
|
29409
29491
|
selectedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
@@ -29433,7 +29515,7 @@ function LazyMultiSelectDropdown({
|
|
|
29433
29515
|
{
|
|
29434
29516
|
type: "text",
|
|
29435
29517
|
placeholder: selectedOptions.length ? "" : placeholder,
|
|
29436
|
-
className: "flex-1 min-w-[60px]
|
|
29518
|
+
className: "flex-1 min-w-[60px] px-2 py-0 outline-none text-xs disabled:cursor-not-allowed",
|
|
29437
29519
|
value: isOpen ? searchTerm : "",
|
|
29438
29520
|
onChange: handleSearch,
|
|
29439
29521
|
readOnly,
|
|
@@ -29455,7 +29537,7 @@ function LazyMultiSelectDropdown({
|
|
|
29455
29537
|
top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
|
|
29456
29538
|
left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
|
|
29457
29539
|
},
|
|
29458
|
-
children:
|
|
29540
|
+
children: dataLoading && lazyOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 py-3 text-center text-gray-500", children: "Loading..." }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
29459
29541
|
lazyOptions.map((option) => {
|
|
29460
29542
|
const isSelected = normalizedValue.includes(option.value);
|
|
29461
29543
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
@@ -29482,14 +29564,14 @@ function LazyMultiSelectDropdown({
|
|
|
29482
29564
|
children: loading ? "Loading\u2026" : "Scroll for more\u2026"
|
|
29483
29565
|
}
|
|
29484
29566
|
)
|
|
29485
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 py-
|
|
29567
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 py-3 text-center text-gray-500", children: "No results" })
|
|
29486
29568
|
}
|
|
29487
29569
|
) })
|
|
29488
29570
|
] });
|
|
29489
29571
|
}
|
|
29490
29572
|
|
|
29491
29573
|
// src/components/ui/data-table.tsx
|
|
29492
|
-
var
|
|
29574
|
+
var React10 = __toESM(require("react"));
|
|
29493
29575
|
var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
|
|
29494
29576
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
29495
29577
|
var import_react_table2 = require("@tanstack/react-table");
|
|
@@ -29583,7 +29665,7 @@ function TableCell({ className, ...props }) {
|
|
|
29583
29665
|
var import_react_table = require("@tanstack/react-table");
|
|
29584
29666
|
|
|
29585
29667
|
// src/lib/table/cellRendererFactory.tsx
|
|
29586
|
-
var
|
|
29668
|
+
var import_react30 = __toESM(require("react"));
|
|
29587
29669
|
var import_image3 = __toESM(require("next/image"));
|
|
29588
29670
|
|
|
29589
29671
|
// src/lib/dayjs-setup.ts
|
|
@@ -29669,9 +29751,9 @@ var getContrastColor = (bg) => {
|
|
|
29669
29751
|
};
|
|
29670
29752
|
var sanitizeValue = (val) => {
|
|
29671
29753
|
if (val == null) return null;
|
|
29672
|
-
if (
|
|
29754
|
+
if (import_react30.default.isValidElement(val)) return val;
|
|
29673
29755
|
if (typeof val === "string" || typeof val === "number") return val;
|
|
29674
|
-
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
29756
|
+
if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react30.default.Fragment, { children: sanitizeValue(v) }, i));
|
|
29675
29757
|
if (typeof val === "object") {
|
|
29676
29758
|
if ("name" in val && typeof val.name === "string") return val.name;
|
|
29677
29759
|
if ("label" in val && typeof val.label === "string") return val.label;
|
|
@@ -29816,6 +29898,13 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
29816
29898
|
onChange: info.row.getToggleSelectedHandler()
|
|
29817
29899
|
}
|
|
29818
29900
|
);
|
|
29901
|
+
case "html":
|
|
29902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
29903
|
+
"span",
|
|
29904
|
+
{
|
|
29905
|
+
dangerouslySetInnerHTML: { __html: String(rowValue || formattedValue) }
|
|
29906
|
+
}
|
|
29907
|
+
);
|
|
29819
29908
|
/* -------------------- ADVANCED -------------------- */
|
|
29820
29909
|
case "custom": {
|
|
29821
29910
|
const CustomRenderer = customRenderers[rendererProps?.customRendererId] || customRenderers[rendererProps?.rendererId];
|
|
@@ -29917,10 +30006,10 @@ function DataTable({
|
|
|
29917
30006
|
enableRowSelection = false,
|
|
29918
30007
|
getRowSelection
|
|
29919
30008
|
}) {
|
|
29920
|
-
const [columnFilters, setColumnFilters] =
|
|
29921
|
-
const [columnVisibility, setColumnVisibility] =
|
|
29922
|
-
const [manualSort, setManualSort] =
|
|
29923
|
-
const [searchTerm, setSearchTerm] =
|
|
30009
|
+
const [columnFilters, setColumnFilters] = React10.useState([]);
|
|
30010
|
+
const [columnVisibility, setColumnVisibility] = React10.useState({});
|
|
30011
|
+
const [manualSort, setManualSort] = React10.useState(null);
|
|
30012
|
+
const [searchTerm, setSearchTerm] = React10.useState("");
|
|
29924
30013
|
const tableData = Array.isArray(data) ? data : [];
|
|
29925
30014
|
const finalCols = [...columns];
|
|
29926
30015
|
if (enableRowSelection) {
|
|
@@ -29946,8 +30035,8 @@ function DataTable({
|
|
|
29946
30035
|
});
|
|
29947
30036
|
}
|
|
29948
30037
|
const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
|
|
29949
|
-
const [rowSelection, setRowSelection] =
|
|
29950
|
-
const [localPageSize, setLocalPageSize] =
|
|
30038
|
+
const [rowSelection, setRowSelection] = React10.useState({});
|
|
30039
|
+
const [localPageSize, setLocalPageSize] = React10.useState(pageSize);
|
|
29951
30040
|
const table = (0, import_react_table2.useReactTable)({
|
|
29952
30041
|
data: tableData,
|
|
29953
30042
|
columns: dynamicCols,
|
|
@@ -30012,7 +30101,7 @@ function DataTable({
|
|
|
30012
30101
|
onPageChange?.(currentPageIndex, newSize);
|
|
30013
30102
|
setLocalPageSize(newSize);
|
|
30014
30103
|
};
|
|
30015
|
-
const pageSizeOptions =
|
|
30104
|
+
const pageSizeOptions = React10.useMemo(() => {
|
|
30016
30105
|
const options = [10, 20, 50, 100].filter((size) => size < totalRecords);
|
|
30017
30106
|
if (options.length === 0) {
|
|
30018
30107
|
options.push(10);
|
|
@@ -30088,17 +30177,20 @@ function DataTable({
|
|
|
30088
30177
|
),
|
|
30089
30178
|
"Toggle All"
|
|
30090
30179
|
] }),
|
|
30091
|
-
table.getAllLeafColumns().map((column) =>
|
|
30092
|
-
|
|
30093
|
-
|
|
30094
|
-
|
|
30095
|
-
|
|
30096
|
-
|
|
30097
|
-
|
|
30098
|
-
|
|
30099
|
-
|
|
30100
|
-
|
|
30101
|
-
|
|
30180
|
+
table.getAllLeafColumns().map((column) => {
|
|
30181
|
+
const header = column.columnDef.header;
|
|
30182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
30183
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
30184
|
+
"input",
|
|
30185
|
+
{
|
|
30186
|
+
type: "checkbox",
|
|
30187
|
+
checked: column.getIsVisible(),
|
|
30188
|
+
onChange: (e) => column.toggleVisibility(e.target.checked)
|
|
30189
|
+
}
|
|
30190
|
+
),
|
|
30191
|
+
typeof header === "function" ? header({ column, header, table }) : typeof header === "string" ? header : column.id
|
|
30192
|
+
] }, column.id);
|
|
30193
|
+
})
|
|
30102
30194
|
] })
|
|
30103
30195
|
] })
|
|
30104
30196
|
] }),
|
|
@@ -30567,7 +30659,7 @@ var CustomPagination = ({
|
|
|
30567
30659
|
var Pagination_default = CustomPagination;
|
|
30568
30660
|
|
|
30569
30661
|
// src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
|
|
30570
|
-
var
|
|
30662
|
+
var import_react31 = require("react");
|
|
30571
30663
|
|
|
30572
30664
|
// src/components/ui/accordion.tsx
|
|
30573
30665
|
var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion"));
|
|
@@ -30691,7 +30783,7 @@ var HistoryTimeline = ({
|
|
|
30691
30783
|
createdAtKey,
|
|
30692
30784
|
...props
|
|
30693
30785
|
}) => {
|
|
30694
|
-
const data = (0,
|
|
30786
|
+
const data = (0, import_react31.useMemo)(() => {
|
|
30695
30787
|
if (Array.isArray(props.data)) {
|
|
30696
30788
|
return props.data;
|
|
30697
30789
|
}
|
|
@@ -30768,7 +30860,7 @@ var HistoryTimeline = ({
|
|
|
30768
30860
|
var HistoryTimeline_default = HistoryTimeline;
|
|
30769
30861
|
|
|
30770
30862
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
30771
|
-
var
|
|
30863
|
+
var import_react32 = require("react");
|
|
30772
30864
|
var import_link5 = __toESM(require("next/link"));
|
|
30773
30865
|
var import_navigation3 = require("next/navigation");
|
|
30774
30866
|
|
|
@@ -30926,7 +31018,7 @@ function showSonnerToast({
|
|
|
30926
31018
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
30927
31019
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
30928
31020
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
30929
|
-
const [openIndex, setOpenIndex] = (0,
|
|
31021
|
+
const [openIndex, setOpenIndex] = (0, import_react32.useState)(null);
|
|
30930
31022
|
const currentPathname = (0, import_navigation3.usePathname)();
|
|
30931
31023
|
function groupMenus(menus = []) {
|
|
30932
31024
|
const menuMap = /* @__PURE__ */ new Map();
|
|
@@ -30960,7 +31052,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30960
31052
|
});
|
|
30961
31053
|
return sortMenus(rootMenus);
|
|
30962
31054
|
}
|
|
30963
|
-
const rawTabs = (0,
|
|
31055
|
+
const rawTabs = (0, import_react32.useMemo)(() => {
|
|
30964
31056
|
if (!Array.isArray(tabs)) return [];
|
|
30965
31057
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
30966
31058
|
return groupMenus(tabs);
|
|
@@ -30990,9 +31082,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30990
31082
|
return tab.children.some((child) => isActive(child.url));
|
|
30991
31083
|
};
|
|
30992
31084
|
const router = (0, import_navigation3.useRouter)();
|
|
30993
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
30994
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
30995
|
-
const handleBuilderExit = (0,
|
|
31085
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react32.useState)(false);
|
|
31086
|
+
const [pendingUrl, setPendingUrl] = (0, import_react32.useState)(null);
|
|
31087
|
+
const handleBuilderExit = (0, import_react32.useCallback)(
|
|
30996
31088
|
(e, url) => {
|
|
30997
31089
|
if (isBuilder) {
|
|
30998
31090
|
e.preventDefault();
|
|
@@ -31159,7 +31251,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
31159
31251
|
var Tabs_default = Tabs;
|
|
31160
31252
|
|
|
31161
31253
|
// src/components/Navigation/Stages/Stages.tsx
|
|
31162
|
-
var
|
|
31254
|
+
var import_react33 = __toESM(require("react"));
|
|
31163
31255
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
31164
31256
|
var StagesComponent = ({
|
|
31165
31257
|
stages,
|
|
@@ -31176,8 +31268,8 @@ var StagesComponent = ({
|
|
|
31176
31268
|
triggerOnClick = false,
|
|
31177
31269
|
canvasMode = "desktop"
|
|
31178
31270
|
}) => {
|
|
31179
|
-
const [activeStage, setActiveStage] = (0,
|
|
31180
|
-
const [isCompleted, setIsCompleted] = (0,
|
|
31271
|
+
const [activeStage, setActiveStage] = (0, import_react33.useState)(currentStage || (stages && stages.length > 0 ? stages[0][dataKey] : null));
|
|
31272
|
+
const [isCompleted, setIsCompleted] = (0, import_react33.useState)(false);
|
|
31181
31273
|
const updateStage = (stageKey) => {
|
|
31182
31274
|
setActiveStage(stageKey);
|
|
31183
31275
|
onStageChange?.(stageKey);
|
|
@@ -31245,7 +31337,7 @@ var StagesComponent = ({
|
|
|
31245
31337
|
const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
|
|
31246
31338
|
const isCompletedStage = isAllStagesCompleted || index <= currentIndex;
|
|
31247
31339
|
const isActive = !isAllStagesCompleted && index === currentIndex;
|
|
31248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
31340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react33.default.Fragment, { children: [
|
|
31249
31341
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
31250
31342
|
"button",
|
|
31251
31343
|
{
|
|
@@ -31313,10 +31405,10 @@ var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
|
31313
31405
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
31314
31406
|
|
|
31315
31407
|
// src/components/ui/avatar.tsx
|
|
31316
|
-
var
|
|
31408
|
+
var React12 = __toESM(require("react"));
|
|
31317
31409
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
31318
31410
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
31319
|
-
var Avatar =
|
|
31411
|
+
var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
31320
31412
|
AvatarPrimitive.Root,
|
|
31321
31413
|
{
|
|
31322
31414
|
ref,
|
|
@@ -31328,7 +31420,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
31328
31420
|
}
|
|
31329
31421
|
));
|
|
31330
31422
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
31331
|
-
var AvatarImage =
|
|
31423
|
+
var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
31332
31424
|
AvatarPrimitive.Image,
|
|
31333
31425
|
{
|
|
31334
31426
|
ref,
|
|
@@ -31337,7 +31429,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
31337
31429
|
}
|
|
31338
31430
|
));
|
|
31339
31431
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
31340
|
-
var AvatarFallback =
|
|
31432
|
+
var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
31341
31433
|
AvatarPrimitive.Fallback,
|
|
31342
31434
|
{
|
|
31343
31435
|
ref,
|
|
@@ -31355,7 +31447,7 @@ var import_link6 = __toESM(require("next/link"));
|
|
|
31355
31447
|
var import_image4 = __toESM(require("next/image"));
|
|
31356
31448
|
var import_navigation4 = require("next/navigation");
|
|
31357
31449
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
31358
|
-
var
|
|
31450
|
+
var import_react34 = require("react");
|
|
31359
31451
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
31360
31452
|
function Navbar({
|
|
31361
31453
|
style,
|
|
@@ -31376,9 +31468,9 @@ function Navbar({
|
|
|
31376
31468
|
}) {
|
|
31377
31469
|
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
31378
31470
|
const router = (0, import_navigation4.useRouter)();
|
|
31379
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
31380
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
31381
|
-
const handleBuilderExit = (0,
|
|
31471
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react34.useState)(false);
|
|
31472
|
+
const [pendingUrl, setPendingUrl] = (0, import_react34.useState)(null);
|
|
31473
|
+
const handleBuilderExit = (0, import_react34.useCallback)(
|
|
31382
31474
|
(e, url) => {
|
|
31383
31475
|
if (isBuilder) {
|
|
31384
31476
|
e.preventDefault();
|
|
@@ -31394,7 +31486,7 @@ function Navbar({
|
|
|
31394
31486
|
router.push(pendingUrl);
|
|
31395
31487
|
}
|
|
31396
31488
|
};
|
|
31397
|
-
const formatedMenu = (0,
|
|
31489
|
+
const formatedMenu = (0, import_react34.useMemo)(() => {
|
|
31398
31490
|
if (source === "state" && navList && navList.length) {
|
|
31399
31491
|
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
31400
31492
|
}
|
|
@@ -31497,7 +31589,7 @@ function Navbar({
|
|
|
31497
31589
|
}
|
|
31498
31590
|
|
|
31499
31591
|
// src/components/Chart/BarChart.tsx
|
|
31500
|
-
var
|
|
31592
|
+
var import_react35 = __toESM(require("react"));
|
|
31501
31593
|
var import_axios2 = __toESM(require("axios"));
|
|
31502
31594
|
var import_recharts = require("recharts");
|
|
31503
31595
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
@@ -31558,18 +31650,18 @@ var ChartComponent = ({
|
|
|
31558
31650
|
canvasMode,
|
|
31559
31651
|
...props
|
|
31560
31652
|
}) => {
|
|
31561
|
-
const [rawData, setRawData] = (0,
|
|
31562
|
-
const [rawMeta, setRawMeta] = (0,
|
|
31563
|
-
const [localLoading, setLocalLoading] = (0,
|
|
31564
|
-
const [currentPage, setCurrentPage] = (0,
|
|
31653
|
+
const [rawData, setRawData] = (0, import_react35.useState)([]);
|
|
31654
|
+
const [rawMeta, setRawMeta] = (0, import_react35.useState)(null);
|
|
31655
|
+
const [localLoading, setLocalLoading] = (0, import_react35.useState)(false);
|
|
31656
|
+
const [currentPage, setCurrentPage] = (0, import_react35.useState)(1);
|
|
31565
31657
|
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
31566
31658
|
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
31567
|
-
(0,
|
|
31659
|
+
(0, import_react35.useEffect)(() => {
|
|
31568
31660
|
if (apiUrl) {
|
|
31569
31661
|
setCurrentPage(1);
|
|
31570
31662
|
}
|
|
31571
31663
|
}, [apiUrl]);
|
|
31572
|
-
const fetchData = (0,
|
|
31664
|
+
const fetchData = (0, import_react35.useCallback)(async (page) => {
|
|
31573
31665
|
if (!apiUrl) return;
|
|
31574
31666
|
const cancelled = false;
|
|
31575
31667
|
try {
|
|
@@ -31606,7 +31698,7 @@ var ChartComponent = ({
|
|
|
31606
31698
|
if (!cancelled) setLocalLoading(false);
|
|
31607
31699
|
}
|
|
31608
31700
|
}, [apiUrl, limit]);
|
|
31609
|
-
(0,
|
|
31701
|
+
(0, import_react35.useEffect)(() => {
|
|
31610
31702
|
if (!apiUrl) return;
|
|
31611
31703
|
fetchData(currentPage);
|
|
31612
31704
|
}, [apiUrl, currentPage, fetchData]);
|
|
@@ -31614,7 +31706,7 @@ var ChartComponent = ({
|
|
|
31614
31706
|
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
31615
31707
|
setCurrentPage(newPage);
|
|
31616
31708
|
};
|
|
31617
|
-
const data = (0,
|
|
31709
|
+
const data = (0, import_react35.useMemo)(() => {
|
|
31618
31710
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
31619
31711
|
return [];
|
|
31620
31712
|
}
|
|
@@ -31802,10 +31894,10 @@ var ChartComponent = ({
|
|
|
31802
31894
|
] }) })
|
|
31803
31895
|
] });
|
|
31804
31896
|
};
|
|
31805
|
-
var BarChart_default =
|
|
31897
|
+
var BarChart_default = import_react35.default.memo(ChartComponent);
|
|
31806
31898
|
|
|
31807
31899
|
// src/components/Chart/PieChart.tsx
|
|
31808
|
-
var
|
|
31900
|
+
var import_react36 = __toESM(require("react"));
|
|
31809
31901
|
var import_axios3 = __toESM(require("axios"));
|
|
31810
31902
|
var import_recharts2 = require("recharts");
|
|
31811
31903
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -31885,11 +31977,11 @@ var DonutChart = ({
|
|
|
31885
31977
|
}) => {
|
|
31886
31978
|
const showLegends = props.showLegends ?? true;
|
|
31887
31979
|
const canvasMode = props.canvasMode;
|
|
31888
|
-
const [rawData, setRawData] = (0,
|
|
31889
|
-
const [localLoading, setLocalLoading] = (0,
|
|
31980
|
+
const [rawData, setRawData] = (0, import_react36.useState)([]);
|
|
31981
|
+
const [localLoading, setLocalLoading] = (0, import_react36.useState)(false);
|
|
31890
31982
|
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
31891
31983
|
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
31892
|
-
(0,
|
|
31984
|
+
(0, import_react36.useEffect)(() => {
|
|
31893
31985
|
if (!apiUrl) return;
|
|
31894
31986
|
let cancelled = false;
|
|
31895
31987
|
const fetchData = async () => {
|
|
@@ -31925,7 +32017,7 @@ var DonutChart = ({
|
|
|
31925
32017
|
cancelled = true;
|
|
31926
32018
|
};
|
|
31927
32019
|
}, [apiUrl]);
|
|
31928
|
-
const data = (0,
|
|
32020
|
+
const data = (0, import_react36.useMemo)(() => {
|
|
31929
32021
|
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
31930
32022
|
return effectiveData.map((item) => ({
|
|
31931
32023
|
...item,
|
|
@@ -31934,11 +32026,11 @@ var DonutChart = ({
|
|
|
31934
32026
|
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
31935
32027
|
}));
|
|
31936
32028
|
}, [effectiveData, dataKey, dataLabel]);
|
|
31937
|
-
const total = (0,
|
|
32029
|
+
const total = (0, import_react36.useMemo)(
|
|
31938
32030
|
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
31939
32031
|
[data, dataKey]
|
|
31940
32032
|
);
|
|
31941
|
-
const formattedTotal = (0,
|
|
32033
|
+
const formattedTotal = (0, import_react36.useMemo)(() => {
|
|
31942
32034
|
if (total >= 1e6) {
|
|
31943
32035
|
return `${(total / 1e6).toFixed(1)}M`;
|
|
31944
32036
|
}
|
|
@@ -31947,7 +32039,7 @@ var DonutChart = ({
|
|
|
31947
32039
|
}
|
|
31948
32040
|
return total.toString();
|
|
31949
32041
|
}, [total]);
|
|
31950
|
-
const chartData = (0,
|
|
32042
|
+
const chartData = (0, import_react36.useMemo)(() => {
|
|
31951
32043
|
if (total === 0) return data;
|
|
31952
32044
|
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
31953
32045
|
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
@@ -31970,12 +32062,12 @@ var DonutChart = ({
|
|
|
31970
32062
|
if (chartData.length <= 6) return { inner: 85, outer: 150 };
|
|
31971
32063
|
return { inner: 70, outer: 130 };
|
|
31972
32064
|
};
|
|
31973
|
-
const [mounted, setMounted] = (0,
|
|
31974
|
-
(0,
|
|
32065
|
+
const [mounted, setMounted] = (0, import_react36.useState)(false);
|
|
32066
|
+
(0, import_react36.useEffect)(() => {
|
|
31975
32067
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
31976
32068
|
return () => clearTimeout(timeout);
|
|
31977
32069
|
}, []);
|
|
31978
|
-
const renderLegends = (0,
|
|
32070
|
+
const renderLegends = (0, import_react36.useMemo)(() => {
|
|
31979
32071
|
if (!showLegends) return null;
|
|
31980
32072
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex flex-wrap justify-center gap-2 mt-4 w-full max-w-4xl", children: chartData.map((d, index) => {
|
|
31981
32073
|
const actualValue = data.find(
|
|
@@ -32103,7 +32195,7 @@ var DonutChart = ({
|
|
|
32103
32195
|
renderLegends
|
|
32104
32196
|
] });
|
|
32105
32197
|
};
|
|
32106
|
-
var PieChart_default =
|
|
32198
|
+
var PieChart_default = import_react36.default.memo(DonutChart);
|
|
32107
32199
|
|
|
32108
32200
|
// src/components/Blocks/EmailComposer.tsx
|
|
32109
32201
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|