@algorithm-shift/design-system 1.2.981 → 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.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: () => Icon_default,
51
+ Icon: () => Icon2,
52
52
  Image: () => Image_default,
53
53
  Modal: () => Modal,
54
54
  MultiCheckbox: () => MultiCheckbox,
@@ -26952,39 +26952,117 @@ function SplitButton({ style, textContent, className, list = [] }) {
26952
26952
  }
26953
26953
 
26954
26954
  // src/components/Basic/Icon/Icon.tsx
26955
- var faSolid = __toESM(require("@fortawesome/free-solid-svg-icons"));
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
- var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize = 10, style }) => {
26959
- let content = null;
26960
- if (iconType === "fontawesome") {
26961
- const faKey = "fa" + name.charAt(0).toUpperCase() + name.slice(1);
26962
- const faIcon = faSolid[faKey];
26963
- if (!faIcon) {
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
- content = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
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: faIcon,
26970
- className: cn("inline-block"),
26971
- style: { fontSize: `${fontSize}px`, color: style?.color }
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 (iconType === "lucide") {
26976
- const Lucide = lucide_react_exports[name];
26977
- if (!Lucide) {
26978
- return null;
26979
- }
26980
- content = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Lucide, { className: cn("w-5 h-5"), size: fontSize, style: { color: style?.color } });
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
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style, className, children: content });
26983
- };
26984
- var Icon_default = Icon2;
27060
+ console.warn("Unknown icon set:", iconSet);
27061
+ return null;
27062
+ }
26985
27063
 
26986
27064
  // src/components/Inputs/TextInput/TextInput.tsx
26987
- var import_react8 = require("react");
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, import_react8.useEffect)(() => {
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 import_react9 = require("react");
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, import_react9.useEffect)(() => {
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 import_react10 = require("react");
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, import_react10.useEffect)(() => {
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 import_react11 = require("react");
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, import_react11.useEffect)(() => {
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 import_react12 = require("react");
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, import_react12.useEffect)(() => {
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 import_react13 = require("react");
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, import_react13.useEffect)(() => {
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 import_react14 = require("react");
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, import_react14.useEffect)(() => {
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 import_react15 = require("react");
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, import_react15.useEffect)(() => {
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 import_react16 = require("react");
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, import_react16.useState)([]);
27523
- const [page, setPage] = (0, import_react16.useState)(1);
27524
- const [hasMore, setHasMore] = (0, import_react16.useState)(true);
27525
- const [pageLoading, setPageLoading] = (0, import_react16.useState)(false);
27526
- const loadMoreRef = (0, import_react16.useRef)(null);
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, import_react16.useCallback)(async () => {
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, import_react16.useCallback)(
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, import_react16.useCallback)(async () => {
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, import_react16.useEffect)(() => {
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, import_react16.useEffect)(() => {
27673
+ (0, import_react17.useEffect)(() => {
27596
27674
  if (source === "api") loadPage();
27597
27675
  }, [page, source]);
27598
- (0, import_react16.useEffect)(() => {
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 import_react18 = require("react");
27739
+ var import_react19 = require("react");
27662
27740
 
27663
27741
  // src/components/Global/TinyMceEditor.tsx
27664
- var import_react17 = require("react");
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, import_react17.useRef)(null);
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, import_react17.useMemo)(() => {
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, import_react18.useEffect)(() => {
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 import_react21 = require("react");
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 import_react20 = require("react");
27969
+ var import_react21 = require("react");
27892
27970
 
27893
27971
  // src/hooks/useLazyDropdown.ts
27894
- var import_react19 = require("react");
27972
+ var import_react20 = require("react");
27895
27973
  var import_axios = __toESM(require("axios"));
27896
27974
  function useLazyDropdown(config) {
27897
- const [options, setOptions] = (0, import_react19.useState)([]);
27898
- const [page, setPage] = (0, import_react19.useState)(1);
27899
- const [hasMore, setHasMore] = (0, import_react19.useState)(true);
27900
- const [loading, setLoading] = (0, import_react19.useState)(false);
27901
- const [searchTerm, setSearchTerm] = (0, import_react19.useState)("");
27902
- const debounceTimer = (0, import_react19.useRef)(null);
27903
- const allDataRef = (0, import_react19.useRef)([]);
27904
- const configRef = (0, import_react19.useRef)(config);
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, import_react19.useEffect)(() => {
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, import_react19.useCallback)((data) => {
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, import_react19.useCallback)(async (pageNum, term) => {
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, import_react19.useCallback)(async (pageNum, term) => {
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, import_react19.useEffect)(() => {
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, import_react19.useCallback)(() => {
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, import_react19.useCallback)((term) => {
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, import_react19.useCallback)(() => {
28165
+ const reset = (0, import_react20.useCallback)(() => {
28088
28166
  setSearchTerm("");
28089
28167
  setPage(1);
28090
28168
  }, []);
28091
- (0, import_react19.useEffect)(() => {
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, import_react19.useEffect)(() => {
28175
+ (0, import_react20.useEffect)(() => {
28098
28176
  return () => {
28099
28177
  if (debounceTimer.current) clearTimeout(debounceTimer.current);
28100
28178
  };
@@ -28158,10 +28236,10 @@ function LazySelectDropdown({
28158
28236
  enableAddNewOption = false,
28159
28237
  enforceStrictQueryParams = false
28160
28238
  }) {
28161
- const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
28162
- const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
28163
- const dropdownRef = (0, import_react20.useRef)(null);
28164
- const observerTarget = (0, import_react20.useRef)(null);
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);
28165
28243
  const {
28166
28244
  options: lazyOptions,
28167
28245
  loading,
@@ -28183,8 +28261,8 @@ function LazySelectDropdown({
28183
28261
  axiosInstance,
28184
28262
  enforceStrictQueryParams
28185
28263
  });
28186
- const selectedOption = (0, import_react20.useMemo)(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
28187
- (0, import_react20.useEffect)(() => {
28264
+ const selectedOption = (0, import_react21.useMemo)(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
28265
+ (0, import_react21.useEffect)(() => {
28188
28266
  const handleClickOutside = (e) => {
28189
28267
  if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
28190
28268
  setIsOpen(false);
@@ -28194,7 +28272,7 @@ function LazySelectDropdown({
28194
28272
  document.addEventListener("mousedown", handleClickOutside);
28195
28273
  return () => document.removeEventListener("mousedown", handleClickOutside);
28196
28274
  }, []);
28197
- (0, import_react20.useEffect)(() => {
28275
+ (0, import_react21.useEffect)(() => {
28198
28276
  if (!isOpen || !hasMore || loading) return;
28199
28277
  const observer = new IntersectionObserver(
28200
28278
  (entries) => {
@@ -28334,7 +28412,7 @@ var Dropdown = ({ className, style, ...props }) => {
28334
28412
  const isEditable = props.isEditable ?? true;
28335
28413
  const isDisabled = props.isDisabled ?? false;
28336
28414
  const isReadonly = props.isReadonly ?? false;
28337
- (0, import_react21.useEffect)(() => {
28415
+ (0, import_react22.useEffect)(() => {
28338
28416
  if (props.value !== void 0) {
28339
28417
  handleChange(props.value);
28340
28418
  }
@@ -28393,7 +28471,7 @@ var Dropdown = ({ className, style, ...props }) => {
28393
28471
  var Dropdown_default = Dropdown;
28394
28472
 
28395
28473
  // src/components/Inputs/SwitchToggle/SwitchToggle.tsx
28396
- var import_react22 = require("react");
28474
+ var import_react23 = require("react");
28397
28475
 
28398
28476
  // src/components/ui/switch.tsx
28399
28477
  var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
@@ -28429,7 +28507,7 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
28429
28507
  var SwitchToggle = ({ className, style, ...props }) => {
28430
28508
  const isEditable = props.isEditable ?? true;
28431
28509
  const isDisabled = props.isDisabled ?? false;
28432
- (0, import_react22.useEffect)(() => {
28510
+ (0, import_react23.useEffect)(() => {
28433
28511
  if (props.value !== void 0) {
28434
28512
  handleChange?.(props.value);
28435
28513
  }
@@ -28456,7 +28534,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
28456
28534
  var SwitchToggle_default = SwitchToggle;
28457
28535
 
28458
28536
  // src/components/Inputs/PhoneInput/PhoneInput.tsx
28459
- var import_react23 = require("react");
28537
+ var import_react24 = require("react");
28460
28538
  var import_react_international_phone = require("react-international-phone");
28461
28539
  var import_style = require("react-international-phone/style.css");
28462
28540
  var import_jsx_runtime40 = require("react/jsx-runtime");
@@ -28471,7 +28549,7 @@ var PhoneInput = ({ className, style, ...props }) => {
28471
28549
  const placeholder = props.placeholder ?? "Enter phone number";
28472
28550
  const isEditable = props.isEditable ?? true;
28473
28551
  const isDisabled = props.isDisabled ?? false;
28474
- (0, import_react23.useEffect)(() => {
28552
+ (0, import_react24.useEffect)(() => {
28475
28553
  if (props.value !== void 0) {
28476
28554
  const normalized = ensureIndiaCode(props.value);
28477
28555
  handleChange?.(normalized);
@@ -28518,7 +28596,7 @@ var PhoneInput = ({ className, style, ...props }) => {
28518
28596
  var PhoneInput_default = PhoneInput;
28519
28597
 
28520
28598
  // src/components/Inputs/SearchInput/SearchInput.tsx
28521
- var import_react24 = require("react");
28599
+ var import_react25 = require("react");
28522
28600
  var import_jsx_runtime41 = require("react/jsx-runtime");
28523
28601
  var SearchInput = ({ className, style, ...props }) => {
28524
28602
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -28526,7 +28604,7 @@ var SearchInput = ({ className, style, ...props }) => {
28526
28604
  const isDisabled = props.isDisabled ?? false;
28527
28605
  const isReadonly = props.isReadonly ?? false;
28528
28606
  const isAutocomplete = props.isAutocomplete ?? false;
28529
- (0, import_react24.useEffect)(() => {
28607
+ (0, import_react25.useEffect)(() => {
28530
28608
  if (props.value !== void 0) {
28531
28609
  const e = { target: { value: props.value } };
28532
28610
  handleChange?.(e);
@@ -28568,11 +28646,11 @@ var SearchInput = ({ className, style, ...props }) => {
28568
28646
  var SearchInput_default = SearchInput;
28569
28647
 
28570
28648
  // src/components/Inputs/FileInput/FileInput.tsx
28571
- var import_react25 = require("react");
28649
+ var import_react26 = require("react");
28572
28650
  var import_jsx_runtime42 = require("react/jsx-runtime");
28573
28651
  var FileInput2 = ({ className, style, ...props }) => {
28574
28652
  const placeholder = props.placeholder ?? "Placeholder text";
28575
- (0, import_react25.useEffect)(() => {
28653
+ (0, import_react26.useEffect)(() => {
28576
28654
  if (props.value !== void 0) {
28577
28655
  const e = { target: { value: props.value } };
28578
28656
  handleChange?.(e);
@@ -28612,11 +28690,11 @@ var FileInput2 = ({ className, style, ...props }) => {
28612
28690
  var FileInput_default = FileInput2;
28613
28691
 
28614
28692
  // src/components/Inputs/DatePicker/DatePicker.tsx
28615
- var React6 = __toESM(require("react"));
28693
+ var React7 = __toESM(require("react"));
28616
28694
  var import_date_fns = require("date-fns");
28617
28695
 
28618
28696
  // src/components/ui/calendar.tsx
28619
- var React5 = __toESM(require("react"));
28697
+ var React6 = __toESM(require("react"));
28620
28698
  var import_react_day_picker = require("react-day-picker");
28621
28699
  var import_jsx_runtime43 = require("react/jsx-runtime");
28622
28700
  function Calendar2({
@@ -28771,8 +28849,8 @@ function CalendarDayButton({
28771
28849
  ...props
28772
28850
  }) {
28773
28851
  const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
28774
- const ref = React5.useRef(null);
28775
- React5.useEffect(() => {
28852
+ const ref = React6.useRef(null);
28853
+ React6.useEffect(() => {
28776
28854
  if (modifiers.focused) ref.current?.focus();
28777
28855
  }, [modifiers.focused]);
28778
28856
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -28866,25 +28944,25 @@ function DateTimePicker({
28866
28944
  const isAutocomplete = props.isAutocomplete ?? false;
28867
28945
  const minDate = resolveDate(minimumDate, customMinimumDate);
28868
28946
  const maxDate = resolveDate(maximumDate, customMaximumDate);
28869
- const [date, setDate] = React6.useState(() => {
28947
+ const [date, setDate] = React7.useState(() => {
28870
28948
  if (!props.value) return void 0;
28871
28949
  const d = new Date(props.value);
28872
28950
  return isNaN(d.getTime()) ? void 0 : d;
28873
28951
  });
28874
28952
  const initialHours = date ? date.getHours() : 0;
28875
28953
  const initialMinutes = date ? date.getMinutes() : 0;
28876
- const [hours, setHours] = React6.useState(initialHours);
28877
- const [minutes, setMinutes] = React6.useState(initialMinutes);
28878
- const [amPm, setAmPm] = React6.useState("AM");
28879
- const displayHours = React6.useMemo(() => {
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(() => {
28880
28958
  if (hours === 0) return 12;
28881
28959
  if (hours > 12) return hours - 12;
28882
28960
  return hours;
28883
28961
  }, [hours]);
28884
- React6.useEffect(() => {
28962
+ React7.useEffect(() => {
28885
28963
  setAmPm(hours >= 12 ? "PM" : "AM");
28886
28964
  }, [hours]);
28887
- React6.useEffect(() => {
28965
+ React7.useEffect(() => {
28888
28966
  if (!props.value) {
28889
28967
  setDate(void 0);
28890
28968
  return;
@@ -28896,8 +28974,8 @@ function DateTimePicker({
28896
28974
  setMinutes(d.getMinutes());
28897
28975
  }
28898
28976
  }, [props.value]);
28899
- const [year, setYear] = React6.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
28900
- React6.useEffect(() => {
28977
+ const [year, setYear] = React7.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
28978
+ React7.useEffect(() => {
28901
28979
  if (!date) return;
28902
28980
  const newDate = new Date(date);
28903
28981
  newDate.setFullYear(year);
@@ -29000,7 +29078,7 @@ function DateTimePicker({
29000
29078
  for (let y = currentYear - 50; y <= currentYear + 10; y++) {
29001
29079
  yearOptions.push(y);
29002
29080
  }
29003
- const displayValue = React6.useMemo(() => {
29081
+ const displayValue = React7.useMemo(() => {
29004
29082
  if (!date) return "";
29005
29083
  try {
29006
29084
  if (mode === "date") return (0, import_date_fns.format)(date, "dd-MM-yyyy");
@@ -29011,11 +29089,11 @@ function DateTimePicker({
29011
29089
  }
29012
29090
  }, [date, mode]);
29013
29091
  const isInputDisabled = isDisabled || !isEditable;
29014
- const [calendarMonthState, setCalendarMonthState] = React6.useState(() => {
29092
+ const [calendarMonthState, setCalendarMonthState] = React7.useState(() => {
29015
29093
  const currentMonth = (/* @__PURE__ */ new Date()).getMonth();
29016
29094
  return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, currentMonth);
29017
29095
  });
29018
- React6.useEffect(() => {
29096
+ React7.useEffect(() => {
29019
29097
  setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
29020
29098
  }, [year]);
29021
29099
  const handleToday = () => {
@@ -29161,18 +29239,18 @@ function DateTimePicker({
29161
29239
  }
29162
29240
 
29163
29241
  // src/components/Inputs/DateRange/DateRange.tsx
29164
- var import_react26 = __toESM(require("react"));
29242
+ var import_react27 = __toESM(require("react"));
29165
29243
  var import_date_fns2 = require("date-fns");
29166
29244
  var import_jsx_runtime46 = require("react/jsx-runtime");
29167
29245
  var DateRange = ({ className, style, ...props }) => {
29168
29246
  const isDateRange = (val) => !!val && val.from instanceof Date;
29169
- const [date, setDate] = import_react26.default.useState(
29247
+ const [date, setDate] = import_react27.default.useState(
29170
29248
  isDateRange(props.value) ? props.value : {
29171
29249
  from: /* @__PURE__ */ new Date(),
29172
29250
  to: (0, import_date_fns2.addDays)(/* @__PURE__ */ new Date(), 7)
29173
29251
  }
29174
29252
  );
29175
- (0, import_react26.useEffect)(() => {
29253
+ (0, import_react27.useEffect)(() => {
29176
29254
  if (props.value && isDateRange(props.value)) {
29177
29255
  handleChange?.(props.value);
29178
29256
  }
@@ -29219,7 +29297,7 @@ var DateRange = ({ className, style, ...props }) => {
29219
29297
  var DateRange_default = DateRange;
29220
29298
 
29221
29299
  // src/components/Inputs/TextInputGroup/TextInputGroup.tsx
29222
- var import_react27 = require("react");
29300
+ var import_react28 = require("react");
29223
29301
  var import_jsx_runtime47 = require("react/jsx-runtime");
29224
29302
  var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
29225
29303
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -29227,7 +29305,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
29227
29305
  const isDisabled = props.isDisabled ?? false;
29228
29306
  const isReadonly = props.isReadonly ?? false;
29229
29307
  const isAutocomplete = props.isAutocomplete ?? false;
29230
- (0, import_react27.useEffect)(() => {
29308
+ (0, import_react28.useEffect)(() => {
29231
29309
  if (props.value !== void 0) {
29232
29310
  const e = { target: { value: props.value } };
29233
29311
  handleChange?.(e);
@@ -29280,10 +29358,9 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
29280
29358
  var TextInputGroup_default = TextInputGroup;
29281
29359
 
29282
29360
  // src/components/Inputs/Multiselect/MultiSelect.tsx
29283
- var import_react28 = require("react");
29361
+ var import_react29 = require("react");
29284
29362
  var import_jsx_runtime48 = require("react/jsx-runtime");
29285
29363
  function LazyMultiSelectDropdown({
29286
- options = [],
29287
29364
  value = [],
29288
29365
  onChange,
29289
29366
  placeholder,
@@ -29298,12 +29375,13 @@ function LazyMultiSelectDropdown({
29298
29375
  dataLabel = "name",
29299
29376
  errorMessage,
29300
29377
  axiosInstance,
29301
- outputFormat = "array"
29378
+ outputFormat = "array",
29379
+ ...props
29302
29380
  }) {
29303
- const [isOpen, setIsOpen] = (0, import_react28.useState)(false);
29304
- const [searchTerm, setSearchTerm] = (0, import_react28.useState)("");
29305
- const dropdownRef = (0, import_react28.useRef)(null);
29306
- const observerTarget = (0, import_react28.useRef)(null);
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);
29307
29385
  const ensureUnique = (arr) => {
29308
29386
  return Array.from(new Set(arr));
29309
29387
  };
@@ -29320,26 +29398,27 @@ function LazyMultiSelectDropdown({
29320
29398
  return ensureUnique(arr);
29321
29399
  };
29322
29400
  const normalizedValue = normalizeInput(value);
29401
+ const list = Array.isArray(props?.data) ? props.data : [];
29323
29402
  const {
29324
29403
  options: lazyOptions,
29325
29404
  loading,
29326
29405
  hasMore,
29327
29406
  loadMore,
29328
29407
  search,
29329
- reset,
29330
29408
  loadPage
29331
29409
  } = useLazyDropdown({
29332
29410
  enabled: true,
29333
29411
  dataSource: source || "",
29334
29412
  apiUrl,
29335
- pageSize: pageSize || 10,
29413
+ pageSize: pageSize ?? 10,
29336
29414
  dataKey,
29337
29415
  dataLabel,
29338
- initialData: options || [],
29416
+ initialData: list || [],
29339
29417
  value: normalizedValue,
29340
29418
  axiosInstance,
29341
29419
  isMultiSelect: true
29342
29420
  });
29421
+ const dataLoading = props.loading || loading;
29343
29422
  const convertOutput = (values) => {
29344
29423
  const unique = ensureUnique(values);
29345
29424
  switch (outputFormat) {
@@ -29351,10 +29430,10 @@ function LazyMultiSelectDropdown({
29351
29430
  return unique;
29352
29431
  }
29353
29432
  };
29354
- const selectedOptions = (0, import_react28.useMemo)(() => {
29433
+ const selectedOptions = (0, import_react29.useMemo)(() => {
29355
29434
  return lazyOptions.filter((opt) => normalizedValue.includes(opt.value));
29356
29435
  }, [lazyOptions, normalizedValue]);
29357
- (0, import_react28.useEffect)(() => {
29436
+ (0, import_react29.useEffect)(() => {
29358
29437
  const handleClick = (e) => {
29359
29438
  if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
29360
29439
  setIsOpen(false);
@@ -29363,7 +29442,7 @@ function LazyMultiSelectDropdown({
29363
29442
  document.addEventListener("mousedown", handleClick);
29364
29443
  return () => document.removeEventListener("mousedown", handleClick);
29365
29444
  }, []);
29366
- (0, import_react28.useEffect)(() => {
29445
+ (0, import_react29.useEffect)(() => {
29367
29446
  if (!isOpen || !hasMore || loading) return;
29368
29447
  const obs = new IntersectionObserver(
29369
29448
  (entries) => {
@@ -29402,10 +29481,11 @@ function LazyMultiSelectDropdown({
29402
29481
  {
29403
29482
  onClick: handleFocus,
29404
29483
  className: cn(
29405
- "min-h-10 w-full flex items-center flex-wrap gap-1 px-2 py-1 border border-[#BDBDBD] rounded-md bg-white cursor-pointer",
29484
+ "w-full flex items-center flex-wrap gap-1 border border-[#BDBDBD] rounded-md bg-white cursor-pointer",
29406
29485
  disabled && "bg-gray-100 cursor-not-allowed",
29407
29486
  errorMessage && "border-red-500",
29408
- className
29487
+ className,
29488
+ "px-2 py-2 min-h-[35px]"
29409
29489
  ),
29410
29490
  children: [
29411
29491
  selectedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
@@ -29435,7 +29515,7 @@ function LazyMultiSelectDropdown({
29435
29515
  {
29436
29516
  type: "text",
29437
29517
  placeholder: selectedOptions.length ? "" : placeholder,
29438
- className: "flex-1 min-w-[60px] p-1 outline-none text-xs disabled:cursor-not-allowed",
29518
+ className: "flex-1 min-w-[60px] px-2 py-0 outline-none text-xs disabled:cursor-not-allowed",
29439
29519
  value: isOpen ? searchTerm : "",
29440
29520
  onChange: handleSearch,
29441
29521
  readOnly,
@@ -29457,7 +29537,7 @@ function LazyMultiSelectDropdown({
29457
29537
  top: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().bottom + window.scrollY : 0,
29458
29538
  left: dropdownRef.current ? dropdownRef.current.getBoundingClientRect().left + window.scrollX : 0
29459
29539
  },
29460
- children: loading && lazyOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 py-4 text-center text-gray-500", children: "Loading..." }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { 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: [
29461
29541
  lazyOptions.map((option) => {
29462
29542
  const isSelected = normalizedValue.includes(option.value);
29463
29543
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
@@ -29484,14 +29564,14 @@ function LazyMultiSelectDropdown({
29484
29564
  children: loading ? "Loading\u2026" : "Scroll for more\u2026"
29485
29565
  }
29486
29566
  )
29487
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 py-4 text-center text-gray-500", children: "No results" })
29567
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-3 py-3 text-center text-gray-500", children: "No results" })
29488
29568
  }
29489
29569
  ) })
29490
29570
  ] });
29491
29571
  }
29492
29572
 
29493
29573
  // src/components/ui/data-table.tsx
29494
- var React9 = __toESM(require("react"));
29574
+ var React10 = __toESM(require("react"));
29495
29575
  var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
29496
29576
  var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
29497
29577
  var import_react_table2 = require("@tanstack/react-table");
@@ -29585,7 +29665,7 @@ function TableCell({ className, ...props }) {
29585
29665
  var import_react_table = require("@tanstack/react-table");
29586
29666
 
29587
29667
  // src/lib/table/cellRendererFactory.tsx
29588
- var import_react29 = __toESM(require("react"));
29668
+ var import_react30 = __toESM(require("react"));
29589
29669
  var import_image3 = __toESM(require("next/image"));
29590
29670
 
29591
29671
  // src/lib/dayjs-setup.ts
@@ -29671,9 +29751,9 @@ var getContrastColor = (bg) => {
29671
29751
  };
29672
29752
  var sanitizeValue = (val) => {
29673
29753
  if (val == null) return null;
29674
- if (import_react29.default.isValidElement(val)) return val;
29754
+ if (import_react30.default.isValidElement(val)) return val;
29675
29755
  if (typeof val === "string" || typeof val === "number") return val;
29676
- if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react29.default.Fragment, { children: sanitizeValue(v) }, i));
29756
+ if (Array.isArray(val)) return val.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react30.default.Fragment, { children: sanitizeValue(v) }, i));
29677
29757
  if (typeof val === "object") {
29678
29758
  if ("name" in val && typeof val.name === "string") return val.name;
29679
29759
  if ("label" in val && typeof val.label === "string") return val.label;
@@ -29926,10 +30006,10 @@ function DataTable({
29926
30006
  enableRowSelection = false,
29927
30007
  getRowSelection
29928
30008
  }) {
29929
- const [columnFilters, setColumnFilters] = React9.useState([]);
29930
- const [columnVisibility, setColumnVisibility] = React9.useState({});
29931
- const [manualSort, setManualSort] = React9.useState(null);
29932
- const [searchTerm, setSearchTerm] = React9.useState("");
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("");
29933
30013
  const tableData = Array.isArray(data) ? data : [];
29934
30014
  const finalCols = [...columns];
29935
30015
  if (enableRowSelection) {
@@ -29955,8 +30035,8 @@ function DataTable({
29955
30035
  });
29956
30036
  }
29957
30037
  const dynamicCols = useDynamicColumns({ columns: finalCols, enableRowSelection });
29958
- const [rowSelection, setRowSelection] = React9.useState({});
29959
- const [localPageSize, setLocalPageSize] = React9.useState(pageSize);
30038
+ const [rowSelection, setRowSelection] = React10.useState({});
30039
+ const [localPageSize, setLocalPageSize] = React10.useState(pageSize);
29960
30040
  const table = (0, import_react_table2.useReactTable)({
29961
30041
  data: tableData,
29962
30042
  columns: dynamicCols,
@@ -30021,7 +30101,7 @@ function DataTable({
30021
30101
  onPageChange?.(currentPageIndex, newSize);
30022
30102
  setLocalPageSize(newSize);
30023
30103
  };
30024
- const pageSizeOptions = React9.useMemo(() => {
30104
+ const pageSizeOptions = React10.useMemo(() => {
30025
30105
  const options = [10, 20, 50, 100].filter((size) => size < totalRecords);
30026
30106
  if (options.length === 0) {
30027
30107
  options.push(10);
@@ -30579,7 +30659,7 @@ var CustomPagination = ({
30579
30659
  var Pagination_default = CustomPagination;
30580
30660
 
30581
30661
  // src/components/DataDisplay/HistoryTimeline/HistoryTimeline.tsx
30582
- var import_react30 = require("react");
30662
+ var import_react31 = require("react");
30583
30663
 
30584
30664
  // src/components/ui/accordion.tsx
30585
30665
  var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion"));
@@ -30703,7 +30783,7 @@ var HistoryTimeline = ({
30703
30783
  createdAtKey,
30704
30784
  ...props
30705
30785
  }) => {
30706
- const data = (0, import_react30.useMemo)(() => {
30786
+ const data = (0, import_react31.useMemo)(() => {
30707
30787
  if (Array.isArray(props.data)) {
30708
30788
  return props.data;
30709
30789
  }
@@ -30780,7 +30860,7 @@ var HistoryTimeline = ({
30780
30860
  var HistoryTimeline_default = HistoryTimeline;
30781
30861
 
30782
30862
  // src/components/Navigation/Tabs/Tabs.tsx
30783
- var import_react31 = require("react");
30863
+ var import_react32 = require("react");
30784
30864
  var import_link5 = __toESM(require("next/link"));
30785
30865
  var import_navigation3 = require("next/navigation");
30786
30866
 
@@ -30938,7 +31018,7 @@ function showSonnerToast({
30938
31018
  // src/components/Navigation/Tabs/Tabs.tsx
30939
31019
  var import_jsx_runtime59 = require("react/jsx-runtime");
30940
31020
  var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
30941
- const [openIndex, setOpenIndex] = (0, import_react31.useState)(null);
31021
+ const [openIndex, setOpenIndex] = (0, import_react32.useState)(null);
30942
31022
  const currentPathname = (0, import_navigation3.usePathname)();
30943
31023
  function groupMenus(menus = []) {
30944
31024
  const menuMap = /* @__PURE__ */ new Map();
@@ -30972,7 +31052,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30972
31052
  });
30973
31053
  return sortMenus(rootMenus);
30974
31054
  }
30975
- const rawTabs = (0, import_react31.useMemo)(() => {
31055
+ const rawTabs = (0, import_react32.useMemo)(() => {
30976
31056
  if (!Array.isArray(tabs)) return [];
30977
31057
  if (source === "manual") return Array.isArray(tabs) ? tabs : [];
30978
31058
  return groupMenus(tabs);
@@ -31002,9 +31082,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
31002
31082
  return tab.children.some((child) => isActive(child.url));
31003
31083
  };
31004
31084
  const router = (0, import_navigation3.useRouter)();
31005
- const [showExitDialog, setShowExitDialog] = (0, import_react31.useState)(false);
31006
- const [pendingUrl, setPendingUrl] = (0, import_react31.useState)(null);
31007
- const handleBuilderExit = (0, import_react31.useCallback)(
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)(
31008
31088
  (e, url) => {
31009
31089
  if (isBuilder) {
31010
31090
  e.preventDefault();
@@ -31171,7 +31251,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
31171
31251
  var Tabs_default = Tabs;
31172
31252
 
31173
31253
  // src/components/Navigation/Stages/Stages.tsx
31174
- var import_react32 = __toESM(require("react"));
31254
+ var import_react33 = __toESM(require("react"));
31175
31255
  var import_jsx_runtime60 = require("react/jsx-runtime");
31176
31256
  var StagesComponent = ({
31177
31257
  stages,
@@ -31188,8 +31268,8 @@ var StagesComponent = ({
31188
31268
  triggerOnClick = false,
31189
31269
  canvasMode = "desktop"
31190
31270
  }) => {
31191
- const [activeStage, setActiveStage] = (0, import_react32.useState)(currentStage || (stages && stages.length > 0 ? stages[0][dataKey] : null));
31192
- const [isCompleted, setIsCompleted] = (0, import_react32.useState)(false);
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);
31193
31273
  const updateStage = (stageKey) => {
31194
31274
  setActiveStage(stageKey);
31195
31275
  onStageChange?.(stageKey);
@@ -31257,7 +31337,7 @@ var StagesComponent = ({
31257
31337
  const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
31258
31338
  const isCompletedStage = isAllStagesCompleted || index <= currentIndex;
31259
31339
  const isActive = !isAllStagesCompleted && index === currentIndex;
31260
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react32.default.Fragment, { children: [
31340
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react33.default.Fragment, { children: [
31261
31341
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
31262
31342
  "button",
31263
31343
  {
@@ -31325,10 +31405,10 @@ var import_jsx_runtime63 = require("react/jsx-runtime");
31325
31405
  var import_jsx_runtime64 = require("react/jsx-runtime");
31326
31406
 
31327
31407
  // src/components/ui/avatar.tsx
31328
- var React11 = __toESM(require("react"));
31408
+ var React12 = __toESM(require("react"));
31329
31409
  var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
31330
31410
  var import_jsx_runtime65 = require("react/jsx-runtime");
31331
- var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
31411
+ var Avatar = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
31332
31412
  AvatarPrimitive.Root,
31333
31413
  {
31334
31414
  ref,
@@ -31340,7 +31420,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
31340
31420
  }
31341
31421
  ));
31342
31422
  Avatar.displayName = AvatarPrimitive.Root.displayName;
31343
- var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
31423
+ var AvatarImage = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
31344
31424
  AvatarPrimitive.Image,
31345
31425
  {
31346
31426
  ref,
@@ -31349,7 +31429,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
31349
31429
  }
31350
31430
  ));
31351
31431
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
31352
- var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
31432
+ var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
31353
31433
  AvatarPrimitive.Fallback,
31354
31434
  {
31355
31435
  ref,
@@ -31367,7 +31447,7 @@ var import_link6 = __toESM(require("next/link"));
31367
31447
  var import_image4 = __toESM(require("next/image"));
31368
31448
  var import_navigation4 = require("next/navigation");
31369
31449
  var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
31370
- var import_react33 = require("react");
31450
+ var import_react34 = require("react");
31371
31451
  var import_jsx_runtime66 = require("react/jsx-runtime");
31372
31452
  function Navbar({
31373
31453
  style,
@@ -31388,9 +31468,9 @@ function Navbar({
31388
31468
  }) {
31389
31469
  const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
31390
31470
  const router = (0, import_navigation4.useRouter)();
31391
- const [showExitDialog, setShowExitDialog] = (0, import_react33.useState)(false);
31392
- const [pendingUrl, setPendingUrl] = (0, import_react33.useState)(null);
31393
- const handleBuilderExit = (0, import_react33.useCallback)(
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)(
31394
31474
  (e, url) => {
31395
31475
  if (isBuilder) {
31396
31476
  e.preventDefault();
@@ -31406,7 +31486,7 @@ function Navbar({
31406
31486
  router.push(pendingUrl);
31407
31487
  }
31408
31488
  };
31409
- const formatedMenu = (0, import_react33.useMemo)(() => {
31489
+ const formatedMenu = (0, import_react34.useMemo)(() => {
31410
31490
  if (source === "state" && navList && navList.length) {
31411
31491
  return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
31412
31492
  }
@@ -31509,7 +31589,7 @@ function Navbar({
31509
31589
  }
31510
31590
 
31511
31591
  // src/components/Chart/BarChart.tsx
31512
- var import_react34 = __toESM(require("react"));
31592
+ var import_react35 = __toESM(require("react"));
31513
31593
  var import_axios2 = __toESM(require("axios"));
31514
31594
  var import_recharts = require("recharts");
31515
31595
  var import_jsx_runtime67 = require("react/jsx-runtime");
@@ -31570,18 +31650,18 @@ var ChartComponent = ({
31570
31650
  canvasMode,
31571
31651
  ...props
31572
31652
  }) => {
31573
- const [rawData, setRawData] = (0, import_react34.useState)([]);
31574
- const [rawMeta, setRawMeta] = (0, import_react34.useState)(null);
31575
- const [localLoading, setLocalLoading] = (0, import_react34.useState)(false);
31576
- const [currentPage, setCurrentPage] = (0, import_react34.useState)(1);
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);
31577
31657
  const effectiveData = apiUrl ? rawData : props.data || [];
31578
31658
  const effectiveLoading = apiUrl ? localLoading : externalLoading;
31579
- (0, import_react34.useEffect)(() => {
31659
+ (0, import_react35.useEffect)(() => {
31580
31660
  if (apiUrl) {
31581
31661
  setCurrentPage(1);
31582
31662
  }
31583
31663
  }, [apiUrl]);
31584
- const fetchData = (0, import_react34.useCallback)(async (page) => {
31664
+ const fetchData = (0, import_react35.useCallback)(async (page) => {
31585
31665
  if (!apiUrl) return;
31586
31666
  const cancelled = false;
31587
31667
  try {
@@ -31618,7 +31698,7 @@ var ChartComponent = ({
31618
31698
  if (!cancelled) setLocalLoading(false);
31619
31699
  }
31620
31700
  }, [apiUrl, limit]);
31621
- (0, import_react34.useEffect)(() => {
31701
+ (0, import_react35.useEffect)(() => {
31622
31702
  if (!apiUrl) return;
31623
31703
  fetchData(currentPage);
31624
31704
  }, [apiUrl, currentPage, fetchData]);
@@ -31626,7 +31706,7 @@ var ChartComponent = ({
31626
31706
  if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
31627
31707
  setCurrentPage(newPage);
31628
31708
  };
31629
- const data = (0, import_react34.useMemo)(() => {
31709
+ const data = (0, import_react35.useMemo)(() => {
31630
31710
  if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
31631
31711
  return [];
31632
31712
  }
@@ -31814,10 +31894,10 @@ var ChartComponent = ({
31814
31894
  ] }) })
31815
31895
  ] });
31816
31896
  };
31817
- var BarChart_default = import_react34.default.memo(ChartComponent);
31897
+ var BarChart_default = import_react35.default.memo(ChartComponent);
31818
31898
 
31819
31899
  // src/components/Chart/PieChart.tsx
31820
- var import_react35 = __toESM(require("react"));
31900
+ var import_react36 = __toESM(require("react"));
31821
31901
  var import_axios3 = __toESM(require("axios"));
31822
31902
  var import_recharts2 = require("recharts");
31823
31903
  var import_jsx_runtime68 = require("react/jsx-runtime");
@@ -31897,11 +31977,11 @@ var DonutChart = ({
31897
31977
  }) => {
31898
31978
  const showLegends = props.showLegends ?? true;
31899
31979
  const canvasMode = props.canvasMode;
31900
- const [rawData, setRawData] = (0, import_react35.useState)([]);
31901
- const [localLoading, setLocalLoading] = (0, import_react35.useState)(false);
31980
+ const [rawData, setRawData] = (0, import_react36.useState)([]);
31981
+ const [localLoading, setLocalLoading] = (0, import_react36.useState)(false);
31902
31982
  const effectiveData = apiUrl ? rawData : props.data || [];
31903
31983
  const effectiveLoading = apiUrl ? localLoading : externalLoading;
31904
- (0, import_react35.useEffect)(() => {
31984
+ (0, import_react36.useEffect)(() => {
31905
31985
  if (!apiUrl) return;
31906
31986
  let cancelled = false;
31907
31987
  const fetchData = async () => {
@@ -31937,7 +32017,7 @@ var DonutChart = ({
31937
32017
  cancelled = true;
31938
32018
  };
31939
32019
  }, [apiUrl]);
31940
- const data = (0, import_react35.useMemo)(() => {
32020
+ const data = (0, import_react36.useMemo)(() => {
31941
32021
  if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
31942
32022
  return effectiveData.map((item) => ({
31943
32023
  ...item,
@@ -31946,11 +32026,11 @@ var DonutChart = ({
31946
32026
  [dataLabel]: item[dataLabel] ?? "Unknown"
31947
32027
  }));
31948
32028
  }, [effectiveData, dataKey, dataLabel]);
31949
- const total = (0, import_react35.useMemo)(
32029
+ const total = (0, import_react36.useMemo)(
31950
32030
  () => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
31951
32031
  [data, dataKey]
31952
32032
  );
31953
- const formattedTotal = (0, import_react35.useMemo)(() => {
32033
+ const formattedTotal = (0, import_react36.useMemo)(() => {
31954
32034
  if (total >= 1e6) {
31955
32035
  return `${(total / 1e6).toFixed(1)}M`;
31956
32036
  }
@@ -31959,7 +32039,7 @@ var DonutChart = ({
31959
32039
  }
31960
32040
  return total.toString();
31961
32041
  }, [total]);
31962
- const chartData = (0, import_react35.useMemo)(() => {
32042
+ const chartData = (0, import_react36.useMemo)(() => {
31963
32043
  if (total === 0) return data;
31964
32044
  const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
31965
32045
  const minAngle = 360 / Math.max(12, sortedData.length);
@@ -31982,12 +32062,12 @@ var DonutChart = ({
31982
32062
  if (chartData.length <= 6) return { inner: 85, outer: 150 };
31983
32063
  return { inner: 70, outer: 130 };
31984
32064
  };
31985
- const [mounted, setMounted] = (0, import_react35.useState)(false);
31986
- (0, import_react35.useEffect)(() => {
32065
+ const [mounted, setMounted] = (0, import_react36.useState)(false);
32066
+ (0, import_react36.useEffect)(() => {
31987
32067
  const timeout = setTimeout(() => setMounted(true), 100);
31988
32068
  return () => clearTimeout(timeout);
31989
32069
  }, []);
31990
- const renderLegends = (0, import_react35.useMemo)(() => {
32070
+ const renderLegends = (0, import_react36.useMemo)(() => {
31991
32071
  if (!showLegends) return null;
31992
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) => {
31993
32073
  const actualValue = data.find(
@@ -32115,7 +32195,7 @@ var DonutChart = ({
32115
32195
  renderLegends
32116
32196
  ] });
32117
32197
  };
32118
- var PieChart_default = import_react35.default.memo(DonutChart);
32198
+ var PieChart_default = import_react36.default.memo(DonutChart);
32119
32199
 
32120
32200
  // src/components/Blocks/EmailComposer.tsx
32121
32201
  var import_jsx_runtime69 = require("react/jsx-runtime");