@eztrak/shared 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HQPQ6TOE.mjs → chunk-PE7NNAX6.mjs} +559 -130
- package/dist/chunk-PE7NNAX6.mjs.map +1 -0
- package/dist/components/index.d.mts +110 -4
- package/dist/components/index.d.ts +110 -4
- package/dist/components/index.js +568 -134
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +568 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
- package/dist/chunk-HQPQ6TOE.mjs.map +0 -1
package/dist/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,
|
|
@@ -1758,23 +2170,34 @@ function PopupCellRenderer({
|
|
|
1758
2170
|
onAction,
|
|
1759
2171
|
placement = "bottom-end",
|
|
1760
2172
|
tippyProps,
|
|
1761
|
-
ariaLabel = "Row actions"
|
|
2173
|
+
ariaLabel = "Row actions",
|
|
2174
|
+
openOnHover = false
|
|
1762
2175
|
}) {
|
|
1763
|
-
const [visible, setVisible] = (0,
|
|
2176
|
+
const [visible, setVisible] = (0, import_react10.useState)(false);
|
|
2177
|
+
const instanceRef = (0, import_react10.useRef)(null);
|
|
1764
2178
|
const show = () => setVisible(true);
|
|
1765
|
-
const hide = () =>
|
|
2179
|
+
const hide = () => {
|
|
2180
|
+
setVisible(false);
|
|
2181
|
+
instanceRef.current?.hide();
|
|
2182
|
+
};
|
|
1766
2183
|
const rowData = params?.data;
|
|
1767
2184
|
const handleAction = (actionType, actionRowData) => {
|
|
1768
2185
|
onAction?.(actionType, actionRowData ?? rowData, hide);
|
|
1769
2186
|
hide();
|
|
1770
2187
|
};
|
|
1771
2188
|
const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
|
|
1772
|
-
|
|
1773
|
-
|
|
2189
|
+
const hoverOrClickProps = openOnHover ? {
|
|
2190
|
+
trigger: "mouseenter",
|
|
2191
|
+
delay: [0, 150],
|
|
2192
|
+
hideOnClick: false
|
|
2193
|
+
} : {
|
|
2194
|
+
visible,
|
|
2195
|
+
onClickOutside: hide
|
|
2196
|
+
};
|
|
2197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2198
|
+
import_react11.default,
|
|
1774
2199
|
{
|
|
1775
2200
|
content,
|
|
1776
|
-
visible,
|
|
1777
|
-
onClickOutside: hide,
|
|
1778
2201
|
allowHTML: true,
|
|
1779
2202
|
arrow: false,
|
|
1780
2203
|
appendTo: () => document.body,
|
|
@@ -1784,12 +2207,16 @@ function PopupCellRenderer({
|
|
|
1784
2207
|
theme: "light",
|
|
1785
2208
|
maxWidth: "none",
|
|
1786
2209
|
offset: [0, 5],
|
|
2210
|
+
onCreate: (instance) => {
|
|
2211
|
+
instanceRef.current = instance;
|
|
2212
|
+
},
|
|
2213
|
+
...hoverOrClickProps,
|
|
1787
2214
|
...tippyProps,
|
|
1788
|
-
children: /* @__PURE__ */ (0,
|
|
2215
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1789
2216
|
"button",
|
|
1790
2217
|
{
|
|
1791
2218
|
type: "button",
|
|
1792
|
-
onClick: visible ? hide : show,
|
|
2219
|
+
onClick: openOnHover ? void 0 : visible ? hide : show,
|
|
1793
2220
|
className: cn(
|
|
1794
2221
|
"flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
|
|
1795
2222
|
className
|
|
@@ -1797,7 +2224,7 @@ function PopupCellRenderer({
|
|
|
1797
2224
|
"aria-label": ariaLabel,
|
|
1798
2225
|
children: [
|
|
1799
2226
|
!hideTitle && title,
|
|
1800
|
-
/* @__PURE__ */ (0,
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ActionIcon, { "aria-hidden": true })
|
|
1801
2228
|
]
|
|
1802
2229
|
}
|
|
1803
2230
|
)
|
|
@@ -1825,7 +2252,7 @@ var ROW_ACTION_PRESETS = {
|
|
|
1825
2252
|
};
|
|
1826
2253
|
|
|
1827
2254
|
// src/components/row-actions/ActionMenuItem.tsx
|
|
1828
|
-
var
|
|
2255
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1829
2256
|
function ActionMenuItem({
|
|
1830
2257
|
label,
|
|
1831
2258
|
icon: Icon,
|
|
@@ -1846,7 +2273,7 @@ function ActionMenuItem({
|
|
|
1846
2273
|
onClick
|
|
1847
2274
|
}) {
|
|
1848
2275
|
const tooltipText = tooltip ?? label;
|
|
1849
|
-
return /* @__PURE__ */ (0,
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1850
2277
|
ToolTip,
|
|
1851
2278
|
{
|
|
1852
2279
|
text: tooltipText,
|
|
@@ -1857,7 +2284,7 @@ function ActionMenuItem({
|
|
|
1857
2284
|
tooltipClassName,
|
|
1858
2285
|
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
1859
2286
|
className: showLabel ? "block w-full" : "inline-flex",
|
|
1860
|
-
children: /* @__PURE__ */ (0,
|
|
2287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1861
2288
|
"button",
|
|
1862
2289
|
{
|
|
1863
2290
|
type: "button",
|
|
@@ -1877,7 +2304,7 @@ function ActionMenuItem({
|
|
|
1877
2304
|
className
|
|
1878
2305
|
),
|
|
1879
2306
|
children: [
|
|
1880
|
-
Icon ? /* @__PURE__ */ (0,
|
|
2307
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1881
2308
|
Icon,
|
|
1882
2309
|
{
|
|
1883
2310
|
className: cn("shrink-0", iconClassName),
|
|
@@ -1885,7 +2312,7 @@ function ActionMenuItem({
|
|
|
1885
2312
|
size: iconSize
|
|
1886
2313
|
}
|
|
1887
2314
|
) : null,
|
|
1888
|
-
showLabel ? /* @__PURE__ */ (0,
|
|
2315
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: labelClassName, children: label }) : null
|
|
1889
2316
|
]
|
|
1890
2317
|
}
|
|
1891
2318
|
)
|
|
@@ -1943,7 +2370,7 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
1943
2370
|
}
|
|
1944
2371
|
|
|
1945
2372
|
// src/components/row-actions/RowActions.tsx
|
|
1946
|
-
var
|
|
2373
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1947
2374
|
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
1948
2375
|
if (!action.onClick) {
|
|
1949
2376
|
if (action.closeOnClick) hide?.();
|
|
@@ -1974,6 +2401,7 @@ function RowActions({
|
|
|
1974
2401
|
triggerAriaLabel = "Row actions",
|
|
1975
2402
|
hasPermission,
|
|
1976
2403
|
placement = "bottom-end",
|
|
2404
|
+
openOnHover = false,
|
|
1977
2405
|
tippyProps,
|
|
1978
2406
|
presets,
|
|
1979
2407
|
confirmFn = confirmationAlert,
|
|
@@ -1996,7 +2424,7 @@ function RowActions({
|
|
|
1996
2424
|
};
|
|
1997
2425
|
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
1998
2426
|
if (action.type === "divider") {
|
|
1999
|
-
return /* @__PURE__ */ (0,
|
|
2427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2000
2428
|
"div",
|
|
2001
2429
|
{
|
|
2002
2430
|
role: "separator",
|
|
@@ -2006,9 +2434,9 @@ function RowActions({
|
|
|
2006
2434
|
);
|
|
2007
2435
|
}
|
|
2008
2436
|
if (action.content) {
|
|
2009
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: action.className, children: action.content }, action.key);
|
|
2010
2438
|
}
|
|
2011
|
-
return /* @__PURE__ */ (0,
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2012
2440
|
ActionMenuItem,
|
|
2013
2441
|
{
|
|
2014
2442
|
label: action.label,
|
|
@@ -2035,15 +2463,15 @@ function RowActions({
|
|
|
2035
2463
|
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
2036
2464
|
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
2037
2465
|
if (!renderItem) return defaultItem;
|
|
2038
|
-
return /* @__PURE__ */ (0,
|
|
2466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
2039
2467
|
});
|
|
2040
2468
|
if (mode === "inline") {
|
|
2041
2469
|
const inlineItems = renderItems(void 0, false);
|
|
2042
|
-
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 });
|
|
2043
2471
|
}
|
|
2044
2472
|
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
2045
2473
|
const buildMenu = (hide) => {
|
|
2046
|
-
const defaultMenu = /* @__PURE__ */ (0,
|
|
2474
|
+
const defaultMenu = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2047
2475
|
"div",
|
|
2048
2476
|
{
|
|
2049
2477
|
className: cn(
|
|
@@ -2062,14 +2490,14 @@ function RowActions({
|
|
|
2062
2490
|
});
|
|
2063
2491
|
};
|
|
2064
2492
|
if (renderTrigger) {
|
|
2065
|
-
return /* @__PURE__ */ (0,
|
|
2493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: renderTrigger({
|
|
2066
2494
|
data,
|
|
2067
2495
|
actions: resolved,
|
|
2068
2496
|
hide: () => void 0,
|
|
2069
2497
|
defaultMenu: buildMenu(() => void 0)
|
|
2070
2498
|
}) });
|
|
2071
2499
|
}
|
|
2072
|
-
return /* @__PURE__ */ (0,
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2073
2501
|
ToolTip,
|
|
2074
2502
|
{
|
|
2075
2503
|
text: triggerTooltipText,
|
|
@@ -2080,7 +2508,7 @@ function RowActions({
|
|
|
2080
2508
|
tooltipClassName,
|
|
2081
2509
|
tooltipStyle,
|
|
2082
2510
|
className: "flex h-full items-center justify-center",
|
|
2083
|
-
children: /* @__PURE__ */ (0,
|
|
2511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2084
2512
|
PopupCellRenderer,
|
|
2085
2513
|
{
|
|
2086
2514
|
params: { data },
|
|
@@ -2088,6 +2516,7 @@ function RowActions({
|
|
|
2088
2516
|
hideTitle: true,
|
|
2089
2517
|
className,
|
|
2090
2518
|
placement,
|
|
2519
|
+
openOnHover,
|
|
2091
2520
|
tippyProps,
|
|
2092
2521
|
ariaLabel: triggerAriaLabel,
|
|
2093
2522
|
dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
|
|
@@ -2098,9 +2527,9 @@ function RowActions({
|
|
|
2098
2527
|
}
|
|
2099
2528
|
|
|
2100
2529
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
2101
|
-
var
|
|
2530
|
+
var import_react12 = require("react");
|
|
2102
2531
|
var import_fa6 = require("react-icons/fa6");
|
|
2103
|
-
var
|
|
2532
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2104
2533
|
var TableErrorBoundary = ({
|
|
2105
2534
|
isError,
|
|
2106
2535
|
isLoading = false,
|
|
@@ -2111,13 +2540,13 @@ var TableErrorBoundary = ({
|
|
|
2111
2540
|
className,
|
|
2112
2541
|
minHeight = "280px"
|
|
2113
2542
|
}) => {
|
|
2114
|
-
const message = (0,
|
|
2543
|
+
const message = (0, import_react12.useMemo)(() => {
|
|
2115
2544
|
if (errorMessage) return errorMessage;
|
|
2116
2545
|
if (error) return classifyError(error).userMessage;
|
|
2117
2546
|
return "Unable to load table data. Please try again.";
|
|
2118
2547
|
}, [error, errorMessage]);
|
|
2119
2548
|
if (isLoading && !isError) {
|
|
2120
|
-
return /* @__PURE__ */ (0,
|
|
2549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2121
2550
|
"div",
|
|
2122
2551
|
{
|
|
2123
2552
|
className: cn(
|
|
@@ -2128,12 +2557,12 @@ var TableErrorBoundary = ({
|
|
|
2128
2557
|
role: "status",
|
|
2129
2558
|
"aria-live": "polite",
|
|
2130
2559
|
"aria-busy": "true",
|
|
2131
|
-
children: /* @__PURE__ */ (0,
|
|
2560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, { size: "40px" })
|
|
2132
2561
|
}
|
|
2133
2562
|
);
|
|
2134
2563
|
}
|
|
2135
2564
|
if (isError) {
|
|
2136
|
-
return /* @__PURE__ */ (0,
|
|
2565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2137
2566
|
"div",
|
|
2138
2567
|
{
|
|
2139
2568
|
className: cn(
|
|
@@ -2144,7 +2573,7 @@ var TableErrorBoundary = ({
|
|
|
2144
2573
|
role: "alert",
|
|
2145
2574
|
"aria-live": "assertive",
|
|
2146
2575
|
children: [
|
|
2147
|
-
/* @__PURE__ */ (0,
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2148
2577
|
import_fa6.FaTriangleExclamation,
|
|
2149
2578
|
{
|
|
2150
2579
|
className: "text-red-500",
|
|
@@ -2152,11 +2581,11 @@ var TableErrorBoundary = ({
|
|
|
2152
2581
|
"aria-hidden": true
|
|
2153
2582
|
}
|
|
2154
2583
|
),
|
|
2155
|
-
/* @__PURE__ */ (0,
|
|
2156
|
-
/* @__PURE__ */ (0,
|
|
2157
|
-
/* @__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 })
|
|
2158
2587
|
] }),
|
|
2159
|
-
refetch && /* @__PURE__ */ (0,
|
|
2588
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2160
2589
|
"button",
|
|
2161
2590
|
{
|
|
2162
2591
|
type: "button",
|
|
@@ -2164,7 +2593,7 @@ var TableErrorBoundary = ({
|
|
|
2164
2593
|
disabled: isLoading,
|
|
2165
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",
|
|
2166
2595
|
children: [
|
|
2167
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
2168
2597
|
isLoading ? "Retrying..." : "Try again"
|
|
2169
2598
|
]
|
|
2170
2599
|
}
|
|
@@ -2173,16 +2602,20 @@ var TableErrorBoundary = ({
|
|
|
2173
2602
|
}
|
|
2174
2603
|
);
|
|
2175
2604
|
}
|
|
2176
|
-
return /* @__PURE__ */ (0,
|
|
2605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
|
2177
2606
|
};
|
|
2178
2607
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2179
2608
|
0 && (module.exports = {
|
|
2180
2609
|
ActionMenuItem,
|
|
2610
|
+
Breadcrumbs,
|
|
2611
|
+
Button,
|
|
2612
|
+
Card,
|
|
2181
2613
|
CardSkeleton,
|
|
2182
2614
|
CustomCellEditor,
|
|
2183
2615
|
CustomPagination,
|
|
2184
2616
|
DropdownFilter,
|
|
2185
2617
|
EztrakTabs,
|
|
2618
|
+
Header,
|
|
2186
2619
|
Loader,
|
|
2187
2620
|
Modal,
|
|
2188
2621
|
PopupCellRenderer,
|
|
@@ -2195,6 +2628,7 @@ var TableErrorBoundary = ({
|
|
|
2195
2628
|
ResetFiltersButton,
|
|
2196
2629
|
RowActions,
|
|
2197
2630
|
SearchInput,
|
|
2631
|
+
Sidebar,
|
|
2198
2632
|
TableErrorBoundary,
|
|
2199
2633
|
TableLayoutToolbarControls,
|
|
2200
2634
|
ToolTip,
|