@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
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
} from "./chunk-FRHPFACM.js";
|
|
10
10
|
import {
|
|
11
11
|
ModalHeader
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-T36HX6QY.js";
|
|
13
13
|
import {
|
|
14
14
|
ModalScrim
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AG43RS4Q.js";
|
|
16
16
|
import {
|
|
17
17
|
useMatchesMobile
|
|
18
18
|
} from "./chunk-JUJBS4ZV.js";
|
|
@@ -81,6 +81,9 @@ var sizes = {
|
|
|
81
81
|
},
|
|
82
82
|
"x-large": {
|
|
83
83
|
sizeClass: "desktop:max-w-300 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
|
|
84
|
+
},
|
|
85
|
+
screen: {
|
|
86
|
+
sizeClass: "w-screen h-screen max-w-screen !rounded-none"
|
|
84
87
|
}
|
|
85
88
|
};
|
|
86
89
|
var Modal = ({
|
|
@@ -99,7 +102,10 @@ var Modal = ({
|
|
|
99
102
|
headerIcon,
|
|
100
103
|
headerIconAlign,
|
|
101
104
|
fixedHeightScrolling = false,
|
|
102
|
-
customActions
|
|
105
|
+
customActions,
|
|
106
|
+
headerClassname,
|
|
107
|
+
customFooter,
|
|
108
|
+
noWrapper
|
|
103
109
|
}) => {
|
|
104
110
|
var _a;
|
|
105
111
|
const mounted = useMounted();
|
|
@@ -207,9 +213,10 @@ var Modal = ({
|
|
|
207
213
|
"data-testid": testid,
|
|
208
214
|
ref: modalRef,
|
|
209
215
|
className: clsx(
|
|
210
|
-
"
|
|
211
|
-
computedFixedHeightScrolling && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
|
|
216
|
+
"shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
|
|
217
|
+
computedFixedHeightScrolling && size !== "screen" && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
|
|
212
218
|
className,
|
|
219
|
+
!(className == null ? void 0 : className.includes("bg-")) && "bg-white",
|
|
213
220
|
sizeClass
|
|
214
221
|
),
|
|
215
222
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -223,10 +230,11 @@ var Modal = ({
|
|
|
223
230
|
onClose: handleClose,
|
|
224
231
|
hideCloseIcon,
|
|
225
232
|
headerIcon,
|
|
226
|
-
headerIconAlign
|
|
233
|
+
headerIconAlign,
|
|
234
|
+
headerClassname
|
|
227
235
|
}
|
|
228
236
|
),
|
|
229
|
-
children && /* @__PURE__ */ jsx(
|
|
237
|
+
children && (size !== "screen" || noWrapper) ? /* @__PURE__ */ jsx(
|
|
230
238
|
ModalContent,
|
|
231
239
|
{
|
|
232
240
|
id: id ? `${id}-content` : void 0,
|
|
@@ -234,8 +242,8 @@ var Modal = ({
|
|
|
234
242
|
fixedHeightScrolling: computedFixedHeightScrolling,
|
|
235
243
|
children
|
|
236
244
|
}
|
|
237
|
-
),
|
|
238
|
-
showButtons
|
|
245
|
+
) : children,
|
|
246
|
+
showButtons ? customFooter ? customActions : /* @__PURE__ */ jsx(
|
|
239
247
|
ModalButtons,
|
|
240
248
|
{
|
|
241
249
|
id: id ? `${id}-buttons` : void 0,
|
|
@@ -244,7 +252,7 @@ var Modal = ({
|
|
|
244
252
|
onContinue,
|
|
245
253
|
customActions
|
|
246
254
|
}
|
|
247
|
-
)
|
|
255
|
+
) : null
|
|
248
256
|
]
|
|
249
257
|
}
|
|
250
258
|
)
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
2
|
+
import { useRef, useEffect, useState, useCallback } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function MobileImageCarousel({
|
|
5
|
+
images,
|
|
6
|
+
currentIndex,
|
|
7
|
+
width = 483,
|
|
8
|
+
height = 483,
|
|
9
|
+
onChangeIndex,
|
|
10
|
+
className = ""
|
|
11
|
+
}) {
|
|
12
|
+
const containerRef = useRef(null);
|
|
13
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
14
|
+
const [startX, setStartX] = useState(0);
|
|
15
|
+
const [currentTranslate, setCurrentTranslate] = useState(0);
|
|
16
|
+
const [prevTranslate, setPrevTranslate] = useState(0);
|
|
17
|
+
const [containerWidth, setContainerWidth] = useState(width);
|
|
18
|
+
const imageSize = Math.min(containerWidth * 0.6, height * 0.6);
|
|
19
|
+
const gap = 16;
|
|
20
|
+
const getTranslateX = useCallback(
|
|
21
|
+
(index) => {
|
|
22
|
+
const containerCenter = containerWidth / 2;
|
|
23
|
+
const imageCenter = imageSize / 2;
|
|
24
|
+
const totalOffset = index * (imageSize + gap);
|
|
25
|
+
return containerCenter - imageCenter - totalOffset;
|
|
26
|
+
},
|
|
27
|
+
[containerWidth, imageSize, gap]
|
|
28
|
+
);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const translateX = getTranslateX(currentIndex);
|
|
31
|
+
setCurrentTranslate(translateX);
|
|
32
|
+
setPrevTranslate(translateX);
|
|
33
|
+
}, [currentIndex, getTranslateX]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const updateContainerWidth = () => {
|
|
36
|
+
if (containerRef.current) {
|
|
37
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
38
|
+
setContainerWidth(rect.width);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
updateContainerWidth();
|
|
42
|
+
const resizeObserver = new ResizeObserver(updateContainerWidth);
|
|
43
|
+
if (containerRef.current) {
|
|
44
|
+
resizeObserver.observe(containerRef.current);
|
|
45
|
+
}
|
|
46
|
+
return () => resizeObserver.disconnect();
|
|
47
|
+
}, []);
|
|
48
|
+
const handleStart = useCallback((clientX) => {
|
|
49
|
+
setIsDragging(true);
|
|
50
|
+
setStartX(clientX);
|
|
51
|
+
}, []);
|
|
52
|
+
const handleMove = useCallback(
|
|
53
|
+
(clientX) => {
|
|
54
|
+
if (!isDragging) return;
|
|
55
|
+
const currentPosition = clientX;
|
|
56
|
+
const diff = currentPosition - startX;
|
|
57
|
+
setCurrentTranslate(prevTranslate + diff);
|
|
58
|
+
},
|
|
59
|
+
[isDragging, startX, prevTranslate]
|
|
60
|
+
);
|
|
61
|
+
const handleEnd = useCallback(() => {
|
|
62
|
+
if (!isDragging) return;
|
|
63
|
+
setIsDragging(false);
|
|
64
|
+
const moved = currentTranslate - prevTranslate;
|
|
65
|
+
const threshold = imageSize / 3;
|
|
66
|
+
let newIndex = currentIndex;
|
|
67
|
+
if (moved > threshold && currentIndex > 0) {
|
|
68
|
+
newIndex = currentIndex - 1;
|
|
69
|
+
} else if (moved < -threshold && currentIndex < images.length - 1) {
|
|
70
|
+
newIndex = currentIndex + 1;
|
|
71
|
+
}
|
|
72
|
+
if (newIndex !== currentIndex) {
|
|
73
|
+
onChangeIndex(newIndex);
|
|
74
|
+
} else {
|
|
75
|
+
setCurrentTranslate(prevTranslate);
|
|
76
|
+
}
|
|
77
|
+
}, [
|
|
78
|
+
isDragging,
|
|
79
|
+
currentTranslate,
|
|
80
|
+
prevTranslate,
|
|
81
|
+
currentIndex,
|
|
82
|
+
imageSize,
|
|
83
|
+
images.length,
|
|
84
|
+
onChangeIndex
|
|
85
|
+
]);
|
|
86
|
+
const handleMouseDown = (e) => {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
handleStart(e.clientX);
|
|
89
|
+
};
|
|
90
|
+
const handleMouseMove = (e) => {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
handleMove(e.clientX);
|
|
93
|
+
};
|
|
94
|
+
const handleMouseUp = () => {
|
|
95
|
+
handleEnd();
|
|
96
|
+
};
|
|
97
|
+
const handleMouseLeave = () => {
|
|
98
|
+
handleEnd();
|
|
99
|
+
};
|
|
100
|
+
const handleTouchStart = (e) => {
|
|
101
|
+
handleStart(e.touches[0].clientX);
|
|
102
|
+
};
|
|
103
|
+
const handleTouchMove = (e) => {
|
|
104
|
+
handleMove(e.touches[0].clientX);
|
|
105
|
+
};
|
|
106
|
+
const handleTouchEnd = () => {
|
|
107
|
+
handleEnd();
|
|
108
|
+
};
|
|
109
|
+
const handleImageClick = useCallback(
|
|
110
|
+
(index) => {
|
|
111
|
+
if (!isDragging && index !== currentIndex) {
|
|
112
|
+
onChangeIndex(index);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[isDragging, currentIndex, onChangeIndex]
|
|
116
|
+
);
|
|
117
|
+
if (!images.length) return null;
|
|
118
|
+
return /* @__PURE__ */ jsx("div", { className: `md:hidden w-full ${className}`, children: /* @__PURE__ */ jsx(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
ref: containerRef,
|
|
122
|
+
className: "relative overflow-hidden cursor-grab active:cursor-grabbing select-none w-full",
|
|
123
|
+
style: {
|
|
124
|
+
height: imageSize
|
|
125
|
+
},
|
|
126
|
+
onMouseDown: handleMouseDown,
|
|
127
|
+
onMouseMove: handleMouseMove,
|
|
128
|
+
onMouseUp: handleMouseUp,
|
|
129
|
+
onMouseLeave: handleMouseLeave,
|
|
130
|
+
onTouchStart: handleTouchStart,
|
|
131
|
+
onTouchMove: handleTouchMove,
|
|
132
|
+
onTouchEnd: handleTouchEnd,
|
|
133
|
+
children: /* @__PURE__ */ jsx(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: "flex items-center",
|
|
137
|
+
style: {
|
|
138
|
+
transform: `translateX(${currentTranslate}px)`,
|
|
139
|
+
transition: isDragging ? "none" : "transform 0.3s ease-out",
|
|
140
|
+
gap: `${gap}px`
|
|
141
|
+
},
|
|
142
|
+
children: images.map((image, index) => {
|
|
143
|
+
const isActive = index === currentIndex;
|
|
144
|
+
const distance = Math.abs(index - currentIndex);
|
|
145
|
+
const shouldRender = distance <= 2;
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
className: "flex-shrink-0 transition-opacity duration-300",
|
|
150
|
+
style: {
|
|
151
|
+
width: imageSize,
|
|
152
|
+
height: imageSize,
|
|
153
|
+
opacity: isActive ? 1 : Math.max(0.3, 1 - distance * 0.3)
|
|
154
|
+
},
|
|
155
|
+
onClick: () => handleImageClick(index),
|
|
156
|
+
children: shouldRender ? /* @__PURE__ */ jsx(
|
|
157
|
+
"img",
|
|
158
|
+
{
|
|
159
|
+
src: image.src,
|
|
160
|
+
alt: image.alt || `Product image ${index + 1}`,
|
|
161
|
+
className: "w-full h-full object-cover",
|
|
162
|
+
draggable: false,
|
|
163
|
+
loading: distance <= 1 ? "eager" : "lazy",
|
|
164
|
+
style: {
|
|
165
|
+
aspectRatio: "1 / 1"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
) : /* @__PURE__ */ jsx(
|
|
169
|
+
"div",
|
|
170
|
+
{
|
|
171
|
+
className: "w-full h-full bg-neutral-100 rounded-md border border-gray-200",
|
|
172
|
+
style: {
|
|
173
|
+
aspectRatio: "1 / 1"
|
|
174
|
+
},
|
|
175
|
+
"aria-hidden": "true"
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
},
|
|
179
|
+
image.src + index
|
|
180
|
+
);
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
) });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
MobileImageCarousel
|
|
190
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PdfPage
|
|
3
|
+
} from "./chunk-VJVY6NPF.js";
|
|
4
|
+
import {
|
|
5
|
+
Spinner
|
|
6
|
+
} from "./chunk-SBRRNFOP.js";
|
|
7
|
+
import {
|
|
8
|
+
Stack
|
|
9
|
+
} from "./chunk-V6U7LU6M.js";
|
|
10
|
+
|
|
11
|
+
// src/components/PDFViewer/PDFElement.tsx
|
|
12
|
+
import { usePdf } from "@mikecousins/react-pdf";
|
|
13
|
+
import { useRef } from "react";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
function PDFElement({
|
|
17
|
+
b64,
|
|
18
|
+
testid,
|
|
19
|
+
isMobile,
|
|
20
|
+
error
|
|
21
|
+
}) {
|
|
22
|
+
var _a;
|
|
23
|
+
const canvasRef = useRef(null);
|
|
24
|
+
const { pdfDocument } = usePdf({
|
|
25
|
+
file: `data:application/pdf;base64,${b64}`,
|
|
26
|
+
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
27
|
+
scale: isMobile ? 1 : 1.3,
|
|
28
|
+
canvasRef
|
|
29
|
+
});
|
|
30
|
+
const pagesArr = new Array((_a = pdfDocument == null ? void 0 : pdfDocument.numPages) != null ? _a : 1).fill(null);
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: "flex flex-col space-y-4",
|
|
35
|
+
style: !isMobile ? {
|
|
36
|
+
minHeight: 871,
|
|
37
|
+
minWidth: 654
|
|
38
|
+
} : void 0,
|
|
39
|
+
children: !!pdfDocument && !!b64 && !error ? /* @__PURE__ */ jsx(Stack, { sizing: "layout-group", children: pagesArr.length > 1 ? pagesArr.map((_, i) => /* @__PURE__ */ jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: clsx(
|
|
43
|
+
"flex justify-center border-border-primary-normal",
|
|
44
|
+
isMobile ? "border-0" : "border"
|
|
45
|
+
),
|
|
46
|
+
children: /* @__PURE__ */ jsx(
|
|
47
|
+
PdfPage,
|
|
48
|
+
{
|
|
49
|
+
testid: testid ? `${testid}-pdf_page_${i + 1}` : void 0,
|
|
50
|
+
file: `data:application/pdf;base64,${b64}`,
|
|
51
|
+
pageNumber: i + 1
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
`${testid}-pdf-page-${i + 1}`
|
|
56
|
+
)) : /* @__PURE__ */ jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: clsx(
|
|
60
|
+
"flex justify-center border-border-primary-normal",
|
|
61
|
+
isMobile ? "border-0" : "border"
|
|
62
|
+
),
|
|
63
|
+
children: /* @__PURE__ */ jsx(
|
|
64
|
+
"canvas",
|
|
65
|
+
{
|
|
66
|
+
"data-testid": testid ? `${testid}-pdf-content` : void 0,
|
|
67
|
+
ref: canvasRef,
|
|
68
|
+
style: { width: "100%", height: "auto" }
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
) }) : /* @__PURE__ */ jsx(
|
|
73
|
+
Stack,
|
|
74
|
+
{
|
|
75
|
+
justify: "center",
|
|
76
|
+
items: "center",
|
|
77
|
+
height: "full",
|
|
78
|
+
flexGrow: 1,
|
|
79
|
+
"data-testid": testid ? `${testid}-pdf-${error ? "error" : "loading"}` : void 0,
|
|
80
|
+
children: error ? error : /* @__PURE__ */ jsx(Spinner, { size: "large" })
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
PDFElement
|
|
89
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GridContext
|
|
3
|
+
} from "./chunk-AJ5M6MVX.js";
|
|
4
|
+
|
|
5
|
+
// src/components/MobileDataGrid/GridContextProvider/useGridContext.ts
|
|
6
|
+
import { useContext } from "react";
|
|
7
|
+
function useGridContext() {
|
|
8
|
+
const ctx = useContext(GridContext);
|
|
9
|
+
if (!ctx) {
|
|
10
|
+
throw new Error("useGridContext must be used within GridContextProvider");
|
|
11
|
+
}
|
|
12
|
+
return ctx;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
useGridContext
|
|
17
|
+
};
|
|
@@ -16,9 +16,10 @@ var ModalScrim = ({
|
|
|
16
16
|
id,
|
|
17
17
|
"data-testid": testid,
|
|
18
18
|
className: clsx(
|
|
19
|
-
"overflow-y-auto h-screen transition-[visibility,opacity,background] ease-in-out duration-100 grid place-content-center
|
|
19
|
+
"overflow-y-auto h-screen transition-[visibility,opacity,background] ease-in-out duration-100 grid place-content-center group bg-neutral-600/50 fixed opacity-0",
|
|
20
20
|
!show && " pointer-events-none",
|
|
21
21
|
size === "small" && "p-4",
|
|
22
|
+
size === "screen" ? "desktop:p-0" : "desktop:p-4",
|
|
22
23
|
"inset-0 z-50"
|
|
23
24
|
),
|
|
24
25
|
onMouseDown: onClick,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-ORMEWXMH.js";
|
|
6
|
+
|
|
7
|
+
// src/components/Surface.tsx
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var Surface = (_a) => {
|
|
11
|
+
var _b = _a, {
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
elevation = 0,
|
|
15
|
+
id
|
|
16
|
+
} = _b, props = __objRest(_b, [
|
|
17
|
+
"children",
|
|
18
|
+
"className",
|
|
19
|
+
"elevation",
|
|
20
|
+
"id"
|
|
21
|
+
]);
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"div",
|
|
24
|
+
__spreadProps(__spreadValues({
|
|
25
|
+
id,
|
|
26
|
+
className: clsx(
|
|
27
|
+
"rounded-base",
|
|
28
|
+
{
|
|
29
|
+
"shadow-2": elevation === 2,
|
|
30
|
+
"shadow-4": elevation === 4,
|
|
31
|
+
"shadow-16": elevation === 16
|
|
32
|
+
},
|
|
33
|
+
className
|
|
34
|
+
)
|
|
35
|
+
}, props), {
|
|
36
|
+
children
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
Surface.displayName = "Surface";
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
Surface
|
|
44
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Surface
|
|
3
|
+
} from "./chunk-AT4AWD6B.js";
|
|
4
|
+
import {
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "./chunk-ORMEWXMH.js";
|
|
7
|
+
|
|
8
|
+
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
function ZoomWindow({
|
|
12
|
+
image,
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
pointer,
|
|
16
|
+
active,
|
|
17
|
+
zoomFactor = 2,
|
|
18
|
+
scaleFactor = 2,
|
|
19
|
+
primaryImagePosition,
|
|
20
|
+
offset = 10,
|
|
21
|
+
className = ""
|
|
22
|
+
}) {
|
|
23
|
+
const imageSrc = useMemo(() => image == null ? void 0 : image.src, [image == null ? void 0 : image.src]);
|
|
24
|
+
if (!image || !active || !pointer) return null;
|
|
25
|
+
const zoomWindowSize = pointer.lensSize * scaleFactor;
|
|
26
|
+
const baseW = pointer.w || width;
|
|
27
|
+
const baseH = pointer.h || height;
|
|
28
|
+
const scaledW = baseW * zoomFactor;
|
|
29
|
+
const scaledH = baseH * zoomFactor;
|
|
30
|
+
const centerX = pointer.x * baseW * zoomFactor;
|
|
31
|
+
const centerY = pointer.y * baseH * zoomFactor;
|
|
32
|
+
const imageOffsetX = zoomWindowSize / 2 - centerX;
|
|
33
|
+
const imageOffsetY = zoomWindowSize / 2 - centerY;
|
|
34
|
+
const calculatePosition = () => {
|
|
35
|
+
if (!primaryImagePosition) {
|
|
36
|
+
return {
|
|
37
|
+
position: "fixed",
|
|
38
|
+
zIndex: 999,
|
|
39
|
+
top: "50%",
|
|
40
|
+
left: "50%",
|
|
41
|
+
transform: "translate(-50%, -50%)"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const lensLeft = primaryImagePosition.left + pointer.x * primaryImagePosition.width - pointer.lensSize / 2;
|
|
45
|
+
const lensTop = primaryImagePosition.top + pointer.y * primaryImagePosition.height - pointer.lensSize / 2;
|
|
46
|
+
let left = lensLeft + pointer.lensSize + offset;
|
|
47
|
+
let top = lensTop;
|
|
48
|
+
const { innerWidth, innerHeight } = window;
|
|
49
|
+
if (left + zoomWindowSize > innerWidth) {
|
|
50
|
+
left = lensLeft - zoomWindowSize - offset;
|
|
51
|
+
}
|
|
52
|
+
if (top + zoomWindowSize > innerHeight) {
|
|
53
|
+
top = lensTop + pointer.lensSize - zoomWindowSize;
|
|
54
|
+
}
|
|
55
|
+
if (top < 0) {
|
|
56
|
+
top = lensTop;
|
|
57
|
+
}
|
|
58
|
+
if (left < 0) {
|
|
59
|
+
left = lensLeft + pointer.lensSize + offset;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
position: "fixed",
|
|
63
|
+
zIndex: 999,
|
|
64
|
+
left,
|
|
65
|
+
top
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
Surface,
|
|
70
|
+
{
|
|
71
|
+
elevation: 16,
|
|
72
|
+
className,
|
|
73
|
+
style: __spreadValues({
|
|
74
|
+
width: zoomWindowSize,
|
|
75
|
+
height: zoomWindowSize,
|
|
76
|
+
position: "fixed",
|
|
77
|
+
zIndex: 999,
|
|
78
|
+
overflow: "hidden",
|
|
79
|
+
pointerEvents: "none",
|
|
80
|
+
userSelect: "none"
|
|
81
|
+
}, calculatePosition()),
|
|
82
|
+
"aria-hidden": true,
|
|
83
|
+
children: /* @__PURE__ */ jsx(
|
|
84
|
+
"img",
|
|
85
|
+
{
|
|
86
|
+
src: imageSrc,
|
|
87
|
+
alt: "",
|
|
88
|
+
className: "pointer-events-none select-none max-w-none object-cover",
|
|
89
|
+
style: {
|
|
90
|
+
width: scaledW,
|
|
91
|
+
height: scaledH,
|
|
92
|
+
transform: `translate(${imageOffsetX}px, ${imageOffsetY}px)`
|
|
93
|
+
},
|
|
94
|
+
draggable: false,
|
|
95
|
+
loading: "lazy"
|
|
96
|
+
},
|
|
97
|
+
imageSrc
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
ZoomWindow
|
|
105
|
+
};
|