@dmsi/wedgekit-react 0.0.369 → 0.0.371
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-RLLQRVM7.js → chunk-2H35FETR.js} +18 -10
- package/dist/chunk-2IKT6IHB.js +190 -0
- package/dist/chunk-4UNWXB4A.js +89 -0
- package/dist/chunk-5IFPG6TS.js +17 -0
- package/dist/{chunk-6GAYJCFE.js → chunk-6DPFKSCT.js} +1 -1
- package/dist/{chunk-ZFOANBWG.js → chunk-AG43RS4Q.js} +2 -1
- package/dist/chunk-AJ5M6MVX.js +7 -0
- package/dist/chunk-AT4AWD6B.js +44 -0
- package/dist/chunk-BQNPOGD5.js +105 -0
- package/dist/chunk-CQFPNZTN.js +172 -0
- package/dist/chunk-EJSPFQCY.js +29 -0
- package/dist/chunk-ER6RCOH3.js +97 -0
- package/dist/{chunk-4VER5OEU.js → chunk-FBE2HGEF.js} +35 -11
- package/dist/chunk-HPQWEZJL.js +45 -0
- package/dist/{chunk-URCLLHO5.js → chunk-IBX6DVHU.js} +376 -102
- package/dist/{chunk-I3WFZOFY.js → chunk-J5V2JRIK.js} +1 -1
- package/dist/chunk-JGJUVJKD.js +283 -0
- package/dist/chunk-KEMCFN4U.js +78 -0
- package/dist/chunk-M6TSTDNZ.js +22 -0
- package/dist/chunk-M7INAUAJ.js +140 -0
- package/dist/chunk-MBZ55T2D.js +51 -0
- package/dist/chunk-N6PNLLNS.js +77 -0
- package/dist/{chunk-ZA5E7ZYM.js → chunk-NXGUDYRR.js} +1 -1
- package/dist/chunk-P36QKH26.js +143 -0
- package/dist/chunk-PTRZHGHA.js +89 -0
- package/dist/chunk-QVWYTQKL.js +29 -0
- package/dist/{chunk-6CPGOW6J.js → chunk-T36HX6QY.js} +6 -4
- package/dist/chunk-U6PUOGG4.js +114 -0
- package/dist/{chunk-NQXZBWDZ.js → chunk-V6U7LU6M.js} +15 -6
- package/dist/chunk-VJVY6NPF.js +32 -0
- package/dist/chunk-VVXPGI2P.js +61 -0
- package/dist/{chunk-ARQBSR3I.js → chunk-YCKRVNJ3.js} +4 -4
- package/dist/chunk-YYHQLQDQ.js +68 -0
- package/dist/components/Accordion.cjs +47 -14
- package/dist/components/Accordion.js +2 -2
- package/dist/components/CalendarRange.cjs +700 -46
- package/dist/components/CalendarRange.css +186 -3
- package/dist/components/CalendarRange.js +43 -11
- package/dist/components/CompactImagesPreview.cjs +485 -0
- package/dist/components/CompactImagesPreview.js +13 -0
- package/dist/components/ContentTabs.cjs +3 -2
- package/dist/components/ContentTabs.js +3 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +4687 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +5051 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +62 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +4687 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +5051 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +62 -0
- package/dist/components/DataGrid/PinnedColumns.cjs +4687 -0
- package/dist/components/DataGrid/PinnedColumns.css +5051 -0
- package/dist/components/DataGrid/PinnedColumns.js +62 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +4689 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.css +5051 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.js +62 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +4689 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +5051 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +62 -0
- package/dist/components/DataGrid/TableBody/index.cjs +4689 -0
- package/dist/components/DataGrid/TableBody/index.css +5051 -0
- package/dist/components/DataGrid/TableBody/index.js +62 -0
- package/dist/components/DataGrid/index.cjs +4692 -0
- package/dist/components/DataGrid/index.css +5051 -0
- package/dist/components/DataGrid/index.js +65 -0
- package/dist/components/DataGrid/utils.cjs +4687 -0
- package/dist/components/DataGrid/utils.css +5051 -0
- package/dist/components/DataGrid/utils.js +62 -0
- package/dist/components/DataGridCell.js +6 -6
- package/dist/components/DateInput.cjs +721 -67
- package/dist/components/DateInput.css +186 -3
- package/dist/components/DateInput.js +45 -13
- package/dist/components/DateRangeInput.cjs +721 -67
- package/dist/components/DateRangeInput.css +186 -3
- package/dist/components/DateRangeInput.js +45 -13
- package/dist/components/FilterGroup.js +3 -3
- package/dist/components/Grid.cjs +3 -1
- package/dist/components/Grid.js +3 -92
- package/dist/components/ImagePlaceholder.cjs +65 -0
- package/dist/components/ImagePlaceholder.js +7 -0
- package/dist/components/Input.js +2 -2
- package/dist/components/MenuOption.js +2 -2
- package/dist/components/MobileDataGrid/ColumnList.cjs +845 -0
- package/dist/components/MobileDataGrid/ColumnList.js +17 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +4797 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +5051 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +62 -0
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.cjs +31 -0
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +7 -0
- package/dist/components/MobileDataGrid/GridContextProvider/index.cjs +177 -0
- package/dist/components/MobileDataGrid/GridContextProvider/index.js +8 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.cjs +269 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +9 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.cjs +790 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +16 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +5059 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +5051 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +62 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.cjs +509 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +13 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +1261 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +27 -0
- package/dist/components/MobileDataGrid/index.cjs +5521 -0
- package/dist/components/MobileDataGrid/index.css +5051 -0
- package/dist/components/MobileDataGrid/index.js +62 -0
- package/dist/components/Modal.cjs +24 -13
- package/dist/components/Modal.js +3 -3
- package/dist/components/ModalHeader.cjs +6 -4
- package/dist/components/ModalHeader.js +1 -1
- package/dist/components/ModalScrim.cjs +2 -1
- package/dist/components/ModalScrim.js +1 -1
- package/dist/components/NestedMenu.js +4 -4
- package/dist/components/Notification.cjs +15 -6
- package/dist/components/Notification.js +1 -1
- package/dist/components/PDFViewer/DownloadIcon.cjs +394 -0
- package/dist/components/PDFViewer/DownloadIcon.js +10 -0
- package/dist/components/PDFViewer/PDFElement.cjs +515 -0
- package/dist/components/PDFViewer/PDFElement.js +11 -0
- package/dist/components/{MobileDataGrid.cjs → PDFViewer/PDFNavigation.cjs} +318 -402
- package/dist/components/PDFViewer/PDFNavigation.js +13 -0
- package/dist/components/PDFViewer/PDFPage.cjs +56 -0
- package/dist/components/PDFViewer/PDFPage.js +7 -0
- package/dist/components/{PDFViewer.cjs → PDFViewer/index.cjs} +290 -202
- package/dist/components/PDFViewer/index.js +29 -0
- package/dist/components/Password.js +2 -2
- package/dist/components/ProductImagePreview/CarouselPagination.cjs +75 -0
- package/dist/components/ProductImagePreview/CarouselPagination.js +7 -0
- package/dist/components/ProductImagePreview/MobileImageCarousel.cjs +214 -0
- package/dist/components/ProductImagePreview/MobileImageCarousel.js +7 -0
- package/dist/components/ProductImagePreview/ProductPrimaryImage.cjs +255 -0
- package/dist/components/ProductImagePreview/ProductPrimaryImage.js +9 -0
- package/dist/components/ProductImagePreview/Thumbnail.cjs +105 -0
- package/dist/components/ProductImagePreview/Thumbnail.js +8 -0
- package/dist/components/ProductImagePreview/ZoomWindow.cjs +198 -0
- package/dist/components/ProductImagePreview/ZoomWindow.js +8 -0
- package/dist/components/ProductImagePreview/index.cjs +1369 -0
- package/dist/components/ProductImagePreview/index.js +22 -0
- package/dist/components/Search.js +3 -3
- package/dist/components/Select.js +3 -3
- package/dist/components/SideMenuGroup.cjs +15 -6
- package/dist/components/SideMenuGroup.js +1 -1
- package/dist/components/SideMenuItem.cjs +15 -6
- package/dist/components/SideMenuItem.js +1 -1
- package/dist/components/SkeletonParagraph.cjs +33 -0
- package/dist/components/SkeletonParagraph.js +10 -0
- package/dist/components/Stack.cjs +15 -6
- package/dist/components/Stack.js +1 -1
- package/dist/components/Stepper.cjs +61 -53
- package/dist/components/Stepper.js +63 -55
- package/dist/components/Surface.js +3 -39
- package/dist/components/Swatch.cjs +15 -6
- package/dist/components/Swatch.js +4 -4
- package/dist/components/Time.cjs +15 -6
- package/dist/components/Time.js +5 -5
- package/dist/components/Upload.cjs +15 -6
- package/dist/components/Upload.js +1 -1
- package/dist/components/index.cjs +2559 -14
- package/dist/components/index.css +186 -3
- package/dist/components/index.js +57 -14
- package/dist/index.css +186 -3
- package/package.json +1 -1
- package/src/components/Accordion.tsx +23 -4
- package/src/components/CompactImagesPreview.tsx +99 -0
- package/src/components/ContentTabs.tsx +3 -1
- package/src/components/DataGrid/types.ts +5 -0
- package/src/components/Grid.tsx +2 -0
- package/src/components/ImagePlaceholder.tsx +22 -0
- package/src/components/MobileDataGrid/ColumnList.tsx +66 -0
- package/src/components/MobileDataGrid/ColumnSelector/index.tsx +97 -0
- package/src/components/MobileDataGrid/GridContextProvider/GridContext.tsx +25 -0
- package/src/components/MobileDataGrid/GridContextProvider/index.tsx +132 -0
- package/src/components/MobileDataGrid/GridContextProvider/useGridContext.ts +10 -0
- package/src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx +20 -0
- package/src/components/MobileDataGrid/MobileDataGridCard/index.tsx +129 -0
- package/src/components/MobileDataGrid/MobileDataGridHeader.tsx +80 -0
- package/src/components/MobileDataGrid/RowDetailModalProvider/ModalContent.tsx +42 -0
- package/src/components/MobileDataGrid/RowDetailModalProvider/index.tsx +68 -0
- package/src/components/MobileDataGrid/dataGridReducer.ts +55 -0
- package/src/components/MobileDataGrid/index.tsx +92 -0
- package/src/components/MobileDataGrid/types.ts +4 -0
- package/src/components/Modal.tsx +31 -12
- package/src/components/ModalButtons.tsx +1 -1
- package/src/components/ModalHeader.tsx +5 -2
- package/src/components/ModalScrim.tsx +3 -2
- package/src/components/PDFViewer/DownloadIcon.tsx +22 -0
- package/src/components/PDFViewer/PDFElement.tsx +90 -0
- package/src/components/PDFViewer/PDFNavigation.tsx +68 -0
- package/src/components/PDFViewer/PDFPage.tsx +34 -0
- package/src/components/PDFViewer/index.tsx +128 -0
- package/src/components/ProductImagePreview/CarouselPagination.tsx +54 -0
- package/src/components/ProductImagePreview/MobileImageCarousel.tsx +226 -0
- package/src/components/ProductImagePreview/ProductPrimaryImage.tsx +218 -0
- package/src/components/ProductImagePreview/Thumbnail.tsx +49 -0
- package/src/components/ProductImagePreview/ZoomWindow.tsx +136 -0
- package/src/components/ProductImagePreview/index.tsx +182 -0
- package/src/components/ProductImagePreview/useProductImagePreview.ts +211 -0
- package/src/components/SkeletonParagraph.tsx +5 -0
- package/src/components/Stack.tsx +29 -6
- package/src/components/Stepper.tsx +5 -1
- package/src/components/index.ts +4 -0
- package/src/types.ts +2 -1
- package/dist/components/MobileDataGrid.js +0 -150
- package/dist/components/PDFViewer.js +0 -250
- package/src/components/MobileDataGrid.tsx +0 -163
- package/src/components/PDFViewer.tsx +0 -264
- package/dist/{chunk-OXSBIBGT.js → chunk-CKQNJNU3.js} +3 -3
- package/dist/{chunk-RJUN52HJ.js → chunk-ZL5X7KP6.js} +3 -3
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Thumbnail
|
|
3
|
+
} from "./chunk-HPQWEZJL.js";
|
|
4
|
+
import {
|
|
5
|
+
ZoomWindow
|
|
6
|
+
} from "./chunk-BQNPOGD5.js";
|
|
7
|
+
import {
|
|
8
|
+
CarouselPagination
|
|
9
|
+
} from "./chunk-MBZ55T2D.js";
|
|
10
|
+
import {
|
|
11
|
+
MobileImageCarousel
|
|
12
|
+
} from "./chunk-2IKT6IHB.js";
|
|
13
|
+
import {
|
|
14
|
+
ProductPrimaryImage
|
|
15
|
+
} from "./chunk-CQFPNZTN.js";
|
|
16
|
+
import {
|
|
17
|
+
Grid
|
|
18
|
+
} from "./chunk-ER6RCOH3.js";
|
|
19
|
+
import {
|
|
20
|
+
useMatchesMobile
|
|
21
|
+
} from "./chunk-JUJBS4ZV.js";
|
|
22
|
+
import {
|
|
23
|
+
Stack
|
|
24
|
+
} from "./chunk-V6U7LU6M.js";
|
|
25
|
+
|
|
26
|
+
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
27
|
+
import { useCallback, useEffect, useRef, useState, useMemo } from "react";
|
|
28
|
+
function useProductImagePreview(props) {
|
|
29
|
+
const {
|
|
30
|
+
images,
|
|
31
|
+
currentIndex,
|
|
32
|
+
zoomEnabled = false,
|
|
33
|
+
zoomFactor = 2,
|
|
34
|
+
scrollToZoomEnabled = false,
|
|
35
|
+
onChangeIndex,
|
|
36
|
+
isMobile = false
|
|
37
|
+
} = props;
|
|
38
|
+
const hasImages = !!(images == null ? void 0 : images.length);
|
|
39
|
+
const safeIndex = hasImages && currentIndex >= 0 && currentIndex < images.length ? currentIndex : 0;
|
|
40
|
+
const active = useMemo(() => {
|
|
41
|
+
return hasImages ? images[safeIndex] : void 0;
|
|
42
|
+
}, [hasImages, images, safeIndex]);
|
|
43
|
+
const [zoomPoint, setZoomPoint] = useState(null);
|
|
44
|
+
const [zoomActive, setZoomActive] = useState(false);
|
|
45
|
+
const [currentZoomFactor, setCurrentZoomFactor] = useState(zoomFactor);
|
|
46
|
+
const [primaryImagePosition, setPrimaryImagePosition] = useState(null);
|
|
47
|
+
const primaryImageRef = useRef(null);
|
|
48
|
+
const cleanupRef = useRef(null);
|
|
49
|
+
const effectiveZoomEnabled = zoomEnabled && !isMobile;
|
|
50
|
+
const effectiveScrollToZoomEnabled = scrollToZoomEnabled && !isMobile;
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!effectiveZoomEnabled) return;
|
|
53
|
+
const setupTracking = () => {
|
|
54
|
+
const element = primaryImageRef.current;
|
|
55
|
+
if (!element) return;
|
|
56
|
+
const updatePosition = () => {
|
|
57
|
+
if (element) {
|
|
58
|
+
setPrimaryImagePosition(element.getBoundingClientRect());
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
updatePosition();
|
|
62
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
63
|
+
resizeObserver.observe(element);
|
|
64
|
+
window.addEventListener("scroll", updatePosition);
|
|
65
|
+
window.addEventListener("resize", updatePosition);
|
|
66
|
+
cleanupRef.current = () => {
|
|
67
|
+
resizeObserver.disconnect();
|
|
68
|
+
window.removeEventListener("scroll", updatePosition);
|
|
69
|
+
window.removeEventListener("resize", updatePosition);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
if (primaryImageRef.current) {
|
|
73
|
+
setupTracking();
|
|
74
|
+
} else {
|
|
75
|
+
const frameId = requestAnimationFrame(setupTracking);
|
|
76
|
+
return () => cancelAnimationFrame(frameId);
|
|
77
|
+
}
|
|
78
|
+
return () => {
|
|
79
|
+
if (cleanupRef.current) {
|
|
80
|
+
cleanupRef.current();
|
|
81
|
+
cleanupRef.current = null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}, [effectiveZoomEnabled]);
|
|
85
|
+
const handleSelect = useCallback(
|
|
86
|
+
(idx) => {
|
|
87
|
+
if (idx === safeIndex) return;
|
|
88
|
+
onChangeIndex(idx);
|
|
89
|
+
},
|
|
90
|
+
[safeIndex, onChangeIndex]
|
|
91
|
+
);
|
|
92
|
+
const handleNext = useCallback(() => {
|
|
93
|
+
if (!hasImages) return;
|
|
94
|
+
const nextIndex = (safeIndex + 1) % images.length;
|
|
95
|
+
onChangeIndex(nextIndex);
|
|
96
|
+
}, [hasImages, safeIndex, images.length, onChangeIndex]);
|
|
97
|
+
const handlePrevious = useCallback(() => {
|
|
98
|
+
if (!hasImages) return;
|
|
99
|
+
const previousIndex = safeIndex === 0 ? images.length - 1 : safeIndex - 1;
|
|
100
|
+
onChangeIndex(previousIndex);
|
|
101
|
+
}, [hasImages, safeIndex, images.length, onChangeIndex]);
|
|
102
|
+
const handleZoomPositionChange = useCallback(
|
|
103
|
+
(p, active2) => {
|
|
104
|
+
if (isMobile) return;
|
|
105
|
+
setZoomPoint(p);
|
|
106
|
+
setZoomActive(active2);
|
|
107
|
+
},
|
|
108
|
+
[isMobile]
|
|
109
|
+
);
|
|
110
|
+
const handleScrollZoom = useCallback(
|
|
111
|
+
(delta) => {
|
|
112
|
+
if (!effectiveScrollToZoomEnabled) return;
|
|
113
|
+
const newZoomFactor = Math.max(1, Math.min(5, currentZoomFactor + delta));
|
|
114
|
+
setCurrentZoomFactor(newZoomFactor);
|
|
115
|
+
},
|
|
116
|
+
[effectiveScrollToZoomEnabled, currentZoomFactor]
|
|
117
|
+
);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
setCurrentZoomFactor(zoomFactor);
|
|
120
|
+
}, [zoomFactor]);
|
|
121
|
+
return {
|
|
122
|
+
// State
|
|
123
|
+
zoomPoint,
|
|
124
|
+
zoomActive,
|
|
125
|
+
currentZoomFactor,
|
|
126
|
+
primaryImagePosition,
|
|
127
|
+
hasImages,
|
|
128
|
+
safeIndex,
|
|
129
|
+
active,
|
|
130
|
+
// Refs
|
|
131
|
+
primaryImageRef,
|
|
132
|
+
// Handlers
|
|
133
|
+
handleSelect,
|
|
134
|
+
handleZoomPositionChange,
|
|
135
|
+
handleScrollZoom,
|
|
136
|
+
handleNext,
|
|
137
|
+
handlePrevious
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/components/ProductImagePreview/index.tsx
|
|
142
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
143
|
+
var PLACEHOLDER_IMAGES = [
|
|
144
|
+
{ src: "", alt: "placeholder" },
|
|
145
|
+
{ src: "", alt: "placeholder" }
|
|
146
|
+
];
|
|
147
|
+
function ProductImagePreview(props) {
|
|
148
|
+
const {
|
|
149
|
+
width = 483,
|
|
150
|
+
height = 483,
|
|
151
|
+
thumbsPerRow = 4,
|
|
152
|
+
zoomEnabled = false,
|
|
153
|
+
scrollToZoomEnabled = false,
|
|
154
|
+
images,
|
|
155
|
+
currentIndex,
|
|
156
|
+
onChangeIndex,
|
|
157
|
+
zoomLensSize,
|
|
158
|
+
zoomFactor = 2,
|
|
159
|
+
zoomWindowScaleFactor = 2.5,
|
|
160
|
+
zoomWindowOffset = 10
|
|
161
|
+
} = props;
|
|
162
|
+
const isMobile = useMatchesMobile();
|
|
163
|
+
const {
|
|
164
|
+
zoomPoint,
|
|
165
|
+
zoomActive,
|
|
166
|
+
currentZoomFactor,
|
|
167
|
+
primaryImagePosition,
|
|
168
|
+
safeIndex,
|
|
169
|
+
active,
|
|
170
|
+
primaryImageRef,
|
|
171
|
+
handleSelect,
|
|
172
|
+
handleZoomPositionChange,
|
|
173
|
+
handleScrollZoom
|
|
174
|
+
} = useProductImagePreview({
|
|
175
|
+
images,
|
|
176
|
+
currentIndex,
|
|
177
|
+
zoomEnabled,
|
|
178
|
+
zoomFactor,
|
|
179
|
+
scrollToZoomEnabled,
|
|
180
|
+
onChangeIndex,
|
|
181
|
+
isMobile
|
|
182
|
+
});
|
|
183
|
+
if (typeof isMobile === "undefined") return null;
|
|
184
|
+
const effectiveZoomEnabled = zoomEnabled && !isMobile;
|
|
185
|
+
return /* @__PURE__ */ jsxs(Stack, { sizing: "layout", style: { width, position: "relative" }, children: [
|
|
186
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-4 items-start", children: [
|
|
187
|
+
/* @__PURE__ */ jsx("div", { ref: primaryImageRef, children: /* @__PURE__ */ jsx(
|
|
188
|
+
ProductPrimaryImage,
|
|
189
|
+
{
|
|
190
|
+
image: active,
|
|
191
|
+
width,
|
|
192
|
+
height,
|
|
193
|
+
zoomEnabled: effectiveZoomEnabled,
|
|
194
|
+
zoomLensSize,
|
|
195
|
+
scrollToZoomEnabled: scrollToZoomEnabled && !isMobile,
|
|
196
|
+
onZoomPositionChange: handleZoomPositionChange,
|
|
197
|
+
onScrollZoom: handleScrollZoom,
|
|
198
|
+
isPlaceholder: images.length === 0
|
|
199
|
+
}
|
|
200
|
+
) }),
|
|
201
|
+
effectiveZoomEnabled && /* @__PURE__ */ jsx(
|
|
202
|
+
ZoomWindow,
|
|
203
|
+
{
|
|
204
|
+
image: active,
|
|
205
|
+
width,
|
|
206
|
+
height,
|
|
207
|
+
pointer: zoomPoint,
|
|
208
|
+
active: zoomActive,
|
|
209
|
+
zoomFactor: currentZoomFactor,
|
|
210
|
+
scaleFactor: zoomWindowScaleFactor,
|
|
211
|
+
primaryImagePosition,
|
|
212
|
+
offset: zoomWindowOffset
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] }) }),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
MobileImageCarousel,
|
|
218
|
+
{
|
|
219
|
+
images,
|
|
220
|
+
currentIndex: safeIndex,
|
|
221
|
+
width,
|
|
222
|
+
height,
|
|
223
|
+
onChangeIndex: handleSelect
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: images.length <= 3 ? /* @__PURE__ */ jsx(
|
|
227
|
+
"div",
|
|
228
|
+
{
|
|
229
|
+
className: "flex justify-center gap-4",
|
|
230
|
+
style: { width: "100%", maxWidth: width },
|
|
231
|
+
"aria-label": "Product image thumbnails",
|
|
232
|
+
children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
|
|
233
|
+
(img, i) => /* @__PURE__ */ jsx("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ jsx(
|
|
234
|
+
Thumbnail,
|
|
235
|
+
{
|
|
236
|
+
src: img.src,
|
|
237
|
+
alt: img.alt || `Thumbnail ${i + 1}`,
|
|
238
|
+
isActive: i === safeIndex,
|
|
239
|
+
onClick: () => handleSelect(i),
|
|
240
|
+
isPlaceholder: images.length === 0
|
|
241
|
+
}
|
|
242
|
+
) }, img.src + i)
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
) : /* @__PURE__ */ jsx(
|
|
246
|
+
Grid,
|
|
247
|
+
{
|
|
248
|
+
sizing: "layout-group",
|
|
249
|
+
"aria-label": "Product image thumbnails",
|
|
250
|
+
style: {
|
|
251
|
+
width: "100%",
|
|
252
|
+
maxWidth: width
|
|
253
|
+
},
|
|
254
|
+
columns: thumbsPerRow > 12 ? 12 : thumbsPerRow < 1 ? 1 : thumbsPerRow,
|
|
255
|
+
children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
|
|
256
|
+
(img, i) => /* @__PURE__ */ jsx(
|
|
257
|
+
Thumbnail,
|
|
258
|
+
{
|
|
259
|
+
src: img.src,
|
|
260
|
+
alt: img.alt || `Thumbnail ${i + 1}`,
|
|
261
|
+
isActive: i === safeIndex,
|
|
262
|
+
onClick: () => handleSelect(i),
|
|
263
|
+
isPlaceholder: images.length === 0
|
|
264
|
+
},
|
|
265
|
+
img.src + i
|
|
266
|
+
)
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
) }),
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
CarouselPagination,
|
|
272
|
+
{
|
|
273
|
+
images,
|
|
274
|
+
currentIndex: safeIndex,
|
|
275
|
+
onSelect: handleSelect
|
|
276
|
+
}
|
|
277
|
+
)
|
|
278
|
+
] });
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export {
|
|
282
|
+
ProductImagePreview
|
|
283
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ModalContent
|
|
3
|
+
} from "./chunk-VVXPGI2P.js";
|
|
4
|
+
import {
|
|
5
|
+
useGridContext
|
|
6
|
+
} from "./chunk-5IFPG6TS.js";
|
|
7
|
+
import {
|
|
8
|
+
Modal
|
|
9
|
+
} from "./chunk-2H35FETR.js";
|
|
10
|
+
import {
|
|
11
|
+
Heading2
|
|
12
|
+
} from "./chunk-EU73QPW7.js";
|
|
13
|
+
import {
|
|
14
|
+
Stack
|
|
15
|
+
} from "./chunk-V6U7LU6M.js";
|
|
16
|
+
import {
|
|
17
|
+
Icon
|
|
18
|
+
} from "./chunk-NKUETCDA.js";
|
|
19
|
+
import {
|
|
20
|
+
Button
|
|
21
|
+
} from "./chunk-WWAPK5PH.js";
|
|
22
|
+
|
|
23
|
+
// src/components/MobileDataGrid/RowDetailModalProvider/index.tsx
|
|
24
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
+
function RowDetailModalProvider() {
|
|
26
|
+
var _a;
|
|
27
|
+
const context = useGridContext();
|
|
28
|
+
const {
|
|
29
|
+
id,
|
|
30
|
+
testid,
|
|
31
|
+
isRowDetailOpen,
|
|
32
|
+
currentRow,
|
|
33
|
+
primaryKey,
|
|
34
|
+
closeRowDetail
|
|
35
|
+
} = context;
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Modal,
|
|
38
|
+
{
|
|
39
|
+
fixedHeightScrolling: true,
|
|
40
|
+
open: isRowDetailOpen,
|
|
41
|
+
onClose: closeRowDetail,
|
|
42
|
+
hideCloseIcon: true,
|
|
43
|
+
size: "medium",
|
|
44
|
+
className: "!p-0",
|
|
45
|
+
headerIcon: /* @__PURE__ */ jsxs(
|
|
46
|
+
Stack,
|
|
47
|
+
{
|
|
48
|
+
horizontal: true,
|
|
49
|
+
horizontalMobile: true,
|
|
50
|
+
items: "center",
|
|
51
|
+
justify: "between",
|
|
52
|
+
width: "full",
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Heading2, { children: (_a = currentRow == null ? void 0 : currentRow[primaryKey != null ? primaryKey : "id"]) != null ? _a : "Grid Detail" }),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
Button,
|
|
57
|
+
{
|
|
58
|
+
id: id ? `${id}-open-in-new-button` : void 0,
|
|
59
|
+
testid: testid ? `${testid}-open-in-new-button` : void 0,
|
|
60
|
+
iconOnly: true,
|
|
61
|
+
variant: "tertiary",
|
|
62
|
+
onClick: closeRowDetail,
|
|
63
|
+
leftIcon: /* @__PURE__ */ jsx("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ jsx(Icon, { name: "open_in_new", size: 24 }) })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
customActions: /* @__PURE__ */ jsx(Button, { onClick: closeRowDetail, className: "w-full", children: "Close" }),
|
|
70
|
+
showButtons: true,
|
|
71
|
+
children: /* @__PURE__ */ jsx("div", { className: "bg-white max-h-full flex flex-col flex-grow-1", children: /* @__PURE__ */ jsx(ModalContent, {}) })
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
RowDetailModalProvider
|
|
78
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Paragraph
|
|
3
|
+
} from "./chunk-OGIFIPKH.js";
|
|
4
|
+
|
|
5
|
+
// src/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.tsx
|
|
6
|
+
import { jsxs } from "react/jsx-runtime";
|
|
7
|
+
function MobileDataGridColumn(props) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { column, data } = props;
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-2 grid grid-cols-2 gap-2 px-3 flex-1", children: [
|
|
11
|
+
/* @__PURE__ */ jsxs(Paragraph, { color: "text-secondary-normal", className: "text-left", children: [
|
|
12
|
+
(_a = column.header) == null ? void 0 : _a.toString(),
|
|
13
|
+
":"
|
|
14
|
+
] }),
|
|
15
|
+
" ",
|
|
16
|
+
column.id && data[column.id] ? data[column.id] : null
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
MobileDataGridColumn
|
|
22
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GridContext
|
|
3
|
+
} from "./chunk-AJ5M6MVX.js";
|
|
4
|
+
import {
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues
|
|
7
|
+
} from "./chunk-ORMEWXMH.js";
|
|
8
|
+
|
|
9
|
+
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
10
|
+
import { useCallback, useMemo, useReducer, useState } from "react";
|
|
11
|
+
|
|
12
|
+
// src/components/MobileDataGrid/dataGridReducer.ts
|
|
13
|
+
function dataGridReducer(state, action) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const { type, payload } = action;
|
|
16
|
+
let itemIndex = null;
|
|
17
|
+
if (action.type === "INSERT" && action.pos === "INDEX")
|
|
18
|
+
itemIndex = action.index;
|
|
19
|
+
if (action.type === "UPDATE")
|
|
20
|
+
itemIndex = (_a = action.index) != null ? _a : state.filter(({ id }) => !!id).findIndex(({ id }) => id === action.id);
|
|
21
|
+
switch (type) {
|
|
22
|
+
case "SET":
|
|
23
|
+
return [...payload];
|
|
24
|
+
case "UPDATE":
|
|
25
|
+
if (typeof itemIndex !== "number" || itemIndex < 0)
|
|
26
|
+
throw new Error("action.(id | index) must be provided.");
|
|
27
|
+
return [
|
|
28
|
+
...state.slice(0, itemIndex),
|
|
29
|
+
__spreadProps(__spreadValues(__spreadValues({}, state[itemIndex]), payload), {
|
|
30
|
+
meta: __spreadValues(__spreadValues({}, (_b = state[itemIndex].meta) != null ? _b : {}), (_c = payload.meta) != null ? _c : {})
|
|
31
|
+
}),
|
|
32
|
+
...state.slice(itemIndex + 1)
|
|
33
|
+
];
|
|
34
|
+
default:
|
|
35
|
+
throw new Error("Action type not implemented.");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/components/MobileDataGrid/GridContextProvider/index.tsx
|
|
40
|
+
import { jsx } from "react/jsx-runtime";
|
|
41
|
+
function GridContextProvider(props) {
|
|
42
|
+
const {
|
|
43
|
+
initialColumns,
|
|
44
|
+
id,
|
|
45
|
+
testid,
|
|
46
|
+
children,
|
|
47
|
+
data,
|
|
48
|
+
numberOfColumnsToShow,
|
|
49
|
+
primaryKey,
|
|
50
|
+
getId,
|
|
51
|
+
onRowSelect
|
|
52
|
+
} = props;
|
|
53
|
+
const [columns, dispatch] = useReducer(dataGridReducer, initialColumns);
|
|
54
|
+
const [selectedRowIds, setSelectedRowIds] = useState([]);
|
|
55
|
+
const [currentRow, setCurrentRow] = useState(null);
|
|
56
|
+
const resetColumnVisibility = useCallback(() => {
|
|
57
|
+
const newColumns = columns.map((column) => {
|
|
58
|
+
var _a;
|
|
59
|
+
const initialColumn = initialColumns.find((c) => c.id === column.id);
|
|
60
|
+
return __spreadProps(__spreadValues({}, column), {
|
|
61
|
+
meta: __spreadProps(__spreadValues({}, column.meta), {
|
|
62
|
+
visible: (_a = initialColumn == null ? void 0 : initialColumn.meta) == null ? void 0 : _a.visible
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
dispatch({ type: "SET", payload: newColumns });
|
|
67
|
+
}, [columns, initialColumns]);
|
|
68
|
+
const handleRowSelect = useCallback(
|
|
69
|
+
(item) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const rowId = (_a = getId(item)) != null ? _a : "";
|
|
72
|
+
if (!rowId) return;
|
|
73
|
+
const nextSelected = selectedRowIds.includes(rowId) ? selectedRowIds.filter((id2) => id2 !== rowId) : [...selectedRowIds, rowId];
|
|
74
|
+
setSelectedRowIds(nextSelected);
|
|
75
|
+
if (onRowSelect) onRowSelect(item, nextSelected);
|
|
76
|
+
},
|
|
77
|
+
[getId, onRowSelect, selectedRowIds]
|
|
78
|
+
);
|
|
79
|
+
const handleRowSelectAll = useCallback(() => {
|
|
80
|
+
setSelectedRowIds((prev) => {
|
|
81
|
+
if (prev.length === data.length) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
return data.map(getId).filter((id2) => id2 !== void 0);
|
|
85
|
+
});
|
|
86
|
+
}, [data, getId]);
|
|
87
|
+
const openRowDetail = useCallback((row) => {
|
|
88
|
+
setCurrentRow(row);
|
|
89
|
+
}, []);
|
|
90
|
+
const closeRowDetail = useCallback(() => {
|
|
91
|
+
setCurrentRow(null);
|
|
92
|
+
}, []);
|
|
93
|
+
const visibleColumns = useMemo(() => {
|
|
94
|
+
const effectiveLimit = typeof numberOfColumnsToShow === "number" ? Math.max(numberOfColumnsToShow - 1, 0) : void 0;
|
|
95
|
+
if (primaryKey) {
|
|
96
|
+
const pkColumn = columns.find((col) => col.id === String(primaryKey));
|
|
97
|
+
const otherColumns = columns.filter(
|
|
98
|
+
(col) => col.id !== String(primaryKey)
|
|
99
|
+
);
|
|
100
|
+
const orderedColumns = pkColumn ? [pkColumn, ...otherColumns] : [...otherColumns];
|
|
101
|
+
return orderedColumns.filter((x) => {
|
|
102
|
+
var _a;
|
|
103
|
+
return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
|
|
104
|
+
}).slice(0, effectiveLimit);
|
|
105
|
+
}
|
|
106
|
+
return columns.filter((x) => {
|
|
107
|
+
var _a;
|
|
108
|
+
return ((_a = x.meta) == null ? void 0 : _a.visible) !== false;
|
|
109
|
+
}).slice(0, effectiveLimit);
|
|
110
|
+
}, [columns, numberOfColumnsToShow, primaryKey]);
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
GridContext.Provider,
|
|
113
|
+
{
|
|
114
|
+
value: {
|
|
115
|
+
columns,
|
|
116
|
+
testid,
|
|
117
|
+
id,
|
|
118
|
+
data,
|
|
119
|
+
selectedRowIds,
|
|
120
|
+
visibleColumns,
|
|
121
|
+
numberOfColumnsToShow,
|
|
122
|
+
primaryKey,
|
|
123
|
+
dispatch,
|
|
124
|
+
getId,
|
|
125
|
+
resetColumnVisibility,
|
|
126
|
+
handleRowSelect,
|
|
127
|
+
handleRowSelectAll,
|
|
128
|
+
isRowDetailOpen: !!currentRow,
|
|
129
|
+
currentRow,
|
|
130
|
+
openRowDetail,
|
|
131
|
+
closeRowDetail
|
|
132
|
+
},
|
|
133
|
+
children
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export {
|
|
139
|
+
GridContextProvider
|
|
140
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/components/ProductImagePreview/CarouselPagination.tsx
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function CarouselPagination({
|
|
5
|
+
images,
|
|
6
|
+
currentIndex,
|
|
7
|
+
onSelect,
|
|
8
|
+
className
|
|
9
|
+
}) {
|
|
10
|
+
if (!(images == null ? void 0 : images.length)) return null;
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: clsx(
|
|
15
|
+
"flex items-center justify-center w-full px-4 md:hidden",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
"aria-label": "Image navigation",
|
|
19
|
+
children: /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: "grid gap-2 place-items-center",
|
|
23
|
+
style: {
|
|
24
|
+
gridTemplateColumns: `repeat(${Math.min(images.length, 8)}, 1fr)`
|
|
25
|
+
},
|
|
26
|
+
role: "tablist",
|
|
27
|
+
children: images.map((_, index) => /* @__PURE__ */ jsx(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
onClick: () => onSelect(index),
|
|
32
|
+
className: clsx(
|
|
33
|
+
"w-4 h-4 transition-all duration-200 focus:outline-none",
|
|
34
|
+
index === currentIndex ? "ring-2 ring-brand-400" : "ring ring-neutral-300"
|
|
35
|
+
),
|
|
36
|
+
"aria-label": `Go to image ${index + 1}`,
|
|
37
|
+
role: "tab",
|
|
38
|
+
"aria-selected": index === currentIndex,
|
|
39
|
+
tabIndex: index === currentIndex ? 0 : -1
|
|
40
|
+
},
|
|
41
|
+
index
|
|
42
|
+
))
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
CarouselPagination
|
|
51
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Heading3
|
|
3
|
+
} from "./chunk-EU73QPW7.js";
|
|
4
|
+
import {
|
|
5
|
+
Stack
|
|
6
|
+
} from "./chunk-V6U7LU6M.js";
|
|
7
|
+
import {
|
|
8
|
+
Paragraph
|
|
9
|
+
} from "./chunk-OGIFIPKH.js";
|
|
10
|
+
import {
|
|
11
|
+
Icon
|
|
12
|
+
} from "./chunk-NKUETCDA.js";
|
|
13
|
+
import {
|
|
14
|
+
Button
|
|
15
|
+
} from "./chunk-WWAPK5PH.js";
|
|
16
|
+
|
|
17
|
+
// src/components/PDFViewer/PDFNavigation.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
function PdfNavigation({
|
|
20
|
+
currentIndex,
|
|
21
|
+
total,
|
|
22
|
+
onPrev,
|
|
23
|
+
onNext,
|
|
24
|
+
disablePrev,
|
|
25
|
+
disableNext,
|
|
26
|
+
extraActions,
|
|
27
|
+
testid,
|
|
28
|
+
fileName
|
|
29
|
+
}) {
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
31
|
+
Stack,
|
|
32
|
+
{
|
|
33
|
+
horizontal: true,
|
|
34
|
+
items: "center",
|
|
35
|
+
justify: "between",
|
|
36
|
+
sizing: "layout-group",
|
|
37
|
+
testid: testid ? `${testid}-pdf-navigation` : void 0,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxs(Stack, { horizontal: true, items: "center", children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
Button,
|
|
42
|
+
{
|
|
43
|
+
iconOnly: true,
|
|
44
|
+
variant: "tertiary",
|
|
45
|
+
onClick: onPrev,
|
|
46
|
+
leftIcon: /* @__PURE__ */ jsx(Icon, { name: "chevron_backward" }),
|
|
47
|
+
disabled: disablePrev,
|
|
48
|
+
testid: testid ? `${testid}-pdf-file-previous-button` : void 0
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsxs(Heading3, { className: "text-text-primary-normal whitespace-nowrap", children: [
|
|
52
|
+
currentIndex + 1,
|
|
53
|
+
" / ",
|
|
54
|
+
total
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
Button,
|
|
58
|
+
{
|
|
59
|
+
iconOnly: true,
|
|
60
|
+
variant: "tertiary",
|
|
61
|
+
onClick: onNext,
|
|
62
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { name: "chevron_forward" }),
|
|
63
|
+
disabled: disableNext,
|
|
64
|
+
testid: testid ? `${testid}-pdf-file-next-button` : void 0
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ jsx(Paragraph, { children: (fileName == null ? void 0 : fileName.endsWith(".pdf")) ? fileName : `${fileName}.pdf` })
|
|
68
|
+
] }),
|
|
69
|
+
extraActions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: extraActions })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
PdfNavigation
|
|
77
|
+
};
|