@algorithm-shift/design-system 1.2.78 → 1.2.80
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 +142 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +880 -371
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +863 -354
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -233,7 +233,7 @@ function Repeater({
|
|
|
233
233
|
[items, count]
|
|
234
234
|
);
|
|
235
235
|
if (!list.length) {
|
|
236
|
-
return emptyFallback ? /* @__PURE__ */ jsx10(Fragment2, { children: emptyFallback }) :
|
|
236
|
+
return emptyFallback ? /* @__PURE__ */ jsx10(Fragment2, { children: emptyFallback }) : /* @__PURE__ */ jsx10("div", { className, children: "No items to display." });
|
|
237
237
|
}
|
|
238
238
|
const content = list.map((item, i) => /* @__PURE__ */ jsx10(React3.Fragment, { children: render(item, i, list) }, i));
|
|
239
239
|
return wrapper ? /* @__PURE__ */ jsx10(Fragment2, { children: wrapper(content) }) : /* @__PURE__ */ jsx10("div", { className, children: content });
|
|
@@ -27505,7 +27505,7 @@ function RichText({ className, style, ...props }) {
|
|
|
27505
27505
|
}
|
|
27506
27506
|
|
|
27507
27507
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
27508
|
-
import { useEffect as
|
|
27508
|
+
import { useEffect as useEffect15 } from "react";
|
|
27509
27509
|
|
|
27510
27510
|
// src/components/ui/select.tsx
|
|
27511
27511
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
@@ -27633,15 +27633,269 @@ function SelectScrollDownButton({
|
|
|
27633
27633
|
);
|
|
27634
27634
|
}
|
|
27635
27635
|
|
|
27636
|
-
// src/components/Inputs/Dropdown/
|
|
27636
|
+
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
27637
|
+
import { useState as useState5, useRef as useRef3, useEffect as useEffect14 } from "react";
|
|
27638
|
+
|
|
27639
|
+
// src/components/Wrappers/Portal.tsx
|
|
27640
|
+
import ReactDOM from "react-dom";
|
|
27641
|
+
var Portal3 = ({ children, container }) => {
|
|
27642
|
+
const target = container || document.body;
|
|
27643
|
+
return ReactDOM.createPortal(children, target);
|
|
27644
|
+
};
|
|
27645
|
+
var Portal_default = Portal3;
|
|
27646
|
+
|
|
27647
|
+
// src/hooks/useLazyDropdown.ts
|
|
27648
|
+
import { useState as useState4, useEffect as useEffect13, useRef as useRef2, useCallback as useCallback2 } from "react";
|
|
27649
|
+
import axios from "axios";
|
|
27650
|
+
function useLazyDropdown(config) {
|
|
27651
|
+
const [options, setOptions] = useState4([]);
|
|
27652
|
+
const [page, setPage] = useState4(1);
|
|
27653
|
+
const [hasMore, setHasMore] = useState4(true);
|
|
27654
|
+
const [loading, setLoading] = useState4(false);
|
|
27655
|
+
const [searchTerm, setSearchTerm] = useState4("");
|
|
27656
|
+
const debounceTimer = useRef2(null);
|
|
27657
|
+
const allDataRef = useRef2([]);
|
|
27658
|
+
const configRef = useRef2(config);
|
|
27659
|
+
const PAGE_SIZE = config.pageSize || 10;
|
|
27660
|
+
useEffect13(() => {
|
|
27661
|
+
configRef.current = config;
|
|
27662
|
+
}, [config]);
|
|
27663
|
+
const transformToOptions = useCallback2((data) => {
|
|
27664
|
+
if (!data || !Array.isArray(data)) return [];
|
|
27665
|
+
const cfg = configRef.current;
|
|
27666
|
+
return data.map((item) => ({
|
|
27667
|
+
value: item[cfg.dataKey] ?? item.id ?? "",
|
|
27668
|
+
label: item[cfg.dataLabel] ?? item.name ?? item.label ?? ""
|
|
27669
|
+
}));
|
|
27670
|
+
}, []);
|
|
27671
|
+
const fetchApiData = useCallback2(async (pageNum, term) => {
|
|
27672
|
+
if (!configRef.current.apiUrl) return [];
|
|
27673
|
+
const limit = PAGE_SIZE;
|
|
27674
|
+
const params = { page: pageNum, limit };
|
|
27675
|
+
if (term) params[configRef.current.dataLabel ?? "search"] = term;
|
|
27676
|
+
const res = await axios.get(configRef.current.apiUrl, {
|
|
27677
|
+
params,
|
|
27678
|
+
withCredentials: true
|
|
27679
|
+
});
|
|
27680
|
+
if (res.data?.success && Array.isArray(res.data.data)) {
|
|
27681
|
+
const data = res.data.data;
|
|
27682
|
+
return transformToOptions(data);
|
|
27683
|
+
}
|
|
27684
|
+
return [];
|
|
27685
|
+
}, [PAGE_SIZE, transformToOptions]);
|
|
27686
|
+
const loadPage = useCallback2(async (pageNum, term) => {
|
|
27687
|
+
const cfg = configRef.current;
|
|
27688
|
+
if (!cfg.enabled) return;
|
|
27689
|
+
setLoading(true);
|
|
27690
|
+
try {
|
|
27691
|
+
let pageOptions = [];
|
|
27692
|
+
if (cfg.dataSource === "api") {
|
|
27693
|
+
pageOptions = await fetchApiData(pageNum, term);
|
|
27694
|
+
setHasMore(pageOptions.length === PAGE_SIZE);
|
|
27695
|
+
} else {
|
|
27696
|
+
const allData = allDataRef.current || [];
|
|
27697
|
+
let filtered = allData;
|
|
27698
|
+
if (term) {
|
|
27699
|
+
const termLower = term.toLowerCase();
|
|
27700
|
+
filtered = allData.filter((item) => {
|
|
27701
|
+
const label = String(item[cfg.dataLabel] ?? item.name ?? item.label ?? "").toLowerCase();
|
|
27702
|
+
const value = String(item[cfg.dataKey] ?? item.id ?? "").toLowerCase();
|
|
27703
|
+
return label.includes(termLower) || value.includes(termLower);
|
|
27704
|
+
});
|
|
27705
|
+
}
|
|
27706
|
+
const start = (pageNum - 1) * PAGE_SIZE;
|
|
27707
|
+
const end = start + PAGE_SIZE;
|
|
27708
|
+
pageOptions = transformToOptions(filtered.slice(start, end));
|
|
27709
|
+
setHasMore(end < filtered.length);
|
|
27710
|
+
}
|
|
27711
|
+
setOptions((prev) => pageNum === 1 ? pageOptions : [...prev, ...pageOptions]);
|
|
27712
|
+
setPage(pageNum);
|
|
27713
|
+
} catch (err) {
|
|
27714
|
+
console.error("\u274C useLazyDropdown loadPage error:", err);
|
|
27715
|
+
setHasMore(false);
|
|
27716
|
+
} finally {
|
|
27717
|
+
setLoading(false);
|
|
27718
|
+
}
|
|
27719
|
+
}, [fetchApiData, transformToOptions]);
|
|
27720
|
+
const loadMore = useCallback2(() => {
|
|
27721
|
+
if (!loading && hasMore) {
|
|
27722
|
+
loadPage(page + 1, searchTerm);
|
|
27723
|
+
}
|
|
27724
|
+
}, [loading, hasMore, page, searchTerm, loadPage]);
|
|
27725
|
+
const search = useCallback2((term) => {
|
|
27726
|
+
setSearchTerm(term);
|
|
27727
|
+
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
27728
|
+
debounceTimer.current = setTimeout(() => {
|
|
27729
|
+
loadPage(1, term);
|
|
27730
|
+
}, 300);
|
|
27731
|
+
}, [loadPage]);
|
|
27732
|
+
const reset = useCallback2(() => {
|
|
27733
|
+
setSearchTerm("");
|
|
27734
|
+
setPage(1);
|
|
27735
|
+
loadPage(1, "");
|
|
27736
|
+
}, [loadPage]);
|
|
27737
|
+
useEffect13(() => {
|
|
27738
|
+
if (config.initialData?.length) {
|
|
27739
|
+
allDataRef.current = config.initialData;
|
|
27740
|
+
loadPage(1, "");
|
|
27741
|
+
}
|
|
27742
|
+
}, [config.initialData, loadPage]);
|
|
27743
|
+
useEffect13(() => {
|
|
27744
|
+
return () => {
|
|
27745
|
+
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
27746
|
+
};
|
|
27747
|
+
}, []);
|
|
27748
|
+
return {
|
|
27749
|
+
options,
|
|
27750
|
+
loading,
|
|
27751
|
+
hasMore,
|
|
27752
|
+
loadMore,
|
|
27753
|
+
search,
|
|
27754
|
+
reset
|
|
27755
|
+
};
|
|
27756
|
+
}
|
|
27757
|
+
|
|
27758
|
+
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
27637
27759
|
import { Fragment as Fragment11, jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
27760
|
+
function LazySelectDropdown({
|
|
27761
|
+
options = [],
|
|
27762
|
+
value,
|
|
27763
|
+
onChange,
|
|
27764
|
+
placeholder,
|
|
27765
|
+
className,
|
|
27766
|
+
id,
|
|
27767
|
+
disabled,
|
|
27768
|
+
readOnly,
|
|
27769
|
+
source,
|
|
27770
|
+
apiUrl,
|
|
27771
|
+
pageSize,
|
|
27772
|
+
dataKey = "id",
|
|
27773
|
+
dataLabel = "name",
|
|
27774
|
+
errorMessage
|
|
27775
|
+
}) {
|
|
27776
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
27777
|
+
const [searchTerm, setSearchTerm] = useState5("");
|
|
27778
|
+
const dropdownRef = useRef3(null);
|
|
27779
|
+
const observerTarget = useRef3(null);
|
|
27780
|
+
const {
|
|
27781
|
+
options: lazyOptions,
|
|
27782
|
+
loading,
|
|
27783
|
+
hasMore,
|
|
27784
|
+
loadMore,
|
|
27785
|
+
search,
|
|
27786
|
+
reset
|
|
27787
|
+
} = useLazyDropdown({
|
|
27788
|
+
enabled: true,
|
|
27789
|
+
dataSource: source || "",
|
|
27790
|
+
apiUrl,
|
|
27791
|
+
pageSize: pageSize || 10,
|
|
27792
|
+
dataKey,
|
|
27793
|
+
dataLabel,
|
|
27794
|
+
initialData: options || []
|
|
27795
|
+
});
|
|
27796
|
+
const selectedOption = lazyOptions.find((opt) => opt.value === value);
|
|
27797
|
+
useEffect14(() => {
|
|
27798
|
+
const handleClickOutside = (e) => {
|
|
27799
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
27800
|
+
setIsOpen(false);
|
|
27801
|
+
setSearchTerm("");
|
|
27802
|
+
}
|
|
27803
|
+
};
|
|
27804
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
27805
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
27806
|
+
}, []);
|
|
27807
|
+
useEffect14(() => {
|
|
27808
|
+
if (!isOpen || !hasMore || loading) return;
|
|
27809
|
+
const observer = new IntersectionObserver(
|
|
27810
|
+
(entries) => {
|
|
27811
|
+
if (entries[0].isIntersecting) loadMore();
|
|
27812
|
+
},
|
|
27813
|
+
{ threshold: 0.1 }
|
|
27814
|
+
);
|
|
27815
|
+
if (observerTarget.current) observer.observe(observerTarget.current);
|
|
27816
|
+
return () => observer.disconnect();
|
|
27817
|
+
}, [isOpen, hasMore, loading, loadMore]);
|
|
27818
|
+
const handleSearchChange = (e) => {
|
|
27819
|
+
const term = e.target.value;
|
|
27820
|
+
setSearchTerm(term);
|
|
27821
|
+
search(term);
|
|
27822
|
+
};
|
|
27823
|
+
const handleSelect = (optValue) => {
|
|
27824
|
+
onChange?.(optValue);
|
|
27825
|
+
setIsOpen(false);
|
|
27826
|
+
setSearchTerm("");
|
|
27827
|
+
reset();
|
|
27828
|
+
};
|
|
27829
|
+
const handleFocus = () => {
|
|
27830
|
+
if (!disabled) setIsOpen(true);
|
|
27831
|
+
};
|
|
27832
|
+
return /* @__PURE__ */ jsxs18("div", { ref: dropdownRef, className: "relative w-full", children: [
|
|
27833
|
+
/* @__PURE__ */ jsx36(
|
|
27834
|
+
"input",
|
|
27835
|
+
{
|
|
27836
|
+
type: "text",
|
|
27837
|
+
id,
|
|
27838
|
+
name: id,
|
|
27839
|
+
className: cn(
|
|
27840
|
+
"w-full px-3 py-2 border border-[#BDBDBD] rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
27841
|
+
disabled ? "bg-gray-100 cursor-not-allowed" : "bg-white cursor-pointer",
|
|
27842
|
+
className,
|
|
27843
|
+
errorMessage ? "border-red-500" : ""
|
|
27844
|
+
),
|
|
27845
|
+
placeholder: selectedOption?.label || placeholder,
|
|
27846
|
+
value: isOpen ? searchTerm : selectedOption?.label || "",
|
|
27847
|
+
onFocus: handleFocus,
|
|
27848
|
+
onChange: handleSearchChange,
|
|
27849
|
+
readOnly: !isOpen || readOnly,
|
|
27850
|
+
disabled
|
|
27851
|
+
}
|
|
27852
|
+
),
|
|
27853
|
+
errorMessage && /* @__PURE__ */ jsx36("p", { className: "mt-1 text-xs text-red-500", children: errorMessage }),
|
|
27854
|
+
isOpen && !disabled && /* @__PURE__ */ jsx36(Portal_default, { container: dropdownRef.current, children: /* @__PURE__ */ jsx36(
|
|
27855
|
+
"div",
|
|
27856
|
+
{
|
|
27857
|
+
className: "fixed z-[9999] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
|
|
27858
|
+
style: { width: dropdownRef.current?.offsetWidth },
|
|
27859
|
+
children: loading && lazyOptions.length === 0 ? /* @__PURE__ */ jsxs18("div", { className: "px-3 py-4 text-center text-gray-500 flex items-center justify-center gap-2 text-sm", children: [
|
|
27860
|
+
/* @__PURE__ */ jsx36("div", { className: "animate-spin w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
27861
|
+
"Loading..."
|
|
27862
|
+
] }) : lazyOptions.length > 0 ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
27863
|
+
lazyOptions.map((option, index) => /* @__PURE__ */ jsx36(
|
|
27864
|
+
"div",
|
|
27865
|
+
{
|
|
27866
|
+
onClick: () => handleSelect(option.value),
|
|
27867
|
+
className: `px-3 py-2 hover:bg-blue-50 cursor-pointer text-sm ${option.value === value ? "bg-blue-100" : ""}`,
|
|
27868
|
+
children: option.label
|
|
27869
|
+
},
|
|
27870
|
+
`${option.value}-${index}`
|
|
27871
|
+
)),
|
|
27872
|
+
hasMore && /* @__PURE__ */ jsx36(
|
|
27873
|
+
"div",
|
|
27874
|
+
{
|
|
27875
|
+
ref: observerTarget,
|
|
27876
|
+
className: "px-3 py-2 text-center text-gray-400 text-sm border-t",
|
|
27877
|
+
children: loading ? /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-center gap-2 text-sm", children: [
|
|
27878
|
+
/* @__PURE__ */ jsx36("div", { className: "animate-spin w-3 h-3 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
27879
|
+
"Loading more..."
|
|
27880
|
+
] }) : "Scroll for more..."
|
|
27881
|
+
}
|
|
27882
|
+
)
|
|
27883
|
+
] }) : /* @__PURE__ */ jsx36("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
27884
|
+
}
|
|
27885
|
+
) })
|
|
27886
|
+
] });
|
|
27887
|
+
}
|
|
27888
|
+
var LazyDropdown_default = LazySelectDropdown;
|
|
27889
|
+
|
|
27890
|
+
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
27891
|
+
import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
27638
27892
|
var Dropdown = ({ className, style, ...props }) => {
|
|
27639
27893
|
const list = Array.isArray(props?.data) ? props.data : [];
|
|
27640
|
-
const placeholder = props.placeholder ? props.placeholder : "
|
|
27894
|
+
const placeholder = props.placeholder ? props.placeholder : "Select an option";
|
|
27641
27895
|
const isEditable = props.isEditable ?? true;
|
|
27642
27896
|
const isDisabled = props.isDisabled ?? false;
|
|
27643
27897
|
const isReadonly = props.isReadonly ?? false;
|
|
27644
|
-
|
|
27898
|
+
useEffect15(() => {
|
|
27645
27899
|
if (props.value !== void 0) {
|
|
27646
27900
|
handleChange(props.value);
|
|
27647
27901
|
}
|
|
@@ -27655,9 +27909,25 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
27655
27909
|
value: item[dataKey],
|
|
27656
27910
|
label: item[dataLabel]
|
|
27657
27911
|
}));
|
|
27658
|
-
|
|
27659
|
-
/* @__PURE__ */
|
|
27660
|
-
|
|
27912
|
+
if (props.lazyLoad) {
|
|
27913
|
+
return /* @__PURE__ */ jsx37(
|
|
27914
|
+
LazyDropdown_default,
|
|
27915
|
+
{
|
|
27916
|
+
...props,
|
|
27917
|
+
id: props.name || "lazy-select-field",
|
|
27918
|
+
options: list,
|
|
27919
|
+
onChange: handleChange,
|
|
27920
|
+
placeholder,
|
|
27921
|
+
className,
|
|
27922
|
+
style,
|
|
27923
|
+
disabled: isDisabled || !isEditable,
|
|
27924
|
+
readOnly: isReadonly
|
|
27925
|
+
}
|
|
27926
|
+
);
|
|
27927
|
+
}
|
|
27928
|
+
return /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
27929
|
+
/* @__PURE__ */ jsxs19(Select, { name: props.name, value: props.value || "", onValueChange: handleChange, disabled: isDisabled || !isEditable, children: [
|
|
27930
|
+
/* @__PURE__ */ jsx37(
|
|
27661
27931
|
SelectTrigger,
|
|
27662
27932
|
{
|
|
27663
27933
|
id: props.name || "select-field",
|
|
@@ -27667,31 +27937,31 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
27667
27937
|
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
27668
27938
|
},
|
|
27669
27939
|
"aria-readonly": isReadonly,
|
|
27670
|
-
children: /* @__PURE__ */
|
|
27940
|
+
children: /* @__PURE__ */ jsx37(SelectValue, { placeholder })
|
|
27671
27941
|
}
|
|
27672
27942
|
),
|
|
27673
|
-
/* @__PURE__ */
|
|
27674
|
-
props.dataLoading && /* @__PURE__ */
|
|
27675
|
-
!props.dataLoading && options.length === 0 && /* @__PURE__ */
|
|
27676
|
-
options.map((opt) => /* @__PURE__ */
|
|
27943
|
+
/* @__PURE__ */ jsxs19(SelectContent, { children: [
|
|
27944
|
+
props.dataLoading && /* @__PURE__ */ jsx37(SelectItem, { value: "none", disabled: true, children: "Loading..." }),
|
|
27945
|
+
!props.dataLoading && options.length === 0 && /* @__PURE__ */ jsx37(SelectItem, { value: "none", disabled: true, children: "No options" }),
|
|
27946
|
+
options.map((opt) => /* @__PURE__ */ jsx37(SelectItem, { value: opt.value, children: opt.label }, opt.value))
|
|
27677
27947
|
] })
|
|
27678
27948
|
] }),
|
|
27679
|
-
props.errorMessage && /* @__PURE__ */
|
|
27949
|
+
props.errorMessage && /* @__PURE__ */ jsx37("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27680
27950
|
] });
|
|
27681
27951
|
};
|
|
27682
27952
|
var Dropdown_default = Dropdown;
|
|
27683
27953
|
|
|
27684
27954
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
27685
|
-
import { useEffect as
|
|
27955
|
+
import { useEffect as useEffect16 } from "react";
|
|
27686
27956
|
|
|
27687
27957
|
// src/components/ui/switch.tsx
|
|
27688
27958
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
27689
|
-
import { jsx as
|
|
27959
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
27690
27960
|
function Switch({
|
|
27691
27961
|
className,
|
|
27692
27962
|
...props
|
|
27693
27963
|
}) {
|
|
27694
|
-
return /* @__PURE__ */
|
|
27964
|
+
return /* @__PURE__ */ jsx38(
|
|
27695
27965
|
SwitchPrimitive.Root,
|
|
27696
27966
|
{
|
|
27697
27967
|
"data-slot": "switch",
|
|
@@ -27700,7 +27970,7 @@ function Switch({
|
|
|
27700
27970
|
className
|
|
27701
27971
|
),
|
|
27702
27972
|
...props,
|
|
27703
|
-
children: /* @__PURE__ */
|
|
27973
|
+
children: /* @__PURE__ */ jsx38(
|
|
27704
27974
|
SwitchPrimitive.Thumb,
|
|
27705
27975
|
{
|
|
27706
27976
|
"data-slot": "switch-thumb",
|
|
@@ -27714,11 +27984,11 @@ function Switch({
|
|
|
27714
27984
|
}
|
|
27715
27985
|
|
|
27716
27986
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
27717
|
-
import { Fragment as
|
|
27987
|
+
import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
27718
27988
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
27719
27989
|
const isEditable = props.isEditable ?? true;
|
|
27720
27990
|
const isDisabled = props.isDisabled ?? false;
|
|
27721
|
-
|
|
27991
|
+
useEffect16(() => {
|
|
27722
27992
|
if (props.value !== void 0) {
|
|
27723
27993
|
handleChange?.(props.value);
|
|
27724
27994
|
}
|
|
@@ -27726,9 +27996,9 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
27726
27996
|
const handleChange = (value) => {
|
|
27727
27997
|
props.onChange?.(value);
|
|
27728
27998
|
};
|
|
27729
|
-
return /* @__PURE__ */
|
|
27730
|
-
/* @__PURE__ */
|
|
27731
|
-
/* @__PURE__ */
|
|
27999
|
+
return /* @__PURE__ */ jsxs20(Fragment13, { children: [
|
|
28000
|
+
/* @__PURE__ */ jsx39("div", { className, style, children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center space-x-2 mb-2", children: [
|
|
28001
|
+
/* @__PURE__ */ jsx39(
|
|
27732
28002
|
Switch,
|
|
27733
28003
|
{
|
|
27734
28004
|
id: props.name || "switch",
|
|
@@ -27737,23 +28007,23 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
27737
28007
|
disabled: isDisabled || !isEditable
|
|
27738
28008
|
}
|
|
27739
28009
|
),
|
|
27740
|
-
/* @__PURE__ */
|
|
28010
|
+
/* @__PURE__ */ jsx39(Label2, { htmlFor: props.name || "switch", children: props.text })
|
|
27741
28011
|
] }) }),
|
|
27742
|
-
props.errorMessage && /* @__PURE__ */
|
|
28012
|
+
props.errorMessage && /* @__PURE__ */ jsx39("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27743
28013
|
] });
|
|
27744
28014
|
};
|
|
27745
28015
|
var SwitchToggle_default = SwitchToggle;
|
|
27746
28016
|
|
|
27747
28017
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
27748
|
-
import { useEffect as
|
|
28018
|
+
import { useEffect as useEffect17 } from "react";
|
|
27749
28019
|
import { PhoneInput as PhoneInputField } from "react-international-phone";
|
|
27750
28020
|
import "react-international-phone/style.css";
|
|
27751
|
-
import { Fragment as
|
|
28021
|
+
import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
27752
28022
|
var PhoneInput = ({ className, style, ...props }) => {
|
|
27753
28023
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
27754
28024
|
const isEditable = props.isEditable ?? true;
|
|
27755
28025
|
const isDisabled = props.isDisabled ?? false;
|
|
27756
|
-
|
|
28026
|
+
useEffect17(() => {
|
|
27757
28027
|
if (props.value !== void 0) {
|
|
27758
28028
|
handleChange?.(props.value);
|
|
27759
28029
|
}
|
|
@@ -27761,8 +28031,8 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
27761
28031
|
const handleChange = (val) => {
|
|
27762
28032
|
props.onChange?.(val);
|
|
27763
28033
|
};
|
|
27764
|
-
return /* @__PURE__ */
|
|
27765
|
-
/* @__PURE__ */
|
|
28034
|
+
return /* @__PURE__ */ jsxs21(Fragment14, { children: [
|
|
28035
|
+
/* @__PURE__ */ jsx40(
|
|
27766
28036
|
PhoneInputField,
|
|
27767
28037
|
{
|
|
27768
28038
|
defaultCountry: "in",
|
|
@@ -27786,21 +28056,21 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
27786
28056
|
disabled: isDisabled || !isEditable
|
|
27787
28057
|
}
|
|
27788
28058
|
),
|
|
27789
|
-
props.errorMessage && /* @__PURE__ */
|
|
28059
|
+
props.errorMessage && /* @__PURE__ */ jsx40("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27790
28060
|
] });
|
|
27791
28061
|
};
|
|
27792
28062
|
var PhoneInput_default = PhoneInput;
|
|
27793
28063
|
|
|
27794
28064
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
27795
|
-
import { useEffect as
|
|
27796
|
-
import { Fragment as
|
|
28065
|
+
import { useEffect as useEffect18 } from "react";
|
|
28066
|
+
import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
27797
28067
|
var SearchInput = ({ className, style, ...props }) => {
|
|
27798
28068
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
27799
28069
|
const isEditable = props.isEditable ?? true;
|
|
27800
28070
|
const isDisabled = props.isDisabled ?? false;
|
|
27801
28071
|
const isReadonly = props.isReadonly ?? false;
|
|
27802
28072
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27803
|
-
|
|
28073
|
+
useEffect18(() => {
|
|
27804
28074
|
if (props.value !== void 0) {
|
|
27805
28075
|
const e = { target: { value: props.value } };
|
|
27806
28076
|
handleChange?.(e);
|
|
@@ -27809,8 +28079,8 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
27809
28079
|
const handleChange = (e) => {
|
|
27810
28080
|
props.onChange?.(e);
|
|
27811
28081
|
};
|
|
27812
|
-
return /* @__PURE__ */
|
|
27813
|
-
/* @__PURE__ */
|
|
28082
|
+
return /* @__PURE__ */ jsxs22(Fragment15, { children: [
|
|
28083
|
+
/* @__PURE__ */ jsx41("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx41(
|
|
27814
28084
|
Input,
|
|
27815
28085
|
{
|
|
27816
28086
|
type: "text",
|
|
@@ -27829,17 +28099,17 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
27829
28099
|
readOnly: isReadonly
|
|
27830
28100
|
}
|
|
27831
28101
|
) }),
|
|
27832
|
-
props.errorMessage && /* @__PURE__ */
|
|
28102
|
+
props.errorMessage && /* @__PURE__ */ jsx41("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27833
28103
|
] });
|
|
27834
28104
|
};
|
|
27835
28105
|
var SearchInput_default = SearchInput;
|
|
27836
28106
|
|
|
27837
28107
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
27838
|
-
import { useEffect as
|
|
27839
|
-
import { jsx as
|
|
28108
|
+
import { useEffect as useEffect19 } from "react";
|
|
28109
|
+
import { jsx as jsx42, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
27840
28110
|
var FileInput2 = ({ className, style, ...props }) => {
|
|
27841
28111
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
27842
|
-
|
|
28112
|
+
useEffect19(() => {
|
|
27843
28113
|
if (props.value !== void 0) {
|
|
27844
28114
|
const e = { target: { value: props.value } };
|
|
27845
28115
|
handleChange?.(e);
|
|
@@ -27848,8 +28118,8 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
27848
28118
|
const handleChange = (e) => {
|
|
27849
28119
|
props.onChange?.(e);
|
|
27850
28120
|
};
|
|
27851
|
-
return /* @__PURE__ */
|
|
27852
|
-
/* @__PURE__ */
|
|
28121
|
+
return /* @__PURE__ */ jsxs23("div", { className: "d-flex items-center relative align-middle", children: [
|
|
28122
|
+
/* @__PURE__ */ jsx42(
|
|
27853
28123
|
Input,
|
|
27854
28124
|
{
|
|
27855
28125
|
type: "file",
|
|
@@ -27866,14 +28136,14 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
27866
28136
|
onChange: handleChange
|
|
27867
28137
|
}
|
|
27868
28138
|
),
|
|
27869
|
-
props.errorMessage && /* @__PURE__ */
|
|
28139
|
+
props.errorMessage && /* @__PURE__ */ jsx42("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27870
28140
|
] });
|
|
27871
28141
|
};
|
|
27872
28142
|
var FileInput_default = FileInput2;
|
|
27873
28143
|
|
|
27874
28144
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
27875
|
-
import { useEffect as
|
|
27876
|
-
import { Fragment as
|
|
28145
|
+
import { useEffect as useEffect20 } from "react";
|
|
28146
|
+
import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
27877
28147
|
function DatePicker({ className, style, ...props }) {
|
|
27878
28148
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
27879
28149
|
const minimumDate = props.minimumDate ?? "none";
|
|
@@ -27898,7 +28168,7 @@ function DatePicker({ className, style, ...props }) {
|
|
|
27898
28168
|
};
|
|
27899
28169
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
27900
28170
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
27901
|
-
|
|
28171
|
+
useEffect20(() => {
|
|
27902
28172
|
if (props.value !== void 0) {
|
|
27903
28173
|
handleChange(props.value);
|
|
27904
28174
|
}
|
|
@@ -27910,8 +28180,8 @@ function DatePicker({ className, style, ...props }) {
|
|
|
27910
28180
|
if (!value) return "";
|
|
27911
28181
|
return new Date(value).toISOString().split("T")[0];
|
|
27912
28182
|
};
|
|
27913
|
-
return /* @__PURE__ */
|
|
27914
|
-
/* @__PURE__ */
|
|
28183
|
+
return /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
28184
|
+
/* @__PURE__ */ jsx43("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx43(
|
|
27915
28185
|
Input,
|
|
27916
28186
|
{
|
|
27917
28187
|
type: "date",
|
|
@@ -27936,18 +28206,18 @@ function DatePicker({ className, style, ...props }) {
|
|
|
27936
28206
|
max: maxDate
|
|
27937
28207
|
}
|
|
27938
28208
|
) }),
|
|
27939
|
-
props.errorMessage && /* @__PURE__ */
|
|
28209
|
+
props.errorMessage && /* @__PURE__ */ jsx43("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27940
28210
|
] });
|
|
27941
28211
|
}
|
|
27942
28212
|
|
|
27943
28213
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
27944
|
-
import React7, { useEffect as
|
|
28214
|
+
import React7, { useEffect as useEffect22 } from "react";
|
|
27945
28215
|
import { addDays, format } from "date-fns";
|
|
27946
28216
|
|
|
27947
28217
|
// src/components/ui/calendar.tsx
|
|
27948
28218
|
import * as React6 from "react";
|
|
27949
28219
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
27950
|
-
import { jsx as
|
|
28220
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
27951
28221
|
function Calendar2({
|
|
27952
28222
|
className,
|
|
27953
28223
|
classNames,
|
|
@@ -27959,7 +28229,7 @@ function Calendar2({
|
|
|
27959
28229
|
...props
|
|
27960
28230
|
}) {
|
|
27961
28231
|
const defaultClassNames = getDefaultClassNames();
|
|
27962
|
-
return /* @__PURE__ */
|
|
28232
|
+
return /* @__PURE__ */ jsx44(
|
|
27963
28233
|
DayPicker,
|
|
27964
28234
|
{
|
|
27965
28235
|
showOutsideDays,
|
|
@@ -28058,7 +28328,7 @@ function Calendar2({
|
|
|
28058
28328
|
},
|
|
28059
28329
|
components: {
|
|
28060
28330
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
28061
|
-
return /* @__PURE__ */
|
|
28331
|
+
return /* @__PURE__ */ jsx44(
|
|
28062
28332
|
"div",
|
|
28063
28333
|
{
|
|
28064
28334
|
"data-slot": "calendar",
|
|
@@ -28070,10 +28340,10 @@ function Calendar2({
|
|
|
28070
28340
|
},
|
|
28071
28341
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
28072
28342
|
if (orientation === "left") {
|
|
28073
|
-
return /* @__PURE__ */
|
|
28343
|
+
return /* @__PURE__ */ jsx44(ChevronLeft, { className: cn("size-4", className2), ...props2 });
|
|
28074
28344
|
}
|
|
28075
28345
|
if (orientation === "right") {
|
|
28076
|
-
return /* @__PURE__ */
|
|
28346
|
+
return /* @__PURE__ */ jsx44(
|
|
28077
28347
|
ChevronRight,
|
|
28078
28348
|
{
|
|
28079
28349
|
className: cn("size-4", className2),
|
|
@@ -28081,11 +28351,11 @@ function Calendar2({
|
|
|
28081
28351
|
}
|
|
28082
28352
|
);
|
|
28083
28353
|
}
|
|
28084
|
-
return /* @__PURE__ */
|
|
28354
|
+
return /* @__PURE__ */ jsx44(ChevronDown, { className: cn("size-4", className2), ...props2 });
|
|
28085
28355
|
},
|
|
28086
28356
|
DayButton: CalendarDayButton,
|
|
28087
28357
|
WeekNumber: ({ children, ...props2 }) => {
|
|
28088
|
-
return /* @__PURE__ */
|
|
28358
|
+
return /* @__PURE__ */ jsx44("td", { ...props2, children: /* @__PURE__ */ jsx44("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
28089
28359
|
},
|
|
28090
28360
|
...components
|
|
28091
28361
|
},
|
|
@@ -28104,7 +28374,7 @@ function CalendarDayButton({
|
|
|
28104
28374
|
React6.useEffect(() => {
|
|
28105
28375
|
if (modifiers.focused) ref.current?.focus();
|
|
28106
28376
|
}, [modifiers.focused]);
|
|
28107
|
-
return /* @__PURE__ */
|
|
28377
|
+
return /* @__PURE__ */ jsx44(
|
|
28108
28378
|
Button,
|
|
28109
28379
|
{
|
|
28110
28380
|
ref,
|
|
@@ -28127,16 +28397,16 @@ function CalendarDayButton({
|
|
|
28127
28397
|
|
|
28128
28398
|
// src/components/ui/popover.tsx
|
|
28129
28399
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
28130
|
-
import { jsx as
|
|
28400
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
28131
28401
|
function Popover({
|
|
28132
28402
|
...props
|
|
28133
28403
|
}) {
|
|
28134
|
-
return /* @__PURE__ */
|
|
28404
|
+
return /* @__PURE__ */ jsx45(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
28135
28405
|
}
|
|
28136
28406
|
function PopoverTrigger({
|
|
28137
28407
|
...props
|
|
28138
28408
|
}) {
|
|
28139
|
-
return /* @__PURE__ */
|
|
28409
|
+
return /* @__PURE__ */ jsx45(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
28140
28410
|
}
|
|
28141
28411
|
function PopoverContent({
|
|
28142
28412
|
className,
|
|
@@ -28144,7 +28414,7 @@ function PopoverContent({
|
|
|
28144
28414
|
sideOffset = 4,
|
|
28145
28415
|
...props
|
|
28146
28416
|
}) {
|
|
28147
|
-
return /* @__PURE__ */
|
|
28417
|
+
return /* @__PURE__ */ jsx45(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx45(
|
|
28148
28418
|
PopoverPrimitive.Content,
|
|
28149
28419
|
{
|
|
28150
28420
|
"data-slot": "popover-content",
|
|
@@ -28160,7 +28430,7 @@ function PopoverContent({
|
|
|
28160
28430
|
}
|
|
28161
28431
|
|
|
28162
28432
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28163
|
-
import { Fragment as
|
|
28433
|
+
import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
28164
28434
|
var DateRange = ({ className, style, ...props }) => {
|
|
28165
28435
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
28166
28436
|
const [date, setDate] = React7.useState(
|
|
@@ -28169,7 +28439,7 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28169
28439
|
to: addDays(/* @__PURE__ */ new Date(), 7)
|
|
28170
28440
|
}
|
|
28171
28441
|
);
|
|
28172
|
-
|
|
28442
|
+
useEffect22(() => {
|
|
28173
28443
|
if (props.value && isDateRange(props.value)) {
|
|
28174
28444
|
handleChange?.(props.value);
|
|
28175
28445
|
}
|
|
@@ -28180,9 +28450,9 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28180
28450
|
props.onChange?.(value);
|
|
28181
28451
|
}
|
|
28182
28452
|
};
|
|
28183
|
-
return /* @__PURE__ */
|
|
28184
|
-
/* @__PURE__ */
|
|
28185
|
-
/* @__PURE__ */
|
|
28453
|
+
return /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
28454
|
+
/* @__PURE__ */ jsx46("div", { className, style, children: /* @__PURE__ */ jsxs25(Popover, { children: [
|
|
28455
|
+
/* @__PURE__ */ jsx46(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx46(
|
|
28186
28456
|
Button,
|
|
28187
28457
|
{
|
|
28188
28458
|
id: "date",
|
|
@@ -28191,15 +28461,15 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28191
28461
|
"w-full justify-start text-left font-normal text-[11px] border-[#BDBDBD]",
|
|
28192
28462
|
!date && "text-muted-foreground"
|
|
28193
28463
|
),
|
|
28194
|
-
children: date?.from ? date.to ? /* @__PURE__ */
|
|
28464
|
+
children: date?.from ? date.to ? /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
28195
28465
|
format(date.from, "LLL dd, y"),
|
|
28196
28466
|
" -",
|
|
28197
28467
|
" ",
|
|
28198
28468
|
format(date.to, "LLL dd, y")
|
|
28199
|
-
] }) : format(date.from, "LLL dd, y") : /* @__PURE__ */
|
|
28469
|
+
] }) : format(date.from, "LLL dd, y") : /* @__PURE__ */ jsx46("span", { children: "Pick a date range" })
|
|
28200
28470
|
}
|
|
28201
28471
|
) }),
|
|
28202
|
-
/* @__PURE__ */
|
|
28472
|
+
/* @__PURE__ */ jsx46(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx46(
|
|
28203
28473
|
Calendar2,
|
|
28204
28474
|
{
|
|
28205
28475
|
mode: "range",
|
|
@@ -28210,21 +28480,21 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28210
28480
|
}
|
|
28211
28481
|
) })
|
|
28212
28482
|
] }) }),
|
|
28213
|
-
props.errorMessage && /* @__PURE__ */
|
|
28483
|
+
props.errorMessage && /* @__PURE__ */ jsx46("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28214
28484
|
] });
|
|
28215
28485
|
};
|
|
28216
28486
|
var DateRange_default = DateRange;
|
|
28217
28487
|
|
|
28218
28488
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
28219
|
-
import { useEffect as
|
|
28220
|
-
import { Fragment as
|
|
28489
|
+
import { useEffect as useEffect23 } from "react";
|
|
28490
|
+
import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
28221
28491
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
28222
28492
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
28223
28493
|
const isEditable = props.isEditable ?? true;
|
|
28224
28494
|
const isDisabled = props.isDisabled ?? false;
|
|
28225
28495
|
const isReadonly = props.isReadonly ?? false;
|
|
28226
28496
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28227
|
-
|
|
28497
|
+
useEffect23(() => {
|
|
28228
28498
|
if (props.value !== void 0) {
|
|
28229
28499
|
const e = { target: { value: props.value } };
|
|
28230
28500
|
handleChange?.(e);
|
|
@@ -28233,8 +28503,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28233
28503
|
const handleChange = (e) => {
|
|
28234
28504
|
props.onChange?.(e);
|
|
28235
28505
|
};
|
|
28236
|
-
return /* @__PURE__ */
|
|
28237
|
-
/* @__PURE__ */
|
|
28506
|
+
return /* @__PURE__ */ jsxs26(Fragment18, { children: [
|
|
28507
|
+
/* @__PURE__ */ jsxs26(
|
|
28238
28508
|
"div",
|
|
28239
28509
|
{
|
|
28240
28510
|
className: cn(
|
|
@@ -28244,8 +28514,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28244
28514
|
props.errorMessage ? "border-red-500" : ""
|
|
28245
28515
|
),
|
|
28246
28516
|
children: [
|
|
28247
|
-
prepend && /* @__PURE__ */
|
|
28248
|
-
/* @__PURE__ */
|
|
28517
|
+
prepend && /* @__PURE__ */ jsx47("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-l-md", children: prepend }),
|
|
28518
|
+
/* @__PURE__ */ jsx47(
|
|
28249
28519
|
Input,
|
|
28250
28520
|
{
|
|
28251
28521
|
id: props.name || "prepend-input",
|
|
@@ -28267,11 +28537,11 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28267
28537
|
readOnly: isReadonly
|
|
28268
28538
|
}
|
|
28269
28539
|
),
|
|
28270
|
-
append && /* @__PURE__ */
|
|
28540
|
+
append && /* @__PURE__ */ jsx47("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-r-md", children: append })
|
|
28271
28541
|
]
|
|
28272
28542
|
}
|
|
28273
28543
|
),
|
|
28274
|
-
props.errorMessage && /* @__PURE__ */
|
|
28544
|
+
props.errorMessage && /* @__PURE__ */ jsx47("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28275
28545
|
] });
|
|
28276
28546
|
};
|
|
28277
28547
|
var TextInputGroup_default = TextInputGroup;
|
|
@@ -28284,22 +28554,22 @@ import { Command as CommandPrimitive } from "cmdk";
|
|
|
28284
28554
|
|
|
28285
28555
|
// src/components/ui/dialog.tsx
|
|
28286
28556
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
28287
|
-
import { jsx as
|
|
28557
|
+
import { jsx as jsx48, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
28288
28558
|
function Dialog({
|
|
28289
28559
|
...props
|
|
28290
28560
|
}) {
|
|
28291
|
-
return /* @__PURE__ */
|
|
28561
|
+
return /* @__PURE__ */ jsx48(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
28292
28562
|
}
|
|
28293
28563
|
function DialogPortal({
|
|
28294
28564
|
...props
|
|
28295
28565
|
}) {
|
|
28296
|
-
return /* @__PURE__ */
|
|
28566
|
+
return /* @__PURE__ */ jsx48(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
28297
28567
|
}
|
|
28298
28568
|
function DialogOverlay({
|
|
28299
28569
|
className,
|
|
28300
28570
|
...props
|
|
28301
28571
|
}) {
|
|
28302
|
-
return /* @__PURE__ */
|
|
28572
|
+
return /* @__PURE__ */ jsx48(
|
|
28303
28573
|
DialogPrimitive.Overlay,
|
|
28304
28574
|
{
|
|
28305
28575
|
"data-slot": "dialog-overlay",
|
|
@@ -28317,9 +28587,9 @@ function DialogContent({
|
|
|
28317
28587
|
showCloseButton = true,
|
|
28318
28588
|
...props
|
|
28319
28589
|
}) {
|
|
28320
|
-
return /* @__PURE__ */
|
|
28321
|
-
/* @__PURE__ */
|
|
28322
|
-
/* @__PURE__ */
|
|
28590
|
+
return /* @__PURE__ */ jsxs27(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
28591
|
+
/* @__PURE__ */ jsx48(DialogOverlay, {}),
|
|
28592
|
+
/* @__PURE__ */ jsxs27(
|
|
28323
28593
|
DialogPrimitive.Content,
|
|
28324
28594
|
{
|
|
28325
28595
|
"data-slot": "dialog-content",
|
|
@@ -28330,14 +28600,14 @@ function DialogContent({
|
|
|
28330
28600
|
...props,
|
|
28331
28601
|
children: [
|
|
28332
28602
|
children,
|
|
28333
|
-
showCloseButton && /* @__PURE__ */
|
|
28603
|
+
showCloseButton && /* @__PURE__ */ jsxs27(
|
|
28334
28604
|
DialogPrimitive.Close,
|
|
28335
28605
|
{
|
|
28336
28606
|
"data-slot": "dialog-close",
|
|
28337
28607
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
28338
28608
|
children: [
|
|
28339
|
-
/* @__PURE__ */
|
|
28340
|
-
/* @__PURE__ */
|
|
28609
|
+
/* @__PURE__ */ jsx48(X, {}),
|
|
28610
|
+
/* @__PURE__ */ jsx48("span", { className: "sr-only", children: "Close" })
|
|
28341
28611
|
]
|
|
28342
28612
|
}
|
|
28343
28613
|
)
|
|
@@ -28347,7 +28617,7 @@ function DialogContent({
|
|
|
28347
28617
|
] });
|
|
28348
28618
|
}
|
|
28349
28619
|
function DialogHeader({ className, ...props }) {
|
|
28350
|
-
return /* @__PURE__ */
|
|
28620
|
+
return /* @__PURE__ */ jsx48(
|
|
28351
28621
|
"div",
|
|
28352
28622
|
{
|
|
28353
28623
|
"data-slot": "dialog-header",
|
|
@@ -28357,7 +28627,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
28357
28627
|
);
|
|
28358
28628
|
}
|
|
28359
28629
|
function DialogFooter({ className, ...props }) {
|
|
28360
|
-
return /* @__PURE__ */
|
|
28630
|
+
return /* @__PURE__ */ jsx48(
|
|
28361
28631
|
"div",
|
|
28362
28632
|
{
|
|
28363
28633
|
"data-slot": "dialog-footer",
|
|
@@ -28373,7 +28643,7 @@ function DialogTitle({
|
|
|
28373
28643
|
className,
|
|
28374
28644
|
...props
|
|
28375
28645
|
}) {
|
|
28376
|
-
return /* @__PURE__ */
|
|
28646
|
+
return /* @__PURE__ */ jsx48(
|
|
28377
28647
|
DialogPrimitive.Title,
|
|
28378
28648
|
{
|
|
28379
28649
|
"data-slot": "dialog-title",
|
|
@@ -28386,7 +28656,7 @@ function DialogDescription({
|
|
|
28386
28656
|
className,
|
|
28387
28657
|
...props
|
|
28388
28658
|
}) {
|
|
28389
|
-
return /* @__PURE__ */
|
|
28659
|
+
return /* @__PURE__ */ jsx48(
|
|
28390
28660
|
DialogPrimitive.Description,
|
|
28391
28661
|
{
|
|
28392
28662
|
"data-slot": "dialog-description",
|
|
@@ -28397,12 +28667,12 @@ function DialogDescription({
|
|
|
28397
28667
|
}
|
|
28398
28668
|
|
|
28399
28669
|
// src/components/ui/command.tsx
|
|
28400
|
-
import { jsx as
|
|
28670
|
+
import { jsx as jsx49, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
28401
28671
|
function Command2({
|
|
28402
28672
|
className,
|
|
28403
28673
|
...props
|
|
28404
28674
|
}) {
|
|
28405
|
-
return /* @__PURE__ */
|
|
28675
|
+
return /* @__PURE__ */ jsx49(
|
|
28406
28676
|
CommandPrimitive,
|
|
28407
28677
|
{
|
|
28408
28678
|
"data-slot": "command",
|
|
@@ -28418,14 +28688,14 @@ function CommandInput({
|
|
|
28418
28688
|
className,
|
|
28419
28689
|
...props
|
|
28420
28690
|
}) {
|
|
28421
|
-
return /* @__PURE__ */
|
|
28691
|
+
return /* @__PURE__ */ jsxs28(
|
|
28422
28692
|
"div",
|
|
28423
28693
|
{
|
|
28424
28694
|
"data-slot": "command-input-wrapper",
|
|
28425
28695
|
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
28426
28696
|
children: [
|
|
28427
|
-
/* @__PURE__ */
|
|
28428
|
-
/* @__PURE__ */
|
|
28697
|
+
/* @__PURE__ */ jsx49(Search, { className: "size-4 shrink-0 opacity-50" }),
|
|
28698
|
+
/* @__PURE__ */ jsx49(
|
|
28429
28699
|
CommandPrimitive.Input,
|
|
28430
28700
|
{
|
|
28431
28701
|
"data-slot": "command-input",
|
|
@@ -28444,7 +28714,7 @@ function CommandList({
|
|
|
28444
28714
|
className,
|
|
28445
28715
|
...props
|
|
28446
28716
|
}) {
|
|
28447
|
-
return /* @__PURE__ */
|
|
28717
|
+
return /* @__PURE__ */ jsx49(
|
|
28448
28718
|
CommandPrimitive.List,
|
|
28449
28719
|
{
|
|
28450
28720
|
"data-slot": "command-list",
|
|
@@ -28459,7 +28729,7 @@ function CommandList({
|
|
|
28459
28729
|
function CommandEmpty({
|
|
28460
28730
|
...props
|
|
28461
28731
|
}) {
|
|
28462
|
-
return /* @__PURE__ */
|
|
28732
|
+
return /* @__PURE__ */ jsx49(
|
|
28463
28733
|
CommandPrimitive.Empty,
|
|
28464
28734
|
{
|
|
28465
28735
|
"data-slot": "command-empty",
|
|
@@ -28472,7 +28742,7 @@ function CommandGroup({
|
|
|
28472
28742
|
className,
|
|
28473
28743
|
...props
|
|
28474
28744
|
}) {
|
|
28475
|
-
return /* @__PURE__ */
|
|
28745
|
+
return /* @__PURE__ */ jsx49(
|
|
28476
28746
|
CommandPrimitive.Group,
|
|
28477
28747
|
{
|
|
28478
28748
|
"data-slot": "command-group",
|
|
@@ -28488,7 +28758,7 @@ function CommandItem({
|
|
|
28488
28758
|
className,
|
|
28489
28759
|
...props
|
|
28490
28760
|
}) {
|
|
28491
|
-
return /* @__PURE__ */
|
|
28761
|
+
return /* @__PURE__ */ jsx49(
|
|
28492
28762
|
CommandPrimitive.Item,
|
|
28493
28763
|
{
|
|
28494
28764
|
"data-slot": "command-item",
|
|
@@ -28502,7 +28772,7 @@ function CommandItem({
|
|
|
28502
28772
|
}
|
|
28503
28773
|
|
|
28504
28774
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
28505
|
-
import { jsx as
|
|
28775
|
+
import { jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
28506
28776
|
var MultiSelect = ({
|
|
28507
28777
|
value = [],
|
|
28508
28778
|
onChange,
|
|
@@ -28527,15 +28797,15 @@ var MultiSelect = ({
|
|
|
28527
28797
|
);
|
|
28528
28798
|
};
|
|
28529
28799
|
const selectedLabels = React8.useMemo(
|
|
28530
|
-
() => data
|
|
28800
|
+
() => data?.filter((opt) => value.includes(opt.value)).map((opt) => opt.label),
|
|
28531
28801
|
[data, value]
|
|
28532
28802
|
);
|
|
28533
|
-
const options = data
|
|
28803
|
+
const options = data?.map((item) => ({
|
|
28534
28804
|
value: item[dataKey],
|
|
28535
28805
|
label: item[dataLabel]
|
|
28536
28806
|
}));
|
|
28537
|
-
return /* @__PURE__ */
|
|
28538
|
-
/* @__PURE__ */
|
|
28807
|
+
return /* @__PURE__ */ jsxs29(Popover, { open, onOpenChange: setOpen, children: [
|
|
28808
|
+
/* @__PURE__ */ jsx50(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs29(
|
|
28539
28809
|
Button,
|
|
28540
28810
|
{
|
|
28541
28811
|
variant: "outline",
|
|
@@ -28544,12 +28814,12 @@ var MultiSelect = ({
|
|
|
28544
28814
|
disabled,
|
|
28545
28815
|
type: "button",
|
|
28546
28816
|
children: [
|
|
28547
|
-
/* @__PURE__ */
|
|
28548
|
-
/* @__PURE__ */
|
|
28817
|
+
/* @__PURE__ */ jsx50("span", { className: "truncate", children: selectedLabels.length > 0 ? selectedLabels.join(", ") : placeholder }),
|
|
28818
|
+
/* @__PURE__ */ jsx50(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
28549
28819
|
]
|
|
28550
28820
|
}
|
|
28551
28821
|
) }),
|
|
28552
|
-
/* @__PURE__ */
|
|
28822
|
+
/* @__PURE__ */ jsx50(
|
|
28553
28823
|
PopoverContent,
|
|
28554
28824
|
{
|
|
28555
28825
|
align: "start",
|
|
@@ -28558,26 +28828,26 @@ var MultiSelect = ({
|
|
|
28558
28828
|
onInteractOutside: (e) => {
|
|
28559
28829
|
if (e.target.closest(".keep-open")) e.preventDefault();
|
|
28560
28830
|
},
|
|
28561
|
-
children: /* @__PURE__ */
|
|
28562
|
-
searchable && /* @__PURE__ */
|
|
28563
|
-
/* @__PURE__ */
|
|
28564
|
-
/* @__PURE__ */
|
|
28565
|
-
/* @__PURE__ */
|
|
28831
|
+
children: /* @__PURE__ */ jsxs29(Command2, { shouldFilter: searchable, children: [
|
|
28832
|
+
searchable && /* @__PURE__ */ jsx50(CommandInput, { placeholder: "Search..." }),
|
|
28833
|
+
/* @__PURE__ */ jsxs29(CommandList, { children: [
|
|
28834
|
+
/* @__PURE__ */ jsx50(CommandEmpty, { children: "No options found." }),
|
|
28835
|
+
/* @__PURE__ */ jsx50(CommandGroup, { children: options.map((opt) => {
|
|
28566
28836
|
const isSelected = value.includes(opt.value);
|
|
28567
|
-
return /* @__PURE__ */
|
|
28837
|
+
return /* @__PURE__ */ jsx50(
|
|
28568
28838
|
"div",
|
|
28569
28839
|
{
|
|
28570
28840
|
className: "keep-open",
|
|
28571
|
-
children: /* @__PURE__ */
|
|
28841
|
+
children: /* @__PURE__ */ jsx50(
|
|
28572
28842
|
CommandItem,
|
|
28573
28843
|
{
|
|
28574
28844
|
onMouseDown: (e) => {
|
|
28575
28845
|
e.preventDefault();
|
|
28576
28846
|
toggleOption(opt.value);
|
|
28577
28847
|
},
|
|
28578
|
-
children: /* @__PURE__ */
|
|
28579
|
-
/* @__PURE__ */
|
|
28580
|
-
/* @__PURE__ */
|
|
28848
|
+
children: /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
28849
|
+
/* @__PURE__ */ jsx50(Checkbox, { checked: isSelected }),
|
|
28850
|
+
/* @__PURE__ */ jsx50("span", { children: opt.label })
|
|
28581
28851
|
] })
|
|
28582
28852
|
},
|
|
28583
28853
|
opt.value
|
|
@@ -28590,7 +28860,7 @@ var MultiSelect = ({
|
|
|
28590
28860
|
] })
|
|
28591
28861
|
}
|
|
28592
28862
|
),
|
|
28593
|
-
props.errorMessage && /* @__PURE__ */
|
|
28863
|
+
props.errorMessage && /* @__PURE__ */ jsx50("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28594
28864
|
] });
|
|
28595
28865
|
};
|
|
28596
28866
|
var MultiSelect_default = MultiSelect;
|
|
@@ -28608,14 +28878,14 @@ import {
|
|
|
28608
28878
|
} from "@tanstack/react-table";
|
|
28609
28879
|
|
|
28610
28880
|
// src/components/ui/table.tsx
|
|
28611
|
-
import { jsx as
|
|
28881
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
28612
28882
|
function Table3({ className, ...props }) {
|
|
28613
|
-
return /* @__PURE__ */
|
|
28883
|
+
return /* @__PURE__ */ jsx51(
|
|
28614
28884
|
"div",
|
|
28615
28885
|
{
|
|
28616
28886
|
"data-slot": "table-container",
|
|
28617
28887
|
className: "relative w-full overflow-x-auto rounded-md border border-gray-200 bg-white",
|
|
28618
|
-
children: /* @__PURE__ */
|
|
28888
|
+
children: /* @__PURE__ */ jsx51(
|
|
28619
28889
|
"table",
|
|
28620
28890
|
{
|
|
28621
28891
|
"data-slot": "table",
|
|
@@ -28627,7 +28897,7 @@ function Table3({ className, ...props }) {
|
|
|
28627
28897
|
);
|
|
28628
28898
|
}
|
|
28629
28899
|
function TableHeader({ className, ...props }) {
|
|
28630
|
-
return /* @__PURE__ */
|
|
28900
|
+
return /* @__PURE__ */ jsx51(
|
|
28631
28901
|
"thead",
|
|
28632
28902
|
{
|
|
28633
28903
|
"data-slot": "table-header",
|
|
@@ -28640,7 +28910,7 @@ function TableHeader({ className, ...props }) {
|
|
|
28640
28910
|
);
|
|
28641
28911
|
}
|
|
28642
28912
|
function TableBody({ className, ...props }) {
|
|
28643
|
-
return /* @__PURE__ */
|
|
28913
|
+
return /* @__PURE__ */ jsx51(
|
|
28644
28914
|
"tbody",
|
|
28645
28915
|
{
|
|
28646
28916
|
"data-slot": "table-body",
|
|
@@ -28653,7 +28923,7 @@ function TableBody({ className, ...props }) {
|
|
|
28653
28923
|
);
|
|
28654
28924
|
}
|
|
28655
28925
|
function TableRow({ className, ...props }) {
|
|
28656
|
-
return /* @__PURE__ */
|
|
28926
|
+
return /* @__PURE__ */ jsx51(
|
|
28657
28927
|
"tr",
|
|
28658
28928
|
{
|
|
28659
28929
|
"data-slot": "table-row",
|
|
@@ -28666,7 +28936,7 @@ function TableRow({ className, ...props }) {
|
|
|
28666
28936
|
);
|
|
28667
28937
|
}
|
|
28668
28938
|
function TableHead({ className, ...props }) {
|
|
28669
|
-
return /* @__PURE__ */
|
|
28939
|
+
return /* @__PURE__ */ jsx51(
|
|
28670
28940
|
"th",
|
|
28671
28941
|
{
|
|
28672
28942
|
"data-slot": "table-head",
|
|
@@ -28679,7 +28949,7 @@ function TableHead({ className, ...props }) {
|
|
|
28679
28949
|
);
|
|
28680
28950
|
}
|
|
28681
28951
|
function TableCell({ className, ...props }) {
|
|
28682
|
-
return /* @__PURE__ */
|
|
28952
|
+
return /* @__PURE__ */ jsx51(
|
|
28683
28953
|
"td",
|
|
28684
28954
|
{
|
|
28685
28955
|
"data-slot": "table-cell",
|
|
@@ -28692,8 +28962,246 @@ function TableCell({ className, ...props }) {
|
|
|
28692
28962
|
);
|
|
28693
28963
|
}
|
|
28694
28964
|
|
|
28965
|
+
// src/lib/table/useDynamicColumns.ts
|
|
28966
|
+
import { createColumnHelper } from "@tanstack/react-table";
|
|
28967
|
+
|
|
28968
|
+
// src/lib/table/cellRendererFactory.tsx
|
|
28969
|
+
import Image2 from "next/image";
|
|
28970
|
+
|
|
28971
|
+
// src/lib/table/valueFormatter.ts
|
|
28972
|
+
import dayjs from "dayjs";
|
|
28973
|
+
var valueFormatter = (value, format2, customFormatters = {}) => {
|
|
28974
|
+
if (!format2) return value;
|
|
28975
|
+
if (value == null) return "";
|
|
28976
|
+
if (format2.startsWith("custom:")) {
|
|
28977
|
+
const key = format2.replace("custom:", "");
|
|
28978
|
+
return customFormatters[key] ? customFormatters[key](value) : value;
|
|
28979
|
+
}
|
|
28980
|
+
const [type, arg] = format2.split(":");
|
|
28981
|
+
switch (type) {
|
|
28982
|
+
case "date":
|
|
28983
|
+
return dayjs(value).format(arg || "YYYY-MM-DD");
|
|
28984
|
+
case "datetime":
|
|
28985
|
+
return dayjs(value).format(arg || "YYYY-MM-DD HH:mm:ss");
|
|
28986
|
+
case "time":
|
|
28987
|
+
return dayjs(value).format(arg || "HH:mm");
|
|
28988
|
+
case "number":
|
|
28989
|
+
return Number(value).toFixed(parseInt(arg || "2"));
|
|
28990
|
+
case "currency":
|
|
28991
|
+
return new Intl.NumberFormat("en-IN", {
|
|
28992
|
+
style: "currency",
|
|
28993
|
+
currency: arg || "INR"
|
|
28994
|
+
}).format(Number(value));
|
|
28995
|
+
case "uppercase":
|
|
28996
|
+
return String(value).toUpperCase();
|
|
28997
|
+
case "lowercase":
|
|
28998
|
+
return String(value).toLowerCase();
|
|
28999
|
+
default:
|
|
29000
|
+
return value;
|
|
29001
|
+
}
|
|
29002
|
+
};
|
|
29003
|
+
|
|
29004
|
+
// src/lib/table/cellRendererFactory.tsx
|
|
29005
|
+
import { Fragment as Fragment19, jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
29006
|
+
var getContrastColor = (bg) => {
|
|
29007
|
+
let c = bg.trim().toUpperCase();
|
|
29008
|
+
if (/^#([a-fA-F0-9]{3})$/.test(c)) {
|
|
29009
|
+
c = "#" + c.slice(1).split("").map((x) => x + x).join("");
|
|
29010
|
+
}
|
|
29011
|
+
const named = {
|
|
29012
|
+
white: "#FFFFFF",
|
|
29013
|
+
black: "#000000",
|
|
29014
|
+
red: "#FF0000",
|
|
29015
|
+
green: "#008000",
|
|
29016
|
+
blue: "#0000FF",
|
|
29017
|
+
gray: "#808080",
|
|
29018
|
+
grey: "#808080",
|
|
29019
|
+
orange: "#FFA500",
|
|
29020
|
+
yellow: "#FFFF00",
|
|
29021
|
+
purple: "#800080",
|
|
29022
|
+
pink: "#FFC0CB",
|
|
29023
|
+
teal: "#008080"
|
|
29024
|
+
};
|
|
29025
|
+
if (!c.startsWith("#")) {
|
|
29026
|
+
const lower = c.toLowerCase();
|
|
29027
|
+
if (named[lower]) c = named[lower];
|
|
29028
|
+
else return "#FFFFFF";
|
|
29029
|
+
}
|
|
29030
|
+
if (!/^#([a-fA-F0-9]{6})$/.test(c)) return "#FFFFFF";
|
|
29031
|
+
const r = parseInt(c.slice(1, 3), 16);
|
|
29032
|
+
const g = parseInt(c.slice(3, 5), 16);
|
|
29033
|
+
const b = parseInt(c.slice(5, 7), 16);
|
|
29034
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
29035
|
+
return brightness > 160 ? "#000000" : "#FFFFFF";
|
|
29036
|
+
};
|
|
29037
|
+
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format2, customFormatters = {}) => {
|
|
29038
|
+
const formattedValue = valueFormatter(value, format2, customFormatters);
|
|
29039
|
+
switch (renderer) {
|
|
29040
|
+
/* -------------------- BASIC -------------------- */
|
|
29041
|
+
case "text":
|
|
29042
|
+
return /* @__PURE__ */ jsx52("span", { children: row?.[rendererProps?.rowField] || formattedValue });
|
|
29043
|
+
case "number":
|
|
29044
|
+
return /* @__PURE__ */ jsx52("span", { className: "tabular-nums text-right", children: valueFormatter(row?.[rendererProps?.rowField] || formattedValue, "number:2") });
|
|
29045
|
+
case "date":
|
|
29046
|
+
return /* @__PURE__ */ jsx52("span", { children: valueFormatter(row?.[rendererProps?.rowField] || formattedValue, "date:DD MMM YYYY") });
|
|
29047
|
+
case "link":
|
|
29048
|
+
return /* @__PURE__ */ jsx52(
|
|
29049
|
+
"a",
|
|
29050
|
+
{
|
|
29051
|
+
href: `${rendererProps?.prefix || ""}${row?.[rendererProps?.rowField] || formattedValue}`,
|
|
29052
|
+
target: "_blank",
|
|
29053
|
+
rel: "noreferrer",
|
|
29054
|
+
className: `text-blue-500 underline ${rendererProps?.className || ""}`,
|
|
29055
|
+
children: rendererProps?.label || formattedValue
|
|
29056
|
+
}
|
|
29057
|
+
);
|
|
29058
|
+
/* -------------------- VISUAL -------------------- */
|
|
29059
|
+
case "image":
|
|
29060
|
+
return /* @__PURE__ */ jsx52("div", { className: "relative", children: /* @__PURE__ */ jsx52(
|
|
29061
|
+
Image2,
|
|
29062
|
+
{
|
|
29063
|
+
src: row?.[rendererProps?.rowField] || formattedValue || rendererProps?.fallback || "/placeholder.png",
|
|
29064
|
+
alt: rendererProps?.alt || "",
|
|
29065
|
+
width: rendererProps?.width || 40,
|
|
29066
|
+
height: rendererProps?.height || 40,
|
|
29067
|
+
className: `object-cover ${rendererProps?.rounded ? "rounded-full" : ""} ${rendererProps?.className || ""}`,
|
|
29068
|
+
style: {
|
|
29069
|
+
borderRadius: rendererProps?.rounded ? "50%" : 0,
|
|
29070
|
+
objectFit: "cover"
|
|
29071
|
+
}
|
|
29072
|
+
}
|
|
29073
|
+
) });
|
|
29074
|
+
case "icon":
|
|
29075
|
+
const maybeIcon = lucide_react_exports[rendererProps?.icon];
|
|
29076
|
+
const IconComponent = typeof maybeIcon === "function" ? maybeIcon : Star;
|
|
29077
|
+
return /* @__PURE__ */ jsx52(
|
|
29078
|
+
IconComponent,
|
|
29079
|
+
{
|
|
29080
|
+
size: rendererProps?.size || 16,
|
|
29081
|
+
color: rendererProps?.color || "#555",
|
|
29082
|
+
className: rendererProps?.className || ""
|
|
29083
|
+
}
|
|
29084
|
+
);
|
|
29085
|
+
case "badge": {
|
|
29086
|
+
const color = rendererProps?.colorMap?.[formattedValue] || rendererProps?.color || "gray";
|
|
29087
|
+
if (!formattedValue) return null;
|
|
29088
|
+
const textColor = getContrastColor(color);
|
|
29089
|
+
return /* @__PURE__ */ jsx52(
|
|
29090
|
+
"span",
|
|
29091
|
+
{
|
|
29092
|
+
className: `inline-block px-2 py-1 text-xs rounded-full bg-${color}-100 text-${textColor}-700 ${rendererProps?.className || ""}`,
|
|
29093
|
+
style: { backgroundColor: color, color: textColor },
|
|
29094
|
+
children: formattedValue
|
|
29095
|
+
}
|
|
29096
|
+
);
|
|
29097
|
+
}
|
|
29098
|
+
case "chip": {
|
|
29099
|
+
const color = rendererProps?.color || "gray";
|
|
29100
|
+
const maybeIcon2 = lucide_react_exports[rendererProps?.icon];
|
|
29101
|
+
const IconComponent2 = typeof maybeIcon2 === "function" ? maybeIcon2 : Star;
|
|
29102
|
+
if (!formattedValue) return null;
|
|
29103
|
+
const textColor = getContrastColor(color);
|
|
29104
|
+
return /* @__PURE__ */ jsxs30(
|
|
29105
|
+
"span",
|
|
29106
|
+
{
|
|
29107
|
+
className: `inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full bg-[${color}]-100 text-[${textColor}]-700`,
|
|
29108
|
+
style: { backgroundColor: color, color: textColor },
|
|
29109
|
+
children: [
|
|
29110
|
+
rendererProps?.icon && /* @__PURE__ */ jsx52(Fragment19, { children: IconComponent2 ? /* @__PURE__ */ jsx52(IconComponent2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx52(Box, { className: "h-4 w-4" }) }),
|
|
29111
|
+
formattedValue
|
|
29112
|
+
]
|
|
29113
|
+
}
|
|
29114
|
+
);
|
|
29115
|
+
}
|
|
29116
|
+
/* -------------------- INTERACTIVE -------------------- */
|
|
29117
|
+
case "button":
|
|
29118
|
+
return /* @__PURE__ */ jsx52(
|
|
29119
|
+
"button",
|
|
29120
|
+
{
|
|
29121
|
+
onClick: () => rendererProps?.onClick?.(row, formattedValue),
|
|
29122
|
+
className: `px-2 py-1 rounded text-white bg-blue-600 hover:bg-blue-700 ${rendererProps?.className || ""}`,
|
|
29123
|
+
children: row?.[rendererProps?.rowField] || rendererProps.value || formattedValue
|
|
29124
|
+
}
|
|
29125
|
+
);
|
|
29126
|
+
case "switch":
|
|
29127
|
+
return /* @__PURE__ */ jsxs30("label", { className: "inline-flex items-center cursor-pointer", children: [
|
|
29128
|
+
/* @__PURE__ */ jsx52(
|
|
29129
|
+
"input",
|
|
29130
|
+
{
|
|
29131
|
+
type: "checkbox",
|
|
29132
|
+
checked: !!value,
|
|
29133
|
+
onChange: (e) => rendererProps?.onChange?.(row, e.target.checked),
|
|
29134
|
+
className: "sr-only peer"
|
|
29135
|
+
}
|
|
29136
|
+
),
|
|
29137
|
+
/* @__PURE__ */ jsx52("div", { className: "relative w-9 h-5 bg-gray-300 peer-checked:bg-blue-600 rounded-full transition-all", children: /* @__PURE__ */ jsx52("div", { className: "absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full peer-checked:translate-x-4 transition-all" }) })
|
|
29138
|
+
] });
|
|
29139
|
+
case "progress":
|
|
29140
|
+
return /* @__PURE__ */ jsx52("div", { className: "w-full bg-gray-100 rounded-full h-2", children: /* @__PURE__ */ jsx52(
|
|
29141
|
+
"div",
|
|
29142
|
+
{
|
|
29143
|
+
className: "bg-blue-600 h-2 rounded-full transition-all",
|
|
29144
|
+
style: { width: `${row?.[rendererProps?.rowField] || formattedValue || 0}%` }
|
|
29145
|
+
}
|
|
29146
|
+
) });
|
|
29147
|
+
case "rating": {
|
|
29148
|
+
const stars = Math.round(Number(row?.[rendererProps?.rowField] || formattedValue) || 0);
|
|
29149
|
+
return /* @__PURE__ */ jsx52("div", { className: "flex items-center", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx52(
|
|
29150
|
+
Star,
|
|
29151
|
+
{
|
|
29152
|
+
size: 16,
|
|
29153
|
+
className: i < stars ? "text-yellow-400" : "text-gray-300",
|
|
29154
|
+
fill: i < stars ? "#facc15" : "none"
|
|
29155
|
+
},
|
|
29156
|
+
i
|
|
29157
|
+
)) });
|
|
29158
|
+
}
|
|
29159
|
+
/* -------------------- ADVANCED -------------------- */
|
|
29160
|
+
case "custom": {
|
|
29161
|
+
const CustomRenderer = customRenderers[rendererProps?.customRendererId] || customRenderers[rendererProps?.rendererId];
|
|
29162
|
+
if (CustomRenderer)
|
|
29163
|
+
return /* @__PURE__ */ jsx52(
|
|
29164
|
+
CustomRenderer,
|
|
29165
|
+
{
|
|
29166
|
+
value: formattedValue,
|
|
29167
|
+
row,
|
|
29168
|
+
...rendererProps
|
|
29169
|
+
}
|
|
29170
|
+
);
|
|
29171
|
+
return /* @__PURE__ */ jsx52("span", { children: "Missing custom renderer" });
|
|
29172
|
+
}
|
|
29173
|
+
/* -------------------- DEFAULT -------------------- */
|
|
29174
|
+
default:
|
|
29175
|
+
return /* @__PURE__ */ jsx52("span", { children: formattedValue });
|
|
29176
|
+
}
|
|
29177
|
+
};
|
|
29178
|
+
|
|
29179
|
+
// src/lib/table/useDynamicColumns.ts
|
|
29180
|
+
var columnHelper = createColumnHelper();
|
|
29181
|
+
var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) => {
|
|
29182
|
+
return config.columns.map(
|
|
29183
|
+
(col) => columnHelper.accessor(col.accessorKey ?? col.id, {
|
|
29184
|
+
id: col.accessorKey ?? col.id,
|
|
29185
|
+
header: col.header,
|
|
29186
|
+
cell: (info) => {
|
|
29187
|
+
const value = info.getValue();
|
|
29188
|
+
const row = info.row.original;
|
|
29189
|
+
return cellRendererFactory(
|
|
29190
|
+
col.renderer,
|
|
29191
|
+
col.rendererProps,
|
|
29192
|
+
value,
|
|
29193
|
+
row,
|
|
29194
|
+
customRenderers,
|
|
29195
|
+
col.format,
|
|
29196
|
+
customFormatters
|
|
29197
|
+
);
|
|
29198
|
+
}
|
|
29199
|
+
})
|
|
29200
|
+
);
|
|
29201
|
+
};
|
|
29202
|
+
|
|
28695
29203
|
// src/components/ui/data-table.tsx
|
|
28696
|
-
import { Fragment as
|
|
29204
|
+
import { Fragment as Fragment20, jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
28697
29205
|
function DataTable({
|
|
28698
29206
|
columns,
|
|
28699
29207
|
data,
|
|
@@ -28719,7 +29227,7 @@ function DataTable({
|
|
|
28719
29227
|
const deleteColumn = React9.useMemo(() => ({
|
|
28720
29228
|
id: "delete",
|
|
28721
29229
|
header: "Actions",
|
|
28722
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
29230
|
+
cell: ({ row }) => /* @__PURE__ */ jsx53(
|
|
28723
29231
|
"button",
|
|
28724
29232
|
{
|
|
28725
29233
|
className: "px-3 py-1 text-[12px] bg-red-800 text-white rounded hover:bg-neutral-600 cursor-pointer",
|
|
@@ -28740,9 +29248,10 @@ function DataTable({
|
|
|
28740
29248
|
}
|
|
28741
29249
|
return columns;
|
|
28742
29250
|
}, [columns, enableDelete, deleteColumn]);
|
|
29251
|
+
const dynamicCols = useDynamicColumns({ columns: combinedColumns });
|
|
28743
29252
|
const table = useReactTable({
|
|
28744
29253
|
data,
|
|
28745
|
-
columns:
|
|
29254
|
+
columns: dynamicCols,
|
|
28746
29255
|
state: {
|
|
28747
29256
|
columnFilters,
|
|
28748
29257
|
columnVisibility,
|
|
@@ -28787,11 +29296,11 @@ function DataTable({
|
|
|
28787
29296
|
}
|
|
28788
29297
|
return [];
|
|
28789
29298
|
};
|
|
28790
|
-
return /* @__PURE__ */
|
|
28791
|
-
/* @__PURE__ */
|
|
28792
|
-
globalSearch && /* @__PURE__ */
|
|
28793
|
-
/* @__PURE__ */
|
|
28794
|
-
/* @__PURE__ */
|
|
29299
|
+
return /* @__PURE__ */ jsxs31("div", { className: "overflow-hidden rounded-md w-full", children: [
|
|
29300
|
+
/* @__PURE__ */ jsxs31("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 bg-gray-50`, children: [
|
|
29301
|
+
globalSearch && /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
|
|
29302
|
+
/* @__PURE__ */ jsxs31("div", { className: "relative w-full", children: [
|
|
29303
|
+
/* @__PURE__ */ jsx53(
|
|
28795
29304
|
"input",
|
|
28796
29305
|
{
|
|
28797
29306
|
type: "text",
|
|
@@ -28806,9 +29315,9 @@ function DataTable({
|
|
|
28806
29315
|
className: "border border-gray-300 rounded-md text-sm px-3 py-2 pl-8 w-full focus:outline-none focus:ring-1 focus:ring-[#12715B]"
|
|
28807
29316
|
}
|
|
28808
29317
|
),
|
|
28809
|
-
/* @__PURE__ */
|
|
29318
|
+
/* @__PURE__ */ jsx53(Search, { className: "absolute left-2 top-2.5 text-gray-400", size: 16 })
|
|
28810
29319
|
] }),
|
|
28811
|
-
/* @__PURE__ */
|
|
29320
|
+
/* @__PURE__ */ jsx53(
|
|
28812
29321
|
Button,
|
|
28813
29322
|
{
|
|
28814
29323
|
size: "sm",
|
|
@@ -28818,8 +29327,8 @@ function DataTable({
|
|
|
28818
29327
|
}
|
|
28819
29328
|
)
|
|
28820
29329
|
] }),
|
|
28821
|
-
/* @__PURE__ */
|
|
28822
|
-
/* @__PURE__ */
|
|
29330
|
+
/* @__PURE__ */ jsxs31(Popover, { children: [
|
|
29331
|
+
/* @__PURE__ */ jsx53(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx53(
|
|
28823
29332
|
Button,
|
|
28824
29333
|
{
|
|
28825
29334
|
variant: "outline",
|
|
@@ -28828,10 +29337,10 @@ function DataTable({
|
|
|
28828
29337
|
children: "Manage Columns"
|
|
28829
29338
|
}
|
|
28830
29339
|
) }),
|
|
28831
|
-
/* @__PURE__ */
|
|
28832
|
-
/* @__PURE__ */
|
|
28833
|
-
/* @__PURE__ */
|
|
28834
|
-
/* @__PURE__ */
|
|
29340
|
+
/* @__PURE__ */ jsxs31(PopoverContent, { align: "end", className: "w-48 p-3 space-y-2", children: [
|
|
29341
|
+
/* @__PURE__ */ jsx53("div", { className: "text-sm font-medium mb-2", children: "Show / Hide Columns" }),
|
|
29342
|
+
/* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
|
|
29343
|
+
/* @__PURE__ */ jsx53(
|
|
28835
29344
|
"input",
|
|
28836
29345
|
{
|
|
28837
29346
|
type: "checkbox",
|
|
@@ -28850,8 +29359,8 @@ function DataTable({
|
|
|
28850
29359
|
),
|
|
28851
29360
|
"Toggle All"
|
|
28852
29361
|
] }),
|
|
28853
|
-
table.getAllLeafColumns().map((column) => /* @__PURE__ */
|
|
28854
|
-
/* @__PURE__ */
|
|
29362
|
+
table.getAllLeafColumns().map((column) => /* @__PURE__ */ jsxs31("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
29363
|
+
/* @__PURE__ */ jsx53(
|
|
28855
29364
|
"input",
|
|
28856
29365
|
{
|
|
28857
29366
|
type: "checkbox",
|
|
@@ -28864,13 +29373,13 @@ function DataTable({
|
|
|
28864
29373
|
] })
|
|
28865
29374
|
] })
|
|
28866
29375
|
] }),
|
|
28867
|
-
/* @__PURE__ */
|
|
28868
|
-
/* @__PURE__ */
|
|
29376
|
+
/* @__PURE__ */ jsxs31(Table3, { children: [
|
|
29377
|
+
/* @__PURE__ */ jsx53(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ jsx53(TableRow, { children: hg.headers.map((header) => {
|
|
28869
29378
|
const canSort = header.column.getCanSort();
|
|
28870
29379
|
const canFilter = header.column.getCanFilter();
|
|
28871
29380
|
const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
|
|
28872
|
-
return /* @__PURE__ */
|
|
28873
|
-
/* @__PURE__ */
|
|
29381
|
+
return /* @__PURE__ */ jsx53(TableHead, { className: "relative select-none", children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
29382
|
+
/* @__PURE__ */ jsxs31(
|
|
28874
29383
|
"span",
|
|
28875
29384
|
{
|
|
28876
29385
|
className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
|
|
@@ -28882,32 +29391,32 @@ function DataTable({
|
|
|
28882
29391
|
},
|
|
28883
29392
|
children: [
|
|
28884
29393
|
flexRender(header.column.columnDef.header, header.getContext()),
|
|
28885
|
-
canSort && /* @__PURE__ */
|
|
28886
|
-
sortDir === "asc" && /* @__PURE__ */
|
|
28887
|
-
sortDir === "desc" && /* @__PURE__ */
|
|
28888
|
-
!sortDir && /* @__PURE__ */
|
|
29394
|
+
canSort && /* @__PURE__ */ jsxs31(Fragment20, { children: [
|
|
29395
|
+
sortDir === "asc" && /* @__PURE__ */ jsx53(ArrowUp, { size: 14, className: "text-gray-500" }),
|
|
29396
|
+
sortDir === "desc" && /* @__PURE__ */ jsx53(ArrowDown, { size: 14, className: "text-gray-500" }),
|
|
29397
|
+
!sortDir && /* @__PURE__ */ jsx53(ArrowUpDown, { size: 14, className: "text-gray-400" })
|
|
28889
29398
|
] })
|
|
28890
29399
|
]
|
|
28891
29400
|
}
|
|
28892
29401
|
),
|
|
28893
|
-
canFilter && /* @__PURE__ */
|
|
28894
|
-
/* @__PURE__ */
|
|
29402
|
+
canFilter && /* @__PURE__ */ jsxs31(Popover, { children: [
|
|
29403
|
+
/* @__PURE__ */ jsx53(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx53(
|
|
28895
29404
|
"span",
|
|
28896
29405
|
{
|
|
28897
29406
|
role: "presentation",
|
|
28898
29407
|
className: "pl-5 cursor-pointer",
|
|
28899
29408
|
onClick: (e) => e.stopPropagation(),
|
|
28900
|
-
children: /* @__PURE__ */
|
|
29409
|
+
children: /* @__PURE__ */ jsx53(FontAwesomeIcon3, { icon: faEllipsisH, className: "w-5 h-5 text-gray-500" })
|
|
28901
29410
|
}
|
|
28902
29411
|
) }),
|
|
28903
|
-
/* @__PURE__ */
|
|
29412
|
+
/* @__PURE__ */ jsx53(
|
|
28904
29413
|
PopoverContent,
|
|
28905
29414
|
{
|
|
28906
29415
|
align: "center",
|
|
28907
29416
|
sideOffset: 14,
|
|
28908
29417
|
className: "w-50 p-3 z-[200] border-gray-300",
|
|
28909
29418
|
avoidCollisions: true,
|
|
28910
|
-
children: /* @__PURE__ */
|
|
29419
|
+
children: /* @__PURE__ */ jsxs31(
|
|
28911
29420
|
"form",
|
|
28912
29421
|
{
|
|
28913
29422
|
onSubmit: (e) => {
|
|
@@ -28920,8 +29429,8 @@ function DataTable({
|
|
|
28920
29429
|
},
|
|
28921
29430
|
className: "space-y-2",
|
|
28922
29431
|
children: [
|
|
28923
|
-
/* @__PURE__ */
|
|
28924
|
-
/* @__PURE__ */
|
|
29432
|
+
/* @__PURE__ */ jsx53("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
|
|
29433
|
+
/* @__PURE__ */ jsx53(
|
|
28925
29434
|
"input",
|
|
28926
29435
|
{
|
|
28927
29436
|
name: "filter",
|
|
@@ -28931,7 +29440,7 @@ function DataTable({
|
|
|
28931
29440
|
autoComplete: "off"
|
|
28932
29441
|
}
|
|
28933
29442
|
),
|
|
28934
|
-
/* @__PURE__ */
|
|
29443
|
+
/* @__PURE__ */ jsx53("div", { className: "justify-end flex", children: /* @__PURE__ */ jsx53(
|
|
28935
29444
|
Button,
|
|
28936
29445
|
{
|
|
28937
29446
|
type: "submit",
|
|
@@ -28947,10 +29456,10 @@ function DataTable({
|
|
|
28947
29456
|
] })
|
|
28948
29457
|
] }) }, header.id);
|
|
28949
29458
|
}) }, hg.id)) }),
|
|
28950
|
-
/* @__PURE__ */
|
|
29459
|
+
/* @__PURE__ */ jsx53(TableBody, { children: loading ? /* @__PURE__ */ jsx53(Fragment20, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx53(TableRow, { children: combinedColumns.map((_2, j) => /* @__PURE__ */ jsx53(TableCell, { className: "p-3", children: /* @__PURE__ */ jsx53("span", { className: "h-4 bg-gray-200 rounded w-3/4 block animate-pulse" }) }, j)) }, i)) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx53(TableRow, { children: row.getVisibleCells().map((cell) => {
|
|
28951
29460
|
const meta = cell.column.columnDef.meta || {};
|
|
28952
29461
|
const isClickable = meta?.isClickable;
|
|
28953
|
-
return /* @__PURE__ */
|
|
29462
|
+
return /* @__PURE__ */ jsx53(
|
|
28954
29463
|
TableCell,
|
|
28955
29464
|
{
|
|
28956
29465
|
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100" : ""}`,
|
|
@@ -28964,17 +29473,17 @@ function DataTable({
|
|
|
28964
29473
|
},
|
|
28965
29474
|
cell.id
|
|
28966
29475
|
);
|
|
28967
|
-
}) }, row.id)) : /* @__PURE__ */
|
|
29476
|
+
}) }, row.id)) : /* @__PURE__ */ jsx53(TableRow, { children: /* @__PURE__ */ jsx53(TableCell, { colSpan: combinedColumns.length, className: "h-24 text-center", children: /* @__PURE__ */ jsx53("span", { className: "flex items-center justify-center py-10 w-full min-w-full text-gray-600 bg-gray-100", children: "No results." }) }) }) })
|
|
28968
29477
|
] }),
|
|
28969
|
-
pagination && /* @__PURE__ */
|
|
28970
|
-
/* @__PURE__ */
|
|
29478
|
+
pagination && /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between py-3 px-2 text-sm w-full", children: [
|
|
29479
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
28971
29480
|
"Page ",
|
|
28972
29481
|
table.getState().pagination.pageIndex + 1,
|
|
28973
29482
|
" of ",
|
|
28974
29483
|
table.getPageCount()
|
|
28975
29484
|
] }),
|
|
28976
|
-
/* @__PURE__ */
|
|
28977
|
-
/* @__PURE__ */
|
|
29485
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
29486
|
+
/* @__PURE__ */ jsx53(
|
|
28978
29487
|
"button",
|
|
28979
29488
|
{
|
|
28980
29489
|
onClick: () => table.previousPage(),
|
|
@@ -28987,7 +29496,7 @@ function DataTable({
|
|
|
28987
29496
|
table.getState().pagination.pageIndex + 1,
|
|
28988
29497
|
table.getPageCount(),
|
|
28989
29498
|
5
|
|
28990
|
-
).map((pageNum, index) => /* @__PURE__ */
|
|
29499
|
+
).map((pageNum, index) => /* @__PURE__ */ jsx53(
|
|
28991
29500
|
"button",
|
|
28992
29501
|
{
|
|
28993
29502
|
disabled: pageNum === "...",
|
|
@@ -28997,7 +29506,7 @@ function DataTable({
|
|
|
28997
29506
|
},
|
|
28998
29507
|
index
|
|
28999
29508
|
)),
|
|
29000
|
-
/* @__PURE__ */
|
|
29509
|
+
/* @__PURE__ */ jsx53(
|
|
29001
29510
|
"button",
|
|
29002
29511
|
{
|
|
29003
29512
|
onClick: () => table.nextPage(),
|
|
@@ -29012,7 +29521,7 @@ function DataTable({
|
|
|
29012
29521
|
}
|
|
29013
29522
|
|
|
29014
29523
|
// src/components/DataDisplay/Table/Table.tsx
|
|
29015
|
-
import { jsx as
|
|
29524
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
29016
29525
|
var Table4 = ({
|
|
29017
29526
|
columns,
|
|
29018
29527
|
data,
|
|
@@ -29038,7 +29547,7 @@ var Table4 = ({
|
|
|
29038
29547
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
29039
29548
|
const rawData = Array.isArray(data) ? data : [];
|
|
29040
29549
|
const isControlled = typeof page === "number";
|
|
29041
|
-
return /* @__PURE__ */
|
|
29550
|
+
return /* @__PURE__ */ jsx54("div", { className: `${className || ""} space-y-3`, style, children: /* @__PURE__ */ jsx54(
|
|
29042
29551
|
DataTable,
|
|
29043
29552
|
{
|
|
29044
29553
|
...props,
|
|
@@ -29071,9 +29580,9 @@ var Table4 = ({
|
|
|
29071
29580
|
var Table_default = Table4;
|
|
29072
29581
|
|
|
29073
29582
|
// src/components/ui/pagination.tsx
|
|
29074
|
-
import { jsx as
|
|
29583
|
+
import { jsx as jsx55, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
29075
29584
|
function Pagination({ className, ...props }) {
|
|
29076
|
-
return /* @__PURE__ */
|
|
29585
|
+
return /* @__PURE__ */ jsx55(
|
|
29077
29586
|
"nav",
|
|
29078
29587
|
{
|
|
29079
29588
|
role: "navigation",
|
|
@@ -29088,7 +29597,7 @@ function PaginationContent({
|
|
|
29088
29597
|
className,
|
|
29089
29598
|
...props
|
|
29090
29599
|
}) {
|
|
29091
|
-
return /* @__PURE__ */
|
|
29600
|
+
return /* @__PURE__ */ jsx55(
|
|
29092
29601
|
"ul",
|
|
29093
29602
|
{
|
|
29094
29603
|
"data-slot": "pagination-content",
|
|
@@ -29098,7 +29607,7 @@ function PaginationContent({
|
|
|
29098
29607
|
);
|
|
29099
29608
|
}
|
|
29100
29609
|
function PaginationItem({ ...props }) {
|
|
29101
|
-
return /* @__PURE__ */
|
|
29610
|
+
return /* @__PURE__ */ jsx55("li", { "data-slot": "pagination-item", ...props });
|
|
29102
29611
|
}
|
|
29103
29612
|
function PaginationLink({
|
|
29104
29613
|
className,
|
|
@@ -29106,7 +29615,7 @@ function PaginationLink({
|
|
|
29106
29615
|
size = "icon",
|
|
29107
29616
|
...props
|
|
29108
29617
|
}) {
|
|
29109
|
-
return /* @__PURE__ */
|
|
29618
|
+
return /* @__PURE__ */ jsx55(
|
|
29110
29619
|
"a",
|
|
29111
29620
|
{
|
|
29112
29621
|
"aria-current": isActive ? "page" : void 0,
|
|
@@ -29127,7 +29636,7 @@ function PaginationPrevious({
|
|
|
29127
29636
|
className,
|
|
29128
29637
|
...props
|
|
29129
29638
|
}) {
|
|
29130
|
-
return /* @__PURE__ */
|
|
29639
|
+
return /* @__PURE__ */ jsxs32(
|
|
29131
29640
|
PaginationLink,
|
|
29132
29641
|
{
|
|
29133
29642
|
"aria-label": "Go to previous page",
|
|
@@ -29135,8 +29644,8 @@ function PaginationPrevious({
|
|
|
29135
29644
|
className: cn("gap-1 px-2.5 sm:pl-2.5", className),
|
|
29136
29645
|
...props,
|
|
29137
29646
|
children: [
|
|
29138
|
-
/* @__PURE__ */
|
|
29139
|
-
/* @__PURE__ */
|
|
29647
|
+
/* @__PURE__ */ jsx55(ChevronLeft, {}),
|
|
29648
|
+
/* @__PURE__ */ jsx55("span", { className: "hidden sm:block", children: "Previous" })
|
|
29140
29649
|
]
|
|
29141
29650
|
}
|
|
29142
29651
|
);
|
|
@@ -29145,7 +29654,7 @@ function PaginationNext({
|
|
|
29145
29654
|
className,
|
|
29146
29655
|
...props
|
|
29147
29656
|
}) {
|
|
29148
|
-
return /* @__PURE__ */
|
|
29657
|
+
return /* @__PURE__ */ jsxs32(
|
|
29149
29658
|
PaginationLink,
|
|
29150
29659
|
{
|
|
29151
29660
|
"aria-label": "Go to next page",
|
|
@@ -29153,8 +29662,8 @@ function PaginationNext({
|
|
|
29153
29662
|
className: cn("gap-1 px-2.5 sm:pr-2.5", className),
|
|
29154
29663
|
...props,
|
|
29155
29664
|
children: [
|
|
29156
|
-
/* @__PURE__ */
|
|
29157
|
-
/* @__PURE__ */
|
|
29665
|
+
/* @__PURE__ */ jsx55("span", { className: "hidden sm:block", children: "Next" }),
|
|
29666
|
+
/* @__PURE__ */ jsx55(ChevronRight, {})
|
|
29158
29667
|
]
|
|
29159
29668
|
}
|
|
29160
29669
|
);
|
|
@@ -29163,7 +29672,7 @@ function PaginationEllipsis({
|
|
|
29163
29672
|
className,
|
|
29164
29673
|
...props
|
|
29165
29674
|
}) {
|
|
29166
|
-
return /* @__PURE__ */
|
|
29675
|
+
return /* @__PURE__ */ jsxs32(
|
|
29167
29676
|
"span",
|
|
29168
29677
|
{
|
|
29169
29678
|
"aria-hidden": true,
|
|
@@ -29171,15 +29680,15 @@ function PaginationEllipsis({
|
|
|
29171
29680
|
className: cn("flex size-9 items-center justify-center", className),
|
|
29172
29681
|
...props,
|
|
29173
29682
|
children: [
|
|
29174
|
-
/* @__PURE__ */
|
|
29175
|
-
/* @__PURE__ */
|
|
29683
|
+
/* @__PURE__ */ jsx55(Ellipsis, { className: "size-4" }),
|
|
29684
|
+
/* @__PURE__ */ jsx55("span", { className: "sr-only", children: "More pages" })
|
|
29176
29685
|
]
|
|
29177
29686
|
}
|
|
29178
29687
|
);
|
|
29179
29688
|
}
|
|
29180
29689
|
|
|
29181
29690
|
// src/components/DataDisplay/Pagination/Pagination.tsx
|
|
29182
|
-
import { jsx as
|
|
29691
|
+
import { jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
29183
29692
|
var CustomPagination = ({
|
|
29184
29693
|
totalPages,
|
|
29185
29694
|
currentPage,
|
|
@@ -29225,10 +29734,10 @@ var CustomPagination = ({
|
|
|
29225
29734
|
}
|
|
29226
29735
|
};
|
|
29227
29736
|
const pageNumbers = getPageNumbers();
|
|
29228
|
-
return /* @__PURE__ */
|
|
29229
|
-
/* @__PURE__ */
|
|
29230
|
-
/* @__PURE__ */
|
|
29231
|
-
/* @__PURE__ */
|
|
29737
|
+
return /* @__PURE__ */ jsxs33("div", { className: "flex flex-row gap-1 w-full items-center justify-between", children: [
|
|
29738
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
29739
|
+
/* @__PURE__ */ jsx56("p", { className: "text-sm text-muted-foreground whitespace-nowrap", children: "Items per page:" }),
|
|
29740
|
+
/* @__PURE__ */ jsxs33(
|
|
29232
29741
|
Select,
|
|
29233
29742
|
{
|
|
29234
29743
|
defaultValue: String(perPage),
|
|
@@ -29236,26 +29745,26 @@ var CustomPagination = ({
|
|
|
29236
29745
|
onPageChange({ page: 1, itemsPerPage: Number(value) });
|
|
29237
29746
|
},
|
|
29238
29747
|
children: [
|
|
29239
|
-
/* @__PURE__ */
|
|
29240
|
-
/* @__PURE__ */
|
|
29241
|
-
/* @__PURE__ */
|
|
29242
|
-
/* @__PURE__ */
|
|
29243
|
-
/* @__PURE__ */
|
|
29244
|
-
/* @__PURE__ */
|
|
29748
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { className: "w-[100px]", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Select" }) }),
|
|
29749
|
+
/* @__PURE__ */ jsxs33(SelectContent, { children: [
|
|
29750
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "5", children: "5" }),
|
|
29751
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "10", children: "10" }),
|
|
29752
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "20", children: "20" }),
|
|
29753
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "50", children: "50" })
|
|
29245
29754
|
] })
|
|
29246
29755
|
]
|
|
29247
29756
|
}
|
|
29248
29757
|
)
|
|
29249
29758
|
] }),
|
|
29250
|
-
/* @__PURE__ */
|
|
29251
|
-
/* @__PURE__ */
|
|
29759
|
+
/* @__PURE__ */ jsx56(Pagination, { className: "justify-end", children: /* @__PURE__ */ jsxs33(PaginationContent, { children: [
|
|
29760
|
+
/* @__PURE__ */ jsx56(PaginationItem, { children: /* @__PURE__ */ jsx56(
|
|
29252
29761
|
PaginationPrevious,
|
|
29253
29762
|
{
|
|
29254
29763
|
onClick: () => handlePageChange(currentPage - 1),
|
|
29255
29764
|
className: currentPage === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"
|
|
29256
29765
|
}
|
|
29257
29766
|
) }),
|
|
29258
|
-
pageNumbers.map((pageNumber, index) => /* @__PURE__ */
|
|
29767
|
+
pageNumbers.map((pageNumber, index) => /* @__PURE__ */ jsx56(PaginationItem, { children: pageNumber === "..." ? /* @__PURE__ */ jsx56(PaginationEllipsis, {}) : /* @__PURE__ */ jsx56(
|
|
29259
29768
|
PaginationLink,
|
|
29260
29769
|
{
|
|
29261
29770
|
onClick: () => handlePageChange(pageNumber),
|
|
@@ -29264,7 +29773,7 @@ var CustomPagination = ({
|
|
|
29264
29773
|
children: pageNumber
|
|
29265
29774
|
}
|
|
29266
29775
|
) }, index)),
|
|
29267
|
-
/* @__PURE__ */
|
|
29776
|
+
/* @__PURE__ */ jsx56(PaginationItem, { children: /* @__PURE__ */ jsx56(
|
|
29268
29777
|
PaginationNext,
|
|
29269
29778
|
{
|
|
29270
29779
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -29277,11 +29786,11 @@ var CustomPagination = ({
|
|
|
29277
29786
|
var Pagination_default = CustomPagination;
|
|
29278
29787
|
|
|
29279
29788
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
29280
|
-
import { useCallback as
|
|
29789
|
+
import { useCallback as useCallback3, useMemo as useMemo5, useState as useState8 } from "react";
|
|
29281
29790
|
import Link5 from "next/link";
|
|
29282
29791
|
import { useRouter } from "next/navigation";
|
|
29283
|
-
import { Fragment as
|
|
29284
|
-
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder =
|
|
29792
|
+
import { Fragment as Fragment21, jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
29793
|
+
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
|
|
29285
29794
|
function groupMenus(menus = []) {
|
|
29286
29795
|
const menuMap = /* @__PURE__ */ new Map();
|
|
29287
29796
|
menus.forEach((menu) => {
|
|
@@ -29327,9 +29836,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29327
29836
|
return pathname === path || path !== "/" && pathname?.startsWith(path);
|
|
29328
29837
|
};
|
|
29329
29838
|
const router = useRouter();
|
|
29330
|
-
const [showExitDialog, setShowExitDialog] =
|
|
29331
|
-
const [pendingUrl, setPendingUrl] =
|
|
29332
|
-
const handleBuilderExit =
|
|
29839
|
+
const [showExitDialog, setShowExitDialog] = useState8(false);
|
|
29840
|
+
const [pendingUrl, setPendingUrl] = useState8(null);
|
|
29841
|
+
const handleBuilderExit = useCallback3(
|
|
29333
29842
|
(e, url) => {
|
|
29334
29843
|
if (isBuilder) {
|
|
29335
29844
|
e.preventDefault();
|
|
@@ -29348,23 +29857,23 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29348
29857
|
const renderDesktopTab = (tab, index) => {
|
|
29349
29858
|
const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
|
|
29350
29859
|
if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
|
|
29351
|
-
return /* @__PURE__ */
|
|
29352
|
-
/* @__PURE__ */
|
|
29860
|
+
return /* @__PURE__ */ jsxs34(DropdownMenu, { children: [
|
|
29861
|
+
/* @__PURE__ */ jsxs34(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
|
|
29353
29862
|
tab.header,
|
|
29354
|
-
/* @__PURE__ */
|
|
29863
|
+
/* @__PURE__ */ jsx57(ChevronDown, { className: "h-4 w-4 opacity-80" })
|
|
29355
29864
|
] }),
|
|
29356
|
-
/* @__PURE__ */
|
|
29865
|
+
/* @__PURE__ */ jsx57(
|
|
29357
29866
|
DropdownMenuContent,
|
|
29358
29867
|
{
|
|
29359
29868
|
align: "start",
|
|
29360
29869
|
sideOffset: 6,
|
|
29361
29870
|
className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
|
|
29362
|
-
children: tab.children.map((item) => /* @__PURE__ */
|
|
29871
|
+
children: tab.children.map((item, index2) => /* @__PURE__ */ jsx57(
|
|
29363
29872
|
DropdownMenuItem,
|
|
29364
29873
|
{
|
|
29365
29874
|
asChild: true,
|
|
29366
29875
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
|
|
29367
|
-
children: /* @__PURE__ */
|
|
29876
|
+
children: /* @__PURE__ */ jsx57(
|
|
29368
29877
|
Link5,
|
|
29369
29878
|
{
|
|
29370
29879
|
href: item.url || "#",
|
|
@@ -29374,13 +29883,13 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29374
29883
|
}
|
|
29375
29884
|
)
|
|
29376
29885
|
},
|
|
29377
|
-
item.id
|
|
29886
|
+
item.id || index2
|
|
29378
29887
|
))
|
|
29379
29888
|
}
|
|
29380
29889
|
)
|
|
29381
29890
|
] }, index);
|
|
29382
29891
|
}
|
|
29383
|
-
return tab.url ? /* @__PURE__ */
|
|
29892
|
+
return tab.url ? /* @__PURE__ */ jsx57(
|
|
29384
29893
|
Link5,
|
|
29385
29894
|
{
|
|
29386
29895
|
href: tab.url,
|
|
@@ -29391,14 +29900,14 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29391
29900
|
children: tab.header
|
|
29392
29901
|
},
|
|
29393
29902
|
index
|
|
29394
|
-
) : /* @__PURE__ */
|
|
29903
|
+
) : /* @__PURE__ */ jsx57("div", { className: finalClasses, style: tab.style, role: "button", tabIndex: 0, children: tab.header }, index);
|
|
29395
29904
|
};
|
|
29396
|
-
const renderMobileMenu = () => /* @__PURE__ */
|
|
29397
|
-
/* @__PURE__ */
|
|
29398
|
-
/* @__PURE__ */
|
|
29905
|
+
const renderMobileMenu = () => /* @__PURE__ */ jsxs34(DropdownMenu, { children: [
|
|
29906
|
+
/* @__PURE__ */ jsxs34(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
|
|
29907
|
+
/* @__PURE__ */ jsx57(Menu, { className: "h-4 w-4" }),
|
|
29399
29908
|
"Menu"
|
|
29400
29909
|
] }),
|
|
29401
|
-
/* @__PURE__ */
|
|
29910
|
+
/* @__PURE__ */ jsx57(
|
|
29402
29911
|
DropdownMenuContent,
|
|
29403
29912
|
{
|
|
29404
29913
|
align: "start",
|
|
@@ -29407,25 +29916,25 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29407
29916
|
children: rawTabs.map((tab, i) => {
|
|
29408
29917
|
const hasChildren = Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown;
|
|
29409
29918
|
if (hasChildren) {
|
|
29410
|
-
return /* @__PURE__ */
|
|
29411
|
-
/* @__PURE__ */
|
|
29412
|
-
/* @__PURE__ */
|
|
29919
|
+
return /* @__PURE__ */ jsxs34(DropdownMenuSub, { children: [
|
|
29920
|
+
/* @__PURE__ */ jsx57(DropdownMenuSubTrigger, { className: "flex items-center justify-between cursor-pointer rounded-sm px-3 py-2 text-[13px] text-foreground hover:text-foreground", children: tab.header }),
|
|
29921
|
+
/* @__PURE__ */ jsx57(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item, index) => /* @__PURE__ */ jsx57(
|
|
29413
29922
|
DropdownMenuItem,
|
|
29414
29923
|
{
|
|
29415
29924
|
asChild: true,
|
|
29416
29925
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100",
|
|
29417
|
-
children: /* @__PURE__ */
|
|
29926
|
+
children: /* @__PURE__ */ jsx57(Link5, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
|
|
29418
29927
|
},
|
|
29419
|
-
item.id
|
|
29928
|
+
item.id || index
|
|
29420
29929
|
)) })
|
|
29421
29930
|
] }, i);
|
|
29422
29931
|
}
|
|
29423
|
-
return /* @__PURE__ */
|
|
29932
|
+
return /* @__PURE__ */ jsx57(
|
|
29424
29933
|
DropdownMenuItem,
|
|
29425
29934
|
{
|
|
29426
29935
|
asChild: true,
|
|
29427
29936
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[13px] text-gray-800 hover:bg-gray-100",
|
|
29428
|
-
children: /* @__PURE__ */
|
|
29937
|
+
children: /* @__PURE__ */ jsx57(Link5, { href: tab.url || "#", onClick: (e) => handleBuilderExit(e, tab.url || "#"), children: tab.header })
|
|
29429
29938
|
},
|
|
29430
29939
|
i
|
|
29431
29940
|
);
|
|
@@ -29435,19 +29944,19 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29435
29944
|
] });
|
|
29436
29945
|
const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
|
|
29437
29946
|
const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
|
|
29438
|
-
return /* @__PURE__ */
|
|
29439
|
-
/* @__PURE__ */
|
|
29440
|
-
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */
|
|
29441
|
-
forceMobile !== void 0 ? forceMobile && /* @__PURE__ */
|
|
29947
|
+
return /* @__PURE__ */ jsxs34(Fragment21, { children: [
|
|
29948
|
+
/* @__PURE__ */ jsxs34("div", { className, style, children: [
|
|
29949
|
+
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ jsx57("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx57("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ jsx57("div", { className: "hidden md:flex", children: /* @__PURE__ */ jsx57("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
|
|
29950
|
+
forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ jsx57("div", { children: renderMobileMenu() }) : /* @__PURE__ */ jsx57("div", { className: "flex md:hidden", children: renderMobileMenu() })
|
|
29442
29951
|
] }),
|
|
29443
|
-
/* @__PURE__ */
|
|
29444
|
-
/* @__PURE__ */
|
|
29445
|
-
/* @__PURE__ */
|
|
29446
|
-
/* @__PURE__ */
|
|
29952
|
+
/* @__PURE__ */ jsx57(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ jsxs34(DialogContent, { className: "bg-[#fff]", children: [
|
|
29953
|
+
/* @__PURE__ */ jsxs34(DialogHeader, { children: [
|
|
29954
|
+
/* @__PURE__ */ jsx57(DialogTitle, { children: "Exit Builder?" }),
|
|
29955
|
+
/* @__PURE__ */ jsx57(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
29447
29956
|
] }),
|
|
29448
|
-
/* @__PURE__ */
|
|
29449
|
-
/* @__PURE__ */
|
|
29450
|
-
/* @__PURE__ */
|
|
29957
|
+
/* @__PURE__ */ jsxs34(DialogFooter, { children: [
|
|
29958
|
+
/* @__PURE__ */ jsx57(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
29959
|
+
/* @__PURE__ */ jsx57(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
29451
29960
|
] })
|
|
29452
29961
|
] }) })
|
|
29453
29962
|
] });
|
|
@@ -29456,17 +29965,17 @@ var Tabs_default = Tabs;
|
|
|
29456
29965
|
|
|
29457
29966
|
// src/components/Navigation/Stages/Stages.tsx
|
|
29458
29967
|
import React10 from "react";
|
|
29459
|
-
import { jsx as
|
|
29968
|
+
import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
29460
29969
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage }) => {
|
|
29461
|
-
return /* @__PURE__ */
|
|
29462
|
-
/* @__PURE__ */
|
|
29463
|
-
/* @__PURE__ */
|
|
29970
|
+
return /* @__PURE__ */ jsx58("div", { className, style, children: /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between bg-red p-2 rounded-lg border border-gray-200 w-full", children: [
|
|
29971
|
+
/* @__PURE__ */ jsx58("div", { className: "flex items-center", children: /* @__PURE__ */ jsx58("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ jsx58("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx58("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
29972
|
+
/* @__PURE__ */ jsx58("div", { className: "flex items-center flex-1 px-2 flex-wrap gap-2", children: stages?.length > 0 && stages?.map((stage, index) => {
|
|
29464
29973
|
const currentIndex = stages.findIndex((s) => s.key === currentStage);
|
|
29465
29974
|
const isAllCompleted = currentStage === "completed";
|
|
29466
29975
|
const isCompleted = isAllCompleted || index < currentIndex;
|
|
29467
29976
|
const isActive = !isAllCompleted && index === currentIndex;
|
|
29468
|
-
return /* @__PURE__ */
|
|
29469
|
-
/* @__PURE__ */
|
|
29977
|
+
return /* @__PURE__ */ jsxs35(React10.Fragment, { children: [
|
|
29978
|
+
/* @__PURE__ */ jsx58(
|
|
29470
29979
|
"button",
|
|
29471
29980
|
{
|
|
29472
29981
|
className: `
|
|
@@ -29480,10 +29989,10 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
29480
29989
|
children: stage.header
|
|
29481
29990
|
}
|
|
29482
29991
|
),
|
|
29483
|
-
index < stages.length - 1 && /* @__PURE__ */
|
|
29992
|
+
index < stages.length - 1 && /* @__PURE__ */ jsx58("div", { className: "flex-shrink-0 w-3 h-px bg-gray-300" })
|
|
29484
29993
|
] }, stage.id);
|
|
29485
29994
|
}) }),
|
|
29486
|
-
isShowBtn && /* @__PURE__ */
|
|
29995
|
+
isShowBtn && /* @__PURE__ */ jsx58("div", { className: "flex items-center", children: /* @__PURE__ */ jsx58(
|
|
29487
29996
|
"button",
|
|
29488
29997
|
{
|
|
29489
29998
|
className: "bg-[#034486] text-white px-6 py-2 rounded-lg text-sm font-medium transition-colors duration-200 shadow-sm",
|
|
@@ -29501,26 +30010,26 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
29501
30010
|
var Stages_default = StagesComponent;
|
|
29502
30011
|
|
|
29503
30012
|
// src/components/Navigation/Spacer/Spacer.tsx
|
|
29504
|
-
import { jsx as
|
|
30013
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
29505
30014
|
var Spacer = ({ className, style }) => {
|
|
29506
|
-
return /* @__PURE__ */
|
|
30015
|
+
return /* @__PURE__ */ jsx59("div", { className: `${className}`, style });
|
|
29507
30016
|
};
|
|
29508
30017
|
var Spacer_default = Spacer;
|
|
29509
30018
|
|
|
29510
30019
|
// src/components/Navigation/Profile/Profile.tsx
|
|
29511
|
-
import { jsx as
|
|
30020
|
+
import { jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
29512
30021
|
|
|
29513
30022
|
// src/components/Navigation/Notification/Notification.tsx
|
|
29514
|
-
import { jsx as
|
|
30023
|
+
import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
29515
30024
|
|
|
29516
30025
|
// src/components/Navigation/Logo/Logo.tsx
|
|
29517
|
-
import { jsx as
|
|
30026
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
29518
30027
|
|
|
29519
30028
|
// src/components/ui/avatar.tsx
|
|
29520
30029
|
import * as React11 from "react";
|
|
29521
30030
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
29522
|
-
import { jsx as
|
|
29523
|
-
var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
30031
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
30032
|
+
var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
|
|
29524
30033
|
AvatarPrimitive.Root,
|
|
29525
30034
|
{
|
|
29526
30035
|
ref,
|
|
@@ -29532,7 +30041,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
29532
30041
|
}
|
|
29533
30042
|
));
|
|
29534
30043
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
29535
|
-
var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
30044
|
+
var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
|
|
29536
30045
|
AvatarPrimitive.Image,
|
|
29537
30046
|
{
|
|
29538
30047
|
ref,
|
|
@@ -29541,7 +30050,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
29541
30050
|
}
|
|
29542
30051
|
));
|
|
29543
30052
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
29544
|
-
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
30053
|
+
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
|
|
29545
30054
|
AvatarPrimitive.Fallback,
|
|
29546
30055
|
{
|
|
29547
30056
|
ref,
|
|
@@ -29556,11 +30065,11 @@ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
|
29556
30065
|
|
|
29557
30066
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
29558
30067
|
import Link6 from "next/link";
|
|
29559
|
-
import
|
|
30068
|
+
import Image4 from "next/image";
|
|
29560
30069
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
29561
30070
|
import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
|
|
29562
|
-
import { useCallback as
|
|
29563
|
-
import { Fragment as
|
|
30071
|
+
import { useCallback as useCallback4, useMemo as useMemo6, useState as useState9 } from "react";
|
|
30072
|
+
import { Fragment as Fragment22, jsx as jsx64, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
29564
30073
|
function Navbar({
|
|
29565
30074
|
style,
|
|
29566
30075
|
badgeType,
|
|
@@ -29580,9 +30089,9 @@ function Navbar({
|
|
|
29580
30089
|
}) {
|
|
29581
30090
|
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
29582
30091
|
const router = useRouter2();
|
|
29583
|
-
const [showExitDialog, setShowExitDialog] =
|
|
29584
|
-
const [pendingUrl, setPendingUrl] =
|
|
29585
|
-
const handleBuilderExit =
|
|
30092
|
+
const [showExitDialog, setShowExitDialog] = useState9(false);
|
|
30093
|
+
const [pendingUrl, setPendingUrl] = useState9(null);
|
|
30094
|
+
const handleBuilderExit = useCallback4(
|
|
29586
30095
|
(e, url) => {
|
|
29587
30096
|
if (isBuilder) {
|
|
29588
30097
|
e.preventDefault();
|
|
@@ -29604,23 +30113,23 @@ function Navbar({
|
|
|
29604
30113
|
}
|
|
29605
30114
|
return list || [];
|
|
29606
30115
|
}, [source, navList]);
|
|
29607
|
-
return /* @__PURE__ */
|
|
29608
|
-
/* @__PURE__ */
|
|
30116
|
+
return /* @__PURE__ */ jsxs38(Fragment22, { children: [
|
|
30117
|
+
/* @__PURE__ */ jsx64(
|
|
29609
30118
|
"nav",
|
|
29610
30119
|
{
|
|
29611
30120
|
className: "w-full border-b border-b-white dark:border-b-gray-800 dark:bg-gray-800 bg-white shadow-sm",
|
|
29612
30121
|
style,
|
|
29613
|
-
children: /* @__PURE__ */
|
|
29614
|
-
/* @__PURE__ */
|
|
30122
|
+
children: /* @__PURE__ */ jsxs38("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
|
|
30123
|
+
/* @__PURE__ */ jsx64(
|
|
29615
30124
|
Link6,
|
|
29616
30125
|
{
|
|
29617
30126
|
href: "/",
|
|
29618
30127
|
onClick: (e) => handleBuilderExit(e, "/"),
|
|
29619
30128
|
className: "flex items-center space-x-2",
|
|
29620
|
-
children: imageUrl ? /* @__PURE__ */
|
|
30129
|
+
children: imageUrl ? /* @__PURE__ */ jsx64(Image4, { src: imageUrl, alt: altText, width: 200, height: 200 }) : /* @__PURE__ */ jsx64("span", { className: "font-semibold text-blue-700", children: "Logo" })
|
|
29621
30130
|
}
|
|
29622
30131
|
),
|
|
29623
|
-
!isMobileView && /* @__PURE__ */
|
|
30132
|
+
!isMobileView && /* @__PURE__ */ jsx64("div", { className: "flex items-center space-x-6 sm:hidden md:flex", children: formatedMenu.map((item) => /* @__PURE__ */ jsx64(
|
|
29624
30133
|
Link6,
|
|
29625
30134
|
{
|
|
29626
30135
|
href: item.url || "#",
|
|
@@ -29630,39 +30139,39 @@ function Navbar({
|
|
|
29630
30139
|
},
|
|
29631
30140
|
item.id
|
|
29632
30141
|
)) }),
|
|
29633
|
-
/* @__PURE__ */
|
|
29634
|
-
!isMobileView ? /* @__PURE__ */
|
|
29635
|
-
/* @__PURE__ */
|
|
29636
|
-
/* @__PURE__ */
|
|
29637
|
-
] }) }) : /* @__PURE__ */
|
|
29638
|
-
/* @__PURE__ */
|
|
29639
|
-
/* @__PURE__ */
|
|
29640
|
-
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */
|
|
30142
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center space-x-3", children: [
|
|
30143
|
+
!isMobileView ? /* @__PURE__ */ jsx64("div", { className: "flex-1 px-6", children: /* @__PURE__ */ jsxs38("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
|
|
30144
|
+
/* @__PURE__ */ jsx64(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
|
|
30145
|
+
/* @__PURE__ */ jsx64(Input, { placeholder: "Search", className: "pl-9 text-gray-400" })
|
|
30146
|
+
] }) }) : /* @__PURE__ */ jsx64(Button, { variant: "ghost", size: "icon", className: "border border-gray-400", children: /* @__PURE__ */ jsx64(Search, { className: "h-5 w-5 text-gray-400" }) }),
|
|
30147
|
+
/* @__PURE__ */ jsxs38("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
|
|
30148
|
+
/* @__PURE__ */ jsx64(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx64(Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
|
|
30149
|
+
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ jsx64("span", { className: "absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-[10px] text-white leading-8", children: badgeCount }) : /* @__PURE__ */ jsx64("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
|
|
29641
30150
|
] }),
|
|
29642
|
-
/* @__PURE__ */
|
|
29643
|
-
/* @__PURE__ */
|
|
29644
|
-
!isMobileView && showName && /* @__PURE__ */
|
|
29645
|
-
!isMobileView ? /* @__PURE__ */
|
|
29646
|
-
/* @__PURE__ */
|
|
30151
|
+
/* @__PURE__ */ jsxs38(DropdownMenu, { children: [
|
|
30152
|
+
/* @__PURE__ */ jsx64(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center space-x-2", children: [
|
|
30153
|
+
!isMobileView && showName && /* @__PURE__ */ jsx64("h4", { className: "text-[#000000] dark:text-gray-300 text-[13px] font-[500] mb-0", children: userName }),
|
|
30154
|
+
!isMobileView ? /* @__PURE__ */ jsxs38(Fragment22, { children: [
|
|
30155
|
+
/* @__PURE__ */ jsx64(Avatar, { className: "cursor-pointer h-8 w-8 text-gray-900", children: profileType === "avatar" ? /* @__PURE__ */ jsx64(
|
|
29647
30156
|
AvatarImage,
|
|
29648
30157
|
{
|
|
29649
30158
|
src: "/images/appbuilder/toolset/profile.svg",
|
|
29650
30159
|
alt: "Profile"
|
|
29651
30160
|
}
|
|
29652
|
-
) : /* @__PURE__ */
|
|
29653
|
-
/* @__PURE__ */
|
|
30161
|
+
) : /* @__PURE__ */ jsx64("div", { className: "w-8 h-8 bg-[#12715b] rounded-full text-[#fff] text-center text-[11px] flex items-center justify-center", children: userName && getInitials(userName) }) }),
|
|
30162
|
+
/* @__PURE__ */ jsx64(
|
|
29654
30163
|
Button,
|
|
29655
30164
|
{
|
|
29656
30165
|
variant: "ghost",
|
|
29657
30166
|
size: "icon",
|
|
29658
30167
|
className: "text-gray-900 md:hidden dark:invert",
|
|
29659
|
-
children: /* @__PURE__ */
|
|
30168
|
+
children: /* @__PURE__ */ jsx64(Menu, { className: "h-6 w-6" })
|
|
29660
30169
|
}
|
|
29661
30170
|
)
|
|
29662
|
-
] }) : /* @__PURE__ */
|
|
30171
|
+
] }) : /* @__PURE__ */ jsx64(Button, { variant: "ghost", size: "icon", className: "text-gray-900 dark:invert", children: /* @__PURE__ */ jsx64(Menu, { className: "h-6 w-6" }) })
|
|
29663
30172
|
] }) }),
|
|
29664
|
-
/* @__PURE__ */
|
|
29665
|
-
profileMenu && profileMenu.length > 0 && /* @__PURE__ */
|
|
30173
|
+
/* @__PURE__ */ jsxs38(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
|
|
30174
|
+
profileMenu && profileMenu.length > 0 && /* @__PURE__ */ jsx64(Fragment22, { children: profileMenu.map((item) => /* @__PURE__ */ jsx64(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx64(
|
|
29666
30175
|
Link6,
|
|
29667
30176
|
{
|
|
29668
30177
|
href: item.url || "#",
|
|
@@ -29670,9 +30179,9 @@ function Navbar({
|
|
|
29670
30179
|
children: item.header
|
|
29671
30180
|
}
|
|
29672
30181
|
) }, item.id)) }),
|
|
29673
|
-
/* @__PURE__ */
|
|
29674
|
-
/* @__PURE__ */
|
|
29675
|
-
formatedMenu && formatedMenu.length > 0 && /* @__PURE__ */
|
|
30182
|
+
/* @__PURE__ */ jsxs38("div", { className: "md:hidden", children: [
|
|
30183
|
+
/* @__PURE__ */ jsx64(DropdownMenuSeparator, {}),
|
|
30184
|
+
formatedMenu && formatedMenu.length > 0 && /* @__PURE__ */ jsx64(Fragment22, { children: formatedMenu.map((item) => /* @__PURE__ */ jsx64(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx64(
|
|
29676
30185
|
Link6,
|
|
29677
30186
|
{
|
|
29678
30187
|
href: item.url || "#",
|
|
@@ -29687,14 +30196,14 @@ function Navbar({
|
|
|
29687
30196
|
] })
|
|
29688
30197
|
}
|
|
29689
30198
|
),
|
|
29690
|
-
/* @__PURE__ */
|
|
29691
|
-
/* @__PURE__ */
|
|
29692
|
-
/* @__PURE__ */
|
|
29693
|
-
/* @__PURE__ */
|
|
30199
|
+
/* @__PURE__ */ jsx64(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ jsxs38(DialogContent, { className: "bg-[#fff]", children: [
|
|
30200
|
+
/* @__PURE__ */ jsxs38(DialogHeader, { children: [
|
|
30201
|
+
/* @__PURE__ */ jsx64(DialogTitle, { children: "Exit Builder?" }),
|
|
30202
|
+
/* @__PURE__ */ jsx64(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
29694
30203
|
] }),
|
|
29695
|
-
/* @__PURE__ */
|
|
29696
|
-
/* @__PURE__ */
|
|
29697
|
-
/* @__PURE__ */
|
|
30204
|
+
/* @__PURE__ */ jsxs38(DialogFooter, { children: [
|
|
30205
|
+
/* @__PURE__ */ jsx64(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
30206
|
+
/* @__PURE__ */ jsx64(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
29698
30207
|
] })
|
|
29699
30208
|
] }) })
|
|
29700
30209
|
] });
|
|
@@ -29714,35 +30223,35 @@ import {
|
|
|
29714
30223
|
ResponsiveContainer,
|
|
29715
30224
|
Legend
|
|
29716
30225
|
} from "recharts";
|
|
29717
|
-
import { jsx as
|
|
30226
|
+
import { jsx as jsx65, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
29718
30227
|
var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
29719
30228
|
const data = Array.isArray(props.data) ? props.data : [];
|
|
29720
30229
|
const chartType = props.chartType || "bar";
|
|
29721
30230
|
const legendsPosition = props.legendsPosition === "middle" || props.legendsPosition === "bottom" ? props.legendsPosition : "top";
|
|
29722
30231
|
if (loading || data.length === 0) {
|
|
29723
|
-
return /* @__PURE__ */
|
|
30232
|
+
return /* @__PURE__ */ jsx65(
|
|
29724
30233
|
"div",
|
|
29725
30234
|
{
|
|
29726
30235
|
className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
|
|
29727
30236
|
style,
|
|
29728
|
-
children: /* @__PURE__ */
|
|
30237
|
+
children: /* @__PURE__ */ jsx65("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
|
|
29729
30238
|
}
|
|
29730
30239
|
);
|
|
29731
30240
|
}
|
|
29732
|
-
return /* @__PURE__ */
|
|
29733
|
-
/* @__PURE__ */
|
|
29734
|
-
/* @__PURE__ */
|
|
29735
|
-
/* @__PURE__ */
|
|
29736
|
-
/* @__PURE__ */
|
|
29737
|
-
/* @__PURE__ */
|
|
29738
|
-
/* @__PURE__ */
|
|
30241
|
+
return /* @__PURE__ */ jsx65("div", { className: `${className} h-[400px]`, style, children: /* @__PURE__ */ jsx65(ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ jsxs39(BarChart, { data, title: "Leads", desc: "content", children: [
|
|
30242
|
+
/* @__PURE__ */ jsx65(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
30243
|
+
/* @__PURE__ */ jsx65(XAxis, { dataKey: "name" }),
|
|
30244
|
+
/* @__PURE__ */ jsx65(YAxis, {}),
|
|
30245
|
+
/* @__PURE__ */ jsx65(Tooltip, { formatter: (value) => `${value}k` }),
|
|
30246
|
+
/* @__PURE__ */ jsx65(Legend, { verticalAlign: legendsPosition, align: "center" }),
|
|
30247
|
+
/* @__PURE__ */ jsx65(
|
|
29739
30248
|
Bar,
|
|
29740
30249
|
{
|
|
29741
30250
|
dataKey: "value",
|
|
29742
30251
|
fill: "#00695C",
|
|
29743
30252
|
radius: [6, 6, 0, 0],
|
|
29744
30253
|
isAnimationActive: false,
|
|
29745
|
-
children: data.map((entry, index) => /* @__PURE__ */
|
|
30254
|
+
children: data.map((entry, index) => /* @__PURE__ */ jsx65(
|
|
29746
30255
|
"rect",
|
|
29747
30256
|
{
|
|
29748
30257
|
fill: entry.color || "#00695C"
|
|
@@ -29751,16 +30260,16 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
29751
30260
|
))
|
|
29752
30261
|
}
|
|
29753
30262
|
)
|
|
29754
|
-
] }) : /* @__PURE__ */
|
|
29755
|
-
/* @__PURE__ */
|
|
29756
|
-
/* @__PURE__ */
|
|
29757
|
-
/* @__PURE__ */
|
|
30263
|
+
] }) : /* @__PURE__ */ jsxs39(AreaChart, { data, children: [
|
|
30264
|
+
/* @__PURE__ */ jsx65("defs", { children: /* @__PURE__ */ jsxs39("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
30265
|
+
/* @__PURE__ */ jsx65("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
|
|
30266
|
+
/* @__PURE__ */ jsx65("stop", { offset: "95%", stopColor: "#00695C", stopOpacity: 0 })
|
|
29758
30267
|
] }) }),
|
|
29759
|
-
/* @__PURE__ */
|
|
29760
|
-
/* @__PURE__ */
|
|
29761
|
-
/* @__PURE__ */
|
|
29762
|
-
/* @__PURE__ */
|
|
29763
|
-
/* @__PURE__ */
|
|
30268
|
+
/* @__PURE__ */ jsx65(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
30269
|
+
/* @__PURE__ */ jsx65(XAxis, { dataKey: "name" }),
|
|
30270
|
+
/* @__PURE__ */ jsx65(YAxis, {}),
|
|
30271
|
+
/* @__PURE__ */ jsx65(Tooltip, { formatter: (value) => `${value}k` }),
|
|
30272
|
+
/* @__PURE__ */ jsx65(
|
|
29764
30273
|
Area,
|
|
29765
30274
|
{
|
|
29766
30275
|
type: "monotone",
|
|
@@ -29776,7 +30285,7 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
29776
30285
|
var BarChart_default = React12.memo(ChartComponent);
|
|
29777
30286
|
|
|
29778
30287
|
// src/components/Chart/PieChart.tsx
|
|
29779
|
-
import React13, { useEffect as
|
|
30288
|
+
import React13, { useEffect as useEffect25, useMemo as useMemo7, useState as useState10 } from "react";
|
|
29780
30289
|
import {
|
|
29781
30290
|
PieChart,
|
|
29782
30291
|
Pie,
|
|
@@ -29785,7 +30294,7 @@ import {
|
|
|
29785
30294
|
Tooltip as Tooltip2,
|
|
29786
30295
|
LabelList
|
|
29787
30296
|
} from "recharts";
|
|
29788
|
-
import { Fragment as
|
|
30297
|
+
import { Fragment as Fragment23, jsx as jsx66, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
29789
30298
|
var getRandomColor = () => {
|
|
29790
30299
|
const palette = [
|
|
29791
30300
|
"#2563eb",
|
|
@@ -29811,26 +30320,26 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29811
30320
|
}, [props.data]);
|
|
29812
30321
|
const total = useMemo7(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
|
|
29813
30322
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
29814
|
-
const [mounted, setMounted] =
|
|
29815
|
-
|
|
30323
|
+
const [mounted, setMounted] = useState10(false);
|
|
30324
|
+
useEffect25(() => {
|
|
29816
30325
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
29817
30326
|
return () => clearTimeout(timeout);
|
|
29818
30327
|
}, []);
|
|
29819
30328
|
const renderLegends = useMemo7(() => {
|
|
29820
30329
|
if (!showLegends) return null;
|
|
29821
|
-
return /* @__PURE__ */
|
|
30330
|
+
return /* @__PURE__ */ jsx66(Fragment23, { children: data.map((d) => /* @__PURE__ */ jsxs40(
|
|
29822
30331
|
"div",
|
|
29823
30332
|
{
|
|
29824
30333
|
className: "flex items-center space-x-2 rounded-md border border-gray-200 px-3 py-2 w-[48%] md:w-auto",
|
|
29825
30334
|
children: [
|
|
29826
|
-
/* @__PURE__ */
|
|
30335
|
+
/* @__PURE__ */ jsx66(
|
|
29827
30336
|
"span",
|
|
29828
30337
|
{
|
|
29829
30338
|
className: "inline-block w-[16px] h-[16px] rounded",
|
|
29830
30339
|
style: { backgroundColor: d.color }
|
|
29831
30340
|
}
|
|
29832
30341
|
),
|
|
29833
|
-
/* @__PURE__ */
|
|
30342
|
+
/* @__PURE__ */ jsx66("span", { className: "text-[#000000] text-[12px] md:text-[13px] font-[500]", children: d.name })
|
|
29834
30343
|
]
|
|
29835
30344
|
},
|
|
29836
30345
|
d.name
|
|
@@ -29838,24 +30347,24 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29838
30347
|
}, [data, showLegends]);
|
|
29839
30348
|
if (!mounted) return null;
|
|
29840
30349
|
if (loading || data.length === 0) {
|
|
29841
|
-
return /* @__PURE__ */
|
|
30350
|
+
return /* @__PURE__ */ jsx66(
|
|
29842
30351
|
"div",
|
|
29843
30352
|
{
|
|
29844
30353
|
className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
|
|
29845
30354
|
style,
|
|
29846
|
-
children: /* @__PURE__ */
|
|
30355
|
+
children: /* @__PURE__ */ jsx66("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
|
|
29847
30356
|
}
|
|
29848
30357
|
);
|
|
29849
30358
|
}
|
|
29850
|
-
return /* @__PURE__ */
|
|
30359
|
+
return /* @__PURE__ */ jsxs40(
|
|
29851
30360
|
"div",
|
|
29852
30361
|
{
|
|
29853
30362
|
className: `relative flex flex-col items-center ${className}`,
|
|
29854
30363
|
style,
|
|
29855
30364
|
children: [
|
|
29856
|
-
/* @__PURE__ */
|
|
29857
|
-
/* @__PURE__ */
|
|
29858
|
-
/* @__PURE__ */
|
|
30365
|
+
/* @__PURE__ */ jsxs40("div", { className: "relative w-full md:w-[70%] h-[300px] md:h-[400px] flex items-center justify-center", children: [
|
|
30366
|
+
/* @__PURE__ */ jsx66(ResponsiveContainer2, { width: "99%", height: "100%", children: /* @__PURE__ */ jsxs40(PieChart, { children: [
|
|
30367
|
+
/* @__PURE__ */ jsxs40(
|
|
29859
30368
|
Pie,
|
|
29860
30369
|
{
|
|
29861
30370
|
data,
|
|
@@ -29867,8 +30376,8 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29867
30376
|
labelLine: false,
|
|
29868
30377
|
isAnimationActive: false,
|
|
29869
30378
|
children: [
|
|
29870
|
-
data.map((entry, index) => /* @__PURE__ */
|
|
29871
|
-
/* @__PURE__ */
|
|
30379
|
+
data.map((entry, index) => /* @__PURE__ */ jsx66(Cell, { fill: entry.color }, `cell-${index}`)),
|
|
30380
|
+
/* @__PURE__ */ jsx66(
|
|
29872
30381
|
LabelList,
|
|
29873
30382
|
{
|
|
29874
30383
|
dataKey: "value",
|
|
@@ -29881,14 +30390,14 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29881
30390
|
]
|
|
29882
30391
|
}
|
|
29883
30392
|
),
|
|
29884
|
-
/* @__PURE__ */
|
|
30393
|
+
/* @__PURE__ */ jsx66(
|
|
29885
30394
|
Tooltip2,
|
|
29886
30395
|
{
|
|
29887
30396
|
formatter: (value, name) => [`${value}k`, name]
|
|
29888
30397
|
}
|
|
29889
30398
|
)
|
|
29890
30399
|
] }) }),
|
|
29891
|
-
/* @__PURE__ */
|
|
30400
|
+
/* @__PURE__ */ jsxs40(
|
|
29892
30401
|
"div",
|
|
29893
30402
|
{
|
|
29894
30403
|
className: `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 ${forceMobile ? "text-2xl" : "text-4xl"} font-bold text-[#000]`,
|
|
@@ -29899,7 +30408,7 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29899
30408
|
}
|
|
29900
30409
|
)
|
|
29901
30410
|
] }),
|
|
29902
|
-
/* @__PURE__ */
|
|
30411
|
+
/* @__PURE__ */ jsx66("div", { className: "flex flex-wrap justify-center gap-2 mt-6 w-full md:w-auto", children: renderLegends })
|
|
29903
30412
|
]
|
|
29904
30413
|
}
|
|
29905
30414
|
);
|
|
@@ -29907,10 +30416,10 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29907
30416
|
var PieChart_default = React13.memo(DonutChart);
|
|
29908
30417
|
|
|
29909
30418
|
// src/components/Blocks/EmailComposer.tsx
|
|
29910
|
-
import { jsx as
|
|
30419
|
+
import { jsx as jsx67, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
29911
30420
|
function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }) {
|
|
29912
|
-
return /* @__PURE__ */
|
|
29913
|
-
/* @__PURE__ */
|
|
30421
|
+
return /* @__PURE__ */ jsx67("div", { className, style, children: /* @__PURE__ */ jsxs41("div", { className: "border rounded-md shadow bg-[#fff] p-4 mx-auto z-[50] relative", children: [
|
|
30422
|
+
/* @__PURE__ */ jsx67("div", { className: "mb-3", children: /* @__PURE__ */ jsx67(
|
|
29914
30423
|
"input",
|
|
29915
30424
|
{
|
|
29916
30425
|
type: "email",
|
|
@@ -29919,8 +30428,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29919
30428
|
required: true
|
|
29920
30429
|
}
|
|
29921
30430
|
) }),
|
|
29922
|
-
/* @__PURE__ */
|
|
29923
|
-
/* @__PURE__ */
|
|
30431
|
+
/* @__PURE__ */ jsx67("div", { className: "mb-3", children: /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
|
|
30432
|
+
/* @__PURE__ */ jsx67(
|
|
29924
30433
|
"input",
|
|
29925
30434
|
{
|
|
29926
30435
|
type: "email",
|
|
@@ -29931,7 +30440,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29931
30440
|
required: true
|
|
29932
30441
|
}
|
|
29933
30442
|
),
|
|
29934
|
-
!showCc && /* @__PURE__ */
|
|
30443
|
+
!showCc && /* @__PURE__ */ jsx67(
|
|
29935
30444
|
"button",
|
|
29936
30445
|
{
|
|
29937
30446
|
onClick: () => setShowCc?.(true),
|
|
@@ -29939,7 +30448,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29939
30448
|
children: "Cc"
|
|
29940
30449
|
}
|
|
29941
30450
|
),
|
|
29942
|
-
!showBcc && /* @__PURE__ */
|
|
30451
|
+
!showBcc && /* @__PURE__ */ jsx67(
|
|
29943
30452
|
"button",
|
|
29944
30453
|
{
|
|
29945
30454
|
onClick: () => setShowBcc?.(true),
|
|
@@ -29948,7 +30457,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29948
30457
|
}
|
|
29949
30458
|
)
|
|
29950
30459
|
] }) }),
|
|
29951
|
-
showCc && /* @__PURE__ */
|
|
30460
|
+
showCc && /* @__PURE__ */ jsx67("div", { className: "mb-3", children: /* @__PURE__ */ jsx67(
|
|
29952
30461
|
"input",
|
|
29953
30462
|
{
|
|
29954
30463
|
type: "text",
|
|
@@ -29958,7 +30467,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29958
30467
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
29959
30468
|
}
|
|
29960
30469
|
) }),
|
|
29961
|
-
showBcc && /* @__PURE__ */
|
|
30470
|
+
showBcc && /* @__PURE__ */ jsx67("div", { className: "mb-3", children: /* @__PURE__ */ jsx67(
|
|
29962
30471
|
"input",
|
|
29963
30472
|
{
|
|
29964
30473
|
type: "text",
|
|
@@ -29968,7 +30477,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29968
30477
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
29969
30478
|
}
|
|
29970
30479
|
) }),
|
|
29971
|
-
/* @__PURE__ */
|
|
30480
|
+
/* @__PURE__ */ jsx67("div", { className: "mb-3", children: /* @__PURE__ */ jsx67(
|
|
29972
30481
|
"input",
|
|
29973
30482
|
{
|
|
29974
30483
|
type: "text",
|
|
@@ -29978,11 +30487,11 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29978
30487
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
29979
30488
|
}
|
|
29980
30489
|
) }),
|
|
29981
|
-
/* @__PURE__ */
|
|
29982
|
-
/* @__PURE__ */
|
|
29983
|
-
/* @__PURE__ */
|
|
29984
|
-
/* @__PURE__ */
|
|
29985
|
-
/* @__PURE__ */
|
|
30490
|
+
/* @__PURE__ */ jsx67("div", { className: "mb-4", children: /* @__PURE__ */ jsx67(MyEditor, { value: body, onChange: setBody }) }),
|
|
30491
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex justify-end gap-2", children: [
|
|
30492
|
+
/* @__PURE__ */ jsx67("button", { className: "px-4 py-2 rounded-md text-gray-600 hover:bg-gray-100", children: "Discard" }),
|
|
30493
|
+
/* @__PURE__ */ jsx67("button", { className: "px-4 py-2 rounded-md border text-[#12715B] border-[#12715B]", children: "Reset" }),
|
|
30494
|
+
/* @__PURE__ */ jsx67("button", { className: "px-4 py-2 rounded-md bg-[#12715B] text-white", children: "Send" })
|
|
29986
30495
|
] })
|
|
29987
30496
|
] }) });
|
|
29988
30497
|
}
|
|
@@ -30027,10 +30536,10 @@ function showSonnerToast({
|
|
|
30027
30536
|
// src/components/ui/sonner.tsx
|
|
30028
30537
|
import { useTheme } from "next-themes";
|
|
30029
30538
|
import { Toaster as Sonner } from "sonner";
|
|
30030
|
-
import { jsx as
|
|
30539
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
30031
30540
|
var Toaster = ({ ...props }) => {
|
|
30032
30541
|
const { theme = "system" } = useTheme();
|
|
30033
|
-
return /* @__PURE__ */
|
|
30542
|
+
return /* @__PURE__ */ jsx68(
|
|
30034
30543
|
Sonner,
|
|
30035
30544
|
{
|
|
30036
30545
|
theme,
|