@eztrak/shared 0.13.0 → 0.13.1
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-HGLO5LDS.mjs +1 -0
- package/dist/chunk-HGLO5LDS.mjs.map +1 -0
- package/dist/{chunk-4P22KKIJ.mjs → chunk-TN7TPFJ3.mjs} +43 -17
- package/dist/chunk-TN7TPFJ3.mjs.map +1 -0
- package/dist/{chunk-BMX2RODZ.mjs → chunk-YWS7JMII.mjs} +54 -1
- package/dist/chunk-YWS7JMII.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +79 -25
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/index.js +48 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -15
- package/dist/utils/index.mjs +12 -13
- package/package.json +1 -1
- package/dist/chunk-4P22KKIJ.mjs.map +0 -1
- package/dist/chunk-7PPCJV2M.mjs +0 -56
- package/dist/chunk-7PPCJV2M.mjs.map +0 -1
- package/dist/chunk-BMX2RODZ.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1066,6 +1066,7 @@ function CustomPagination({
|
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
// src/components/search-filters/DropdownFilter.tsx
|
|
1069
|
+
var import_react4 = require("react");
|
|
1069
1070
|
var import_react_select = __toESM(require("react-select"));
|
|
1070
1071
|
var import_react_router_dom2 = require("react-router-dom");
|
|
1071
1072
|
|
|
@@ -1150,22 +1151,44 @@ function DropdownFilter({
|
|
|
1150
1151
|
isSearchable = true,
|
|
1151
1152
|
isDisabled = false,
|
|
1152
1153
|
isLoading = false,
|
|
1154
|
+
saveToLocalStorage = false,
|
|
1153
1155
|
...otherProps
|
|
1154
1156
|
}) {
|
|
1155
1157
|
const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
|
|
1158
|
+
const hasRestoredFromStorage = (0, import_react4.useRef)(false);
|
|
1159
|
+
(0, import_react4.useEffect)(() => {
|
|
1160
|
+
if (!saveToLocalStorage || hasRestoredFromStorage.current) return;
|
|
1161
|
+
hasRestoredFromStorage.current = true;
|
|
1162
|
+
if (searchParams.get(name)) return;
|
|
1163
|
+
const stored = getItemFromLocalStorage(name);
|
|
1164
|
+
if (stored != null && stored !== "") {
|
|
1165
|
+
setSearchParams((prev) => {
|
|
1166
|
+
prev.set(name, String(stored));
|
|
1167
|
+
return prev;
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
}, [saveToLocalStorage, name, searchParams, setSearchParams]);
|
|
1156
1171
|
const currentValue = searchParams.get(name);
|
|
1157
1172
|
const selectedOption = currentValue ? options?.find(
|
|
1158
1173
|
(option) => option[valueKey]?.toString() === currentValue
|
|
1159
1174
|
) ?? null : null;
|
|
1160
1175
|
const handleChange = (selected) => {
|
|
1176
|
+
const selectedValue = selected && selected[valueKey] !== "" ? String(selected[valueKey]) : null;
|
|
1161
1177
|
setSearchParams((prev) => {
|
|
1162
|
-
if (!
|
|
1178
|
+
if (!selectedValue) {
|
|
1163
1179
|
prev.delete(name);
|
|
1164
1180
|
} else {
|
|
1165
|
-
prev.set(name,
|
|
1181
|
+
prev.set(name, selectedValue);
|
|
1166
1182
|
}
|
|
1167
1183
|
return prev;
|
|
1168
1184
|
});
|
|
1185
|
+
if (saveToLocalStorage) {
|
|
1186
|
+
if (selectedValue) {
|
|
1187
|
+
storeItemInLocalStorage(name, selectedValue);
|
|
1188
|
+
} else {
|
|
1189
|
+
removeItem(name);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1169
1192
|
};
|
|
1170
1193
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cn(className), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1171
1194
|
import_react_select.default,
|
|
@@ -1256,7 +1279,7 @@ function ResetFiltersButton({
|
|
|
1256
1279
|
}
|
|
1257
1280
|
|
|
1258
1281
|
// src/components/search-filters/SearchInput.tsx
|
|
1259
|
-
var
|
|
1282
|
+
var import_react5 = require("react");
|
|
1260
1283
|
var import_fi = require("react-icons/fi");
|
|
1261
1284
|
var import_react_router_dom4 = require("react-router-dom");
|
|
1262
1285
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -1278,8 +1301,8 @@ function SearchInput({
|
|
|
1278
1301
|
}) {
|
|
1279
1302
|
const [searchParams, setSearchParams] = (0, import_react_router_dom4.useSearchParams)();
|
|
1280
1303
|
const queryParam = searchParams.get(defaultParam) || defaultValue || "";
|
|
1281
|
-
const [inputValue, setInputValue] = (0,
|
|
1282
|
-
const debounceTimerRef = (0,
|
|
1304
|
+
const [inputValue, setInputValue] = (0, import_react5.useState)(queryParam);
|
|
1305
|
+
const debounceTimerRef = (0, import_react5.useRef)(null);
|
|
1283
1306
|
const updateSearchParams = (searchQuery) => {
|
|
1284
1307
|
if (searchQuery?.trim()) {
|
|
1285
1308
|
setSearchParams((prev) => {
|
|
@@ -1318,10 +1341,10 @@ function SearchInput({
|
|
|
1318
1341
|
updateSearchParams("");
|
|
1319
1342
|
}
|
|
1320
1343
|
};
|
|
1321
|
-
(0,
|
|
1344
|
+
(0, import_react5.useEffect)(() => {
|
|
1322
1345
|
setInputValue(queryParam);
|
|
1323
1346
|
}, [queryParam]);
|
|
1324
|
-
(0,
|
|
1347
|
+
(0, import_react5.useEffect)(() => {
|
|
1325
1348
|
return () => {
|
|
1326
1349
|
if (debounceTimerRef.current) {
|
|
1327
1350
|
clearTimeout(debounceTimerRef.current);
|
|
@@ -1372,7 +1395,7 @@ function SearchInput({
|
|
|
1372
1395
|
|
|
1373
1396
|
// src/components/modal/Modal.tsx
|
|
1374
1397
|
var import_framer_motion = require("framer-motion");
|
|
1375
|
-
var
|
|
1398
|
+
var import_react6 = require("react");
|
|
1376
1399
|
var import_react_dom = require("react-dom");
|
|
1377
1400
|
var import_fa = require("react-icons/fa");
|
|
1378
1401
|
var import_io5 = require("react-icons/io5");
|
|
@@ -1417,13 +1440,13 @@ function Modal({
|
|
|
1417
1440
|
customLoader = null,
|
|
1418
1441
|
footerClassName
|
|
1419
1442
|
}) {
|
|
1420
|
-
const modalRef = (0,
|
|
1443
|
+
const modalRef = (0, import_react6.useRef)(null);
|
|
1421
1444
|
const handleBackdropClick = (e) => {
|
|
1422
1445
|
if (e.target === e.currentTarget && closeOnBackdropClick) {
|
|
1423
1446
|
onClose();
|
|
1424
1447
|
}
|
|
1425
1448
|
};
|
|
1426
|
-
(0,
|
|
1449
|
+
(0, import_react6.useEffect)(() => {
|
|
1427
1450
|
const handleEscape = (e) => {
|
|
1428
1451
|
if (e.key === "Escape" && isOpen && closeOnEscape) {
|
|
1429
1452
|
onClose();
|
|
@@ -1667,7 +1690,7 @@ function CardSkeleton({
|
|
|
1667
1690
|
}
|
|
1668
1691
|
|
|
1669
1692
|
// src/components/tooltip/ToolTip.tsx
|
|
1670
|
-
var
|
|
1693
|
+
var import_react7 = require("react");
|
|
1671
1694
|
var import_react_tooltip = require("react-tooltip");
|
|
1672
1695
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1673
1696
|
var defaultTooltipStyle = {
|
|
@@ -1692,7 +1715,7 @@ function ToolTip({
|
|
|
1692
1715
|
disabled = false,
|
|
1693
1716
|
children
|
|
1694
1717
|
}) {
|
|
1695
|
-
const generatedId = (0,
|
|
1718
|
+
const generatedId = (0, import_react7.useId)();
|
|
1696
1719
|
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1697
1720
|
const tooltipText = String(text ?? "");
|
|
1698
1721
|
if (disabled || !tooltipText) {
|
|
@@ -1763,7 +1786,7 @@ function TooltipText({
|
|
|
1763
1786
|
}
|
|
1764
1787
|
|
|
1765
1788
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1766
|
-
var
|
|
1789
|
+
var import_react8 = require("react");
|
|
1767
1790
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1768
1791
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1769
1792
|
function ButtonSpinner() {
|
|
@@ -1810,7 +1833,7 @@ function normalizeInitialValue(initialValue, inputType) {
|
|
|
1810
1833
|
}
|
|
1811
1834
|
return initialValue;
|
|
1812
1835
|
}
|
|
1813
|
-
var CustomCellEditor = (0,
|
|
1836
|
+
var CustomCellEditor = (0, import_react8.forwardRef)(
|
|
1814
1837
|
({
|
|
1815
1838
|
value: initialValue,
|
|
1816
1839
|
name,
|
|
@@ -1835,11 +1858,11 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
|
|
|
1835
1858
|
cancelButtonClassName
|
|
1836
1859
|
}, ref) => {
|
|
1837
1860
|
const normalizedInitial = normalizeInitialValue(initialValue, inputType);
|
|
1838
|
-
const [value, setValue] = (0,
|
|
1839
|
-
const [isLoading, setIsLoading] = (0,
|
|
1840
|
-
const inputRef = (0,
|
|
1841
|
-
const selectRef = (0,
|
|
1842
|
-
const normalizedOptions = (0,
|
|
1861
|
+
const [value, setValue] = (0, import_react8.useState)(normalizedInitial);
|
|
1862
|
+
const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
|
|
1863
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
1864
|
+
const selectRef = (0, import_react8.useRef)(null);
|
|
1865
|
+
const normalizedOptions = (0, import_react8.useMemo)(() => {
|
|
1843
1866
|
if (customOptions && customOptions.length > 0) {
|
|
1844
1867
|
return customOptions.map((opt) => ({
|
|
1845
1868
|
value: String(opt[valueKey] ?? ""),
|
|
@@ -1849,13 +1872,13 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
|
|
|
1849
1872
|
return dropdownOptions;
|
|
1850
1873
|
}, [customOptions, dropdownOptions, valueKey, labelKey]);
|
|
1851
1874
|
const isDropdown = inputType === "dropdown" || normalizedOptions.length > 0;
|
|
1852
|
-
(0,
|
|
1875
|
+
(0, import_react8.useImperativeHandle)(ref, () => ({
|
|
1853
1876
|
getValue: () => value,
|
|
1854
1877
|
isCancelBeforeStart: () => false,
|
|
1855
1878
|
isCancelAfterEnd: () => false,
|
|
1856
1879
|
isPopup: () => true
|
|
1857
1880
|
}));
|
|
1858
|
-
(0,
|
|
1881
|
+
(0, import_react8.useEffect)(() => {
|
|
1859
1882
|
if (isDropdown) {
|
|
1860
1883
|
selectRef.current?.focus();
|
|
1861
1884
|
return;
|
|
@@ -1992,8 +2015,8 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
|
|
|
1992
2015
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
1993
2016
|
|
|
1994
2017
|
// src/components/popup-cell-renderer/PopupCellRenderer.tsx
|
|
1995
|
-
var
|
|
1996
|
-
var
|
|
2018
|
+
var import_react9 = require("react");
|
|
2019
|
+
var import_react10 = __toESM(require("@tippyjs/react"));
|
|
1997
2020
|
var import_bi = require("react-icons/bi");
|
|
1998
2021
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1999
2022
|
function PopupCellRenderer({
|
|
@@ -2007,7 +2030,7 @@ function PopupCellRenderer({
|
|
|
2007
2030
|
placement = "bottom-end",
|
|
2008
2031
|
tippyProps
|
|
2009
2032
|
}) {
|
|
2010
|
-
const [visible, setVisible] = (0,
|
|
2033
|
+
const [visible, setVisible] = (0, import_react9.useState)(false);
|
|
2011
2034
|
const show = () => setVisible(true);
|
|
2012
2035
|
const hide = () => setVisible(false);
|
|
2013
2036
|
const rowData = params?.data;
|
|
@@ -2017,7 +2040,7 @@ function PopupCellRenderer({
|
|
|
2017
2040
|
};
|
|
2018
2041
|
const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
|
|
2019
2042
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2020
|
-
|
|
2043
|
+
import_react10.default,
|
|
2021
2044
|
{
|
|
2022
2045
|
content,
|
|
2023
2046
|
visible,
|