@eztrak/shared 0.15.1 → 0.16.0
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-HQPQ6TOE.mjs → chunk-PE7NNAX6.mjs} +559 -130
- package/dist/chunk-PE7NNAX6.mjs.map +1 -0
- package/dist/components/index.d.mts +110 -4
- package/dist/components/index.d.ts +110 -4
- package/dist/components/index.js +568 -134
- 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 +568 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
- package/dist/chunk-HQPQ6TOE.mjs.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,
|
|
@@ -1722,8 +1727,473 @@ function Modal({
|
|
|
1722
1727
|
return (0, import_react_dom.createPortal)(modalContent, modalRoot);
|
|
1723
1728
|
}
|
|
1724
1729
|
|
|
1725
|
-
// src/components/
|
|
1730
|
+
// src/components/button/Button.tsx
|
|
1731
|
+
var import_react7 = require("react");
|
|
1726
1732
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1733
|
+
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";
|
|
1734
|
+
var VARIANTS2 = {
|
|
1735
|
+
primary: "bg-white text-secondary border-secondary hover:bg-lightGray hover:text-black",
|
|
1736
|
+
"primary-outline": "bg-white text-primary-150 border-primary-150 hover:bg-primary-100 hover:text-white font-bold",
|
|
1737
|
+
"primary-fill": "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1738
|
+
secondary: "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1739
|
+
danger: "bg-red-600 text-white border-red-600 hover:bg-red-700",
|
|
1740
|
+
outline: "bg-white text-primary border-primary hover:bg-primary/10",
|
|
1741
|
+
ghost: "bg-transparent text-secondary border-transparent hover:bg-primary/10 p-2",
|
|
1742
|
+
inline: "bg-transparent text-gray-500 border-none hover:text-gray-600 underline shadow-none p-0 m-0"
|
|
1743
|
+
};
|
|
1744
|
+
var SIZES = {
|
|
1745
|
+
sm: "px-3 py-2 text-xs",
|
|
1746
|
+
md: "px-5 py-3 text-sm",
|
|
1747
|
+
lg: "px-6 py-4 text-base"
|
|
1748
|
+
};
|
|
1749
|
+
var Button = (0, import_react7.forwardRef)(
|
|
1750
|
+
({
|
|
1751
|
+
children,
|
|
1752
|
+
className = "",
|
|
1753
|
+
type = "button",
|
|
1754
|
+
onClick,
|
|
1755
|
+
disabled = false,
|
|
1756
|
+
variant = "primary",
|
|
1757
|
+
size = "md",
|
|
1758
|
+
...props
|
|
1759
|
+
}, ref) => {
|
|
1760
|
+
const variantStyles = VARIANTS2[variant] || VARIANTS2.primary;
|
|
1761
|
+
const sizeStyles = SIZES[size];
|
|
1762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1763
|
+
"button",
|
|
1764
|
+
{
|
|
1765
|
+
ref,
|
|
1766
|
+
type,
|
|
1767
|
+
className: cn(
|
|
1768
|
+
BASE_STYLES2,
|
|
1769
|
+
variantStyles,
|
|
1770
|
+
size !== "md" && sizeStyles,
|
|
1771
|
+
className
|
|
1772
|
+
),
|
|
1773
|
+
onClick,
|
|
1774
|
+
disabled,
|
|
1775
|
+
...props,
|
|
1776
|
+
children
|
|
1777
|
+
}
|
|
1778
|
+
);
|
|
1779
|
+
}
|
|
1780
|
+
);
|
|
1781
|
+
Button.displayName = "Button";
|
|
1782
|
+
|
|
1783
|
+
// src/components/card/Card.tsx
|
|
1784
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1785
|
+
function Card({
|
|
1786
|
+
title,
|
|
1787
|
+
content,
|
|
1788
|
+
icon,
|
|
1789
|
+
onClick,
|
|
1790
|
+
containerClassName = "shadow p-6",
|
|
1791
|
+
iconClassName = "",
|
|
1792
|
+
titleClassName = "",
|
|
1793
|
+
contentClassName = "",
|
|
1794
|
+
cardBodyClassName = ""
|
|
1795
|
+
}) {
|
|
1796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1797
|
+
"div",
|
|
1798
|
+
{
|
|
1799
|
+
className: cn(
|
|
1800
|
+
"transform transition duration-300 cursor-pointer select-none",
|
|
1801
|
+
containerClassName
|
|
1802
|
+
),
|
|
1803
|
+
onClick,
|
|
1804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("flex space-x-4", cardBodyClassName), children: [
|
|
1805
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("text-primary text-3xl", iconClassName), children: icon }),
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: cn("font-semibold text-lg text-primary", titleClassName), children: title }),
|
|
1808
|
+
content != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: cn("text-sm text-secondary", contentClassName), children: content })
|
|
1809
|
+
] })
|
|
1810
|
+
] })
|
|
1811
|
+
}
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
// src/components/header/Header.tsx
|
|
1816
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1817
|
+
function Header({
|
|
1818
|
+
title = "Header",
|
|
1819
|
+
className = "p-2 gap-2 flex-col",
|
|
1820
|
+
containerClass = "",
|
|
1821
|
+
breadcrumbs = "",
|
|
1822
|
+
titleStyle = "text-4xl h-fit font-bold",
|
|
1823
|
+
breadcrumbsStyle = "text-sm",
|
|
1824
|
+
children
|
|
1825
|
+
}) {
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex ${className}`, children: [
|
|
1827
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "title-wrapper", children: [
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: titleStyle, children: title }),
|
|
1829
|
+
breadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `breadcrumbs-wraper ${breadcrumbsStyle}`, children: breadcrumbs })
|
|
1830
|
+
] }),
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex flex-row justify-between items-center ${containerClass}`, children })
|
|
1832
|
+
] });
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
// src/components/breadcrumbs/Breadcrumbs.tsx
|
|
1836
|
+
var import_react8 = require("react");
|
|
1837
|
+
var import_react_router_dom5 = require("react-router-dom");
|
|
1838
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1839
|
+
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]";
|
|
1840
|
+
function asTitleMap(customTitles) {
|
|
1841
|
+
if (Object.prototype.toString.call(customTitles) !== "[object Object]") {
|
|
1842
|
+
return {};
|
|
1843
|
+
}
|
|
1844
|
+
return customTitles;
|
|
1845
|
+
}
|
|
1846
|
+
function findRoute(pathname, routes, parentPath = "") {
|
|
1847
|
+
for (const route of routes) {
|
|
1848
|
+
const fullPath = `${parentPath}/${route.path}`.replace(/\/+/g, "/");
|
|
1849
|
+
if (fullPath === pathname) {
|
|
1850
|
+
return route;
|
|
1851
|
+
}
|
|
1852
|
+
if (route.children) {
|
|
1853
|
+
const childRoute = findRoute(pathname, route.children, fullPath);
|
|
1854
|
+
if (childRoute) {
|
|
1855
|
+
return childRoute;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
return null;
|
|
1860
|
+
}
|
|
1861
|
+
function getLastParam(str) {
|
|
1862
|
+
return str.endsWith("/") ? str.slice(0, -1).split("/").pop() : str.split("/").pop();
|
|
1863
|
+
}
|
|
1864
|
+
function Breadcrumbs({
|
|
1865
|
+
routes = [],
|
|
1866
|
+
containerClassName,
|
|
1867
|
+
linkClassName = "",
|
|
1868
|
+
separatorClassName = "",
|
|
1869
|
+
separator = "/",
|
|
1870
|
+
activeClassName = "font-bold whitespace-pre",
|
|
1871
|
+
customTitles = {},
|
|
1872
|
+
customIcons = {},
|
|
1873
|
+
prefix,
|
|
1874
|
+
suffix,
|
|
1875
|
+
nonClickablePaths = []
|
|
1876
|
+
}) {
|
|
1877
|
+
const location = (0, import_react_router_dom5.useLocation)();
|
|
1878
|
+
const pathnames = location.pathname.split("/").filter((segment) => segment);
|
|
1879
|
+
const titles = asTitleMap(customTitles);
|
|
1880
|
+
const inactiveLinkClassName = cn(INACTIVE_LINK_CLASS, linkClassName);
|
|
1881
|
+
const getTitle = (pathname) => {
|
|
1882
|
+
const match = findRoute(pathname, routes);
|
|
1883
|
+
if (match && match.title) {
|
|
1884
|
+
return match.title;
|
|
1885
|
+
}
|
|
1886
|
+
const titleKeys = Object.keys(titles);
|
|
1887
|
+
const paramMatch = pathname.split("/").find((segment) => titleKeys.includes(segment)) || "";
|
|
1888
|
+
if (paramMatch && titles[paramMatch]) {
|
|
1889
|
+
return titles[paramMatch];
|
|
1890
|
+
}
|
|
1891
|
+
const lastParamPath = getLastParam(pathname);
|
|
1892
|
+
if (lastParamPath) {
|
|
1893
|
+
return lastParamPath;
|
|
1894
|
+
}
|
|
1895
|
+
return pathname;
|
|
1896
|
+
};
|
|
1897
|
+
const getIcon = (pathname) => {
|
|
1898
|
+
const iconKeys = Object.keys(customIcons);
|
|
1899
|
+
const matchedSegment = pathname.split("/").find((segment) => iconKeys.includes(segment));
|
|
1900
|
+
if (matchedSegment && customIcons[matchedSegment]) {
|
|
1901
|
+
return customIcons[matchedSegment];
|
|
1902
|
+
}
|
|
1903
|
+
return null;
|
|
1904
|
+
};
|
|
1905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1906
|
+
"div",
|
|
1907
|
+
{
|
|
1908
|
+
className: cn(
|
|
1909
|
+
"flex flex-row gap-2 items-center text-sm text-secondary",
|
|
1910
|
+
containerClassName
|
|
1911
|
+
),
|
|
1912
|
+
children: [
|
|
1913
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "breadcrumb-prefix", children: prefix }),
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_router_dom5.Link, { to: "/", className: inactiveLinkClassName, children: [
|
|
1915
|
+
customIcons.home && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-1", children: customIcons.home }),
|
|
1916
|
+
titles.home || "Home"
|
|
1917
|
+
] }),
|
|
1918
|
+
pathnames.map((segment, index) => {
|
|
1919
|
+
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
|
|
1920
|
+
const isLast = index === pathnames.length - 1;
|
|
1921
|
+
const title = getTitle(to);
|
|
1922
|
+
const icon = getIcon(to);
|
|
1923
|
+
const isNonClickable = nonClickablePaths.some(
|
|
1924
|
+
(token) => to.includes(token) || segment === token
|
|
1925
|
+
);
|
|
1926
|
+
const crumb = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1927
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-1", children: icon }),
|
|
1928
|
+
title
|
|
1929
|
+
] });
|
|
1930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react8.Fragment, { children: [
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: separatorClassName, children: separator }),
|
|
1932
|
+
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 })
|
|
1933
|
+
] }, to);
|
|
1934
|
+
}),
|
|
1935
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "breadcrumb-suffix", children: suffix })
|
|
1936
|
+
]
|
|
1937
|
+
}
|
|
1938
|
+
);
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
// src/components/sidebar/Sidebar.tsx
|
|
1942
|
+
var import_react10 = require("react");
|
|
1943
|
+
var import_react_router_dom6 = require("react-router-dom");
|
|
1944
|
+
|
|
1945
|
+
// src/components/tooltip/ToolTip.tsx
|
|
1946
|
+
var import_react9 = require("react");
|
|
1947
|
+
var import_react_tooltip = require("react-tooltip");
|
|
1948
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1949
|
+
var defaultTooltipStyle = {
|
|
1950
|
+
color: "#fff",
|
|
1951
|
+
borderRadius: "5px",
|
|
1952
|
+
zIndex: 999,
|
|
1953
|
+
textAlign: "justify",
|
|
1954
|
+
maxWidth: "300px",
|
|
1955
|
+
whiteSpace: "pre-wrap",
|
|
1956
|
+
wordWrap: "break-word",
|
|
1957
|
+
overflowWrap: "break-word"
|
|
1958
|
+
};
|
|
1959
|
+
function ToolTip({
|
|
1960
|
+
text = "tool tip",
|
|
1961
|
+
placement = "top",
|
|
1962
|
+
delayShow,
|
|
1963
|
+
delayHide,
|
|
1964
|
+
className,
|
|
1965
|
+
tooltipClassName,
|
|
1966
|
+
tooltipStyle,
|
|
1967
|
+
wrapperTabIndex,
|
|
1968
|
+
disabled = false,
|
|
1969
|
+
children
|
|
1970
|
+
}) {
|
|
1971
|
+
const generatedId = (0, import_react9.useId)();
|
|
1972
|
+
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1973
|
+
const tooltipText = String(text ?? "");
|
|
1974
|
+
if (disabled || !tooltipText) {
|
|
1975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className, children });
|
|
1976
|
+
}
|
|
1977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1979
|
+
"span",
|
|
1980
|
+
{
|
|
1981
|
+
className,
|
|
1982
|
+
"data-tooltip-id": tooltipId,
|
|
1983
|
+
"data-tooltip-content": tooltipText,
|
|
1984
|
+
tabIndex: wrapperTabIndex,
|
|
1985
|
+
children
|
|
1986
|
+
}
|
|
1987
|
+
),
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1989
|
+
import_react_tooltip.Tooltip,
|
|
1990
|
+
{
|
|
1991
|
+
id: tooltipId,
|
|
1992
|
+
place: placement,
|
|
1993
|
+
positionStrategy: "fixed",
|
|
1994
|
+
delayShow,
|
|
1995
|
+
delayHide,
|
|
1996
|
+
className: tooltipClassName,
|
|
1997
|
+
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
1998
|
+
}
|
|
1999
|
+
)
|
|
2000
|
+
] });
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
// src/components/sidebar/Sidebar.tsx
|
|
2004
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2005
|
+
function Sidebar({
|
|
2006
|
+
className,
|
|
2007
|
+
sideCollapseWidth = "w-20",
|
|
2008
|
+
sidebarWidth = "w-48",
|
|
2009
|
+
header,
|
|
2010
|
+
children,
|
|
2011
|
+
footer,
|
|
2012
|
+
items = [],
|
|
2013
|
+
logoUrl = "",
|
|
2014
|
+
logoAltText = "Logo",
|
|
2015
|
+
collapseButtonText = "\u2B05\uFE0F Collapse",
|
|
2016
|
+
expandButtonText = "\u27A1\uFE0F",
|
|
2017
|
+
location: _location,
|
|
2018
|
+
classNames = {},
|
|
2019
|
+
onCollapseChange,
|
|
2020
|
+
isCollapsed = false,
|
|
2021
|
+
itemDropdownIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u25BC" }),
|
|
2022
|
+
...rest
|
|
2023
|
+
}) {
|
|
2024
|
+
const location = (0, import_react_router_dom6.useLocation)();
|
|
2025
|
+
const [collapsed, setCollapsed] = (0, import_react10.useState)(isCollapsed);
|
|
2026
|
+
const [, setActiveLink] = (0, import_react10.useState)(location.pathname);
|
|
2027
|
+
const [subItemsCollapsed, setSubItemsCollapsed] = (0, import_react10.useState)({});
|
|
2028
|
+
(0, import_react10.useEffect)(() => {
|
|
2029
|
+
if (onCollapseChange) {
|
|
2030
|
+
onCollapseChange(collapsed);
|
|
2031
|
+
}
|
|
2032
|
+
}, [collapsed, onCollapseChange]);
|
|
2033
|
+
(0, import_react10.useEffect)(() => {
|
|
2034
|
+
setActiveLink(location.pathname);
|
|
2035
|
+
}, [location]);
|
|
2036
|
+
const toggleGroup = (group) => {
|
|
2037
|
+
setSubItemsCollapsed((prevState) => ({
|
|
2038
|
+
...prevState,
|
|
2039
|
+
[group]: !prevState[group]
|
|
2040
|
+
}));
|
|
2041
|
+
};
|
|
2042
|
+
const isActive = (link) => {
|
|
2043
|
+
return location.pathname.startsWith(link);
|
|
2044
|
+
};
|
|
2045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2046
|
+
"div",
|
|
2047
|
+
{
|
|
2048
|
+
className: `flex flex-col h-screen overflow-hidden ${collapsed ? `${sideCollapseWidth} justify-center items-center collapsed` : `${sidebarWidth}`} transition-all duration-100 ${className ?? ""}`,
|
|
2049
|
+
...rest,
|
|
2050
|
+
children: [
|
|
2051
|
+
logoUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2052
|
+
"div",
|
|
2053
|
+
{
|
|
2054
|
+
className: cn(
|
|
2055
|
+
"flex items-center justify-center h-16 border-b border-gray-300",
|
|
2056
|
+
classNames.logoSection
|
|
2057
|
+
),
|
|
2058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: logoUrl, alt: logoAltText, className: "h-10" })
|
|
2059
|
+
}
|
|
2060
|
+
),
|
|
2061
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-between p-4 border-b border-gray-300", children: header }),
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { className: cn("flex-grow", classNames.navSection), children: items.map((item, index) => {
|
|
2063
|
+
if (item.subItems) {
|
|
2064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2065
|
+
"div",
|
|
2066
|
+
{
|
|
2067
|
+
className: `my-2 ${item?.subItems && "has-sub-items"}`,
|
|
2068
|
+
children: [
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2070
|
+
"div",
|
|
2071
|
+
{
|
|
2072
|
+
onClick: () => toggleGroup(item.name),
|
|
2073
|
+
"data-sidebar-item": item.name,
|
|
2074
|
+
"data-tooltip-id": item.name,
|
|
2075
|
+
className: `flex cursor-pointer dropdown-title-wrapper ${classNames?.navItem ?? ""}`,
|
|
2076
|
+
children: [
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2078
|
+
ToolTip,
|
|
2079
|
+
{
|
|
2080
|
+
text: item.tooltip || item.name,
|
|
2081
|
+
placement: item.tooltipPlacement || "top",
|
|
2082
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames?.navItemText, children: item.icon }),
|
|
2084
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames?.navItemText, children: item.name })
|
|
2085
|
+
] })
|
|
2086
|
+
}
|
|
2087
|
+
),
|
|
2088
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2089
|
+
"span",
|
|
2090
|
+
{
|
|
2091
|
+
className: `transform transition-transform ${subItemsCollapsed[item.name] ? "rotate-180" : "rotate-0"}`,
|
|
2092
|
+
children: itemDropdownIcon
|
|
2093
|
+
}
|
|
2094
|
+
)
|
|
2095
|
+
]
|
|
2096
|
+
}
|
|
2097
|
+
),
|
|
2098
|
+
subItemsCollapsed[item.name] && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("collapse-btn-wrapper", classNames.subItem), children: item.subItems.map((subItem, subIndex) => {
|
|
2099
|
+
if (subItem.component) {
|
|
2100
|
+
const SubItemComponent = subItem.component;
|
|
2101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SubItemComponent, {}, `${index}-${subIndex}`);
|
|
2102
|
+
}
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2104
|
+
"div",
|
|
2105
|
+
{
|
|
2106
|
+
className: "w-full",
|
|
2107
|
+
"data-sidebar-item": subItem.name,
|
|
2108
|
+
"data-tooltip-id": subItem.name,
|
|
2109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2110
|
+
ToolTip,
|
|
2111
|
+
{
|
|
2112
|
+
text: item.tooltip || item.name,
|
|
2113
|
+
placement: item.tooltipPlacement || "top",
|
|
2114
|
+
className: "block w-full",
|
|
2115
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2116
|
+
import_react_router_dom6.Link,
|
|
2117
|
+
{
|
|
2118
|
+
to: subItem.link || "#",
|
|
2119
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(subItem?.link ?? "") ? "active" : ""} ${item?.itemClassName}`,
|
|
2120
|
+
onClick: () => subItem.link && setActiveLink(subItem.link || ""),
|
|
2121
|
+
title: subItem.tooltip || subItem.name,
|
|
2122
|
+
children: [
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2124
|
+
"span",
|
|
2125
|
+
{
|
|
2126
|
+
className: classNames.navItemText ?? "text-orange-600",
|
|
2127
|
+
children: subItem.icon
|
|
2128
|
+
}
|
|
2129
|
+
),
|
|
2130
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText, children: subItem.name })
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
)
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
},
|
|
2137
|
+
`${index}-${subIndex}`
|
|
2138
|
+
);
|
|
2139
|
+
}) })
|
|
2140
|
+
]
|
|
2141
|
+
},
|
|
2142
|
+
index
|
|
2143
|
+
);
|
|
2144
|
+
}
|
|
2145
|
+
if (item.component) {
|
|
2146
|
+
const ItemComponent = item.component;
|
|
2147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ItemComponent, {}, index);
|
|
2148
|
+
}
|
|
2149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2150
|
+
"div",
|
|
2151
|
+
{
|
|
2152
|
+
className: "w-full",
|
|
2153
|
+
"data-sidebar-item": item.name,
|
|
2154
|
+
"data-tooltip-id": item.name,
|
|
2155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2156
|
+
ToolTip,
|
|
2157
|
+
{
|
|
2158
|
+
text: item.tooltip || item.name,
|
|
2159
|
+
placement: item.tooltipPlacement || "top",
|
|
2160
|
+
className: "block w-full",
|
|
2161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2162
|
+
import_react_router_dom6.Link,
|
|
2163
|
+
{
|
|
2164
|
+
to: item.link || "#",
|
|
2165
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(item.link || "") ? "active" : ""} ${item?.itemClassName}`,
|
|
2166
|
+
onClick: () => setActiveLink(item.link || ""),
|
|
2167
|
+
title: item.tooltip || item.name,
|
|
2168
|
+
children: [
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText ?? "text-orange-600", children: item.icon }),
|
|
2170
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText, children: item.name })
|
|
2171
|
+
]
|
|
2172
|
+
}
|
|
2173
|
+
)
|
|
2174
|
+
}
|
|
2175
|
+
)
|
|
2176
|
+
},
|
|
2177
|
+
index
|
|
2178
|
+
);
|
|
2179
|
+
}) }),
|
|
2180
|
+
children,
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2182
|
+
"button",
|
|
2183
|
+
{
|
|
2184
|
+
onClick: () => setCollapsed(!collapsed),
|
|
2185
|
+
className: cn("", classNames.collapseButton) ?? "p-4 border-t border-gray-300",
|
|
2186
|
+
children: collapsed ? expandButtonText : collapseButtonText
|
|
2187
|
+
}
|
|
2188
|
+
),
|
|
2189
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: classNames?.footer ?? "p-4 border-t border-gray-300", children: footer })
|
|
2190
|
+
]
|
|
2191
|
+
}
|
|
2192
|
+
);
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
// src/components/skeleton/CardSkeleton.tsx
|
|
2196
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1727
2197
|
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
1728
2198
|
function shouldShowAvatar(variant, showAvatar) {
|
|
1729
2199
|
return showAvatar ?? variant === "profile";
|
|
@@ -1732,7 +2202,7 @@ function shouldShowImage(variant, showImage) {
|
|
|
1732
2202
|
return showImage ?? variant === "image";
|
|
1733
2203
|
}
|
|
1734
2204
|
function AvatarSkeleton({ className }) {
|
|
1735
|
-
return /* @__PURE__ */ (0,
|
|
2205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1736
2206
|
"svg",
|
|
1737
2207
|
{
|
|
1738
2208
|
className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
|
|
@@ -1740,7 +2210,7 @@ function AvatarSkeleton({ className }) {
|
|
|
1740
2210
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1741
2211
|
fill: "currentColor",
|
|
1742
2212
|
viewBox: "0 0 20 20",
|
|
1743
|
-
children: /* @__PURE__ */ (0,
|
|
2213
|
+
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
2214
|
}
|
|
1745
2215
|
);
|
|
1746
2216
|
}
|
|
@@ -1749,7 +2219,7 @@ function SkeletonBlock({
|
|
|
1749
2219
|
className,
|
|
1750
2220
|
isFirst
|
|
1751
2221
|
}) {
|
|
1752
|
-
return /* @__PURE__ */ (0,
|
|
2222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1753
2223
|
"div",
|
|
1754
2224
|
{
|
|
1755
2225
|
className: cn(
|
|
@@ -1781,14 +2251,14 @@ function CardSkeleton({
|
|
|
1781
2251
|
const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
|
|
1782
2252
|
const renderAvatar = shouldShowAvatar(variant, showAvatar);
|
|
1783
2253
|
const renderImage = shouldShowImage(variant, showImage);
|
|
1784
|
-
return /* @__PURE__ */ (0,
|
|
2254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1785
2255
|
"div",
|
|
1786
2256
|
{
|
|
1787
2257
|
className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
|
|
1788
2258
|
style: { animationDuration, ...style },
|
|
1789
2259
|
...props,
|
|
1790
2260
|
children: [
|
|
1791
|
-
renderImage ? /* @__PURE__ */ (0,
|
|
2261
|
+
renderImage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1792
2262
|
"div",
|
|
1793
2263
|
{
|
|
1794
2264
|
className: cn(
|
|
@@ -1797,9 +2267,9 @@ function CardSkeleton({
|
|
|
1797
2267
|
)
|
|
1798
2268
|
}
|
|
1799
2269
|
) : null,
|
|
1800
|
-
/* @__PURE__ */ (0,
|
|
1801
|
-
renderAvatar ? /* @__PURE__ */ (0,
|
|
1802
|
-
/* @__PURE__ */ (0,
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
|
|
2271
|
+
renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
|
|
2272
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1803
2273
|
SkeletonBlock,
|
|
1804
2274
|
{
|
|
1805
2275
|
widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
|
|
@@ -1809,75 +2279,17 @@ function CardSkeleton({
|
|
|
1809
2279
|
lineIndex
|
|
1810
2280
|
)) })
|
|
1811
2281
|
] }),
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
2282
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: srLabel })
|
|
1813
2283
|
]
|
|
1814
2284
|
},
|
|
1815
2285
|
index
|
|
1816
2286
|
);
|
|
1817
2287
|
});
|
|
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
|
-
] });
|
|
2288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: skeletons });
|
|
1877
2289
|
}
|
|
1878
2290
|
|
|
1879
2291
|
// src/components/tooltip/TooltipText.tsx
|
|
1880
|
-
var
|
|
2292
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1881
2293
|
function TooltipText({
|
|
1882
2294
|
text = "",
|
|
1883
2295
|
maxLength = 20,
|
|
@@ -1897,7 +2309,7 @@ function TooltipText({
|
|
|
1897
2309
|
const displayText = truncateText(fullText, maxLength);
|
|
1898
2310
|
const isTruncated = displayText !== fullText;
|
|
1899
2311
|
const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
|
|
1900
|
-
return /* @__PURE__ */ (0,
|
|
2312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1901
2313
|
ToolTip,
|
|
1902
2314
|
{
|
|
1903
2315
|
text: fullText,
|
|
@@ -1909,17 +2321,17 @@ function TooltipText({
|
|
|
1909
2321
|
tooltipStyle,
|
|
1910
2322
|
wrapperTabIndex: tooltipDisabled ? void 0 : 0,
|
|
1911
2323
|
disabled: tooltipDisabled,
|
|
1912
|
-
children: /* @__PURE__ */ (0,
|
|
2324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
|
|
1913
2325
|
}
|
|
1914
2326
|
);
|
|
1915
2327
|
}
|
|
1916
2328
|
|
|
1917
2329
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1918
|
-
var
|
|
2330
|
+
var import_react11 = require("react");
|
|
1919
2331
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1920
|
-
var
|
|
2332
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1921
2333
|
function ButtonSpinner() {
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
2334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1923
2335
|
"svg",
|
|
1924
2336
|
{
|
|
1925
2337
|
className: "animate-spin",
|
|
@@ -1929,7 +2341,7 @@ function ButtonSpinner() {
|
|
|
1929
2341
|
fill: "none",
|
|
1930
2342
|
"aria-hidden": true,
|
|
1931
2343
|
children: [
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1933
2345
|
"circle",
|
|
1934
2346
|
{
|
|
1935
2347
|
cx: "12",
|
|
@@ -1940,7 +2352,7 @@ function ButtonSpinner() {
|
|
|
1940
2352
|
strokeOpacity: "0.25"
|
|
1941
2353
|
}
|
|
1942
2354
|
),
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1944
2356
|
"path",
|
|
1945
2357
|
{
|
|
1946
2358
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
@@ -1962,7 +2374,7 @@ function normalizeInitialValue(initialValue, inputType) {
|
|
|
1962
2374
|
}
|
|
1963
2375
|
return initialValue;
|
|
1964
2376
|
}
|
|
1965
|
-
var CustomCellEditor = (0,
|
|
2377
|
+
var CustomCellEditor = (0, import_react11.forwardRef)(
|
|
1966
2378
|
({
|
|
1967
2379
|
value: initialValue,
|
|
1968
2380
|
name,
|
|
@@ -1987,11 +2399,11 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
1987
2399
|
cancelButtonClassName
|
|
1988
2400
|
}, ref) => {
|
|
1989
2401
|
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,
|
|
2402
|
+
const [value, setValue] = (0, import_react11.useState)(normalizedInitial);
|
|
2403
|
+
const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
|
|
2404
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
2405
|
+
const selectRef = (0, import_react11.useRef)(null);
|
|
2406
|
+
const normalizedOptions = (0, import_react11.useMemo)(() => {
|
|
1995
2407
|
if (customOptions && customOptions.length > 0) {
|
|
1996
2408
|
return customOptions.map((opt) => ({
|
|
1997
2409
|
value: String(opt[valueKey] ?? ""),
|
|
@@ -2001,13 +2413,13 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2001
2413
|
return dropdownOptions;
|
|
2002
2414
|
}, [customOptions, dropdownOptions, valueKey, labelKey]);
|
|
2003
2415
|
const isDropdown = inputType === "dropdown" || normalizedOptions.length > 0;
|
|
2004
|
-
(0,
|
|
2416
|
+
(0, import_react11.useImperativeHandle)(ref, () => ({
|
|
2005
2417
|
getValue: () => value,
|
|
2006
2418
|
isCancelBeforeStart: () => false,
|
|
2007
2419
|
isCancelAfterEnd: () => false,
|
|
2008
2420
|
isPopup: () => true
|
|
2009
2421
|
}));
|
|
2010
|
-
(0,
|
|
2422
|
+
(0, import_react11.useEffect)(() => {
|
|
2011
2423
|
if (isDropdown) {
|
|
2012
2424
|
selectRef.current?.focus();
|
|
2013
2425
|
return;
|
|
@@ -2076,7 +2488,7 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2076
2488
|
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
2489
|
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
2490
|
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,
|
|
2491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2080
2492
|
"div",
|
|
2081
2493
|
{
|
|
2082
2494
|
className: cn(
|
|
@@ -2085,7 +2497,7 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2085
2497
|
),
|
|
2086
2498
|
style: containerStyle,
|
|
2087
2499
|
children: [
|
|
2088
|
-
isDropdown ? /* @__PURE__ */ (0,
|
|
2500
|
+
isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2089
2501
|
"select",
|
|
2090
2502
|
{
|
|
2091
2503
|
ref: selectRef,
|
|
@@ -2095,11 +2507,11 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2095
2507
|
className: inputClassName ?? defaultInputClass,
|
|
2096
2508
|
disabled: isLoading,
|
|
2097
2509
|
children: [
|
|
2098
|
-
/* @__PURE__ */ (0,
|
|
2099
|
-
normalizedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
|
|
2511
|
+
normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
2100
2512
|
]
|
|
2101
2513
|
}
|
|
2102
|
-
) : /* @__PURE__ */ (0,
|
|
2514
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2103
2515
|
"input",
|
|
2104
2516
|
{
|
|
2105
2517
|
ref: inputRef,
|
|
@@ -2112,7 +2524,7 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2112
2524
|
disabled: isLoading
|
|
2113
2525
|
}
|
|
2114
2526
|
),
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2116
2528
|
"button",
|
|
2117
2529
|
{
|
|
2118
2530
|
type: "button",
|
|
@@ -2121,10 +2533,10 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2121
2533
|
className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
|
|
2122
2534
|
style: saveButtonStyle,
|
|
2123
2535
|
title: "Save (Enter)",
|
|
2124
|
-
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0,
|
|
2536
|
+
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
|
|
2125
2537
|
}
|
|
2126
2538
|
),
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2128
2540
|
"button",
|
|
2129
2541
|
{
|
|
2130
2542
|
type: "button",
|
|
@@ -2144,10 +2556,10 @@ var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
|
2144
2556
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
2145
2557
|
|
|
2146
2558
|
// src/components/popup-cell-renderer/PopupCellRenderer.tsx
|
|
2147
|
-
var
|
|
2148
|
-
var
|
|
2559
|
+
var import_react12 = require("react");
|
|
2560
|
+
var import_react13 = __toESM(require("@tippyjs/react"));
|
|
2149
2561
|
var import_bi = require("react-icons/bi");
|
|
2150
|
-
var
|
|
2562
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2151
2563
|
function PopupCellRenderer({
|
|
2152
2564
|
dropDownContent,
|
|
2153
2565
|
actionIcon: ActionIcon = import_bi.BiDotsVerticalRounded,
|
|
@@ -2158,23 +2570,34 @@ function PopupCellRenderer({
|
|
|
2158
2570
|
onAction,
|
|
2159
2571
|
placement = "bottom-end",
|
|
2160
2572
|
tippyProps,
|
|
2161
|
-
ariaLabel = "Row actions"
|
|
2573
|
+
ariaLabel = "Row actions",
|
|
2574
|
+
openOnHover = false
|
|
2162
2575
|
}) {
|
|
2163
|
-
const [visible, setVisible] = (0,
|
|
2576
|
+
const [visible, setVisible] = (0, import_react12.useState)(false);
|
|
2577
|
+
const instanceRef = (0, import_react12.useRef)(null);
|
|
2164
2578
|
const show = () => setVisible(true);
|
|
2165
|
-
const hide = () =>
|
|
2579
|
+
const hide = () => {
|
|
2580
|
+
setVisible(false);
|
|
2581
|
+
instanceRef.current?.hide();
|
|
2582
|
+
};
|
|
2166
2583
|
const rowData = params?.data;
|
|
2167
2584
|
const handleAction = (actionType, actionRowData) => {
|
|
2168
2585
|
onAction?.(actionType, actionRowData ?? rowData, hide);
|
|
2169
2586
|
hide();
|
|
2170
2587
|
};
|
|
2171
2588
|
const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
|
|
2172
|
-
|
|
2173
|
-
|
|
2589
|
+
const hoverOrClickProps = openOnHover ? {
|
|
2590
|
+
trigger: "mouseenter",
|
|
2591
|
+
delay: [0, 150],
|
|
2592
|
+
hideOnClick: false
|
|
2593
|
+
} : {
|
|
2594
|
+
visible,
|
|
2595
|
+
onClickOutside: hide
|
|
2596
|
+
};
|
|
2597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2598
|
+
import_react13.default,
|
|
2174
2599
|
{
|
|
2175
2600
|
content,
|
|
2176
|
-
visible,
|
|
2177
|
-
onClickOutside: hide,
|
|
2178
2601
|
allowHTML: true,
|
|
2179
2602
|
arrow: false,
|
|
2180
2603
|
appendTo: () => document.body,
|
|
@@ -2184,12 +2607,16 @@ function PopupCellRenderer({
|
|
|
2184
2607
|
theme: "light",
|
|
2185
2608
|
maxWidth: "none",
|
|
2186
2609
|
offset: [0, 5],
|
|
2610
|
+
onCreate: (instance) => {
|
|
2611
|
+
instanceRef.current = instance;
|
|
2612
|
+
},
|
|
2613
|
+
...hoverOrClickProps,
|
|
2187
2614
|
...tippyProps,
|
|
2188
|
-
children: /* @__PURE__ */ (0,
|
|
2615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2189
2616
|
"button",
|
|
2190
2617
|
{
|
|
2191
2618
|
type: "button",
|
|
2192
|
-
onClick: visible ? hide : show,
|
|
2619
|
+
onClick: openOnHover ? void 0 : visible ? hide : show,
|
|
2193
2620
|
className: cn(
|
|
2194
2621
|
"flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
|
|
2195
2622
|
className
|
|
@@ -2197,7 +2624,7 @@ function PopupCellRenderer({
|
|
|
2197
2624
|
"aria-label": ariaLabel,
|
|
2198
2625
|
children: [
|
|
2199
2626
|
!hideTitle && title,
|
|
2200
|
-
/* @__PURE__ */ (0,
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ActionIcon, { "aria-hidden": true })
|
|
2201
2628
|
]
|
|
2202
2629
|
}
|
|
2203
2630
|
)
|
|
@@ -2225,7 +2652,7 @@ var ROW_ACTION_PRESETS = {
|
|
|
2225
2652
|
};
|
|
2226
2653
|
|
|
2227
2654
|
// src/components/row-actions/ActionMenuItem.tsx
|
|
2228
|
-
var
|
|
2655
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2229
2656
|
function ActionMenuItem({
|
|
2230
2657
|
label,
|
|
2231
2658
|
icon: Icon,
|
|
@@ -2246,7 +2673,7 @@ function ActionMenuItem({
|
|
|
2246
2673
|
onClick
|
|
2247
2674
|
}) {
|
|
2248
2675
|
const tooltipText = tooltip ?? label;
|
|
2249
|
-
return /* @__PURE__ */ (0,
|
|
2676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2250
2677
|
ToolTip,
|
|
2251
2678
|
{
|
|
2252
2679
|
text: tooltipText,
|
|
@@ -2257,7 +2684,7 @@ function ActionMenuItem({
|
|
|
2257
2684
|
tooltipClassName,
|
|
2258
2685
|
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
2259
2686
|
className: showLabel ? "block w-full" : "inline-flex",
|
|
2260
|
-
children: /* @__PURE__ */ (0,
|
|
2687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2261
2688
|
"button",
|
|
2262
2689
|
{
|
|
2263
2690
|
type: "button",
|
|
@@ -2277,7 +2704,7 @@ function ActionMenuItem({
|
|
|
2277
2704
|
className
|
|
2278
2705
|
),
|
|
2279
2706
|
children: [
|
|
2280
|
-
Icon ? /* @__PURE__ */ (0,
|
|
2707
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2281
2708
|
Icon,
|
|
2282
2709
|
{
|
|
2283
2710
|
className: cn("shrink-0", iconClassName),
|
|
@@ -2285,7 +2712,7 @@ function ActionMenuItem({
|
|
|
2285
2712
|
size: iconSize
|
|
2286
2713
|
}
|
|
2287
2714
|
) : null,
|
|
2288
|
-
showLabel ? /* @__PURE__ */ (0,
|
|
2715
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: labelClassName, children: label }) : null
|
|
2289
2716
|
]
|
|
2290
2717
|
}
|
|
2291
2718
|
)
|
|
@@ -2343,7 +2770,7 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
2343
2770
|
}
|
|
2344
2771
|
|
|
2345
2772
|
// src/components/row-actions/RowActions.tsx
|
|
2346
|
-
var
|
|
2773
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2347
2774
|
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
2348
2775
|
if (!action.onClick) {
|
|
2349
2776
|
if (action.closeOnClick) hide?.();
|
|
@@ -2374,6 +2801,7 @@ function RowActions({
|
|
|
2374
2801
|
triggerAriaLabel = "Row actions",
|
|
2375
2802
|
hasPermission,
|
|
2376
2803
|
placement = "bottom-end",
|
|
2804
|
+
openOnHover = false,
|
|
2377
2805
|
tippyProps,
|
|
2378
2806
|
presets,
|
|
2379
2807
|
confirmFn = confirmationAlert,
|
|
@@ -2396,7 +2824,7 @@ function RowActions({
|
|
|
2396
2824
|
};
|
|
2397
2825
|
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
2398
2826
|
if (action.type === "divider") {
|
|
2399
|
-
return /* @__PURE__ */ (0,
|
|
2827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2400
2828
|
"div",
|
|
2401
2829
|
{
|
|
2402
2830
|
role: "separator",
|
|
@@ -2406,9 +2834,9 @@ function RowActions({
|
|
|
2406
2834
|
);
|
|
2407
2835
|
}
|
|
2408
2836
|
if (action.content) {
|
|
2409
|
-
return /* @__PURE__ */ (0,
|
|
2837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: action.className, children: action.content }, action.key);
|
|
2410
2838
|
}
|
|
2411
|
-
return /* @__PURE__ */ (0,
|
|
2839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2412
2840
|
ActionMenuItem,
|
|
2413
2841
|
{
|
|
2414
2842
|
label: action.label,
|
|
@@ -2435,15 +2863,15 @@ function RowActions({
|
|
|
2435
2863
|
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
2436
2864
|
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
2437
2865
|
if (!renderItem) return defaultItem;
|
|
2438
|
-
return /* @__PURE__ */ (0,
|
|
2866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
2439
2867
|
});
|
|
2440
2868
|
if (mode === "inline") {
|
|
2441
2869
|
const inlineItems = renderItems(void 0, false);
|
|
2442
|
-
return /* @__PURE__ */ (0,
|
|
2870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("flex h-full items-center justify-center gap-1", className), children: inlineItems });
|
|
2443
2871
|
}
|
|
2444
2872
|
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
2445
2873
|
const buildMenu = (hide) => {
|
|
2446
|
-
const defaultMenu = /* @__PURE__ */ (0,
|
|
2874
|
+
const defaultMenu = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2447
2875
|
"div",
|
|
2448
2876
|
{
|
|
2449
2877
|
className: cn(
|
|
@@ -2462,14 +2890,14 @@ function RowActions({
|
|
|
2462
2890
|
});
|
|
2463
2891
|
};
|
|
2464
2892
|
if (renderTrigger) {
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: renderTrigger({
|
|
2466
2894
|
data,
|
|
2467
2895
|
actions: resolved,
|
|
2468
2896
|
hide: () => void 0,
|
|
2469
2897
|
defaultMenu: buildMenu(() => void 0)
|
|
2470
2898
|
}) });
|
|
2471
2899
|
}
|
|
2472
|
-
return /* @__PURE__ */ (0,
|
|
2900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2473
2901
|
ToolTip,
|
|
2474
2902
|
{
|
|
2475
2903
|
text: triggerTooltipText,
|
|
@@ -2480,7 +2908,7 @@ function RowActions({
|
|
|
2480
2908
|
tooltipClassName,
|
|
2481
2909
|
tooltipStyle,
|
|
2482
2910
|
className: "flex h-full items-center justify-center",
|
|
2483
|
-
children: /* @__PURE__ */ (0,
|
|
2911
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2484
2912
|
PopupCellRenderer,
|
|
2485
2913
|
{
|
|
2486
2914
|
params: { data },
|
|
@@ -2488,6 +2916,7 @@ function RowActions({
|
|
|
2488
2916
|
hideTitle: true,
|
|
2489
2917
|
className,
|
|
2490
2918
|
placement,
|
|
2919
|
+
openOnHover,
|
|
2491
2920
|
tippyProps,
|
|
2492
2921
|
ariaLabel: triggerAriaLabel,
|
|
2493
2922
|
dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
|
|
@@ -2498,9 +2927,9 @@ function RowActions({
|
|
|
2498
2927
|
}
|
|
2499
2928
|
|
|
2500
2929
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
2501
|
-
var
|
|
2930
|
+
var import_react14 = require("react");
|
|
2502
2931
|
var import_fa6 = require("react-icons/fa6");
|
|
2503
|
-
var
|
|
2932
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2504
2933
|
var TableErrorBoundary = ({
|
|
2505
2934
|
isError,
|
|
2506
2935
|
isLoading = false,
|
|
@@ -2511,13 +2940,13 @@ var TableErrorBoundary = ({
|
|
|
2511
2940
|
className,
|
|
2512
2941
|
minHeight = "280px"
|
|
2513
2942
|
}) => {
|
|
2514
|
-
const message = (0,
|
|
2943
|
+
const message = (0, import_react14.useMemo)(() => {
|
|
2515
2944
|
if (errorMessage) return errorMessage;
|
|
2516
2945
|
if (error) return classifyError(error).userMessage;
|
|
2517
2946
|
return "Unable to load table data. Please try again.";
|
|
2518
2947
|
}, [error, errorMessage]);
|
|
2519
2948
|
if (isLoading && !isError) {
|
|
2520
|
-
return /* @__PURE__ */ (0,
|
|
2949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2521
2950
|
"div",
|
|
2522
2951
|
{
|
|
2523
2952
|
className: cn(
|
|
@@ -2528,12 +2957,12 @@ var TableErrorBoundary = ({
|
|
|
2528
2957
|
role: "status",
|
|
2529
2958
|
"aria-live": "polite",
|
|
2530
2959
|
"aria-busy": "true",
|
|
2531
|
-
children: /* @__PURE__ */ (0,
|
|
2960
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, { size: "40px" })
|
|
2532
2961
|
}
|
|
2533
2962
|
);
|
|
2534
2963
|
}
|
|
2535
2964
|
if (isError) {
|
|
2536
|
-
return /* @__PURE__ */ (0,
|
|
2965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2537
2966
|
"div",
|
|
2538
2967
|
{
|
|
2539
2968
|
className: cn(
|
|
@@ -2544,7 +2973,7 @@ var TableErrorBoundary = ({
|
|
|
2544
2973
|
role: "alert",
|
|
2545
2974
|
"aria-live": "assertive",
|
|
2546
2975
|
children: [
|
|
2547
|
-
/* @__PURE__ */ (0,
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2548
2977
|
import_fa6.FaTriangleExclamation,
|
|
2549
2978
|
{
|
|
2550
2979
|
className: "text-red-500",
|
|
@@ -2552,11 +2981,11 @@ var TableErrorBoundary = ({
|
|
|
2552
2981
|
"aria-hidden": true
|
|
2553
2982
|
}
|
|
2554
2983
|
),
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "max-w-md space-y-1", children: [
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
2986
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-gray-600", children: message })
|
|
2558
2987
|
] }),
|
|
2559
|
-
refetch && /* @__PURE__ */ (0,
|
|
2988
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2560
2989
|
"button",
|
|
2561
2990
|
{
|
|
2562
2991
|
type: "button",
|
|
@@ -2564,7 +2993,7 @@ var TableErrorBoundary = ({
|
|
|
2564
2993
|
disabled: isLoading,
|
|
2565
2994
|
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",
|
|
2566
2995
|
children: [
|
|
2567
|
-
/* @__PURE__ */ (0,
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
2568
2997
|
isLoading ? "Retrying..." : "Try again"
|
|
2569
2998
|
]
|
|
2570
2999
|
}
|
|
@@ -2573,16 +3002,20 @@ var TableErrorBoundary = ({
|
|
|
2573
3002
|
}
|
|
2574
3003
|
);
|
|
2575
3004
|
}
|
|
2576
|
-
return /* @__PURE__ */ (0,
|
|
3005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
|
2577
3006
|
};
|
|
2578
3007
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2579
3008
|
0 && (module.exports = {
|
|
2580
3009
|
ActionMenuItem,
|
|
3010
|
+
Breadcrumbs,
|
|
3011
|
+
Button,
|
|
3012
|
+
Card,
|
|
2581
3013
|
CardSkeleton,
|
|
2582
3014
|
CustomCellEditor,
|
|
2583
3015
|
CustomPagination,
|
|
2584
3016
|
DropdownFilter,
|
|
2585
3017
|
EztrakTabs,
|
|
3018
|
+
Header,
|
|
2586
3019
|
Loader,
|
|
2587
3020
|
Modal,
|
|
2588
3021
|
PopupCellRenderer,
|
|
@@ -2595,6 +3028,7 @@ var TableErrorBoundary = ({
|
|
|
2595
3028
|
ResetFiltersButton,
|
|
2596
3029
|
RowActions,
|
|
2597
3030
|
SearchInput,
|
|
3031
|
+
Sidebar,
|
|
2598
3032
|
TableErrorBoundary,
|
|
2599
3033
|
TableLayoutToolbarControls,
|
|
2600
3034
|
ToolTip,
|