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