@dmsi/wedgekit-react 1.0.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classNames.d.ts +1 -0
- package/dist/classNames.d.ts.map +1 -1
- package/dist/classNames.js +150 -0
- package/dist/components/AccessCard.js +63 -0
- package/dist/components/AccessCardGroup.js +73 -0
- package/dist/components/AccessChangerTabItem.js +51 -0
- package/dist/components/Accordion.js +99 -0
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js +78 -0
- package/dist/components/Breadcrumbs.js +111 -0
- package/dist/components/Button.js +137 -0
- package/dist/components/CalendarRange.js +405 -0
- package/dist/components/Caption.js +99 -0
- package/dist/components/Card.js +50 -0
- package/dist/components/Checkbox.js +108 -0
- package/dist/components/CompactImagesPreview.d.ts.map +1 -1
- package/dist/components/CompactImagesPreview.js +120 -0
- package/dist/components/ContentTab.js +68 -0
- package/dist/components/ContentTabs.js +96 -0
- package/dist/components/DMSiLogo.js +54 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +27 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +79 -0
- package/dist/components/DataGrid/PinnedColumns.d.ts +9 -2
- package/dist/components/DataGrid/PinnedColumns.d.ts.map +1 -1
- package/dist/components/DataGrid/PinnedColumns.js +165 -0
- package/dist/components/DataGrid/SummaryRow/SummaryCell.d.ts +18 -0
- package/dist/components/DataGrid/SummaryRow/SummaryCell.d.ts.map +1 -0
- package/dist/components/DataGrid/SummaryRow/SummaryCell.js +51 -0
- package/dist/components/DataGrid/SummaryRow/aggregations.d.ts +39 -0
- package/dist/components/DataGrid/SummaryRow/aggregations.d.ts.map +1 -0
- package/dist/components/DataGrid/SummaryRow/aggregations.js +55 -0
- package/dist/components/DataGrid/SummaryRow/index.d.ts +18 -0
- package/dist/components/DataGrid/SummaryRow/index.d.ts.map +1 -0
- package/dist/components/DataGrid/SummaryRow/index.js +86 -0
- package/dist/components/DataGrid/TableBody/GroupRow.d.ts +18 -0
- package/dist/components/DataGrid/TableBody/GroupRow.d.ts.map +1 -0
- package/dist/components/DataGrid/TableBody/GroupRow.js +243 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.js +33 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.d.ts +3 -2
- package/dist/components/DataGrid/TableBody/TableBodyRow.d.ts.map +1 -1
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +136 -0
- package/dist/components/DataGrid/TableBody/index.d.ts +3 -1
- package/dist/components/DataGrid/TableBody/index.d.ts.map +1 -1
- package/dist/components/DataGrid/TableBody/index.js +161 -0
- package/dist/components/DataGrid/index.d.ts +1 -1
- package/dist/components/DataGrid/index.d.ts.map +1 -1
- package/dist/components/DataGrid/index.js +696 -0
- package/dist/components/DataGrid/types.d.ts +141 -1
- package/dist/components/DataGrid/types.d.ts.map +1 -1
- package/dist/components/DataGrid/utils.d.ts +2 -0
- package/dist/components/DataGrid/utils.d.ts.map +1 -1
- package/dist/components/DataGrid/utils.js +20 -0
- package/dist/components/DataGridCell.d.ts +5 -2
- package/dist/components/DataGridCell.d.ts.map +1 -1
- package/dist/components/DataGridCell.js +412 -0
- package/dist/components/DataTable.js +700 -0
- package/dist/components/DateInput.js +193 -0
- package/dist/components/DateRangeInput.js +368 -0
- package/dist/components/DebugJson.js +28 -0
- package/dist/components/Display.js +46 -0
- package/dist/components/EditingContext.js +34 -0
- package/dist/components/EmblaCarousel/ArrowButtons.js +83 -0
- package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +12 -0
- package/dist/components/EmblaCarousel/index.js +153 -0
- package/dist/components/EmblaCarousel/usePrevNextButtons.js +21 -0
- package/dist/components/EmblaCarousel/useSelectedSnapDisplay.js +15 -0
- package/dist/components/EmptyCartIcon.js +25 -0
- package/dist/components/FilterGroup.d.ts +5 -3
- package/dist/components/FilterGroup.d.ts.map +1 -1
- package/dist/components/FilterGroup.js +198 -0
- package/dist/components/FullViewportBox.js +19 -0
- package/dist/components/Grid.js +54 -0
- package/dist/components/Heading.js +50 -0
- package/dist/components/HorizontalDivider.js +20 -0
- package/dist/components/Icon.d.ts +5 -2
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +73 -0
- package/dist/components/ImagePlaceholder.js +22 -0
- package/dist/components/Input.d.ts +11 -9
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +469 -0
- package/dist/components/InputGroup.js +45 -0
- package/dist/components/Label.js +37 -0
- package/dist/components/Link.js +69 -0
- package/dist/components/List.js +12 -0
- package/dist/components/ListGroup.d.ts.map +1 -1
- package/dist/components/ListGroup.js +54 -0
- package/dist/components/LiveChatComponent.js +25 -0
- package/dist/components/LoadingScrim.js +22 -0
- package/dist/components/LogoAgilityTopBar.js +90 -0
- package/dist/components/LogoDMSiTopBar.js +54 -0
- package/dist/components/LogoMillworkTopBar.js +196 -0
- package/dist/components/MainBar.js +58 -0
- package/dist/components/MaxViewportBox.js +19 -0
- package/dist/components/Menu.d.ts.map +1 -1
- package/dist/components/Menu.js +202 -0
- package/dist/components/MenuOption.js +161 -0
- package/dist/components/MobileDataGrid/ColumnList.js +85 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +100 -0
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +6 -0
- package/dist/components/MobileDataGrid/GridContextProvider/index.js +80 -0
- package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.js +11 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +18 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.d.ts +2 -1
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +130 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +67 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +42 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +58 -0
- package/dist/components/MobileDataGrid/dataGridReducer.js +28 -0
- package/dist/components/MobileDataGrid/index.d.ts +1 -1
- package/dist/components/MobileDataGrid/index.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/index.js +78 -0
- package/dist/components/MobileNavMenu.d.ts.map +1 -1
- package/dist/components/MobileNavMenu.js +173 -0
- package/dist/components/Modal.d.ts +1 -2
- package/dist/components/Modal.d.ts.map +1 -1
- package/dist/components/Modal.js +201 -0
- package/dist/components/ModalButtons.d.ts.map +1 -1
- package/dist/components/ModalButtons.js +57 -0
- package/dist/components/ModalContent.d.ts +1 -2
- package/dist/components/ModalContent.d.ts.map +1 -1
- package/dist/components/ModalContent.js +24 -0
- package/dist/components/ModalHeader.js +74 -0
- package/dist/components/ModalScrim.js +32 -0
- package/dist/components/NavigationTab.js +72 -0
- package/dist/components/NavigationTabs.js +45 -0
- package/dist/components/NestedMenu.d.ts.map +1 -1
- package/dist/components/NestedMenu.js +119 -0
- package/dist/components/Notification.js +91 -0
- package/dist/components/OptionPill.d.ts +2 -1
- package/dist/components/OptionPill.d.ts.map +1 -1
- package/dist/components/OptionPill.js +103 -0
- package/dist/components/OrderCheckIcon.js +28 -0
- package/dist/components/PDFViewer/DownloadIcon.js +25 -0
- package/dist/components/PDFViewer/PDFElement.js +77 -0
- package/dist/components/PDFViewer/PDFNavigation.js +64 -0
- package/dist/components/PDFViewer/PDFPage.js +28 -0
- package/dist/components/PDFViewer/index.d.ts.map +1 -1
- package/dist/components/PDFViewer/index.js +124 -0
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +117 -0
- package/dist/components/Paragraph.js +43 -0
- package/dist/components/Password.js +47 -0
- package/dist/components/ProductImagePreview/CarouselPagination.js +48 -0
- package/dist/components/ProductImagePreview/MobileImageCarousel.d.ts +2 -1
- package/dist/components/ProductImagePreview/MobileImageCarousel.d.ts.map +1 -1
- package/dist/components/ProductImagePreview/MobileImageCarousel.js +146 -0
- package/dist/components/ProductImagePreview/ProductPrimaryImage.d.ts +2 -1
- package/dist/components/ProductImagePreview/ProductPrimaryImage.d.ts.map +1 -1
- package/dist/components/ProductImagePreview/ProductPrimaryImage.js +138 -0
- package/dist/components/ProductImagePreview/Thumbnail.d.ts +2 -1
- package/dist/components/ProductImagePreview/Thumbnail.d.ts.map +1 -1
- package/dist/components/ProductImagePreview/Thumbnail.js +46 -0
- package/dist/components/ProductImagePreview/ZoomWindow.js +74 -0
- package/dist/components/ProductImagePreview/index.d.ts.map +1 -1
- package/dist/components/ProductImagePreview/index.js +189 -0
- package/dist/components/ProductImagePreview/useProductImagePreview.js +85 -0
- package/dist/components/ProjectBar.d.ts +1 -1
- package/dist/components/ProjectBar.js +54 -0
- package/dist/components/Radio.js +113 -0
- package/dist/components/Search.js +89 -0
- package/dist/components/SearchResultImage/index.js +26 -0
- package/dist/components/Select.js +122 -0
- package/dist/components/SideMenu.js +24 -0
- package/dist/components/SideMenuGroup.js +80 -0
- package/dist/components/SideMenuItem.js +79 -0
- package/dist/components/SimpleTable.js +60 -0
- package/dist/components/SkeletonParagraph.js +24 -0
- package/dist/components/Spinner.d.ts +1 -1
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner.js +30 -0
- package/dist/components/Stack.js +174 -0
- package/dist/components/StatusPill.js +44 -0
- package/dist/components/Stepper.js +138 -0
- package/dist/components/Subheader.d.ts +2 -1
- package/dist/components/Subheader.d.ts.map +1 -1
- package/dist/components/Subheader.js +41 -0
- package/dist/components/Surface.js +30 -0
- package/dist/components/Swatch.js +1498 -0
- package/dist/components/Textarea.js +106 -0
- package/dist/components/Theme.d.ts +1 -1
- package/dist/components/Theme.d.ts.map +1 -1
- package/dist/components/Theme.js +25 -0
- package/dist/components/Time.d.ts +2 -1
- package/dist/components/Time.d.ts.map +1 -1
- package/dist/components/Time.js +225 -0
- package/dist/components/Toast.d.ts +4 -3
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +170 -0
- package/dist/components/Tooltip.js +102 -0
- package/dist/components/TopBar.d.ts.map +1 -1
- package/dist/components/TopBar.js +119 -0
- package/dist/components/Upload.js +107 -0
- package/dist/components/WorldpayIframe.d.ts.map +1 -1
- package/dist/components/WorldpayIframe.js +19 -0
- package/dist/hooks/useEditCell.js +23 -0
- package/dist/hooks/useInfiniteScroll.js +25 -0
- package/dist/hooks/useKeydown.js +20 -0
- package/dist/hooks/useMatchesMedia.js +15 -0
- package/dist/hooks/useMenuSystem.js +186 -0
- package/dist/hooks/useMounted.js +9 -0
- package/dist/hooks/useTableLayout/computeColumns.js +59 -0
- package/dist/hooks/useTableLayout/storage.js +64 -0
- package/dist/hooks/useTableLayout/useTableLayout.js +163 -0
- package/dist/index.js +249 -52864
- package/dist/lib/loadFonts.js +11 -0
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2299 -0
- package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +367 -0
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
- package/dist/node_modules/@headlessui/react/dist/components/description/description.js +45 -0
- package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/components/label/label.js +62 -0
- package/dist/node_modules/@headlessui/react/dist/components/switch/switch.js +56 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-active-press.js +33 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +10 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-default-value.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +12 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-slot.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +16 -0
- package/dist/node_modules/@headlessui/react/dist/internal/disabled.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/internal/form-fields.js +35 -0
- package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +13 -0
- package/dist/node_modules/@headlessui/react/dist/internal/id.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +19 -0
- package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +40 -0
- package/dist/node_modules/@headlessui/react/dist/utils/dom.js +34 -0
- package/dist/node_modules/@headlessui/react/dist/utils/env.js +34 -0
- package/dist/node_modules/@headlessui/react/dist/utils/form.js +32 -0
- package/dist/node_modules/@headlessui/react/dist/utils/match.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/owner.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/render.js +126 -0
- package/dist/node_modules/@js-temporal/polyfill/dist/index.esm.js +3913 -0
- package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +83 -0
- package/dist/node_modules/@react-aria/focus/dist/useFocusRing.js +38 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocus.js +31 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +99 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.js +59 -0
- package/dist/node_modules/@react-aria/interactions/dist/useHover.js +86 -0
- package/dist/node_modules/@react-aria/interactions/dist/utils.js +68 -0
- package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +32 -0
- package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +15 -0
- package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +45 -0
- package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +7 -0
- package/dist/node_modules/@react-aria/utils/dist/openLink.js +28 -0
- package/dist/node_modules/@react-aria/utils/dist/platform.js +47 -0
- package/dist/node_modules/@react-aria/utils/dist/useGlobalListeners.js +34 -0
- package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +6 -0
- package/dist/node_modules/@react-stately/flags/dist/import.js +7 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +94 -0
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +38 -0
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1954 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +575 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
- package/dist/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1204 -0
- package/dist/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js +126 -0
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +24 -0
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +35 -0
- package/dist/node_modules/jsbi/dist/jsbi.js +1040 -0
- package/dist/node_modules/react-use/esm/usePrevious.js +10 -0
- package/dist/static/no-results-image.png.js +4 -0
- package/dist/styles.css +1 -1
- package/dist/utils/date-patch-dashes.js +28 -0
- package/dist/utils/date.js +95 -0
- package/dist/utils/formatting.js +22 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/mergeObjectArrays.js +18 -0
- package/dist/utils.js +20 -0
- package/package.json +1 -1
- /package/dist/{pdf-l6QfMa5e.js → node_modules/pdfjs-dist/build/pdf.js} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsxs as b, jsx as Y } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useState as _, useMemo as G, useCallback as d, useEffect as J } from "react";
|
|
3
|
+
const R = "/placeholder.svg";
|
|
4
|
+
function Q({
|
|
5
|
+
image: p,
|
|
6
|
+
width: u,
|
|
7
|
+
height: f,
|
|
8
|
+
zoomEnabled: n = !1,
|
|
9
|
+
zoomLensSize: c = 140,
|
|
10
|
+
scrollToZoomEnabled: m = !1,
|
|
11
|
+
className: W = "",
|
|
12
|
+
isPlaceholder: y = !1,
|
|
13
|
+
onImageError: j,
|
|
14
|
+
onZoomPositionChange: s,
|
|
15
|
+
onScrollZoom: N
|
|
16
|
+
}) {
|
|
17
|
+
const h = M(null), i = M(null), g = M(null), [a, P] = _(!1), [, X] = _(0), o = G(() => p?.src, [p?.src]), k = () => {
|
|
18
|
+
g.current == null && (g.current = requestAnimationFrame(() => {
|
|
19
|
+
g.current = null, X((t) => t + 1);
|
|
20
|
+
}));
|
|
21
|
+
}, A = d(() => {
|
|
22
|
+
if (!n) return;
|
|
23
|
+
P(!0);
|
|
24
|
+
const t = h.current;
|
|
25
|
+
if (t) {
|
|
26
|
+
const r = t.getBoundingClientRect(), e = i.current;
|
|
27
|
+
s?.(
|
|
28
|
+
e ? { ...e, w: r.width, h: r.height, lensSize: c } : null,
|
|
29
|
+
!0
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}, [n, s, c]), B = d(() => {
|
|
33
|
+
n && (P(!1), i.current = null, s?.(null, !1));
|
|
34
|
+
}, [n, s]), F = d(
|
|
35
|
+
(t) => {
|
|
36
|
+
if (y || !n || !a || t.pointerType === "touch") return;
|
|
37
|
+
const r = h.current;
|
|
38
|
+
if (!r) return;
|
|
39
|
+
const e = r.getBoundingClientRect(), x = (t.clientX - e.left) / e.width, I = (t.clientY - e.top) / e.height, l = c ?? 140, q = Math.max(
|
|
40
|
+
0,
|
|
41
|
+
Math.min(e.width - l, x * e.width - l / 2)
|
|
42
|
+
), D = Math.max(
|
|
43
|
+
0,
|
|
44
|
+
Math.min(e.height - l, I * e.height - l / 2)
|
|
45
|
+
), T = (q + l / 2) / e.width, U = (D + l / 2) / e.height;
|
|
46
|
+
i.current = {
|
|
47
|
+
x: T,
|
|
48
|
+
y: U
|
|
49
|
+
}, k(), s?.(
|
|
50
|
+
i.current ? {
|
|
51
|
+
...i.current,
|
|
52
|
+
w: e.width,
|
|
53
|
+
h: e.height,
|
|
54
|
+
lensSize: c
|
|
55
|
+
} : null,
|
|
56
|
+
!0
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
[y, n, a, c, s]
|
|
60
|
+
);
|
|
61
|
+
J(() => {
|
|
62
|
+
const t = h.current;
|
|
63
|
+
if (!t || !m) return;
|
|
64
|
+
const r = (e) => {
|
|
65
|
+
if (e.preventDefault(), e.stopPropagation(), !n || !a) return;
|
|
66
|
+
const x = e.deltaY > 0 ? -0.2 : 0.2;
|
|
67
|
+
N?.(x);
|
|
68
|
+
};
|
|
69
|
+
return t.addEventListener("wheel", r, { passive: !1 }), () => {
|
|
70
|
+
t.removeEventListener("wheel", r);
|
|
71
|
+
};
|
|
72
|
+
}, [m, n, a, N]);
|
|
73
|
+
const H = d(
|
|
74
|
+
(t) => {
|
|
75
|
+
j?.(o);
|
|
76
|
+
const r = t.currentTarget;
|
|
77
|
+
r.src !== R && (r.src = R);
|
|
78
|
+
},
|
|
79
|
+
[o, j]
|
|
80
|
+
), v = i.current;
|
|
81
|
+
let w;
|
|
82
|
+
if (v && a && n) {
|
|
83
|
+
const t = c, r = v.x * u - t / 2, e = v.y * f - t / 2;
|
|
84
|
+
w = {
|
|
85
|
+
width: t,
|
|
86
|
+
height: t,
|
|
87
|
+
left: Math.max(0, Math.min(u - t, r)),
|
|
88
|
+
top: Math.max(0, Math.min(f - t, e))
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ b(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
ref: h,
|
|
95
|
+
className: [
|
|
96
|
+
"relative overflow-hidden bg-white rounded flex items-center justify-center select-none",
|
|
97
|
+
n ? "cursor-crosshair" : "",
|
|
98
|
+
W
|
|
99
|
+
].join(" "),
|
|
100
|
+
onPointerEnter: A,
|
|
101
|
+
onPointerLeave: B,
|
|
102
|
+
onPointerMove: F,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ Y(
|
|
105
|
+
"img",
|
|
106
|
+
{
|
|
107
|
+
src: o ?? R,
|
|
108
|
+
alt: p?.alt || "Product image",
|
|
109
|
+
style: {
|
|
110
|
+
maxWidth: u,
|
|
111
|
+
maxHeight: f,
|
|
112
|
+
minWidth: u,
|
|
113
|
+
minHeight: f,
|
|
114
|
+
aspectRatio: "1 / 1",
|
|
115
|
+
objectFit: "contain",
|
|
116
|
+
userSelect: "none"
|
|
117
|
+
},
|
|
118
|
+
draggable: !1,
|
|
119
|
+
loading: "lazy",
|
|
120
|
+
onError: H
|
|
121
|
+
},
|
|
122
|
+
o
|
|
123
|
+
),
|
|
124
|
+
n && a && w && /* @__PURE__ */ Y(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
"aria-hidden": !0,
|
|
128
|
+
className: "absolute pointer-events-none border border-white/70 shadow-[0_0_0_1px_rgba(0,0,0,0.15)] rounded-md bg-white/10 backdrop-blur-[1px]",
|
|
129
|
+
style: w
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
Q as ProductPrimaryImage
|
|
138
|
+
};
|
|
@@ -6,6 +6,7 @@ export type ThumbnailProps = {
|
|
|
6
6
|
isActive?: boolean;
|
|
7
7
|
isPlaceholder?: boolean;
|
|
8
8
|
onClick?: () => void;
|
|
9
|
+
onImageError?: (src: string) => void;
|
|
9
10
|
};
|
|
10
|
-
export declare function Thumbnail({ width, height, src, alt, isActive, onClick, isPlaceholder, }: ThumbnailProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Thumbnail({ width, height, src, alt, isActive, onClick, isPlaceholder, onImageError, }: ThumbnailProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
//# sourceMappingURL=Thumbnail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Thumbnail.d.ts","sourceRoot":"","sources":["../../../src/components/ProductImagePreview/Thumbnail.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Thumbnail.d.ts","sourceRoot":"","sources":["../../../src/components/ProductImagePreview/Thumbnail.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,QAAQ,EACR,OAAO,EACP,aAAqB,EACrB,YAAY,GACb,EAAE,cAAc,2CAkChB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u } from "react";
|
|
3
|
+
import { ImagePlaceholder as g } from "../ImagePlaceholder.js";
|
|
4
|
+
function h({
|
|
5
|
+
width: a,
|
|
6
|
+
height: n,
|
|
7
|
+
src: o,
|
|
8
|
+
alt: i,
|
|
9
|
+
isActive: t,
|
|
10
|
+
onClick: l,
|
|
11
|
+
isPlaceholder: e = !1,
|
|
12
|
+
onImageError: s
|
|
13
|
+
}) {
|
|
14
|
+
const [f, m] = u(!1);
|
|
15
|
+
return /* @__PURE__ */ r(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
onClick: l,
|
|
20
|
+
className: [
|
|
21
|
+
"cursor-pointer relative overflow-hidden rounded aspect-square w-full",
|
|
22
|
+
// base radius, square when no explicit size
|
|
23
|
+
"focus:outline-none",
|
|
24
|
+
t && !e && "ring-[3px] ring-offset-1 ring-border-action-normal ring-offset-white opacity-70"
|
|
25
|
+
].join(" "),
|
|
26
|
+
style: { maxWidth: a, maxHeight: n, aspectRatio: "1 / 1" },
|
|
27
|
+
"aria-pressed": t && !e ? "true" : "false",
|
|
28
|
+
children: e ? /* @__PURE__ */ r(g, { width: 115, height: 115 }) : /* @__PURE__ */ r(
|
|
29
|
+
"img",
|
|
30
|
+
{
|
|
31
|
+
src: f ? "/placeholder.svg" : o,
|
|
32
|
+
alt: i,
|
|
33
|
+
className: "object-contain w-full h-full select-none",
|
|
34
|
+
draggable: !1,
|
|
35
|
+
loading: "lazy",
|
|
36
|
+
onError: () => {
|
|
37
|
+
s?.(o), m(!0);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
h as Thumbnail
|
|
46
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as Y } from "react";
|
|
3
|
+
import { Surface as $ } from "../Surface.js";
|
|
4
|
+
function N({
|
|
5
|
+
image: i,
|
|
6
|
+
width: u,
|
|
7
|
+
height: w,
|
|
8
|
+
pointer: e,
|
|
9
|
+
active: S,
|
|
10
|
+
zoomFactor: c = 2,
|
|
11
|
+
scaleFactor: z = 2,
|
|
12
|
+
primaryImagePosition: t,
|
|
13
|
+
offset: o = 10,
|
|
14
|
+
className: g = ""
|
|
15
|
+
}) {
|
|
16
|
+
const a = Y(() => i?.src, [i?.src]);
|
|
17
|
+
if (!i || !S || !e) return null;
|
|
18
|
+
const n = e.lensSize * z, r = e.w || u, h = e.h || w, v = r * c, W = h * c, b = e.x * r * c, m = e.y * h * c, H = n / 2 - b, j = n / 2 - m;
|
|
19
|
+
return /* @__PURE__ */ x(
|
|
20
|
+
$,
|
|
21
|
+
{
|
|
22
|
+
elevation: 16,
|
|
23
|
+
className: g,
|
|
24
|
+
style: {
|
|
25
|
+
width: n,
|
|
26
|
+
height: n,
|
|
27
|
+
position: "fixed",
|
|
28
|
+
zIndex: 999,
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
pointerEvents: "none",
|
|
31
|
+
userSelect: "none",
|
|
32
|
+
...(() => {
|
|
33
|
+
if (!t)
|
|
34
|
+
return {
|
|
35
|
+
position: "fixed",
|
|
36
|
+
zIndex: 999,
|
|
37
|
+
top: "50%",
|
|
38
|
+
left: "50%",
|
|
39
|
+
transform: "translate(-50%, -50%)"
|
|
40
|
+
};
|
|
41
|
+
const d = t.left + e.x * t.width - e.lensSize / 2, f = t.top + e.y * t.height - e.lensSize / 2;
|
|
42
|
+
let s = d + e.lensSize + o, l = f;
|
|
43
|
+
const { innerWidth: O, innerHeight: X } = window;
|
|
44
|
+
return s + n > O && (s = d - n - o), l + n > X && (l = f + e.lensSize - n), l < 0 && (l = f), s < 0 && (s = d + e.lensSize + o), {
|
|
45
|
+
position: "fixed",
|
|
46
|
+
zIndex: 999,
|
|
47
|
+
left: s,
|
|
48
|
+
top: l
|
|
49
|
+
};
|
|
50
|
+
})()
|
|
51
|
+
},
|
|
52
|
+
"aria-hidden": !0,
|
|
53
|
+
children: /* @__PURE__ */ x(
|
|
54
|
+
"img",
|
|
55
|
+
{
|
|
56
|
+
src: a,
|
|
57
|
+
alt: "",
|
|
58
|
+
className: "pointer-events-none select-none max-w-none object-cover",
|
|
59
|
+
style: {
|
|
60
|
+
width: v,
|
|
61
|
+
height: W,
|
|
62
|
+
transform: `translate(${H}px, ${j}px)`
|
|
63
|
+
},
|
|
64
|
+
draggable: !1,
|
|
65
|
+
loading: "lazy"
|
|
66
|
+
},
|
|
67
|
+
a
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
N as ZoomWindow
|
|
74
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProductImagePreview/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProductImagePreview/index.tsx"],"names":[],"mappings":"AAwBA,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,8GAA8G;AAC9G,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,kDAqMlE"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx as r, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { Thumbnail as x } from "./Thumbnail.js";
|
|
3
|
+
import { Stack as $ } from "../Stack.js";
|
|
4
|
+
import { Grid as D } from "../Grid.js";
|
|
5
|
+
import { ProductPrimaryImage as G } from "./ProductPrimaryImage.js";
|
|
6
|
+
import { ZoomWindow as K } from "./ZoomWindow.js";
|
|
7
|
+
import { CarouselPagination as L } from "./CarouselPagination.js";
|
|
8
|
+
import { MobileImageCarousel as U } from "./MobileImageCarousel.js";
|
|
9
|
+
import { useMatchesMobile as V } from "../../hooks/useMatchesMedia.js";
|
|
10
|
+
import { useState as q, useMemo as P, useCallback as B, useEffect as H } from "react";
|
|
11
|
+
import { useProductImagePreview as J } from "./useProductImagePreview.js";
|
|
12
|
+
const y = "/placeholder.svg";
|
|
13
|
+
function Q(c) {
|
|
14
|
+
const a = c?.trim();
|
|
15
|
+
return !!a && a !== y && !a.endsWith("/placeholder.svg") && !a.includes("/placeholder.svg?");
|
|
16
|
+
}
|
|
17
|
+
function me(c) {
|
|
18
|
+
const {
|
|
19
|
+
width: a = 483,
|
|
20
|
+
height: d = 483,
|
|
21
|
+
thumbsPerRow: h = 4,
|
|
22
|
+
zoomEnabled: g = !1,
|
|
23
|
+
scrollToZoomEnabled: u = !1,
|
|
24
|
+
images: l,
|
|
25
|
+
currentIndex: z,
|
|
26
|
+
onChangeIndex: w,
|
|
27
|
+
zoomLensSize: E,
|
|
28
|
+
zoomFactor: S = 2,
|
|
29
|
+
zoomWindowScaleFactor: C = 2.5,
|
|
30
|
+
zoomWindowOffset: Z = 10,
|
|
31
|
+
testid: k
|
|
32
|
+
} = c, [f, p] = q([]), F = P(
|
|
33
|
+
() => l.map((e) => e.src).join("|"),
|
|
34
|
+
[l]
|
|
35
|
+
), t = P(
|
|
36
|
+
() => l.filter(
|
|
37
|
+
(e) => Q(e.src) && f.indexOf(e.src) === -1
|
|
38
|
+
),
|
|
39
|
+
[f, l]
|
|
40
|
+
), n = B((e) => {
|
|
41
|
+
e && p(
|
|
42
|
+
(o) => o.indexOf(e) >= 0 ? o : [...o, e]
|
|
43
|
+
);
|
|
44
|
+
}, []);
|
|
45
|
+
H(() => {
|
|
46
|
+
p([]);
|
|
47
|
+
}, [F]);
|
|
48
|
+
const i = V(), {
|
|
49
|
+
zoomPoint: W,
|
|
50
|
+
zoomActive: T,
|
|
51
|
+
currentZoomFactor: j,
|
|
52
|
+
primaryImagePosition: M,
|
|
53
|
+
safeIndex: m,
|
|
54
|
+
active: I,
|
|
55
|
+
primaryImageRef: N,
|
|
56
|
+
handleSelect: s,
|
|
57
|
+
handleZoomPositionChange: A,
|
|
58
|
+
handleScrollZoom: O
|
|
59
|
+
} = J({
|
|
60
|
+
images: t,
|
|
61
|
+
currentIndex: z,
|
|
62
|
+
zoomEnabled: g,
|
|
63
|
+
zoomFactor: S,
|
|
64
|
+
scrollToZoomEnabled: u,
|
|
65
|
+
onChangeIndex: w,
|
|
66
|
+
isMobile: i
|
|
67
|
+
});
|
|
68
|
+
if (typeof i > "u") return null;
|
|
69
|
+
if (i && !t.length)
|
|
70
|
+
return /* @__PURE__ */ r(
|
|
71
|
+
"img",
|
|
72
|
+
{
|
|
73
|
+
src: y,
|
|
74
|
+
alt: "Placeholder Image",
|
|
75
|
+
draggable: !1,
|
|
76
|
+
loading: "eager",
|
|
77
|
+
style: {
|
|
78
|
+
aspectRatio: "1 / 1",
|
|
79
|
+
objectFit: "cover",
|
|
80
|
+
height: "100%",
|
|
81
|
+
width: "100%"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const b = g && !i, R = t.length > 1;
|
|
86
|
+
return /* @__PURE__ */ v(
|
|
87
|
+
$,
|
|
88
|
+
{
|
|
89
|
+
sizing: "layout-group",
|
|
90
|
+
style: { width: a, position: "relative" },
|
|
91
|
+
testid: k,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ v("div", { className: "flex gap-4 items-start", children: [
|
|
94
|
+
/* @__PURE__ */ r("div", { ref: N, children: /* @__PURE__ */ r(
|
|
95
|
+
G,
|
|
96
|
+
{
|
|
97
|
+
image: I,
|
|
98
|
+
width: a,
|
|
99
|
+
height: d,
|
|
100
|
+
zoomEnabled: b,
|
|
101
|
+
zoomLensSize: E,
|
|
102
|
+
scrollToZoomEnabled: u && !i,
|
|
103
|
+
onZoomPositionChange: A,
|
|
104
|
+
onScrollZoom: O,
|
|
105
|
+
isPlaceholder: t.length === 0,
|
|
106
|
+
onImageError: n
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
b && /* @__PURE__ */ r(
|
|
110
|
+
K,
|
|
111
|
+
{
|
|
112
|
+
image: I,
|
|
113
|
+
width: a,
|
|
114
|
+
height: d,
|
|
115
|
+
pointer: W,
|
|
116
|
+
active: T,
|
|
117
|
+
zoomFactor: j,
|
|
118
|
+
scaleFactor: C,
|
|
119
|
+
primaryImagePosition: M,
|
|
120
|
+
offset: Z
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] }) }),
|
|
124
|
+
i && /* @__PURE__ */ r(
|
|
125
|
+
U,
|
|
126
|
+
{
|
|
127
|
+
images: t,
|
|
128
|
+
currentIndex: m,
|
|
129
|
+
width: a,
|
|
130
|
+
height: d,
|
|
131
|
+
onChangeIndex: s,
|
|
132
|
+
onImageError: n
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
R && /* @__PURE__ */ r("div", { className: "hidden md:block", children: t.length <= 3 ? /* @__PURE__ */ r(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: "flex justify-center gap-4",
|
|
139
|
+
style: { width: "100%", maxWidth: a },
|
|
140
|
+
"aria-label": "Product image thumbnails",
|
|
141
|
+
children: t.map((e, o) => /* @__PURE__ */ r("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ r(
|
|
142
|
+
x,
|
|
143
|
+
{
|
|
144
|
+
src: e.src,
|
|
145
|
+
alt: e.alt || `Thumbnail ${o + 1}`,
|
|
146
|
+
isActive: o === m,
|
|
147
|
+
onClick: () => s(o),
|
|
148
|
+
onImageError: n
|
|
149
|
+
}
|
|
150
|
+
) }, e.src + o))
|
|
151
|
+
}
|
|
152
|
+
) : /* @__PURE__ */ r(
|
|
153
|
+
D,
|
|
154
|
+
{
|
|
155
|
+
sizing: "layout-group",
|
|
156
|
+
"aria-label": "Product image thumbnails",
|
|
157
|
+
style: {
|
|
158
|
+
width: "100%",
|
|
159
|
+
maxWidth: a
|
|
160
|
+
},
|
|
161
|
+
columns: h > 12 ? 12 : h < 1 ? 1 : h,
|
|
162
|
+
children: t.map((e, o) => /* @__PURE__ */ r(
|
|
163
|
+
x,
|
|
164
|
+
{
|
|
165
|
+
src: e.src,
|
|
166
|
+
alt: e.alt || `Thumbnail ${o + 1}`,
|
|
167
|
+
isActive: o === m,
|
|
168
|
+
onClick: () => s(o),
|
|
169
|
+
onImageError: n
|
|
170
|
+
},
|
|
171
|
+
e.src + o
|
|
172
|
+
))
|
|
173
|
+
}
|
|
174
|
+
) }),
|
|
175
|
+
/* @__PURE__ */ r(
|
|
176
|
+
L,
|
|
177
|
+
{
|
|
178
|
+
images: t,
|
|
179
|
+
currentIndex: m,
|
|
180
|
+
onSelect: s
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
me as ProductImagePreview
|
|
189
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useMemo as O, useState as u, useRef as P, useEffect as Z, useCallback as i } from "react";
|
|
2
|
+
function B(b) {
|
|
3
|
+
const {
|
|
4
|
+
images: o,
|
|
5
|
+
currentIndex: m,
|
|
6
|
+
zoomEnabled: E = !1,
|
|
7
|
+
zoomFactor: d = 2,
|
|
8
|
+
scrollToZoomEnabled: p = !1,
|
|
9
|
+
onChangeIndex: s,
|
|
10
|
+
isMobile: a = !1
|
|
11
|
+
} = b, r = !!o?.length, n = r && m >= 0 && m < o.length ? m : 0, x = O(() => r ? o[n] : void 0, [r, o, n]), [z, F] = u(null), [C, R] = u(!1), [f, g] = u(d), [A, L] = u(null), v = P(null), l = P(null), h = E && !a, w = p && !a;
|
|
12
|
+
Z(() => {
|
|
13
|
+
if (!h) return;
|
|
14
|
+
const e = () => {
|
|
15
|
+
const t = v.current;
|
|
16
|
+
if (!t) return;
|
|
17
|
+
const c = () => {
|
|
18
|
+
t && L(t.getBoundingClientRect());
|
|
19
|
+
};
|
|
20
|
+
c();
|
|
21
|
+
const I = new ResizeObserver(c);
|
|
22
|
+
I.observe(t), window.addEventListener("scroll", c), window.addEventListener("resize", c), l.current = () => {
|
|
23
|
+
I.disconnect(), window.removeEventListener("scroll", c), window.removeEventListener("resize", c);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
if (v.current)
|
|
27
|
+
e();
|
|
28
|
+
else {
|
|
29
|
+
const t = requestAnimationFrame(e);
|
|
30
|
+
return () => cancelAnimationFrame(t);
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
l.current && (l.current(), l.current = null);
|
|
34
|
+
};
|
|
35
|
+
}, [h]);
|
|
36
|
+
const M = i(
|
|
37
|
+
(e) => {
|
|
38
|
+
e !== n && s(e);
|
|
39
|
+
},
|
|
40
|
+
[n, s]
|
|
41
|
+
), S = i(() => {
|
|
42
|
+
if (!r) return;
|
|
43
|
+
const e = (n + 1) % o.length;
|
|
44
|
+
s(e);
|
|
45
|
+
}, [r, n, o.length, s]), y = i(() => {
|
|
46
|
+
if (!r) return;
|
|
47
|
+
const e = n === 0 ? o.length - 1 : n - 1;
|
|
48
|
+
s(e);
|
|
49
|
+
}, [r, n, o.length, s]), T = i(
|
|
50
|
+
(e, t) => {
|
|
51
|
+
a || (F(e), R(t));
|
|
52
|
+
},
|
|
53
|
+
[a]
|
|
54
|
+
), k = i(
|
|
55
|
+
(e) => {
|
|
56
|
+
if (!w) return;
|
|
57
|
+
const t = Math.max(1, Math.min(5, f + e));
|
|
58
|
+
g(t);
|
|
59
|
+
},
|
|
60
|
+
[w, f]
|
|
61
|
+
);
|
|
62
|
+
return Z(() => {
|
|
63
|
+
g(d);
|
|
64
|
+
}, [d]), {
|
|
65
|
+
// State
|
|
66
|
+
zoomPoint: z,
|
|
67
|
+
zoomActive: C,
|
|
68
|
+
currentZoomFactor: f,
|
|
69
|
+
primaryImagePosition: A,
|
|
70
|
+
hasImages: r,
|
|
71
|
+
safeIndex: n,
|
|
72
|
+
active: x,
|
|
73
|
+
// Refs
|
|
74
|
+
primaryImageRef: v,
|
|
75
|
+
// Handlers
|
|
76
|
+
handleSelect: M,
|
|
77
|
+
handleZoomPositionChange: T,
|
|
78
|
+
handleScrollZoom: k,
|
|
79
|
+
handleNext: S,
|
|
80
|
+
handlePrevious: y
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
B as useProductImagePreview
|
|
85
|
+
};
|
|
@@ -7,6 +7,6 @@ type ProjectBarProps = {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
testid?: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function ProjectBar({ left, right, mobileLeft, mobileRight, id, testid, }: ComponentProps<
|
|
10
|
+
export declare function ProjectBar({ left, right, mobileLeft, mobileRight, id, testid, }: ComponentProps<'div'> & ProjectBarProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=ProjectBar.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as r } from "../node_modules/clsx/dist/clsx.js";
|
|
3
|
+
import { layoutGroupGap as a, paddingYUsingLayoutGroupGap as s, containerPaddingX as p, layoutGap as v } from "../classNames.js";
|
|
4
|
+
import { useMatchesMobile as u } from "../hooks/useMatchesMedia.js";
|
|
5
|
+
import "react";
|
|
6
|
+
function g({
|
|
7
|
+
left: c,
|
|
8
|
+
right: e,
|
|
9
|
+
mobileLeft: i,
|
|
10
|
+
mobileRight: l,
|
|
11
|
+
id: t,
|
|
12
|
+
testid: n
|
|
13
|
+
}) {
|
|
14
|
+
const d = u() ? {
|
|
15
|
+
"--color-background-primary-normal": "var(--color-brand-400)",
|
|
16
|
+
"--color-background-action-primary-normal": "var(--color-neutral-000)",
|
|
17
|
+
"--color-background-action-primary-hover": "var(--color-critical-100)",
|
|
18
|
+
"--color-background-action-primary-active": "var(--color-neutral-200)",
|
|
19
|
+
"--color-background-action-secondary-normal": "var(--color-brand-400)",
|
|
20
|
+
"--color-background-action-secondary-hover": "var(--color-critical-100)",
|
|
21
|
+
"--color-text-on-action-primary-normal": "var(--color-brand-400)",
|
|
22
|
+
"--color-text-primary-normal": "var(--color-neutral-000)",
|
|
23
|
+
"--color-text-action-primary-normal": "var(--color-neutral-000)",
|
|
24
|
+
"--color-text-action-primary-hover": "var(--color-critical-500)",
|
|
25
|
+
"--color-text-action-primary-active": "var(--color-critical-300)",
|
|
26
|
+
"--color-border-action-normal": "var(--color-neutral-000)",
|
|
27
|
+
"--color-border-action-hover": "var(--color-critical-500)",
|
|
28
|
+
"--color-border-action-active": "var(--color-critical-300)"
|
|
29
|
+
} : {};
|
|
30
|
+
return /* @__PURE__ */ m(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
id: t,
|
|
34
|
+
"data-testid": n,
|
|
35
|
+
style: { ...d },
|
|
36
|
+
className: r(
|
|
37
|
+
"flex items-center justify-between",
|
|
38
|
+
"bg-background-primary-normal text-text-primary-normal",
|
|
39
|
+
s,
|
|
40
|
+
p,
|
|
41
|
+
v
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ o("div", { className: r("hidden desktop:block flex-1 leading-[1]"), children: c }),
|
|
45
|
+
/* @__PURE__ */ o("div", { className: r("hidden desktop:flex items-center", a), children: e }),
|
|
46
|
+
/* @__PURE__ */ o("div", { className: r("flex flex-col desktop:hidden"), children: i }),
|
|
47
|
+
/* @__PURE__ */ o("div", { className: r("flex items-center desktop:hidden", a), children: l })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
g as ProjectBar
|
|
54
|
+
};
|