@eztrak/shared 0.8.0 → 0.9.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 +38 -1
- package/dist/{chunk-QW67L4Z5.mjs → chunk-2MTTG7D2.mjs} +119 -21
- package/dist/chunk-2MTTG7D2.mjs.map +1 -0
- package/dist/components/index.d.mts +20 -2
- package/dist/components/index.d.ts +20 -2
- package/dist/components/index.js +119 -20
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +119 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
- package/dist/chunk-QW67L4Z5.mjs.map +0 -1
package/dist/components/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/components/index.ts
|
|
31
31
|
var components_exports = {};
|
|
32
32
|
__export(components_exports, {
|
|
33
|
+
CardSkeleton: () => CardSkeleton,
|
|
33
34
|
CustomCellEditor: () => CustomCellEditor,
|
|
34
35
|
CustomPagination: () => CustomPagination,
|
|
35
36
|
EztrakTabs: () => EztrakTabs,
|
|
@@ -980,10 +981,106 @@ function Modal({
|
|
|
980
981
|
return (0, import_react_dom.createPortal)(modalContent, modalRoot);
|
|
981
982
|
}
|
|
982
983
|
|
|
984
|
+
// src/components/skeleton/CardSkeleton.tsx
|
|
985
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
986
|
+
var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
|
|
987
|
+
function shouldShowAvatar(variant, showAvatar) {
|
|
988
|
+
return showAvatar ?? variant === "profile";
|
|
989
|
+
}
|
|
990
|
+
function shouldShowImage(variant, showImage) {
|
|
991
|
+
return showImage ?? variant === "image";
|
|
992
|
+
}
|
|
993
|
+
function AvatarSkeleton({ className }) {
|
|
994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
995
|
+
"svg",
|
|
996
|
+
{
|
|
997
|
+
className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
|
|
998
|
+
"aria-hidden": "true",
|
|
999
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1000
|
+
fill: "currentColor",
|
|
1001
|
+
viewBox: "0 0 20 20",
|
|
1002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.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" })
|
|
1003
|
+
}
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
function SkeletonBlock({
|
|
1007
|
+
widthClass,
|
|
1008
|
+
className,
|
|
1009
|
+
isFirst
|
|
1010
|
+
}) {
|
|
1011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1012
|
+
"div",
|
|
1013
|
+
{
|
|
1014
|
+
className: cn(
|
|
1015
|
+
isFirst ? "h-2.5 mb-2" : "h-2",
|
|
1016
|
+
"bg-gray-200 rounded-full dark:bg-gray-700",
|
|
1017
|
+
widthClass,
|
|
1018
|
+
className
|
|
1019
|
+
)
|
|
1020
|
+
}
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
function CardSkeleton({
|
|
1024
|
+
variant = "profile",
|
|
1025
|
+
count = 1,
|
|
1026
|
+
lines = 2,
|
|
1027
|
+
lineWidths = DEFAULT_LINE_WIDTHS,
|
|
1028
|
+
showAvatar,
|
|
1029
|
+
showImage,
|
|
1030
|
+
animationDuration = "0.7s",
|
|
1031
|
+
className,
|
|
1032
|
+
style,
|
|
1033
|
+
avatarClassName,
|
|
1034
|
+
imageClassName,
|
|
1035
|
+
contentClassName,
|
|
1036
|
+
lineClassName,
|
|
1037
|
+
srLabel = "Loading...",
|
|
1038
|
+
...props
|
|
1039
|
+
}) {
|
|
1040
|
+
const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
|
|
1041
|
+
const renderAvatar = shouldShowAvatar(variant, showAvatar);
|
|
1042
|
+
const renderImage = shouldShowImage(variant, showImage);
|
|
1043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1044
|
+
"div",
|
|
1045
|
+
{
|
|
1046
|
+
className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
|
|
1047
|
+
style: { animationDuration, ...style },
|
|
1048
|
+
...props,
|
|
1049
|
+
children: [
|
|
1050
|
+
renderImage ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1051
|
+
"div",
|
|
1052
|
+
{
|
|
1053
|
+
className: cn(
|
|
1054
|
+
"mb-4 h-32 w-full rounded-xl bg-gray-200 dark:bg-gray-700",
|
|
1055
|
+
imageClassName
|
|
1056
|
+
)
|
|
1057
|
+
}
|
|
1058
|
+
) : null,
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
|
|
1060
|
+
renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
|
|
1061
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1062
|
+
SkeletonBlock,
|
|
1063
|
+
{
|
|
1064
|
+
widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
|
|
1065
|
+
className: lineClassName,
|
|
1066
|
+
isFirst: lineIndex === 0
|
|
1067
|
+
},
|
|
1068
|
+
lineIndex
|
|
1069
|
+
)) })
|
|
1070
|
+
] }),
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sr-only", children: srLabel })
|
|
1072
|
+
]
|
|
1073
|
+
},
|
|
1074
|
+
index
|
|
1075
|
+
);
|
|
1076
|
+
});
|
|
1077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: skeletons });
|
|
1078
|
+
}
|
|
1079
|
+
|
|
983
1080
|
// src/components/tooltip/ToolTip.tsx
|
|
984
1081
|
var import_react4 = require("react");
|
|
985
1082
|
var import_react_tooltip = require("react-tooltip");
|
|
986
|
-
var
|
|
1083
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
987
1084
|
var defaultTooltipStyle = {
|
|
988
1085
|
color: "#fff",
|
|
989
1086
|
borderRadius: "5px",
|
|
@@ -1010,10 +1107,10 @@ function ToolTip({
|
|
|
1010
1107
|
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1011
1108
|
const tooltipText = String(text ?? "");
|
|
1012
1109
|
if (disabled || !tooltipText) {
|
|
1013
|
-
return /* @__PURE__ */ (0,
|
|
1110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className, children });
|
|
1014
1111
|
}
|
|
1015
|
-
return /* @__PURE__ */ (0,
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1017
1114
|
"span",
|
|
1018
1115
|
{
|
|
1019
1116
|
className,
|
|
@@ -1023,11 +1120,12 @@ function ToolTip({
|
|
|
1023
1120
|
children
|
|
1024
1121
|
}
|
|
1025
1122
|
),
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1027
1124
|
import_react_tooltip.Tooltip,
|
|
1028
1125
|
{
|
|
1029
1126
|
id: tooltipId,
|
|
1030
1127
|
place: placement,
|
|
1128
|
+
positionStrategy: "fixed",
|
|
1031
1129
|
delayShow,
|
|
1032
1130
|
delayHide,
|
|
1033
1131
|
className: tooltipClassName,
|
|
@@ -1066,7 +1164,7 @@ var toDateInputValue = (date) => {
|
|
|
1066
1164
|
};
|
|
1067
1165
|
|
|
1068
1166
|
// src/components/tooltip/TooltipText.tsx
|
|
1069
|
-
var
|
|
1167
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1070
1168
|
function TooltipText({
|
|
1071
1169
|
text = "",
|
|
1072
1170
|
maxLength = 20,
|
|
@@ -1086,7 +1184,7 @@ function TooltipText({
|
|
|
1086
1184
|
const displayText = truncateText(fullText, maxLength);
|
|
1087
1185
|
const isTruncated = displayText !== fullText;
|
|
1088
1186
|
const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
|
|
1089
|
-
return /* @__PURE__ */ (0,
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1090
1188
|
ToolTip,
|
|
1091
1189
|
{
|
|
1092
1190
|
text: fullText,
|
|
@@ -1098,7 +1196,7 @@ function TooltipText({
|
|
|
1098
1196
|
tooltipStyle,
|
|
1099
1197
|
wrapperTabIndex: tooltipDisabled ? void 0 : 0,
|
|
1100
1198
|
disabled: tooltipDisabled,
|
|
1101
|
-
children: /* @__PURE__ */ (0,
|
|
1199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
|
|
1102
1200
|
}
|
|
1103
1201
|
);
|
|
1104
1202
|
}
|
|
@@ -1106,9 +1204,9 @@ function TooltipText({
|
|
|
1106
1204
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1107
1205
|
var import_react5 = require("react");
|
|
1108
1206
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1109
|
-
var
|
|
1207
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1110
1208
|
function ButtonSpinner() {
|
|
1111
|
-
return /* @__PURE__ */ (0,
|
|
1209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1112
1210
|
"svg",
|
|
1113
1211
|
{
|
|
1114
1212
|
className: "animate-spin",
|
|
@@ -1118,7 +1216,7 @@ function ButtonSpinner() {
|
|
|
1118
1216
|
fill: "none",
|
|
1119
1217
|
"aria-hidden": true,
|
|
1120
1218
|
children: [
|
|
1121
|
-
/* @__PURE__ */ (0,
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1122
1220
|
"circle",
|
|
1123
1221
|
{
|
|
1124
1222
|
cx: "12",
|
|
@@ -1129,7 +1227,7 @@ function ButtonSpinner() {
|
|
|
1129
1227
|
strokeOpacity: "0.25"
|
|
1130
1228
|
}
|
|
1131
1229
|
),
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1133
1231
|
"path",
|
|
1134
1232
|
{
|
|
1135
1233
|
d: "M12 2a10 10 0 0 1 10 10",
|
|
@@ -1265,7 +1363,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1265
1363
|
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";
|
|
1266
1364
|
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";
|
|
1267
1365
|
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";
|
|
1268
|
-
return /* @__PURE__ */ (0,
|
|
1366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1269
1367
|
"div",
|
|
1270
1368
|
{
|
|
1271
1369
|
className: cn(
|
|
@@ -1274,7 +1372,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1274
1372
|
),
|
|
1275
1373
|
style: containerStyle,
|
|
1276
1374
|
children: [
|
|
1277
|
-
isDropdown ? /* @__PURE__ */ (0,
|
|
1375
|
+
isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1278
1376
|
"select",
|
|
1279
1377
|
{
|
|
1280
1378
|
ref: selectRef,
|
|
@@ -1284,11 +1382,11 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1284
1382
|
className: inputClassName ?? defaultInputClass,
|
|
1285
1383
|
disabled: isLoading,
|
|
1286
1384
|
children: [
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
normalizedOptions.map((opt) => /* @__PURE__ */ (0,
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
|
|
1386
|
+
normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1289
1387
|
]
|
|
1290
1388
|
}
|
|
1291
|
-
) : /* @__PURE__ */ (0,
|
|
1389
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1292
1390
|
"input",
|
|
1293
1391
|
{
|
|
1294
1392
|
ref: inputRef,
|
|
@@ -1301,7 +1399,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1301
1399
|
disabled: isLoading
|
|
1302
1400
|
}
|
|
1303
1401
|
),
|
|
1304
|
-
/* @__PURE__ */ (0,
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1305
1403
|
"button",
|
|
1306
1404
|
{
|
|
1307
1405
|
type: "button",
|
|
@@ -1310,10 +1408,10 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1310
1408
|
className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
|
|
1311
1409
|
style: saveButtonStyle,
|
|
1312
1410
|
title: "Save (Enter)",
|
|
1313
|
-
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0,
|
|
1411
|
+
children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
|
|
1314
1412
|
}
|
|
1315
1413
|
),
|
|
1316
|
-
/* @__PURE__ */ (0,
|
|
1414
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1317
1415
|
"button",
|
|
1318
1416
|
{
|
|
1319
1417
|
type: "button",
|
|
@@ -1333,6 +1431,7 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1333
1431
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
1334
1432
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1335
1433
|
0 && (module.exports = {
|
|
1434
|
+
CardSkeleton,
|
|
1336
1435
|
CustomCellEditor,
|
|
1337
1436
|
CustomPagination,
|
|
1338
1437
|
EztrakTabs,
|