@eztrak/shared 0.15.3 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QM2TGUZN.mjs → chunk-PE7NNAX6.mjs} +537 -125
- package/dist/chunk-PE7NNAX6.mjs.map +1 -0
- package/dist/components/index.d.mts +98 -2
- package/dist/components/index.d.ts +98 -2
- package/dist/components/index.js +547 -130
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +547 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
- package/dist/chunk-QM2TGUZN.mjs.map +0 -1
|
@@ -1080,8 +1080,473 @@ function Modal({
|
|
|
1080
1080
|
return createPortal(modalContent, modalRoot);
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
|
+
// src/components/button/Button.tsx
|
|
1084
|
+
import { forwardRef } from "react";
|
|
1085
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1086
|
+
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";
|
|
1087
|
+
var VARIANTS2 = {
|
|
1088
|
+
primary: "bg-white text-secondary border-secondary hover:bg-lightGray hover:text-black",
|
|
1089
|
+
"primary-outline": "bg-white text-primary-150 border-primary-150 hover:bg-primary-100 hover:text-white font-bold",
|
|
1090
|
+
"primary-fill": "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1091
|
+
secondary: "bg-primary-150 text-white border-primary hover:bg-primary/90",
|
|
1092
|
+
danger: "bg-red-600 text-white border-red-600 hover:bg-red-700",
|
|
1093
|
+
outline: "bg-white text-primary border-primary hover:bg-primary/10",
|
|
1094
|
+
ghost: "bg-transparent text-secondary border-transparent hover:bg-primary/10 p-2",
|
|
1095
|
+
inline: "bg-transparent text-gray-500 border-none hover:text-gray-600 underline shadow-none p-0 m-0"
|
|
1096
|
+
};
|
|
1097
|
+
var SIZES = {
|
|
1098
|
+
sm: "px-3 py-2 text-xs",
|
|
1099
|
+
md: "px-5 py-3 text-sm",
|
|
1100
|
+
lg: "px-6 py-4 text-base"
|
|
1101
|
+
};
|
|
1102
|
+
var Button = forwardRef(
|
|
1103
|
+
({
|
|
1104
|
+
children,
|
|
1105
|
+
className = "",
|
|
1106
|
+
type = "button",
|
|
1107
|
+
onClick,
|
|
1108
|
+
disabled = false,
|
|
1109
|
+
variant = "primary",
|
|
1110
|
+
size = "md",
|
|
1111
|
+
...props
|
|
1112
|
+
}, ref) => {
|
|
1113
|
+
const variantStyles = VARIANTS2[variant] || VARIANTS2.primary;
|
|
1114
|
+
const sizeStyles = SIZES[size];
|
|
1115
|
+
return /* @__PURE__ */ jsx8(
|
|
1116
|
+
"button",
|
|
1117
|
+
{
|
|
1118
|
+
ref,
|
|
1119
|
+
type,
|
|
1120
|
+
className: cn(
|
|
1121
|
+
BASE_STYLES2,
|
|
1122
|
+
variantStyles,
|
|
1123
|
+
size !== "md" && sizeStyles,
|
|
1124
|
+
className
|
|
1125
|
+
),
|
|
1126
|
+
onClick,
|
|
1127
|
+
disabled,
|
|
1128
|
+
...props,
|
|
1129
|
+
children
|
|
1130
|
+
}
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
);
|
|
1134
|
+
Button.displayName = "Button";
|
|
1135
|
+
|
|
1136
|
+
// src/components/card/Card.tsx
|
|
1137
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1138
|
+
function Card({
|
|
1139
|
+
title,
|
|
1140
|
+
content,
|
|
1141
|
+
icon,
|
|
1142
|
+
onClick,
|
|
1143
|
+
containerClassName = "shadow p-6",
|
|
1144
|
+
iconClassName = "",
|
|
1145
|
+
titleClassName = "",
|
|
1146
|
+
contentClassName = "",
|
|
1147
|
+
cardBodyClassName = ""
|
|
1148
|
+
}) {
|
|
1149
|
+
return /* @__PURE__ */ jsx9(
|
|
1150
|
+
"div",
|
|
1151
|
+
{
|
|
1152
|
+
className: cn(
|
|
1153
|
+
"transform transition duration-300 cursor-pointer select-none",
|
|
1154
|
+
containerClassName
|
|
1155
|
+
),
|
|
1156
|
+
onClick,
|
|
1157
|
+
children: /* @__PURE__ */ jsxs6("div", { className: cn("flex space-x-4", cardBodyClassName), children: [
|
|
1158
|
+
/* @__PURE__ */ jsx9("span", { className: cn("text-primary text-3xl", iconClassName), children: icon }),
|
|
1159
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1160
|
+
/* @__PURE__ */ jsx9("h3", { className: cn("font-semibold text-lg text-primary", titleClassName), children: title }),
|
|
1161
|
+
content != null && /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-secondary", contentClassName), children: content })
|
|
1162
|
+
] })
|
|
1163
|
+
] })
|
|
1164
|
+
}
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
// src/components/header/Header.tsx
|
|
1169
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1170
|
+
function Header({
|
|
1171
|
+
title = "Header",
|
|
1172
|
+
className = "p-2 gap-2 flex-col",
|
|
1173
|
+
containerClass = "",
|
|
1174
|
+
breadcrumbs = "",
|
|
1175
|
+
titleStyle = "text-4xl h-fit font-bold",
|
|
1176
|
+
breadcrumbsStyle = "text-sm",
|
|
1177
|
+
children
|
|
1178
|
+
}) {
|
|
1179
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex ${className}`, children: [
|
|
1180
|
+
/* @__PURE__ */ jsxs7("div", { className: "title-wrapper", children: [
|
|
1181
|
+
/* @__PURE__ */ jsx10("h1", { className: titleStyle, children: title }),
|
|
1182
|
+
breadcrumbs && /* @__PURE__ */ jsx10("div", { className: `breadcrumbs-wraper ${breadcrumbsStyle}`, children: breadcrumbs })
|
|
1183
|
+
] }),
|
|
1184
|
+
/* @__PURE__ */ jsx10("div", { className: `flex flex-row justify-between items-center ${containerClass}`, children })
|
|
1185
|
+
] });
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// src/components/breadcrumbs/Breadcrumbs.tsx
|
|
1189
|
+
import { Fragment } from "react";
|
|
1190
|
+
import { Link, useLocation } from "react-router-dom";
|
|
1191
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1192
|
+
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]";
|
|
1193
|
+
function asTitleMap(customTitles) {
|
|
1194
|
+
if (Object.prototype.toString.call(customTitles) !== "[object Object]") {
|
|
1195
|
+
return {};
|
|
1196
|
+
}
|
|
1197
|
+
return customTitles;
|
|
1198
|
+
}
|
|
1199
|
+
function findRoute(pathname, routes, parentPath = "") {
|
|
1200
|
+
for (const route of routes) {
|
|
1201
|
+
const fullPath = `${parentPath}/${route.path}`.replace(/\/+/g, "/");
|
|
1202
|
+
if (fullPath === pathname) {
|
|
1203
|
+
return route;
|
|
1204
|
+
}
|
|
1205
|
+
if (route.children) {
|
|
1206
|
+
const childRoute = findRoute(pathname, route.children, fullPath);
|
|
1207
|
+
if (childRoute) {
|
|
1208
|
+
return childRoute;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return null;
|
|
1213
|
+
}
|
|
1214
|
+
function getLastParam(str) {
|
|
1215
|
+
return str.endsWith("/") ? str.slice(0, -1).split("/").pop() : str.split("/").pop();
|
|
1216
|
+
}
|
|
1217
|
+
function Breadcrumbs({
|
|
1218
|
+
routes = [],
|
|
1219
|
+
containerClassName,
|
|
1220
|
+
linkClassName = "",
|
|
1221
|
+
separatorClassName = "",
|
|
1222
|
+
separator = "/",
|
|
1223
|
+
activeClassName = "font-bold whitespace-pre",
|
|
1224
|
+
customTitles = {},
|
|
1225
|
+
customIcons = {},
|
|
1226
|
+
prefix,
|
|
1227
|
+
suffix,
|
|
1228
|
+
nonClickablePaths = []
|
|
1229
|
+
}) {
|
|
1230
|
+
const location = useLocation();
|
|
1231
|
+
const pathnames = location.pathname.split("/").filter((segment) => segment);
|
|
1232
|
+
const titles = asTitleMap(customTitles);
|
|
1233
|
+
const inactiveLinkClassName = cn(INACTIVE_LINK_CLASS, linkClassName);
|
|
1234
|
+
const getTitle = (pathname) => {
|
|
1235
|
+
const match = findRoute(pathname, routes);
|
|
1236
|
+
if (match && match.title) {
|
|
1237
|
+
return match.title;
|
|
1238
|
+
}
|
|
1239
|
+
const titleKeys = Object.keys(titles);
|
|
1240
|
+
const paramMatch = pathname.split("/").find((segment) => titleKeys.includes(segment)) || "";
|
|
1241
|
+
if (paramMatch && titles[paramMatch]) {
|
|
1242
|
+
return titles[paramMatch];
|
|
1243
|
+
}
|
|
1244
|
+
const lastParamPath = getLastParam(pathname);
|
|
1245
|
+
if (lastParamPath) {
|
|
1246
|
+
return lastParamPath;
|
|
1247
|
+
}
|
|
1248
|
+
return pathname;
|
|
1249
|
+
};
|
|
1250
|
+
const getIcon = (pathname) => {
|
|
1251
|
+
const iconKeys = Object.keys(customIcons);
|
|
1252
|
+
const matchedSegment = pathname.split("/").find((segment) => iconKeys.includes(segment));
|
|
1253
|
+
if (matchedSegment && customIcons[matchedSegment]) {
|
|
1254
|
+
return customIcons[matchedSegment];
|
|
1255
|
+
}
|
|
1256
|
+
return null;
|
|
1257
|
+
};
|
|
1258
|
+
return /* @__PURE__ */ jsxs8(
|
|
1259
|
+
"div",
|
|
1260
|
+
{
|
|
1261
|
+
className: cn(
|
|
1262
|
+
"flex flex-row gap-2 items-center text-sm text-secondary",
|
|
1263
|
+
containerClassName
|
|
1264
|
+
),
|
|
1265
|
+
children: [
|
|
1266
|
+
prefix && /* @__PURE__ */ jsx11("div", { className: "breadcrumb-prefix", children: prefix }),
|
|
1267
|
+
/* @__PURE__ */ jsxs8(Link, { to: "/", className: inactiveLinkClassName, children: [
|
|
1268
|
+
customIcons.home && /* @__PURE__ */ jsx11("span", { className: "mr-1", children: customIcons.home }),
|
|
1269
|
+
titles.home || "Home"
|
|
1270
|
+
] }),
|
|
1271
|
+
pathnames.map((segment, index) => {
|
|
1272
|
+
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
|
|
1273
|
+
const isLast = index === pathnames.length - 1;
|
|
1274
|
+
const title = getTitle(to);
|
|
1275
|
+
const icon = getIcon(to);
|
|
1276
|
+
const isNonClickable = nonClickablePaths.some(
|
|
1277
|
+
(token) => to.includes(token) || segment === token
|
|
1278
|
+
);
|
|
1279
|
+
const crumb = /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1280
|
+
icon && /* @__PURE__ */ jsx11("span", { className: "mr-1", children: icon }),
|
|
1281
|
+
title
|
|
1282
|
+
] });
|
|
1283
|
+
return /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1284
|
+
/* @__PURE__ */ jsx11("span", { className: separatorClassName, children: separator }),
|
|
1285
|
+
isLast || isNonClickable ? /* @__PURE__ */ jsx11("span", { className: isLast ? activeClassName : linkClassName, children: crumb }) : /* @__PURE__ */ jsx11(Link, { to, className: inactiveLinkClassName, children: crumb })
|
|
1286
|
+
] }, to);
|
|
1287
|
+
}),
|
|
1288
|
+
suffix && /* @__PURE__ */ jsx11("div", { className: "breadcrumb-suffix", children: suffix })
|
|
1289
|
+
]
|
|
1290
|
+
}
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// src/components/sidebar/Sidebar.tsx
|
|
1295
|
+
import { useEffect as useEffect5, useState as useState3 } from "react";
|
|
1296
|
+
import { Link as Link2, useLocation as useLocation2 } from "react-router-dom";
|
|
1297
|
+
|
|
1298
|
+
// src/components/tooltip/ToolTip.tsx
|
|
1299
|
+
import { useId as useId2 } from "react";
|
|
1300
|
+
import { Tooltip } from "react-tooltip";
|
|
1301
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1302
|
+
var defaultTooltipStyle = {
|
|
1303
|
+
color: "#fff",
|
|
1304
|
+
borderRadius: "5px",
|
|
1305
|
+
zIndex: 999,
|
|
1306
|
+
textAlign: "justify",
|
|
1307
|
+
maxWidth: "300px",
|
|
1308
|
+
whiteSpace: "pre-wrap",
|
|
1309
|
+
wordWrap: "break-word",
|
|
1310
|
+
overflowWrap: "break-word"
|
|
1311
|
+
};
|
|
1312
|
+
function ToolTip({
|
|
1313
|
+
text = "tool tip",
|
|
1314
|
+
placement = "top",
|
|
1315
|
+
delayShow,
|
|
1316
|
+
delayHide,
|
|
1317
|
+
className,
|
|
1318
|
+
tooltipClassName,
|
|
1319
|
+
tooltipStyle,
|
|
1320
|
+
wrapperTabIndex,
|
|
1321
|
+
disabled = false,
|
|
1322
|
+
children
|
|
1323
|
+
}) {
|
|
1324
|
+
const generatedId = useId2();
|
|
1325
|
+
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1326
|
+
const tooltipText = String(text ?? "");
|
|
1327
|
+
if (disabled || !tooltipText) {
|
|
1328
|
+
return /* @__PURE__ */ jsx12("span", { className, children });
|
|
1329
|
+
}
|
|
1330
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1331
|
+
/* @__PURE__ */ jsx12(
|
|
1332
|
+
"span",
|
|
1333
|
+
{
|
|
1334
|
+
className,
|
|
1335
|
+
"data-tooltip-id": tooltipId,
|
|
1336
|
+
"data-tooltip-content": tooltipText,
|
|
1337
|
+
tabIndex: wrapperTabIndex,
|
|
1338
|
+
children
|
|
1339
|
+
}
|
|
1340
|
+
),
|
|
1341
|
+
/* @__PURE__ */ jsx12(
|
|
1342
|
+
Tooltip,
|
|
1343
|
+
{
|
|
1344
|
+
id: tooltipId,
|
|
1345
|
+
place: placement,
|
|
1346
|
+
positionStrategy: "fixed",
|
|
1347
|
+
delayShow,
|
|
1348
|
+
delayHide,
|
|
1349
|
+
className: tooltipClassName,
|
|
1350
|
+
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
1351
|
+
}
|
|
1352
|
+
)
|
|
1353
|
+
] });
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// src/components/sidebar/Sidebar.tsx
|
|
1357
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1358
|
+
function Sidebar({
|
|
1359
|
+
className,
|
|
1360
|
+
sideCollapseWidth = "w-20",
|
|
1361
|
+
sidebarWidth = "w-48",
|
|
1362
|
+
header,
|
|
1363
|
+
children,
|
|
1364
|
+
footer,
|
|
1365
|
+
items = [],
|
|
1366
|
+
logoUrl = "",
|
|
1367
|
+
logoAltText = "Logo",
|
|
1368
|
+
collapseButtonText = "\u2B05\uFE0F Collapse",
|
|
1369
|
+
expandButtonText = "\u27A1\uFE0F",
|
|
1370
|
+
location: _location,
|
|
1371
|
+
classNames = {},
|
|
1372
|
+
onCollapseChange,
|
|
1373
|
+
isCollapsed = false,
|
|
1374
|
+
itemDropdownIcon = /* @__PURE__ */ jsx13("span", { children: "\u25BC" }),
|
|
1375
|
+
...rest
|
|
1376
|
+
}) {
|
|
1377
|
+
const location = useLocation2();
|
|
1378
|
+
const [collapsed, setCollapsed] = useState3(isCollapsed);
|
|
1379
|
+
const [, setActiveLink] = useState3(location.pathname);
|
|
1380
|
+
const [subItemsCollapsed, setSubItemsCollapsed] = useState3({});
|
|
1381
|
+
useEffect5(() => {
|
|
1382
|
+
if (onCollapseChange) {
|
|
1383
|
+
onCollapseChange(collapsed);
|
|
1384
|
+
}
|
|
1385
|
+
}, [collapsed, onCollapseChange]);
|
|
1386
|
+
useEffect5(() => {
|
|
1387
|
+
setActiveLink(location.pathname);
|
|
1388
|
+
}, [location]);
|
|
1389
|
+
const toggleGroup = (group) => {
|
|
1390
|
+
setSubItemsCollapsed((prevState) => ({
|
|
1391
|
+
...prevState,
|
|
1392
|
+
[group]: !prevState[group]
|
|
1393
|
+
}));
|
|
1394
|
+
};
|
|
1395
|
+
const isActive = (link) => {
|
|
1396
|
+
return location.pathname.startsWith(link);
|
|
1397
|
+
};
|
|
1398
|
+
return /* @__PURE__ */ jsxs10(
|
|
1399
|
+
"div",
|
|
1400
|
+
{
|
|
1401
|
+
className: `flex flex-col h-screen overflow-hidden ${collapsed ? `${sideCollapseWidth} justify-center items-center collapsed` : `${sidebarWidth}`} transition-all duration-100 ${className ?? ""}`,
|
|
1402
|
+
...rest,
|
|
1403
|
+
children: [
|
|
1404
|
+
logoUrl && /* @__PURE__ */ jsx13(
|
|
1405
|
+
"div",
|
|
1406
|
+
{
|
|
1407
|
+
className: cn(
|
|
1408
|
+
"flex items-center justify-center h-16 border-b border-gray-300",
|
|
1409
|
+
classNames.logoSection
|
|
1410
|
+
),
|
|
1411
|
+
children: /* @__PURE__ */ jsx13("img", { src: logoUrl, alt: logoAltText, className: "h-10" })
|
|
1412
|
+
}
|
|
1413
|
+
),
|
|
1414
|
+
header && /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-between p-4 border-b border-gray-300", children: header }),
|
|
1415
|
+
/* @__PURE__ */ jsx13("nav", { className: cn("flex-grow", classNames.navSection), children: items.map((item, index) => {
|
|
1416
|
+
if (item.subItems) {
|
|
1417
|
+
return /* @__PURE__ */ jsxs10(
|
|
1418
|
+
"div",
|
|
1419
|
+
{
|
|
1420
|
+
className: `my-2 ${item?.subItems && "has-sub-items"}`,
|
|
1421
|
+
children: [
|
|
1422
|
+
/* @__PURE__ */ jsxs10(
|
|
1423
|
+
"div",
|
|
1424
|
+
{
|
|
1425
|
+
onClick: () => toggleGroup(item.name),
|
|
1426
|
+
"data-sidebar-item": item.name,
|
|
1427
|
+
"data-tooltip-id": item.name,
|
|
1428
|
+
className: `flex cursor-pointer dropdown-title-wrapper ${classNames?.navItem ?? ""}`,
|
|
1429
|
+
children: [
|
|
1430
|
+
/* @__PURE__ */ jsx13(
|
|
1431
|
+
ToolTip,
|
|
1432
|
+
{
|
|
1433
|
+
text: item.tooltip || item.name,
|
|
1434
|
+
placement: item.tooltipPlacement || "top",
|
|
1435
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center space-x-2", children: [
|
|
1436
|
+
/* @__PURE__ */ jsx13("span", { className: classNames?.navItemText, children: item.icon }),
|
|
1437
|
+
!collapsed && /* @__PURE__ */ jsx13("span", { className: classNames?.navItemText, children: item.name })
|
|
1438
|
+
] })
|
|
1439
|
+
}
|
|
1440
|
+
),
|
|
1441
|
+
!collapsed && /* @__PURE__ */ jsx13(
|
|
1442
|
+
"span",
|
|
1443
|
+
{
|
|
1444
|
+
className: `transform transition-transform ${subItemsCollapsed[item.name] ? "rotate-180" : "rotate-0"}`,
|
|
1445
|
+
children: itemDropdownIcon
|
|
1446
|
+
}
|
|
1447
|
+
)
|
|
1448
|
+
]
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
subItemsCollapsed[item.name] && /* @__PURE__ */ jsx13("div", { className: cn("collapse-btn-wrapper", classNames.subItem), children: item.subItems.map((subItem, subIndex) => {
|
|
1452
|
+
if (subItem.component) {
|
|
1453
|
+
const SubItemComponent = subItem.component;
|
|
1454
|
+
return /* @__PURE__ */ jsx13(SubItemComponent, {}, `${index}-${subIndex}`);
|
|
1455
|
+
}
|
|
1456
|
+
return /* @__PURE__ */ jsx13(
|
|
1457
|
+
"div",
|
|
1458
|
+
{
|
|
1459
|
+
className: "w-full",
|
|
1460
|
+
"data-sidebar-item": subItem.name,
|
|
1461
|
+
"data-tooltip-id": subItem.name,
|
|
1462
|
+
children: /* @__PURE__ */ jsx13(
|
|
1463
|
+
ToolTip,
|
|
1464
|
+
{
|
|
1465
|
+
text: item.tooltip || item.name,
|
|
1466
|
+
placement: item.tooltipPlacement || "top",
|
|
1467
|
+
className: "block w-full",
|
|
1468
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1469
|
+
Link2,
|
|
1470
|
+
{
|
|
1471
|
+
to: subItem.link || "#",
|
|
1472
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(subItem?.link ?? "") ? "active" : ""} ${item?.itemClassName}`,
|
|
1473
|
+
onClick: () => subItem.link && setActiveLink(subItem.link || ""),
|
|
1474
|
+
title: subItem.tooltip || subItem.name,
|
|
1475
|
+
children: [
|
|
1476
|
+
/* @__PURE__ */ jsx13(
|
|
1477
|
+
"span",
|
|
1478
|
+
{
|
|
1479
|
+
className: classNames.navItemText ?? "text-orange-600",
|
|
1480
|
+
children: subItem.icon
|
|
1481
|
+
}
|
|
1482
|
+
),
|
|
1483
|
+
!collapsed && /* @__PURE__ */ jsx13("span", { className: classNames.navItemText, children: subItem.name })
|
|
1484
|
+
]
|
|
1485
|
+
}
|
|
1486
|
+
)
|
|
1487
|
+
}
|
|
1488
|
+
)
|
|
1489
|
+
},
|
|
1490
|
+
`${index}-${subIndex}`
|
|
1491
|
+
);
|
|
1492
|
+
}) })
|
|
1493
|
+
]
|
|
1494
|
+
},
|
|
1495
|
+
index
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
if (item.component) {
|
|
1499
|
+
const ItemComponent = item.component;
|
|
1500
|
+
return /* @__PURE__ */ jsx13(ItemComponent, {}, index);
|
|
1501
|
+
}
|
|
1502
|
+
return /* @__PURE__ */ jsx13(
|
|
1503
|
+
"div",
|
|
1504
|
+
{
|
|
1505
|
+
className: "w-full",
|
|
1506
|
+
"data-sidebar-item": item.name,
|
|
1507
|
+
"data-tooltip-id": item.name,
|
|
1508
|
+
children: /* @__PURE__ */ jsx13(
|
|
1509
|
+
ToolTip,
|
|
1510
|
+
{
|
|
1511
|
+
text: item.tooltip || item.name,
|
|
1512
|
+
placement: item.tooltipPlacement || "top",
|
|
1513
|
+
className: "block w-full",
|
|
1514
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1515
|
+
Link2,
|
|
1516
|
+
{
|
|
1517
|
+
to: item.link || "#",
|
|
1518
|
+
className: `flex ${classNames?.navItem ?? ""} ${isActive(item.link || "") ? "active" : ""} ${item?.itemClassName}`,
|
|
1519
|
+
onClick: () => setActiveLink(item.link || ""),
|
|
1520
|
+
title: item.tooltip || item.name,
|
|
1521
|
+
children: [
|
|
1522
|
+
/* @__PURE__ */ jsx13("span", { className: classNames.navItemText ?? "text-orange-600", children: item.icon }),
|
|
1523
|
+
!collapsed && /* @__PURE__ */ jsx13("span", { className: classNames.navItemText, children: item.name })
|
|
1524
|
+
]
|
|
1525
|
+
}
|
|
1526
|
+
)
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
},
|
|
1530
|
+
index
|
|
1531
|
+
);
|
|
1532
|
+
}) }),
|
|
1533
|
+
children,
|
|
1534
|
+
/* @__PURE__ */ jsx13(
|
|
1535
|
+
"button",
|
|
1536
|
+
{
|
|
1537
|
+
onClick: () => setCollapsed(!collapsed),
|
|
1538
|
+
className: cn("", classNames.collapseButton) ?? "p-4 border-t border-gray-300",
|
|
1539
|
+
children: collapsed ? expandButtonText : collapseButtonText
|
|
1540
|
+
}
|
|
1541
|
+
),
|
|
1542
|
+
footer && /* @__PURE__ */ jsx13("div", { className: classNames?.footer ?? "p-4 border-t border-gray-300", children: footer })
|
|
1543
|
+
]
|
|
1544
|
+
}
|
|
1545
|
+
);
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1083
1548
|
// src/components/skeleton/CardSkeleton.tsx
|
|
1084
|
-
import { Fragment, jsx as
|
|
1549
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1085
1550
|
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
1086
1551
|
function shouldShowAvatar(variant, showAvatar) {
|
|
1087
1552
|
return showAvatar ?? variant === "profile";
|
|
@@ -1090,7 +1555,7 @@ function shouldShowImage(variant, showImage) {
|
|
|
1090
1555
|
return showImage ?? variant === "image";
|
|
1091
1556
|
}
|
|
1092
1557
|
function AvatarSkeleton({ className }) {
|
|
1093
|
-
return /* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ jsx14(
|
|
1094
1559
|
"svg",
|
|
1095
1560
|
{
|
|
1096
1561
|
className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
|
|
@@ -1098,7 +1563,7 @@ function AvatarSkeleton({ className }) {
|
|
|
1098
1563
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1099
1564
|
fill: "currentColor",
|
|
1100
1565
|
viewBox: "0 0 20 20",
|
|
1101
|
-
children: /* @__PURE__ */
|
|
1566
|
+
children: /* @__PURE__ */ jsx14("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" })
|
|
1102
1567
|
}
|
|
1103
1568
|
);
|
|
1104
1569
|
}
|
|
@@ -1107,7 +1572,7 @@ function SkeletonBlock({
|
|
|
1107
1572
|
className,
|
|
1108
1573
|
isFirst
|
|
1109
1574
|
}) {
|
|
1110
|
-
return /* @__PURE__ */
|
|
1575
|
+
return /* @__PURE__ */ jsx14(
|
|
1111
1576
|
"div",
|
|
1112
1577
|
{
|
|
1113
1578
|
className: cn(
|
|
@@ -1139,14 +1604,14 @@ function CardSkeleton({
|
|
|
1139
1604
|
const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
|
|
1140
1605
|
const renderAvatar = shouldShowAvatar(variant, showAvatar);
|
|
1141
1606
|
const renderImage = shouldShowImage(variant, showImage);
|
|
1142
|
-
return /* @__PURE__ */
|
|
1607
|
+
return /* @__PURE__ */ jsxs11(
|
|
1143
1608
|
"div",
|
|
1144
1609
|
{
|
|
1145
1610
|
className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
|
|
1146
1611
|
style: { animationDuration, ...style },
|
|
1147
1612
|
...props,
|
|
1148
1613
|
children: [
|
|
1149
|
-
renderImage ? /* @__PURE__ */
|
|
1614
|
+
renderImage ? /* @__PURE__ */ jsx14(
|
|
1150
1615
|
"div",
|
|
1151
1616
|
{
|
|
1152
1617
|
className: cn(
|
|
@@ -1155,9 +1620,9 @@ function CardSkeleton({
|
|
|
1155
1620
|
)
|
|
1156
1621
|
}
|
|
1157
1622
|
) : null,
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
renderAvatar ? /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ jsxs11("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
|
|
1624
|
+
renderAvatar ? /* @__PURE__ */ jsx14(AvatarSkeleton, { className: avatarClassName }) : null,
|
|
1625
|
+
/* @__PURE__ */ jsx14("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ jsx14(
|
|
1161
1626
|
SkeletonBlock,
|
|
1162
1627
|
{
|
|
1163
1628
|
widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
|
|
@@ -1167,75 +1632,17 @@ function CardSkeleton({
|
|
|
1167
1632
|
lineIndex
|
|
1168
1633
|
)) })
|
|
1169
1634
|
] }),
|
|
1170
|
-
/* @__PURE__ */
|
|
1635
|
+
/* @__PURE__ */ jsx14("span", { className: "sr-only", children: srLabel })
|
|
1171
1636
|
]
|
|
1172
1637
|
},
|
|
1173
1638
|
index
|
|
1174
1639
|
);
|
|
1175
1640
|
});
|
|
1176
|
-
return /* @__PURE__ */
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
// src/components/tooltip/ToolTip.tsx
|
|
1180
|
-
import { useId as useId2 } from "react";
|
|
1181
|
-
import { Tooltip } from "react-tooltip";
|
|
1182
|
-
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1183
|
-
var defaultTooltipStyle = {
|
|
1184
|
-
color: "#fff",
|
|
1185
|
-
borderRadius: "5px",
|
|
1186
|
-
zIndex: 999,
|
|
1187
|
-
textAlign: "justify",
|
|
1188
|
-
maxWidth: "300px",
|
|
1189
|
-
whiteSpace: "pre-wrap",
|
|
1190
|
-
wordWrap: "break-word",
|
|
1191
|
-
overflowWrap: "break-word"
|
|
1192
|
-
};
|
|
1193
|
-
function ToolTip({
|
|
1194
|
-
text = "tool tip",
|
|
1195
|
-
placement = "top",
|
|
1196
|
-
delayShow,
|
|
1197
|
-
delayHide,
|
|
1198
|
-
className,
|
|
1199
|
-
tooltipClassName,
|
|
1200
|
-
tooltipStyle,
|
|
1201
|
-
wrapperTabIndex,
|
|
1202
|
-
disabled = false,
|
|
1203
|
-
children
|
|
1204
|
-
}) {
|
|
1205
|
-
const generatedId = useId2();
|
|
1206
|
-
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1207
|
-
const tooltipText = String(text ?? "");
|
|
1208
|
-
if (disabled || !tooltipText) {
|
|
1209
|
-
return /* @__PURE__ */ jsx9("span", { className, children });
|
|
1210
|
-
}
|
|
1211
|
-
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1212
|
-
/* @__PURE__ */ jsx9(
|
|
1213
|
-
"span",
|
|
1214
|
-
{
|
|
1215
|
-
className,
|
|
1216
|
-
"data-tooltip-id": tooltipId,
|
|
1217
|
-
"data-tooltip-content": tooltipText,
|
|
1218
|
-
tabIndex: wrapperTabIndex,
|
|
1219
|
-
children
|
|
1220
|
-
}
|
|
1221
|
-
),
|
|
1222
|
-
/* @__PURE__ */ jsx9(
|
|
1223
|
-
Tooltip,
|
|
1224
|
-
{
|
|
1225
|
-
id: tooltipId,
|
|
1226
|
-
place: placement,
|
|
1227
|
-
positionStrategy: "fixed",
|
|
1228
|
-
delayShow,
|
|
1229
|
-
delayHide,
|
|
1230
|
-
className: tooltipClassName,
|
|
1231
|
-
style: { ...defaultTooltipStyle, ...tooltipStyle }
|
|
1232
|
-
}
|
|
1233
|
-
)
|
|
1234
|
-
] });
|
|
1641
|
+
return /* @__PURE__ */ jsx14(Fragment4, { children: skeletons });
|
|
1235
1642
|
}
|
|
1236
1643
|
|
|
1237
1644
|
// src/components/tooltip/TooltipText.tsx
|
|
1238
|
-
import { jsx as
|
|
1645
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1239
1646
|
function TooltipText({
|
|
1240
1647
|
text = "",
|
|
1241
1648
|
maxLength = 20,
|
|
@@ -1255,7 +1662,7 @@ function TooltipText({
|
|
|
1255
1662
|
const displayText = truncateText(fullText, maxLength);
|
|
1256
1663
|
const isTruncated = displayText !== fullText;
|
|
1257
1664
|
const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
|
|
1258
|
-
return /* @__PURE__ */
|
|
1665
|
+
return /* @__PURE__ */ jsx15(
|
|
1259
1666
|
ToolTip,
|
|
1260
1667
|
{
|
|
1261
1668
|
text: fullText,
|
|
@@ -1267,24 +1674,24 @@ function TooltipText({
|
|
|
1267
1674
|
tooltipStyle,
|
|
1268
1675
|
wrapperTabIndex: tooltipDisabled ? void 0 : 0,
|
|
1269
1676
|
disabled: tooltipDisabled,
|
|
1270
|
-
children: /* @__PURE__ */
|
|
1677
|
+
children: /* @__PURE__ */ jsx15("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
|
|
1271
1678
|
}
|
|
1272
1679
|
);
|
|
1273
1680
|
}
|
|
1274
1681
|
|
|
1275
1682
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1276
1683
|
import {
|
|
1277
|
-
forwardRef,
|
|
1278
|
-
useEffect as
|
|
1684
|
+
forwardRef as forwardRef2,
|
|
1685
|
+
useEffect as useEffect6,
|
|
1279
1686
|
useImperativeHandle,
|
|
1280
1687
|
useMemo,
|
|
1281
1688
|
useRef as useRef5,
|
|
1282
|
-
useState as
|
|
1689
|
+
useState as useState4
|
|
1283
1690
|
} from "react";
|
|
1284
1691
|
import toast from "react-hot-toast";
|
|
1285
|
-
import { jsx as
|
|
1692
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1286
1693
|
function ButtonSpinner() {
|
|
1287
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ jsxs12(
|
|
1288
1695
|
"svg",
|
|
1289
1696
|
{
|
|
1290
1697
|
className: "animate-spin",
|
|
@@ -1294,7 +1701,7 @@ function ButtonSpinner() {
|
|
|
1294
1701
|
fill: "none",
|
|
1295
1702
|
"aria-hidden": true,
|
|
1296
1703
|
children: [
|
|
1297
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ jsx16(
|
|
1298
1705
|
"circle",
|
|
1299
1706
|
{
|
|
1300
1707
|
cx: "12",
|
|
@@ -1305,7 +1712,7 @@ function ButtonSpinner() {
|
|
|
1305
1712
|
strokeOpacity: "0.25"
|
|
1306
1713
|
}
|
|
1307
1714
|
),
|
|
1308
|
-
/* @__PURE__ */
|
|
1715
|
+
/* @__PURE__ */ jsx16(
|
|
1309
1716
|
"path",
|
|
1310
1717
|
{
|
|
1311
1718
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
@@ -1327,7 +1734,7 @@ function normalizeInitialValue(initialValue, inputType) {
|
|
|
1327
1734
|
}
|
|
1328
1735
|
return initialValue;
|
|
1329
1736
|
}
|
|
1330
|
-
var CustomCellEditor =
|
|
1737
|
+
var CustomCellEditor = forwardRef2(
|
|
1331
1738
|
({
|
|
1332
1739
|
value: initialValue,
|
|
1333
1740
|
name,
|
|
@@ -1352,8 +1759,8 @@ var CustomCellEditor = forwardRef(
|
|
|
1352
1759
|
cancelButtonClassName
|
|
1353
1760
|
}, ref) => {
|
|
1354
1761
|
const normalizedInitial = normalizeInitialValue(initialValue, inputType);
|
|
1355
|
-
const [value, setValue] =
|
|
1356
|
-
const [isLoading, setIsLoading] =
|
|
1762
|
+
const [value, setValue] = useState4(normalizedInitial);
|
|
1763
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
1357
1764
|
const inputRef = useRef5(null);
|
|
1358
1765
|
const selectRef = useRef5(null);
|
|
1359
1766
|
const normalizedOptions = useMemo(() => {
|
|
@@ -1372,7 +1779,7 @@ var CustomCellEditor = forwardRef(
|
|
|
1372
1779
|
isCancelAfterEnd: () => false,
|
|
1373
1780
|
isPopup: () => true
|
|
1374
1781
|
}));
|
|
1375
|
-
|
|
1782
|
+
useEffect6(() => {
|
|
1376
1783
|
if (isDropdown) {
|
|
1377
1784
|
selectRef.current?.focus();
|
|
1378
1785
|
return;
|
|
@@ -1441,7 +1848,7 @@ var CustomCellEditor = forwardRef(
|
|
|
1441
1848
|
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";
|
|
1442
1849
|
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";
|
|
1443
1850
|
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";
|
|
1444
|
-
return /* @__PURE__ */
|
|
1851
|
+
return /* @__PURE__ */ jsxs12(
|
|
1445
1852
|
"div",
|
|
1446
1853
|
{
|
|
1447
1854
|
className: cn(
|
|
@@ -1450,7 +1857,7 @@ var CustomCellEditor = forwardRef(
|
|
|
1450
1857
|
),
|
|
1451
1858
|
style: containerStyle,
|
|
1452
1859
|
children: [
|
|
1453
|
-
isDropdown ? /* @__PURE__ */
|
|
1860
|
+
isDropdown ? /* @__PURE__ */ jsxs12(
|
|
1454
1861
|
"select",
|
|
1455
1862
|
{
|
|
1456
1863
|
ref: selectRef,
|
|
@@ -1460,11 +1867,11 @@ var CustomCellEditor = forwardRef(
|
|
|
1460
1867
|
className: inputClassName ?? defaultInputClass,
|
|
1461
1868
|
disabled: isLoading,
|
|
1462
1869
|
children: [
|
|
1463
|
-
/* @__PURE__ */
|
|
1464
|
-
normalizedOptions.map((opt) => /* @__PURE__ */
|
|
1870
|
+
/* @__PURE__ */ jsx16("option", { value: "", disabled: true, children: "Select option..." }),
|
|
1871
|
+
normalizedOptions.map((opt) => /* @__PURE__ */ jsx16("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1465
1872
|
]
|
|
1466
1873
|
}
|
|
1467
|
-
) : /* @__PURE__ */
|
|
1874
|
+
) : /* @__PURE__ */ jsx16(
|
|
1468
1875
|
"input",
|
|
1469
1876
|
{
|
|
1470
1877
|
ref: inputRef,
|
|
@@ -1477,7 +1884,7 @@ var CustomCellEditor = forwardRef(
|
|
|
1477
1884
|
disabled: isLoading
|
|
1478
1885
|
}
|
|
1479
1886
|
),
|
|
1480
|
-
/* @__PURE__ */
|
|
1887
|
+
/* @__PURE__ */ jsx16(
|
|
1481
1888
|
"button",
|
|
1482
1889
|
{
|
|
1483
1890
|
type: "button",
|
|
@@ -1486,10 +1893,10 @@ var CustomCellEditor = forwardRef(
|
|
|
1486
1893
|
className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
|
|
1487
1894
|
style: saveButtonStyle,
|
|
1488
1895
|
title: "Save (Enter)",
|
|
1489
|
-
children: isLoading ? loadingIndicator ?? /* @__PURE__ */
|
|
1896
|
+
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ jsx16(ButtonSpinner, {}) : saveButtonContent ?? "Save"
|
|
1490
1897
|
}
|
|
1491
1898
|
),
|
|
1492
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ jsx16(
|
|
1493
1900
|
"button",
|
|
1494
1901
|
{
|
|
1495
1902
|
type: "button",
|
|
@@ -1509,10 +1916,10 @@ var CustomCellEditor = forwardRef(
|
|
|
1509
1916
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
1510
1917
|
|
|
1511
1918
|
// src/components/popup-cell-renderer/PopupCellRenderer.tsx
|
|
1512
|
-
import { useRef as useRef6, useState as
|
|
1919
|
+
import { useRef as useRef6, useState as useState5 } from "react";
|
|
1513
1920
|
import Tippy from "@tippyjs/react";
|
|
1514
1921
|
import { BiDotsVerticalRounded } from "react-icons/bi";
|
|
1515
|
-
import { jsx as
|
|
1922
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1516
1923
|
function PopupCellRenderer({
|
|
1517
1924
|
dropDownContent,
|
|
1518
1925
|
actionIcon: ActionIcon = BiDotsVerticalRounded,
|
|
@@ -1526,7 +1933,7 @@ function PopupCellRenderer({
|
|
|
1526
1933
|
ariaLabel = "Row actions",
|
|
1527
1934
|
openOnHover = false
|
|
1528
1935
|
}) {
|
|
1529
|
-
const [visible, setVisible] =
|
|
1936
|
+
const [visible, setVisible] = useState5(false);
|
|
1530
1937
|
const instanceRef = useRef6(null);
|
|
1531
1938
|
const show = () => setVisible(true);
|
|
1532
1939
|
const hide = () => {
|
|
@@ -1547,7 +1954,7 @@ function PopupCellRenderer({
|
|
|
1547
1954
|
visible,
|
|
1548
1955
|
onClickOutside: hide
|
|
1549
1956
|
};
|
|
1550
|
-
return /* @__PURE__ */
|
|
1957
|
+
return /* @__PURE__ */ jsx17("div", { className: "flex h-full", children: /* @__PURE__ */ jsx17(
|
|
1551
1958
|
Tippy,
|
|
1552
1959
|
{
|
|
1553
1960
|
content,
|
|
@@ -1565,7 +1972,7 @@ function PopupCellRenderer({
|
|
|
1565
1972
|
},
|
|
1566
1973
|
...hoverOrClickProps,
|
|
1567
1974
|
...tippyProps,
|
|
1568
|
-
children: /* @__PURE__ */
|
|
1975
|
+
children: /* @__PURE__ */ jsxs13(
|
|
1569
1976
|
"button",
|
|
1570
1977
|
{
|
|
1571
1978
|
type: "button",
|
|
@@ -1577,7 +1984,7 @@ function PopupCellRenderer({
|
|
|
1577
1984
|
"aria-label": ariaLabel,
|
|
1578
1985
|
children: [
|
|
1579
1986
|
!hideTitle && title,
|
|
1580
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsx17(ActionIcon, { "aria-hidden": true })
|
|
1581
1988
|
]
|
|
1582
1989
|
}
|
|
1583
1990
|
)
|
|
@@ -1614,7 +2021,7 @@ var ROW_ACTION_PRESETS = {
|
|
|
1614
2021
|
};
|
|
1615
2022
|
|
|
1616
2023
|
// src/components/row-actions/ActionMenuItem.tsx
|
|
1617
|
-
import { jsx as
|
|
2024
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1618
2025
|
function ActionMenuItem({
|
|
1619
2026
|
label,
|
|
1620
2027
|
icon: Icon,
|
|
@@ -1635,7 +2042,7 @@ function ActionMenuItem({
|
|
|
1635
2042
|
onClick
|
|
1636
2043
|
}) {
|
|
1637
2044
|
const tooltipText = tooltip ?? label;
|
|
1638
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ jsx18(
|
|
1639
2046
|
ToolTip,
|
|
1640
2047
|
{
|
|
1641
2048
|
text: tooltipText,
|
|
@@ -1646,7 +2053,7 @@ function ActionMenuItem({
|
|
|
1646
2053
|
tooltipClassName,
|
|
1647
2054
|
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
1648
2055
|
className: showLabel ? "block w-full" : "inline-flex",
|
|
1649
|
-
children: /* @__PURE__ */
|
|
2056
|
+
children: /* @__PURE__ */ jsxs14(
|
|
1650
2057
|
"button",
|
|
1651
2058
|
{
|
|
1652
2059
|
type: "button",
|
|
@@ -1666,7 +2073,7 @@ function ActionMenuItem({
|
|
|
1666
2073
|
className
|
|
1667
2074
|
),
|
|
1668
2075
|
children: [
|
|
1669
|
-
Icon ? /* @__PURE__ */
|
|
2076
|
+
Icon ? /* @__PURE__ */ jsx18(
|
|
1670
2077
|
Icon,
|
|
1671
2078
|
{
|
|
1672
2079
|
className: cn("shrink-0", iconClassName),
|
|
@@ -1674,7 +2081,7 @@ function ActionMenuItem({
|
|
|
1674
2081
|
size: iconSize
|
|
1675
2082
|
}
|
|
1676
2083
|
) : null,
|
|
1677
|
-
showLabel ? /* @__PURE__ */
|
|
2084
|
+
showLabel ? /* @__PURE__ */ jsx18("span", { className: labelClassName, children: label }) : null
|
|
1678
2085
|
]
|
|
1679
2086
|
}
|
|
1680
2087
|
)
|
|
@@ -1732,7 +2139,7 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
1732
2139
|
}
|
|
1733
2140
|
|
|
1734
2141
|
// src/components/row-actions/RowActions.tsx
|
|
1735
|
-
import { Fragment as
|
|
2142
|
+
import { Fragment as Fragment5, jsx as jsx19 } from "react/jsx-runtime";
|
|
1736
2143
|
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
1737
2144
|
if (!action.onClick) {
|
|
1738
2145
|
if (action.closeOnClick) hide?.();
|
|
@@ -1786,7 +2193,7 @@ function RowActions({
|
|
|
1786
2193
|
};
|
|
1787
2194
|
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
1788
2195
|
if (action.type === "divider") {
|
|
1789
|
-
return /* @__PURE__ */
|
|
2196
|
+
return /* @__PURE__ */ jsx19(
|
|
1790
2197
|
"div",
|
|
1791
2198
|
{
|
|
1792
2199
|
role: "separator",
|
|
@@ -1796,9 +2203,9 @@ function RowActions({
|
|
|
1796
2203
|
);
|
|
1797
2204
|
}
|
|
1798
2205
|
if (action.content) {
|
|
1799
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ jsx19("div", { className: action.className, children: action.content }, action.key);
|
|
1800
2207
|
}
|
|
1801
|
-
return /* @__PURE__ */
|
|
2208
|
+
return /* @__PURE__ */ jsx19(
|
|
1802
2209
|
ActionMenuItem,
|
|
1803
2210
|
{
|
|
1804
2211
|
label: action.label,
|
|
@@ -1825,15 +2232,15 @@ function RowActions({
|
|
|
1825
2232
|
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
1826
2233
|
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
1827
2234
|
if (!renderItem) return defaultItem;
|
|
1828
|
-
return /* @__PURE__ */
|
|
2235
|
+
return /* @__PURE__ */ jsx19("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
1829
2236
|
});
|
|
1830
2237
|
if (mode === "inline") {
|
|
1831
2238
|
const inlineItems = renderItems(void 0, false);
|
|
1832
|
-
return /* @__PURE__ */
|
|
2239
|
+
return /* @__PURE__ */ jsx19("div", { className: cn("flex h-full items-center justify-center gap-1", className), children: inlineItems });
|
|
1833
2240
|
}
|
|
1834
2241
|
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
1835
2242
|
const buildMenu = (hide) => {
|
|
1836
|
-
const defaultMenu = /* @__PURE__ */
|
|
2243
|
+
const defaultMenu = /* @__PURE__ */ jsx19(
|
|
1837
2244
|
"div",
|
|
1838
2245
|
{
|
|
1839
2246
|
className: cn(
|
|
@@ -1852,14 +2259,14 @@ function RowActions({
|
|
|
1852
2259
|
});
|
|
1853
2260
|
};
|
|
1854
2261
|
if (renderTrigger) {
|
|
1855
|
-
return /* @__PURE__ */
|
|
2262
|
+
return /* @__PURE__ */ jsx19(Fragment5, { children: renderTrigger({
|
|
1856
2263
|
data,
|
|
1857
2264
|
actions: resolved,
|
|
1858
2265
|
hide: () => void 0,
|
|
1859
2266
|
defaultMenu: buildMenu(() => void 0)
|
|
1860
2267
|
}) });
|
|
1861
2268
|
}
|
|
1862
|
-
return /* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ jsx19(
|
|
1863
2270
|
ToolTip,
|
|
1864
2271
|
{
|
|
1865
2272
|
text: triggerTooltipText,
|
|
@@ -1870,7 +2277,7 @@ function RowActions({
|
|
|
1870
2277
|
tooltipClassName,
|
|
1871
2278
|
tooltipStyle,
|
|
1872
2279
|
className: "flex h-full items-center justify-center",
|
|
1873
|
-
children: /* @__PURE__ */
|
|
2280
|
+
children: /* @__PURE__ */ jsx19(
|
|
1874
2281
|
PopupCellRenderer,
|
|
1875
2282
|
{
|
|
1876
2283
|
params: { data },
|
|
@@ -1891,7 +2298,7 @@ function RowActions({
|
|
|
1891
2298
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
1892
2299
|
import { useMemo as useMemo2 } from "react";
|
|
1893
2300
|
import { FaArrowsRotate, FaTriangleExclamation } from "react-icons/fa6";
|
|
1894
|
-
import { Fragment as
|
|
2301
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1895
2302
|
var TableErrorBoundary = ({
|
|
1896
2303
|
isError,
|
|
1897
2304
|
isLoading = false,
|
|
@@ -1908,7 +2315,7 @@ var TableErrorBoundary = ({
|
|
|
1908
2315
|
return "Unable to load table data. Please try again.";
|
|
1909
2316
|
}, [error, errorMessage]);
|
|
1910
2317
|
if (isLoading && !isError) {
|
|
1911
|
-
return /* @__PURE__ */
|
|
2318
|
+
return /* @__PURE__ */ jsx20(
|
|
1912
2319
|
"div",
|
|
1913
2320
|
{
|
|
1914
2321
|
className: cn(
|
|
@@ -1919,12 +2326,12 @@ var TableErrorBoundary = ({
|
|
|
1919
2326
|
role: "status",
|
|
1920
2327
|
"aria-live": "polite",
|
|
1921
2328
|
"aria-busy": "true",
|
|
1922
|
-
children: /* @__PURE__ */
|
|
2329
|
+
children: /* @__PURE__ */ jsx20(Loader, { size: "40px" })
|
|
1923
2330
|
}
|
|
1924
2331
|
);
|
|
1925
2332
|
}
|
|
1926
2333
|
if (isError) {
|
|
1927
|
-
return /* @__PURE__ */
|
|
2334
|
+
return /* @__PURE__ */ jsxs15(
|
|
1928
2335
|
"div",
|
|
1929
2336
|
{
|
|
1930
2337
|
className: cn(
|
|
@@ -1935,7 +2342,7 @@ var TableErrorBoundary = ({
|
|
|
1935
2342
|
role: "alert",
|
|
1936
2343
|
"aria-live": "assertive",
|
|
1937
2344
|
children: [
|
|
1938
|
-
/* @__PURE__ */
|
|
2345
|
+
/* @__PURE__ */ jsx20(
|
|
1939
2346
|
FaTriangleExclamation,
|
|
1940
2347
|
{
|
|
1941
2348
|
className: "text-red-500",
|
|
@@ -1943,11 +2350,11 @@ var TableErrorBoundary = ({
|
|
|
1943
2350
|
"aria-hidden": true
|
|
1944
2351
|
}
|
|
1945
2352
|
),
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
2353
|
+
/* @__PURE__ */ jsxs15("div", { className: "max-w-md space-y-1", children: [
|
|
2354
|
+
/* @__PURE__ */ jsx20("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
2355
|
+
/* @__PURE__ */ jsx20("p", { className: "text-sm text-gray-600", children: message })
|
|
1949
2356
|
] }),
|
|
1950
|
-
refetch && /* @__PURE__ */
|
|
2357
|
+
refetch && /* @__PURE__ */ jsxs15(
|
|
1951
2358
|
"button",
|
|
1952
2359
|
{
|
|
1953
2360
|
type: "button",
|
|
@@ -1955,7 +2362,7 @@ var TableErrorBoundary = ({
|
|
|
1955
2362
|
disabled: isLoading,
|
|
1956
2363
|
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",
|
|
1957
2364
|
children: [
|
|
1958
|
-
/* @__PURE__ */
|
|
2365
|
+
/* @__PURE__ */ jsx20(FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
1959
2366
|
isLoading ? "Retrying..." : "Try again"
|
|
1960
2367
|
]
|
|
1961
2368
|
}
|
|
@@ -1964,7 +2371,7 @@ var TableErrorBoundary = ({
|
|
|
1964
2371
|
}
|
|
1965
2372
|
);
|
|
1966
2373
|
}
|
|
1967
|
-
return /* @__PURE__ */
|
|
2374
|
+
return /* @__PURE__ */ jsx20(Fragment6, { children });
|
|
1968
2375
|
};
|
|
1969
2376
|
|
|
1970
2377
|
export {
|
|
@@ -1978,8 +2385,13 @@ export {
|
|
|
1978
2385
|
SearchInput,
|
|
1979
2386
|
Loader,
|
|
1980
2387
|
Modal,
|
|
1981
|
-
|
|
2388
|
+
Button,
|
|
2389
|
+
Card,
|
|
2390
|
+
Header,
|
|
2391
|
+
Breadcrumbs,
|
|
1982
2392
|
ToolTip,
|
|
2393
|
+
Sidebar,
|
|
2394
|
+
CardSkeleton,
|
|
1983
2395
|
TooltipText,
|
|
1984
2396
|
CustomCellEditor,
|
|
1985
2397
|
PopupCellRenderer,
|
|
@@ -1993,4 +2405,4 @@ export {
|
|
|
1993
2405
|
RowActions,
|
|
1994
2406
|
TableErrorBoundary
|
|
1995
2407
|
};
|
|
1996
|
-
//# sourceMappingURL=chunk-
|
|
2408
|
+
//# sourceMappingURL=chunk-PE7NNAX6.mjs.map
|