@dmsi/wedgekit-react 0.0.643 → 0.0.645
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-XX5GVIPZ.js → chunk-3MV3KMQH.js} +2 -2
- package/dist/{chunk-V7GPM6Z3.js → chunk-3PBA2EZ5.js} +1 -1
- package/dist/{chunk-3R3AY5MT.js → chunk-B3T7KBDA.js} +1 -1
- package/dist/{chunk-FIOXWZWU.js → chunk-ECYXZZWC.js} +1 -1
- package/dist/{chunk-RQMOWYB7.js → chunk-EXCAOI2L.js} +3 -3
- package/dist/{chunk-MQB6BSRX.js → chunk-FCGPQNS2.js} +1 -1
- package/dist/{chunk-SJ3SULQB.js → chunk-FJXWYGB7.js} +7 -7
- package/dist/{chunk-QJZ3XHNH.js → chunk-HCHKYUNQ.js} +19 -5
- package/dist/{chunk-5JHKFK73.js → chunk-HIGNJAQA.js} +2 -2
- package/dist/{chunk-IATOG76G.js → chunk-ISRG77J6.js} +1 -1
- package/dist/{chunk-UB3GEENN.js → chunk-OZEKRO4L.js} +1 -1
- package/dist/{chunk-LGX34HML.js → chunk-Q4AANHJY.js} +1 -1
- package/dist/{chunk-PS7MBNUT.js → chunk-REC2XOPI.js} +1 -1
- package/dist/{chunk-ARWHCWG7.js → chunk-XT4BQXSX.js} +1 -1
- package/dist/{chunk-YR4ZO2XL.js → chunk-ZSRTAMSW.js} +56 -23
- package/dist/components/CalendarRange.cjs +202 -180
- package/dist/components/CalendarRange.js +15 -15
- package/dist/components/CompactImagesPreview.cjs +6 -3
- package/dist/components/CompactImagesPreview.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +202 -180
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +15 -15
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +202 -180
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +15 -15
- package/dist/components/DataGrid/PinnedColumns.cjs +202 -180
- package/dist/components/DataGrid/PinnedColumns.js +15 -15
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +202 -180
- package/dist/components/DataGrid/TableBody/LoadingCell.js +15 -15
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +202 -180
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +15 -15
- package/dist/components/DataGrid/TableBody/index.cjs +202 -180
- package/dist/components/DataGrid/TableBody/index.js +15 -15
- package/dist/components/DataGrid/index.cjs +203 -181
- package/dist/components/DataGrid/index.js +15 -15
- package/dist/components/DataGrid/utils.cjs +202 -180
- package/dist/components/DataGrid/utils.js +15 -15
- package/dist/components/DataGridCell.cjs +61 -58
- package/dist/components/DataGridCell.js +6 -6
- package/dist/components/DateInput.cjs +195 -173
- package/dist/components/DateInput.js +15 -15
- package/dist/components/DateRangeInput.cjs +208 -186
- package/dist/components/DateRangeInput.js +15 -15
- package/dist/components/Menu.cjs +15 -12
- package/dist/components/Menu.js +4 -4
- package/dist/components/MenuOption.cjs +8 -5
- package/dist/components/MenuOption.js +3 -3
- package/dist/components/MobileDataGrid/ColumnList.js +4 -4
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +206 -184
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +15 -15
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +206 -184
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +15 -15
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +3 -3
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +19 -16
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +6 -6
- package/dist/components/MobileDataGrid/index.cjs +215 -193
- package/dist/components/MobileDataGrid/index.js +15 -15
- package/dist/components/Modal.cjs +15 -12
- package/dist/components/Modal.js +3 -3
- package/dist/components/NestedMenu.cjs +11 -8
- package/dist/components/NestedMenu.js +3 -3
- package/dist/components/PDFViewer/index.cjs +31 -28
- package/dist/components/PDFViewer/index.js +3 -3
- package/dist/components/ProductImagePreview/index.cjs +18 -15
- package/dist/components/ProductImagePreview/index.js +3 -3
- package/dist/components/ProjectBar.cjs +3 -0
- package/dist/components/ProjectBar.js +2 -2
- package/dist/components/Time.js +1 -1
- package/dist/components/index.cjs +263 -241
- package/dist/components/index.js +15 -15
- package/dist/components/useMenuSystem.cjs +22 -19
- package/dist/components/useMenuSystem.js +3 -3
- package/dist/hooks/index.cjs +76 -26
- package/dist/hooks/index.js +4 -2
- package/dist/utils/index.cjs +21 -5
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -149,7 +149,7 @@ var CSS = /* @__PURE__ */ Object.freeze({
|
|
|
149
149
|
|
|
150
150
|
// src/components/DataGridCell.tsx
|
|
151
151
|
var import_clsx9 = __toESM(require("clsx"), 1);
|
|
152
|
-
var
|
|
152
|
+
var import_react12 = require("react");
|
|
153
153
|
|
|
154
154
|
// src/classNames.ts
|
|
155
155
|
var import_clsx = __toESM(require("clsx"), 1);
|
|
@@ -293,7 +293,7 @@ var gapUsingContainerPadding = (0, import_clsx.default)(
|
|
|
293
293
|
|
|
294
294
|
// src/components/MenuOption.tsx
|
|
295
295
|
var import_clsx6 = __toESM(require("clsx"), 1);
|
|
296
|
-
var
|
|
296
|
+
var import_react7 = require("react");
|
|
297
297
|
|
|
298
298
|
// src/components/Label.tsx
|
|
299
299
|
var import_clsx2 = __toESM(require("clsx"), 1);
|
|
@@ -627,11 +627,24 @@ function formatDate(date) {
|
|
|
627
627
|
|
|
628
628
|
// src/utils/mergeObjectArrays.ts
|
|
629
629
|
function mergeObjectArrays(arr1, arr2) {
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
630
|
+
const arr2Map = /* @__PURE__ */ new Map();
|
|
631
|
+
for (const item of arr2) {
|
|
632
|
+
const id = item.id;
|
|
633
|
+
if (id !== void 0) {
|
|
634
|
+
arr2Map.set(id, item);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return arr1.map((item1) => {
|
|
638
|
+
const id = item1.id;
|
|
639
|
+
if (id !== void 0 && arr2Map.has(id)) {
|
|
640
|
+
const item2 = arr2Map.get(id);
|
|
641
|
+
const meta1 = item1.meta;
|
|
642
|
+
const meta2 = item2.meta;
|
|
643
|
+
const mergedMeta = meta1 && meta2 && typeof meta1 === "object" && typeof meta2 === "object" ? __spreadValues(__spreadValues({}, meta1), meta2) : meta2 != null ? meta2 : meta1;
|
|
644
|
+
return __spreadProps(__spreadValues(__spreadValues({}, item1), item2), { meta: mergedMeta });
|
|
645
|
+
}
|
|
646
|
+
return item1;
|
|
647
|
+
});
|
|
635
648
|
}
|
|
636
649
|
|
|
637
650
|
// src/utils/index.ts
|
|
@@ -667,52 +680,58 @@ var getLocalStorageKeyWithPrefix = (key) => `${LocalStoragePrefix}__${key}`;
|
|
|
667
680
|
function useTableLayout(initialColumns, key, autosync = true) {
|
|
668
681
|
const [columns, setColumns] = (0, import_react5.useState)(initialColumns);
|
|
669
682
|
const [isReady, setIsReady] = (0, import_react5.useState)(false);
|
|
670
|
-
const
|
|
683
|
+
const isReadyRef = (0, import_react5.useRef)(false);
|
|
684
|
+
const keyRef = (0, import_react5.useRef)(key);
|
|
685
|
+
(0, import_react5.useEffect)(() => {
|
|
686
|
+
isReadyRef.current = isReady;
|
|
687
|
+
keyRef.current = key;
|
|
688
|
+
}, [isReady, key]);
|
|
671
689
|
const handleSaveLayout = (0, import_react5.useCallback)(
|
|
672
690
|
(setter, _internal) => {
|
|
673
|
-
if (!
|
|
691
|
+
if (!isReadyRef.current && !_internal || !keyRef.current) return;
|
|
674
692
|
setColumns((prevColumns) => {
|
|
675
693
|
const newColumns = typeof setter === "function" ? setter(prevColumns) : setter;
|
|
676
|
-
if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal)
|
|
694
|
+
if (JSON.stringify(newColumns) === JSON.stringify(prevColumns) && !_internal) {
|
|
677
695
|
return prevColumns;
|
|
696
|
+
}
|
|
678
697
|
localStorage.setItem(
|
|
679
|
-
getLocalStorageKeyWithPrefix(`${
|
|
698
|
+
getLocalStorageKeyWithPrefix(`${keyRef.current}-tableLayout`),
|
|
680
699
|
JSON.stringify(newColumns)
|
|
681
700
|
);
|
|
682
701
|
return newColumns;
|
|
683
702
|
});
|
|
684
703
|
},
|
|
685
|
-
[
|
|
704
|
+
[]
|
|
686
705
|
);
|
|
687
706
|
(0, import_react5.useEffect)(() => {
|
|
688
707
|
if (!autosync) return;
|
|
689
|
-
if (!key)
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
`useTableLayout should only be called once per component render cycle.
|
|
693
|
-
${renderCountRef.current} Renders detected.
|
|
694
|
-
Check dependency stability`
|
|
695
|
-
);
|
|
708
|
+
if (!key) {
|
|
709
|
+
setIsReady(true);
|
|
710
|
+
return;
|
|
696
711
|
}
|
|
697
|
-
renderCountRef.current += 1;
|
|
698
712
|
const savedLayout = localStorage.getItem(
|
|
699
713
|
getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
|
|
700
714
|
);
|
|
701
715
|
if (savedLayout) {
|
|
702
|
-
|
|
716
|
+
setColumns(
|
|
703
717
|
mergeObjectArrays(
|
|
704
718
|
initialColumns,
|
|
705
719
|
JSON.parse(savedLayout)
|
|
706
|
-
)
|
|
707
|
-
true
|
|
720
|
+
)
|
|
708
721
|
);
|
|
722
|
+
} else {
|
|
723
|
+
localStorage.setItem(
|
|
724
|
+
getLocalStorageKeyWithPrefix(`${key}-tableLayout`),
|
|
725
|
+
JSON.stringify(initialColumns)
|
|
726
|
+
);
|
|
727
|
+
setColumns((prev) => {
|
|
728
|
+
if (JSON.stringify(initialColumns) === JSON.stringify(prev))
|
|
729
|
+
return prev;
|
|
730
|
+
return initialColumns;
|
|
731
|
+
});
|
|
709
732
|
}
|
|
710
|
-
if (!savedLayout) handleSaveLayout(initialColumns, true);
|
|
711
733
|
setIsReady(true);
|
|
712
|
-
|
|
713
|
-
renderCountRef.current = 0;
|
|
714
|
-
};
|
|
715
|
-
}, [handleSaveLayout, initialColumns, key, autosync]);
|
|
734
|
+
}, [initialColumns, key, autosync]);
|
|
716
735
|
const getSavedLayout = (0, import_react5.useCallback)(() => {
|
|
717
736
|
const savedLayout = localStorage.getItem(
|
|
718
737
|
getLocalStorageKeyWithPrefix(`${key}-tableLayout`)
|
|
@@ -724,6 +743,9 @@ function useTableLayout(initialColumns, key, autosync = true) {
|
|
|
724
743
|
return { columns, setColumns: handleSaveLayout, isReady, getSavedLayout };
|
|
725
744
|
}
|
|
726
745
|
|
|
746
|
+
// src/hooks/useEditCell.tsx
|
|
747
|
+
var import_react6 = require("react");
|
|
748
|
+
|
|
727
749
|
// src/components/Caption.tsx
|
|
728
750
|
var import_clsx5 = __toESM(require("clsx"), 1);
|
|
729
751
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -875,12 +897,12 @@ var MenuOption = ({
|
|
|
875
897
|
onMouseMove,
|
|
876
898
|
small = false
|
|
877
899
|
}) => {
|
|
878
|
-
const uniqueId = (0,
|
|
879
|
-
const internalRef = (0,
|
|
900
|
+
const uniqueId = (0, import_react7.useId)();
|
|
901
|
+
const internalRef = (0, import_react7.useRef)(null);
|
|
880
902
|
const actualRef = ref || internalRef;
|
|
881
|
-
const menuId = (0,
|
|
903
|
+
const menuId = (0, import_react7.useRef)(`menu-${uniqueId}`);
|
|
882
904
|
const isMobile = useMatchesMobile();
|
|
883
|
-
const [isSubMenuHovered, setIsSubMenuHovered] = (0,
|
|
905
|
+
const [isSubMenuHovered, setIsSubMenuHovered] = (0, import_react7.useState)(false);
|
|
884
906
|
const handleMouseEnter = () => {
|
|
885
907
|
if (subMenu && onSubMenuHover && !disabled) {
|
|
886
908
|
onSubMenuHover(menuId.current, subMenuLevel);
|
|
@@ -1040,27 +1062,27 @@ function highlightMatch(text, searchValue) {
|
|
|
1040
1062
|
|
|
1041
1063
|
// src/components/Menu.tsx
|
|
1042
1064
|
var import_clsx7 = __toESM(require("clsx"), 1);
|
|
1043
|
-
var
|
|
1065
|
+
var import_react9 = require("react");
|
|
1044
1066
|
var import_react_dom = require("react-dom");
|
|
1045
1067
|
|
|
1046
1068
|
// src/components/useMenuSystem.tsx
|
|
1047
|
-
var
|
|
1069
|
+
var import_react8 = require("react");
|
|
1048
1070
|
function useSubMenuSystem(mobilePositionTo) {
|
|
1049
|
-
const [activeMenus, setActiveMenus] = (0,
|
|
1071
|
+
const [activeMenus, setActiveMenus] = (0, import_react8.useState)(
|
|
1050
1072
|
{}
|
|
1051
1073
|
);
|
|
1052
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
1053
|
-
const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0,
|
|
1074
|
+
const [activeMenu, setActiveMenu] = (0, import_react8.useState)("");
|
|
1075
|
+
const [currentSubMenuLevel, setCurrentSubMenuLevel] = (0, import_react8.useState)(
|
|
1054
1076
|
null
|
|
1055
1077
|
);
|
|
1056
|
-
const menuRootRef = (0,
|
|
1057
|
-
const subMenuRefs = (0,
|
|
1058
|
-
const hoverTimeoutRef = (0,
|
|
1059
|
-
const closeTimeoutRef = (0,
|
|
1060
|
-
const mouseStopTimeoutRef = (0,
|
|
1061
|
-
const isMouseMovingRef = (0,
|
|
1062
|
-
const pendingOpenActionRef = (0,
|
|
1063
|
-
const pendingCloseActionRef = (0,
|
|
1078
|
+
const menuRootRef = (0, import_react8.useRef)(null);
|
|
1079
|
+
const subMenuRefs = (0, import_react8.useRef)({});
|
|
1080
|
+
const hoverTimeoutRef = (0, import_react8.useRef)(null);
|
|
1081
|
+
const closeTimeoutRef = (0, import_react8.useRef)(null);
|
|
1082
|
+
const mouseStopTimeoutRef = (0, import_react8.useRef)(null);
|
|
1083
|
+
const isMouseMovingRef = (0, import_react8.useRef)(false);
|
|
1084
|
+
const pendingOpenActionRef = (0, import_react8.useRef)(null);
|
|
1085
|
+
const pendingCloseActionRef = (0, import_react8.useRef)(null);
|
|
1064
1086
|
const isMobile = useMatchesMobile();
|
|
1065
1087
|
const toggleMenu = (menuId, level) => {
|
|
1066
1088
|
if (closeTimeoutRef.current) {
|
|
@@ -1100,7 +1122,7 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1100
1122
|
return newActiveMenus;
|
|
1101
1123
|
});
|
|
1102
1124
|
};
|
|
1103
|
-
const executePendingActions = (0,
|
|
1125
|
+
const executePendingActions = (0, import_react8.useCallback)(() => {
|
|
1104
1126
|
if (pendingCloseActionRef.current) {
|
|
1105
1127
|
pendingCloseActionRef.current();
|
|
1106
1128
|
pendingCloseActionRef.current = null;
|
|
@@ -1189,7 +1211,7 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1189
1211
|
const isMenuActive = (menuId, level) => {
|
|
1190
1212
|
return activeMenus[level] === menuId;
|
|
1191
1213
|
};
|
|
1192
|
-
(0,
|
|
1214
|
+
(0, import_react8.useEffect)(() => {
|
|
1193
1215
|
const handleClickOutside = (event) => {
|
|
1194
1216
|
var _a;
|
|
1195
1217
|
if (Object.keys(activeMenus).length === 0) return;
|
|
@@ -1208,7 +1230,7 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1208
1230
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1209
1231
|
};
|
|
1210
1232
|
}, [activeMenus]);
|
|
1211
|
-
(0,
|
|
1233
|
+
(0, import_react8.useEffect)(() => {
|
|
1212
1234
|
return () => {
|
|
1213
1235
|
if (hoverTimeoutRef.current) {
|
|
1214
1236
|
clearTimeout(hoverTimeoutRef.current);
|
|
@@ -1286,13 +1308,13 @@ function useSubMenuSystem(mobilePositionTo) {
|
|
|
1286
1308
|
};
|
|
1287
1309
|
}
|
|
1288
1310
|
function useMenuPosition(elementRef, position = "bottom", options) {
|
|
1289
|
-
const [menuPosition, setMenuPosition] = (0,
|
|
1311
|
+
const [menuPosition, setMenuPosition] = (0, import_react8.useState)({
|
|
1290
1312
|
top: 0,
|
|
1291
1313
|
left: 0,
|
|
1292
1314
|
minWidth: 0
|
|
1293
1315
|
});
|
|
1294
1316
|
const isMobile = options == null ? void 0 : options.isMobile;
|
|
1295
|
-
const updatePosition = (0,
|
|
1317
|
+
const updatePosition = (0, import_react8.useCallback)(() => {
|
|
1296
1318
|
var _a, _b, _c;
|
|
1297
1319
|
if (!(elementRef == null ? void 0 : elementRef.current)) return;
|
|
1298
1320
|
const triggerRect = elementRef.current.getBoundingClientRect();
|
|
@@ -1340,7 +1362,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
|
|
|
1340
1362
|
minWidth: triggerRect.width
|
|
1341
1363
|
});
|
|
1342
1364
|
}, [elementRef, position, options == null ? void 0 : options.menuRef, options == null ? void 0 : options.topOffset, isMobile]);
|
|
1343
|
-
(0,
|
|
1365
|
+
(0, import_react8.useEffect)(() => {
|
|
1344
1366
|
if (!(options == null ? void 0 : options.isOpen) || !(options == null ? void 0 : options.setIsOpen)) return;
|
|
1345
1367
|
const handleClickOutside = (event) => {
|
|
1346
1368
|
var _a, _b, _c, _d, _e;
|
|
@@ -1366,7 +1388,7 @@ function useMenuPosition(elementRef, position = "bottom", options) {
|
|
|
1366
1388
|
options == null ? void 0 : options.menuRef,
|
|
1367
1389
|
options == null ? void 0 : options.additionalRefs
|
|
1368
1390
|
]);
|
|
1369
|
-
(0,
|
|
1391
|
+
(0, import_react8.useEffect)(() => {
|
|
1370
1392
|
updatePosition();
|
|
1371
1393
|
const resizeObserver = new ResizeObserver(updatePosition);
|
|
1372
1394
|
if (elementRef == null ? void 0 : elementRef.current) {
|
|
@@ -1447,9 +1469,9 @@ var Menu = (_a) => {
|
|
|
1447
1469
|
"menuName",
|
|
1448
1470
|
"calculateMinMaxHeight"
|
|
1449
1471
|
]);
|
|
1450
|
-
const internalRef = (0,
|
|
1472
|
+
const internalRef = (0, import_react9.useRef)(null);
|
|
1451
1473
|
const actualRef = ref || internalRef;
|
|
1452
|
-
const [maxHeight, setMaxHeight] = (0,
|
|
1474
|
+
const [maxHeight, setMaxHeight] = (0, import_react9.useState)("180px");
|
|
1453
1475
|
const isMobile = useMatchesMobile();
|
|
1454
1476
|
const { menuPosition, updatePosition } = useMenuPosition(
|
|
1455
1477
|
isMobile && mobilePositionTo ? mobilePositionTo : positionTo,
|
|
@@ -1462,7 +1484,7 @@ var Menu = (_a) => {
|
|
|
1462
1484
|
isMobile: !!(isMobile && mobilePositionTo)
|
|
1463
1485
|
}
|
|
1464
1486
|
);
|
|
1465
|
-
(0,
|
|
1487
|
+
(0, import_react9.useEffect)(() => {
|
|
1466
1488
|
if (calculateMinMaxHeight) {
|
|
1467
1489
|
return;
|
|
1468
1490
|
}
|
|
@@ -1486,7 +1508,7 @@ var Menu = (_a) => {
|
|
|
1486
1508
|
cancelAnimationFrame(raf);
|
|
1487
1509
|
};
|
|
1488
1510
|
}, [actualRef.current, customMaxHeight, calculateMinMaxHeight]);
|
|
1489
|
-
(0,
|
|
1511
|
+
(0, import_react9.useEffect)(() => {
|
|
1490
1512
|
if (!calculateMinMaxHeight) {
|
|
1491
1513
|
return;
|
|
1492
1514
|
}
|
|
@@ -1497,14 +1519,14 @@ var Menu = (_a) => {
|
|
|
1497
1519
|
setMaxHeight(`${calculatedMaxHeight}px`);
|
|
1498
1520
|
}
|
|
1499
1521
|
}, [actualRef.current, positionTo == null ? void 0 : positionTo.current, calculateMinMaxHeight]);
|
|
1500
|
-
(0,
|
|
1522
|
+
(0, import_react9.useEffect)(() => {
|
|
1501
1523
|
if (!show) {
|
|
1502
1524
|
return;
|
|
1503
1525
|
}
|
|
1504
1526
|
initializeMenuFocus();
|
|
1505
1527
|
updatePosition();
|
|
1506
1528
|
}, [show, updatePosition]);
|
|
1507
|
-
(0,
|
|
1529
|
+
(0, import_react9.useEffect)(() => {
|
|
1508
1530
|
if (!show || !setShow) {
|
|
1509
1531
|
return;
|
|
1510
1532
|
}
|
|
@@ -1658,10 +1680,10 @@ var Menu = (_a) => {
|
|
|
1658
1680
|
Menu.displayName = "Menu";
|
|
1659
1681
|
|
|
1660
1682
|
// src/components/Search.tsx
|
|
1661
|
-
var
|
|
1683
|
+
var import_react11 = require("react");
|
|
1662
1684
|
|
|
1663
1685
|
// src/components/Input.tsx
|
|
1664
|
-
var
|
|
1686
|
+
var import_react10 = require("react");
|
|
1665
1687
|
var import_clsx8 = __toESM(require("clsx"), 1);
|
|
1666
1688
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1667
1689
|
var InputBase = (_a) => {
|
|
@@ -1718,9 +1740,9 @@ var InputBase = (_a) => {
|
|
|
1718
1740
|
"data-error": error && !focus || null,
|
|
1719
1741
|
"data-focus": focus || null
|
|
1720
1742
|
};
|
|
1721
|
-
const inputRef = (0,
|
|
1743
|
+
const inputRef = (0, import_react10.useRef)(null);
|
|
1722
1744
|
const inputId = id ? `${id}-input` : void 0;
|
|
1723
|
-
(0,
|
|
1745
|
+
(0, import_react10.useEffect)(() => {
|
|
1724
1746
|
var _a2;
|
|
1725
1747
|
const input = inputRef.current;
|
|
1726
1748
|
const focusHandler = () => {
|
|
@@ -1879,15 +1901,15 @@ var Input = (_a) => {
|
|
|
1879
1901
|
"testid",
|
|
1880
1902
|
"rightAdornment"
|
|
1881
1903
|
]);
|
|
1882
|
-
const [internalValue, setInternalValue] = (0,
|
|
1883
|
-
const [displayValue, setDisplayValue] = (0,
|
|
1884
|
-
(0,
|
|
1904
|
+
const [internalValue, setInternalValue] = (0, import_react10.useState)("");
|
|
1905
|
+
const [displayValue, setDisplayValue] = (0, import_react10.useState)("");
|
|
1906
|
+
(0, import_react10.useEffect)(() => {
|
|
1885
1907
|
var _a2;
|
|
1886
1908
|
const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
|
|
1887
1909
|
setInternalValue(stringValue);
|
|
1888
1910
|
setDisplayValue(stringValue);
|
|
1889
1911
|
}, [propValue]);
|
|
1890
|
-
(0,
|
|
1912
|
+
(0, import_react10.useEffect)(() => {
|
|
1891
1913
|
var _a2;
|
|
1892
1914
|
if (variant !== "currency") {
|
|
1893
1915
|
return;
|
|
@@ -2148,14 +2170,14 @@ var Search = (_a) => {
|
|
|
2148
2170
|
"removeRoundness",
|
|
2149
2171
|
"autocompletePadding"
|
|
2150
2172
|
]);
|
|
2151
|
-
const inputRef = (0,
|
|
2152
|
-
const inputContainerRef = (0,
|
|
2153
|
-
const preventFocusOnInitialRender = (0,
|
|
2154
|
-
const [show, setShow] = (0,
|
|
2155
|
-
const [clearing, setClearing] = (0,
|
|
2156
|
-
const uniqueId = (0,
|
|
2173
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
2174
|
+
const inputContainerRef = (0, import_react11.useRef)(null);
|
|
2175
|
+
const preventFocusOnInitialRender = (0, import_react11.useRef)(true);
|
|
2176
|
+
const [show, setShow] = (0, import_react11.useState)(false);
|
|
2177
|
+
const [clearing, setClearing] = (0, import_react11.useState)(false);
|
|
2178
|
+
const uniqueId = (0, import_react11.useId)();
|
|
2157
2179
|
const searchMenuName = `search-menu-${uniqueId}`;
|
|
2158
|
-
(0,
|
|
2180
|
+
(0, import_react11.useEffect)(() => {
|
|
2159
2181
|
var _a2;
|
|
2160
2182
|
if (preventFocusOnInitialRender.current) {
|
|
2161
2183
|
preventFocusOnInitialRender.current = false;
|
|
@@ -2239,7 +2261,7 @@ Search.displayName = "Search";
|
|
|
2239
2261
|
|
|
2240
2262
|
// src/components/DataGridCell.tsx
|
|
2241
2263
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2242
|
-
var DataGridCell = (0,
|
|
2264
|
+
var DataGridCell = (0, import_react12.memo)(
|
|
2243
2265
|
(_a) => {
|
|
2244
2266
|
var _b = _a, {
|
|
2245
2267
|
id,
|
|
@@ -2281,10 +2303,10 @@ var DataGridCell = (0, import_react11.memo)(
|
|
|
2281
2303
|
"testid"
|
|
2282
2304
|
]);
|
|
2283
2305
|
const Element = type === "header" ? "th" : "td";
|
|
2284
|
-
const timerRef = (0,
|
|
2285
|
-
const [isGrabbing, setIsGrabbing] = (0,
|
|
2286
|
-
const [isPointerPressed, setIsPointerPressed] = (0,
|
|
2287
|
-
(0,
|
|
2306
|
+
const timerRef = (0, import_react12.useRef)(null);
|
|
2307
|
+
const [isGrabbing, setIsGrabbing] = (0, import_react12.useState)(false);
|
|
2308
|
+
const [isPointerPressed, setIsPointerPressed] = (0, import_react12.useState)(false);
|
|
2309
|
+
(0, import_react12.useEffect)(() => {
|
|
2288
2310
|
return () => {
|
|
2289
2311
|
if (timerRef.current) {
|
|
2290
2312
|
clearTimeout(timerRef.current);
|
|
@@ -2394,12 +2416,12 @@ function DataCellHeader(_a) {
|
|
|
2394
2416
|
"useMenuDefaultMinWidth"
|
|
2395
2417
|
]);
|
|
2396
2418
|
var _a2;
|
|
2397
|
-
const [showMenu, setShowMenu] = (0,
|
|
2398
|
-
const [filter, setFilter] = (0,
|
|
2419
|
+
const [showMenu, setShowMenu] = (0, import_react12.useState)(false);
|
|
2420
|
+
const [filter, setFilter] = (0, import_react12.useState)(
|
|
2399
2421
|
(_a2 = header.column.getFilterValue()) != null ? _a2 : ""
|
|
2400
2422
|
);
|
|
2401
|
-
const ref = (0,
|
|
2402
|
-
const predeterminedPinned = (0,
|
|
2423
|
+
const ref = (0, import_react12.useRef)(null);
|
|
2424
|
+
const predeterminedPinned = (0, import_react12.useRef)(false);
|
|
2403
2425
|
const { column, getContext } = header;
|
|
2404
2426
|
const { id: columnId, setFilterValue } = column;
|
|
2405
2427
|
const {
|
|
@@ -2409,14 +2431,14 @@ function DataCellHeader(_a) {
|
|
|
2409
2431
|
listeners: subMenuListeners,
|
|
2410
2432
|
mobileHide
|
|
2411
2433
|
} = useSubMenuSystem(node ? node : ref);
|
|
2412
|
-
(0,
|
|
2434
|
+
(0, import_react12.useEffect)(() => {
|
|
2413
2435
|
var _a3, _b2, _c;
|
|
2414
2436
|
const columnPinning = (_a3 = getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
|
|
2415
2437
|
const left = (_b2 = columnPinning == null ? void 0 : columnPinning.left) != null ? _b2 : [];
|
|
2416
2438
|
const right = (_c = columnPinning == null ? void 0 : columnPinning.right) != null ? _c : [];
|
|
2417
2439
|
predeterminedPinned.current = [...left, ...right].includes(columnId);
|
|
2418
2440
|
}, [columnId, getContext]);
|
|
2419
|
-
(0,
|
|
2441
|
+
(0, import_react12.useEffect)(() => {
|
|
2420
2442
|
const handler = setTimeout(() => {
|
|
2421
2443
|
setFilterValue(filter);
|
|
2422
2444
|
}, 500);
|
|
@@ -2679,7 +2701,7 @@ function DragAlongCell(_a) {
|
|
|
2679
2701
|
DragAlongCell.displayName = "DragAlongCell";
|
|
2680
2702
|
|
|
2681
2703
|
// src/components/DataGrid/index.tsx
|
|
2682
|
-
var
|
|
2704
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
2683
2705
|
var import_react_table3 = require("@tanstack/react-table");
|
|
2684
2706
|
var import_core = require("@dnd-kit/core");
|
|
2685
2707
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
@@ -2707,7 +2729,7 @@ function getSortIcon(sort, nextSort = false) {
|
|
|
2707
2729
|
}
|
|
2708
2730
|
|
|
2709
2731
|
// src/components/DataGrid/PinnedColumns.tsx
|
|
2710
|
-
var
|
|
2732
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
2711
2733
|
|
|
2712
2734
|
// src/components/DataGrid/TableBody/index.tsx
|
|
2713
2735
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
@@ -2716,7 +2738,7 @@ var import_clsx12 = __toESM(require("clsx"), 1);
|
|
|
2716
2738
|
// src/components/DataGrid/TableBody/TableBodyRow.tsx
|
|
2717
2739
|
var import_clsx11 = __toESM(require("clsx"), 1);
|
|
2718
2740
|
var import_react_table = require("@tanstack/react-table");
|
|
2719
|
-
var
|
|
2741
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2720
2742
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2721
2743
|
var valueFormatters = {
|
|
2722
2744
|
date: (value) => typeof value === "string" ? formatDate(value) : "",
|
|
@@ -2784,7 +2806,7 @@ function TableBodyRow({
|
|
|
2784
2806
|
const cellFormat = (_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.format;
|
|
2785
2807
|
const cellValue = cellFormat && isValueFormatterKey(cellFormat) ? valueFormatters[cellFormat](cell.getValue()) : cell.getValue();
|
|
2786
2808
|
const cellAlignment = (_c = (_b = cell.column.columnDef.meta) == null ? void 0 : _b.align) != null ? _c : typeof cellValue === "number" ? "right" : "left";
|
|
2787
|
-
return ((_d = cell.column.columnDef.meta) == null ? void 0 : _d.useCustomRenderer) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2809
|
+
return ((_d = cell.column.columnDef.meta) == null ? void 0 : _d.useCustomRenderer) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.default.Fragment, { children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2788
2810
|
CellElement,
|
|
2789
2811
|
{
|
|
2790
2812
|
id: id ? `${id}-row-${row.id}-cell-${cell.id}` : void 0,
|
|
@@ -2998,10 +3020,10 @@ function TableBody({
|
|
|
2998
3020
|
}
|
|
2999
3021
|
|
|
3000
3022
|
// src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
|
|
3001
|
-
var
|
|
3023
|
+
var import_react15 = require("react");
|
|
3002
3024
|
|
|
3003
3025
|
// src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx
|
|
3004
|
-
var
|
|
3026
|
+
var import_react14 = require("react");
|
|
3005
3027
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3006
3028
|
function ColumnSelectorMenuOption({
|
|
3007
3029
|
id,
|
|
@@ -3009,7 +3031,7 @@ function ColumnSelectorMenuOption({
|
|
|
3009
3031
|
column,
|
|
3010
3032
|
toggleColumnVisibility
|
|
3011
3033
|
}) {
|
|
3012
|
-
const [isVisible, setIsVisible] = (0,
|
|
3034
|
+
const [isVisible, setIsVisible] = (0, import_react14.useState)(column.getIsVisible());
|
|
3013
3035
|
const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
|
|
3014
3036
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuOption, { id, testid, defaultChecked: isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3015
3037
|
Checkbox,
|
|
@@ -3035,8 +3057,8 @@ function ColumnSelectorHeaderCell({
|
|
|
3035
3057
|
toggleColumnVisibility,
|
|
3036
3058
|
resetColumnVisibility
|
|
3037
3059
|
}) {
|
|
3038
|
-
const ref = (0,
|
|
3039
|
-
const [show, setShow] = (0,
|
|
3060
|
+
const ref = (0, import_react15.useRef)(null);
|
|
3061
|
+
const [show, setShow] = (0, import_react15.useState)(false);
|
|
3040
3062
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3041
3063
|
DataGridCell,
|
|
3042
3064
|
{
|
|
@@ -3205,7 +3227,7 @@ function PinnedColumns(_a) {
|
|
|
3205
3227
|
header.id
|
|
3206
3228
|
);
|
|
3207
3229
|
}
|
|
3208
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.default.Fragment, { children: ((_f = header.column.columnDef.meta) == null ? void 0 : _f.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3209
3231
|
Checkbox,
|
|
3210
3232
|
{
|
|
3211
3233
|
checked: allSelectedAcrossPages,
|
|
@@ -3287,23 +3309,23 @@ function DataGrid({
|
|
|
3287
3309
|
ref
|
|
3288
3310
|
}) {
|
|
3289
3311
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
3290
|
-
(0,
|
|
3312
|
+
(0, import_react17.useImperativeHandle)(ref, () => ({
|
|
3291
3313
|
getSavedLayout: () => {
|
|
3292
3314
|
return getSavedLayout();
|
|
3293
3315
|
}
|
|
3294
3316
|
}));
|
|
3295
|
-
const [localSorting, setLocalSorting] = (0,
|
|
3296
|
-
const [localColumnFilters, setLocalColumnFilters] = (0,
|
|
3297
|
-
const [localRowSelection, setLocalRowSelection] = (0,
|
|
3317
|
+
const [localSorting, setLocalSorting] = (0, import_react17.useState)([]);
|
|
3318
|
+
const [localColumnFilters, setLocalColumnFilters] = (0, import_react17.useState)([]);
|
|
3319
|
+
const [localRowSelection, setLocalRowSelection] = (0, import_react17.useState)({});
|
|
3298
3320
|
const {
|
|
3299
3321
|
columns: tableColumns,
|
|
3300
3322
|
setColumns: setTableColumns,
|
|
3301
3323
|
getSavedLayout
|
|
3302
3324
|
} = useTableLayout(columns, id != null ? id : testid);
|
|
3303
|
-
const [columnOrder, setColumnOrder] = (0,
|
|
3325
|
+
const [columnOrder, setColumnOrder] = (0, import_react17.useState)(
|
|
3304
3326
|
tableColumns.map((c) => c.id)
|
|
3305
3327
|
);
|
|
3306
|
-
const [columnVisibility, setColumnVisibility] = (0,
|
|
3328
|
+
const [columnVisibility, setColumnVisibility] = (0, import_react17.useState)(
|
|
3307
3329
|
Object.fromEntries(
|
|
3308
3330
|
tableColumns.filter((column) => !!column.id).map((column) => {
|
|
3309
3331
|
var _a2, _b2;
|
|
@@ -3311,7 +3333,7 @@ function DataGrid({
|
|
|
3311
3333
|
})
|
|
3312
3334
|
)
|
|
3313
3335
|
);
|
|
3314
|
-
const updateColumnVisibility = (0,
|
|
3336
|
+
const updateColumnVisibility = (0, import_react17.useCallback)(
|
|
3315
3337
|
(updateOrder) => {
|
|
3316
3338
|
setColumnVisibility(
|
|
3317
3339
|
Object.fromEntries(
|
|
@@ -3325,7 +3347,7 @@ function DataGrid({
|
|
|
3325
3347
|
},
|
|
3326
3348
|
[tableColumns]
|
|
3327
3349
|
);
|
|
3328
|
-
const resetDefaultColumnVisibility = (0,
|
|
3350
|
+
const resetDefaultColumnVisibility = (0, import_react17.useCallback)(() => {
|
|
3329
3351
|
setTableColumns((prev) => {
|
|
3330
3352
|
columns.forEach((column) => {
|
|
3331
3353
|
var _a2, _b2;
|
|
@@ -3341,7 +3363,7 @@ function DataGrid({
|
|
|
3341
3363
|
return [...prev];
|
|
3342
3364
|
}, true);
|
|
3343
3365
|
}, [columns, setTableColumns]);
|
|
3344
|
-
(0,
|
|
3366
|
+
(0, import_react17.useEffect)(() => {
|
|
3345
3367
|
updateColumnVisibility(true);
|
|
3346
3368
|
}, [updateColumnVisibility]);
|
|
3347
3369
|
const sortingState = pagination ? externalSorting != null ? externalSorting : localSorting : localSorting;
|
|
@@ -3357,7 +3379,7 @@ function DataGrid({
|
|
|
3357
3379
|
(onColumnFiltersChange != null ? onColumnFiltersChange : setLocalColumnFilters)(value);
|
|
3358
3380
|
} : setLocalColumnFilters;
|
|
3359
3381
|
const rowSelection = externalRowSelection != null ? externalRowSelection : localRowSelection;
|
|
3360
|
-
const setRowSelection = (0,
|
|
3382
|
+
const setRowSelection = (0, import_react17.useCallback)(
|
|
3361
3383
|
(updaterOrValue) => {
|
|
3362
3384
|
if (pagination) {
|
|
3363
3385
|
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
@@ -3371,9 +3393,9 @@ function DataGrid({
|
|
|
3371
3393
|
},
|
|
3372
3394
|
[externalRowSelection, onRowSelectionChange, pagination]
|
|
3373
3395
|
);
|
|
3374
|
-
const dndId = (0,
|
|
3375
|
-
const containerRef =
|
|
3376
|
-
const toggleColumnVisibility = (0,
|
|
3396
|
+
const dndId = (0, import_react17.useId)();
|
|
3397
|
+
const containerRef = import_react17.default.useRef(null);
|
|
3398
|
+
const toggleColumnVisibility = (0, import_react17.useCallback)(
|
|
3377
3399
|
(columnId, isVisible) => {
|
|
3378
3400
|
setTableColumns((prev) => {
|
|
3379
3401
|
const persistedIndex = prev.findIndex((col) => col.id === columnId);
|
|
@@ -3621,7 +3643,7 @@ function DataGrid({
|
|
|
3621
3643
|
header.id
|
|
3622
3644
|
);
|
|
3623
3645
|
}
|
|
3624
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react17.default.Fragment, { children: ((_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3625
3647
|
DataGridCell,
|
|
3626
3648
|
{
|
|
3627
3649
|
id: id ? `${id}-header-${header.id}` : void 0,
|
|
@@ -3827,7 +3849,7 @@ function adaptTableStateSetter(setter) {
|
|
|
3827
3849
|
}
|
|
3828
3850
|
|
|
3829
3851
|
// src/components/Select.tsx
|
|
3830
|
-
var
|
|
3852
|
+
var import_react18 = require("react");
|
|
3831
3853
|
var import_clsx15 = __toESM(require("clsx"), 1);
|
|
3832
3854
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3833
3855
|
var Select = (_a) => {
|
|
@@ -3861,11 +3883,11 @@ var Select = (_a) => {
|
|
|
3861
3883
|
"value"
|
|
3862
3884
|
]);
|
|
3863
3885
|
var _a2;
|
|
3864
|
-
const inputRef = (0,
|
|
3865
|
-
const inputContainerRef = (0,
|
|
3866
|
-
const preventFocusOnInitialRender = (0,
|
|
3867
|
-
const [show, setShow] = (0,
|
|
3868
|
-
(0,
|
|
3886
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
3887
|
+
const inputContainerRef = (0, import_react18.useRef)(null);
|
|
3888
|
+
const preventFocusOnInitialRender = (0, import_react18.useRef)(true);
|
|
3889
|
+
const [show, setShow] = (0, import_react18.useState)(false);
|
|
3890
|
+
(0, import_react18.useEffect)(() => {
|
|
3869
3891
|
var _a3;
|
|
3870
3892
|
if (preventFocusOnInitialRender.current) {
|
|
3871
3893
|
preventFocusOnInitialRender.current = false;
|
|
@@ -4287,7 +4309,7 @@ Button.displayName = "Button";
|
|
|
4287
4309
|
|
|
4288
4310
|
// src/components/Tooltip.tsx
|
|
4289
4311
|
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
4290
|
-
var
|
|
4312
|
+
var import_react19 = require("react");
|
|
4291
4313
|
var import_react_dom2 = require("react-dom");
|
|
4292
4314
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4293
4315
|
var Tooltip = ({
|
|
@@ -4300,11 +4322,11 @@ var Tooltip = ({
|
|
|
4300
4322
|
offset = 8,
|
|
4301
4323
|
keepHidden = false
|
|
4302
4324
|
}) => {
|
|
4303
|
-
const ref = (0,
|
|
4304
|
-
const tooltipRef = (0,
|
|
4305
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
4306
|
-
const [isVisible, setIsVisible] = (0,
|
|
4307
|
-
const [removeOpacity, setRemoveOpacity] = (0,
|
|
4325
|
+
const ref = (0, import_react19.useRef)(null);
|
|
4326
|
+
const tooltipRef = (0, import_react19.useRef)(null);
|
|
4327
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react19.useState)({ top: 0, left: 0 });
|
|
4328
|
+
const [isVisible, setIsVisible] = (0, import_react19.useState)(false);
|
|
4329
|
+
const [removeOpacity, setRemoveOpacity] = (0, import_react19.useState)(false);
|
|
4308
4330
|
const updatePosition = () => {
|
|
4309
4331
|
if (!ref.current || !tooltipRef.current) return;
|
|
4310
4332
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -4343,14 +4365,14 @@ var Tooltip = ({
|
|
|
4343
4365
|
setIsVisible(false);
|
|
4344
4366
|
setRemoveOpacity(false);
|
|
4345
4367
|
};
|
|
4346
|
-
(0,
|
|
4368
|
+
(0, import_react19.useEffect)(() => {
|
|
4347
4369
|
if (isVisible && tooltipRef.current) {
|
|
4348
4370
|
requestAnimationFrame(() => {
|
|
4349
4371
|
updatePosition();
|
|
4350
4372
|
});
|
|
4351
4373
|
}
|
|
4352
4374
|
}, [isVisible]);
|
|
4353
|
-
(0,
|
|
4375
|
+
(0, import_react19.useEffect)(() => {
|
|
4354
4376
|
if (isVisible) {
|
|
4355
4377
|
window.addEventListener("resize", updatePosition);
|
|
4356
4378
|
return () => window.removeEventListener("resize", updatePosition);
|
|
@@ -4408,12 +4430,12 @@ var Tooltip = ({
|
|
|
4408
4430
|
Tooltip.displayName = "Tooltip";
|
|
4409
4431
|
|
|
4410
4432
|
// src/components/DateInput.tsx
|
|
4411
|
-
var
|
|
4433
|
+
var import_react21 = require("react");
|
|
4412
4434
|
var import_react_dom3 = require("react-dom");
|
|
4413
4435
|
|
|
4414
4436
|
// src/components/CalendarRange.tsx
|
|
4415
4437
|
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
4416
|
-
var
|
|
4438
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
4417
4439
|
var import_polyfill = require("@js-temporal/polyfill");
|
|
4418
4440
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4419
4441
|
function DateCell(_a) {
|
|
@@ -4526,20 +4548,20 @@ function CalendarRange({
|
|
|
4526
4548
|
const fromDate = parseDate(from);
|
|
4527
4549
|
const toDate = parseDate(to);
|
|
4528
4550
|
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4529
|
-
const [baseMonth, setBaseMonth] = (0,
|
|
4551
|
+
const [baseMonth, setBaseMonth] = (0, import_react20.useState)(
|
|
4530
4552
|
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4531
4553
|
);
|
|
4532
|
-
const [selecting, setSelecting] = (0,
|
|
4533
|
-
const [pendingFrom, setPendingFrom] = (0,
|
|
4534
|
-
const [hoveredDate, setHoveredDate] = (0,
|
|
4535
|
-
(0,
|
|
4554
|
+
const [selecting, setSelecting] = (0, import_react20.useState)("from");
|
|
4555
|
+
const [pendingFrom, setPendingFrom] = (0, import_react20.useState)(void 0);
|
|
4556
|
+
const [hoveredDate, setHoveredDate] = (0, import_react20.useState)(void 0);
|
|
4557
|
+
(0, import_react20.useEffect)(() => {
|
|
4536
4558
|
if (fromDate) {
|
|
4537
4559
|
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4538
4560
|
} else if (toDate) {
|
|
4539
4561
|
setBaseMonth(toDate.with({ day: 1 }));
|
|
4540
4562
|
}
|
|
4541
4563
|
}, [from, to]);
|
|
4542
|
-
(0,
|
|
4564
|
+
(0, import_react20.useEffect)(() => {
|
|
4543
4565
|
if (fromDate && toDate) {
|
|
4544
4566
|
setSelecting("from");
|
|
4545
4567
|
setPendingFrom(void 0);
|
|
@@ -4685,14 +4707,14 @@ function CalendarPane({
|
|
|
4685
4707
|
const years = Array.from({ length: 100 }).map(
|
|
4686
4708
|
(_, i) => baseMonth.year - 50 + i
|
|
4687
4709
|
);
|
|
4688
|
-
const [monthMenuOpen, setMonthMenuOpen] = (0,
|
|
4689
|
-
const [yearMenuOpen, setYearMenuOpen] = (0,
|
|
4690
|
-
const monthMenuRef = (0,
|
|
4691
|
-
const yearMenuRef = (0,
|
|
4710
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react20.useState)(false);
|
|
4711
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react20.useState)(false);
|
|
4712
|
+
const monthMenuRef = (0, import_react20.useRef)(null);
|
|
4713
|
+
const yearMenuRef = (0, import_react20.useRef)(null);
|
|
4692
4714
|
const month = getMonthData(offset);
|
|
4693
4715
|
const totalCells = 42;
|
|
4694
4716
|
const emptyCells = month.firstDayOffset;
|
|
4695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react20.default.Fragment, { children: [
|
|
4696
4718
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4697
4719
|
"div",
|
|
4698
4720
|
{
|
|
@@ -4900,24 +4922,24 @@ var DateInput = (_a) => {
|
|
|
4900
4922
|
"label",
|
|
4901
4923
|
"isDateAvailable"
|
|
4902
4924
|
]);
|
|
4903
|
-
const [visible, setVisible] = (0,
|
|
4904
|
-
const [inputValue, setInputValue] = (0,
|
|
4905
|
-
const [isTyping, setIsTyping] = (0,
|
|
4906
|
-
const popoverRef = (0,
|
|
4907
|
-
const triggerRef = (0,
|
|
4908
|
-
const rootRef = (0,
|
|
4909
|
-
const [calendarPosition, setCalendarPosition] = (0,
|
|
4925
|
+
const [visible, setVisible] = (0, import_react21.useState)(false);
|
|
4926
|
+
const [inputValue, setInputValue] = (0, import_react21.useState)("");
|
|
4927
|
+
const [isTyping, setIsTyping] = (0, import_react21.useState)(false);
|
|
4928
|
+
const popoverRef = (0, import_react21.useRef)(null);
|
|
4929
|
+
const triggerRef = (0, import_react21.useRef)(null);
|
|
4930
|
+
const rootRef = (0, import_react21.useRef)(null);
|
|
4931
|
+
const [calendarPosition, setCalendarPosition] = (0, import_react21.useState)({
|
|
4910
4932
|
top: 0,
|
|
4911
4933
|
left: 0,
|
|
4912
4934
|
width: 0
|
|
4913
4935
|
});
|
|
4914
4936
|
const [from, to] = [value, ""];
|
|
4915
|
-
(0,
|
|
4937
|
+
(0, import_react21.useEffect)(() => {
|
|
4916
4938
|
if (!isTyping) {
|
|
4917
4939
|
setInputValue(formatDisplayValue(from));
|
|
4918
4940
|
}
|
|
4919
4941
|
}, [from, isTyping]);
|
|
4920
|
-
(0,
|
|
4942
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
4921
4943
|
if (visible) {
|
|
4922
4944
|
updatePosition();
|
|
4923
4945
|
}
|
|
@@ -4932,7 +4954,7 @@ var DateInput = (_a) => {
|
|
|
4932
4954
|
});
|
|
4933
4955
|
}
|
|
4934
4956
|
};
|
|
4935
|
-
(0,
|
|
4957
|
+
(0, import_react21.useEffect)(() => {
|
|
4936
4958
|
updatePosition();
|
|
4937
4959
|
const resizeObserver = new ResizeObserver(updatePosition);
|
|
4938
4960
|
if (triggerRef.current) {
|
|
@@ -4944,7 +4966,7 @@ var DateInput = (_a) => {
|
|
|
4944
4966
|
window.removeEventListener("scroll", updatePosition);
|
|
4945
4967
|
};
|
|
4946
4968
|
}, []);
|
|
4947
|
-
(0,
|
|
4969
|
+
(0, import_react21.useEffect)(() => {
|
|
4948
4970
|
const handleKeyDown2 = (event) => {
|
|
4949
4971
|
var _a2;
|
|
4950
4972
|
if (event.key === "Escape" && popoverRef.current) {
|
|
@@ -4957,7 +4979,7 @@ var DateInput = (_a) => {
|
|
|
4957
4979
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
4958
4980
|
};
|
|
4959
4981
|
});
|
|
4960
|
-
(0,
|
|
4982
|
+
(0, import_react21.useEffect)(() => {
|
|
4961
4983
|
const handleClickOutside = (event) => {
|
|
4962
4984
|
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
4963
4985
|
setVisible(false);
|
|
@@ -5564,18 +5586,18 @@ function Theme({
|
|
|
5564
5586
|
}
|
|
5565
5587
|
|
|
5566
5588
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
5567
|
-
var
|
|
5589
|
+
var import_react24 = require("react");
|
|
5568
5590
|
|
|
5569
5591
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
5570
|
-
var
|
|
5592
|
+
var import_react23 = require("react");
|
|
5571
5593
|
|
|
5572
5594
|
// src/components/MobileDataGrid/GridContextProvider/GridContext.tsx
|
|
5573
|
-
var
|
|
5574
|
-
var GridContext = (0,
|
|
5595
|
+
var import_react22 = require("react");
|
|
5596
|
+
var GridContext = (0, import_react22.createContext)(null);
|
|
5575
5597
|
|
|
5576
5598
|
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
5577
5599
|
function useGridContext() {
|
|
5578
|
-
const ctx = (0,
|
|
5600
|
+
const ctx = (0, import_react23.useContext)(GridContext);
|
|
5579
5601
|
if (!ctx) {
|
|
5580
5602
|
throw new Error("useGridContext must be used within GridContextProvider");
|
|
5581
5603
|
}
|
|
@@ -5586,8 +5608,8 @@ function useGridContext() {
|
|
|
5586
5608
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5587
5609
|
function ColumnSelector() {
|
|
5588
5610
|
const context = useGridContext();
|
|
5589
|
-
const ref = (0,
|
|
5590
|
-
const [show, setShow] = (0,
|
|
5611
|
+
const ref = (0, import_react24.useRef)(null);
|
|
5612
|
+
const [show, setShow] = (0, import_react24.useState)(false);
|
|
5591
5613
|
const {
|
|
5592
5614
|
columns,
|
|
5593
5615
|
id,
|
|
@@ -5598,7 +5620,7 @@ function ColumnSelector() {
|
|
|
5598
5620
|
resetColumnVisibility,
|
|
5599
5621
|
dispatch
|
|
5600
5622
|
} = context;
|
|
5601
|
-
const toggleColumnVisibility = (0,
|
|
5623
|
+
const toggleColumnVisibility = (0, import_react24.useCallback)(
|
|
5602
5624
|
(index, visible) => {
|
|
5603
5625
|
dispatch({ type: "UPDATE", index, payload: { meta: { visible } } });
|
|
5604
5626
|
},
|
|
@@ -5753,7 +5775,7 @@ function MobileDataGridHeader({
|
|
|
5753
5775
|
}
|
|
5754
5776
|
|
|
5755
5777
|
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
5756
|
-
var
|
|
5778
|
+
var import_react25 = require("react");
|
|
5757
5779
|
|
|
5758
5780
|
// src/components/MobileDataGrid/dataGridReducer.ts
|
|
5759
5781
|
function dataGridReducer(state, action) {
|
|
@@ -5796,10 +5818,10 @@ function GridContextProvider(props) {
|
|
|
5796
5818
|
getId,
|
|
5797
5819
|
onRowSelect
|
|
5798
5820
|
} = props;
|
|
5799
|
-
const [columns, dispatch] = (0,
|
|
5800
|
-
const [selectedRowIds, setSelectedRowIds] = (0,
|
|
5801
|
-
const [currentRow, setCurrentRow] = (0,
|
|
5802
|
-
const resetColumnVisibility = (0,
|
|
5821
|
+
const [columns, dispatch] = (0, import_react25.useReducer)(dataGridReducer, initialColumns);
|
|
5822
|
+
const [selectedRowIds, setSelectedRowIds] = (0, import_react25.useState)([]);
|
|
5823
|
+
const [currentRow, setCurrentRow] = (0, import_react25.useState)(null);
|
|
5824
|
+
const resetColumnVisibility = (0, import_react25.useCallback)(() => {
|
|
5803
5825
|
const newColumns = columns.map((column) => {
|
|
5804
5826
|
var _a;
|
|
5805
5827
|
const initialColumn = initialColumns.find((c) => c.id === column.id);
|
|
@@ -5811,7 +5833,7 @@ function GridContextProvider(props) {
|
|
|
5811
5833
|
});
|
|
5812
5834
|
dispatch({ type: "SET", payload: newColumns });
|
|
5813
5835
|
}, [columns, initialColumns]);
|
|
5814
|
-
const handleRowSelect = (0,
|
|
5836
|
+
const handleRowSelect = (0, import_react25.useCallback)(
|
|
5815
5837
|
(item) => {
|
|
5816
5838
|
var _a;
|
|
5817
5839
|
const rowId = (_a = getId(item)) != null ? _a : "";
|
|
@@ -5822,7 +5844,7 @@ function GridContextProvider(props) {
|
|
|
5822
5844
|
},
|
|
5823
5845
|
[getId, onRowSelect, selectedRowIds]
|
|
5824
5846
|
);
|
|
5825
|
-
const handleRowSelectAll = (0,
|
|
5847
|
+
const handleRowSelectAll = (0, import_react25.useCallback)(() => {
|
|
5826
5848
|
setSelectedRowIds((prev) => {
|
|
5827
5849
|
if (prev.length === data.length) {
|
|
5828
5850
|
return [];
|
|
@@ -5830,13 +5852,13 @@ function GridContextProvider(props) {
|
|
|
5830
5852
|
return data.map(getId).filter((id2) => id2 !== void 0);
|
|
5831
5853
|
});
|
|
5832
5854
|
}, [data, getId]);
|
|
5833
|
-
const openRowDetail = (0,
|
|
5855
|
+
const openRowDetail = (0, import_react25.useCallback)((row) => {
|
|
5834
5856
|
setCurrentRow(row);
|
|
5835
5857
|
}, []);
|
|
5836
|
-
const closeRowDetail = (0,
|
|
5858
|
+
const closeRowDetail = (0, import_react25.useCallback)(() => {
|
|
5837
5859
|
setCurrentRow(null);
|
|
5838
5860
|
}, []);
|
|
5839
|
-
const visibleColumns = (0,
|
|
5861
|
+
const visibleColumns = (0, import_react25.useMemo)(() => {
|
|
5840
5862
|
const effectiveLimit = typeof numberOfColumnsToShow === "number" ? Math.max(numberOfColumnsToShow - 1, 0) : void 0;
|
|
5841
5863
|
if (primaryKey) {
|
|
5842
5864
|
const pkColumn = columns.find((col) => col.id === String(primaryKey));
|
|
@@ -5883,7 +5905,7 @@ function GridContextProvider(props) {
|
|
|
5883
5905
|
|
|
5884
5906
|
// src/components/Modal.tsx
|
|
5885
5907
|
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
5886
|
-
var
|
|
5908
|
+
var import_react27 = require("react");
|
|
5887
5909
|
|
|
5888
5910
|
// src/components/ModalHeader.tsx
|
|
5889
5911
|
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
@@ -6059,10 +6081,10 @@ var import_react_dom4 = require("react-dom");
|
|
|
6059
6081
|
var import_react_use = require("react-use");
|
|
6060
6082
|
|
|
6061
6083
|
// src/components/useMounted.tsx
|
|
6062
|
-
var
|
|
6084
|
+
var import_react26 = require("react");
|
|
6063
6085
|
var useMounted = () => {
|
|
6064
|
-
const [isMounted, setIsMounted] = (0,
|
|
6065
|
-
(0,
|
|
6086
|
+
const [isMounted, setIsMounted] = (0, import_react26.useState)(false);
|
|
6087
|
+
(0, import_react26.useEffect)(() => {
|
|
6066
6088
|
setIsMounted(true);
|
|
6067
6089
|
return () => setIsMounted(false);
|
|
6068
6090
|
}, []);
|
|
@@ -6156,12 +6178,12 @@ var Modal = ({
|
|
|
6156
6178
|
}) => {
|
|
6157
6179
|
var _a;
|
|
6158
6180
|
const mounted = useMounted();
|
|
6159
|
-
const modalRef = (0,
|
|
6160
|
-
const bgRef = (0,
|
|
6181
|
+
const modalRef = (0, import_react27.useRef)(null);
|
|
6182
|
+
const bgRef = (0, import_react27.useRef)(null);
|
|
6161
6183
|
const wasOpen = (0, import_react_use.usePrevious)(open);
|
|
6162
6184
|
const isMobile = useMatchesMobile();
|
|
6163
6185
|
const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
|
|
6164
|
-
(0,
|
|
6186
|
+
(0, import_react27.useEffect)(() => {
|
|
6165
6187
|
if (!mounted) return;
|
|
6166
6188
|
if (!modalRef.current || !bgRef.current) {
|
|
6167
6189
|
console.error("Modal or background reference is not set.");
|
|
@@ -6181,7 +6203,7 @@ var Modal = ({
|
|
|
6181
6203
|
bgFadeIn(bgRef.current);
|
|
6182
6204
|
}
|
|
6183
6205
|
}, [mounted, onClose, open, wasOpen]);
|
|
6184
|
-
const handleKeyDown = (0,
|
|
6206
|
+
const handleKeyDown = (0, import_react27.useCallback)(
|
|
6185
6207
|
(e) => {
|
|
6186
6208
|
if (e.key === "Escape") {
|
|
6187
6209
|
if (onClose) {
|
|
@@ -6192,12 +6214,12 @@ var Modal = ({
|
|
|
6192
6214
|
},
|
|
6193
6215
|
[onClose]
|
|
6194
6216
|
);
|
|
6195
|
-
const handleClose = (0,
|
|
6217
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
6196
6218
|
if (onClose) {
|
|
6197
6219
|
onClose();
|
|
6198
6220
|
}
|
|
6199
6221
|
}, [onClose]);
|
|
6200
|
-
(0,
|
|
6222
|
+
(0, import_react27.useEffect)(() => {
|
|
6201
6223
|
if (open) {
|
|
6202
6224
|
document.addEventListener("keyup", handleKeyDown);
|
|
6203
6225
|
}
|
|
@@ -6205,7 +6227,7 @@ var Modal = ({
|
|
|
6205
6227
|
document.removeEventListener("keyup", handleKeyDown);
|
|
6206
6228
|
};
|
|
6207
6229
|
}, [open, handleKeyDown]);
|
|
6208
|
-
(0,
|
|
6230
|
+
(0, import_react27.useEffect)(() => {
|
|
6209
6231
|
if (!open) return;
|
|
6210
6232
|
const scrollY = window.scrollY;
|
|
6211
6233
|
const body = document.body;
|
|
@@ -6226,7 +6248,7 @@ var Modal = ({
|
|
|
6226
6248
|
};
|
|
6227
6249
|
}, [open]);
|
|
6228
6250
|
const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
|
|
6229
|
-
const backgroundClickHandler = (0,
|
|
6251
|
+
const backgroundClickHandler = (0, import_react27.useCallback)(
|
|
6230
6252
|
(e) => {
|
|
6231
6253
|
const target = e.target;
|
|
6232
6254
|
const currentTarget = e.currentTarget;
|
|
@@ -6712,13 +6734,13 @@ function MobileDataGrid(props) {
|
|
|
6712
6734
|
}
|
|
6713
6735
|
|
|
6714
6736
|
// src/components/ProductImagePreview/Thumbnail.tsx
|
|
6715
|
-
var
|
|
6737
|
+
var import_react29 = require("react");
|
|
6716
6738
|
|
|
6717
6739
|
// src/components/ImagePlaceholder.tsx
|
|
6718
|
-
var
|
|
6740
|
+
var import_react28 = require("react");
|
|
6719
6741
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
6720
6742
|
function ImagePlaceholder(props) {
|
|
6721
|
-
const clipId = (0,
|
|
6743
|
+
const clipId = (0, import_react28.useId)();
|
|
6722
6744
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
6723
6745
|
"svg",
|
|
6724
6746
|
__spreadProps(__spreadValues({
|
|
@@ -6746,7 +6768,7 @@ function Thumbnail({
|
|
|
6746
6768
|
onClick,
|
|
6747
6769
|
isPlaceholder = false
|
|
6748
6770
|
}) {
|
|
6749
|
-
const [imageError, setImageError] = (0,
|
|
6771
|
+
const [imageError, setImageError] = (0, import_react29.useState)(false);
|
|
6750
6772
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6751
6773
|
"button",
|
|
6752
6774
|
{
|
|
@@ -6847,7 +6869,7 @@ var Grid = (_a) => {
|
|
|
6847
6869
|
};
|
|
6848
6870
|
|
|
6849
6871
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
6850
|
-
var
|
|
6872
|
+
var import_react30 = require("react");
|
|
6851
6873
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6852
6874
|
var placeholderImageUri = "/placeholder.svg";
|
|
6853
6875
|
function ProductPrimaryImage({
|
|
@@ -6862,12 +6884,12 @@ function ProductPrimaryImage({
|
|
|
6862
6884
|
onZoomPositionChange,
|
|
6863
6885
|
onScrollZoom
|
|
6864
6886
|
}) {
|
|
6865
|
-
const containerRef = (0,
|
|
6866
|
-
const lastPointRef = (0,
|
|
6867
|
-
const rafRef = (0,
|
|
6868
|
-
const [active, setActive] = (0,
|
|
6869
|
-
const [, forceRerender] = (0,
|
|
6870
|
-
const imageSrc = (0,
|
|
6887
|
+
const containerRef = (0, import_react30.useRef)(null);
|
|
6888
|
+
const lastPointRef = (0, import_react30.useRef)(null);
|
|
6889
|
+
const rafRef = (0, import_react30.useRef)(null);
|
|
6890
|
+
const [active, setActive] = (0, import_react30.useState)(false);
|
|
6891
|
+
const [, forceRerender] = (0, import_react30.useState)(0);
|
|
6892
|
+
const imageSrc = (0, import_react30.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
|
|
6871
6893
|
const schedule = () => {
|
|
6872
6894
|
if (rafRef.current != null) return;
|
|
6873
6895
|
rafRef.current = requestAnimationFrame(() => {
|
|
@@ -6875,7 +6897,7 @@ function ProductPrimaryImage({
|
|
|
6875
6897
|
forceRerender((n) => n + 1);
|
|
6876
6898
|
});
|
|
6877
6899
|
};
|
|
6878
|
-
const handlePointerEnter = (0,
|
|
6900
|
+
const handlePointerEnter = (0, import_react30.useCallback)(() => {
|
|
6879
6901
|
if (!zoomEnabled) return;
|
|
6880
6902
|
setActive(true);
|
|
6881
6903
|
const el = containerRef.current;
|
|
@@ -6888,13 +6910,13 @@ function ProductPrimaryImage({
|
|
|
6888
6910
|
);
|
|
6889
6911
|
}
|
|
6890
6912
|
}, [zoomEnabled, onZoomPositionChange, zoomLensSize]);
|
|
6891
|
-
const handlePointerLeave = (0,
|
|
6913
|
+
const handlePointerLeave = (0, import_react30.useCallback)(() => {
|
|
6892
6914
|
if (!zoomEnabled) return;
|
|
6893
6915
|
setActive(false);
|
|
6894
6916
|
lastPointRef.current = null;
|
|
6895
6917
|
onZoomPositionChange == null ? void 0 : onZoomPositionChange(null, false);
|
|
6896
6918
|
}, [zoomEnabled, onZoomPositionChange]);
|
|
6897
|
-
const handlePointerMove = (0,
|
|
6919
|
+
const handlePointerMove = (0, import_react30.useCallback)(
|
|
6898
6920
|
(e) => {
|
|
6899
6921
|
if (isPlaceholder) return;
|
|
6900
6922
|
if (!zoomEnabled || !active) return;
|
|
@@ -6931,7 +6953,7 @@ function ProductPrimaryImage({
|
|
|
6931
6953
|
},
|
|
6932
6954
|
[isPlaceholder, zoomEnabled, active, zoomLensSize, onZoomPositionChange]
|
|
6933
6955
|
);
|
|
6934
|
-
(0,
|
|
6956
|
+
(0, import_react30.useEffect)(() => {
|
|
6935
6957
|
const container = containerRef.current;
|
|
6936
6958
|
if (!container || !scrollToZoomEnabled) return;
|
|
6937
6959
|
const handleNativeWheel = (e) => {
|
|
@@ -6946,7 +6968,7 @@ function ProductPrimaryImage({
|
|
|
6946
6968
|
container.removeEventListener("wheel", handleNativeWheel);
|
|
6947
6969
|
};
|
|
6948
6970
|
}, [scrollToZoomEnabled, zoomEnabled, active, onScrollZoom]);
|
|
6949
|
-
const handleImgError = (0,
|
|
6971
|
+
const handleImgError = (0, import_react30.useCallback)(
|
|
6950
6972
|
(e) => {
|
|
6951
6973
|
if (!placeholderImageUri) return;
|
|
6952
6974
|
const img = e.currentTarget;
|
|
@@ -7014,7 +7036,7 @@ function ProductPrimaryImage({
|
|
|
7014
7036
|
}
|
|
7015
7037
|
|
|
7016
7038
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
7017
|
-
var
|
|
7039
|
+
var import_react31 = require("react");
|
|
7018
7040
|
|
|
7019
7041
|
// src/components/Surface.tsx
|
|
7020
7042
|
var import_clsx33 = __toESM(require("clsx"), 1);
|
|
@@ -7065,7 +7087,7 @@ function ZoomWindow({
|
|
|
7065
7087
|
offset = 10,
|
|
7066
7088
|
className = ""
|
|
7067
7089
|
}) {
|
|
7068
|
-
const imageSrc = (0,
|
|
7090
|
+
const imageSrc = (0, import_react31.useMemo)(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
|
|
7069
7091
|
if (!image || !active || !pointer) return null;
|
|
7070
7092
|
const zoomWindowSize = pointer.lensSize * scaleFactor;
|
|
7071
7093
|
const baseW = pointer.w || width;
|
|
@@ -7194,7 +7216,7 @@ function CarouselPagination({
|
|
|
7194
7216
|
}
|
|
7195
7217
|
|
|
7196
7218
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
7197
|
-
var
|
|
7219
|
+
var import_react32 = require("react");
|
|
7198
7220
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
7199
7221
|
function MobileImageCarousel({
|
|
7200
7222
|
images,
|
|
@@ -7204,15 +7226,15 @@ function MobileImageCarousel({
|
|
|
7204
7226
|
onChangeIndex,
|
|
7205
7227
|
className = ""
|
|
7206
7228
|
}) {
|
|
7207
|
-
const containerRef = (0,
|
|
7208
|
-
const [isDragging, setIsDragging] = (0,
|
|
7209
|
-
const [startX, setStartX] = (0,
|
|
7210
|
-
const [currentTranslate, setCurrentTranslate] = (0,
|
|
7211
|
-
const [prevTranslate, setPrevTranslate] = (0,
|
|
7212
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
7229
|
+
const containerRef = (0, import_react32.useRef)(null);
|
|
7230
|
+
const [isDragging, setIsDragging] = (0, import_react32.useState)(false);
|
|
7231
|
+
const [startX, setStartX] = (0, import_react32.useState)(0);
|
|
7232
|
+
const [currentTranslate, setCurrentTranslate] = (0, import_react32.useState)(0);
|
|
7233
|
+
const [prevTranslate, setPrevTranslate] = (0, import_react32.useState)(0);
|
|
7234
|
+
const [containerWidth, setContainerWidth] = (0, import_react32.useState)(width);
|
|
7213
7235
|
const imageSize = Math.min(containerWidth * 0.6, height * 0.6);
|
|
7214
7236
|
const gap = 16;
|
|
7215
|
-
const getTranslateX = (0,
|
|
7237
|
+
const getTranslateX = (0, import_react32.useCallback)(
|
|
7216
7238
|
(index) => {
|
|
7217
7239
|
const containerCenter = containerWidth / 2;
|
|
7218
7240
|
const imageCenter = imageSize / 2;
|
|
@@ -7221,12 +7243,12 @@ function MobileImageCarousel({
|
|
|
7221
7243
|
},
|
|
7222
7244
|
[containerWidth, imageSize, gap]
|
|
7223
7245
|
);
|
|
7224
|
-
(0,
|
|
7246
|
+
(0, import_react32.useEffect)(() => {
|
|
7225
7247
|
const translateX = getTranslateX(currentIndex);
|
|
7226
7248
|
setCurrentTranslate(translateX);
|
|
7227
7249
|
setPrevTranslate(translateX);
|
|
7228
7250
|
}, [currentIndex, getTranslateX]);
|
|
7229
|
-
(0,
|
|
7251
|
+
(0, import_react32.useEffect)(() => {
|
|
7230
7252
|
const updateContainerWidth = () => {
|
|
7231
7253
|
if (containerRef.current) {
|
|
7232
7254
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -7240,11 +7262,11 @@ function MobileImageCarousel({
|
|
|
7240
7262
|
}
|
|
7241
7263
|
return () => resizeObserver.disconnect();
|
|
7242
7264
|
}, []);
|
|
7243
|
-
const handleStart = (0,
|
|
7265
|
+
const handleStart = (0, import_react32.useCallback)((clientX) => {
|
|
7244
7266
|
setIsDragging(true);
|
|
7245
7267
|
setStartX(clientX);
|
|
7246
7268
|
}, []);
|
|
7247
|
-
const handleMove = (0,
|
|
7269
|
+
const handleMove = (0, import_react32.useCallback)(
|
|
7248
7270
|
(clientX) => {
|
|
7249
7271
|
if (!isDragging) return;
|
|
7250
7272
|
const currentPosition = clientX;
|
|
@@ -7253,7 +7275,7 @@ function MobileImageCarousel({
|
|
|
7253
7275
|
},
|
|
7254
7276
|
[isDragging, startX, prevTranslate]
|
|
7255
7277
|
);
|
|
7256
|
-
const handleEnd = (0,
|
|
7278
|
+
const handleEnd = (0, import_react32.useCallback)(() => {
|
|
7257
7279
|
if (!isDragging) return;
|
|
7258
7280
|
setIsDragging(false);
|
|
7259
7281
|
const moved = currentTranslate - prevTranslate;
|
|
@@ -7301,7 +7323,7 @@ function MobileImageCarousel({
|
|
|
7301
7323
|
const handleTouchEnd = () => {
|
|
7302
7324
|
handleEnd();
|
|
7303
7325
|
};
|
|
7304
|
-
const handleImageClick = (0,
|
|
7326
|
+
const handleImageClick = (0, import_react32.useCallback)(
|
|
7305
7327
|
(index) => {
|
|
7306
7328
|
if (!isDragging && index !== currentIndex) {
|
|
7307
7329
|
onChangeIndex(index);
|
|
@@ -7381,7 +7403,7 @@ function MobileImageCarousel({
|
|
|
7381
7403
|
}
|
|
7382
7404
|
|
|
7383
7405
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
7384
|
-
var
|
|
7406
|
+
var import_react33 = require("react");
|
|
7385
7407
|
function useProductImagePreview(props) {
|
|
7386
7408
|
const {
|
|
7387
7409
|
images,
|
|
@@ -7394,18 +7416,18 @@ function useProductImagePreview(props) {
|
|
|
7394
7416
|
} = props;
|
|
7395
7417
|
const hasImages = !!(images == null ? void 0 : images.length);
|
|
7396
7418
|
const safeIndex = hasImages && currentIndex >= 0 && currentIndex < images.length ? currentIndex : 0;
|
|
7397
|
-
const active = (0,
|
|
7419
|
+
const active = (0, import_react33.useMemo)(() => {
|
|
7398
7420
|
return hasImages ? images[safeIndex] : void 0;
|
|
7399
7421
|
}, [hasImages, images, safeIndex]);
|
|
7400
|
-
const [zoomPoint, setZoomPoint] = (0,
|
|
7401
|
-
const [zoomActive, setZoomActive] = (0,
|
|
7402
|
-
const [currentZoomFactor, setCurrentZoomFactor] = (0,
|
|
7403
|
-
const [primaryImagePosition, setPrimaryImagePosition] = (0,
|
|
7404
|
-
const primaryImageRef = (0,
|
|
7405
|
-
const cleanupRef = (0,
|
|
7422
|
+
const [zoomPoint, setZoomPoint] = (0, import_react33.useState)(null);
|
|
7423
|
+
const [zoomActive, setZoomActive] = (0, import_react33.useState)(false);
|
|
7424
|
+
const [currentZoomFactor, setCurrentZoomFactor] = (0, import_react33.useState)(zoomFactor);
|
|
7425
|
+
const [primaryImagePosition, setPrimaryImagePosition] = (0, import_react33.useState)(null);
|
|
7426
|
+
const primaryImageRef = (0, import_react33.useRef)(null);
|
|
7427
|
+
const cleanupRef = (0, import_react33.useRef)(null);
|
|
7406
7428
|
const effectiveZoomEnabled = zoomEnabled && !isMobile;
|
|
7407
7429
|
const effectiveScrollToZoomEnabled = scrollToZoomEnabled && !isMobile;
|
|
7408
|
-
(0,
|
|
7430
|
+
(0, import_react33.useEffect)(() => {
|
|
7409
7431
|
if (!effectiveZoomEnabled) return;
|
|
7410
7432
|
const setupTracking = () => {
|
|
7411
7433
|
const element = primaryImageRef.current;
|
|
@@ -7439,24 +7461,24 @@ function useProductImagePreview(props) {
|
|
|
7439
7461
|
}
|
|
7440
7462
|
};
|
|
7441
7463
|
}, [effectiveZoomEnabled]);
|
|
7442
|
-
const handleSelect = (0,
|
|
7464
|
+
const handleSelect = (0, import_react33.useCallback)(
|
|
7443
7465
|
(idx) => {
|
|
7444
7466
|
if (idx === safeIndex) return;
|
|
7445
7467
|
onChangeIndex(idx);
|
|
7446
7468
|
},
|
|
7447
7469
|
[safeIndex, onChangeIndex]
|
|
7448
7470
|
);
|
|
7449
|
-
const handleNext = (0,
|
|
7471
|
+
const handleNext = (0, import_react33.useCallback)(() => {
|
|
7450
7472
|
if (!hasImages) return;
|
|
7451
7473
|
const nextIndex = (safeIndex + 1) % images.length;
|
|
7452
7474
|
onChangeIndex(nextIndex);
|
|
7453
7475
|
}, [hasImages, safeIndex, images.length, onChangeIndex]);
|
|
7454
|
-
const handlePrevious = (0,
|
|
7476
|
+
const handlePrevious = (0, import_react33.useCallback)(() => {
|
|
7455
7477
|
if (!hasImages) return;
|
|
7456
7478
|
const previousIndex = safeIndex === 0 ? images.length - 1 : safeIndex - 1;
|
|
7457
7479
|
onChangeIndex(previousIndex);
|
|
7458
7480
|
}, [hasImages, safeIndex, images.length, onChangeIndex]);
|
|
7459
|
-
const handleZoomPositionChange = (0,
|
|
7481
|
+
const handleZoomPositionChange = (0, import_react33.useCallback)(
|
|
7460
7482
|
(p, active2) => {
|
|
7461
7483
|
if (isMobile) return;
|
|
7462
7484
|
setZoomPoint(p);
|
|
@@ -7464,7 +7486,7 @@ function useProductImagePreview(props) {
|
|
|
7464
7486
|
},
|
|
7465
7487
|
[isMobile]
|
|
7466
7488
|
);
|
|
7467
|
-
const handleScrollZoom = (0,
|
|
7489
|
+
const handleScrollZoom = (0, import_react33.useCallback)(
|
|
7468
7490
|
(delta) => {
|
|
7469
7491
|
if (!effectiveScrollToZoomEnabled) return;
|
|
7470
7492
|
const newZoomFactor = Math.max(1, Math.min(5, currentZoomFactor + delta));
|
|
@@ -7472,7 +7494,7 @@ function useProductImagePreview(props) {
|
|
|
7472
7494
|
},
|
|
7473
7495
|
[effectiveScrollToZoomEnabled, currentZoomFactor]
|
|
7474
7496
|
);
|
|
7475
|
-
(0,
|
|
7497
|
+
(0, import_react33.useEffect)(() => {
|
|
7476
7498
|
setCurrentZoomFactor(zoomFactor);
|
|
7477
7499
|
}, [zoomFactor]);
|
|
7478
7500
|
return {
|
|
@@ -7636,7 +7658,7 @@ function ProductImagePreview(props) {
|
|
|
7636
7658
|
}
|
|
7637
7659
|
|
|
7638
7660
|
// src/components/CompactImagesPreview.tsx
|
|
7639
|
-
var
|
|
7661
|
+
var import_react34 = require("react");
|
|
7640
7662
|
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
7641
7663
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
7642
7664
|
function CompactImagesPreview(props) {
|
|
@@ -7656,7 +7678,7 @@ function CompactImagesPreview(props) {
|
|
|
7656
7678
|
} = props;
|
|
7657
7679
|
const isMobile = useMatchesMobile();
|
|
7658
7680
|
const imagesCount = sources.length;
|
|
7659
|
-
const handleImgError = (0,
|
|
7681
|
+
const handleImgError = (0, import_react34.useCallback)(
|
|
7660
7682
|
(e) => {
|
|
7661
7683
|
if (!placeholderImageUri2) return;
|
|
7662
7684
|
const img = e.currentTarget;
|
|
@@ -7666,7 +7688,7 @@ function CompactImagesPreview(props) {
|
|
|
7666
7688
|
},
|
|
7667
7689
|
[placeholderImageUri2, placeholderAlt]
|
|
7668
7690
|
);
|
|
7669
|
-
const handleThumbnailClick = (0,
|
|
7691
|
+
const handleThumbnailClick = (0, import_react34.useCallback)(
|
|
7670
7692
|
(newIndex) => {
|
|
7671
7693
|
if (newIndex === currentSourceIndex) return;
|
|
7672
7694
|
if (newIndex < 0 || newIndex >= imagesCount) return;
|
|
@@ -7795,7 +7817,7 @@ function SimpleTable({
|
|
|
7795
7817
|
}
|
|
7796
7818
|
|
|
7797
7819
|
// src/components/ListGroup.tsx
|
|
7798
|
-
var
|
|
7820
|
+
var import_react35 = require("react");
|
|
7799
7821
|
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
7800
7822
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
7801
7823
|
function ListGroup({
|
|
@@ -7808,7 +7830,7 @@ function ListGroup({
|
|
|
7808
7830
|
className,
|
|
7809
7831
|
children
|
|
7810
7832
|
}) {
|
|
7811
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
7833
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react35.useState)(defaultOpen);
|
|
7812
7834
|
const isControlled = controlledOpen !== void 0;
|
|
7813
7835
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
7814
7836
|
const toggle = () => {
|
|
@@ -7848,7 +7870,7 @@ function ListGroup({
|
|
|
7848
7870
|
}
|
|
7849
7871
|
|
|
7850
7872
|
// src/components/Pagination.tsx
|
|
7851
|
-
var
|
|
7873
|
+
var import_react36 = require("react");
|
|
7852
7874
|
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
7853
7875
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7854
7876
|
var Pagination = ({
|
|
@@ -7860,7 +7882,7 @@ var Pagination = ({
|
|
|
7860
7882
|
className,
|
|
7861
7883
|
disabled
|
|
7862
7884
|
}) => {
|
|
7863
|
-
const goTo = (0,
|
|
7885
|
+
const goTo = (0, import_react36.useCallback)(
|
|
7864
7886
|
(page) => {
|
|
7865
7887
|
if (disabled) return;
|
|
7866
7888
|
onPageChange(page);
|
|
@@ -7877,7 +7899,7 @@ var Pagination = ({
|
|
|
7877
7899
|
goTo(currentPage + 1);
|
|
7878
7900
|
}
|
|
7879
7901
|
};
|
|
7880
|
-
const pageTokens = (0,
|
|
7902
|
+
const pageTokens = (0, import_react36.useMemo)(() => {
|
|
7881
7903
|
if (totalPages <= 5) {
|
|
7882
7904
|
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
7883
7905
|
}
|
|
@@ -8040,7 +8062,7 @@ function EmptyCartIcon() {
|
|
|
8040
8062
|
}
|
|
8041
8063
|
|
|
8042
8064
|
// src/components/SearchResultImage/index.tsx
|
|
8043
|
-
var
|
|
8065
|
+
var import_react37 = require("react");
|
|
8044
8066
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
8045
8067
|
function SearchResultImage({
|
|
8046
8068
|
width = 20,
|
|
@@ -8048,7 +8070,7 @@ function SearchResultImage({
|
|
|
8048
8070
|
src,
|
|
8049
8071
|
alt
|
|
8050
8072
|
}) {
|
|
8051
|
-
const [imageError, setImageError] = (0,
|
|
8073
|
+
const [imageError, setImageError] = (0, import_react37.useState)(false);
|
|
8052
8074
|
const showPlaceholder = imageError || !src;
|
|
8053
8075
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: showPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ImagePlaceholder, { width, height }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8054
8076
|
"img",
|
|
@@ -8066,7 +8088,7 @@ function SearchResultImage({
|
|
|
8066
8088
|
|
|
8067
8089
|
// src/components/Alert.tsx
|
|
8068
8090
|
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
8069
|
-
var
|
|
8091
|
+
var import_react38 = require("react");
|
|
8070
8092
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8071
8093
|
function Alert(_a) {
|
|
8072
8094
|
var _b = _a, {
|
|
@@ -8087,7 +8109,7 @@ function Alert(_a) {
|
|
|
8087
8109
|
"onClose"
|
|
8088
8110
|
]);
|
|
8089
8111
|
const isError = variant === "error";
|
|
8090
|
-
const handleClose = (0,
|
|
8112
|
+
const handleClose = (0, import_react38.useCallback)(() => {
|
|
8091
8113
|
if (onClose) onClose();
|
|
8092
8114
|
}, [onClose]);
|
|
8093
8115
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
@@ -8168,11 +8190,11 @@ function OrderCheckIcon(props) {
|
|
|
8168
8190
|
}
|
|
8169
8191
|
|
|
8170
8192
|
// src/components/EditingContext.tsx
|
|
8171
|
-
var
|
|
8193
|
+
var import_react39 = require("react");
|
|
8172
8194
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
8173
|
-
var EditingContext = (0,
|
|
8195
|
+
var EditingContext = (0, import_react39.createContext)(null);
|
|
8174
8196
|
var useTableEditingContext = () => {
|
|
8175
|
-
const context = (0,
|
|
8197
|
+
const context = (0, import_react39.useContext)(EditingContext);
|
|
8176
8198
|
if (!context) {
|
|
8177
8199
|
throw new Error("useTableEditingContext must be used within EditingProvider");
|
|
8178
8200
|
}
|
|
@@ -8373,7 +8395,7 @@ function AccessCard(props) {
|
|
|
8373
8395
|
|
|
8374
8396
|
// src/components/AccessCardGroup.tsx
|
|
8375
8397
|
var import_clsx42 = __toESM(require("clsx"), 1);
|
|
8376
|
-
var
|
|
8398
|
+
var import_react40 = require("react");
|
|
8377
8399
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8378
8400
|
function AccessCardGroup(props) {
|
|
8379
8401
|
const {
|
|
@@ -8387,7 +8409,7 @@ function AccessCardGroup(props) {
|
|
|
8387
8409
|
testid,
|
|
8388
8410
|
unavailable
|
|
8389
8411
|
} = props;
|
|
8390
|
-
const [expand, setExpand] = (0,
|
|
8412
|
+
const [expand, setExpand] = (0, import_react40.useState)(expanded);
|
|
8391
8413
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { "data-testid": testid, className: "mb-mobile-layout-group-gap desktop:mb-desktop-layout-group-gap compact:mb-desktop-compact-layout-group-gap", children: [
|
|
8392
8414
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
8393
8415
|
"div",
|