@eztrak/shared 0.15.3 → 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-QM2TGUZN.mjs → chunk-PE7NNAX6.mjs} +537 -125
- package/dist/chunk-PE7NNAX6.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 +547 -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 +547 -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.js
CHANGED
|
@@ -31,11 +31,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var components_exports = {};
|
|
32
32
|
__export(components_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(components_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,
|
|
@@ -1294,8 +1299,473 @@ function Modal({
|
|
|
1294
1299
|
return (0, import_react_dom.createPortal)(modalContent, modalRoot);
|
|
1295
1300
|
}
|
|
1296
1301
|
|
|
1297
|
-
// src/components/
|
|
1302
|
+
// src/components/button/Button.tsx
|
|
1303
|
+
var import_react5 = require("react");
|
|
1298
1304
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1305
|
+
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";
|
|
1306
|
+
var VARIANTS2 = {
|
|
1307
|
+
primary: "bg-white text-secondary border-secondary hover:bg-lightGray hover:text-black",
|
|
1308
|
+
"primary-outline": "bg-white text-primary-150 border-primary-150 hover:bg-primary-100 hover:text-white font-bold",
|
|
1309
|
+
"primary-fill": "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1310
|
+
secondary: "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1311
|
+
danger: "bg-red-600 text-white border-red-600 hover:bg-red-700",
|
|
1312
|
+
outline: "bg-white text-primary border-primary hover:bg-primary/10",
|
|
1313
|
+
ghost: "bg-transparent text-secondary border-transparent hover:bg-primary/10 p-2",
|
|
1314
|
+
inline: "bg-transparent text-gray-500 border-none hover:text-gray-600 underline shadow-none p-0 m-0"
|
|
1315
|
+
};
|
|
1316
|
+
var SIZES = {
|
|
1317
|
+
sm: "px-3 py-2 text-xs",
|
|
1318
|
+
md: "px-5 py-3 text-sm",
|
|
1319
|
+
lg: "px-6 py-4 text-base"
|
|
1320
|
+
};
|
|
1321
|
+
var Button = (0, import_react5.forwardRef)(
|
|
1322
|
+
({
|
|
1323
|
+
children,
|
|
1324
|
+
className = "",
|
|
1325
|
+
type = "button",
|
|
1326
|
+
onClick,
|
|
1327
|
+
disabled = false,
|
|
1328
|
+
variant = "primary",
|
|
1329
|
+
size = "md",
|
|
1330
|
+
...props
|
|
1331
|
+
}, ref) => {
|
|
1332
|
+
const variantStyles = VARIANTS2[variant] || VARIANTS2.primary;
|
|
1333
|
+
const sizeStyles = SIZES[size];
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1335
|
+
"button",
|
|
1336
|
+
{
|
|
1337
|
+
ref,
|
|
1338
|
+
type,
|
|
1339
|
+
className: cn(
|
|
1340
|
+
BASE_STYLES2,
|
|
1341
|
+
variantStyles,
|
|
1342
|
+
size !== "md" && sizeStyles,
|
|
1343
|
+
className
|
|
1344
|
+
),
|
|
1345
|
+
onClick,
|
|
1346
|
+
disabled,
|
|
1347
|
+
...props,
|
|
1348
|
+
children
|
|
1349
|
+
}
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
1353
|
+
Button.displayName = "Button";
|
|
1354
|
+
|
|
1355
|
+
// src/components/card/Card.tsx
|
|
1356
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1357
|
+
function Card({
|
|
1358
|
+
title,
|
|
1359
|
+
content,
|
|
1360
|
+
icon,
|
|
1361
|
+
onClick,
|
|
1362
|
+
containerClassName = "shadow p-6",
|
|
1363
|
+
iconClassName = "",
|
|
1364
|
+
titleClassName = "",
|
|
1365
|
+
contentClassName = "",
|
|
1366
|
+
cardBodyClassName = ""
|
|
1367
|
+
}) {
|
|
1368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1369
|
+
"div",
|
|
1370
|
+
{
|
|
1371
|
+
className: cn(
|
|
1372
|
+
"transform transition duration-300 cursor-pointer select-none",
|
|
1373
|
+
containerClassName
|
|
1374
|
+
),
|
|
1375
|
+
onClick,
|
|
1376
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("flex space-x-4", cardBodyClassName), children: [
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("text-primary text-3xl", iconClassName), children: icon }),
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: cn("font-semibold text-lg text-primary", titleClassName), children: title }),
|
|
1380
|
+
content != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: cn("text-sm text-secondary", contentClassName), children: content })
|
|
1381
|
+
] })
|
|
1382
|
+
] })
|
|
1383
|
+
}
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// src/components/header/Header.tsx
|
|
1388
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1389
|
+
function Header({
|
|
1390
|
+
title = "Header",
|
|
1391
|
+
className = "p-2 gap-2 flex-col",
|
|
1392
|
+
containerClass = "",
|
|
1393
|
+
breadcrumbs = "",
|
|
1394
|
+
titleStyle = "text-4xl h-fit font-bold",
|
|
1395
|
+
breadcrumbsStyle = "text-sm",
|
|
1396
|
+
children
|
|
1397
|
+
}) {
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex ${className}`, children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "title-wrapper", children: [
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: titleStyle, children: title }),
|
|
1401
|
+
breadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `breadcrumbs-wraper ${breadcrumbsStyle}`, children: breadcrumbs })
|
|
1402
|
+
] }),
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex flex-row justify-between items-center ${containerClass}`, children })
|
|
1404
|
+
] });
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
// src/components/breadcrumbs/Breadcrumbs.tsx
|
|
1408
|
+
var import_react6 = require("react");
|
|
1409
|
+
var import_react_router_dom5 = require("react-router-dom");
|
|
1410
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1411
|
+
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]";
|
|
1412
|
+
function asTitleMap(customTitles) {
|
|
1413
|
+
if (Object.prototype.toString.call(customTitles) !== "[object Object]") {
|
|
1414
|
+
return {};
|
|
1415
|
+
}
|
|
1416
|
+
return customTitles;
|
|
1417
|
+
}
|
|
1418
|
+
function findRoute(pathname, routes, parentPath = "") {
|
|
1419
|
+
for (const route of routes) {
|
|
1420
|
+
const fullPath = `${parentPath}/${route.path}`.replace(/\/+/g, "/");
|
|
1421
|
+
if (fullPath === pathname) {
|
|
1422
|
+
return route;
|
|
1423
|
+
}
|
|
1424
|
+
if (route.children) {
|
|
1425
|
+
const childRoute = findRoute(pathname, route.children, fullPath);
|
|
1426
|
+
if (childRoute) {
|
|
1427
|
+
return childRoute;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return null;
|
|
1432
|
+
}
|
|
1433
|
+
function getLastParam(str) {
|
|
1434
|
+
return str.endsWith("/") ? str.slice(0, -1).split("/").pop() : str.split("/").pop();
|
|
1435
|
+
}
|
|
1436
|
+
function Breadcrumbs({
|
|
1437
|
+
routes = [],
|
|
1438
|
+
containerClassName,
|
|
1439
|
+
linkClassName = "",
|
|
1440
|
+
separatorClassName = "",
|
|
1441
|
+
separator = "/",
|
|
1442
|
+
activeClassName = "font-bold whitespace-pre",
|
|
1443
|
+
customTitles = {},
|
|
1444
|
+
customIcons = {},
|
|
1445
|
+
prefix,
|
|
1446
|
+
suffix,
|
|
1447
|
+
nonClickablePaths = []
|
|
1448
|
+
}) {
|
|
1449
|
+
const location = (0, import_react_router_dom5.useLocation)();
|
|
1450
|
+
const pathnames = location.pathname.split("/").filter((segment) => segment);
|
|
1451
|
+
const titles = asTitleMap(customTitles);
|
|
1452
|
+
const inactiveLinkClassName = cn(INACTIVE_LINK_CLASS, linkClassName);
|
|
1453
|
+
const getTitle = (pathname) => {
|
|
1454
|
+
const match = findRoute(pathname, routes);
|
|
1455
|
+
if (match && match.title) {
|
|
1456
|
+
return match.title;
|
|
1457
|
+
}
|
|
1458
|
+
const titleKeys = Object.keys(titles);
|
|
1459
|
+
const paramMatch = pathname.split("/").find((segment) => titleKeys.includes(segment)) || "";
|
|
1460
|
+
if (paramMatch && titles[paramMatch]) {
|
|
1461
|
+
return titles[paramMatch];
|
|
1462
|
+
}
|
|
1463
|
+
const lastParamPath = getLastParam(pathname);
|
|
1464
|
+
if (lastParamPath) {
|
|
1465
|
+
return lastParamPath;
|
|
1466
|
+
}
|
|
1467
|
+
return pathname;
|
|
1468
|
+
};
|
|
1469
|
+
const getIcon = (pathname) => {
|
|
1470
|
+
const iconKeys = Object.keys(customIcons);
|
|
1471
|
+
const matchedSegment = pathname.split("/").find((segment) => iconKeys.includes(segment));
|
|
1472
|
+
if (matchedSegment && customIcons[matchedSegment]) {
|
|
1473
|
+
return customIcons[matchedSegment];
|
|
1474
|
+
}
|
|
1475
|
+
return null;
|
|
1476
|
+
};
|
|
1477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1478
|
+
"div",
|
|
1479
|
+
{
|
|
1480
|
+
className: cn(
|
|
1481
|
+
"flex flex-row gap-2 items-center text-sm text-secondary",
|
|
1482
|
+
containerClassName
|
|
1483
|
+
),
|
|
1484
|
+
children: [
|
|
1485
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "breadcrumb-prefix", children: prefix }),
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_router_dom5.Link, { to: "/", className: inactiveLinkClassName, children: [
|
|
1487
|
+
customIcons.home && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-1", children: customIcons.home }),
|
|
1488
|
+
titles.home || "Home"
|
|
1489
|
+
] }),
|
|
1490
|
+
pathnames.map((segment, index) => {
|
|
1491
|
+
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
|
|
1492
|
+
const isLast = index === pathnames.length - 1;
|
|
1493
|
+
const title = getTitle(to);
|
|
1494
|
+
const icon = getIcon(to);
|
|
1495
|
+
const isNonClickable = nonClickablePaths.some(
|
|
1496
|
+
(token) => to.includes(token) || segment === token
|
|
1497
|
+
);
|
|
1498
|
+
const crumb = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1499
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mr-1", children: icon }),
|
|
1500
|
+
title
|
|
1501
|
+
] });
|
|
1502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react6.Fragment, { children: [
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: separatorClassName, children: separator }),
|
|
1504
|
+
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 })
|
|
1505
|
+
] }, to);
|
|
1506
|
+
}),
|
|
1507
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "breadcrumb-suffix", children: suffix })
|
|
1508
|
+
]
|
|
1509
|
+
}
|
|
1510
|
+
);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
// src/components/sidebar/Sidebar.tsx
|
|
1514
|
+
var import_react8 = require("react");
|
|
1515
|
+
var import_react_router_dom6 = require("react-router-dom");
|
|
1516
|
+
|
|
1517
|
+
// src/components/tooltip/ToolTip.tsx
|
|
1518
|
+
var import_react7 = require("react");
|
|
1519
|
+
var import_react_tooltip = require("react-tooltip");
|
|
1520
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1521
|
+
var defaultTooltipStyle = {
|
|
1522
|
+
color: "#fff",
|
|
1523
|
+
borderRadius: "5px",
|
|
1524
|
+
zIndex: 999,
|
|
1525
|
+
textAlign: "justify",
|
|
1526
|
+
maxWidth: "300px",
|
|
1527
|
+
whiteSpace: "pre-wrap",
|
|
1528
|
+
wordWrap: "break-word",
|
|
1529
|
+
overflowWrap: "break-word"
|
|
1530
|
+
};
|
|
1531
|
+
function ToolTip({
|
|
1532
|
+
text = "tool tip",
|
|
1533
|
+
placement = "top",
|
|
1534
|
+
delayShow,
|
|
1535
|
+
delayHide,
|
|
1536
|
+
className,
|
|
1537
|
+
tooltipClassName,
|
|
1538
|
+
tooltipStyle,
|
|
1539
|
+
wrapperTabIndex,
|
|
1540
|
+
disabled = false,
|
|
1541
|
+
children
|
|
1542
|
+
}) {
|
|
1543
|
+
const generatedId = (0, import_react7.useId)();
|
|
1544
|
+
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1545
|
+
const tooltipText = String(text ?? "");
|
|
1546
|
+
if (disabled || !tooltipText) {
|
|
1547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className, children });
|
|
1548
|
+
}
|
|
1549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1551
|
+
"span",
|
|
1552
|
+
{
|
|
1553
|
+
className,
|
|
1554
|
+
"data-tooltip-id": tooltipId,
|
|
1555
|
+
"data-tooltip-content": tooltipText,
|
|
1556
|
+
tabIndex: wrapperTabIndex,
|
|
1557
|
+
children
|
|
1558
|
+
}
|
|
1559
|
+
),
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1561
|
+
import_react_tooltip.Tooltip,
|
|
1562
|
+
{
|
|
1563
|
+
id: tooltipId,
|
|
1564
|
+
place: placement,
|
|
1565
|
+
positionStrategy: "fixed",
|
|
1566
|
+
delayShow,
|
|
1567
|
+
delayHide,
|
|
1568
|
+
className: tooltipClassName,
|
|
1569
|
+
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
1570
|
+
}
|
|
1571
|
+
)
|
|
1572
|
+
] });
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// src/components/sidebar/Sidebar.tsx
|
|
1576
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1577
|
+
function Sidebar({
|
|
1578
|
+
className,
|
|
1579
|
+
sideCollapseWidth = "w-20",
|
|
1580
|
+
sidebarWidth = "w-48",
|
|
1581
|
+
header,
|
|
1582
|
+
children,
|
|
1583
|
+
footer,
|
|
1584
|
+
items = [],
|
|
1585
|
+
logoUrl = "",
|
|
1586
|
+
logoAltText = "Logo",
|
|
1587
|
+
collapseButtonText = "\u2B05\uFE0F Collapse",
|
|
1588
|
+
expandButtonText = "\u27A1\uFE0F",
|
|
1589
|
+
location: _location,
|
|
1590
|
+
classNames = {},
|
|
1591
|
+
onCollapseChange,
|
|
1592
|
+
isCollapsed = false,
|
|
1593
|
+
itemDropdownIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u25BC" }),
|
|
1594
|
+
...rest
|
|
1595
|
+
}) {
|
|
1596
|
+
const location = (0, import_react_router_dom6.useLocation)();
|
|
1597
|
+
const [collapsed, setCollapsed] = (0, import_react8.useState)(isCollapsed);
|
|
1598
|
+
const [, setActiveLink] = (0, import_react8.useState)(location.pathname);
|
|
1599
|
+
const [subItemsCollapsed, setSubItemsCollapsed] = (0, import_react8.useState)({});
|
|
1600
|
+
(0, import_react8.useEffect)(() => {
|
|
1601
|
+
if (onCollapseChange) {
|
|
1602
|
+
onCollapseChange(collapsed);
|
|
1603
|
+
}
|
|
1604
|
+
}, [collapsed, onCollapseChange]);
|
|
1605
|
+
(0, import_react8.useEffect)(() => {
|
|
1606
|
+
setActiveLink(location.pathname);
|
|
1607
|
+
}, [location]);
|
|
1608
|
+
const toggleGroup = (group) => {
|
|
1609
|
+
setSubItemsCollapsed((prevState) => ({
|
|
1610
|
+
...prevState,
|
|
1611
|
+
[group]: !prevState[group]
|
|
1612
|
+
}));
|
|
1613
|
+
};
|
|
1614
|
+
const isActive = (link) => {
|
|
1615
|
+
return location.pathname.startsWith(link);
|
|
1616
|
+
};
|
|
1617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1618
|
+
"div",
|
|
1619
|
+
{
|
|
1620
|
+
className: `flex flex-col h-screen overflow-hidden ${collapsed ? `${sideCollapseWidth} justify-center items-center collapsed` : `${sidebarWidth}`} transition-all duration-100 ${className ?? ""}`,
|
|
1621
|
+
...rest,
|
|
1622
|
+
children: [
|
|
1623
|
+
logoUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1624
|
+
"div",
|
|
1625
|
+
{
|
|
1626
|
+
className: cn(
|
|
1627
|
+
"flex items-center justify-center h-16 border-b border-gray-300",
|
|
1628
|
+
classNames.logoSection
|
|
1629
|
+
),
|
|
1630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: logoUrl, alt: logoAltText, className: "h-10" })
|
|
1631
|
+
}
|
|
1632
|
+
),
|
|
1633
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-between p-4 border-b border-gray-300", children: header }),
|
|
1634
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { className: cn("flex-grow", classNames.navSection), children: items.map((item, index) => {
|
|
1635
|
+
if (item.subItems) {
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1637
|
+
"div",
|
|
1638
|
+
{
|
|
1639
|
+
className: `my-2 ${item?.subItems && "has-sub-items"}`,
|
|
1640
|
+
children: [
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1642
|
+
"div",
|
|
1643
|
+
{
|
|
1644
|
+
onClick: () => toggleGroup(item.name),
|
|
1645
|
+
"data-sidebar-item": item.name,
|
|
1646
|
+
"data-tooltip-id": item.name,
|
|
1647
|
+
className: `flex cursor-pointer dropdown-title-wrapper ${classNames?.navItem ?? ""}`,
|
|
1648
|
+
children: [
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1650
|
+
ToolTip,
|
|
1651
|
+
{
|
|
1652
|
+
text: item.tooltip || item.name,
|
|
1653
|
+
placement: item.tooltipPlacement || "top",
|
|
1654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames?.navItemText, children: item.icon }),
|
|
1656
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames?.navItemText, children: item.name })
|
|
1657
|
+
] })
|
|
1658
|
+
}
|
|
1659
|
+
),
|
|
1660
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1661
|
+
"span",
|
|
1662
|
+
{
|
|
1663
|
+
className: `transform transition-transform ${subItemsCollapsed[item.name] ? "rotate-180" : "rotate-0"}`,
|
|
1664
|
+
children: itemDropdownIcon
|
|
1665
|
+
}
|
|
1666
|
+
)
|
|
1667
|
+
]
|
|
1668
|
+
}
|
|
1669
|
+
),
|
|
1670
|
+
subItemsCollapsed[item.name] && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("collapse-btn-wrapper", classNames.subItem), children: item.subItems.map((subItem, subIndex) => {
|
|
1671
|
+
if (subItem.component) {
|
|
1672
|
+
const SubItemComponent = subItem.component;
|
|
1673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SubItemComponent, {}, `${index}-${subIndex}`);
|
|
1674
|
+
}
|
|
1675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1676
|
+
"div",
|
|
1677
|
+
{
|
|
1678
|
+
className: "w-full",
|
|
1679
|
+
"data-sidebar-item": subItem.name,
|
|
1680
|
+
"data-tooltip-id": subItem.name,
|
|
1681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1682
|
+
ToolTip,
|
|
1683
|
+
{
|
|
1684
|
+
text: item.tooltip || item.name,
|
|
1685
|
+
placement: item.tooltipPlacement || "top",
|
|
1686
|
+
className: "block w-full",
|
|
1687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1688
|
+
import_react_router_dom6.Link,
|
|
1689
|
+
{
|
|
1690
|
+
to: subItem.link || "#",
|
|
1691
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(subItem?.link ?? "") ? "active" : ""} ${item?.itemClassName}`,
|
|
1692
|
+
onClick: () => subItem.link && setActiveLink(subItem.link || ""),
|
|
1693
|
+
title: subItem.tooltip || subItem.name,
|
|
1694
|
+
children: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1696
|
+
"span",
|
|
1697
|
+
{
|
|
1698
|
+
className: classNames.navItemText ?? "text-orange-600",
|
|
1699
|
+
children: subItem.icon
|
|
1700
|
+
}
|
|
1701
|
+
),
|
|
1702
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText, children: subItem.name })
|
|
1703
|
+
]
|
|
1704
|
+
}
|
|
1705
|
+
)
|
|
1706
|
+
}
|
|
1707
|
+
)
|
|
1708
|
+
},
|
|
1709
|
+
`${index}-${subIndex}`
|
|
1710
|
+
);
|
|
1711
|
+
}) })
|
|
1712
|
+
]
|
|
1713
|
+
},
|
|
1714
|
+
index
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
if (item.component) {
|
|
1718
|
+
const ItemComponent = item.component;
|
|
1719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ItemComponent, {}, index);
|
|
1720
|
+
}
|
|
1721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1722
|
+
"div",
|
|
1723
|
+
{
|
|
1724
|
+
className: "w-full",
|
|
1725
|
+
"data-sidebar-item": item.name,
|
|
1726
|
+
"data-tooltip-id": item.name,
|
|
1727
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1728
|
+
ToolTip,
|
|
1729
|
+
{
|
|
1730
|
+
text: item.tooltip || item.name,
|
|
1731
|
+
placement: item.tooltipPlacement || "top",
|
|
1732
|
+
className: "block w-full",
|
|
1733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1734
|
+
import_react_router_dom6.Link,
|
|
1735
|
+
{
|
|
1736
|
+
to: item.link || "#",
|
|
1737
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(item.link || "") ? "active" : ""} ${item?.itemClassName}`,
|
|
1738
|
+
onClick: () => setActiveLink(item.link || ""),
|
|
1739
|
+
title: item.tooltip || item.name,
|
|
1740
|
+
children: [
|
|
1741
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText ?? "text-orange-600", children: item.icon }),
|
|
1742
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: classNames.navItemText, children: item.name })
|
|
1743
|
+
]
|
|
1744
|
+
}
|
|
1745
|
+
)
|
|
1746
|
+
}
|
|
1747
|
+
)
|
|
1748
|
+
},
|
|
1749
|
+
index
|
|
1750
|
+
);
|
|
1751
|
+
}) }),
|
|
1752
|
+
children,
|
|
1753
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1754
|
+
"button",
|
|
1755
|
+
{
|
|
1756
|
+
onClick: () => setCollapsed(!collapsed),
|
|
1757
|
+
className: cn("", classNames.collapseButton) ?? "p-4 border-t border-gray-300",
|
|
1758
|
+
children: collapsed ? expandButtonText : collapseButtonText
|
|
1759
|
+
}
|
|
1760
|
+
),
|
|
1761
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: classNames?.footer ?? "p-4 border-t border-gray-300", children: footer })
|
|
1762
|
+
]
|
|
1763
|
+
}
|
|
1764
|
+
);
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
// src/components/skeleton/CardSkeleton.tsx
|
|
1768
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1299
1769
|
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
1300
1770
|
function shouldShowAvatar(variant, showAvatar) {
|
|
1301
1771
|
return showAvatar ?? variant === "profile";
|
|
@@ -1304,7 +1774,7 @@ function shouldShowImage(variant, showImage) {
|
|
|
1304
1774
|
return showImage ?? variant === "image";
|
|
1305
1775
|
}
|
|
1306
1776
|
function AvatarSkeleton({ className }) {
|
|
1307
|
-
return /* @__PURE__ */ (0,
|
|
1777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1308
1778
|
"svg",
|
|
1309
1779
|
{
|
|
1310
1780
|
className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
|
|
@@ -1312,7 +1782,7 @@ function AvatarSkeleton({ className }) {
|
|
|
1312
1782
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1313
1783
|
fill: "currentColor",
|
|
1314
1784
|
viewBox: "0 0 20 20",
|
|
1315
|
-
children: /* @__PURE__ */ (0,
|
|
1785
|
+
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" })
|
|
1316
1786
|
}
|
|
1317
1787
|
);
|
|
1318
1788
|
}
|
|
@@ -1321,7 +1791,7 @@ function SkeletonBlock({
|
|
|
1321
1791
|
className,
|
|
1322
1792
|
isFirst
|
|
1323
1793
|
}) {
|
|
1324
|
-
return /* @__PURE__ */ (0,
|
|
1794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1325
1795
|
"div",
|
|
1326
1796
|
{
|
|
1327
1797
|
className: cn(
|
|
@@ -1353,14 +1823,14 @@ function CardSkeleton({
|
|
|
1353
1823
|
const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
|
|
1354
1824
|
const renderAvatar = shouldShowAvatar(variant, showAvatar);
|
|
1355
1825
|
const renderImage = shouldShowImage(variant, showImage);
|
|
1356
|
-
return /* @__PURE__ */ (0,
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1357
1827
|
"div",
|
|
1358
1828
|
{
|
|
1359
1829
|
className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
|
|
1360
1830
|
style: { animationDuration, ...style },
|
|
1361
1831
|
...props,
|
|
1362
1832
|
children: [
|
|
1363
|
-
renderImage ? /* @__PURE__ */ (0,
|
|
1833
|
+
renderImage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1364
1834
|
"div",
|
|
1365
1835
|
{
|
|
1366
1836
|
className: cn(
|
|
@@ -1369,9 +1839,9 @@ function CardSkeleton({
|
|
|
1369
1839
|
)
|
|
1370
1840
|
}
|
|
1371
1841
|
) : null,
|
|
1372
|
-
/* @__PURE__ */ (0,
|
|
1373
|
-
renderAvatar ? /* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
|
|
1843
|
+
renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
|
|
1844
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1375
1845
|
SkeletonBlock,
|
|
1376
1846
|
{
|
|
1377
1847
|
widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
|
|
@@ -1381,71 +1851,13 @@ function CardSkeleton({
|
|
|
1381
1851
|
lineIndex
|
|
1382
1852
|
)) })
|
|
1383
1853
|
] }),
|
|
1384
|
-
/* @__PURE__ */ (0,
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: srLabel })
|
|
1385
1855
|
]
|
|
1386
1856
|
},
|
|
1387
1857
|
index
|
|
1388
1858
|
);
|
|
1389
1859
|
});
|
|
1390
|
-
return /* @__PURE__ */ (0,
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
// src/components/tooltip/ToolTip.tsx
|
|
1394
|
-
var import_react5 = require("react");
|
|
1395
|
-
var import_react_tooltip = require("react-tooltip");
|
|
1396
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1397
|
-
var defaultTooltipStyle = {
|
|
1398
|
-
color: "#fff",
|
|
1399
|
-
borderRadius: "5px",
|
|
1400
|
-
zIndex: 999,
|
|
1401
|
-
textAlign: "justify",
|
|
1402
|
-
maxWidth: "300px",
|
|
1403
|
-
whiteSpace: "pre-wrap",
|
|
1404
|
-
wordWrap: "break-word",
|
|
1405
|
-
overflowWrap: "break-word"
|
|
1406
|
-
};
|
|
1407
|
-
function ToolTip({
|
|
1408
|
-
text = "tool tip",
|
|
1409
|
-
placement = "top",
|
|
1410
|
-
delayShow,
|
|
1411
|
-
delayHide,
|
|
1412
|
-
className,
|
|
1413
|
-
tooltipClassName,
|
|
1414
|
-
tooltipStyle,
|
|
1415
|
-
wrapperTabIndex,
|
|
1416
|
-
disabled = false,
|
|
1417
|
-
children
|
|
1418
|
-
}) {
|
|
1419
|
-
const generatedId = (0, import_react5.useId)();
|
|
1420
|
-
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1421
|
-
const tooltipText = String(text ?? "");
|
|
1422
|
-
if (disabled || !tooltipText) {
|
|
1423
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className, children });
|
|
1424
|
-
}
|
|
1425
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1426
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1427
|
-
"span",
|
|
1428
|
-
{
|
|
1429
|
-
className,
|
|
1430
|
-
"data-tooltip-id": tooltipId,
|
|
1431
|
-
"data-tooltip-content": tooltipText,
|
|
1432
|
-
tabIndex: wrapperTabIndex,
|
|
1433
|
-
children
|
|
1434
|
-
}
|
|
1435
|
-
),
|
|
1436
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1437
|
-
import_react_tooltip.Tooltip,
|
|
1438
|
-
{
|
|
1439
|
-
id: tooltipId,
|
|
1440
|
-
place: placement,
|
|
1441
|
-
positionStrategy: "fixed",
|
|
1442
|
-
delayShow,
|
|
1443
|
-
delayHide,
|
|
1444
|
-
className: tooltipClassName,
|
|
1445
|
-
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
1446
|
-
}
|
|
1447
|
-
)
|
|
1448
|
-
] });
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: skeletons });
|
|
1449
1861
|
}
|
|
1450
1862
|
|
|
1451
1863
|
// src/utils/helpers.ts
|
|
@@ -1477,7 +1889,7 @@ var toDateInputValue = (date) => {
|
|
|
1477
1889
|
};
|
|
1478
1890
|
|
|
1479
1891
|
// src/components/tooltip/TooltipText.tsx
|
|
1480
|
-
var
|
|
1892
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1481
1893
|
function TooltipText({
|
|
1482
1894
|
text = "",
|
|
1483
1895
|
maxLength = 20,
|
|
@@ -1497,7 +1909,7 @@ function TooltipText({
|
|
|
1497
1909
|
const displayText = truncateText(fullText, maxLength);
|
|
1498
1910
|
const isTruncated = displayText !== fullText;
|
|
1499
1911
|
const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
|
|
1500
|
-
return /* @__PURE__ */ (0,
|
|
1912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1501
1913
|
ToolTip,
|
|
1502
1914
|
{
|
|
1503
1915
|
text: fullText,
|
|
@@ -1509,17 +1921,17 @@ function TooltipText({
|
|
|
1509
1921
|
tooltipStyle,
|
|
1510
1922
|
wrapperTabIndex: tooltipDisabled ? void 0 : 0,
|
|
1511
1923
|
disabled: tooltipDisabled,
|
|
1512
|
-
children: /* @__PURE__ */ (0,
|
|
1924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
|
|
1513
1925
|
}
|
|
1514
1926
|
);
|
|
1515
1927
|
}
|
|
1516
1928
|
|
|
1517
1929
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1518
|
-
var
|
|
1930
|
+
var import_react9 = require("react");
|
|
1519
1931
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1520
|
-
var
|
|
1932
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1521
1933
|
function ButtonSpinner() {
|
|
1522
|
-
return /* @__PURE__ */ (0,
|
|
1934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1523
1935
|
"svg",
|
|
1524
1936
|
{
|
|
1525
1937
|
className: "animate-spin",
|
|
@@ -1529,7 +1941,7 @@ function ButtonSpinner() {
|
|
|
1529
1941
|
fill: "none",
|
|
1530
1942
|
"aria-hidden": true,
|
|
1531
1943
|
children: [
|
|
1532
|
-
/* @__PURE__ */ (0,
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1533
1945
|
"circle",
|
|
1534
1946
|
{
|
|
1535
1947
|
cx: "12",
|
|
@@ -1540,7 +1952,7 @@ function ButtonSpinner() {
|
|
|
1540
1952
|
strokeOpacity: "0.25"
|
|
1541
1953
|
}
|
|
1542
1954
|
),
|
|
1543
|
-
/* @__PURE__ */ (0,
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1544
1956
|
"path",
|
|
1545
1957
|
{
|
|
1546
1958
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
@@ -1562,7 +1974,7 @@ function normalizeInitialValue(initialValue, inputType) {
|
|
|
1562
1974
|
}
|
|
1563
1975
|
return initialValue;
|
|
1564
1976
|
}
|
|
1565
|
-
var CustomCellEditor = (0,
|
|
1977
|
+
var CustomCellEditor = (0, import_react9.forwardRef)(
|
|
1566
1978
|
({
|
|
1567
1979
|
value: initialValue,
|
|
1568
1980
|
name,
|
|
@@ -1587,11 +1999,11 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1587
1999
|
cancelButtonClassName
|
|
1588
2000
|
}, ref) => {
|
|
1589
2001
|
const normalizedInitial = normalizeInitialValue(initialValue, inputType);
|
|
1590
|
-
const [value, setValue] = (0,
|
|
1591
|
-
const [isLoading, setIsLoading] = (0,
|
|
1592
|
-
const inputRef = (0,
|
|
1593
|
-
const selectRef = (0,
|
|
1594
|
-
const normalizedOptions = (0,
|
|
2002
|
+
const [value, setValue] = (0, import_react9.useState)(normalizedInitial);
|
|
2003
|
+
const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
|
|
2004
|
+
const inputRef = (0, import_react9.useRef)(null);
|
|
2005
|
+
const selectRef = (0, import_react9.useRef)(null);
|
|
2006
|
+
const normalizedOptions = (0, import_react9.useMemo)(() => {
|
|
1595
2007
|
if (customOptions && customOptions.length > 0) {
|
|
1596
2008
|
return customOptions.map((opt) => ({
|
|
1597
2009
|
value: String(opt[valueKey] ?? ""),
|
|
@@ -1601,13 +2013,13 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1601
2013
|
return dropdownOptions;
|
|
1602
2014
|
}, [customOptions, dropdownOptions, valueKey, labelKey]);
|
|
1603
2015
|
const isDropdown = inputType === "dropdown" || normalizedOptions.length > 0;
|
|
1604
|
-
(0,
|
|
2016
|
+
(0, import_react9.useImperativeHandle)(ref, () => ({
|
|
1605
2017
|
getValue: () => value,
|
|
1606
2018
|
isCancelBeforeStart: () => false,
|
|
1607
2019
|
isCancelAfterEnd: () => false,
|
|
1608
2020
|
isPopup: () => true
|
|
1609
2021
|
}));
|
|
1610
|
-
(0,
|
|
2022
|
+
(0, import_react9.useEffect)(() => {
|
|
1611
2023
|
if (isDropdown) {
|
|
1612
2024
|
selectRef.current?.focus();
|
|
1613
2025
|
return;
|
|
@@ -1676,7 +2088,7 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1676
2088
|
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";
|
|
1677
2089
|
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";
|
|
1678
2090
|
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";
|
|
1679
|
-
return /* @__PURE__ */ (0,
|
|
2091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1680
2092
|
"div",
|
|
1681
2093
|
{
|
|
1682
2094
|
className: cn(
|
|
@@ -1685,7 +2097,7 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1685
2097
|
),
|
|
1686
2098
|
style: containerStyle,
|
|
1687
2099
|
children: [
|
|
1688
|
-
isDropdown ? /* @__PURE__ */ (0,
|
|
2100
|
+
isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1689
2101
|
"select",
|
|
1690
2102
|
{
|
|
1691
2103
|
ref: selectRef,
|
|
@@ -1695,11 +2107,11 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1695
2107
|
className: inputClassName ?? defaultInputClass,
|
|
1696
2108
|
disabled: isLoading,
|
|
1697
2109
|
children: [
|
|
1698
|
-
/* @__PURE__ */ (0,
|
|
1699
|
-
normalizedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
|
|
2111
|
+
normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1700
2112
|
]
|
|
1701
2113
|
}
|
|
1702
|
-
) : /* @__PURE__ */ (0,
|
|
2114
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1703
2115
|
"input",
|
|
1704
2116
|
{
|
|
1705
2117
|
ref: inputRef,
|
|
@@ -1712,7 +2124,7 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1712
2124
|
disabled: isLoading
|
|
1713
2125
|
}
|
|
1714
2126
|
),
|
|
1715
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1716
2128
|
"button",
|
|
1717
2129
|
{
|
|
1718
2130
|
type: "button",
|
|
@@ -1721,10 +2133,10 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1721
2133
|
className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
|
|
1722
2134
|
style: saveButtonStyle,
|
|
1723
2135
|
title: "Save (Enter)",
|
|
1724
|
-
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0,
|
|
2136
|
+
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
|
|
1725
2137
|
}
|
|
1726
2138
|
),
|
|
1727
|
-
/* @__PURE__ */ (0,
|
|
2139
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1728
2140
|
"button",
|
|
1729
2141
|
{
|
|
1730
2142
|
type: "button",
|
|
@@ -1744,10 +2156,10 @@ var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
|
1744
2156
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
1745
2157
|
|
|
1746
2158
|
// src/components/popup-cell-renderer/PopupCellRenderer.tsx
|
|
1747
|
-
var
|
|
1748
|
-
var
|
|
2159
|
+
var import_react10 = require("react");
|
|
2160
|
+
var import_react11 = __toESM(require("@tippyjs/react"));
|
|
1749
2161
|
var import_bi = require("react-icons/bi");
|
|
1750
|
-
var
|
|
2162
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1751
2163
|
function PopupCellRenderer({
|
|
1752
2164
|
dropDownContent,
|
|
1753
2165
|
actionIcon: ActionIcon = import_bi.BiDotsVerticalRounded,
|
|
@@ -1761,8 +2173,8 @@ function PopupCellRenderer({
|
|
|
1761
2173
|
ariaLabel = "Row actions",
|
|
1762
2174
|
openOnHover = false
|
|
1763
2175
|
}) {
|
|
1764
|
-
const [visible, setVisible] = (0,
|
|
1765
|
-
const instanceRef = (0,
|
|
2176
|
+
const [visible, setVisible] = (0, import_react10.useState)(false);
|
|
2177
|
+
const instanceRef = (0, import_react10.useRef)(null);
|
|
1766
2178
|
const show = () => setVisible(true);
|
|
1767
2179
|
const hide = () => {
|
|
1768
2180
|
setVisible(false);
|
|
@@ -1782,8 +2194,8 @@ function PopupCellRenderer({
|
|
|
1782
2194
|
visible,
|
|
1783
2195
|
onClickOutside: hide
|
|
1784
2196
|
};
|
|
1785
|
-
return /* @__PURE__ */ (0,
|
|
1786
|
-
|
|
2197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2198
|
+
import_react11.default,
|
|
1787
2199
|
{
|
|
1788
2200
|
content,
|
|
1789
2201
|
allowHTML: true,
|
|
@@ -1800,7 +2212,7 @@ function PopupCellRenderer({
|
|
|
1800
2212
|
},
|
|
1801
2213
|
...hoverOrClickProps,
|
|
1802
2214
|
...tippyProps,
|
|
1803
|
-
children: /* @__PURE__ */ (0,
|
|
2215
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1804
2216
|
"button",
|
|
1805
2217
|
{
|
|
1806
2218
|
type: "button",
|
|
@@ -1812,7 +2224,7 @@ function PopupCellRenderer({
|
|
|
1812
2224
|
"aria-label": ariaLabel,
|
|
1813
2225
|
children: [
|
|
1814
2226
|
!hideTitle && title,
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ActionIcon, { "aria-hidden": true })
|
|
1816
2228
|
]
|
|
1817
2229
|
}
|
|
1818
2230
|
)
|
|
@@ -1840,7 +2252,7 @@ var ROW_ACTION_PRESETS = {
|
|
|
1840
2252
|
};
|
|
1841
2253
|
|
|
1842
2254
|
// src/components/row-actions/ActionMenuItem.tsx
|
|
1843
|
-
var
|
|
2255
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1844
2256
|
function ActionMenuItem({
|
|
1845
2257
|
label,
|
|
1846
2258
|
icon: Icon,
|
|
@@ -1861,7 +2273,7 @@ function ActionMenuItem({
|
|
|
1861
2273
|
onClick
|
|
1862
2274
|
}) {
|
|
1863
2275
|
const tooltipText = tooltip ?? label;
|
|
1864
|
-
return /* @__PURE__ */ (0,
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1865
2277
|
ToolTip,
|
|
1866
2278
|
{
|
|
1867
2279
|
text: tooltipText,
|
|
@@ -1872,7 +2284,7 @@ function ActionMenuItem({
|
|
|
1872
2284
|
tooltipClassName,
|
|
1873
2285
|
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
1874
2286
|
className: showLabel ? "block w-full" : "inline-flex",
|
|
1875
|
-
children: /* @__PURE__ */ (0,
|
|
2287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1876
2288
|
"button",
|
|
1877
2289
|
{
|
|
1878
2290
|
type: "button",
|
|
@@ -1892,7 +2304,7 @@ function ActionMenuItem({
|
|
|
1892
2304
|
className
|
|
1893
2305
|
),
|
|
1894
2306
|
children: [
|
|
1895
|
-
Icon ? /* @__PURE__ */ (0,
|
|
2307
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1896
2308
|
Icon,
|
|
1897
2309
|
{
|
|
1898
2310
|
className: cn("shrink-0", iconClassName),
|
|
@@ -1900,7 +2312,7 @@ function ActionMenuItem({
|
|
|
1900
2312
|
size: iconSize
|
|
1901
2313
|
}
|
|
1902
2314
|
) : null,
|
|
1903
|
-
showLabel ? /* @__PURE__ */ (0,
|
|
2315
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: labelClassName, children: label }) : null
|
|
1904
2316
|
]
|
|
1905
2317
|
}
|
|
1906
2318
|
)
|
|
@@ -1958,7 +2370,7 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
1958
2370
|
}
|
|
1959
2371
|
|
|
1960
2372
|
// src/components/row-actions/RowActions.tsx
|
|
1961
|
-
var
|
|
2373
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1962
2374
|
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
1963
2375
|
if (!action.onClick) {
|
|
1964
2376
|
if (action.closeOnClick) hide?.();
|
|
@@ -2012,7 +2424,7 @@ function RowActions({
|
|
|
2012
2424
|
};
|
|
2013
2425
|
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
2014
2426
|
if (action.type === "divider") {
|
|
2015
|
-
return /* @__PURE__ */ (0,
|
|
2427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2016
2428
|
"div",
|
|
2017
2429
|
{
|
|
2018
2430
|
role: "separator",
|
|
@@ -2022,9 +2434,9 @@ function RowActions({
|
|
|
2022
2434
|
);
|
|
2023
2435
|
}
|
|
2024
2436
|
if (action.content) {
|
|
2025
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: action.className, children: action.content }, action.key);
|
|
2026
2438
|
}
|
|
2027
|
-
return /* @__PURE__ */ (0,
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2028
2440
|
ActionMenuItem,
|
|
2029
2441
|
{
|
|
2030
2442
|
label: action.label,
|
|
@@ -2051,15 +2463,15 @@ function RowActions({
|
|
|
2051
2463
|
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
2052
2464
|
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
2053
2465
|
if (!renderItem) return defaultItem;
|
|
2054
|
-
return /* @__PURE__ */ (0,
|
|
2466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
2055
2467
|
});
|
|
2056
2468
|
if (mode === "inline") {
|
|
2057
2469
|
const inlineItems = renderItems(void 0, false);
|
|
2058
|
-
return /* @__PURE__ */ (0,
|
|
2470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("flex h-full items-center justify-center gap-1", className), children: inlineItems });
|
|
2059
2471
|
}
|
|
2060
2472
|
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
2061
2473
|
const buildMenu = (hide) => {
|
|
2062
|
-
const defaultMenu = /* @__PURE__ */ (0,
|
|
2474
|
+
const defaultMenu = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2063
2475
|
"div",
|
|
2064
2476
|
{
|
|
2065
2477
|
className: cn(
|
|
@@ -2078,14 +2490,14 @@ function RowActions({
|
|
|
2078
2490
|
});
|
|
2079
2491
|
};
|
|
2080
2492
|
if (renderTrigger) {
|
|
2081
|
-
return /* @__PURE__ */ (0,
|
|
2493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: renderTrigger({
|
|
2082
2494
|
data,
|
|
2083
2495
|
actions: resolved,
|
|
2084
2496
|
hide: () => void 0,
|
|
2085
2497
|
defaultMenu: buildMenu(() => void 0)
|
|
2086
2498
|
}) });
|
|
2087
2499
|
}
|
|
2088
|
-
return /* @__PURE__ */ (0,
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2089
2501
|
ToolTip,
|
|
2090
2502
|
{
|
|
2091
2503
|
text: triggerTooltipText,
|
|
@@ -2096,7 +2508,7 @@ function RowActions({
|
|
|
2096
2508
|
tooltipClassName,
|
|
2097
2509
|
tooltipStyle,
|
|
2098
2510
|
className: "flex h-full items-center justify-center",
|
|
2099
|
-
children: /* @__PURE__ */ (0,
|
|
2511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2100
2512
|
PopupCellRenderer,
|
|
2101
2513
|
{
|
|
2102
2514
|
params: { data },
|
|
@@ -2115,9 +2527,9 @@ function RowActions({
|
|
|
2115
2527
|
}
|
|
2116
2528
|
|
|
2117
2529
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
2118
|
-
var
|
|
2530
|
+
var import_react12 = require("react");
|
|
2119
2531
|
var import_fa6 = require("react-icons/fa6");
|
|
2120
|
-
var
|
|
2532
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2121
2533
|
var TableErrorBoundary = ({
|
|
2122
2534
|
isError,
|
|
2123
2535
|
isLoading = false,
|
|
@@ -2128,13 +2540,13 @@ var TableErrorBoundary = ({
|
|
|
2128
2540
|
className,
|
|
2129
2541
|
minHeight = "280px"
|
|
2130
2542
|
}) => {
|
|
2131
|
-
const message = (0,
|
|
2543
|
+
const message = (0, import_react12.useMemo)(() => {
|
|
2132
2544
|
if (errorMessage) return errorMessage;
|
|
2133
2545
|
if (error) return classifyError(error).userMessage;
|
|
2134
2546
|
return "Unable to load table data. Please try again.";
|
|
2135
2547
|
}, [error, errorMessage]);
|
|
2136
2548
|
if (isLoading && !isError) {
|
|
2137
|
-
return /* @__PURE__ */ (0,
|
|
2549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2138
2550
|
"div",
|
|
2139
2551
|
{
|
|
2140
2552
|
className: cn(
|
|
@@ -2145,12 +2557,12 @@ var TableErrorBoundary = ({
|
|
|
2145
2557
|
role: "status",
|
|
2146
2558
|
"aria-live": "polite",
|
|
2147
2559
|
"aria-busy": "true",
|
|
2148
|
-
children: /* @__PURE__ */ (0,
|
|
2560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, { size: "40px" })
|
|
2149
2561
|
}
|
|
2150
2562
|
);
|
|
2151
2563
|
}
|
|
2152
2564
|
if (isError) {
|
|
2153
|
-
return /* @__PURE__ */ (0,
|
|
2565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2154
2566
|
"div",
|
|
2155
2567
|
{
|
|
2156
2568
|
className: cn(
|
|
@@ -2161,7 +2573,7 @@ var TableErrorBoundary = ({
|
|
|
2161
2573
|
role: "alert",
|
|
2162
2574
|
"aria-live": "assertive",
|
|
2163
2575
|
children: [
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2165
2577
|
import_fa6.FaTriangleExclamation,
|
|
2166
2578
|
{
|
|
2167
2579
|
className: "text-red-500",
|
|
@@ -2169,11 +2581,11 @@ var TableErrorBoundary = ({
|
|
|
2169
2581
|
"aria-hidden": true
|
|
2170
2582
|
}
|
|
2171
2583
|
),
|
|
2172
|
-
/* @__PURE__ */ (0,
|
|
2173
|
-
/* @__PURE__ */ (0,
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2584
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "max-w-md space-y-1", children: [
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-gray-600", children: message })
|
|
2175
2587
|
] }),
|
|
2176
|
-
refetch && /* @__PURE__ */ (0,
|
|
2588
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2177
2589
|
"button",
|
|
2178
2590
|
{
|
|
2179
2591
|
type: "button",
|
|
@@ -2181,7 +2593,7 @@ var TableErrorBoundary = ({
|
|
|
2181
2593
|
disabled: isLoading,
|
|
2182
2594
|
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",
|
|
2183
2595
|
children: [
|
|
2184
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
2185
2597
|
isLoading ? "Retrying..." : "Try again"
|
|
2186
2598
|
]
|
|
2187
2599
|
}
|
|
@@ -2190,16 +2602,20 @@ var TableErrorBoundary = ({
|
|
|
2190
2602
|
}
|
|
2191
2603
|
);
|
|
2192
2604
|
}
|
|
2193
|
-
return /* @__PURE__ */ (0,
|
|
2605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
|
2194
2606
|
};
|
|
2195
2607
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2196
2608
|
0 && (module.exports = {
|
|
2197
2609
|
ActionMenuItem,
|
|
2610
|
+
Breadcrumbs,
|
|
2611
|
+
Button,
|
|
2612
|
+
Card,
|
|
2198
2613
|
CardSkeleton,
|
|
2199
2614
|
CustomCellEditor,
|
|
2200
2615
|
CustomPagination,
|
|
2201
2616
|
DropdownFilter,
|
|
2202
2617
|
EztrakTabs,
|
|
2618
|
+
Header,
|
|
2203
2619
|
Loader,
|
|
2204
2620
|
Modal,
|
|
2205
2621
|
PopupCellRenderer,
|
|
@@ -2212,6 +2628,7 @@ var TableErrorBoundary = ({
|
|
|
2212
2628
|
ResetFiltersButton,
|
|
2213
2629
|
RowActions,
|
|
2214
2630
|
SearchInput,
|
|
2631
|
+
Sidebar,
|
|
2215
2632
|
TableErrorBoundary,
|
|
2216
2633
|
TableLayoutToolbarControls,
|
|
2217
2634
|
ToolTip,
|