@eztrak/shared 0.15.3 → 0.16.1
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/{chunk-QM2TGUZN.mjs → chunk-DFGYKOJF.mjs} +540 -125
- package/dist/chunk-DFGYKOJF.mjs.map +1 -0
- package/dist/components/index.d.mts +98 -2
- package/dist/components/index.d.ts +98 -2
- package/dist/components/index.js +550 -130
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +550 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
- package/dist/chunk-QM2TGUZN.mjs.map +0 -1
- package/dist/components/index.css +0 -21
- package/dist/components/index.css.map +0 -1
- package/dist/index.css +0 -21
- package/dist/index.css.map +0 -1
package/dist/index.js
CHANGED
|
@@ -31,11 +31,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ActionMenuItem: () => ActionMenuItem,
|
|
34
|
+
Breadcrumbs: () => Breadcrumbs,
|
|
35
|
+
Button: () => Button,
|
|
36
|
+
Card: () => Card,
|
|
34
37
|
CardSkeleton: () => CardSkeleton,
|
|
35
38
|
CustomCellEditor: () => CustomCellEditor,
|
|
36
39
|
CustomPagination: () => CustomPagination,
|
|
37
40
|
DropdownFilter: () => DropdownFilter,
|
|
38
41
|
EztrakTabs: () => EztrakTabs,
|
|
42
|
+
Header: () => Header,
|
|
39
43
|
Loader: () => Loader,
|
|
40
44
|
Modal: () => Modal,
|
|
41
45
|
PopupCellRenderer: () => PopupCellRenderer,
|
|
@@ -48,6 +52,7 @@ __export(src_exports, {
|
|
|
48
52
|
ResetFiltersButton: () => ResetFiltersButton,
|
|
49
53
|
RowActions: () => RowActions,
|
|
50
54
|
SearchInput: () => SearchInput,
|
|
55
|
+
Sidebar: () => Sidebar,
|
|
51
56
|
TableErrorBoundary: () => TableErrorBoundary,
|
|
52
57
|
TableLayoutToolbarControls: () => TableLayoutToolbarControls,
|
|
53
58
|
ToolTip: () => ToolTip,
|
|
@@ -1525,6 +1530,9 @@ var import_react_dom = require("react-dom");
|
|
|
1525
1530
|
var import_fa = require("react-icons/fa");
|
|
1526
1531
|
var import_io5 = require("react-icons/io5");
|
|
1527
1532
|
|
|
1533
|
+
// src/components/Loader/Loader.css
|
|
1534
|
+
var import_loader = require("@eztrak/shared/components/loader.css");
|
|
1535
|
+
|
|
1528
1536
|
// src/components/Loader/Loader.tsx
|
|
1529
1537
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1530
1538
|
var Loader = ({ className, color = "#F54C00", size = "50px", speed = "1s" }) => {
|
|
@@ -1722,8 +1730,473 @@ function Modal({
|
|
|
1722
1730
|
return (0, import_react_dom.createPortal)(modalContent, modalRoot);
|
|
1723
1731
|
}
|
|
1724
1732
|
|
|
1725
|
-
// src/components/
|
|
1733
|
+
// src/components/button/Button.tsx
|
|
1734
|
+
var import_react7 = require("react");
|
|
1726
1735
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1736
|
+
var BASE_STYLES2 = "flex gap-1 items-center font-medium text-sm px-5 py-3 rounded-md transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
1737
|
+
var VARIANTS2 = {
|
|
1738
|
+
primary: "bg-white text-secondary border-secondary hover:bg-lightGray hover:text-black",
|
|
1739
|
+
"primary-outline": "bg-white text-primary-150 border-primary-150 hover:bg-primary-100 hover:text-white font-bold",
|
|
1740
|
+
"primary-fill": "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1741
|
+
secondary: "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1742
|
+
danger: "bg-red-600 text-white border-red-600 hover:bg-red-700",
|
|
1743
|
+
outline: "bg-white text-primary border-primary hover:bg-primary/10",
|
|
1744
|
+
ghost: "bg-transparent text-secondary border-transparent hover:bg-primary/10 p-2",
|
|
1745
|
+
inline: "bg-transparent text-gray-500 border-none hover:text-gray-600 underline shadow-none p-0 m-0"
|
|
1746
|
+
};
|
|
1747
|
+
var SIZES = {
|
|
1748
|
+
sm: "px-3 py-2 text-xs",
|
|
1749
|
+
md: "px-5 py-3 text-sm",
|
|
1750
|
+
lg: "px-6 py-4 text-base"
|
|
1751
|
+
};
|
|
1752
|
+
var Button = (0, import_react7.forwardRef)(
|
|
1753
|
+
({
|
|
1754
|
+
children,
|
|
1755
|
+
className = "",
|
|
1756
|
+
type = "button",
|
|
1757
|
+
onClick,
|
|
1758
|
+
disabled = false,
|
|
1759
|
+
variant = "primary",
|
|
1760
|
+
size = "md",
|
|
1761
|
+
...props
|
|
1762
|
+
}, ref) => {
|
|
1763
|
+
const variantStyles = VARIANTS2[variant] || VARIANTS2.primary;
|
|
1764
|
+
const sizeStyles = SIZES[size];
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1766
|
+
"button",
|
|
1767
|
+
{
|
|
1768
|
+
ref,
|
|
1769
|
+
type,
|
|
1770
|
+
className: cn(
|
|
1771
|
+
BASE_STYLES2,
|
|
1772
|
+
variantStyles,
|
|
1773
|
+
size !== "md" && sizeStyles,
|
|
1774
|
+
className
|
|
1775
|
+
),
|
|
1776
|
+
onClick,
|
|
1777
|
+
disabled,
|
|
1778
|
+
...props,
|
|
1779
|
+
children
|
|
1780
|
+
}
|
|
1781
|
+
);
|
|
1782
|
+
}
|
|
1783
|
+
);
|
|
1784
|
+
Button.displayName = "Button";
|
|
1785
|
+
|
|
1786
|
+
// src/components/card/Card.tsx
|
|
1787
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1788
|
+
function Card({
|
|
1789
|
+
title,
|
|
1790
|
+
content,
|
|
1791
|
+
icon,
|
|
1792
|
+
onClick,
|
|
1793
|
+
containerClassName = "shadow p-6",
|
|
1794
|
+
iconClassName = "",
|
|
1795
|
+
titleClassName = "",
|
|
1796
|
+
contentClassName = "",
|
|
1797
|
+
cardBodyClassName = ""
|
|
1798
|
+
}) {
|
|
1799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1800
|
+
"div",
|
|
1801
|
+
{
|
|
1802
|
+
className: cn(
|
|
1803
|
+
"transform transition duration-300 cursor-pointer select-none",
|
|
1804
|
+
containerClassName
|
|
1805
|
+
),
|
|
1806
|
+
onClick,
|
|
1807
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("flex space-x-4", cardBodyClassName), children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("text-primary text-3xl", iconClassName), children: icon }),
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: cn("font-semibold text-lg text-primary", titleClassName), children: title }),
|
|
1811
|
+
content != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: cn("text-sm text-secondary", contentClassName), children: content })
|
|
1812
|
+
] })
|
|
1813
|
+
] })
|
|
1814
|
+
}
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
// src/components/header/Header.tsx
|
|
1819
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1820
|
+
function Header({
|
|
1821
|
+
title = "Header",
|
|
1822
|
+
className = "p-2 gap-2 flex-col",
|
|
1823
|
+
containerClass = "",
|
|
1824
|
+
breadcrumbs = "",
|
|
1825
|
+
titleStyle = "text-4xl h-fit font-bold",
|
|
1826
|
+
breadcrumbsStyle = "text-sm",
|
|
1827
|
+
children
|
|
1828
|
+
}) {
|
|
1829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex ${className}`, children: [
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "title-wrapper", children: [
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: titleStyle, children: title }),
|
|
1832
|
+
breadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `breadcrumbs-wraper ${breadcrumbsStyle}`, children: breadcrumbs })
|
|
1833
|
+
] }),
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex flex-row justify-between items-center ${containerClass}`, children })
|
|
1835
|
+
] });
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
// src/components/breadcrumbs/Breadcrumbs.tsx
|
|
1839
|
+
var import_react8 = require("react");
|
|
1840
|
+
var import_react_router_dom5 = require("react-router-dom");
|
|
1841
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1842
|
+
var INACTIVE_LINK_CLASS = "inline-flex items-center justify-center text-[#5D6D7F] bg-white px-4 py-2 rounded-lg transition-colors duration-300 hover:text-[#516378]";
|
|
1843
|
+
function asTitleMap(customTitles) {
|
|
1844
|
+
if (Object.prototype.toString.call(customTitles) !== "[object Object]") {
|
|
1845
|
+
return {};
|
|
1846
|
+
}
|
|
1847
|
+
return customTitles;
|
|
1848
|
+
}
|
|
1849
|
+
function findRoute(pathname, routes, parentPath = "") {
|
|
1850
|
+
for (const route of routes) {
|
|
1851
|
+
const fullPath = `${parentPath}/${route.path}`.replace(/\/+/g, "/");
|
|
1852
|
+
if (fullPath === pathname) {
|
|
1853
|
+
return route;
|
|
1854
|
+
}
|
|
1855
|
+
if (route.children) {
|
|
1856
|
+
const childRoute = findRoute(pathname, route.children, fullPath);
|
|
1857
|
+
if (childRoute) {
|
|
1858
|
+
return childRoute;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
return null;
|
|
1863
|
+
}
|
|
1864
|
+
function getLastParam(str) {
|
|
1865
|
+
return str.endsWith("/") ? str.slice(0, -1).split("/").pop() : str.split("/").pop();
|
|
1866
|
+
}
|
|
1867
|
+
function Breadcrumbs({
|
|
1868
|
+
routes = [],
|
|
1869
|
+
containerClassName,
|
|
1870
|
+
linkClassName = "",
|
|
1871
|
+
separatorClassName = "",
|
|
1872
|
+
separator = "/",
|
|
1873
|
+
activeClassName = "font-bold whitespace-pre",
|
|
1874
|
+
customTitles = {},
|
|
1875
|
+
customIcons = {},
|
|
1876
|
+
prefix,
|
|
1877
|
+
suffix,
|
|
1878
|
+
nonClickablePaths = []
|
|
1879
|
+
}) {
|
|
1880
|
+
const location = (0, import_react_router_dom5.useLocation)();
|
|
1881
|
+
const pathnames = location.pathname.split("/").filter((segment) => segment);
|
|
1882
|
+
const titles = asTitleMap(customTitles);
|
|
1883
|
+
const inactiveLinkClassName = cn(INACTIVE_LINK_CLASS, linkClassName);
|
|
1884
|
+
const getTitle = (pathname) => {
|
|
1885
|
+
const match = findRoute(pathname, routes);
|
|
1886
|
+
if (match && match.title) {
|
|
1887
|
+
return match.title;
|
|
1888
|
+
}
|
|
1889
|
+
const titleKeys = Object.keys(titles);
|
|
1890
|
+
const paramMatch = pathname.split("/").find((segment) => titleKeys.includes(segment)) || "";
|
|
1891
|
+
if (paramMatch && titles[paramMatch]) {
|
|
1892
|
+
return titles[paramMatch];
|
|
1893
|
+
}
|
|
1894
|
+
const lastParamPath = getLastParam(pathname);
|
|
1895
|
+
if (lastParamPath) {
|
|
1896
|
+
return lastParamPath;
|
|
1897
|
+
}
|
|
1898
|
+
return pathname;
|
|
1899
|
+
};
|
|
1900
|
+
const getIcon = (pathname) => {
|
|
1901
|
+
const iconKeys = Object.keys(customIcons);
|
|
1902
|
+
const matchedSegment = pathname.split("/").find((segment) => iconKeys.includes(segment));
|
|
1903
|
+
if (matchedSegment && customIcons[matchedSegment]) {
|
|
1904
|
+
return customIcons[matchedSegment];
|
|
1905
|
+
}
|
|
1906
|
+
return null;
|
|
1907
|
+
};
|
|
1908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1909
|
+
"div",
|
|
1910
|
+
{
|
|
1911
|
+
className: cn(
|
|
1912
|
+
"flex flex-row gap-2 items-center text-sm text-secondary",
|
|
1913
|
+
containerClassName
|
|
1914
|
+
),
|
|
1915
|
+
children: [
|
|
1916
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "breadcrumb-prefix", children: prefix }),
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_router_dom5.Link, { to: "/", className: inactiveLinkClassName, children: [
|
|
1918
|
+
customIcons.home && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-1", children: customIcons.home }),
|
|
1919
|
+
titles.home || "Home"
|
|
1920
|
+
] }),
|
|
1921
|
+
pathnames.map((segment, index) => {
|
|
1922
|
+
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
|
|
1923
|
+
const isLast = index === pathnames.length - 1;
|
|
1924
|
+
const title = getTitle(to);
|
|
1925
|
+
const icon = getIcon(to);
|
|
1926
|
+
const isNonClickable = nonClickablePaths.some(
|
|
1927
|
+
(token) => to.includes(token) || segment === token
|
|
1928
|
+
);
|
|
1929
|
+
const crumb = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1930
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-1", children: icon }),
|
|
1931
|
+
title
|
|
1932
|
+
] });
|
|
1933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react8.Fragment, { children: [
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: separatorClassName, children: separator }),
|
|
1935
|
+
isLast || isNonClickable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: isLast ? activeClassName : linkClassName, children: crumb }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_router_dom5.Link, { to, className: inactiveLinkClassName, children: crumb })
|
|
1936
|
+
] }, to);
|
|
1937
|
+
}),
|
|
1938
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "breadcrumb-suffix", children: suffix })
|
|
1939
|
+
]
|
|
1940
|
+
}
|
|
1941
|
+
);
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
// src/components/sidebar/Sidebar.tsx
|
|
1945
|
+
var import_react10 = require("react");
|
|
1946
|
+
var import_react_router_dom6 = require("react-router-dom");
|
|
1947
|
+
|
|
1948
|
+
// src/components/tooltip/ToolTip.tsx
|
|
1949
|
+
var import_react9 = require("react");
|
|
1950
|
+
var import_react_tooltip = require("react-tooltip");
|
|
1951
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1952
|
+
var defaultTooltipStyle = {
|
|
1953
|
+
color: "#fff",
|
|
1954
|
+
borderRadius: "5px",
|
|
1955
|
+
zIndex: 999,
|
|
1956
|
+
textAlign: "justify",
|
|
1957
|
+
maxWidth: "300px",
|
|
1958
|
+
whiteSpace: "pre-wrap",
|
|
1959
|
+
wordWrap: "break-word",
|
|
1960
|
+
overflowWrap: "break-word"
|
|
1961
|
+
};
|
|
1962
|
+
function ToolTip({
|
|
1963
|
+
text = "tool tip",
|
|
1964
|
+
placement = "top",
|
|
1965
|
+
delayShow,
|
|
1966
|
+
delayHide,
|
|
1967
|
+
className,
|
|
1968
|
+
tooltipClassName,
|
|
1969
|
+
tooltipStyle,
|
|
1970
|
+
wrapperTabIndex,
|
|
1971
|
+
disabled = false,
|
|
1972
|
+
children
|
|
1973
|
+
}) {
|
|
1974
|
+
const generatedId = (0, import_react9.useId)();
|
|
1975
|
+
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1976
|
+
const tooltipText = String(text ?? "");
|
|
1977
|
+
if (disabled || !tooltipText) {
|
|
1978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className, children });
|
|
1979
|
+
}
|
|
1980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1982
|
+
"span",
|
|
1983
|
+
{
|
|
1984
|
+
className,
|
|
1985
|
+
"data-tooltip-id": tooltipId,
|
|
1986
|
+
"data-tooltip-content": tooltipText,
|
|
1987
|
+
tabIndex: wrapperTabIndex,
|
|
1988
|
+
children
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1992
|
+
import_react_tooltip.Tooltip,
|
|
1993
|
+
{
|
|
1994
|
+
id: tooltipId,
|
|
1995
|
+
place: placement,
|
|
1996
|
+
positionStrategy: "fixed",
|
|
1997
|
+
delayShow,
|
|
1998
|
+
delayHide,
|
|
1999
|
+
className: tooltipClassName,
|
|
2000
|
+
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
2001
|
+
}
|
|
2002
|
+
)
|
|
2003
|
+
] });
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
// src/components/sidebar/Sidebar.tsx
|
|
2007
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2008
|
+
function Sidebar({
|
|
2009
|
+
className,
|
|
2010
|
+
sideCollapseWidth = "w-20",
|
|
2011
|
+
sidebarWidth = "w-48",
|
|
2012
|
+
header,
|
|
2013
|
+
children,
|
|
2014
|
+
footer,
|
|
2015
|
+
items = [],
|
|
2016
|
+
logoUrl = "",
|
|
2017
|
+
logoAltText = "Logo",
|
|
2018
|
+
collapseButtonText = "\u2B05\uFE0F Collapse",
|
|
2019
|
+
expandButtonText = "\u27A1\uFE0F",
|
|
2020
|
+
location: _location,
|
|
2021
|
+
classNames = {},
|
|
2022
|
+
onCollapseChange,
|
|
2023
|
+
isCollapsed = false,
|
|
2024
|
+
itemDropdownIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u25BC" }),
|
|
2025
|
+
...rest
|
|
2026
|
+
}) {
|
|
2027
|
+
const location = (0, import_react_router_dom6.useLocation)();
|
|
2028
|
+
const [collapsed, setCollapsed] = (0, import_react10.useState)(isCollapsed);
|
|
2029
|
+
const [, setActiveLink] = (0, import_react10.useState)(location.pathname);
|
|
2030
|
+
const [subItemsCollapsed, setSubItemsCollapsed] = (0, import_react10.useState)({});
|
|
2031
|
+
(0, import_react10.useEffect)(() => {
|
|
2032
|
+
if (onCollapseChange) {
|
|
2033
|
+
onCollapseChange(collapsed);
|
|
2034
|
+
}
|
|
2035
|
+
}, [collapsed, onCollapseChange]);
|
|
2036
|
+
(0, import_react10.useEffect)(() => {
|
|
2037
|
+
setActiveLink(location.pathname);
|
|
2038
|
+
}, [location]);
|
|
2039
|
+
const toggleGroup = (group) => {
|
|
2040
|
+
setSubItemsCollapsed((prevState) => ({
|
|
2041
|
+
...prevState,
|
|
2042
|
+
[group]: !prevState[group]
|
|
2043
|
+
}));
|
|
2044
|
+
};
|
|
2045
|
+
const isActive = (link) => {
|
|
2046
|
+
return location.pathname.startsWith(link);
|
|
2047
|
+
};
|
|
2048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2049
|
+
"div",
|
|
2050
|
+
{
|
|
2051
|
+
className: `flex flex-col h-screen overflow-hidden ${collapsed ? `${sideCollapseWidth} justify-center items-center collapsed` : `${sidebarWidth}`} transition-all duration-100 ${className ?? ""}`,
|
|
2052
|
+
...rest,
|
|
2053
|
+
children: [
|
|
2054
|
+
logoUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2055
|
+
"div",
|
|
2056
|
+
{
|
|
2057
|
+
className: cn(
|
|
2058
|
+
"flex items-center justify-center h-16 border-b border-gray-300",
|
|
2059
|
+
classNames.logoSection
|
|
2060
|
+
),
|
|
2061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: logoUrl, alt: logoAltText, className: "h-10" })
|
|
2062
|
+
}
|
|
2063
|
+
),
|
|
2064
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-between p-4 border-b border-gray-300", children: header }),
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { className: cn("flex-grow", classNames.navSection), children: items.map((item, index) => {
|
|
2066
|
+
if (item.subItems) {
|
|
2067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2068
|
+
"div",
|
|
2069
|
+
{
|
|
2070
|
+
className: `my-2 ${item?.subItems && "has-sub-items"}`,
|
|
2071
|
+
children: [
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2073
|
+
"div",
|
|
2074
|
+
{
|
|
2075
|
+
onClick: () => toggleGroup(item.name),
|
|
2076
|
+
"data-sidebar-item": item.name,
|
|
2077
|
+
"data-tooltip-id": item.name,
|
|
2078
|
+
className: `flex cursor-pointer dropdown-title-wrapper ${classNames?.navItem ?? ""}`,
|
|
2079
|
+
children: [
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2081
|
+
ToolTip,
|
|
2082
|
+
{
|
|
2083
|
+
text: item.tooltip || item.name,
|
|
2084
|
+
placement: item.tooltipPlacement || "top",
|
|
2085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames?.navItemText, children: item.icon }),
|
|
2087
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames?.navItemText, children: item.name })
|
|
2088
|
+
] })
|
|
2089
|
+
}
|
|
2090
|
+
),
|
|
2091
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2092
|
+
"span",
|
|
2093
|
+
{
|
|
2094
|
+
className: `transform transition-transform ${subItemsCollapsed[item.name] ? "rotate-180" : "rotate-0"}`,
|
|
2095
|
+
children: itemDropdownIcon
|
|
2096
|
+
}
|
|
2097
|
+
)
|
|
2098
|
+
]
|
|
2099
|
+
}
|
|
2100
|
+
),
|
|
2101
|
+
subItemsCollapsed[item.name] && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("collapse-btn-wrapper", classNames.subItem), children: item.subItems.map((subItem, subIndex) => {
|
|
2102
|
+
if (subItem.component) {
|
|
2103
|
+
const SubItemComponent = subItem.component;
|
|
2104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SubItemComponent, {}, `${index}-${subIndex}`);
|
|
2105
|
+
}
|
|
2106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2107
|
+
"div",
|
|
2108
|
+
{
|
|
2109
|
+
className: "w-full",
|
|
2110
|
+
"data-sidebar-item": subItem.name,
|
|
2111
|
+
"data-tooltip-id": subItem.name,
|
|
2112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2113
|
+
ToolTip,
|
|
2114
|
+
{
|
|
2115
|
+
text: item.tooltip || item.name,
|
|
2116
|
+
placement: item.tooltipPlacement || "top",
|
|
2117
|
+
className: "block w-full",
|
|
2118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2119
|
+
import_react_router_dom6.Link,
|
|
2120
|
+
{
|
|
2121
|
+
to: subItem.link || "#",
|
|
2122
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(subItem?.link ?? "") ? "active" : ""} ${item?.itemClassName}`,
|
|
2123
|
+
onClick: () => subItem.link && setActiveLink(subItem.link || ""),
|
|
2124
|
+
title: subItem.tooltip || subItem.name,
|
|
2125
|
+
children: [
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2127
|
+
"span",
|
|
2128
|
+
{
|
|
2129
|
+
className: classNames.navItemText ?? "text-orange-600",
|
|
2130
|
+
children: subItem.icon
|
|
2131
|
+
}
|
|
2132
|
+
),
|
|
2133
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText, children: subItem.name })
|
|
2134
|
+
]
|
|
2135
|
+
}
|
|
2136
|
+
)
|
|
2137
|
+
}
|
|
2138
|
+
)
|
|
2139
|
+
},
|
|
2140
|
+
`${index}-${subIndex}`
|
|
2141
|
+
);
|
|
2142
|
+
}) })
|
|
2143
|
+
]
|
|
2144
|
+
},
|
|
2145
|
+
index
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
if (item.component) {
|
|
2149
|
+
const ItemComponent = item.component;
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ItemComponent, {}, index);
|
|
2151
|
+
}
|
|
2152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2153
|
+
"div",
|
|
2154
|
+
{
|
|
2155
|
+
className: "w-full",
|
|
2156
|
+
"data-sidebar-item": item.name,
|
|
2157
|
+
"data-tooltip-id": item.name,
|
|
2158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2159
|
+
ToolTip,
|
|
2160
|
+
{
|
|
2161
|
+
text: item.tooltip || item.name,
|
|
2162
|
+
placement: item.tooltipPlacement || "top",
|
|
2163
|
+
className: "block w-full",
|
|
2164
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2165
|
+
import_react_router_dom6.Link,
|
|
2166
|
+
{
|
|
2167
|
+
to: item.link || "#",
|
|
2168
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(item.link || "") ? "active" : ""} ${item?.itemClassName}`,
|
|
2169
|
+
onClick: () => setActiveLink(item.link || ""),
|
|
2170
|
+
title: item.tooltip || item.name,
|
|
2171
|
+
children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText ?? "text-orange-600", children: item.icon }),
|
|
2173
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText, children: item.name })
|
|
2174
|
+
]
|
|
2175
|
+
}
|
|
2176
|
+
)
|
|
2177
|
+
}
|
|
2178
|
+
)
|
|
2179
|
+
},
|
|
2180
|
+
index
|
|
2181
|
+
);
|
|
2182
|
+
}) }),
|
|
2183
|
+
children,
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2185
|
+
"button",
|
|
2186
|
+
{
|
|
2187
|
+
onClick: () => setCollapsed(!collapsed),
|
|
2188
|
+
className: cn("", classNames.collapseButton) ?? "p-4 border-t border-gray-300",
|
|
2189
|
+
children: collapsed ? expandButtonText : collapseButtonText
|
|
2190
|
+
}
|
|
2191
|
+
),
|
|
2192
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: classNames?.footer ?? "p-4 border-t border-gray-300", children: footer })
|
|
2193
|
+
]
|
|
2194
|
+
}
|
|
2195
|
+
);
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
// src/components/skeleton/CardSkeleton.tsx
|
|
2199
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1727
2200
|
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
1728
2201
|
function shouldShowAvatar(variant, showAvatar) {
|
|
1729
2202
|
return showAvatar ?? variant === "profile";
|
|
@@ -1732,7 +2205,7 @@ function shouldShowImage(variant, showImage) {
|
|
|
1732
2205
|
return showImage ?? variant === "image";
|
|
1733
2206
|
}
|
|
1734
2207
|
function AvatarSkeleton({ className }) {
|
|
1735
|
-
return /* @__PURE__ */ (0,
|
|
2208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1736
2209
|
"svg",
|
|
1737
2210
|
{
|
|
1738
2211
|
className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
|
|
@@ -1740,7 +2213,7 @@ function AvatarSkeleton({ className }) {
|
|
|
1740
2213
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1741
2214
|
fill: "currentColor",
|
|
1742
2215
|
viewBox: "0 0 20 20",
|
|
1743
|
-
children: /* @__PURE__ */ (0,
|
|
2216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z" })
|
|
1744
2217
|
}
|
|
1745
2218
|
);
|
|
1746
2219
|
}
|
|
@@ -1749,7 +2222,7 @@ function SkeletonBlock({
|
|
|
1749
2222
|
className,
|
|
1750
2223
|
isFirst
|
|
1751
2224
|
}) {
|
|
1752
|
-
return /* @__PURE__ */ (0,
|
|
2225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1753
2226
|
"div",
|
|
1754
2227
|
{
|
|
1755
2228
|
className: cn(
|
|
@@ -1781,14 +2254,14 @@ function CardSkeleton({
|
|
|
1781
2254
|
const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
|
|
1782
2255
|
const renderAvatar = shouldShowAvatar(variant, showAvatar);
|
|
1783
2256
|
const renderImage = shouldShowImage(variant, showImage);
|
|
1784
|
-
return /* @__PURE__ */ (0,
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1785
2258
|
"div",
|
|
1786
2259
|
{
|
|
1787
2260
|
className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
|
|
1788
2261
|
style: { animationDuration, ...style },
|
|
1789
2262
|
...props,
|
|
1790
2263
|
children: [
|
|
1791
|
-
renderImage ? /* @__PURE__ */ (0,
|
|
2264
|
+
renderImage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1792
2265
|
"div",
|
|
1793
2266
|
{
|
|
1794
2267
|
className: cn(
|
|
@@ -1797,9 +2270,9 @@ function CardSkeleton({
|
|
|
1797
2270
|
)
|
|
1798
2271
|
}
|
|
1799
2272
|
) : null,
|
|
1800
|
-
/* @__PURE__ */ (0,
|
|
1801
|
-
renderAvatar ? /* @__PURE__ */ (0,
|
|
1802
|
-
/* @__PURE__ */ (0,
|
|
2273
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
|
|
2274
|
+
renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
|
|
2275
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1803
2276
|
SkeletonBlock,
|
|
1804
2277
|
{
|
|
1805
2278
|
widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
|
|
@@ -1809,75 +2282,17 @@ function CardSkeleton({
|
|
|
1809
2282
|
lineIndex
|
|
1810
2283
|
)) })
|
|
1811
2284
|
] }),
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: srLabel })
|
|
1813
2286
|
]
|
|
1814
2287
|
},
|
|
1815
2288
|
index
|
|
1816
2289
|
);
|
|
1817
2290
|
});
|
|
1818
|
-
return /* @__PURE__ */ (0,
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
// src/components/tooltip/ToolTip.tsx
|
|
1822
|
-
var import_react7 = require("react");
|
|
1823
|
-
var import_react_tooltip = require("react-tooltip");
|
|
1824
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1825
|
-
var defaultTooltipStyle = {
|
|
1826
|
-
color: "#fff",
|
|
1827
|
-
borderRadius: "5px",
|
|
1828
|
-
zIndex: 999,
|
|
1829
|
-
textAlign: "justify",
|
|
1830
|
-
maxWidth: "300px",
|
|
1831
|
-
whiteSpace: "pre-wrap",
|
|
1832
|
-
wordWrap: "break-word",
|
|
1833
|
-
overflowWrap: "break-word"
|
|
1834
|
-
};
|
|
1835
|
-
function ToolTip({
|
|
1836
|
-
text = "tool tip",
|
|
1837
|
-
placement = "top",
|
|
1838
|
-
delayShow,
|
|
1839
|
-
delayHide,
|
|
1840
|
-
className,
|
|
1841
|
-
tooltipClassName,
|
|
1842
|
-
tooltipStyle,
|
|
1843
|
-
wrapperTabIndex,
|
|
1844
|
-
disabled = false,
|
|
1845
|
-
children
|
|
1846
|
-
}) {
|
|
1847
|
-
const generatedId = (0, import_react7.useId)();
|
|
1848
|
-
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1849
|
-
const tooltipText = String(text ?? "");
|
|
1850
|
-
if (disabled || !tooltipText) {
|
|
1851
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className, children });
|
|
1852
|
-
}
|
|
1853
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1854
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1855
|
-
"span",
|
|
1856
|
-
{
|
|
1857
|
-
className,
|
|
1858
|
-
"data-tooltip-id": tooltipId,
|
|
1859
|
-
"data-tooltip-content": tooltipText,
|
|
1860
|
-
tabIndex: wrapperTabIndex,
|
|
1861
|
-
children
|
|
1862
|
-
}
|
|
1863
|
-
),
|
|
1864
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1865
|
-
import_react_tooltip.Tooltip,
|
|
1866
|
-
{
|
|
1867
|
-
id: tooltipId,
|
|
1868
|
-
place: placement,
|
|
1869
|
-
positionStrategy: "fixed",
|
|
1870
|
-
delayShow,
|
|
1871
|
-
delayHide,
|
|
1872
|
-
className: tooltipClassName,
|
|
1873
|
-
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
1874
|
-
}
|
|
1875
|
-
)
|
|
1876
|
-
] });
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: skeletons });
|
|
1877
2292
|
}
|
|
1878
2293
|
|
|
1879
2294
|
// src/components/tooltip/TooltipText.tsx
|
|
1880
|
-
var
|
|
2295
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1881
2296
|
function TooltipText({
|
|
1882
2297
|
text = "",
|
|
1883
2298
|
maxLength = 20,
|
|
@@ -1897,7 +2312,7 @@ function TooltipText({
|
|
|
1897
2312
|
const displayText = truncateText(fullText, maxLength);
|
|
1898
2313
|
const isTruncated = displayText !== fullText;
|
|
1899
2314
|
const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
|
|
1900
|
-
return /* @__PURE__ */ (0,
|
|
2315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1901
2316
|
ToolTip,
|
|
1902
2317
|
{
|
|
1903
2318
|
text: fullText,
|
|
@@ -1909,17 +2324,17 @@ function TooltipText({
|
|
|
1909
2324
|
tooltipStyle,
|
|
1910
2325
|
wrapperTabIndex: tooltipDisabled ? void 0 : 0,
|
|
1911
2326
|
disabled: tooltipDisabled,
|
|
1912
|
-
children: /* @__PURE__ */ (0,
|
|
2327
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
|
|
1913
2328
|
}
|
|
1914
2329
|
);
|
|
1915
2330
|
}
|
|
1916
2331
|
|
|
1917
2332
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1918
|
-
var
|
|
2333
|
+
var import_react11 = require("react");
|
|
1919
2334
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1920
|
-
var
|
|
2335
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1921
2336
|
function ButtonSpinner() {
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
2337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1923
2338
|
"svg",
|
|
1924
2339
|
{
|
|
1925
2340
|
className: "animate-spin",
|
|
@@ -1929,7 +2344,7 @@ function ButtonSpinner() {
|
|
|
1929
2344
|
fill: "none",
|
|
1930
2345
|
"aria-hidden": true,
|
|
1931
2346
|
children: [
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1933
2348
|
"circle",
|
|
1934
2349
|
{
|
|
1935
2350
|
cx: "12",
|
|
@@ -1940,7 +2355,7 @@ function ButtonSpinner() {
|
|
|
1940
2355
|
strokeOpacity: "0.25"
|
|
1941
2356
|
}
|
|
1942
2357
|
),
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
2358
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1944
2359
|
"path",
|
|
1945
2360
|
{
|
|
1946
2361
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
@@ -1962,7 +2377,7 @@ function normalizeInitialValue(initialValue, inputType) {
|
|
|
1962
2377
|
}
|
|
1963
2378
|
return initialValue;
|
|
1964
2379
|
}
|
|
1965
|
-
var CustomCellEditor = (0,
|
|
2380
|
+
var CustomCellEditor = (0, import_react11.forwardRef)(
|
|
1966
2381
|
({
|
|
1967
2382
|
value: initialValue,
|
|
1968
2383
|
name,
|
|
@@ -1987,11 +2402,11 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
1987
2402
|
cancelButtonClassName
|
|
1988
2403
|
}, ref) => {
|
|
1989
2404
|
const normalizedInitial = normalizeInitialValue(initialValue, inputType);
|
|
1990
|
-
const [value, setValue] = (0,
|
|
1991
|
-
const [isLoading, setIsLoading] = (0,
|
|
1992
|
-
const inputRef = (0,
|
|
1993
|
-
const selectRef = (0,
|
|
1994
|
-
const normalizedOptions = (0,
|
|
2405
|
+
const [value, setValue] = (0, import_react11.useState)(normalizedInitial);
|
|
2406
|
+
const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
|
|
2407
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
2408
|
+
const selectRef = (0, import_react11.useRef)(null);
|
|
2409
|
+
const normalizedOptions = (0, import_react11.useMemo)(() => {
|
|
1995
2410
|
if (customOptions && customOptions.length > 0) {
|
|
1996
2411
|
return customOptions.map((opt) => ({
|
|
1997
2412
|
value: String(opt[valueKey] ?? ""),
|
|
@@ -2001,13 +2416,13 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2001
2416
|
return dropdownOptions;
|
|
2002
2417
|
}, [customOptions, dropdownOptions, valueKey, labelKey]);
|
|
2003
2418
|
const isDropdown = inputType === "dropdown" || normalizedOptions.length > 0;
|
|
2004
|
-
(0,
|
|
2419
|
+
(0, import_react11.useImperativeHandle)(ref, () => ({
|
|
2005
2420
|
getValue: () => value,
|
|
2006
2421
|
isCancelBeforeStart: () => false,
|
|
2007
2422
|
isCancelAfterEnd: () => false,
|
|
2008
2423
|
isPopup: () => true
|
|
2009
2424
|
}));
|
|
2010
|
-
(0,
|
|
2425
|
+
(0, import_react11.useEffect)(() => {
|
|
2011
2426
|
if (isDropdown) {
|
|
2012
2427
|
selectRef.current?.focus();
|
|
2013
2428
|
return;
|
|
@@ -2076,7 +2491,7 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2076
2491
|
const defaultInputClass = "w-48 px-2 py-1 text-sm border border-gray-200 rounded-md bg-white focus:outline-none focus:ring-1 focus:ring-blue-400";
|
|
2077
2492
|
const defaultSaveBtnClass = "px-3 py-1 text-sm font-medium text-white bg-green-500 rounded-md hover:bg-green-600 disabled:opacity-50 whitespace-nowrap shrink-0";
|
|
2078
2493
|
const defaultCancelBtnClass = "px-3 py-1 text-sm font-medium text-white bg-red-500 rounded-md hover:bg-red-600 disabled:opacity-50 whitespace-nowrap shrink-0";
|
|
2079
|
-
return /* @__PURE__ */ (0,
|
|
2494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2080
2495
|
"div",
|
|
2081
2496
|
{
|
|
2082
2497
|
className: cn(
|
|
@@ -2085,7 +2500,7 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2085
2500
|
),
|
|
2086
2501
|
style: containerStyle,
|
|
2087
2502
|
children: [
|
|
2088
|
-
isDropdown ? /* @__PURE__ */ (0,
|
|
2503
|
+
isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2089
2504
|
"select",
|
|
2090
2505
|
{
|
|
2091
2506
|
ref: selectRef,
|
|
@@ -2095,11 +2510,11 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2095
2510
|
className: inputClassName ?? defaultInputClass,
|
|
2096
2511
|
disabled: isLoading,
|
|
2097
2512
|
children: [
|
|
2098
|
-
/* @__PURE__ */ (0,
|
|
2099
|
-
normalizedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
|
|
2514
|
+
normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
2100
2515
|
]
|
|
2101
2516
|
}
|
|
2102
|
-
) : /* @__PURE__ */ (0,
|
|
2517
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2103
2518
|
"input",
|
|
2104
2519
|
{
|
|
2105
2520
|
ref: inputRef,
|
|
@@ -2112,7 +2527,7 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2112
2527
|
disabled: isLoading
|
|
2113
2528
|
}
|
|
2114
2529
|
),
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2116
2531
|
"button",
|
|
2117
2532
|
{
|
|
2118
2533
|
type: "button",
|
|
@@ -2121,10 +2536,10 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2121
2536
|
className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
|
|
2122
2537
|
style: saveButtonStyle,
|
|
2123
2538
|
title: "Save (Enter)",
|
|
2124
|
-
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0,
|
|
2539
|
+
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
|
|
2125
2540
|
}
|
|
2126
2541
|
),
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2128
2543
|
"button",
|
|
2129
2544
|
{
|
|
2130
2545
|
type: "button",
|
|
@@ -2144,10 +2559,10 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2144
2559
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
2145
2560
|
|
|
2146
2561
|
// src/components/popup-cell-renderer/PopupCellRenderer.tsx
|
|
2147
|
-
var
|
|
2148
|
-
var
|
|
2562
|
+
var import_react12 = require("react");
|
|
2563
|
+
var import_react13 = __toESM(require("@tippyjs/react"));
|
|
2149
2564
|
var import_bi = require("react-icons/bi");
|
|
2150
|
-
var
|
|
2565
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2151
2566
|
function PopupCellRenderer({
|
|
2152
2567
|
dropDownContent,
|
|
2153
2568
|
actionIcon: ActionIcon = import_bi.BiDotsVerticalRounded,
|
|
@@ -2161,8 +2576,8 @@ function PopupCellRenderer({
|
|
|
2161
2576
|
ariaLabel = "Row actions",
|
|
2162
2577
|
openOnHover = false
|
|
2163
2578
|
}) {
|
|
2164
|
-
const [visible, setVisible] = (0,
|
|
2165
|
-
const instanceRef = (0,
|
|
2579
|
+
const [visible, setVisible] = (0, import_react12.useState)(false);
|
|
2580
|
+
const instanceRef = (0, import_react12.useRef)(null);
|
|
2166
2581
|
const show = () => setVisible(true);
|
|
2167
2582
|
const hide = () => {
|
|
2168
2583
|
setVisible(false);
|
|
@@ -2182,8 +2597,8 @@ function PopupCellRenderer({
|
|
|
2182
2597
|
visible,
|
|
2183
2598
|
onClickOutside: hide
|
|
2184
2599
|
};
|
|
2185
|
-
return /* @__PURE__ */ (0,
|
|
2186
|
-
|
|
2600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2601
|
+
import_react13.default,
|
|
2187
2602
|
{
|
|
2188
2603
|
content,
|
|
2189
2604
|
allowHTML: true,
|
|
@@ -2200,7 +2615,7 @@ function PopupCellRenderer({
|
|
|
2200
2615
|
},
|
|
2201
2616
|
...hoverOrClickProps,
|
|
2202
2617
|
...tippyProps,
|
|
2203
|
-
children: /* @__PURE__ */ (0,
|
|
2618
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2204
2619
|
"button",
|
|
2205
2620
|
{
|
|
2206
2621
|
type: "button",
|
|
@@ -2212,7 +2627,7 @@ function PopupCellRenderer({
|
|
|
2212
2627
|
"aria-label": ariaLabel,
|
|
2213
2628
|
children: [
|
|
2214
2629
|
!hideTitle && title,
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ActionIcon, { "aria-hidden": true })
|
|
2216
2631
|
]
|
|
2217
2632
|
}
|
|
2218
2633
|
)
|
|
@@ -2240,7 +2655,7 @@ var ROW_ACTION_PRESETS = {
|
|
|
2240
2655
|
};
|
|
2241
2656
|
|
|
2242
2657
|
// src/components/row-actions/ActionMenuItem.tsx
|
|
2243
|
-
var
|
|
2658
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2244
2659
|
function ActionMenuItem({
|
|
2245
2660
|
label,
|
|
2246
2661
|
icon: Icon,
|
|
@@ -2261,7 +2676,7 @@ function ActionMenuItem({
|
|
|
2261
2676
|
onClick
|
|
2262
2677
|
}) {
|
|
2263
2678
|
const tooltipText = tooltip ?? label;
|
|
2264
|
-
return /* @__PURE__ */ (0,
|
|
2679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2265
2680
|
ToolTip,
|
|
2266
2681
|
{
|
|
2267
2682
|
text: tooltipText,
|
|
@@ -2272,7 +2687,7 @@ function ActionMenuItem({
|
|
|
2272
2687
|
tooltipClassName,
|
|
2273
2688
|
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
2274
2689
|
className: showLabel ? "block w-full" : "inline-flex",
|
|
2275
|
-
children: /* @__PURE__ */ (0,
|
|
2690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2276
2691
|
"button",
|
|
2277
2692
|
{
|
|
2278
2693
|
type: "button",
|
|
@@ -2292,7 +2707,7 @@ function ActionMenuItem({
|
|
|
2292
2707
|
className
|
|
2293
2708
|
),
|
|
2294
2709
|
children: [
|
|
2295
|
-
Icon ? /* @__PURE__ */ (0,
|
|
2710
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2296
2711
|
Icon,
|
|
2297
2712
|
{
|
|
2298
2713
|
className: cn("shrink-0", iconClassName),
|
|
@@ -2300,7 +2715,7 @@ function ActionMenuItem({
|
|
|
2300
2715
|
size: iconSize
|
|
2301
2716
|
}
|
|
2302
2717
|
) : null,
|
|
2303
|
-
showLabel ? /* @__PURE__ */ (0,
|
|
2718
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: labelClassName, children: label }) : null
|
|
2304
2719
|
]
|
|
2305
2720
|
}
|
|
2306
2721
|
)
|
|
@@ -2358,7 +2773,7 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
2358
2773
|
}
|
|
2359
2774
|
|
|
2360
2775
|
// src/components/row-actions/RowActions.tsx
|
|
2361
|
-
var
|
|
2776
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2362
2777
|
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
2363
2778
|
if (!action.onClick) {
|
|
2364
2779
|
if (action.closeOnClick) hide?.();
|
|
@@ -2412,7 +2827,7 @@ function RowActions({
|
|
|
2412
2827
|
};
|
|
2413
2828
|
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
2414
2829
|
if (action.type === "divider") {
|
|
2415
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2416
2831
|
"div",
|
|
2417
2832
|
{
|
|
2418
2833
|
role: "separator",
|
|
@@ -2422,9 +2837,9 @@ function RowActions({
|
|
|
2422
2837
|
);
|
|
2423
2838
|
}
|
|
2424
2839
|
if (action.content) {
|
|
2425
|
-
return /* @__PURE__ */ (0,
|
|
2840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: action.className, children: action.content }, action.key);
|
|
2426
2841
|
}
|
|
2427
|
-
return /* @__PURE__ */ (0,
|
|
2842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2428
2843
|
ActionMenuItem,
|
|
2429
2844
|
{
|
|
2430
2845
|
label: action.label,
|
|
@@ -2451,15 +2866,15 @@ function RowActions({
|
|
|
2451
2866
|
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
2452
2867
|
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
2453
2868
|
if (!renderItem) return defaultItem;
|
|
2454
|
-
return /* @__PURE__ */ (0,
|
|
2869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
2455
2870
|
});
|
|
2456
2871
|
if (mode === "inline") {
|
|
2457
2872
|
const inlineItems = renderItems(void 0, false);
|
|
2458
|
-
return /* @__PURE__ */ (0,
|
|
2873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("flex h-full items-center justify-center gap-1", className), children: inlineItems });
|
|
2459
2874
|
}
|
|
2460
2875
|
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
2461
2876
|
const buildMenu = (hide) => {
|
|
2462
|
-
const defaultMenu = /* @__PURE__ */ (0,
|
|
2877
|
+
const defaultMenu = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2463
2878
|
"div",
|
|
2464
2879
|
{
|
|
2465
2880
|
className: cn(
|
|
@@ -2478,14 +2893,14 @@ function RowActions({
|
|
|
2478
2893
|
});
|
|
2479
2894
|
};
|
|
2480
2895
|
if (renderTrigger) {
|
|
2481
|
-
return /* @__PURE__ */ (0,
|
|
2896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: renderTrigger({
|
|
2482
2897
|
data,
|
|
2483
2898
|
actions: resolved,
|
|
2484
2899
|
hide: () => void 0,
|
|
2485
2900
|
defaultMenu: buildMenu(() => void 0)
|
|
2486
2901
|
}) });
|
|
2487
2902
|
}
|
|
2488
|
-
return /* @__PURE__ */ (0,
|
|
2903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2489
2904
|
ToolTip,
|
|
2490
2905
|
{
|
|
2491
2906
|
text: triggerTooltipText,
|
|
@@ -2496,7 +2911,7 @@ function RowActions({
|
|
|
2496
2911
|
tooltipClassName,
|
|
2497
2912
|
tooltipStyle,
|
|
2498
2913
|
className: "flex h-full items-center justify-center",
|
|
2499
|
-
children: /* @__PURE__ */ (0,
|
|
2914
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2500
2915
|
PopupCellRenderer,
|
|
2501
2916
|
{
|
|
2502
2917
|
params: { data },
|
|
@@ -2515,9 +2930,9 @@ function RowActions({
|
|
|
2515
2930
|
}
|
|
2516
2931
|
|
|
2517
2932
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
2518
|
-
var
|
|
2933
|
+
var import_react14 = require("react");
|
|
2519
2934
|
var import_fa6 = require("react-icons/fa6");
|
|
2520
|
-
var
|
|
2935
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2521
2936
|
var TableErrorBoundary = ({
|
|
2522
2937
|
isError,
|
|
2523
2938
|
isLoading = false,
|
|
@@ -2528,13 +2943,13 @@ var TableErrorBoundary = ({
|
|
|
2528
2943
|
className,
|
|
2529
2944
|
minHeight = "280px"
|
|
2530
2945
|
}) => {
|
|
2531
|
-
const message = (0,
|
|
2946
|
+
const message = (0, import_react14.useMemo)(() => {
|
|
2532
2947
|
if (errorMessage) return errorMessage;
|
|
2533
2948
|
if (error) return classifyError(error).userMessage;
|
|
2534
2949
|
return "Unable to load table data. Please try again.";
|
|
2535
2950
|
}, [error, errorMessage]);
|
|
2536
2951
|
if (isLoading && !isError) {
|
|
2537
|
-
return /* @__PURE__ */ (0,
|
|
2952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2538
2953
|
"div",
|
|
2539
2954
|
{
|
|
2540
2955
|
className: cn(
|
|
@@ -2545,12 +2960,12 @@ var TableErrorBoundary = ({
|
|
|
2545
2960
|
role: "status",
|
|
2546
2961
|
"aria-live": "polite",
|
|
2547
2962
|
"aria-busy": "true",
|
|
2548
|
-
children: /* @__PURE__ */ (0,
|
|
2963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, { size: "40px" })
|
|
2549
2964
|
}
|
|
2550
2965
|
);
|
|
2551
2966
|
}
|
|
2552
2967
|
if (isError) {
|
|
2553
|
-
return /* @__PURE__ */ (0,
|
|
2968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2554
2969
|
"div",
|
|
2555
2970
|
{
|
|
2556
2971
|
className: cn(
|
|
@@ -2561,7 +2976,7 @@ var TableErrorBoundary = ({
|
|
|
2561
2976
|
role: "alert",
|
|
2562
2977
|
"aria-live": "assertive",
|
|
2563
2978
|
children: [
|
|
2564
|
-
/* @__PURE__ */ (0,
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2565
2980
|
import_fa6.FaTriangleExclamation,
|
|
2566
2981
|
{
|
|
2567
2982
|
className: "text-red-500",
|
|
@@ -2569,11 +2984,11 @@ var TableErrorBoundary = ({
|
|
|
2569
2984
|
"aria-hidden": true
|
|
2570
2985
|
}
|
|
2571
2986
|
),
|
|
2572
|
-
/* @__PURE__ */ (0,
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
2987
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "max-w-md space-y-1", children: [
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-gray-600", children: message })
|
|
2575
2990
|
] }),
|
|
2576
|
-
refetch && /* @__PURE__ */ (0,
|
|
2991
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2577
2992
|
"button",
|
|
2578
2993
|
{
|
|
2579
2994
|
type: "button",
|
|
@@ -2581,7 +2996,7 @@ var TableErrorBoundary = ({
|
|
|
2581
2996
|
disabled: isLoading,
|
|
2582
2997
|
className: "inline-flex items-center gap-2 rounded-lg bg-primary-150 px-4 py-2 text-sm font-medium text-white transition-colors hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
|
|
2583
2998
|
children: [
|
|
2584
|
-
/* @__PURE__ */ (0,
|
|
2999
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
2585
3000
|
isLoading ? "Retrying..." : "Try again"
|
|
2586
3001
|
]
|
|
2587
3002
|
}
|
|
@@ -2590,16 +3005,20 @@ var TableErrorBoundary = ({
|
|
|
2590
3005
|
}
|
|
2591
3006
|
);
|
|
2592
3007
|
}
|
|
2593
|
-
return /* @__PURE__ */ (0,
|
|
3008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
|
2594
3009
|
};
|
|
2595
3010
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2596
3011
|
0 && (module.exports = {
|
|
2597
3012
|
ActionMenuItem,
|
|
3013
|
+
Breadcrumbs,
|
|
3014
|
+
Button,
|
|
3015
|
+
Card,
|
|
2598
3016
|
CardSkeleton,
|
|
2599
3017
|
CustomCellEditor,
|
|
2600
3018
|
CustomPagination,
|
|
2601
3019
|
DropdownFilter,
|
|
2602
3020
|
EztrakTabs,
|
|
3021
|
+
Header,
|
|
2603
3022
|
Loader,
|
|
2604
3023
|
Modal,
|
|
2605
3024
|
PopupCellRenderer,
|
|
@@ -2612,6 +3031,7 @@ var TableErrorBoundary = ({
|
|
|
2612
3031
|
ResetFiltersButton,
|
|
2613
3032
|
RowActions,
|
|
2614
3033
|
SearchInput,
|
|
3034
|
+
Sidebar,
|
|
2615
3035
|
TableErrorBoundary,
|
|
2616
3036
|
TableLayoutToolbarControls,
|
|
2617
3037
|
ToolTip,
|