@eztrak/shared 0.16.5 → 0.17.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/README.md +119 -3
- package/dist/{chunk-EIX5CUQF.mjs → chunk-A5BBQ7X5.mjs} +224 -20
- package/dist/chunk-A5BBQ7X5.mjs.map +1 -0
- package/dist/{chunk-WZVYTP6G.mjs → chunk-HAW3AKJP.mjs} +2 -2
- package/dist/{chunk-S7ZLXOPF.mjs → chunk-KJWCRX6F.mjs} +150 -51
- package/dist/chunk-KJWCRX6F.mjs.map +1 -0
- package/dist/components/index.d.mts +10 -2
- package/dist/components/index.d.ts +10 -2
- package/dist/components/index.js +357 -58
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/{handleApiError-CwVIJOqO.d.mts → handleApiError-SHMjCJHj.d.mts} +25 -1
- package/dist/{handleApiError-CwVIJOqO.d.ts → handleApiError-SHMjCJHj.d.ts} +25 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +359 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +224 -19
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -2
- package/package.json +1 -1
- package/dist/chunk-EIX5CUQF.mjs.map +0 -1
- package/dist/chunk-S7ZLXOPF.mjs.map +0 -1
- /package/dist/{chunk-WZVYTP6G.mjs.map → chunk-HAW3AKJP.mjs.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
storeItemInLocalStorage,
|
|
9
9
|
toDateInputValue,
|
|
10
10
|
truncateText
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-A5BBQ7X5.mjs";
|
|
12
12
|
|
|
13
13
|
// src/components/tabs/EztrakTabs.tsx
|
|
14
14
|
import {
|
|
@@ -1189,10 +1189,41 @@ function Header({
|
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
1191
|
// src/components/breadcrumbs/Breadcrumbs.tsx
|
|
1192
|
-
import {
|
|
1192
|
+
import {
|
|
1193
|
+
cloneElement,
|
|
1194
|
+
isValidElement
|
|
1195
|
+
} from "react";
|
|
1193
1196
|
import { Link, useLocation } from "react-router-dom";
|
|
1194
|
-
import { Fragment
|
|
1195
|
-
var
|
|
1197
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1198
|
+
var DEFAULT_BACKGROUND = "#F7F7F5";
|
|
1199
|
+
var DEFAULT_INACTIVE = "#6B7280";
|
|
1200
|
+
var DEFAULT_ACTIVE = "#111111";
|
|
1201
|
+
var DEFAULT_SEPARATOR = "#9CA3AF";
|
|
1202
|
+
var CRUMB_LAYOUT = "inline-flex items-center gap-1.5 whitespace-nowrap leading-5 rounded-sm";
|
|
1203
|
+
var LINK_INTERACTION = "font-normal transition-colors duration-200 motion-reduce:transition-none hover:!text-[color-mix(in_srgb,var(--bc-inactive)_65%,#111111)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#111111]";
|
|
1204
|
+
function BreadcrumbChevron() {
|
|
1205
|
+
return /* @__PURE__ */ jsx11(
|
|
1206
|
+
"svg",
|
|
1207
|
+
{
|
|
1208
|
+
width: "12",
|
|
1209
|
+
height: "12",
|
|
1210
|
+
viewBox: "0 0 12 12",
|
|
1211
|
+
fill: "none",
|
|
1212
|
+
"aria-hidden": "true",
|
|
1213
|
+
className: "shrink-0",
|
|
1214
|
+
children: /* @__PURE__ */ jsx11(
|
|
1215
|
+
"path",
|
|
1216
|
+
{
|
|
1217
|
+
d: "M4.5 2.5L8 6L4.5 9.5",
|
|
1218
|
+
stroke: "currentColor",
|
|
1219
|
+
strokeWidth: "1.5",
|
|
1220
|
+
strokeLinecap: "round",
|
|
1221
|
+
strokeLinejoin: "round"
|
|
1222
|
+
}
|
|
1223
|
+
)
|
|
1224
|
+
}
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1196
1227
|
function asTitleMap(customTitles) {
|
|
1197
1228
|
if (Object.prototype.toString.call(customTitles) !== "[object Object]") {
|
|
1198
1229
|
return {};
|
|
@@ -1222,73 +1253,141 @@ function Breadcrumbs({
|
|
|
1222
1253
|
containerClassName,
|
|
1223
1254
|
linkClassName = "",
|
|
1224
1255
|
separatorClassName = "",
|
|
1225
|
-
separator
|
|
1226
|
-
activeClassName = "font-
|
|
1256
|
+
separator,
|
|
1257
|
+
activeClassName = "font-semibold",
|
|
1227
1258
|
customTitles = {},
|
|
1228
1259
|
customIcons = {},
|
|
1229
1260
|
prefix,
|
|
1230
1261
|
suffix,
|
|
1231
|
-
nonClickablePaths = []
|
|
1262
|
+
nonClickablePaths = [],
|
|
1263
|
+
backgroundColor = DEFAULT_BACKGROUND,
|
|
1264
|
+
inactiveColor = DEFAULT_INACTIVE,
|
|
1265
|
+
activeColor = DEFAULT_ACTIVE,
|
|
1266
|
+
separatorColor = DEFAULT_SEPARATOR,
|
|
1267
|
+
iconColor,
|
|
1268
|
+
iconClassName,
|
|
1269
|
+
showHome = false
|
|
1232
1270
|
}) {
|
|
1233
1271
|
const location = useLocation();
|
|
1234
1272
|
const pathnames = location.pathname.split("/").filter((segment) => segment);
|
|
1235
1273
|
const titles = asTitleMap(customTitles);
|
|
1236
|
-
const inactiveLinkClassName = cn(INACTIVE_LINK_CLASS, linkClassName);
|
|
1237
1274
|
const getTitle = (pathname) => {
|
|
1238
1275
|
const match = findRoute(pathname, routes);
|
|
1239
1276
|
if (match && match.title) {
|
|
1240
1277
|
return match.title;
|
|
1241
1278
|
}
|
|
1242
|
-
const titleKeys = Object.keys(titles);
|
|
1243
|
-
const paramMatch = pathname.split("/").find((segment) => titleKeys.includes(segment)) || "";
|
|
1244
|
-
if (paramMatch && titles[paramMatch]) {
|
|
1245
|
-
return titles[paramMatch];
|
|
1246
|
-
}
|
|
1247
1279
|
const lastParamPath = getLastParam(pathname);
|
|
1280
|
+
if (lastParamPath && titles[lastParamPath]) {
|
|
1281
|
+
return titles[lastParamPath];
|
|
1282
|
+
}
|
|
1248
1283
|
if (lastParamPath) {
|
|
1249
1284
|
return lastParamPath;
|
|
1250
1285
|
}
|
|
1251
1286
|
return pathname;
|
|
1252
1287
|
};
|
|
1253
1288
|
const getIcon = (pathname) => {
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
return customIcons[matchedSegment];
|
|
1289
|
+
const segment = getLastParam(pathname);
|
|
1290
|
+
if (segment && customIcons[segment]) {
|
|
1291
|
+
return customIcons[segment];
|
|
1258
1292
|
}
|
|
1259
1293
|
return null;
|
|
1260
1294
|
};
|
|
1295
|
+
const crumbs = [];
|
|
1296
|
+
if (showHome) {
|
|
1297
|
+
crumbs.push({
|
|
1298
|
+
key: "home",
|
|
1299
|
+
to: "/",
|
|
1300
|
+
title: titles.home || "Home",
|
|
1301
|
+
icon: customIcons.home ?? null,
|
|
1302
|
+
isCurrent: pathnames.length === 0,
|
|
1303
|
+
isLink: pathnames.length > 0
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
pathnames.forEach((segment, index) => {
|
|
1307
|
+
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
|
|
1308
|
+
const isCurrent = index === pathnames.length - 1;
|
|
1309
|
+
const isNonClickable = nonClickablePaths.some(
|
|
1310
|
+
(token) => to.includes(token) || segment === token
|
|
1311
|
+
);
|
|
1312
|
+
crumbs.push({
|
|
1313
|
+
key: to,
|
|
1314
|
+
to,
|
|
1315
|
+
title: getTitle(to),
|
|
1316
|
+
icon: getIcon(to),
|
|
1317
|
+
isCurrent,
|
|
1318
|
+
isLink: !isCurrent && !isNonClickable
|
|
1319
|
+
});
|
|
1320
|
+
});
|
|
1321
|
+
const navStyle = {
|
|
1322
|
+
backgroundColor,
|
|
1323
|
+
"--bc-inactive": inactiveColor
|
|
1324
|
+
};
|
|
1325
|
+
const inactiveClassName = cn(CRUMB_LAYOUT, LINK_INTERACTION, linkClassName);
|
|
1326
|
+
const staticInactiveClassName = cn(CRUMB_LAYOUT, "font-normal", linkClassName);
|
|
1327
|
+
const currentClassName = cn(CRUMB_LAYOUT, activeClassName);
|
|
1328
|
+
const renderCrumb = (crumb) => {
|
|
1329
|
+
const content = /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1330
|
+
crumb.icon ? /* @__PURE__ */ jsx11(
|
|
1331
|
+
"span",
|
|
1332
|
+
{
|
|
1333
|
+
className: cn("inline-flex shrink-0 items-center", iconClassName),
|
|
1334
|
+
style: iconColor ? { color: iconColor } : void 0,
|
|
1335
|
+
children: crumb.icon
|
|
1336
|
+
}
|
|
1337
|
+
) : null,
|
|
1338
|
+
crumb.title
|
|
1339
|
+
] });
|
|
1340
|
+
if (crumb.isCurrent) {
|
|
1341
|
+
return /* @__PURE__ */ jsx11(
|
|
1342
|
+
"span",
|
|
1343
|
+
{
|
|
1344
|
+
className: currentClassName,
|
|
1345
|
+
style: { color: activeColor },
|
|
1346
|
+
"aria-current": "page",
|
|
1347
|
+
children: content
|
|
1348
|
+
}
|
|
1349
|
+
);
|
|
1350
|
+
}
|
|
1351
|
+
if (crumb.isLink) {
|
|
1352
|
+
return /* @__PURE__ */ jsx11(
|
|
1353
|
+
Link,
|
|
1354
|
+
{
|
|
1355
|
+
to: crumb.to,
|
|
1356
|
+
className: inactiveClassName,
|
|
1357
|
+
style: { color: inactiveColor },
|
|
1358
|
+
children: content
|
|
1359
|
+
}
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
return /* @__PURE__ */ jsx11("span", { className: staticInactiveClassName, style: { color: inactiveColor }, children: content });
|
|
1363
|
+
};
|
|
1261
1364
|
return /* @__PURE__ */ jsxs8(
|
|
1262
|
-
"
|
|
1365
|
+
"nav",
|
|
1263
1366
|
{
|
|
1367
|
+
"aria-label": "Breadcrumb",
|
|
1264
1368
|
className: cn(
|
|
1265
|
-
"flex flex-row gap-2
|
|
1369
|
+
"flex w-full flex-row items-center gap-2 overflow-x-auto px-4 py-3 text-sm leading-5",
|
|
1266
1370
|
containerClassName
|
|
1267
1371
|
),
|
|
1372
|
+
style: navStyle,
|
|
1268
1373
|
children: [
|
|
1269
|
-
prefix
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
return /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1287
|
-
/* @__PURE__ */ jsx11("span", { className: separatorClassName, children: separator }),
|
|
1288
|
-
isLast || isNonClickable ? /* @__PURE__ */ jsx11("span", { className: isLast ? activeClassName : linkClassName, children: crumb }) : /* @__PURE__ */ jsx11(Link, { to, className: inactiveLinkClassName, children: crumb })
|
|
1289
|
-
] }, to);
|
|
1290
|
-
}),
|
|
1291
|
-
suffix && /* @__PURE__ */ jsx11("div", { className: "breadcrumb-suffix", children: suffix })
|
|
1374
|
+
prefix ? /* @__PURE__ */ jsx11("div", { className: "breadcrumb-prefix", children: prefix }) : null,
|
|
1375
|
+
/* @__PURE__ */ jsx11("ol", { className: "flex min-w-0 flex-row flex-nowrap items-center gap-2", children: crumbs.map((crumb, index) => /* @__PURE__ */ jsxs8("li", { className: "inline-flex items-center gap-2", children: [
|
|
1376
|
+
index > 0 ? /* @__PURE__ */ jsx11(
|
|
1377
|
+
"span",
|
|
1378
|
+
{
|
|
1379
|
+
"aria-hidden": "true",
|
|
1380
|
+
className: cn(
|
|
1381
|
+
"inline-flex shrink-0 items-center",
|
|
1382
|
+
separatorClassName
|
|
1383
|
+
),
|
|
1384
|
+
style: { color: separatorColor },
|
|
1385
|
+
children: separator === void 0 ? /* @__PURE__ */ jsx11(BreadcrumbChevron, {}) : isValidElement(separator) ? cloneElement(separator) : separator
|
|
1386
|
+
}
|
|
1387
|
+
) : null,
|
|
1388
|
+
renderCrumb(crumb)
|
|
1389
|
+
] }, crumb.key)) }),
|
|
1390
|
+
suffix ? /* @__PURE__ */ jsx11("div", { className: "breadcrumb-suffix", children: suffix }) : null
|
|
1292
1391
|
]
|
|
1293
1392
|
}
|
|
1294
1393
|
);
|
|
@@ -1301,7 +1400,7 @@ import { Link as Link2, useLocation as useLocation2 } from "react-router-dom";
|
|
|
1301
1400
|
// src/components/tooltip/ToolTip.tsx
|
|
1302
1401
|
import { useId as useId2 } from "react";
|
|
1303
1402
|
import { Tooltip } from "react-tooltip";
|
|
1304
|
-
import { Fragment as
|
|
1403
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1305
1404
|
var defaultTooltipStyle = {
|
|
1306
1405
|
color: "#fff",
|
|
1307
1406
|
borderRadius: "5px",
|
|
@@ -1330,7 +1429,7 @@ function ToolTip({
|
|
|
1330
1429
|
if (disabled || !tooltipText) {
|
|
1331
1430
|
return /* @__PURE__ */ jsx12("span", { className, children });
|
|
1332
1431
|
}
|
|
1333
|
-
return /* @__PURE__ */ jsxs9(
|
|
1432
|
+
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1334
1433
|
/* @__PURE__ */ jsx12(
|
|
1335
1434
|
"span",
|
|
1336
1435
|
{
|
|
@@ -1694,7 +1793,7 @@ function Sidebar({
|
|
|
1694
1793
|
}
|
|
1695
1794
|
|
|
1696
1795
|
// src/components/skeleton/CardSkeleton.tsx
|
|
1697
|
-
import { Fragment as
|
|
1796
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1698
1797
|
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
1699
1798
|
function shouldShowAvatar(variant, showAvatar) {
|
|
1700
1799
|
return showAvatar ?? variant === "profile";
|
|
@@ -1786,7 +1885,7 @@ function CardSkeleton({
|
|
|
1786
1885
|
index
|
|
1787
1886
|
);
|
|
1788
1887
|
});
|
|
1789
|
-
return /* @__PURE__ */ jsx14(
|
|
1888
|
+
return /* @__PURE__ */ jsx14(Fragment3, { children: skeletons });
|
|
1790
1889
|
}
|
|
1791
1890
|
|
|
1792
1891
|
// src/components/tooltip/TooltipText.tsx
|
|
@@ -2287,7 +2386,7 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
2287
2386
|
}
|
|
2288
2387
|
|
|
2289
2388
|
// src/components/row-actions/RowActions.tsx
|
|
2290
|
-
import { Fragment as
|
|
2389
|
+
import { Fragment as Fragment4, jsx as jsx19 } from "react/jsx-runtime";
|
|
2291
2390
|
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
2292
2391
|
if (!action.onClick) {
|
|
2293
2392
|
if (action.closeOnClick) hide?.();
|
|
@@ -2407,7 +2506,7 @@ function RowActions({
|
|
|
2407
2506
|
});
|
|
2408
2507
|
};
|
|
2409
2508
|
if (renderTrigger) {
|
|
2410
|
-
return /* @__PURE__ */ jsx19(
|
|
2509
|
+
return /* @__PURE__ */ jsx19(Fragment4, { children: renderTrigger({
|
|
2411
2510
|
data,
|
|
2412
2511
|
actions: resolved,
|
|
2413
2512
|
hide: () => void 0,
|
|
@@ -2446,7 +2545,7 @@ function RowActions({
|
|
|
2446
2545
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
2447
2546
|
import { useMemo as useMemo2 } from "react";
|
|
2448
2547
|
import { FaArrowsRotate, FaTriangleExclamation } from "react-icons/fa6";
|
|
2449
|
-
import { Fragment as
|
|
2548
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2450
2549
|
var TableErrorBoundary = ({
|
|
2451
2550
|
isError,
|
|
2452
2551
|
isLoading = false,
|
|
@@ -2519,7 +2618,7 @@ var TableErrorBoundary = ({
|
|
|
2519
2618
|
}
|
|
2520
2619
|
);
|
|
2521
2620
|
}
|
|
2522
|
-
return /* @__PURE__ */ jsx20(
|
|
2621
|
+
return /* @__PURE__ */ jsx20(Fragment5, { children });
|
|
2523
2622
|
};
|
|
2524
2623
|
|
|
2525
2624
|
export {
|
|
@@ -2553,4 +2652,4 @@ export {
|
|
|
2553
2652
|
RowActions,
|
|
2554
2653
|
TableErrorBoundary
|
|
2555
2654
|
};
|
|
2556
|
-
//# sourceMappingURL=chunk-
|
|
2655
|
+
//# sourceMappingURL=chunk-KJWCRX6F.mjs.map
|