@algorithm-shift/design-system 1.2.79 → 1.2.81
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 +910 -373
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +893 -356
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -330,7 +330,7 @@ function Repeater({
|
|
|
330
330
|
[items, count]
|
|
331
331
|
);
|
|
332
332
|
if (!list.length) {
|
|
333
|
-
return emptyFallback ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: emptyFallback }) :
|
|
333
|
+
return emptyFallback ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: emptyFallback }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, children: "No items to display." });
|
|
334
334
|
}
|
|
335
335
|
const content = list.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react4.default.Fragment, { children: render(item, i, list) }, i));
|
|
336
336
|
return wrapper ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: wrapper(content) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, children: content });
|
|
@@ -27602,7 +27602,7 @@ function RichText({ className, style, ...props }) {
|
|
|
27602
27602
|
}
|
|
27603
27603
|
|
|
27604
27604
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
27605
|
-
var
|
|
27605
|
+
var import_react21 = require("react");
|
|
27606
27606
|
|
|
27607
27607
|
// src/components/ui/select.tsx
|
|
27608
27608
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
@@ -27730,15 +27730,272 @@ function SelectScrollDownButton({
|
|
|
27730
27730
|
);
|
|
27731
27731
|
}
|
|
27732
27732
|
|
|
27733
|
-
// src/components/Inputs/Dropdown/
|
|
27733
|
+
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
27734
|
+
var import_react20 = require("react");
|
|
27735
|
+
|
|
27736
|
+
// src/components/Wrappers/Portal.tsx
|
|
27737
|
+
var import_react_dom = __toESM(require("react-dom"));
|
|
27738
|
+
var Portal3 = ({ children, container }) => {
|
|
27739
|
+
const target = container || document.body;
|
|
27740
|
+
return import_react_dom.default.createPortal(children, target);
|
|
27741
|
+
};
|
|
27742
|
+
var Portal_default = Portal3;
|
|
27743
|
+
|
|
27744
|
+
// src/hooks/useLazyDropdown.ts
|
|
27745
|
+
var import_react19 = require("react");
|
|
27746
|
+
var import_axios = __toESM(require("axios"));
|
|
27747
|
+
function useLazyDropdown(config) {
|
|
27748
|
+
const [options, setOptions] = (0, import_react19.useState)([]);
|
|
27749
|
+
const [page, setPage] = (0, import_react19.useState)(1);
|
|
27750
|
+
const [hasMore, setHasMore] = (0, import_react19.useState)(true);
|
|
27751
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
27752
|
+
const [searchTerm, setSearchTerm] = (0, import_react19.useState)("");
|
|
27753
|
+
const debounceTimer = (0, import_react19.useRef)(null);
|
|
27754
|
+
const allDataRef = (0, import_react19.useRef)([]);
|
|
27755
|
+
const configRef = (0, import_react19.useRef)(config);
|
|
27756
|
+
const PAGE_SIZE = config.pageSize || 10;
|
|
27757
|
+
(0, import_react19.useEffect)(() => {
|
|
27758
|
+
configRef.current = config;
|
|
27759
|
+
}, [config]);
|
|
27760
|
+
const transformToOptions = (0, import_react19.useCallback)((data) => {
|
|
27761
|
+
if (!data || !Array.isArray(data)) return [];
|
|
27762
|
+
const cfg = configRef.current;
|
|
27763
|
+
return data.map((item) => ({
|
|
27764
|
+
value: item[cfg.dataKey] ?? item.id ?? "",
|
|
27765
|
+
label: item[cfg.dataLabel] ?? item.name ?? item.label ?? ""
|
|
27766
|
+
}));
|
|
27767
|
+
}, []);
|
|
27768
|
+
const fetchApiData = (0, import_react19.useCallback)(async (pageNum, term) => {
|
|
27769
|
+
if (!configRef.current.apiUrl) return [];
|
|
27770
|
+
const limit = PAGE_SIZE;
|
|
27771
|
+
const params = { page: pageNum, limit };
|
|
27772
|
+
if (term) params[configRef.current.dataLabel ?? "search"] = term;
|
|
27773
|
+
const res = await import_axios.default.get(configRef.current.apiUrl, {
|
|
27774
|
+
params,
|
|
27775
|
+
withCredentials: true
|
|
27776
|
+
});
|
|
27777
|
+
if (res.data?.success && Array.isArray(res.data.data)) {
|
|
27778
|
+
const data = res.data.data;
|
|
27779
|
+
return transformToOptions(data);
|
|
27780
|
+
}
|
|
27781
|
+
return [];
|
|
27782
|
+
}, [PAGE_SIZE, transformToOptions]);
|
|
27783
|
+
const loadPage = (0, import_react19.useCallback)(async (pageNum, term) => {
|
|
27784
|
+
const cfg = configRef.current;
|
|
27785
|
+
if (!cfg.enabled) return;
|
|
27786
|
+
setLoading(true);
|
|
27787
|
+
try {
|
|
27788
|
+
let pageOptions = [];
|
|
27789
|
+
if (cfg.dataSource === "api") {
|
|
27790
|
+
pageOptions = await fetchApiData(pageNum, term);
|
|
27791
|
+
setHasMore(pageOptions.length === PAGE_SIZE);
|
|
27792
|
+
} else {
|
|
27793
|
+
const allData = allDataRef.current || [];
|
|
27794
|
+
let filtered = allData;
|
|
27795
|
+
if (term) {
|
|
27796
|
+
const termLower = term.toLowerCase();
|
|
27797
|
+
filtered = allData.filter((item) => {
|
|
27798
|
+
const label = String(item[cfg.dataLabel] ?? item.name ?? item.label ?? "").toLowerCase();
|
|
27799
|
+
const value = String(item[cfg.dataKey] ?? item.id ?? "").toLowerCase();
|
|
27800
|
+
return label.includes(termLower) || value.includes(termLower);
|
|
27801
|
+
});
|
|
27802
|
+
}
|
|
27803
|
+
const start = (pageNum - 1) * PAGE_SIZE;
|
|
27804
|
+
const end = start + PAGE_SIZE;
|
|
27805
|
+
pageOptions = transformToOptions(filtered.slice(start, end));
|
|
27806
|
+
setHasMore(end < filtered.length);
|
|
27807
|
+
}
|
|
27808
|
+
setOptions((prev) => pageNum === 1 ? pageOptions : [...prev, ...pageOptions]);
|
|
27809
|
+
setPage(pageNum);
|
|
27810
|
+
} catch (err) {
|
|
27811
|
+
console.error("\u274C useLazyDropdown loadPage error:", err);
|
|
27812
|
+
setHasMore(false);
|
|
27813
|
+
} finally {
|
|
27814
|
+
setLoading(false);
|
|
27815
|
+
}
|
|
27816
|
+
}, [fetchApiData, transformToOptions]);
|
|
27817
|
+
const loadMore = (0, import_react19.useCallback)(() => {
|
|
27818
|
+
if (!loading && hasMore) {
|
|
27819
|
+
loadPage(page + 1, searchTerm);
|
|
27820
|
+
}
|
|
27821
|
+
}, [loading, hasMore, page, searchTerm, loadPage]);
|
|
27822
|
+
const search = (0, import_react19.useCallback)((term) => {
|
|
27823
|
+
setSearchTerm(term);
|
|
27824
|
+
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
27825
|
+
debounceTimer.current = setTimeout(() => {
|
|
27826
|
+
loadPage(1, term);
|
|
27827
|
+
}, 300);
|
|
27828
|
+
}, [loadPage]);
|
|
27829
|
+
const reset = (0, import_react19.useCallback)(() => {
|
|
27830
|
+
setSearchTerm("");
|
|
27831
|
+
setPage(1);
|
|
27832
|
+
loadPage(1, "");
|
|
27833
|
+
}, [loadPage]);
|
|
27834
|
+
(0, import_react19.useEffect)(() => {
|
|
27835
|
+
if (config.initialData?.length) {
|
|
27836
|
+
allDataRef.current = config.initialData;
|
|
27837
|
+
loadPage(1, "");
|
|
27838
|
+
}
|
|
27839
|
+
}, [config.initialData, loadPage]);
|
|
27840
|
+
(0, import_react19.useEffect)(() => {
|
|
27841
|
+
return () => {
|
|
27842
|
+
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
27843
|
+
};
|
|
27844
|
+
}, []);
|
|
27845
|
+
return {
|
|
27846
|
+
options,
|
|
27847
|
+
loading,
|
|
27848
|
+
hasMore,
|
|
27849
|
+
loadMore,
|
|
27850
|
+
search,
|
|
27851
|
+
reset,
|
|
27852
|
+
loadPage
|
|
27853
|
+
};
|
|
27854
|
+
}
|
|
27855
|
+
|
|
27856
|
+
// src/components/Inputs/Dropdown/LazyDropdown.tsx
|
|
27734
27857
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
27858
|
+
function LazySelectDropdown({
|
|
27859
|
+
options = [],
|
|
27860
|
+
value,
|
|
27861
|
+
onChange,
|
|
27862
|
+
placeholder,
|
|
27863
|
+
className,
|
|
27864
|
+
id,
|
|
27865
|
+
disabled,
|
|
27866
|
+
readOnly,
|
|
27867
|
+
source,
|
|
27868
|
+
apiUrl,
|
|
27869
|
+
pageSize,
|
|
27870
|
+
dataKey = "id",
|
|
27871
|
+
dataLabel = "name",
|
|
27872
|
+
errorMessage
|
|
27873
|
+
}) {
|
|
27874
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
27875
|
+
const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
|
|
27876
|
+
const dropdownRef = (0, import_react20.useRef)(null);
|
|
27877
|
+
const observerTarget = (0, import_react20.useRef)(null);
|
|
27878
|
+
const {
|
|
27879
|
+
options: lazyOptions,
|
|
27880
|
+
loading,
|
|
27881
|
+
hasMore,
|
|
27882
|
+
loadMore,
|
|
27883
|
+
search,
|
|
27884
|
+
reset,
|
|
27885
|
+
loadPage
|
|
27886
|
+
} = useLazyDropdown({
|
|
27887
|
+
enabled: true,
|
|
27888
|
+
dataSource: source || "",
|
|
27889
|
+
apiUrl,
|
|
27890
|
+
pageSize: pageSize || 10,
|
|
27891
|
+
dataKey,
|
|
27892
|
+
dataLabel,
|
|
27893
|
+
initialData: options || []
|
|
27894
|
+
});
|
|
27895
|
+
const selectedOption = lazyOptions.find((opt) => opt.value === value);
|
|
27896
|
+
(0, import_react20.useEffect)(() => {
|
|
27897
|
+
const handleClickOutside = (e) => {
|
|
27898
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
27899
|
+
setIsOpen(false);
|
|
27900
|
+
setSearchTerm("");
|
|
27901
|
+
}
|
|
27902
|
+
};
|
|
27903
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
27904
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
27905
|
+
}, []);
|
|
27906
|
+
(0, import_react20.useEffect)(() => {
|
|
27907
|
+
if (!isOpen || !hasMore || loading) return;
|
|
27908
|
+
const observer = new IntersectionObserver(
|
|
27909
|
+
(entries) => {
|
|
27910
|
+
if (entries[0].isIntersecting) loadMore();
|
|
27911
|
+
},
|
|
27912
|
+
{ threshold: 0.1 }
|
|
27913
|
+
);
|
|
27914
|
+
if (observerTarget.current) observer.observe(observerTarget.current);
|
|
27915
|
+
return () => observer.disconnect();
|
|
27916
|
+
}, [isOpen, hasMore, loading, loadMore]);
|
|
27917
|
+
const handleSearchChange = (e) => {
|
|
27918
|
+
const term = e.target.value;
|
|
27919
|
+
setSearchTerm(term);
|
|
27920
|
+
search(term);
|
|
27921
|
+
};
|
|
27922
|
+
const handleSelect = (optValue) => {
|
|
27923
|
+
onChange?.(optValue);
|
|
27924
|
+
setIsOpen(false);
|
|
27925
|
+
setSearchTerm("");
|
|
27926
|
+
reset();
|
|
27927
|
+
};
|
|
27928
|
+
const handleFocus = () => {
|
|
27929
|
+
if (!disabled) setIsOpen(true);
|
|
27930
|
+
loadPage(1, "");
|
|
27931
|
+
};
|
|
27932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { ref: dropdownRef, className: "relative w-full", children: [
|
|
27933
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
27934
|
+
"input",
|
|
27935
|
+
{
|
|
27936
|
+
type: "text",
|
|
27937
|
+
id,
|
|
27938
|
+
name: id,
|
|
27939
|
+
className: cn(
|
|
27940
|
+
"w-full px-3 py-2 border border-[#BDBDBD] rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
27941
|
+
disabled ? "bg-gray-100 cursor-not-allowed" : "bg-white cursor-pointer",
|
|
27942
|
+
className,
|
|
27943
|
+
errorMessage ? "border-red-500" : ""
|
|
27944
|
+
),
|
|
27945
|
+
placeholder: selectedOption?.label || placeholder,
|
|
27946
|
+
value: isOpen ? searchTerm : selectedOption?.label || "",
|
|
27947
|
+
onFocus: handleFocus,
|
|
27948
|
+
onChange: handleSearchChange,
|
|
27949
|
+
readOnly: !isOpen || readOnly,
|
|
27950
|
+
disabled
|
|
27951
|
+
}
|
|
27952
|
+
),
|
|
27953
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "mt-1 text-xs text-red-500", children: errorMessage }),
|
|
27954
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Portal_default, { container: dropdownRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
27955
|
+
"div",
|
|
27956
|
+
{
|
|
27957
|
+
className: "fixed z-[9999] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
|
|
27958
|
+
style: { width: dropdownRef.current?.offsetWidth },
|
|
27959
|
+
children: loading && lazyOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "px-3 py-4 text-center text-gray-500 flex items-center justify-center gap-2 text-sm", children: [
|
|
27960
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "animate-spin w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
27961
|
+
"Loading..."
|
|
27962
|
+
] }) : lazyOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
27963
|
+
lazyOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
27964
|
+
"div",
|
|
27965
|
+
{
|
|
27966
|
+
onClick: () => handleSelect(option.value),
|
|
27967
|
+
className: `px-3 py-2 hover:bg-blue-50 cursor-pointer text-sm ${option.value === value ? "bg-blue-100" : ""}`,
|
|
27968
|
+
children: option.label
|
|
27969
|
+
},
|
|
27970
|
+
`${option.value}-${index}`
|
|
27971
|
+
)),
|
|
27972
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
27973
|
+
"div",
|
|
27974
|
+
{
|
|
27975
|
+
ref: observerTarget,
|
|
27976
|
+
className: "px-3 py-2 text-center text-gray-400 text-sm border-t",
|
|
27977
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-center gap-2 text-sm", children: [
|
|
27978
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "animate-spin w-3 h-3 border-2 border-gray-300 border-t-blue-500 rounded-full" }),
|
|
27979
|
+
"Loading more..."
|
|
27980
|
+
] }) : "Scroll for more..."
|
|
27981
|
+
}
|
|
27982
|
+
)
|
|
27983
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "px-3 py-4 text-sm text-center text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
27984
|
+
}
|
|
27985
|
+
) })
|
|
27986
|
+
] });
|
|
27987
|
+
}
|
|
27988
|
+
var LazyDropdown_default = LazySelectDropdown;
|
|
27989
|
+
|
|
27990
|
+
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
27991
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
27735
27992
|
var Dropdown = ({ className, style, ...props }) => {
|
|
27736
27993
|
const list = Array.isArray(props?.data) ? props.data : [];
|
|
27737
|
-
const placeholder = props.placeholder ? props.placeholder : "
|
|
27994
|
+
const placeholder = props.placeholder ? props.placeholder : "Select an option";
|
|
27738
27995
|
const isEditable = props.isEditable ?? true;
|
|
27739
27996
|
const isDisabled = props.isDisabled ?? false;
|
|
27740
27997
|
const isReadonly = props.isReadonly ?? false;
|
|
27741
|
-
(0,
|
|
27998
|
+
(0, import_react21.useEffect)(() => {
|
|
27742
27999
|
if (props.value !== void 0) {
|
|
27743
28000
|
handleChange(props.value);
|
|
27744
28001
|
}
|
|
@@ -27752,9 +28009,25 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
27752
28009
|
value: item[dataKey],
|
|
27753
28010
|
label: item[dataLabel]
|
|
27754
28011
|
}));
|
|
27755
|
-
|
|
27756
|
-
/* @__PURE__ */ (0,
|
|
27757
|
-
|
|
28012
|
+
if (props.lazyLoad) {
|
|
28013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
28014
|
+
LazyDropdown_default,
|
|
28015
|
+
{
|
|
28016
|
+
...props,
|
|
28017
|
+
id: props.name || "lazy-select-field",
|
|
28018
|
+
options: list,
|
|
28019
|
+
onChange: handleChange,
|
|
28020
|
+
placeholder,
|
|
28021
|
+
className,
|
|
28022
|
+
style,
|
|
28023
|
+
disabled: isDisabled || !isEditable,
|
|
28024
|
+
readOnly: isReadonly
|
|
28025
|
+
}
|
|
28026
|
+
);
|
|
28027
|
+
}
|
|
28028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
28029
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Select, { name: props.name, value: props.value || "", onValueChange: handleChange, disabled: isDisabled || !isEditable, children: [
|
|
28030
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
27758
28031
|
SelectTrigger,
|
|
27759
28032
|
{
|
|
27760
28033
|
id: props.name || "select-field",
|
|
@@ -27764,31 +28037,31 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
27764
28037
|
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
27765
28038
|
},
|
|
27766
28039
|
"aria-readonly": isReadonly,
|
|
27767
|
-
children: /* @__PURE__ */ (0,
|
|
28040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SelectValue, { placeholder })
|
|
27768
28041
|
}
|
|
27769
28042
|
),
|
|
27770
|
-
/* @__PURE__ */ (0,
|
|
27771
|
-
props.dataLoading && /* @__PURE__ */ (0,
|
|
27772
|
-
!props.dataLoading && options.length === 0 && /* @__PURE__ */ (0,
|
|
27773
|
-
options.map((opt) => /* @__PURE__ */ (0,
|
|
28043
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(SelectContent, { children: [
|
|
28044
|
+
props.dataLoading && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SelectItem, { value: "none", disabled: true, children: "Loading..." }),
|
|
28045
|
+
!props.dataLoading && options.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SelectItem, { value: "none", disabled: true, children: "No options" }),
|
|
28046
|
+
options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SelectItem, { value: opt.value, children: opt.label }, opt.value))
|
|
27774
28047
|
] })
|
|
27775
28048
|
] }),
|
|
27776
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28049
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27777
28050
|
] });
|
|
27778
28051
|
};
|
|
27779
28052
|
var Dropdown_default = Dropdown;
|
|
27780
28053
|
|
|
27781
28054
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
27782
|
-
var
|
|
28055
|
+
var import_react22 = require("react");
|
|
27783
28056
|
|
|
27784
28057
|
// src/components/ui/switch.tsx
|
|
27785
28058
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
27786
|
-
var
|
|
28059
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
27787
28060
|
function Switch({
|
|
27788
28061
|
className,
|
|
27789
28062
|
...props
|
|
27790
28063
|
}) {
|
|
27791
|
-
return /* @__PURE__ */ (0,
|
|
28064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
27792
28065
|
SwitchPrimitive.Root,
|
|
27793
28066
|
{
|
|
27794
28067
|
"data-slot": "switch",
|
|
@@ -27797,7 +28070,7 @@ function Switch({
|
|
|
27797
28070
|
className
|
|
27798
28071
|
),
|
|
27799
28072
|
...props,
|
|
27800
|
-
children: /* @__PURE__ */ (0,
|
|
28073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
27801
28074
|
SwitchPrimitive.Thumb,
|
|
27802
28075
|
{
|
|
27803
28076
|
"data-slot": "switch-thumb",
|
|
@@ -27811,11 +28084,11 @@ function Switch({
|
|
|
27811
28084
|
}
|
|
27812
28085
|
|
|
27813
28086
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
27814
|
-
var
|
|
28087
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
27815
28088
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
27816
28089
|
const isEditable = props.isEditable ?? true;
|
|
27817
28090
|
const isDisabled = props.isDisabled ?? false;
|
|
27818
|
-
(0,
|
|
28091
|
+
(0, import_react22.useEffect)(() => {
|
|
27819
28092
|
if (props.value !== void 0) {
|
|
27820
28093
|
handleChange?.(props.value);
|
|
27821
28094
|
}
|
|
@@ -27823,9 +28096,9 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
27823
28096
|
const handleChange = (value) => {
|
|
27824
28097
|
props.onChange?.(value);
|
|
27825
28098
|
};
|
|
27826
|
-
return /* @__PURE__ */ (0,
|
|
27827
|
-
/* @__PURE__ */ (0,
|
|
27828
|
-
/* @__PURE__ */ (0,
|
|
28099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
28100
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center space-x-2 mb-2", children: [
|
|
28101
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
27829
28102
|
Switch,
|
|
27830
28103
|
{
|
|
27831
28104
|
id: props.name || "switch",
|
|
@@ -27834,23 +28107,23 @@ var SwitchToggle = ({ className, style, ...props }) => {
|
|
|
27834
28107
|
disabled: isDisabled || !isEditable
|
|
27835
28108
|
}
|
|
27836
28109
|
),
|
|
27837
|
-
/* @__PURE__ */ (0,
|
|
28110
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Label2, { htmlFor: props.name || "switch", children: props.text })
|
|
27838
28111
|
] }) }),
|
|
27839
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28112
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27840
28113
|
] });
|
|
27841
28114
|
};
|
|
27842
28115
|
var SwitchToggle_default = SwitchToggle;
|
|
27843
28116
|
|
|
27844
28117
|
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
27845
|
-
var
|
|
28118
|
+
var import_react23 = require("react");
|
|
27846
28119
|
var import_react_international_phone = require("react-international-phone");
|
|
27847
28120
|
var import_style = require("react-international-phone/style.css");
|
|
27848
|
-
var
|
|
28121
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
27849
28122
|
var PhoneInput = ({ className, style, ...props }) => {
|
|
27850
28123
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
27851
28124
|
const isEditable = props.isEditable ?? true;
|
|
27852
28125
|
const isDisabled = props.isDisabled ?? false;
|
|
27853
|
-
(0,
|
|
28126
|
+
(0, import_react23.useEffect)(() => {
|
|
27854
28127
|
if (props.value !== void 0) {
|
|
27855
28128
|
handleChange?.(props.value);
|
|
27856
28129
|
}
|
|
@@ -27858,8 +28131,8 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
27858
28131
|
const handleChange = (val) => {
|
|
27859
28132
|
props.onChange?.(val);
|
|
27860
28133
|
};
|
|
27861
|
-
return /* @__PURE__ */ (0,
|
|
27862
|
-
/* @__PURE__ */ (0,
|
|
28134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
28135
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
27863
28136
|
import_react_international_phone.PhoneInput,
|
|
27864
28137
|
{
|
|
27865
28138
|
defaultCountry: "in",
|
|
@@ -27883,21 +28156,21 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
27883
28156
|
disabled: isDisabled || !isEditable
|
|
27884
28157
|
}
|
|
27885
28158
|
),
|
|
27886
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28159
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27887
28160
|
] });
|
|
27888
28161
|
};
|
|
27889
28162
|
var PhoneInput_default = PhoneInput;
|
|
27890
28163
|
|
|
27891
28164
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
27892
|
-
var
|
|
27893
|
-
var
|
|
28165
|
+
var import_react24 = require("react");
|
|
28166
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
27894
28167
|
var SearchInput = ({ className, style, ...props }) => {
|
|
27895
28168
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
27896
28169
|
const isEditable = props.isEditable ?? true;
|
|
27897
28170
|
const isDisabled = props.isDisabled ?? false;
|
|
27898
28171
|
const isReadonly = props.isReadonly ?? false;
|
|
27899
28172
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
27900
|
-
(0,
|
|
28173
|
+
(0, import_react24.useEffect)(() => {
|
|
27901
28174
|
if (props.value !== void 0) {
|
|
27902
28175
|
const e = { target: { value: props.value } };
|
|
27903
28176
|
handleChange?.(e);
|
|
@@ -27906,8 +28179,8 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
27906
28179
|
const handleChange = (e) => {
|
|
27907
28180
|
props.onChange?.(e);
|
|
27908
28181
|
};
|
|
27909
|
-
return /* @__PURE__ */ (0,
|
|
27910
|
-
/* @__PURE__ */ (0,
|
|
28182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
28183
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
27911
28184
|
Input,
|
|
27912
28185
|
{
|
|
27913
28186
|
type: "text",
|
|
@@ -27926,17 +28199,17 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
27926
28199
|
readOnly: isReadonly
|
|
27927
28200
|
}
|
|
27928
28201
|
) }),
|
|
27929
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28202
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27930
28203
|
] });
|
|
27931
28204
|
};
|
|
27932
28205
|
var SearchInput_default = SearchInput;
|
|
27933
28206
|
|
|
27934
28207
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
27935
|
-
var
|
|
27936
|
-
var
|
|
28208
|
+
var import_react25 = require("react");
|
|
28209
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
27937
28210
|
var FileInput2 = ({ className, style, ...props }) => {
|
|
27938
28211
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
27939
|
-
(0,
|
|
28212
|
+
(0, import_react25.useEffect)(() => {
|
|
27940
28213
|
if (props.value !== void 0) {
|
|
27941
28214
|
const e = { target: { value: props.value } };
|
|
27942
28215
|
handleChange?.(e);
|
|
@@ -27945,8 +28218,8 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
27945
28218
|
const handleChange = (e) => {
|
|
27946
28219
|
props.onChange?.(e);
|
|
27947
28220
|
};
|
|
27948
|
-
return /* @__PURE__ */ (0,
|
|
27949
|
-
/* @__PURE__ */ (0,
|
|
28221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "d-flex items-center relative align-middle", children: [
|
|
28222
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
27950
28223
|
Input,
|
|
27951
28224
|
{
|
|
27952
28225
|
type: "file",
|
|
@@ -27963,14 +28236,14 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
27963
28236
|
onChange: handleChange
|
|
27964
28237
|
}
|
|
27965
28238
|
),
|
|
27966
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28239
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
27967
28240
|
] });
|
|
27968
28241
|
};
|
|
27969
28242
|
var FileInput_default = FileInput2;
|
|
27970
28243
|
|
|
27971
28244
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
27972
|
-
var
|
|
27973
|
-
var
|
|
28245
|
+
var import_react26 = require("react");
|
|
28246
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
27974
28247
|
function DatePicker({ className, style, ...props }) {
|
|
27975
28248
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
27976
28249
|
const minimumDate = props.minimumDate ?? "none";
|
|
@@ -27995,7 +28268,7 @@ function DatePicker({ className, style, ...props }) {
|
|
|
27995
28268
|
};
|
|
27996
28269
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
27997
28270
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
27998
|
-
(0,
|
|
28271
|
+
(0, import_react26.useEffect)(() => {
|
|
27999
28272
|
if (props.value !== void 0) {
|
|
28000
28273
|
handleChange(props.value);
|
|
28001
28274
|
}
|
|
@@ -28007,8 +28280,8 @@ function DatePicker({ className, style, ...props }) {
|
|
|
28007
28280
|
if (!value) return "";
|
|
28008
28281
|
return new Date(value).toISOString().split("T")[0];
|
|
28009
28282
|
};
|
|
28010
|
-
return /* @__PURE__ */ (0,
|
|
28011
|
-
/* @__PURE__ */ (0,
|
|
28283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
28284
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
28012
28285
|
Input,
|
|
28013
28286
|
{
|
|
28014
28287
|
type: "date",
|
|
@@ -28033,18 +28306,18 @@ function DatePicker({ className, style, ...props }) {
|
|
|
28033
28306
|
max: maxDate
|
|
28034
28307
|
}
|
|
28035
28308
|
) }),
|
|
28036
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28309
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28037
28310
|
] });
|
|
28038
28311
|
}
|
|
28039
28312
|
|
|
28040
28313
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28041
|
-
var
|
|
28314
|
+
var import_react27 = __toESM(require("react"));
|
|
28042
28315
|
var import_date_fns = require("date-fns");
|
|
28043
28316
|
|
|
28044
28317
|
// src/components/ui/calendar.tsx
|
|
28045
28318
|
var React6 = __toESM(require("react"));
|
|
28046
28319
|
var import_react_day_picker = require("react-day-picker");
|
|
28047
|
-
var
|
|
28320
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
28048
28321
|
function Calendar2({
|
|
28049
28322
|
className,
|
|
28050
28323
|
classNames,
|
|
@@ -28056,7 +28329,7 @@ function Calendar2({
|
|
|
28056
28329
|
...props
|
|
28057
28330
|
}) {
|
|
28058
28331
|
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
28059
|
-
return /* @__PURE__ */ (0,
|
|
28332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
28060
28333
|
import_react_day_picker.DayPicker,
|
|
28061
28334
|
{
|
|
28062
28335
|
showOutsideDays,
|
|
@@ -28155,7 +28428,7 @@ function Calendar2({
|
|
|
28155
28428
|
},
|
|
28156
28429
|
components: {
|
|
28157
28430
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
28158
|
-
return /* @__PURE__ */ (0,
|
|
28431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
28159
28432
|
"div",
|
|
28160
28433
|
{
|
|
28161
28434
|
"data-slot": "calendar",
|
|
@@ -28167,10 +28440,10 @@ function Calendar2({
|
|
|
28167
28440
|
},
|
|
28168
28441
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
28169
28442
|
if (orientation === "left") {
|
|
28170
|
-
return /* @__PURE__ */ (0,
|
|
28443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronLeft, { className: cn("size-4", className2), ...props2 });
|
|
28171
28444
|
}
|
|
28172
28445
|
if (orientation === "right") {
|
|
28173
|
-
return /* @__PURE__ */ (0,
|
|
28446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
28174
28447
|
ChevronRight,
|
|
28175
28448
|
{
|
|
28176
28449
|
className: cn("size-4", className2),
|
|
@@ -28178,11 +28451,11 @@ function Calendar2({
|
|
|
28178
28451
|
}
|
|
28179
28452
|
);
|
|
28180
28453
|
}
|
|
28181
|
-
return /* @__PURE__ */ (0,
|
|
28454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { className: cn("size-4", className2), ...props2 });
|
|
28182
28455
|
},
|
|
28183
28456
|
DayButton: CalendarDayButton,
|
|
28184
28457
|
WeekNumber: ({ children, ...props2 }) => {
|
|
28185
|
-
return /* @__PURE__ */ (0,
|
|
28458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { ...props2, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
28186
28459
|
},
|
|
28187
28460
|
...components
|
|
28188
28461
|
},
|
|
@@ -28201,7 +28474,7 @@ function CalendarDayButton({
|
|
|
28201
28474
|
React6.useEffect(() => {
|
|
28202
28475
|
if (modifiers.focused) ref.current?.focus();
|
|
28203
28476
|
}, [modifiers.focused]);
|
|
28204
|
-
return /* @__PURE__ */ (0,
|
|
28477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
28205
28478
|
Button,
|
|
28206
28479
|
{
|
|
28207
28480
|
ref,
|
|
@@ -28224,16 +28497,16 @@ function CalendarDayButton({
|
|
|
28224
28497
|
|
|
28225
28498
|
// src/components/ui/popover.tsx
|
|
28226
28499
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
28227
|
-
var
|
|
28500
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
28228
28501
|
function Popover({
|
|
28229
28502
|
...props
|
|
28230
28503
|
}) {
|
|
28231
|
-
return /* @__PURE__ */ (0,
|
|
28504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
28232
28505
|
}
|
|
28233
28506
|
function PopoverTrigger({
|
|
28234
28507
|
...props
|
|
28235
28508
|
}) {
|
|
28236
|
-
return /* @__PURE__ */ (0,
|
|
28509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
28237
28510
|
}
|
|
28238
28511
|
function PopoverContent({
|
|
28239
28512
|
className,
|
|
@@ -28241,7 +28514,7 @@ function PopoverContent({
|
|
|
28241
28514
|
sideOffset = 4,
|
|
28242
28515
|
...props
|
|
28243
28516
|
}) {
|
|
28244
|
-
return /* @__PURE__ */ (0,
|
|
28517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
28245
28518
|
PopoverPrimitive.Content,
|
|
28246
28519
|
{
|
|
28247
28520
|
"data-slot": "popover-content",
|
|
@@ -28257,16 +28530,16 @@ function PopoverContent({
|
|
|
28257
28530
|
}
|
|
28258
28531
|
|
|
28259
28532
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28260
|
-
var
|
|
28533
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
28261
28534
|
var DateRange = ({ className, style, ...props }) => {
|
|
28262
28535
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
28263
|
-
const [date, setDate] =
|
|
28536
|
+
const [date, setDate] = import_react27.default.useState(
|
|
28264
28537
|
isDateRange(props.value) ? props.value : {
|
|
28265
28538
|
from: /* @__PURE__ */ new Date(),
|
|
28266
28539
|
to: (0, import_date_fns.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
28267
28540
|
}
|
|
28268
28541
|
);
|
|
28269
|
-
(0,
|
|
28542
|
+
(0, import_react27.useEffect)(() => {
|
|
28270
28543
|
if (props.value && isDateRange(props.value)) {
|
|
28271
28544
|
handleChange?.(props.value);
|
|
28272
28545
|
}
|
|
@@ -28277,9 +28550,9 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28277
28550
|
props.onChange?.(value);
|
|
28278
28551
|
}
|
|
28279
28552
|
};
|
|
28280
|
-
return /* @__PURE__ */ (0,
|
|
28281
|
-
/* @__PURE__ */ (0,
|
|
28282
|
-
/* @__PURE__ */ (0,
|
|
28553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
28554
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Popover, { children: [
|
|
28555
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
28283
28556
|
Button,
|
|
28284
28557
|
{
|
|
28285
28558
|
id: "date",
|
|
@@ -28288,15 +28561,15 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28288
28561
|
"w-full justify-start text-left font-normal text-[11px] border-[#BDBDBD]",
|
|
28289
28562
|
!date && "text-muted-foreground"
|
|
28290
28563
|
),
|
|
28291
|
-
children: date?.from ? date.to ? /* @__PURE__ */ (0,
|
|
28564
|
+
children: date?.from ? date.to ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
28292
28565
|
(0, import_date_fns.format)(date.from, "LLL dd, y"),
|
|
28293
28566
|
" -",
|
|
28294
28567
|
" ",
|
|
28295
28568
|
(0, import_date_fns.format)(date.to, "LLL dd, y")
|
|
28296
|
-
] }) : (0, import_date_fns.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0,
|
|
28569
|
+
] }) : (0, import_date_fns.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Pick a date range" })
|
|
28297
28570
|
}
|
|
28298
28571
|
) }),
|
|
28299
|
-
/* @__PURE__ */ (0,
|
|
28572
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
28300
28573
|
Calendar2,
|
|
28301
28574
|
{
|
|
28302
28575
|
mode: "range",
|
|
@@ -28307,21 +28580,21 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28307
28580
|
}
|
|
28308
28581
|
) })
|
|
28309
28582
|
] }) }),
|
|
28310
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28583
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28311
28584
|
] });
|
|
28312
28585
|
};
|
|
28313
28586
|
var DateRange_default = DateRange;
|
|
28314
28587
|
|
|
28315
28588
|
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
28316
|
-
var
|
|
28317
|
-
var
|
|
28589
|
+
var import_react28 = require("react");
|
|
28590
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
28318
28591
|
var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
28319
28592
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
28320
28593
|
const isEditable = props.isEditable ?? true;
|
|
28321
28594
|
const isDisabled = props.isDisabled ?? false;
|
|
28322
28595
|
const isReadonly = props.isReadonly ?? false;
|
|
28323
28596
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28324
|
-
(0,
|
|
28597
|
+
(0, import_react28.useEffect)(() => {
|
|
28325
28598
|
if (props.value !== void 0) {
|
|
28326
28599
|
const e = { target: { value: props.value } };
|
|
28327
28600
|
handleChange?.(e);
|
|
@@ -28330,8 +28603,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28330
28603
|
const handleChange = (e) => {
|
|
28331
28604
|
props.onChange?.(e);
|
|
28332
28605
|
};
|
|
28333
|
-
return /* @__PURE__ */ (0,
|
|
28334
|
-
/* @__PURE__ */ (0,
|
|
28606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
28607
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
28335
28608
|
"div",
|
|
28336
28609
|
{
|
|
28337
28610
|
className: cn(
|
|
@@ -28341,8 +28614,8 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28341
28614
|
props.errorMessage ? "border-red-500" : ""
|
|
28342
28615
|
),
|
|
28343
28616
|
children: [
|
|
28344
|
-
prepend && /* @__PURE__ */ (0,
|
|
28345
|
-
/* @__PURE__ */ (0,
|
|
28617
|
+
prepend && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-l-md", children: prepend }),
|
|
28618
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28346
28619
|
Input,
|
|
28347
28620
|
{
|
|
28348
28621
|
id: props.name || "prepend-input",
|
|
@@ -28364,11 +28637,11 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28364
28637
|
readOnly: isReadonly
|
|
28365
28638
|
}
|
|
28366
28639
|
),
|
|
28367
|
-
append && /* @__PURE__ */ (0,
|
|
28640
|
+
append && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "px-3 flex items-center bg-gray-500 text-white h-10 rounded-r-md", children: append })
|
|
28368
28641
|
]
|
|
28369
28642
|
}
|
|
28370
28643
|
),
|
|
28371
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28644
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28372
28645
|
] });
|
|
28373
28646
|
};
|
|
28374
28647
|
var TextInputGroup_default = TextInputGroup;
|
|
@@ -28381,22 +28654,22 @@ var import_cmdk = require("cmdk");
|
|
|
28381
28654
|
|
|
28382
28655
|
// src/components/ui/dialog.tsx
|
|
28383
28656
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
28384
|
-
var
|
|
28657
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
28385
28658
|
function Dialog({
|
|
28386
28659
|
...props
|
|
28387
28660
|
}) {
|
|
28388
|
-
return /* @__PURE__ */ (0,
|
|
28661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
28389
28662
|
}
|
|
28390
28663
|
function DialogPortal({
|
|
28391
28664
|
...props
|
|
28392
28665
|
}) {
|
|
28393
|
-
return /* @__PURE__ */ (0,
|
|
28666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
28394
28667
|
}
|
|
28395
28668
|
function DialogOverlay({
|
|
28396
28669
|
className,
|
|
28397
28670
|
...props
|
|
28398
28671
|
}) {
|
|
28399
|
-
return /* @__PURE__ */ (0,
|
|
28672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
28400
28673
|
DialogPrimitive.Overlay,
|
|
28401
28674
|
{
|
|
28402
28675
|
"data-slot": "dialog-overlay",
|
|
@@ -28414,9 +28687,9 @@ function DialogContent({
|
|
|
28414
28687
|
showCloseButton = true,
|
|
28415
28688
|
...props
|
|
28416
28689
|
}) {
|
|
28417
|
-
return /* @__PURE__ */ (0,
|
|
28418
|
-
/* @__PURE__ */ (0,
|
|
28419
|
-
/* @__PURE__ */ (0,
|
|
28690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
28691
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DialogOverlay, {}),
|
|
28692
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
28420
28693
|
DialogPrimitive.Content,
|
|
28421
28694
|
{
|
|
28422
28695
|
"data-slot": "dialog-content",
|
|
@@ -28427,14 +28700,14 @@ function DialogContent({
|
|
|
28427
28700
|
...props,
|
|
28428
28701
|
children: [
|
|
28429
28702
|
children,
|
|
28430
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
28703
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
28431
28704
|
DialogPrimitive.Close,
|
|
28432
28705
|
{
|
|
28433
28706
|
"data-slot": "dialog-close",
|
|
28434
28707
|
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",
|
|
28435
28708
|
children: [
|
|
28436
|
-
/* @__PURE__ */ (0,
|
|
28437
|
-
/* @__PURE__ */ (0,
|
|
28709
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(X, {}),
|
|
28710
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "sr-only", children: "Close" })
|
|
28438
28711
|
]
|
|
28439
28712
|
}
|
|
28440
28713
|
)
|
|
@@ -28444,7 +28717,7 @@ function DialogContent({
|
|
|
28444
28717
|
] });
|
|
28445
28718
|
}
|
|
28446
28719
|
function DialogHeader({ className, ...props }) {
|
|
28447
|
-
return /* @__PURE__ */ (0,
|
|
28720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
28448
28721
|
"div",
|
|
28449
28722
|
{
|
|
28450
28723
|
"data-slot": "dialog-header",
|
|
@@ -28454,7 +28727,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
28454
28727
|
);
|
|
28455
28728
|
}
|
|
28456
28729
|
function DialogFooter({ className, ...props }) {
|
|
28457
|
-
return /* @__PURE__ */ (0,
|
|
28730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
28458
28731
|
"div",
|
|
28459
28732
|
{
|
|
28460
28733
|
"data-slot": "dialog-footer",
|
|
@@ -28470,7 +28743,7 @@ function DialogTitle({
|
|
|
28470
28743
|
className,
|
|
28471
28744
|
...props
|
|
28472
28745
|
}) {
|
|
28473
|
-
return /* @__PURE__ */ (0,
|
|
28746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
28474
28747
|
DialogPrimitive.Title,
|
|
28475
28748
|
{
|
|
28476
28749
|
"data-slot": "dialog-title",
|
|
@@ -28483,7 +28756,7 @@ function DialogDescription({
|
|
|
28483
28756
|
className,
|
|
28484
28757
|
...props
|
|
28485
28758
|
}) {
|
|
28486
|
-
return /* @__PURE__ */ (0,
|
|
28759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
28487
28760
|
DialogPrimitive.Description,
|
|
28488
28761
|
{
|
|
28489
28762
|
"data-slot": "dialog-description",
|
|
@@ -28494,12 +28767,12 @@ function DialogDescription({
|
|
|
28494
28767
|
}
|
|
28495
28768
|
|
|
28496
28769
|
// src/components/ui/command.tsx
|
|
28497
|
-
var
|
|
28770
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
28498
28771
|
function Command2({
|
|
28499
28772
|
className,
|
|
28500
28773
|
...props
|
|
28501
28774
|
}) {
|
|
28502
|
-
return /* @__PURE__ */ (0,
|
|
28775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28503
28776
|
import_cmdk.Command,
|
|
28504
28777
|
{
|
|
28505
28778
|
"data-slot": "command",
|
|
@@ -28515,14 +28788,14 @@ function CommandInput({
|
|
|
28515
28788
|
className,
|
|
28516
28789
|
...props
|
|
28517
28790
|
}) {
|
|
28518
|
-
return /* @__PURE__ */ (0,
|
|
28791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
28519
28792
|
"div",
|
|
28520
28793
|
{
|
|
28521
28794
|
"data-slot": "command-input-wrapper",
|
|
28522
28795
|
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
28523
28796
|
children: [
|
|
28524
|
-
/* @__PURE__ */ (0,
|
|
28525
|
-
/* @__PURE__ */ (0,
|
|
28797
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Search, { className: "size-4 shrink-0 opacity-50" }),
|
|
28798
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28526
28799
|
import_cmdk.Command.Input,
|
|
28527
28800
|
{
|
|
28528
28801
|
"data-slot": "command-input",
|
|
@@ -28541,7 +28814,7 @@ function CommandList({
|
|
|
28541
28814
|
className,
|
|
28542
28815
|
...props
|
|
28543
28816
|
}) {
|
|
28544
|
-
return /* @__PURE__ */ (0,
|
|
28817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28545
28818
|
import_cmdk.Command.List,
|
|
28546
28819
|
{
|
|
28547
28820
|
"data-slot": "command-list",
|
|
@@ -28556,7 +28829,7 @@ function CommandList({
|
|
|
28556
28829
|
function CommandEmpty({
|
|
28557
28830
|
...props
|
|
28558
28831
|
}) {
|
|
28559
|
-
return /* @__PURE__ */ (0,
|
|
28832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28560
28833
|
import_cmdk.Command.Empty,
|
|
28561
28834
|
{
|
|
28562
28835
|
"data-slot": "command-empty",
|
|
@@ -28569,7 +28842,7 @@ function CommandGroup({
|
|
|
28569
28842
|
className,
|
|
28570
28843
|
...props
|
|
28571
28844
|
}) {
|
|
28572
|
-
return /* @__PURE__ */ (0,
|
|
28845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28573
28846
|
import_cmdk.Command.Group,
|
|
28574
28847
|
{
|
|
28575
28848
|
"data-slot": "command-group",
|
|
@@ -28585,7 +28858,7 @@ function CommandItem({
|
|
|
28585
28858
|
className,
|
|
28586
28859
|
...props
|
|
28587
28860
|
}) {
|
|
28588
|
-
return /* @__PURE__ */ (0,
|
|
28861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28589
28862
|
import_cmdk.Command.Item,
|
|
28590
28863
|
{
|
|
28591
28864
|
"data-slot": "command-item",
|
|
@@ -28599,7 +28872,7 @@ function CommandItem({
|
|
|
28599
28872
|
}
|
|
28600
28873
|
|
|
28601
28874
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
28602
|
-
var
|
|
28875
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
28603
28876
|
var MultiSelect = ({
|
|
28604
28877
|
value = [],
|
|
28605
28878
|
onChange,
|
|
@@ -28624,15 +28897,18 @@ var MultiSelect = ({
|
|
|
28624
28897
|
);
|
|
28625
28898
|
};
|
|
28626
28899
|
const selectedLabels = React8.useMemo(
|
|
28627
|
-
() =>
|
|
28900
|
+
() => {
|
|
28901
|
+
if (!data || !value) return [];
|
|
28902
|
+
return data?.filter((opt) => value.includes(opt.value)).map((opt) => opt.label);
|
|
28903
|
+
},
|
|
28628
28904
|
[data, value]
|
|
28629
28905
|
);
|
|
28630
|
-
const options = data
|
|
28906
|
+
const options = data && data?.map((item) => ({
|
|
28631
28907
|
value: item[dataKey],
|
|
28632
28908
|
label: item[dataLabel]
|
|
28633
28909
|
}));
|
|
28634
|
-
return /* @__PURE__ */ (0,
|
|
28635
|
-
/* @__PURE__ */ (0,
|
|
28910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
28911
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
28636
28912
|
Button,
|
|
28637
28913
|
{
|
|
28638
28914
|
variant: "outline",
|
|
@@ -28641,12 +28917,12 @@ var MultiSelect = ({
|
|
|
28641
28917
|
disabled,
|
|
28642
28918
|
type: "button",
|
|
28643
28919
|
children: [
|
|
28644
|
-
/* @__PURE__ */ (0,
|
|
28645
|
-
/* @__PURE__ */ (0,
|
|
28920
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "truncate", children: selectedLabels.length > 0 ? selectedLabels.join(", ") : placeholder }),
|
|
28921
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
28646
28922
|
]
|
|
28647
28923
|
}
|
|
28648
28924
|
) }),
|
|
28649
|
-
/* @__PURE__ */ (0,
|
|
28925
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
28650
28926
|
PopoverContent,
|
|
28651
28927
|
{
|
|
28652
28928
|
align: "start",
|
|
@@ -28655,26 +28931,26 @@ var MultiSelect = ({
|
|
|
28655
28931
|
onInteractOutside: (e) => {
|
|
28656
28932
|
if (e.target.closest(".keep-open")) e.preventDefault();
|
|
28657
28933
|
},
|
|
28658
|
-
children: /* @__PURE__ */ (0,
|
|
28659
|
-
searchable && /* @__PURE__ */ (0,
|
|
28660
|
-
/* @__PURE__ */ (0,
|
|
28661
|
-
/* @__PURE__ */ (0,
|
|
28662
|
-
/* @__PURE__ */ (0,
|
|
28934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Command2, { shouldFilter: searchable, children: [
|
|
28935
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
28936
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(CommandList, { children: [
|
|
28937
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CommandEmpty, { children: "No options found." }),
|
|
28938
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CommandGroup, { children: options.map((opt) => {
|
|
28663
28939
|
const isSelected = value.includes(opt.value);
|
|
28664
|
-
return /* @__PURE__ */ (0,
|
|
28940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
28665
28941
|
"div",
|
|
28666
28942
|
{
|
|
28667
28943
|
className: "keep-open",
|
|
28668
|
-
children: /* @__PURE__ */ (0,
|
|
28944
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
28669
28945
|
CommandItem,
|
|
28670
28946
|
{
|
|
28671
28947
|
onMouseDown: (e) => {
|
|
28672
28948
|
e.preventDefault();
|
|
28673
28949
|
toggleOption(opt.value);
|
|
28674
28950
|
},
|
|
28675
|
-
children: /* @__PURE__ */ (0,
|
|
28676
|
-
/* @__PURE__ */ (0,
|
|
28677
|
-
/* @__PURE__ */ (0,
|
|
28951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
28952
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Checkbox, { checked: isSelected }),
|
|
28953
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: opt.label })
|
|
28678
28954
|
] })
|
|
28679
28955
|
},
|
|
28680
28956
|
opt.value
|
|
@@ -28687,7 +28963,7 @@ var MultiSelect = ({
|
|
|
28687
28963
|
] })
|
|
28688
28964
|
}
|
|
28689
28965
|
),
|
|
28690
|
-
props.errorMessage && /* @__PURE__ */ (0,
|
|
28966
|
+
props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28691
28967
|
] });
|
|
28692
28968
|
};
|
|
28693
28969
|
var MultiSelect_default = MultiSelect;
|
|
@@ -28696,17 +28972,17 @@ var MultiSelect_default = MultiSelect;
|
|
|
28696
28972
|
var React9 = __toESM(require("react"));
|
|
28697
28973
|
var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
|
|
28698
28974
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
28699
|
-
var
|
|
28975
|
+
var import_react_table2 = require("@tanstack/react-table");
|
|
28700
28976
|
|
|
28701
28977
|
// src/components/ui/table.tsx
|
|
28702
|
-
var
|
|
28978
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
28703
28979
|
function Table3({ className, ...props }) {
|
|
28704
|
-
return /* @__PURE__ */ (0,
|
|
28980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28705
28981
|
"div",
|
|
28706
28982
|
{
|
|
28707
28983
|
"data-slot": "table-container",
|
|
28708
28984
|
className: "relative w-full overflow-x-auto rounded-md border border-gray-200 bg-white",
|
|
28709
|
-
children: /* @__PURE__ */ (0,
|
|
28985
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28710
28986
|
"table",
|
|
28711
28987
|
{
|
|
28712
28988
|
"data-slot": "table",
|
|
@@ -28718,7 +28994,7 @@ function Table3({ className, ...props }) {
|
|
|
28718
28994
|
);
|
|
28719
28995
|
}
|
|
28720
28996
|
function TableHeader({ className, ...props }) {
|
|
28721
|
-
return /* @__PURE__ */ (0,
|
|
28997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28722
28998
|
"thead",
|
|
28723
28999
|
{
|
|
28724
29000
|
"data-slot": "table-header",
|
|
@@ -28731,7 +29007,7 @@ function TableHeader({ className, ...props }) {
|
|
|
28731
29007
|
);
|
|
28732
29008
|
}
|
|
28733
29009
|
function TableBody({ className, ...props }) {
|
|
28734
|
-
return /* @__PURE__ */ (0,
|
|
29010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28735
29011
|
"tbody",
|
|
28736
29012
|
{
|
|
28737
29013
|
"data-slot": "table-body",
|
|
@@ -28744,7 +29020,7 @@ function TableBody({ className, ...props }) {
|
|
|
28744
29020
|
);
|
|
28745
29021
|
}
|
|
28746
29022
|
function TableRow({ className, ...props }) {
|
|
28747
|
-
return /* @__PURE__ */ (0,
|
|
29023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28748
29024
|
"tr",
|
|
28749
29025
|
{
|
|
28750
29026
|
"data-slot": "table-row",
|
|
@@ -28757,7 +29033,7 @@ function TableRow({ className, ...props }) {
|
|
|
28757
29033
|
);
|
|
28758
29034
|
}
|
|
28759
29035
|
function TableHead({ className, ...props }) {
|
|
28760
|
-
return /* @__PURE__ */ (0,
|
|
29036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28761
29037
|
"th",
|
|
28762
29038
|
{
|
|
28763
29039
|
"data-slot": "table-head",
|
|
@@ -28770,7 +29046,7 @@ function TableHead({ className, ...props }) {
|
|
|
28770
29046
|
);
|
|
28771
29047
|
}
|
|
28772
29048
|
function TableCell({ className, ...props }) {
|
|
28773
|
-
return /* @__PURE__ */ (0,
|
|
29049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28774
29050
|
"td",
|
|
28775
29051
|
{
|
|
28776
29052
|
"data-slot": "table-cell",
|
|
@@ -28783,8 +29059,271 @@ function TableCell({ className, ...props }) {
|
|
|
28783
29059
|
);
|
|
28784
29060
|
}
|
|
28785
29061
|
|
|
29062
|
+
// src/lib/table/useDynamicColumns.ts
|
|
29063
|
+
var import_react_table = require("@tanstack/react-table");
|
|
29064
|
+
|
|
29065
|
+
// src/lib/table/cellRendererFactory.tsx
|
|
29066
|
+
var import_image3 = __toESM(require("next/image"));
|
|
29067
|
+
|
|
29068
|
+
// src/lib/dayjs-setup.ts
|
|
29069
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
29070
|
+
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
29071
|
+
import_dayjs.default.extend(import_utc.default);
|
|
29072
|
+
var dayjs_setup_default = import_dayjs.default;
|
|
29073
|
+
|
|
29074
|
+
// src/lib/table/valueFormatter.ts
|
|
29075
|
+
var valueFormatter = (value, format2, customFormatters = {}) => {
|
|
29076
|
+
if (!format2) return value;
|
|
29077
|
+
if (value == null) return "";
|
|
29078
|
+
if (format2.startsWith("custom:")) {
|
|
29079
|
+
const key = format2.replace("custom:", "");
|
|
29080
|
+
return customFormatters[key] ? customFormatters[key](value) : value;
|
|
29081
|
+
}
|
|
29082
|
+
const [type, arg] = format2.split(":");
|
|
29083
|
+
switch (type) {
|
|
29084
|
+
case "date":
|
|
29085
|
+
return dayjs_setup_default(value).format(arg || "YYYY-MM-DD");
|
|
29086
|
+
case "datetime":
|
|
29087
|
+
const parsed = dayjs_setup_default(value).isValid() ? dayjs_setup_default(value).utc() : dayjs_setup_default(value);
|
|
29088
|
+
return parsed.format("YYYY-MM-DD hh:mm");
|
|
29089
|
+
case "days":
|
|
29090
|
+
return dayjs_setup_default().diff(dayjs_setup_default(value), "day");
|
|
29091
|
+
case "months":
|
|
29092
|
+
return dayjs_setup_default().diff(dayjs_setup_default(value), "month");
|
|
29093
|
+
case "years":
|
|
29094
|
+
return dayjs_setup_default().diff(dayjs_setup_default(value), "year");
|
|
29095
|
+
case "time":
|
|
29096
|
+
return dayjs_setup_default(value).format("HH:mm");
|
|
29097
|
+
case "number":
|
|
29098
|
+
return Number(value).toFixed(parseInt(arg || "2"));
|
|
29099
|
+
case "currency":
|
|
29100
|
+
return new Intl.NumberFormat("en-IN", {
|
|
29101
|
+
style: "currency",
|
|
29102
|
+
currency: arg || "INR"
|
|
29103
|
+
}).format(Number(value));
|
|
29104
|
+
case "uppercase":
|
|
29105
|
+
return String(value).toUpperCase();
|
|
29106
|
+
case "lowercase":
|
|
29107
|
+
return String(value).toLowerCase();
|
|
29108
|
+
default:
|
|
29109
|
+
return value;
|
|
29110
|
+
}
|
|
29111
|
+
};
|
|
29112
|
+
|
|
29113
|
+
// src/lib/table/cellRendererFactory.tsx
|
|
29114
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
29115
|
+
var getContrastColor = (bg) => {
|
|
29116
|
+
let c = bg.trim().toUpperCase();
|
|
29117
|
+
if (/^#([a-fA-F0-9]{3})$/.test(c)) {
|
|
29118
|
+
c = "#" + c.slice(1).split("").map((x) => x + x).join("");
|
|
29119
|
+
}
|
|
29120
|
+
const named = {
|
|
29121
|
+
white: "#FFFFFF",
|
|
29122
|
+
black: "#000000",
|
|
29123
|
+
red: "#FF0000",
|
|
29124
|
+
green: "#008000",
|
|
29125
|
+
blue: "#0000FF",
|
|
29126
|
+
gray: "#808080",
|
|
29127
|
+
grey: "#808080",
|
|
29128
|
+
orange: "#FFA500",
|
|
29129
|
+
yellow: "#FFFF00",
|
|
29130
|
+
purple: "#800080",
|
|
29131
|
+
pink: "#FFC0CB",
|
|
29132
|
+
teal: "#008080"
|
|
29133
|
+
};
|
|
29134
|
+
if (!c.startsWith("#")) {
|
|
29135
|
+
const lower = c.toLowerCase();
|
|
29136
|
+
if (named[lower]) c = named[lower];
|
|
29137
|
+
else return "#FFFFFF";
|
|
29138
|
+
}
|
|
29139
|
+
if (!/^#([a-fA-F0-9]{6})$/.test(c)) return "#FFFFFF";
|
|
29140
|
+
const r = parseInt(c.slice(1, 3), 16);
|
|
29141
|
+
const g = parseInt(c.slice(3, 5), 16);
|
|
29142
|
+
const b = parseInt(c.slice(5, 7), 16);
|
|
29143
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
29144
|
+
return brightness > 160 ? "#000000" : "#FFFFFF";
|
|
29145
|
+
};
|
|
29146
|
+
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format2, customFormatters = {}) => {
|
|
29147
|
+
const formattedValue = valueFormatter(value, format2, customFormatters);
|
|
29148
|
+
switch (renderer) {
|
|
29149
|
+
/* -------------------- BASIC -------------------- */
|
|
29150
|
+
case "text":
|
|
29151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: row?.[rendererProps?.rowField] || formattedValue });
|
|
29152
|
+
case "number":
|
|
29153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "tabular-nums text-right", children: valueFormatter(row?.[rendererProps?.rowField] || value, "number:2") });
|
|
29154
|
+
case "date":
|
|
29155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: valueFormatter(row?.[rendererProps?.rowField] || value, format2) });
|
|
29156
|
+
case "link":
|
|
29157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29158
|
+
"a",
|
|
29159
|
+
{
|
|
29160
|
+
href: `${rendererProps?.prefix || ""}${row?.[rendererProps?.rowField] || formattedValue}`,
|
|
29161
|
+
target: "_blank",
|
|
29162
|
+
rel: "noreferrer",
|
|
29163
|
+
className: `text-blue-500 underline ${rendererProps?.className || ""}`,
|
|
29164
|
+
children: rendererProps?.label || formattedValue
|
|
29165
|
+
}
|
|
29166
|
+
);
|
|
29167
|
+
/* -------------------- VISUAL -------------------- */
|
|
29168
|
+
case "image":
|
|
29169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29170
|
+
import_image3.default,
|
|
29171
|
+
{
|
|
29172
|
+
src: row?.[rendererProps?.rowField] || formattedValue || rendererProps?.fallback || "/placeholder.png",
|
|
29173
|
+
alt: rendererProps?.alt || "",
|
|
29174
|
+
width: rendererProps?.width || 40,
|
|
29175
|
+
height: rendererProps?.height || 40,
|
|
29176
|
+
className: `object-cover ${rendererProps?.rounded ? "rounded-full" : ""} ${rendererProps?.className || ""}`,
|
|
29177
|
+
style: {
|
|
29178
|
+
borderRadius: rendererProps?.rounded ? "50%" : 0,
|
|
29179
|
+
objectFit: "cover"
|
|
29180
|
+
}
|
|
29181
|
+
}
|
|
29182
|
+
) });
|
|
29183
|
+
case "icon":
|
|
29184
|
+
const maybeIcon = lucide_react_exports[rendererProps?.icon];
|
|
29185
|
+
const IconComponent = typeof maybeIcon === "function" ? maybeIcon : Star;
|
|
29186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29187
|
+
IconComponent,
|
|
29188
|
+
{
|
|
29189
|
+
size: rendererProps?.size || 16,
|
|
29190
|
+
color: rendererProps?.color || "#555",
|
|
29191
|
+
className: rendererProps?.className || ""
|
|
29192
|
+
}
|
|
29193
|
+
);
|
|
29194
|
+
case "badge": {
|
|
29195
|
+
const color = rendererProps?.colorMap?.[formattedValue] || rendererProps?.color || "gray";
|
|
29196
|
+
if (!formattedValue) return null;
|
|
29197
|
+
const textColor = getContrastColor(color);
|
|
29198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29199
|
+
"span",
|
|
29200
|
+
{
|
|
29201
|
+
className: `inline-block px-2 py-1 text-xs rounded-full bg-${color}-100 text-${textColor}-700 ${rendererProps?.className || ""}`,
|
|
29202
|
+
style: { backgroundColor: color, color: textColor },
|
|
29203
|
+
children: formattedValue
|
|
29204
|
+
}
|
|
29205
|
+
);
|
|
29206
|
+
}
|
|
29207
|
+
case "chip": {
|
|
29208
|
+
const color = rendererProps?.color || "gray";
|
|
29209
|
+
const maybeIcon2 = lucide_react_exports[rendererProps?.icon];
|
|
29210
|
+
const IconComponent2 = typeof maybeIcon2 === "function" ? maybeIcon2 : Star;
|
|
29211
|
+
if (!formattedValue) return null;
|
|
29212
|
+
const textColor = getContrastColor(color);
|
|
29213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
29214
|
+
"span",
|
|
29215
|
+
{
|
|
29216
|
+
className: `inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full bg-[${color}]-100 text-[${textColor}]-700`,
|
|
29217
|
+
style: { backgroundColor: color, color: textColor },
|
|
29218
|
+
children: [
|
|
29219
|
+
rendererProps?.icon && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: IconComponent2 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(IconComponent2, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Box, { className: "h-4 w-4" }) }),
|
|
29220
|
+
formattedValue
|
|
29221
|
+
]
|
|
29222
|
+
}
|
|
29223
|
+
);
|
|
29224
|
+
}
|
|
29225
|
+
/* -------------------- INTERACTIVE -------------------- */
|
|
29226
|
+
case "button":
|
|
29227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29228
|
+
"button",
|
|
29229
|
+
{
|
|
29230
|
+
onClick: () => rendererProps?.onClick?.(row, formattedValue),
|
|
29231
|
+
className: `px-2 py-1 rounded text-white bg-blue-600 hover:bg-blue-700 ${rendererProps?.className || ""}`,
|
|
29232
|
+
children: row?.[rendererProps?.rowField] || rendererProps.value || formattedValue
|
|
29233
|
+
}
|
|
29234
|
+
);
|
|
29235
|
+
case "switch":
|
|
29236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "inline-flex items-center cursor-pointer", children: [
|
|
29237
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29238
|
+
"input",
|
|
29239
|
+
{
|
|
29240
|
+
type: "checkbox",
|
|
29241
|
+
checked: !!value,
|
|
29242
|
+
onChange: (e) => rendererProps?.onChange?.(row, e.target.checked),
|
|
29243
|
+
className: "sr-only peer"
|
|
29244
|
+
}
|
|
29245
|
+
),
|
|
29246
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "relative w-9 h-5 bg-gray-300 peer-checked:bg-blue-600 rounded-full transition-all", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full peer-checked:translate-x-4 transition-all" }) })
|
|
29247
|
+
] });
|
|
29248
|
+
case "progress":
|
|
29249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "w-full bg-gray-100 rounded-full h-2", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29250
|
+
"div",
|
|
29251
|
+
{
|
|
29252
|
+
className: "bg-blue-600 h-2 rounded-full transition-all",
|
|
29253
|
+
style: { width: `${row?.[rendererProps?.rowField] || formattedValue || 0}%` }
|
|
29254
|
+
}
|
|
29255
|
+
) });
|
|
29256
|
+
case "rating": {
|
|
29257
|
+
const stars = Math.round(Number(row?.[rendererProps?.rowField] || formattedValue) || 0);
|
|
29258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex items-center", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29259
|
+
Star,
|
|
29260
|
+
{
|
|
29261
|
+
size: 16,
|
|
29262
|
+
className: i < stars ? "text-yellow-400" : "text-gray-300",
|
|
29263
|
+
fill: i < stars ? "#facc15" : "none"
|
|
29264
|
+
},
|
|
29265
|
+
i
|
|
29266
|
+
)) });
|
|
29267
|
+
}
|
|
29268
|
+
/* -------------------- ADVANCED -------------------- */
|
|
29269
|
+
case "custom": {
|
|
29270
|
+
const CustomRenderer = customRenderers[rendererProps?.customRendererId] || customRenderers[rendererProps?.rendererId];
|
|
29271
|
+
if (CustomRenderer)
|
|
29272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
29273
|
+
CustomRenderer,
|
|
29274
|
+
{
|
|
29275
|
+
value: formattedValue,
|
|
29276
|
+
row,
|
|
29277
|
+
...rendererProps
|
|
29278
|
+
}
|
|
29279
|
+
);
|
|
29280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: "Missing custom renderer" });
|
|
29281
|
+
}
|
|
29282
|
+
/* -------------------- DEFAULT -------------------- */
|
|
29283
|
+
default:
|
|
29284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: formattedValue });
|
|
29285
|
+
}
|
|
29286
|
+
};
|
|
29287
|
+
|
|
29288
|
+
// src/lib/table/useDynamicColumns.ts
|
|
29289
|
+
var columnHelper = (0, import_react_table.createColumnHelper)();
|
|
29290
|
+
function getValueByPath(obj, path) {
|
|
29291
|
+
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
29292
|
+
}
|
|
29293
|
+
var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) => {
|
|
29294
|
+
return config.columns.map((col) => {
|
|
29295
|
+
const accessorKey = col.accessorKey ?? col.id;
|
|
29296
|
+
const accessorFn = (row) => {
|
|
29297
|
+
if (Object.prototype.hasOwnProperty.call(row, accessorKey)) {
|
|
29298
|
+
return row[accessorKey];
|
|
29299
|
+
}
|
|
29300
|
+
if (accessorKey.includes(".")) {
|
|
29301
|
+
return getValueByPath(row, accessorKey);
|
|
29302
|
+
}
|
|
29303
|
+
return row[accessorKey];
|
|
29304
|
+
};
|
|
29305
|
+
return columnHelper.accessor(accessorFn, {
|
|
29306
|
+
id: accessorKey,
|
|
29307
|
+
header: col.header,
|
|
29308
|
+
cell: (info) => {
|
|
29309
|
+
const value = info.getValue();
|
|
29310
|
+
const row = info.row.original;
|
|
29311
|
+
return cellRendererFactory(
|
|
29312
|
+
col.renderer,
|
|
29313
|
+
col.rendererProps,
|
|
29314
|
+
value,
|
|
29315
|
+
row,
|
|
29316
|
+
customRenderers,
|
|
29317
|
+
col.format,
|
|
29318
|
+
customFormatters
|
|
29319
|
+
);
|
|
29320
|
+
}
|
|
29321
|
+
});
|
|
29322
|
+
});
|
|
29323
|
+
};
|
|
29324
|
+
|
|
28786
29325
|
// src/components/ui/data-table.tsx
|
|
28787
|
-
var
|
|
29326
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
28788
29327
|
function DataTable({
|
|
28789
29328
|
columns,
|
|
28790
29329
|
data,
|
|
@@ -28810,7 +29349,7 @@ function DataTable({
|
|
|
28810
29349
|
const deleteColumn = React9.useMemo(() => ({
|
|
28811
29350
|
id: "delete",
|
|
28812
29351
|
header: "Actions",
|
|
28813
|
-
cell: ({ row }) => /* @__PURE__ */ (0,
|
|
29352
|
+
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28814
29353
|
"button",
|
|
28815
29354
|
{
|
|
28816
29355
|
className: "px-3 py-1 text-[12px] bg-red-800 text-white rounded hover:bg-neutral-600 cursor-pointer",
|
|
@@ -28831,9 +29370,10 @@ function DataTable({
|
|
|
28831
29370
|
}
|
|
28832
29371
|
return columns;
|
|
28833
29372
|
}, [columns, enableDelete, deleteColumn]);
|
|
28834
|
-
const
|
|
29373
|
+
const dynamicCols = useDynamicColumns({ columns: combinedColumns });
|
|
29374
|
+
const table = (0, import_react_table2.useReactTable)({
|
|
28835
29375
|
data,
|
|
28836
|
-
columns:
|
|
29376
|
+
columns: dynamicCols,
|
|
28837
29377
|
state: {
|
|
28838
29378
|
columnFilters,
|
|
28839
29379
|
columnVisibility,
|
|
@@ -28846,9 +29386,9 @@ function DataTable({
|
|
|
28846
29386
|
},
|
|
28847
29387
|
onColumnFiltersChange: setColumnFilters,
|
|
28848
29388
|
onColumnVisibilityChange: setColumnVisibility,
|
|
28849
|
-
getCoreRowModel: (0,
|
|
28850
|
-
getFilteredRowModel: (0,
|
|
28851
|
-
getPaginationRowModel: pagination && paginationMode === "client" ? (0,
|
|
29389
|
+
getCoreRowModel: (0, import_react_table2.getCoreRowModel)(),
|
|
29390
|
+
getFilteredRowModel: (0, import_react_table2.getFilteredRowModel)(),
|
|
29391
|
+
getPaginationRowModel: pagination && paginationMode === "client" ? (0, import_react_table2.getPaginationRowModel)() : void 0,
|
|
28852
29392
|
manualPagination: paginationMode === "server",
|
|
28853
29393
|
pageCount: paginationMode === "server" ? Math.ceil(totalRecords / pageSize) : void 0,
|
|
28854
29394
|
...paginationMode === "server" ? {
|
|
@@ -28878,11 +29418,11 @@ function DataTable({
|
|
|
28878
29418
|
}
|
|
28879
29419
|
return [];
|
|
28880
29420
|
};
|
|
28881
|
-
return /* @__PURE__ */ (0,
|
|
28882
|
-
/* @__PURE__ */ (0,
|
|
28883
|
-
globalSearch && /* @__PURE__ */ (0,
|
|
28884
|
-
/* @__PURE__ */ (0,
|
|
28885
|
-
/* @__PURE__ */ (0,
|
|
29421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "overflow-hidden rounded-md w-full", children: [
|
|
29422
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 bg-gray-50`, children: [
|
|
29423
|
+
globalSearch && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
|
|
29424
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "relative w-full", children: [
|
|
29425
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28886
29426
|
"input",
|
|
28887
29427
|
{
|
|
28888
29428
|
type: "text",
|
|
@@ -28897,9 +29437,9 @@ function DataTable({
|
|
|
28897
29437
|
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]"
|
|
28898
29438
|
}
|
|
28899
29439
|
),
|
|
28900
|
-
/* @__PURE__ */ (0,
|
|
29440
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Search, { className: "absolute left-2 top-2.5 text-gray-400", size: 16 })
|
|
28901
29441
|
] }),
|
|
28902
|
-
/* @__PURE__ */ (0,
|
|
29442
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28903
29443
|
Button,
|
|
28904
29444
|
{
|
|
28905
29445
|
size: "sm",
|
|
@@ -28909,8 +29449,8 @@ function DataTable({
|
|
|
28909
29449
|
}
|
|
28910
29450
|
)
|
|
28911
29451
|
] }),
|
|
28912
|
-
/* @__PURE__ */ (0,
|
|
28913
|
-
/* @__PURE__ */ (0,
|
|
29452
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Popover, { children: [
|
|
29453
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28914
29454
|
Button,
|
|
28915
29455
|
{
|
|
28916
29456
|
variant: "outline",
|
|
@@ -28919,10 +29459,10 @@ function DataTable({
|
|
|
28919
29459
|
children: "Manage Columns"
|
|
28920
29460
|
}
|
|
28921
29461
|
) }),
|
|
28922
|
-
/* @__PURE__ */ (0,
|
|
28923
|
-
/* @__PURE__ */ (0,
|
|
28924
|
-
/* @__PURE__ */ (0,
|
|
28925
|
-
/* @__PURE__ */ (0,
|
|
29462
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(PopoverContent, { align: "end", className: "w-48 p-3 space-y-2", children: [
|
|
29463
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "text-sm font-medium mb-2", children: "Show / Hide Columns" }),
|
|
29464
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
|
|
29465
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28926
29466
|
"input",
|
|
28927
29467
|
{
|
|
28928
29468
|
type: "checkbox",
|
|
@@ -28941,8 +29481,8 @@ function DataTable({
|
|
|
28941
29481
|
),
|
|
28942
29482
|
"Toggle All"
|
|
28943
29483
|
] }),
|
|
28944
|
-
table.getAllLeafColumns().map((column) => /* @__PURE__ */ (0,
|
|
28945
|
-
/* @__PURE__ */ (0,
|
|
29484
|
+
table.getAllLeafColumns().map((column) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
29485
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28946
29486
|
"input",
|
|
28947
29487
|
{
|
|
28948
29488
|
type: "checkbox",
|
|
@@ -28955,13 +29495,13 @@ function DataTable({
|
|
|
28955
29495
|
] })
|
|
28956
29496
|
] })
|
|
28957
29497
|
] }),
|
|
28958
|
-
/* @__PURE__ */ (0,
|
|
28959
|
-
/* @__PURE__ */ (0,
|
|
29498
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Table3, { children: [
|
|
29499
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: hg.headers.map((header) => {
|
|
28960
29500
|
const canSort = header.column.getCanSort();
|
|
28961
29501
|
const canFilter = header.column.getCanFilter();
|
|
28962
29502
|
const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
|
|
28963
|
-
return /* @__PURE__ */ (0,
|
|
28964
|
-
/* @__PURE__ */ (0,
|
|
29503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableHead, { className: "relative select-none", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
29504
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
28965
29505
|
"span",
|
|
28966
29506
|
{
|
|
28967
29507
|
className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
|
|
@@ -28972,33 +29512,33 @@ function DataTable({
|
|
|
28972
29512
|
onSortChange?.(header.column.id, newDir);
|
|
28973
29513
|
},
|
|
28974
29514
|
children: [
|
|
28975
|
-
(0,
|
|
28976
|
-
canSort && /* @__PURE__ */ (0,
|
|
28977
|
-
sortDir === "asc" && /* @__PURE__ */ (0,
|
|
28978
|
-
sortDir === "desc" && /* @__PURE__ */ (0,
|
|
28979
|
-
!sortDir && /* @__PURE__ */ (0,
|
|
29515
|
+
(0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
|
|
29516
|
+
canSort && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
29517
|
+
sortDir === "asc" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUp, { size: 14, className: "text-gray-500" }),
|
|
29518
|
+
sortDir === "desc" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowDown, { size: 14, className: "text-gray-500" }),
|
|
29519
|
+
!sortDir && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUpDown, { size: 14, className: "text-gray-400" })
|
|
28980
29520
|
] })
|
|
28981
29521
|
]
|
|
28982
29522
|
}
|
|
28983
29523
|
),
|
|
28984
|
-
canFilter && /* @__PURE__ */ (0,
|
|
28985
|
-
/* @__PURE__ */ (0,
|
|
29524
|
+
canFilter && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Popover, { children: [
|
|
29525
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28986
29526
|
"span",
|
|
28987
29527
|
{
|
|
28988
29528
|
role: "presentation",
|
|
28989
29529
|
className: "pl-5 cursor-pointer",
|
|
28990
29530
|
onClick: (e) => e.stopPropagation(),
|
|
28991
|
-
children: /* @__PURE__ */ (0,
|
|
29531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons2.faEllipsisH, className: "w-5 h-5 text-gray-500" })
|
|
28992
29532
|
}
|
|
28993
29533
|
) }),
|
|
28994
|
-
/* @__PURE__ */ (0,
|
|
29534
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28995
29535
|
PopoverContent,
|
|
28996
29536
|
{
|
|
28997
29537
|
align: "center",
|
|
28998
29538
|
sideOffset: 14,
|
|
28999
29539
|
className: "w-50 p-3 z-[200] border-gray-300",
|
|
29000
29540
|
avoidCollisions: true,
|
|
29001
|
-
children: /* @__PURE__ */ (0,
|
|
29541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
29002
29542
|
"form",
|
|
29003
29543
|
{
|
|
29004
29544
|
onSubmit: (e) => {
|
|
@@ -29011,8 +29551,8 @@ function DataTable({
|
|
|
29011
29551
|
},
|
|
29012
29552
|
className: "space-y-2",
|
|
29013
29553
|
children: [
|
|
29014
|
-
/* @__PURE__ */ (0,
|
|
29015
|
-
/* @__PURE__ */ (0,
|
|
29554
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
|
|
29555
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
29016
29556
|
"input",
|
|
29017
29557
|
{
|
|
29018
29558
|
name: "filter",
|
|
@@ -29022,7 +29562,7 @@ function DataTable({
|
|
|
29022
29562
|
autoComplete: "off"
|
|
29023
29563
|
}
|
|
29024
29564
|
),
|
|
29025
|
-
/* @__PURE__ */ (0,
|
|
29565
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "justify-end flex", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
29026
29566
|
Button,
|
|
29027
29567
|
{
|
|
29028
29568
|
type: "submit",
|
|
@@ -29038,10 +29578,10 @@ function DataTable({
|
|
|
29038
29578
|
] })
|
|
29039
29579
|
] }) }, header.id);
|
|
29040
29580
|
}) }, hg.id)) }),
|
|
29041
|
-
/* @__PURE__ */ (0,
|
|
29581
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: combinedColumns.map((_2, j) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableCell, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("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__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: row.getVisibleCells().map((cell) => {
|
|
29042
29582
|
const meta = cell.column.columnDef.meta || {};
|
|
29043
29583
|
const isClickable = meta?.isClickable;
|
|
29044
|
-
return /* @__PURE__ */ (0,
|
|
29584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
29045
29585
|
TableCell,
|
|
29046
29586
|
{
|
|
29047
29587
|
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100" : ""}`,
|
|
@@ -29051,21 +29591,21 @@ function DataTable({
|
|
|
29051
29591
|
onCellClick(cell.row.original, cell.column.id);
|
|
29052
29592
|
}
|
|
29053
29593
|
},
|
|
29054
|
-
children: (0,
|
|
29594
|
+
children: (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
29055
29595
|
},
|
|
29056
29596
|
cell.id
|
|
29057
29597
|
);
|
|
29058
|
-
}) }, row.id)) : /* @__PURE__ */ (0,
|
|
29598
|
+
}) }, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableCell, { colSpan: combinedColumns.length, className: "h-24 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex items-center justify-center py-10 w-full min-w-full text-gray-600 bg-gray-100", children: "No results." }) }) }) })
|
|
29059
29599
|
] }),
|
|
29060
|
-
pagination && /* @__PURE__ */ (0,
|
|
29061
|
-
/* @__PURE__ */ (0,
|
|
29600
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between py-3 px-2 text-sm w-full", children: [
|
|
29601
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
29062
29602
|
"Page ",
|
|
29063
29603
|
table.getState().pagination.pageIndex + 1,
|
|
29064
29604
|
" of ",
|
|
29065
29605
|
table.getPageCount()
|
|
29066
29606
|
] }),
|
|
29067
|
-
/* @__PURE__ */ (0,
|
|
29068
|
-
/* @__PURE__ */ (0,
|
|
29607
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
29608
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
29069
29609
|
"button",
|
|
29070
29610
|
{
|
|
29071
29611
|
onClick: () => table.previousPage(),
|
|
@@ -29078,7 +29618,7 @@ function DataTable({
|
|
|
29078
29618
|
table.getState().pagination.pageIndex + 1,
|
|
29079
29619
|
table.getPageCount(),
|
|
29080
29620
|
5
|
|
29081
|
-
).map((pageNum, index) => /* @__PURE__ */ (0,
|
|
29621
|
+
).map((pageNum, index) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
29082
29622
|
"button",
|
|
29083
29623
|
{
|
|
29084
29624
|
disabled: pageNum === "...",
|
|
@@ -29088,7 +29628,7 @@ function DataTable({
|
|
|
29088
29628
|
},
|
|
29089
29629
|
index
|
|
29090
29630
|
)),
|
|
29091
|
-
/* @__PURE__ */ (0,
|
|
29631
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
29092
29632
|
"button",
|
|
29093
29633
|
{
|
|
29094
29634
|
onClick: () => table.nextPage(),
|
|
@@ -29103,7 +29643,7 @@ function DataTable({
|
|
|
29103
29643
|
}
|
|
29104
29644
|
|
|
29105
29645
|
// src/components/DataDisplay/Table/Table.tsx
|
|
29106
|
-
var
|
|
29646
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
29107
29647
|
var Table4 = ({
|
|
29108
29648
|
columns,
|
|
29109
29649
|
data,
|
|
@@ -29129,7 +29669,7 @@ var Table4 = ({
|
|
|
29129
29669
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
29130
29670
|
const rawData = Array.isArray(data) ? data : [];
|
|
29131
29671
|
const isControlled = typeof page === "number";
|
|
29132
|
-
return /* @__PURE__ */ (0,
|
|
29672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: `${className || ""} space-y-3`, style, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
29133
29673
|
DataTable,
|
|
29134
29674
|
{
|
|
29135
29675
|
...props,
|
|
@@ -29162,9 +29702,9 @@ var Table4 = ({
|
|
|
29162
29702
|
var Table_default = Table4;
|
|
29163
29703
|
|
|
29164
29704
|
// src/components/ui/pagination.tsx
|
|
29165
|
-
var
|
|
29705
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
29166
29706
|
function Pagination({ className, ...props }) {
|
|
29167
|
-
return /* @__PURE__ */ (0,
|
|
29707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
29168
29708
|
"nav",
|
|
29169
29709
|
{
|
|
29170
29710
|
role: "navigation",
|
|
@@ -29179,7 +29719,7 @@ function PaginationContent({
|
|
|
29179
29719
|
className,
|
|
29180
29720
|
...props
|
|
29181
29721
|
}) {
|
|
29182
|
-
return /* @__PURE__ */ (0,
|
|
29722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
29183
29723
|
"ul",
|
|
29184
29724
|
{
|
|
29185
29725
|
"data-slot": "pagination-content",
|
|
@@ -29189,7 +29729,7 @@ function PaginationContent({
|
|
|
29189
29729
|
);
|
|
29190
29730
|
}
|
|
29191
29731
|
function PaginationItem({ ...props }) {
|
|
29192
|
-
return /* @__PURE__ */ (0,
|
|
29732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("li", { "data-slot": "pagination-item", ...props });
|
|
29193
29733
|
}
|
|
29194
29734
|
function PaginationLink({
|
|
29195
29735
|
className,
|
|
@@ -29197,7 +29737,7 @@ function PaginationLink({
|
|
|
29197
29737
|
size = "icon",
|
|
29198
29738
|
...props
|
|
29199
29739
|
}) {
|
|
29200
|
-
return /* @__PURE__ */ (0,
|
|
29740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
29201
29741
|
"a",
|
|
29202
29742
|
{
|
|
29203
29743
|
"aria-current": isActive ? "page" : void 0,
|
|
@@ -29218,7 +29758,7 @@ function PaginationPrevious({
|
|
|
29218
29758
|
className,
|
|
29219
29759
|
...props
|
|
29220
29760
|
}) {
|
|
29221
|
-
return /* @__PURE__ */ (0,
|
|
29761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
29222
29762
|
PaginationLink,
|
|
29223
29763
|
{
|
|
29224
29764
|
"aria-label": "Go to previous page",
|
|
@@ -29226,8 +29766,8 @@ function PaginationPrevious({
|
|
|
29226
29766
|
className: cn("gap-1 px-2.5 sm:pl-2.5", className),
|
|
29227
29767
|
...props,
|
|
29228
29768
|
children: [
|
|
29229
|
-
/* @__PURE__ */ (0,
|
|
29230
|
-
/* @__PURE__ */ (0,
|
|
29769
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronLeft, {}),
|
|
29770
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "hidden sm:block", children: "Previous" })
|
|
29231
29771
|
]
|
|
29232
29772
|
}
|
|
29233
29773
|
);
|
|
@@ -29236,7 +29776,7 @@ function PaginationNext({
|
|
|
29236
29776
|
className,
|
|
29237
29777
|
...props
|
|
29238
29778
|
}) {
|
|
29239
|
-
return /* @__PURE__ */ (0,
|
|
29779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
29240
29780
|
PaginationLink,
|
|
29241
29781
|
{
|
|
29242
29782
|
"aria-label": "Go to next page",
|
|
@@ -29244,8 +29784,8 @@ function PaginationNext({
|
|
|
29244
29784
|
className: cn("gap-1 px-2.5 sm:pr-2.5", className),
|
|
29245
29785
|
...props,
|
|
29246
29786
|
children: [
|
|
29247
|
-
/* @__PURE__ */ (0,
|
|
29248
|
-
/* @__PURE__ */ (0,
|
|
29787
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "hidden sm:block", children: "Next" }),
|
|
29788
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronRight, {})
|
|
29249
29789
|
]
|
|
29250
29790
|
}
|
|
29251
29791
|
);
|
|
@@ -29254,7 +29794,7 @@ function PaginationEllipsis({
|
|
|
29254
29794
|
className,
|
|
29255
29795
|
...props
|
|
29256
29796
|
}) {
|
|
29257
|
-
return /* @__PURE__ */ (0,
|
|
29797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
29258
29798
|
"span",
|
|
29259
29799
|
{
|
|
29260
29800
|
"aria-hidden": true,
|
|
@@ -29262,15 +29802,15 @@ function PaginationEllipsis({
|
|
|
29262
29802
|
className: cn("flex size-9 items-center justify-center", className),
|
|
29263
29803
|
...props,
|
|
29264
29804
|
children: [
|
|
29265
|
-
/* @__PURE__ */ (0,
|
|
29266
|
-
/* @__PURE__ */ (0,
|
|
29805
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Ellipsis, { className: "size-4" }),
|
|
29806
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "More pages" })
|
|
29267
29807
|
]
|
|
29268
29808
|
}
|
|
29269
29809
|
);
|
|
29270
29810
|
}
|
|
29271
29811
|
|
|
29272
29812
|
// src/components/DataDisplay/Pagination/Pagination.tsx
|
|
29273
|
-
var
|
|
29813
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
29274
29814
|
var CustomPagination = ({
|
|
29275
29815
|
totalPages,
|
|
29276
29816
|
currentPage,
|
|
@@ -29316,10 +29856,10 @@ var CustomPagination = ({
|
|
|
29316
29856
|
}
|
|
29317
29857
|
};
|
|
29318
29858
|
const pageNumbers = getPageNumbers();
|
|
29319
|
-
return /* @__PURE__ */ (0,
|
|
29320
|
-
/* @__PURE__ */ (0,
|
|
29321
|
-
/* @__PURE__ */ (0,
|
|
29322
|
-
/* @__PURE__ */ (0,
|
|
29859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-row gap-1 w-full items-center justify-between", children: [
|
|
29860
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
29861
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-sm text-muted-foreground whitespace-nowrap", children: "Items per page:" }),
|
|
29862
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
29323
29863
|
Select,
|
|
29324
29864
|
{
|
|
29325
29865
|
defaultValue: String(perPage),
|
|
@@ -29327,26 +29867,26 @@ var CustomPagination = ({
|
|
|
29327
29867
|
onPageChange({ page: 1, itemsPerPage: Number(value) });
|
|
29328
29868
|
},
|
|
29329
29869
|
children: [
|
|
29330
|
-
/* @__PURE__ */ (0,
|
|
29331
|
-
/* @__PURE__ */ (0,
|
|
29332
|
-
/* @__PURE__ */ (0,
|
|
29333
|
-
/* @__PURE__ */ (0,
|
|
29334
|
-
/* @__PURE__ */ (0,
|
|
29335
|
-
/* @__PURE__ */ (0,
|
|
29870
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectTrigger, { className: "w-[100px]", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
29871
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(SelectContent, { children: [
|
|
29872
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectItem, { value: "5", children: "5" }),
|
|
29873
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectItem, { value: "10", children: "10" }),
|
|
29874
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectItem, { value: "20", children: "20" }),
|
|
29875
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectItem, { value: "50", children: "50" })
|
|
29336
29876
|
] })
|
|
29337
29877
|
]
|
|
29338
29878
|
}
|
|
29339
29879
|
)
|
|
29340
29880
|
] }),
|
|
29341
|
-
/* @__PURE__ */ (0,
|
|
29342
|
-
/* @__PURE__ */ (0,
|
|
29881
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Pagination, { className: "justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(PaginationContent, { children: [
|
|
29882
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
29343
29883
|
PaginationPrevious,
|
|
29344
29884
|
{
|
|
29345
29885
|
onClick: () => handlePageChange(currentPage - 1),
|
|
29346
29886
|
className: currentPage === 1 ? "pointer-events-none opacity-50" : "cursor-pointer"
|
|
29347
29887
|
}
|
|
29348
29888
|
) }),
|
|
29349
|
-
pageNumbers.map((pageNumber, index) => /* @__PURE__ */ (0,
|
|
29889
|
+
pageNumbers.map((pageNumber, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PaginationItem, { children: pageNumber === "..." ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PaginationEllipsis, {}) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
29350
29890
|
PaginationLink,
|
|
29351
29891
|
{
|
|
29352
29892
|
onClick: () => handlePageChange(pageNumber),
|
|
@@ -29355,7 +29895,7 @@ var CustomPagination = ({
|
|
|
29355
29895
|
children: pageNumber
|
|
29356
29896
|
}
|
|
29357
29897
|
) }, index)),
|
|
29358
|
-
/* @__PURE__ */ (0,
|
|
29898
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
29359
29899
|
PaginationNext,
|
|
29360
29900
|
{
|
|
29361
29901
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -29368,11 +29908,11 @@ var CustomPagination = ({
|
|
|
29368
29908
|
var Pagination_default = CustomPagination;
|
|
29369
29909
|
|
|
29370
29910
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
29371
|
-
var
|
|
29911
|
+
var import_react29 = require("react");
|
|
29372
29912
|
var import_link5 = __toESM(require("next/link"));
|
|
29373
29913
|
var import_navigation3 = require("next/navigation");
|
|
29374
|
-
var
|
|
29375
|
-
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder =
|
|
29914
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
29915
|
+
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading }) => {
|
|
29376
29916
|
function groupMenus(menus = []) {
|
|
29377
29917
|
const menuMap = /* @__PURE__ */ new Map();
|
|
29378
29918
|
menus.forEach((menu) => {
|
|
@@ -29405,7 +29945,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29405
29945
|
});
|
|
29406
29946
|
return sortMenus(rootMenus);
|
|
29407
29947
|
}
|
|
29408
|
-
const rawTabs = (0,
|
|
29948
|
+
const rawTabs = (0, import_react29.useMemo)(() => {
|
|
29409
29949
|
if (!Array.isArray(tabs)) return [];
|
|
29410
29950
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
29411
29951
|
return groupMenus(tabs);
|
|
@@ -29418,9 +29958,9 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29418
29958
|
return pathname === path || path !== "/" && pathname?.startsWith(path);
|
|
29419
29959
|
};
|
|
29420
29960
|
const router = (0, import_navigation3.useRouter)();
|
|
29421
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
29422
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
29423
|
-
const handleBuilderExit = (0,
|
|
29961
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react29.useState)(false);
|
|
29962
|
+
const [pendingUrl, setPendingUrl] = (0, import_react29.useState)(null);
|
|
29963
|
+
const handleBuilderExit = (0, import_react29.useCallback)(
|
|
29424
29964
|
(e, url) => {
|
|
29425
29965
|
if (isBuilder) {
|
|
29426
29966
|
e.preventDefault();
|
|
@@ -29439,23 +29979,23 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29439
29979
|
const renderDesktopTab = (tab, index) => {
|
|
29440
29980
|
const finalClasses = [baseClasses, isActive(tab.url) ? activeClasses : hoverClasses, tab.className || ""].join(" ");
|
|
29441
29981
|
if (Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown) {
|
|
29442
|
-
return /* @__PURE__ */ (0,
|
|
29443
|
-
/* @__PURE__ */ (0,
|
|
29982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenu, { children: [
|
|
29983
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenuTrigger, { className: `${finalClasses} inline-flex items-center gap-1`, children: [
|
|
29444
29984
|
tab.header,
|
|
29445
|
-
/* @__PURE__ */ (0,
|
|
29985
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ChevronDown, { className: "h-4 w-4 opacity-80" })
|
|
29446
29986
|
] }),
|
|
29447
|
-
/* @__PURE__ */ (0,
|
|
29987
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29448
29988
|
DropdownMenuContent,
|
|
29449
29989
|
{
|
|
29450
29990
|
align: "start",
|
|
29451
29991
|
sideOffset: 6,
|
|
29452
29992
|
className: "z-50 min-w-[160px] rounded-md border border-gray-200 bg-white p-1 shadow-lg",
|
|
29453
|
-
children: tab.children.map((item, index2) => /* @__PURE__ */ (0,
|
|
29993
|
+
children: tab.children.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29454
29994
|
DropdownMenuItem,
|
|
29455
29995
|
{
|
|
29456
29996
|
asChild: true,
|
|
29457
29997
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
|
|
29458
|
-
children: /* @__PURE__ */ (0,
|
|
29998
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29459
29999
|
import_link5.default,
|
|
29460
30000
|
{
|
|
29461
30001
|
href: item.url || "#",
|
|
@@ -29471,7 +30011,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29471
30011
|
)
|
|
29472
30012
|
] }, index);
|
|
29473
30013
|
}
|
|
29474
|
-
return tab.url ? /* @__PURE__ */ (0,
|
|
30014
|
+
return tab.url ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29475
30015
|
import_link5.default,
|
|
29476
30016
|
{
|
|
29477
30017
|
href: tab.url,
|
|
@@ -29482,14 +30022,14 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29482
30022
|
children: tab.header
|
|
29483
30023
|
},
|
|
29484
30024
|
index
|
|
29485
|
-
) : /* @__PURE__ */ (0,
|
|
30025
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: finalClasses, style: tab.style, role: "button", tabIndex: 0, children: tab.header }, index);
|
|
29486
30026
|
};
|
|
29487
|
-
const renderMobileMenu = () => /* @__PURE__ */ (0,
|
|
29488
|
-
/* @__PURE__ */ (0,
|
|
29489
|
-
/* @__PURE__ */ (0,
|
|
30027
|
+
const renderMobileMenu = () => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenu, { children: [
|
|
30028
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenuTrigger, { className: "flex items-center gap-2 px-3 py-2 rounded-md bg-white/10 text-white text-sm", children: [
|
|
30029
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Menu, { className: "h-4 w-4" }),
|
|
29490
30030
|
"Menu"
|
|
29491
30031
|
] }),
|
|
29492
|
-
/* @__PURE__ */ (0,
|
|
30032
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29493
30033
|
DropdownMenuContent,
|
|
29494
30034
|
{
|
|
29495
30035
|
align: "start",
|
|
@@ -29498,25 +30038,25 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29498
30038
|
children: rawTabs.map((tab, i) => {
|
|
29499
30039
|
const hasChildren = Array.isArray(tab.children) && tab.children.length > 0 && tab.isDropDown;
|
|
29500
30040
|
if (hasChildren) {
|
|
29501
|
-
return /* @__PURE__ */ (0,
|
|
29502
|
-
/* @__PURE__ */ (0,
|
|
29503
|
-
/* @__PURE__ */ (0,
|
|
30041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DropdownMenuSub, { children: [
|
|
30042
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(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 }),
|
|
30043
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(DropdownMenuSubContent, { className: "bg-white border shadow-lg rounded-md p-1", children: tab.children.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29504
30044
|
DropdownMenuItem,
|
|
29505
30045
|
{
|
|
29506
30046
|
asChild: true,
|
|
29507
30047
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100",
|
|
29508
|
-
children: /* @__PURE__ */ (0,
|
|
30048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_link5.default, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
|
|
29509
30049
|
},
|
|
29510
30050
|
item.id || index
|
|
29511
30051
|
)) })
|
|
29512
30052
|
] }, i);
|
|
29513
30053
|
}
|
|
29514
|
-
return /* @__PURE__ */ (0,
|
|
30054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
29515
30055
|
DropdownMenuItem,
|
|
29516
30056
|
{
|
|
29517
30057
|
asChild: true,
|
|
29518
30058
|
className: "cursor-pointer rounded-sm px-3 py-2 text-[13px] text-gray-800 hover:bg-gray-100",
|
|
29519
|
-
children: /* @__PURE__ */ (0,
|
|
30059
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_link5.default, { href: tab.url || "#", onClick: (e) => handleBuilderExit(e, tab.url || "#"), children: tab.header })
|
|
29520
30060
|
},
|
|
29521
30061
|
i
|
|
29522
30062
|
);
|
|
@@ -29526,19 +30066,19 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29526
30066
|
] });
|
|
29527
30067
|
const forceMobile = canvasMode ? canvasMode === "mobile" || canvasMode === "tablet" : void 0;
|
|
29528
30068
|
const forceDesktop = canvasMode ? canvasMode === "desktop" : void 0;
|
|
29529
|
-
return /* @__PURE__ */ (0,
|
|
29530
|
-
/* @__PURE__ */ (0,
|
|
29531
|
-
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ (0,
|
|
29532
|
-
forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ (0,
|
|
30069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
30070
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className, style, children: [
|
|
30071
|
+
forceDesktop !== void 0 ? forceDesktop && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "hidden md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "hidden md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: `flex gap-2 ${verticalMenu ? "flex-col items-start" : "flex-row"}`, children: rawTabs.map(renderDesktopTab) }) }),
|
|
30072
|
+
forceMobile !== void 0 ? forceMobile && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { children: renderMobileMenu() }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex md:hidden", children: renderMobileMenu() })
|
|
29533
30073
|
] }),
|
|
29534
|
-
/* @__PURE__ */ (0,
|
|
29535
|
-
/* @__PURE__ */ (0,
|
|
29536
|
-
/* @__PURE__ */ (0,
|
|
29537
|
-
/* @__PURE__ */ (0,
|
|
30074
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DialogContent, { className: "bg-[#fff]", children: [
|
|
30075
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DialogHeader, { children: [
|
|
30076
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(DialogTitle, { children: "Exit Builder?" }),
|
|
30077
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
29538
30078
|
] }),
|
|
29539
|
-
/* @__PURE__ */ (0,
|
|
29540
|
-
/* @__PURE__ */ (0,
|
|
29541
|
-
/* @__PURE__ */ (0,
|
|
30079
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(DialogFooter, { children: [
|
|
30080
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
30081
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
29542
30082
|
] })
|
|
29543
30083
|
] }) })
|
|
29544
30084
|
] });
|
|
@@ -29546,18 +30086,18 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29546
30086
|
var Tabs_default = Tabs;
|
|
29547
30087
|
|
|
29548
30088
|
// src/components/Navigation/Stages/Stages.tsx
|
|
29549
|
-
var
|
|
29550
|
-
var
|
|
30089
|
+
var import_react30 = __toESM(require("react"));
|
|
30090
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
29551
30091
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage }) => {
|
|
29552
|
-
return /* @__PURE__ */ (0,
|
|
29553
|
-
/* @__PURE__ */ (0,
|
|
29554
|
-
/* @__PURE__ */ (0,
|
|
30092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center justify-between bg-red p-2 rounded-lg border border-gray-200 w-full", children: [
|
|
30093
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
30094
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center flex-1 px-2 flex-wrap gap-2", children: stages?.length > 0 && stages?.map((stage, index) => {
|
|
29555
30095
|
const currentIndex = stages.findIndex((s) => s.key === currentStage);
|
|
29556
30096
|
const isAllCompleted = currentStage === "completed";
|
|
29557
30097
|
const isCompleted = isAllCompleted || index < currentIndex;
|
|
29558
30098
|
const isActive = !isAllCompleted && index === currentIndex;
|
|
29559
|
-
return /* @__PURE__ */ (0,
|
|
29560
|
-
/* @__PURE__ */ (0,
|
|
30099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react30.default.Fragment, { children: [
|
|
30100
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
29561
30101
|
"button",
|
|
29562
30102
|
{
|
|
29563
30103
|
className: `
|
|
@@ -29571,18 +30111,15 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
29571
30111
|
children: stage.header
|
|
29572
30112
|
}
|
|
29573
30113
|
),
|
|
29574
|
-
index < stages.length - 1 && /* @__PURE__ */ (0,
|
|
30114
|
+
index < stages.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex-shrink-0 w-3 h-px bg-gray-300" })
|
|
29575
30115
|
] }, stage.id);
|
|
29576
30116
|
}) }),
|
|
29577
|
-
isShowBtn && /* @__PURE__ */ (0,
|
|
30117
|
+
isShowBtn && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
29578
30118
|
"button",
|
|
29579
30119
|
{
|
|
29580
30120
|
className: "bg-[#034486] text-white px-6 py-2 rounded-lg text-sm font-medium transition-colors duration-200 shadow-sm",
|
|
29581
30121
|
onClick: () => {
|
|
29582
|
-
|
|
29583
|
-
if (activeStage && onStageChange) {
|
|
29584
|
-
onStageChange("completed");
|
|
29585
|
-
}
|
|
30122
|
+
onStageChange?.("completed");
|
|
29586
30123
|
},
|
|
29587
30124
|
children: buttonText
|
|
29588
30125
|
}
|
|
@@ -29592,26 +30129,26 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
29592
30129
|
var Stages_default = StagesComponent;
|
|
29593
30130
|
|
|
29594
30131
|
// src/components/Navigation/Spacer/Spacer.tsx
|
|
29595
|
-
var
|
|
30132
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
29596
30133
|
var Spacer = ({ className, style }) => {
|
|
29597
|
-
return /* @__PURE__ */ (0,
|
|
30134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: `${className}`, style });
|
|
29598
30135
|
};
|
|
29599
30136
|
var Spacer_default = Spacer;
|
|
29600
30137
|
|
|
29601
30138
|
// src/components/Navigation/Profile/Profile.tsx
|
|
29602
|
-
var
|
|
30139
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
29603
30140
|
|
|
29604
30141
|
// src/components/Navigation/Notification/Notification.tsx
|
|
29605
|
-
var
|
|
30142
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
29606
30143
|
|
|
29607
30144
|
// src/components/Navigation/Logo/Logo.tsx
|
|
29608
|
-
var
|
|
30145
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
29609
30146
|
|
|
29610
30147
|
// src/components/ui/avatar.tsx
|
|
29611
30148
|
var React11 = __toESM(require("react"));
|
|
29612
30149
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
29613
|
-
var
|
|
29614
|
-
var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
30150
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
30151
|
+
var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
29615
30152
|
AvatarPrimitive.Root,
|
|
29616
30153
|
{
|
|
29617
30154
|
ref,
|
|
@@ -29623,7 +30160,7 @@ var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
29623
30160
|
}
|
|
29624
30161
|
));
|
|
29625
30162
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
29626
|
-
var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
30163
|
+
var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
29627
30164
|
AvatarPrimitive.Image,
|
|
29628
30165
|
{
|
|
29629
30166
|
ref,
|
|
@@ -29632,7 +30169,7 @@ var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
29632
30169
|
}
|
|
29633
30170
|
));
|
|
29634
30171
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
29635
|
-
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
30172
|
+
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
29636
30173
|
AvatarPrimitive.Fallback,
|
|
29637
30174
|
{
|
|
29638
30175
|
ref,
|
|
@@ -29647,11 +30184,11 @@ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
|
29647
30184
|
|
|
29648
30185
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
29649
30186
|
var import_link6 = __toESM(require("next/link"));
|
|
29650
|
-
var
|
|
30187
|
+
var import_image4 = __toESM(require("next/image"));
|
|
29651
30188
|
var import_navigation4 = require("next/navigation");
|
|
29652
30189
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
29653
|
-
var
|
|
29654
|
-
var
|
|
30190
|
+
var import_react31 = require("react");
|
|
30191
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
29655
30192
|
function Navbar({
|
|
29656
30193
|
style,
|
|
29657
30194
|
badgeType,
|
|
@@ -29671,9 +30208,9 @@ function Navbar({
|
|
|
29671
30208
|
}) {
|
|
29672
30209
|
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
29673
30210
|
const router = (0, import_navigation4.useRouter)();
|
|
29674
|
-
const [showExitDialog, setShowExitDialog] = (0,
|
|
29675
|
-
const [pendingUrl, setPendingUrl] = (0,
|
|
29676
|
-
const handleBuilderExit = (0,
|
|
30211
|
+
const [showExitDialog, setShowExitDialog] = (0, import_react31.useState)(false);
|
|
30212
|
+
const [pendingUrl, setPendingUrl] = (0, import_react31.useState)(null);
|
|
30213
|
+
const handleBuilderExit = (0, import_react31.useCallback)(
|
|
29677
30214
|
(e, url) => {
|
|
29678
30215
|
if (isBuilder) {
|
|
29679
30216
|
e.preventDefault();
|
|
@@ -29689,29 +30226,29 @@ function Navbar({
|
|
|
29689
30226
|
router.push(pendingUrl);
|
|
29690
30227
|
}
|
|
29691
30228
|
};
|
|
29692
|
-
const formatedMenu = (0,
|
|
30229
|
+
const formatedMenu = (0, import_react31.useMemo)(() => {
|
|
29693
30230
|
if (source === "state" && navList && navList.length) {
|
|
29694
30231
|
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
29695
30232
|
}
|
|
29696
30233
|
return list || [];
|
|
29697
30234
|
}, [source, navList]);
|
|
29698
|
-
return /* @__PURE__ */ (0,
|
|
29699
|
-
/* @__PURE__ */ (0,
|
|
30235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
30236
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29700
30237
|
"nav",
|
|
29701
30238
|
{
|
|
29702
30239
|
className: "w-full border-b border-b-white dark:border-b-gray-800 dark:bg-gray-800 bg-white shadow-sm",
|
|
29703
30240
|
style,
|
|
29704
|
-
children: /* @__PURE__ */ (0,
|
|
29705
|
-
/* @__PURE__ */ (0,
|
|
30241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
|
|
30242
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29706
30243
|
import_link6.default,
|
|
29707
30244
|
{
|
|
29708
30245
|
href: "/",
|
|
29709
30246
|
onClick: (e) => handleBuilderExit(e, "/"),
|
|
29710
30247
|
className: "flex items-center space-x-2",
|
|
29711
|
-
children: imageUrl ? /* @__PURE__ */ (0,
|
|
30248
|
+
children: imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_image4.default, { src: imageUrl, alt: altText, width: 200, height: 200 }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "font-semibold text-blue-700", children: "Logo" })
|
|
29712
30249
|
}
|
|
29713
30250
|
),
|
|
29714
|
-
!isMobileView && /* @__PURE__ */ (0,
|
|
30251
|
+
!isMobileView && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex items-center space-x-6 sm:hidden md:flex", children: formatedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29715
30252
|
import_link6.default,
|
|
29716
30253
|
{
|
|
29717
30254
|
href: item.url || "#",
|
|
@@ -29721,39 +30258,39 @@ function Navbar({
|
|
|
29721
30258
|
},
|
|
29722
30259
|
item.id
|
|
29723
30260
|
)) }),
|
|
29724
|
-
/* @__PURE__ */ (0,
|
|
29725
|
-
!isMobileView ? /* @__PURE__ */ (0,
|
|
29726
|
-
/* @__PURE__ */ (0,
|
|
29727
|
-
/* @__PURE__ */ (0,
|
|
29728
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
29729
|
-
/* @__PURE__ */ (0,
|
|
29730
|
-
/* @__PURE__ */ (0,
|
|
29731
|
-
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ (0,
|
|
30261
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
30262
|
+
!isMobileView ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex-1 px-6", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
|
|
30263
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
|
|
30264
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Input, { placeholder: "Search", className: "pl-9 text-gray-400" })
|
|
30265
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "ghost", size: "icon", className: "border border-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Search, { className: "h-5 w-5 text-gray-400" }) }),
|
|
30266
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
|
|
30267
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
|
|
30268
|
+
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("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__ */ (0, import_jsx_runtime64.jsx)("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
|
|
29732
30269
|
] }),
|
|
29733
|
-
/* @__PURE__ */ (0,
|
|
29734
|
-
/* @__PURE__ */ (0,
|
|
29735
|
-
!isMobileView && showName && /* @__PURE__ */ (0,
|
|
29736
|
-
!isMobileView ? /* @__PURE__ */ (0,
|
|
29737
|
-
/* @__PURE__ */ (0,
|
|
30270
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DropdownMenu, { children: [
|
|
30271
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
30272
|
+
!isMobileView && showName && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h4", { className: "text-[#000000] dark:text-gray-300 text-[13px] font-[500] mb-0", children: userName }),
|
|
30273
|
+
!isMobileView ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
30274
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Avatar, { className: "cursor-pointer h-8 w-8 text-gray-900", children: profileType === "avatar" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29738
30275
|
AvatarImage,
|
|
29739
30276
|
{
|
|
29740
30277
|
src: "/images/appbuilder/toolset/profile.svg",
|
|
29741
30278
|
alt: "Profile"
|
|
29742
30279
|
}
|
|
29743
|
-
) : /* @__PURE__ */ (0,
|
|
29744
|
-
/* @__PURE__ */ (0,
|
|
30280
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("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) }) }),
|
|
30281
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29745
30282
|
Button,
|
|
29746
30283
|
{
|
|
29747
30284
|
variant: "ghost",
|
|
29748
30285
|
size: "icon",
|
|
29749
30286
|
className: "text-gray-900 md:hidden dark:invert",
|
|
29750
|
-
children: /* @__PURE__ */ (0,
|
|
30287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Menu, { className: "h-6 w-6" })
|
|
29751
30288
|
}
|
|
29752
30289
|
)
|
|
29753
|
-
] }) : /* @__PURE__ */ (0,
|
|
30290
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "ghost", size: "icon", className: "text-gray-900 dark:invert", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Menu, { className: "h-6 w-6" }) })
|
|
29754
30291
|
] }) }),
|
|
29755
|
-
/* @__PURE__ */ (0,
|
|
29756
|
-
profileMenu && profileMenu.length > 0 && /* @__PURE__ */ (0,
|
|
30292
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
|
|
30293
|
+
profileMenu && profileMenu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: profileMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29757
30294
|
import_link6.default,
|
|
29758
30295
|
{
|
|
29759
30296
|
href: item.url || "#",
|
|
@@ -29761,9 +30298,9 @@ function Navbar({
|
|
|
29761
30298
|
children: item.header
|
|
29762
30299
|
}
|
|
29763
30300
|
) }, item.id)) }),
|
|
29764
|
-
/* @__PURE__ */ (0,
|
|
29765
|
-
/* @__PURE__ */ (0,
|
|
29766
|
-
formatedMenu && formatedMenu.length > 0 && /* @__PURE__ */ (0,
|
|
30301
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "md:hidden", children: [
|
|
30302
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_dropdown_menu.DropdownMenuSeparator, {}),
|
|
30303
|
+
formatedMenu && formatedMenu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: formatedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
29767
30304
|
import_link6.default,
|
|
29768
30305
|
{
|
|
29769
30306
|
href: item.url || "#",
|
|
@@ -29778,51 +30315,51 @@ function Navbar({
|
|
|
29778
30315
|
] })
|
|
29779
30316
|
}
|
|
29780
30317
|
),
|
|
29781
|
-
/* @__PURE__ */ (0,
|
|
29782
|
-
/* @__PURE__ */ (0,
|
|
29783
|
-
/* @__PURE__ */ (0,
|
|
29784
|
-
/* @__PURE__ */ (0,
|
|
30318
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Dialog, { open: showExitDialog, onOpenChange: setShowExitDialog, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DialogContent, { className: "bg-[#fff]", children: [
|
|
30319
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DialogHeader, { children: [
|
|
30320
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DialogTitle, { children: "Exit Builder?" }),
|
|
30321
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
29785
30322
|
] }),
|
|
29786
|
-
/* @__PURE__ */ (0,
|
|
29787
|
-
/* @__PURE__ */ (0,
|
|
29788
|
-
/* @__PURE__ */ (0,
|
|
30323
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(DialogFooter, { children: [
|
|
30324
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
30325
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
29789
30326
|
] })
|
|
29790
30327
|
] }) })
|
|
29791
30328
|
] });
|
|
29792
30329
|
}
|
|
29793
30330
|
|
|
29794
30331
|
// src/components/Chart/BarChart.tsx
|
|
29795
|
-
var
|
|
30332
|
+
var import_react32 = __toESM(require("react"));
|
|
29796
30333
|
var import_recharts = require("recharts");
|
|
29797
|
-
var
|
|
30334
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
29798
30335
|
var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
29799
30336
|
const data = Array.isArray(props.data) ? props.data : [];
|
|
29800
30337
|
const chartType = props.chartType || "bar";
|
|
29801
30338
|
const legendsPosition = props.legendsPosition === "middle" || props.legendsPosition === "bottom" ? props.legendsPosition : "top";
|
|
29802
30339
|
if (loading || data.length === 0) {
|
|
29803
|
-
return /* @__PURE__ */ (0,
|
|
30340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
29804
30341
|
"div",
|
|
29805
30342
|
{
|
|
29806
30343
|
className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
|
|
29807
30344
|
style,
|
|
29808
|
-
children: /* @__PURE__ */ (0,
|
|
30345
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
|
|
29809
30346
|
}
|
|
29810
30347
|
);
|
|
29811
30348
|
}
|
|
29812
|
-
return /* @__PURE__ */ (0,
|
|
29813
|
-
/* @__PURE__ */ (0,
|
|
29814
|
-
/* @__PURE__ */ (0,
|
|
29815
|
-
/* @__PURE__ */ (0,
|
|
29816
|
-
/* @__PURE__ */ (0,
|
|
29817
|
-
/* @__PURE__ */ (0,
|
|
29818
|
-
/* @__PURE__ */ (0,
|
|
30349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: `${className} h-[400px]`, style, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_recharts.BarChart, { data, title: "Leads", desc: "content", children: [
|
|
30350
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
30351
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.XAxis, { dataKey: "name" }),
|
|
30352
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.YAxis, {}),
|
|
30353
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.Tooltip, { formatter: (value) => `${value}k` }),
|
|
30354
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.Legend, { verticalAlign: legendsPosition, align: "center" }),
|
|
30355
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
29819
30356
|
import_recharts.Bar,
|
|
29820
30357
|
{
|
|
29821
30358
|
dataKey: "value",
|
|
29822
30359
|
fill: "#00695C",
|
|
29823
30360
|
radius: [6, 6, 0, 0],
|
|
29824
30361
|
isAnimationActive: false,
|
|
29825
|
-
children: data.map((entry, index) => /* @__PURE__ */ (0,
|
|
30362
|
+
children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
29826
30363
|
"rect",
|
|
29827
30364
|
{
|
|
29828
30365
|
fill: entry.color || "#00695C"
|
|
@@ -29831,16 +30368,16 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
29831
30368
|
))
|
|
29832
30369
|
}
|
|
29833
30370
|
)
|
|
29834
|
-
] }) : /* @__PURE__ */ (0,
|
|
29835
|
-
/* @__PURE__ */ (0,
|
|
29836
|
-
/* @__PURE__ */ (0,
|
|
29837
|
-
/* @__PURE__ */ (0,
|
|
30371
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_recharts.AreaChart, { data, children: [
|
|
30372
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
30373
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
|
|
30374
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("stop", { offset: "95%", stopColor: "#00695C", stopOpacity: 0 })
|
|
29838
30375
|
] }) }),
|
|
29839
|
-
/* @__PURE__ */ (0,
|
|
29840
|
-
/* @__PURE__ */ (0,
|
|
29841
|
-
/* @__PURE__ */ (0,
|
|
29842
|
-
/* @__PURE__ */ (0,
|
|
29843
|
-
/* @__PURE__ */ (0,
|
|
30376
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
30377
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.XAxis, { dataKey: "name" }),
|
|
30378
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.YAxis, {}),
|
|
30379
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_recharts.Tooltip, { formatter: (value) => `${value}k` }),
|
|
30380
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
29844
30381
|
import_recharts.Area,
|
|
29845
30382
|
{
|
|
29846
30383
|
type: "monotone",
|
|
@@ -29853,12 +30390,12 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
29853
30390
|
)
|
|
29854
30391
|
] }) }) });
|
|
29855
30392
|
};
|
|
29856
|
-
var BarChart_default =
|
|
30393
|
+
var BarChart_default = import_react32.default.memo(ChartComponent);
|
|
29857
30394
|
|
|
29858
30395
|
// src/components/Chart/PieChart.tsx
|
|
29859
|
-
var
|
|
30396
|
+
var import_react33 = __toESM(require("react"));
|
|
29860
30397
|
var import_recharts2 = require("recharts");
|
|
29861
|
-
var
|
|
30398
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
29862
30399
|
var getRandomColor = () => {
|
|
29863
30400
|
const palette = [
|
|
29864
30401
|
"#2563eb",
|
|
@@ -29878,32 +30415,32 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29878
30415
|
const showLegends = props.showLegends ?? true;
|
|
29879
30416
|
const labelType = props.labelType || "inside";
|
|
29880
30417
|
const canvasMode = props.canvasMode;
|
|
29881
|
-
const data = (0,
|
|
30418
|
+
const data = (0, import_react33.useMemo)(() => {
|
|
29882
30419
|
if (!Array.isArray(props.data)) return [];
|
|
29883
30420
|
return props.data.map((item) => ({ ...item, color: getRandomColor() }));
|
|
29884
30421
|
}, [props.data]);
|
|
29885
|
-
const total = (0,
|
|
30422
|
+
const total = (0, import_react33.useMemo)(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
|
|
29886
30423
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
29887
|
-
const [mounted, setMounted] = (0,
|
|
29888
|
-
(0,
|
|
30424
|
+
const [mounted, setMounted] = (0, import_react33.useState)(false);
|
|
30425
|
+
(0, import_react33.useEffect)(() => {
|
|
29889
30426
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
29890
30427
|
return () => clearTimeout(timeout);
|
|
29891
30428
|
}, []);
|
|
29892
|
-
const renderLegends = (0,
|
|
30429
|
+
const renderLegends = (0, import_react33.useMemo)(() => {
|
|
29893
30430
|
if (!showLegends) return null;
|
|
29894
|
-
return /* @__PURE__ */ (0,
|
|
30431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: data.map((d) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
29895
30432
|
"div",
|
|
29896
30433
|
{
|
|
29897
30434
|
className: "flex items-center space-x-2 rounded-md border border-gray-200 px-3 py-2 w-[48%] md:w-auto",
|
|
29898
30435
|
children: [
|
|
29899
|
-
/* @__PURE__ */ (0,
|
|
30436
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
29900
30437
|
"span",
|
|
29901
30438
|
{
|
|
29902
30439
|
className: "inline-block w-[16px] h-[16px] rounded",
|
|
29903
30440
|
style: { backgroundColor: d.color }
|
|
29904
30441
|
}
|
|
29905
30442
|
),
|
|
29906
|
-
/* @__PURE__ */ (0,
|
|
30443
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "text-[#000000] text-[12px] md:text-[13px] font-[500]", children: d.name })
|
|
29907
30444
|
]
|
|
29908
30445
|
},
|
|
29909
30446
|
d.name
|
|
@@ -29911,24 +30448,24 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29911
30448
|
}, [data, showLegends]);
|
|
29912
30449
|
if (!mounted) return null;
|
|
29913
30450
|
if (loading || data.length === 0) {
|
|
29914
|
-
return /* @__PURE__ */ (0,
|
|
30451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
29915
30452
|
"div",
|
|
29916
30453
|
{
|
|
29917
30454
|
className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
|
|
29918
30455
|
style,
|
|
29919
|
-
children: /* @__PURE__ */ (0,
|
|
30456
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
|
|
29920
30457
|
}
|
|
29921
30458
|
);
|
|
29922
30459
|
}
|
|
29923
|
-
return /* @__PURE__ */ (0,
|
|
30460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
29924
30461
|
"div",
|
|
29925
30462
|
{
|
|
29926
30463
|
className: `relative flex flex-col items-center ${className}`,
|
|
29927
30464
|
style,
|
|
29928
30465
|
children: [
|
|
29929
|
-
/* @__PURE__ */ (0,
|
|
29930
|
-
/* @__PURE__ */ (0,
|
|
29931
|
-
/* @__PURE__ */ (0,
|
|
30466
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative w-full md:w-[70%] h-[300px] md:h-[400px] flex items-center justify-center", children: [
|
|
30467
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_recharts2.ResponsiveContainer, { width: "99%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_recharts2.PieChart, { children: [
|
|
30468
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
29932
30469
|
import_recharts2.Pie,
|
|
29933
30470
|
{
|
|
29934
30471
|
data,
|
|
@@ -29940,8 +30477,8 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29940
30477
|
labelLine: false,
|
|
29941
30478
|
isAnimationActive: false,
|
|
29942
30479
|
children: [
|
|
29943
|
-
data.map((entry, index) => /* @__PURE__ */ (0,
|
|
29944
|
-
/* @__PURE__ */ (0,
|
|
30480
|
+
data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_recharts2.Cell, { fill: entry.color }, `cell-${index}`)),
|
|
30481
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
29945
30482
|
import_recharts2.LabelList,
|
|
29946
30483
|
{
|
|
29947
30484
|
dataKey: "value",
|
|
@@ -29954,14 +30491,14 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29954
30491
|
]
|
|
29955
30492
|
}
|
|
29956
30493
|
),
|
|
29957
|
-
/* @__PURE__ */ (0,
|
|
30494
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
29958
30495
|
import_recharts2.Tooltip,
|
|
29959
30496
|
{
|
|
29960
30497
|
formatter: (value, name) => [`${value}k`, name]
|
|
29961
30498
|
}
|
|
29962
30499
|
)
|
|
29963
30500
|
] }) }),
|
|
29964
|
-
/* @__PURE__ */ (0,
|
|
30501
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
29965
30502
|
"div",
|
|
29966
30503
|
{
|
|
29967
30504
|
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]`,
|
|
@@ -29972,18 +30509,18 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
29972
30509
|
}
|
|
29973
30510
|
)
|
|
29974
30511
|
] }),
|
|
29975
|
-
/* @__PURE__ */ (0,
|
|
30512
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex flex-wrap justify-center gap-2 mt-6 w-full md:w-auto", children: renderLegends })
|
|
29976
30513
|
]
|
|
29977
30514
|
}
|
|
29978
30515
|
);
|
|
29979
30516
|
};
|
|
29980
|
-
var PieChart_default =
|
|
30517
|
+
var PieChart_default = import_react33.default.memo(DonutChart);
|
|
29981
30518
|
|
|
29982
30519
|
// src/components/Blocks/EmailComposer.tsx
|
|
29983
|
-
var
|
|
30520
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
29984
30521
|
function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc, setShowBcc, cc, setCc, bcc, setBcc, subject, setSubject, body, setBody }) {
|
|
29985
|
-
return /* @__PURE__ */ (0,
|
|
29986
|
-
/* @__PURE__ */ (0,
|
|
30522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "border rounded-md shadow bg-[#fff] p-4 mx-auto z-[50] relative", children: [
|
|
30523
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
29987
30524
|
"input",
|
|
29988
30525
|
{
|
|
29989
30526
|
type: "email",
|
|
@@ -29992,8 +30529,8 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
29992
30529
|
required: true
|
|
29993
30530
|
}
|
|
29994
30531
|
) }),
|
|
29995
|
-
/* @__PURE__ */ (0,
|
|
29996
|
-
/* @__PURE__ */ (0,
|
|
30532
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
30533
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
29997
30534
|
"input",
|
|
29998
30535
|
{
|
|
29999
30536
|
type: "email",
|
|
@@ -30004,7 +30541,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
30004
30541
|
required: true
|
|
30005
30542
|
}
|
|
30006
30543
|
),
|
|
30007
|
-
!showCc && /* @__PURE__ */ (0,
|
|
30544
|
+
!showCc && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
30008
30545
|
"button",
|
|
30009
30546
|
{
|
|
30010
30547
|
onClick: () => setShowCc?.(true),
|
|
@@ -30012,7 +30549,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
30012
30549
|
children: "Cc"
|
|
30013
30550
|
}
|
|
30014
30551
|
),
|
|
30015
|
-
!showBcc && /* @__PURE__ */ (0,
|
|
30552
|
+
!showBcc && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
30016
30553
|
"button",
|
|
30017
30554
|
{
|
|
30018
30555
|
onClick: () => setShowBcc?.(true),
|
|
@@ -30021,7 +30558,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
30021
30558
|
}
|
|
30022
30559
|
)
|
|
30023
30560
|
] }) }),
|
|
30024
|
-
showCc && /* @__PURE__ */ (0,
|
|
30561
|
+
showCc && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
30025
30562
|
"input",
|
|
30026
30563
|
{
|
|
30027
30564
|
type: "text",
|
|
@@ -30031,7 +30568,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
30031
30568
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
30032
30569
|
}
|
|
30033
30570
|
) }),
|
|
30034
|
-
showBcc && /* @__PURE__ */ (0,
|
|
30571
|
+
showBcc && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
30035
30572
|
"input",
|
|
30036
30573
|
{
|
|
30037
30574
|
type: "text",
|
|
@@ -30041,7 +30578,7 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
30041
30578
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
30042
30579
|
}
|
|
30043
30580
|
) }),
|
|
30044
|
-
/* @__PURE__ */ (0,
|
|
30581
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
30045
30582
|
"input",
|
|
30046
30583
|
{
|
|
30047
30584
|
type: "text",
|
|
@@ -30051,11 +30588,11 @@ function EmailComposer({ className, style, to, setTo, showCc, setShowCc, showBcc
|
|
|
30051
30588
|
className: "w-full flex-1 border-2 rounded-md h-[40px] px-3 focus:outline-none border-[#E9E9E9] text-[#383838]"
|
|
30052
30589
|
}
|
|
30053
30590
|
) }),
|
|
30054
|
-
/* @__PURE__ */ (0,
|
|
30055
|
-
/* @__PURE__ */ (0,
|
|
30056
|
-
/* @__PURE__ */ (0,
|
|
30057
|
-
/* @__PURE__ */ (0,
|
|
30058
|
-
/* @__PURE__ */ (0,
|
|
30591
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(MyEditor, { value: body, onChange: setBody }) }),
|
|
30592
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex justify-end gap-2", children: [
|
|
30593
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { className: "px-4 py-2 rounded-md text-gray-600 hover:bg-gray-100", children: "Discard" }),
|
|
30594
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { className: "px-4 py-2 rounded-md border text-[#12715B] border-[#12715B]", children: "Reset" }),
|
|
30595
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { className: "px-4 py-2 rounded-md bg-[#12715B] text-white", children: "Send" })
|
|
30059
30596
|
] })
|
|
30060
30597
|
] }) });
|
|
30061
30598
|
}
|
|
@@ -30100,10 +30637,10 @@ function showSonnerToast({
|
|
|
30100
30637
|
// src/components/ui/sonner.tsx
|
|
30101
30638
|
var import_next_themes = require("next-themes");
|
|
30102
30639
|
var import_sonner2 = require("sonner");
|
|
30103
|
-
var
|
|
30640
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
30104
30641
|
var Toaster = ({ ...props }) => {
|
|
30105
30642
|
const { theme = "system" } = (0, import_next_themes.useTheme)();
|
|
30106
|
-
return /* @__PURE__ */ (0,
|
|
30643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
30107
30644
|
import_sonner2.Toaster,
|
|
30108
30645
|
{
|
|
30109
30646
|
theme,
|