@eztrak/shared 0.9.0 → 0.12.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/index.js CHANGED
@@ -33,6 +33,7 @@ __export(src_exports, {
33
33
  CardSkeleton: () => CardSkeleton,
34
34
  CustomCellEditor: () => CustomCellEditor,
35
35
  CustomPagination: () => CustomPagination,
36
+ DropdownFilter: () => DropdownFilter,
36
37
  EztrakTabs: () => EztrakTabs,
37
38
  Loader: () => Loader,
38
39
  Modal: () => Modal,
@@ -42,6 +43,7 @@ __export(src_exports, {
42
43
  TableLayoutToolbarControls: () => TableLayoutToolbarControls,
43
44
  ToolTip: () => ToolTip,
44
45
  TooltipText: () => TooltipText,
46
+ USER_STATE_STORAGE_KEY: () => USER_STATE_STORAGE_KEY,
45
47
  capitalizeText: () => capitalizeText,
46
48
  checkIfExistsInArray: () => checkIfExistsInArray,
47
49
  cn: () => cn,
@@ -49,21 +51,32 @@ __export(src_exports, {
49
51
  convertCommaDataToArray: () => convertCommaDataToArray,
50
52
  currencyFormatter: () => currencyFormatter,
51
53
  deserializeJson: () => deserializeJson,
54
+ dropdownStyles: () => dropdownStyles,
52
55
  flattenTableData: () => flattenTableData,
53
56
  formatDate: () => formatDate,
54
57
  formatDateTime: () => formatDateTime,
55
58
  formatNumber: () => formatNumber,
56
59
  formatValidationErrorsHtml: () => formatValidationErrorsHtml,
60
+ get: () => get,
57
61
  getApiError: () => getApiError,
58
62
  getErrorMessages: () => getErrorMessages,
59
63
  getFieldsByCategory: () => getFieldsByCategory,
60
64
  getFieldsByInputType: () => getFieldsByInputType,
61
65
  getFieldsByName: () => getFieldsByName,
66
+ getItem: () => getItem,
67
+ getItemFromLocalStorage: () => getItemFromLocalStorage,
62
68
  handleApiError: () => handleApiError,
63
69
  isEmpty: () => isEmpty,
70
+ loadUserState: () => loadUserState,
64
71
  normalizeApiListItems: () => normalizeApiListItems,
65
72
  parseCurrencyValueToNumber: () => parseCurrencyValueToNumber,
66
73
  removeByPropertyValues: () => removeByPropertyValues,
74
+ removeItem: () => removeItem,
75
+ saveItemLocalStorage: () => saveItemLocalStorage,
76
+ saveUserState: () => saveUserState,
77
+ set: () => set,
78
+ setItem: () => setItem,
79
+ storeItemInLocalStorage: () => storeItemInLocalStorage,
67
80
  toDateInputValue: () => toDateInputValue,
68
81
  toLowerCaseText: () => toLowerCaseText,
69
82
  truncateFileName: () => truncateFileName,
@@ -278,6 +291,48 @@ var getFieldsByInputType = (fields = [], key) => {
278
291
  return fields.filter(({ inputType = "" }) => inputType === key);
279
292
  };
280
293
 
294
+ // src/utils/localStorage.ts
295
+ var USER_STATE_STORAGE_KEY = "authState";
296
+ function getStorage() {
297
+ if (typeof window === "undefined") return null;
298
+ return window.localStorage;
299
+ }
300
+ function getItem(key, fallback = null) {
301
+ try {
302
+ const raw = getStorage()?.getItem(key);
303
+ if (raw === null || raw === void 0) {
304
+ return fallback;
305
+ }
306
+ return JSON.parse(raw);
307
+ } catch {
308
+ return fallback;
309
+ }
310
+ }
311
+ function setItem(key, value) {
312
+ try {
313
+ getStorage()?.setItem(key, JSON.stringify(value));
314
+ } catch {
315
+ }
316
+ }
317
+ function removeItem(key) {
318
+ try {
319
+ getStorage()?.removeItem(key);
320
+ } catch {
321
+ }
322
+ }
323
+ function loadUserState(key = USER_STATE_STORAGE_KEY) {
324
+ const value = getItem(key, void 0);
325
+ return value === null ? void 0 : value;
326
+ }
327
+ function saveUserState(state, key = USER_STATE_STORAGE_KEY) {
328
+ setItem(key, state);
329
+ }
330
+ var get = getItem;
331
+ var set = setItem;
332
+ var getItemFromLocalStorage = getItem;
333
+ var storeItemInLocalStorage = setItem;
334
+ var saveItemLocalStorage = setItem;
335
+
281
336
  // src/utils/handleApiError.ts
282
337
  var import_react_hot_toast = __toESM(require("react-hot-toast"));
283
338
  var import_sweetalert2 = __toESM(require("sweetalert2"));
@@ -330,18 +385,92 @@ function handleApiError(error, { showAlert = false, fallbackMessage } = {}) {
330
385
  const message = fallbackMessage || data?.message || data?.title || error.error || "An error occurred. Please try again.";
331
386
  import_react_hot_toast.default.error(message);
332
387
  }
388
+ var BRAND_ORANGE = "#FF7335";
389
+ var CANCEL_RED = "#ff0000";
390
+ function getConfirmErrorMessage(error) {
391
+ if (error && typeof error === "object") {
392
+ const err = error;
393
+ return err.data?.message || err.data?.title || err.message || "Something went wrong. Please try again.";
394
+ }
395
+ return "Something went wrong. Please try again.";
396
+ }
333
397
  function confirmationAlert(onConfirm, options = {}) {
334
- void import_sweetalert2.default.fire({
335
- title: options.title ?? "Are you sure?",
336
- text: options.text,
337
- icon: options.icon ?? "warning",
398
+ const {
399
+ title = options.inputExpectedValue ? "Confirmation Required" : "Are you sure?",
400
+ text,
401
+ html,
402
+ icon = "warning",
403
+ confirmButtonText = "Yes",
404
+ cancelButtonText = "Cancel",
405
+ confirmButtonColor = BRAND_ORANGE,
406
+ cancelButtonColor = CANCEL_RED,
407
+ showLoaderOnConfirm = false,
408
+ inputExpectedValue,
409
+ inputPlaceholder = "Type confirmation text to proceed",
410
+ reverseButtons,
411
+ focusCancel,
412
+ zIndex
413
+ } = options;
414
+ const hasInput = Boolean(inputExpectedValue);
415
+ const useLoader = showLoaderOnConfirm || hasInput;
416
+ const inputHtml = html ?? (hasInput ? `
417
+ ${text ? `<p style="margin-bottom: 15px;">${text}</p>` : ""}
418
+ <p style="margin-bottom: 10px; font-weight: bold; color: #666;">
419
+ Please type "<span style="color: ${BRAND_ORANGE}; font-weight: bold;">${inputExpectedValue}</span>" to confirm:
420
+ </p>
421
+ ` : void 0);
422
+ const swalOptions = {
423
+ title,
424
+ icon,
338
425
  showCancelButton: true,
339
- confirmButtonText: options.confirmButtonText ?? "Yes",
340
- cancelButtonText: options.cancelButtonText ?? "Cancel",
341
- confirmButtonColor: "#FF7335"
342
- }).then((result) => {
343
- if (result.isConfirmed) {
344
- onConfirm();
426
+ confirmButtonText,
427
+ cancelButtonText,
428
+ confirmButtonColor,
429
+ cancelButtonColor,
430
+ reverseButtons,
431
+ focusCancel,
432
+ allowOutsideClick: () => !import_sweetalert2.default.isLoading(),
433
+ allowEscapeKey: () => !import_sweetalert2.default.isLoading(),
434
+ didOpen: () => {
435
+ if (zIndex == null) return;
436
+ const container = import_sweetalert2.default.getContainer();
437
+ if (container) container.style.zIndex = String(zIndex);
438
+ }
439
+ };
440
+ if (hasInput) {
441
+ swalOptions.html = inputHtml;
442
+ swalOptions.input = "text";
443
+ swalOptions.inputPlaceholder = inputPlaceholder;
444
+ swalOptions.inputValidator = (value) => {
445
+ if (!value?.trim()) return "You need to enter the confirmation text!";
446
+ if (value.trim() !== inputExpectedValue.trim()) {
447
+ return `Please type "${inputExpectedValue}" exactly as shown!`;
448
+ }
449
+ return null;
450
+ };
451
+ } else if (html) {
452
+ swalOptions.html = html;
453
+ } else {
454
+ swalOptions.text = text;
455
+ }
456
+ if (useLoader) {
457
+ swalOptions.showLoaderOnConfirm = true;
458
+ swalOptions.preConfirm = (inputValue) => {
459
+ if (hasInput && inputValue?.trim() !== inputExpectedValue.trim()) {
460
+ import_sweetalert2.default.showValidationMessage(
461
+ `Please type "${inputExpectedValue}" exactly as shown!`
462
+ );
463
+ return false;
464
+ }
465
+ return Promise.resolve().then(() => onConfirm()).catch((error) => {
466
+ import_sweetalert2.default.showValidationMessage(getConfirmErrorMessage(error));
467
+ throw error;
468
+ });
469
+ };
470
+ }
471
+ void import_sweetalert2.default.fire(swalOptions).then((result) => {
472
+ if (result.isConfirmed && !useLoader) {
473
+ void Promise.resolve(onConfirm());
345
474
  }
346
475
  });
347
476
  }
@@ -935,9 +1064,119 @@ function CustomPagination({
935
1064
  );
936
1065
  }
937
1066
 
938
- // src/components/search-filters/ResetFiltersButton.tsx
1067
+ // src/components/search-filters/DropdownFilter.tsx
1068
+ var import_react_select = __toESM(require("react-select"));
939
1069
  var import_react_router_dom2 = require("react-router-dom");
1070
+
1071
+ // src/components/search-filters/dropdownStyles.ts
1072
+ var themeColors = {
1073
+ primary: "#FF7335",
1074
+ primaryHover: "#E65C2E",
1075
+ lightBackground: "#FFF3EB",
1076
+ textColor: "black",
1077
+ white: "white"
1078
+ };
1079
+ var dropdownStyles = (_borderRadius = "5px") => ({
1080
+ control: (provided, state) => ({
1081
+ ...provided,
1082
+ fontSize: "14px",
1083
+ padding: "4px 8px",
1084
+ minWidth: "180px",
1085
+ borderRadius: "5px",
1086
+ cursor: "pointer",
1087
+ borderColor: state.isFocused ? themeColors.primary : "#e0e0e0",
1088
+ boxShadow: state.isFocused ? "0 0 0 2px rgba(255, 115, 53, 0.3)" : "none",
1089
+ "&:hover": {
1090
+ borderColor: themeColors.primary
1091
+ },
1092
+ transition: "border-color 0.2s, box-shadow 0.2s",
1093
+ zIndex: 50
1094
+ }),
1095
+ option: (provided, state) => ({
1096
+ ...provided,
1097
+ fontSize: "14px",
1098
+ backgroundColor: state.isSelected ? themeColors.primary : state.isFocused ? themeColors.lightBackground : themeColors.white,
1099
+ borderRadius: "5px",
1100
+ cursor: "pointer",
1101
+ borderColor: state.isFocused ? themeColors.primary : "#e0e0e0",
1102
+ color: state.isSelected ? themeColors.white : state.isFocused ? themeColors.primary : themeColors.textColor,
1103
+ "&:hover": {
1104
+ backgroundColor: themeColors.lightBackground,
1105
+ color: themeColors.primary
1106
+ },
1107
+ "&:active": {
1108
+ backgroundColor: themeColors.primary,
1109
+ color: themeColors.white
1110
+ },
1111
+ transition: "background-color 0.2s, color 0.2s",
1112
+ zIndex: 50
1113
+ }),
1114
+ singleValue: (provided) => ({
1115
+ ...provided,
1116
+ color: themeColors.textColor,
1117
+ zIndex: 50
1118
+ }),
1119
+ menu: (provided) => ({
1120
+ ...provided,
1121
+ borderRadius: "5px",
1122
+ boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
1123
+ marginTop: "4px",
1124
+ zIndex: 50
1125
+ }),
1126
+ dropdownIndicator: (provided) => ({
1127
+ ...provided,
1128
+ color: themeColors.primary,
1129
+ "&:hover": {
1130
+ color: themeColors.primaryHover
1131
+ },
1132
+ zIndex: 50
1133
+ }),
1134
+ indicatorSeparator: () => ({
1135
+ display: "none"
1136
+ })
1137
+ });
1138
+
1139
+ // src/components/search-filters/DropdownFilter.tsx
940
1140
  var import_jsx_runtime3 = require("react/jsx-runtime");
1141
+ function DropdownFilter({
1142
+ name,
1143
+ valueKey = "id",
1144
+ options,
1145
+ placeholder,
1146
+ borderRadius = "20px",
1147
+ ...otherProps
1148
+ }) {
1149
+ const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
1150
+ const currentValue = searchParams.get(name);
1151
+ const selectedOption = currentValue ? options?.find(
1152
+ (option) => option[valueKey]?.toString() === currentValue
1153
+ ) ?? null : null;
1154
+ const handleChange = (selected) => {
1155
+ setSearchParams((prev) => {
1156
+ if (!selected || selected[valueKey] === "") {
1157
+ prev.delete(name);
1158
+ } else {
1159
+ prev.set(name, String(selected[valueKey]));
1160
+ }
1161
+ return prev;
1162
+ });
1163
+ };
1164
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1165
+ import_react_select.default,
1166
+ {
1167
+ placeholder: placeholder ?? `Select ${name}`,
1168
+ value: selectedOption,
1169
+ onChange: handleChange,
1170
+ options,
1171
+ styles: dropdownStyles(borderRadius),
1172
+ ...otherProps
1173
+ }
1174
+ );
1175
+ }
1176
+
1177
+ // src/components/search-filters/ResetFiltersButton.tsx
1178
+ var import_react_router_dom3 = require("react-router-dom");
1179
+ var import_jsx_runtime4 = require("react/jsx-runtime");
941
1180
  var BASE_STYLES = "inline-flex items-center gap-1.5 px-5 py-3 rounded-md text-sm font-medium transition-colors duration-200 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50";
942
1181
  var VARIANTS = {
943
1182
  primary: "bg-white text-secondary border border-secondary hover:bg-lightGray hover:text-black",
@@ -952,7 +1191,7 @@ function ResetIcon({
952
1191
  size = 16,
953
1192
  className
954
1193
  }) {
955
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1194
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
956
1195
  "svg",
957
1196
  {
958
1197
  width: size,
@@ -966,10 +1205,10 @@ function ResetIcon({
966
1205
  "aria-hidden": "true",
967
1206
  className,
968
1207
  children: [
969
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
970
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 3v5h-5" }),
971
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
972
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 16H3v5" })
1208
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
1209
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 3v5h-5" }),
1210
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
1211
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 16H3v5" })
973
1212
  ]
974
1213
  }
975
1214
  );
@@ -983,13 +1222,13 @@ function ResetFiltersButton({
983
1222
  onReset,
984
1223
  disabled = false
985
1224
  }) {
986
- const [, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
1225
+ const [, setSearchParams] = (0, import_react_router_dom3.useSearchParams)();
987
1226
  const handleReset = () => {
988
1227
  setSearchParams({}, { replace: true });
989
1228
  onReset?.();
990
1229
  };
991
- const resolvedIcon = icon === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ResetIcon, { size: 16 }) : icon;
992
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1230
+ const resolvedIcon = icon === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ResetIcon, { size: 16 }) : icon;
1231
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
993
1232
  "button",
994
1233
  {
995
1234
  type: "button",
@@ -1007,8 +1246,8 @@ function ResetFiltersButton({
1007
1246
  // src/components/search-filters/SearchInput.tsx
1008
1247
  var import_react4 = require("react");
1009
1248
  var import_fi = require("react-icons/fi");
1010
- var import_react_router_dom3 = require("react-router-dom");
1011
- var import_jsx_runtime4 = require("react/jsx-runtime");
1249
+ var import_react_router_dom4 = require("react-router-dom");
1250
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1012
1251
  function SearchInput({
1013
1252
  placeholder = "Search...",
1014
1253
  searchBtn = "",
@@ -1025,7 +1264,7 @@ function SearchInput({
1025
1264
  defaultValue,
1026
1265
  ...props
1027
1266
  }) {
1028
- const [searchParams, setSearchParams] = (0, import_react_router_dom3.useSearchParams)();
1267
+ const [searchParams, setSearchParams] = (0, import_react_router_dom4.useSearchParams)();
1029
1268
  const queryParam = searchParams.get(defaultParam) || defaultValue || "";
1030
1269
  const [inputValue, setInputValue] = (0, import_react4.useState)(queryParam);
1031
1270
  const debounceTimerRef = (0, import_react4.useRef)(null);
@@ -1077,7 +1316,7 @@ function SearchInput({
1077
1316
  }
1078
1317
  };
1079
1318
  }, []);
1080
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1319
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1081
1320
  "form",
1082
1321
  {
1083
1322
  onSubmit: handleSearch,
@@ -1086,7 +1325,7 @@ function SearchInput({
1086
1325
  searchWrapperClass
1087
1326
  ),
1088
1327
  children: [
1089
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1328
+ showIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1090
1329
  "button",
1091
1330
  {
1092
1331
  type: "submit",
@@ -1094,7 +1333,7 @@ function SearchInput({
1094
1333
  "bg-white text-secondary rounded-full flex items-center justify-center w-10 h-10",
1095
1334
  searchBtn
1096
1335
  ),
1097
- children: customIcon ? customIcon : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1336
+ children: customIcon ? customIcon : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1098
1337
  import_fi.FiSearch,
1099
1338
  {
1100
1339
  className: cn("h-5 w-5 text-gray-400", searchIconClassName)
@@ -1102,7 +1341,7 @@ function SearchInput({
1102
1341
  )
1103
1342
  }
1104
1343
  ),
1105
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1344
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1106
1345
  "input",
1107
1346
  {
1108
1347
  value: inputValue,
@@ -1127,9 +1366,9 @@ var import_fa = require("react-icons/fa");
1127
1366
  var import_io5 = require("react-icons/io5");
1128
1367
 
1129
1368
  // src/components/Loader/Loader.tsx
1130
- var import_jsx_runtime5 = require("react/jsx-runtime");
1369
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1131
1370
  var Loader = ({ className, color = "#F54C00", size = "50px", speed = "1s" }) => {
1132
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `loader`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1371
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `loader`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1133
1372
  "div",
1134
1373
  {
1135
1374
  className: `spinner ${className}`,
@@ -1146,7 +1385,7 @@ var Loader = ({ className, color = "#F54C00", size = "50px", speed = "1s" }) =>
1146
1385
  };
1147
1386
 
1148
1387
  // src/components/modal/Modal.tsx
1149
- var import_jsx_runtime6 = require("react/jsx-runtime");
1388
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1150
1389
  function Modal({
1151
1390
  isOpen,
1152
1391
  onClose,
@@ -1187,7 +1426,7 @@ function Modal({
1187
1426
  document.body.style.overflow = "unset";
1188
1427
  };
1189
1428
  }, [isOpen, onClose, closeOnEscape]);
1190
- const modalContent = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_framer_motion.AnimatePresence, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1429
+ const modalContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_framer_motion.AnimatePresence, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1191
1430
  "div",
1192
1431
  {
1193
1432
  className: "fixed inset-0 bg-gray-500 bg-opacity-50 flex justify-center items-center z-1000 p-4",
@@ -1206,7 +1445,7 @@ function Modal({
1206
1445
  zIndex
1207
1446
  },
1208
1447
  children: [
1209
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1448
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1210
1449
  import_framer_motion.motion.div,
1211
1450
  {
1212
1451
  ref: modalRef,
@@ -1227,7 +1466,7 @@ function Modal({
1227
1466
  // Ensure modal doesn't exceed viewport height
1228
1467
  },
1229
1468
  children: [
1230
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1469
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1231
1470
  "div",
1232
1471
  {
1233
1472
  style: {
@@ -1235,43 +1474,43 @@ function Modal({
1235
1474
  },
1236
1475
  className: "sticky top-0 z-10 flex justify-between items-center bg-white text-2xl p-8 pb-4 rounded-t-3xl",
1237
1476
  children: [
1238
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "font-semibold", children: title }),
1239
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center space-x-4", children: [
1240
- onPrint && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1477
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "font-semibold", children: title }),
1478
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center space-x-4", children: [
1479
+ onPrint && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1241
1480
  "button",
1242
1481
  {
1243
1482
  onClick: onPrint,
1244
1483
  className: "flex items-center gap-1 hover:text-gray-300 text-sm border p-1 rounded",
1245
1484
  children: [
1246
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fa.FaPrint, { name: "FaPrint" }),
1247
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Print" })
1485
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fa.FaPrint, { name: "FaPrint" }),
1486
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Print" })
1248
1487
  ]
1249
1488
  }
1250
1489
  ),
1251
- onExport && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1490
+ onExport && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1252
1491
  "button",
1253
1492
  {
1254
1493
  onClick: onExport,
1255
1494
  className: "flex items-center gap-1 hover:text-gray-300 text-sm border p-1 rounded",
1256
1495
  children: [
1257
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fa.FaFileExport, {}),
1258
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Export" })
1496
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_fa.FaFileExport, {}),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Export" })
1259
1498
  ]
1260
1499
  }
1261
1500
  ),
1262
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1501
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1263
1502
  "button",
1264
1503
  {
1265
1504
  onClick: onClose,
1266
1505
  className: "px-2 hover:opacity-70 transition-opacity",
1267
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_io5.IoCloseCircleOutline, { color: "#8898AA", size: 25 })
1506
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_io5.IoCloseCircleOutline, { color: "#8898AA", size: 25 })
1268
1507
  }
1269
1508
  )
1270
1509
  ] })
1271
1510
  ]
1272
1511
  }
1273
1512
  ),
1274
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1513
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1275
1514
  "div",
1276
1515
  {
1277
1516
  className: cn(
@@ -1281,7 +1520,7 @@ function Modal({
1281
1520
  children
1282
1521
  }
1283
1522
  ),
1284
- footer && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1523
+ footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1285
1524
  "div",
1286
1525
  {
1287
1526
  className: cn("sticky bottom-0 flex justify-end p-4 space-x-4 border-t bg-white ", footerClassName),
@@ -1295,7 +1534,7 @@ function Modal({
1295
1534
  ]
1296
1535
  }
1297
1536
  ),
1298
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1537
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1299
1538
  "div",
1300
1539
  {
1301
1540
  className: "fixed inset-0 flex items-center justify-center bg-gray-200/60",
@@ -1304,7 +1543,7 @@ function Modal({
1304
1543
  "aria-live": "polite",
1305
1544
  role: "status",
1306
1545
  onClick: (e) => e.stopPropagation(),
1307
- children: customLoader ? customLoader : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Loader, { size: "48px" })
1546
+ children: customLoader ? customLoader : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader, { size: "48px" })
1308
1547
  }
1309
1548
  )
1310
1549
  ]
@@ -1320,7 +1559,7 @@ function Modal({
1320
1559
  }
1321
1560
 
1322
1561
  // src/components/skeleton/CardSkeleton.tsx
1323
- var import_jsx_runtime7 = require("react/jsx-runtime");
1562
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1324
1563
  var DEFAULT_LINE_WIDTHS = ["w-32", "w-48"];
1325
1564
  function shouldShowAvatar(variant, showAvatar) {
1326
1565
  return showAvatar ?? variant === "profile";
@@ -1329,7 +1568,7 @@ function shouldShowImage(variant, showImage) {
1329
1568
  return showImage ?? variant === "image";
1330
1569
  }
1331
1570
  function AvatarSkeleton({ className }) {
1332
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1571
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1333
1572
  "svg",
1334
1573
  {
1335
1574
  className: cn("w-10 h-10 text-gray-200 dark:text-gray-700", className),
@@ -1337,7 +1576,7 @@ function AvatarSkeleton({ className }) {
1337
1576
  xmlns: "http://www.w3.org/2000/svg",
1338
1577
  fill: "currentColor",
1339
1578
  viewBox: "0 0 20 20",
1340
- 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" })
1579
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.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" })
1341
1580
  }
1342
1581
  );
1343
1582
  }
@@ -1346,7 +1585,7 @@ function SkeletonBlock({
1346
1585
  className,
1347
1586
  isFirst
1348
1587
  }) {
1349
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1588
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1350
1589
  "div",
1351
1590
  {
1352
1591
  className: cn(
@@ -1378,14 +1617,14 @@ function CardSkeleton({
1378
1617
  const skeletons = Array.from({ length: Math.max(1, count) }, (_, index) => {
1379
1618
  const renderAvatar = shouldShowAvatar(variant, showAvatar);
1380
1619
  const renderImage = shouldShowImage(variant, showImage);
1381
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1620
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1382
1621
  "div",
1383
1622
  {
1384
1623
  className: cn("animate-pulse md:p-6 dark:border-gray-700", className),
1385
1624
  style: { animationDuration, ...style },
1386
1625
  ...props,
1387
1626
  children: [
1388
- renderImage ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1627
+ renderImage ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1389
1628
  "div",
1390
1629
  {
1391
1630
  className: cn(
@@ -1394,9 +1633,9 @@ function CardSkeleton({
1394
1633
  )
1395
1634
  }
1396
1635
  ) : null,
1397
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
1398
- renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
1399
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1636
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("flex items-center mt-4 gap-4", contentClassName), children: [
1637
+ renderAvatar ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarSkeleton, { className: avatarClassName }) : null,
1638
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: Array.from({ length: Math.max(1, lines) }, (_2, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1400
1639
  SkeletonBlock,
1401
1640
  {
1402
1641
  widthClass: lineWidths[lineIndex] ?? lineWidths[lineWidths.length - 1] ?? DEFAULT_LINE_WIDTHS[1],
@@ -1406,19 +1645,19 @@ function CardSkeleton({
1406
1645
  lineIndex
1407
1646
  )) })
1408
1647
  ] }),
1409
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sr-only", children: srLabel })
1648
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sr-only", children: srLabel })
1410
1649
  ]
1411
1650
  },
1412
1651
  index
1413
1652
  );
1414
1653
  });
1415
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: skeletons });
1654
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: skeletons });
1416
1655
  }
1417
1656
 
1418
1657
  // src/components/tooltip/ToolTip.tsx
1419
1658
  var import_react6 = require("react");
1420
1659
  var import_react_tooltip = require("react-tooltip");
1421
- var import_jsx_runtime8 = require("react/jsx-runtime");
1660
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1422
1661
  var defaultTooltipStyle = {
1423
1662
  color: "#fff",
1424
1663
  borderRadius: "5px",
@@ -1445,10 +1684,10 @@ function ToolTip({
1445
1684
  const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
1446
1685
  const tooltipText = String(text ?? "");
1447
1686
  if (disabled || !tooltipText) {
1448
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className, children });
1687
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className, children });
1449
1688
  }
1450
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1451
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1689
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1690
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1452
1691
  "span",
1453
1692
  {
1454
1693
  className,
@@ -1458,7 +1697,7 @@ function ToolTip({
1458
1697
  children
1459
1698
  }
1460
1699
  ),
1461
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1700
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1462
1701
  import_react_tooltip.Tooltip,
1463
1702
  {
1464
1703
  id: tooltipId,
@@ -1474,7 +1713,7 @@ function ToolTip({
1474
1713
  }
1475
1714
 
1476
1715
  // src/components/tooltip/TooltipText.tsx
1477
- var import_jsx_runtime9 = require("react/jsx-runtime");
1716
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1478
1717
  function TooltipText({
1479
1718
  text = "",
1480
1719
  maxLength = 20,
@@ -1494,7 +1733,7 @@ function TooltipText({
1494
1733
  const displayText = truncateText(fullText, maxLength);
1495
1734
  const isTruncated = displayText !== fullText;
1496
1735
  const tooltipDisabled = !showTooltip || !hasValue || tooltipWhenTruncatedOnly && !isTruncated;
1497
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1736
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1498
1737
  ToolTip,
1499
1738
  {
1500
1739
  text: fullText,
@@ -1506,7 +1745,7 @@ function TooltipText({
1506
1745
  tooltipStyle,
1507
1746
  wrapperTabIndex: tooltipDisabled ? void 0 : 0,
1508
1747
  disabled: tooltipDisabled,
1509
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
1748
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cn("inline-block max-w-full align-bottom", textClassName), children: displayText })
1510
1749
  }
1511
1750
  );
1512
1751
  }
@@ -1514,9 +1753,9 @@ function TooltipText({
1514
1753
  // src/components/cell-editor/CustomCellEditor.tsx
1515
1754
  var import_react7 = require("react");
1516
1755
  var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
1517
- var import_jsx_runtime10 = require("react/jsx-runtime");
1756
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1518
1757
  function ButtonSpinner() {
1519
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1758
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1520
1759
  "svg",
1521
1760
  {
1522
1761
  className: "animate-spin",
@@ -1526,7 +1765,7 @@ function ButtonSpinner() {
1526
1765
  fill: "none",
1527
1766
  "aria-hidden": true,
1528
1767
  children: [
1529
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1768
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1530
1769
  "circle",
1531
1770
  {
1532
1771
  cx: "12",
@@ -1537,7 +1776,7 @@ function ButtonSpinner() {
1537
1776
  strokeOpacity: "0.25"
1538
1777
  }
1539
1778
  ),
1540
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1779
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1541
1780
  "path",
1542
1781
  {
1543
1782
  d: "M12 2a10 10 0 0 1 10 10",
@@ -1673,7 +1912,7 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1673
1912
  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";
1674
1913
  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";
1675
1914
  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";
1676
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1915
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1677
1916
  "div",
1678
1917
  {
1679
1918
  className: cn(
@@ -1682,7 +1921,7 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1682
1921
  ),
1683
1922
  style: containerStyle,
1684
1923
  children: [
1685
- isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1924
+ isDropdown ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1686
1925
  "select",
1687
1926
  {
1688
1927
  ref: selectRef,
@@ -1692,11 +1931,11 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1692
1931
  className: inputClassName ?? defaultInputClass,
1693
1932
  disabled: isLoading,
1694
1933
  children: [
1695
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
1696
- normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1934
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", disabled: true, children: "Select option..." }),
1935
+ normalizedOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1697
1936
  ]
1698
1937
  }
1699
- ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1938
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1700
1939
  "input",
1701
1940
  {
1702
1941
  ref: inputRef,
@@ -1709,7 +1948,7 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1709
1948
  disabled: isLoading
1710
1949
  }
1711
1950
  ),
1712
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1951
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1713
1952
  "button",
1714
1953
  {
1715
1954
  type: "button",
@@ -1718,10 +1957,10 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1718
1957
  className: saveButtonClassName ?? (saveButtonStyle ? void 0 : defaultSaveBtnClass),
1719
1958
  style: saveButtonStyle,
1720
1959
  title: "Save (Enter)",
1721
- children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
1960
+ children: isLoading ? loadingIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ButtonSpinner, {}) : saveButtonContent ?? "Save"
1722
1961
  }
1723
1962
  ),
1724
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1963
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1725
1964
  "button",
1726
1965
  {
1727
1966
  type: "button",
@@ -1744,6 +1983,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
1744
1983
  CardSkeleton,
1745
1984
  CustomCellEditor,
1746
1985
  CustomPagination,
1986
+ DropdownFilter,
1747
1987
  EztrakTabs,
1748
1988
  Loader,
1749
1989
  Modal,
@@ -1753,6 +1993,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
1753
1993
  TableLayoutToolbarControls,
1754
1994
  ToolTip,
1755
1995
  TooltipText,
1996
+ USER_STATE_STORAGE_KEY,
1756
1997
  capitalizeText,
1757
1998
  checkIfExistsInArray,
1758
1999
  cn,
@@ -1760,21 +2001,32 @@ CustomCellEditor.displayName = "CustomCellEditor";
1760
2001
  convertCommaDataToArray,
1761
2002
  currencyFormatter,
1762
2003
  deserializeJson,
2004
+ dropdownStyles,
1763
2005
  flattenTableData,
1764
2006
  formatDate,
1765
2007
  formatDateTime,
1766
2008
  formatNumber,
1767
2009
  formatValidationErrorsHtml,
2010
+ get,
1768
2011
  getApiError,
1769
2012
  getErrorMessages,
1770
2013
  getFieldsByCategory,
1771
2014
  getFieldsByInputType,
1772
2015
  getFieldsByName,
2016
+ getItem,
2017
+ getItemFromLocalStorage,
1773
2018
  handleApiError,
1774
2019
  isEmpty,
2020
+ loadUserState,
1775
2021
  normalizeApiListItems,
1776
2022
  parseCurrencyValueToNumber,
1777
2023
  removeByPropertyValues,
2024
+ removeItem,
2025
+ saveItemLocalStorage,
2026
+ saveUserState,
2027
+ set,
2028
+ setItem,
2029
+ storeItemInLocalStorage,
1778
2030
  toDateInputValue,
1779
2031
  toLowerCaseText,
1780
2032
  truncateFileName,