@dmsi/wedgekit-react 2.0.0 → 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.
Files changed (210) hide show
  1. package/dist/classNames.js +150 -0
  2. package/dist/components/AccessCard.js +63 -0
  3. package/dist/components/AccessCardGroup.js +73 -0
  4. package/dist/components/AccessChangerTabItem.js +51 -0
  5. package/dist/components/Accordion.js +99 -0
  6. package/dist/components/Alert.js +78 -0
  7. package/dist/components/Breadcrumbs.js +111 -0
  8. package/dist/components/Button.js +137 -0
  9. package/dist/components/CalendarRange.js +405 -0
  10. package/dist/components/Caption.js +99 -0
  11. package/dist/components/Card.js +50 -0
  12. package/dist/components/Checkbox.js +108 -0
  13. package/dist/components/CompactImagesPreview.js +120 -0
  14. package/dist/components/ContentTab.js +68 -0
  15. package/dist/components/ContentTabs.js +96 -0
  16. package/dist/components/DMSiLogo.js +54 -0
  17. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +27 -0
  18. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +79 -0
  19. package/dist/components/DataGrid/PinnedColumns.js +165 -0
  20. package/dist/components/DataGrid/SummaryRow/SummaryCell.js +51 -0
  21. package/dist/components/DataGrid/SummaryRow/aggregations.js +55 -0
  22. package/dist/components/DataGrid/SummaryRow/index.js +86 -0
  23. package/dist/components/DataGrid/TableBody/GroupRow.js +243 -0
  24. package/dist/components/DataGrid/TableBody/LoadingCell.js +33 -0
  25. package/dist/components/DataGrid/TableBody/TableBodyRow.js +136 -0
  26. package/dist/components/DataGrid/TableBody/index.js +161 -0
  27. package/dist/components/DataGrid/index.js +696 -0
  28. package/dist/components/DataGrid/utils.js +20 -0
  29. package/dist/components/DataGridCell.js +412 -0
  30. package/dist/components/DataTable.js +700 -0
  31. package/dist/components/DateInput.js +193 -0
  32. package/dist/components/DateRangeInput.js +368 -0
  33. package/dist/components/DebugJson.js +28 -0
  34. package/dist/components/Display.js +46 -0
  35. package/dist/components/EditingContext.js +34 -0
  36. package/dist/components/EmblaCarousel/ArrowButtons.js +83 -0
  37. package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +12 -0
  38. package/dist/components/EmblaCarousel/index.js +153 -0
  39. package/dist/components/EmblaCarousel/usePrevNextButtons.js +21 -0
  40. package/dist/components/EmblaCarousel/useSelectedSnapDisplay.js +15 -0
  41. package/dist/components/EmptyCartIcon.js +25 -0
  42. package/dist/components/FilterGroup.js +198 -0
  43. package/dist/components/FullViewportBox.js +19 -0
  44. package/dist/components/Grid.js +54 -0
  45. package/dist/components/Heading.js +50 -0
  46. package/dist/components/HorizontalDivider.js +20 -0
  47. package/dist/components/Icon.js +73 -0
  48. package/dist/components/ImagePlaceholder.js +22 -0
  49. package/dist/components/Input.js +469 -0
  50. package/dist/components/InputGroup.js +45 -0
  51. package/dist/components/Label.js +37 -0
  52. package/dist/components/Link.js +69 -0
  53. package/dist/components/List.js +12 -0
  54. package/dist/components/ListGroup.js +54 -0
  55. package/dist/components/LiveChatComponent.js +25 -0
  56. package/dist/components/LoadingScrim.js +22 -0
  57. package/dist/components/LogoAgilityTopBar.js +90 -0
  58. package/dist/components/LogoDMSiTopBar.js +54 -0
  59. package/dist/components/LogoMillworkTopBar.js +196 -0
  60. package/dist/components/MainBar.js +58 -0
  61. package/dist/components/MaxViewportBox.js +19 -0
  62. package/dist/components/Menu.js +202 -0
  63. package/dist/components/MenuOption.js +161 -0
  64. package/dist/components/MobileDataGrid/ColumnList.js +85 -0
  65. package/dist/components/MobileDataGrid/ColumnSelector/index.js +100 -0
  66. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -1
  67. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +6 -0
  68. package/dist/components/MobileDataGrid/GridContextProvider/index.js +80 -0
  69. package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.js +11 -0
  70. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +18 -0
  71. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +130 -0
  72. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +67 -0
  73. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +42 -0
  74. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +58 -0
  75. package/dist/components/MobileDataGrid/dataGridReducer.js +28 -0
  76. package/dist/components/MobileDataGrid/index.js +78 -0
  77. package/dist/components/MobileNavMenu.js +173 -0
  78. package/dist/components/Modal.js +201 -0
  79. package/dist/components/ModalButtons.js +57 -0
  80. package/dist/components/ModalContent.js +24 -0
  81. package/dist/components/ModalHeader.js +74 -0
  82. package/dist/components/ModalScrim.js +32 -0
  83. package/dist/components/NavigationTab.js +72 -0
  84. package/dist/components/NavigationTabs.js +45 -0
  85. package/dist/components/NestedMenu.js +119 -0
  86. package/dist/components/Notification.js +91 -0
  87. package/dist/components/OptionPill.js +103 -0
  88. package/dist/components/OrderCheckIcon.js +28 -0
  89. package/dist/components/PDFViewer/DownloadIcon.js +25 -0
  90. package/dist/components/PDFViewer/PDFElement.js +77 -0
  91. package/dist/components/PDFViewer/PDFNavigation.js +64 -0
  92. package/dist/components/PDFViewer/PDFPage.js +28 -0
  93. package/dist/components/PDFViewer/index.js +124 -0
  94. package/dist/components/Pagination.js +117 -0
  95. package/dist/components/Paragraph.js +43 -0
  96. package/dist/components/Password.js +47 -0
  97. package/dist/components/ProductImagePreview/CarouselPagination.js +48 -0
  98. package/dist/components/ProductImagePreview/MobileImageCarousel.js +146 -0
  99. package/dist/components/ProductImagePreview/ProductPrimaryImage.js +138 -0
  100. package/dist/components/ProductImagePreview/Thumbnail.js +46 -0
  101. package/dist/components/ProductImagePreview/ZoomWindow.js +74 -0
  102. package/dist/components/ProductImagePreview/index.js +189 -0
  103. package/dist/components/ProductImagePreview/useProductImagePreview.js +85 -0
  104. package/dist/components/ProjectBar.js +54 -0
  105. package/dist/components/Radio.js +113 -0
  106. package/dist/components/Search.js +89 -0
  107. package/dist/components/SearchResultImage/index.js +26 -0
  108. package/dist/components/Select.js +122 -0
  109. package/dist/components/SideMenu.js +24 -0
  110. package/dist/components/SideMenuGroup.js +80 -0
  111. package/dist/components/SideMenuItem.js +79 -0
  112. package/dist/components/SimpleTable.js +60 -0
  113. package/dist/components/SkeletonParagraph.js +24 -0
  114. package/dist/components/Spinner.js +30 -0
  115. package/dist/components/Stack.js +174 -0
  116. package/dist/components/StatusPill.js +44 -0
  117. package/dist/components/Stepper.js +138 -0
  118. package/dist/components/Subheader.js +41 -0
  119. package/dist/components/Surface.js +30 -0
  120. package/dist/components/Swatch.js +1498 -0
  121. package/dist/components/Textarea.js +106 -0
  122. package/dist/components/Theme.js +25 -0
  123. package/dist/components/Time.js +225 -0
  124. package/dist/components/Toast.js +170 -0
  125. package/dist/components/Tooltip.js +102 -0
  126. package/dist/components/TopBar.js +119 -0
  127. package/dist/components/Upload.js +107 -0
  128. package/dist/components/WorldpayIframe.js +19 -0
  129. package/dist/hooks/useEditCell.js +23 -0
  130. package/dist/hooks/useInfiniteScroll.js +25 -0
  131. package/dist/hooks/useKeydown.js +20 -0
  132. package/dist/hooks/useMatchesMedia.js +15 -0
  133. package/dist/hooks/useMenuSystem.js +186 -0
  134. package/dist/hooks/useMounted.js +9 -0
  135. package/dist/hooks/useTableLayout/computeColumns.js +59 -0
  136. package/dist/hooks/useTableLayout/storage.js +64 -0
  137. package/dist/hooks/useTableLayout/useTableLayout.js +163 -0
  138. package/dist/index.js +249 -53839
  139. package/dist/lib/loadFonts.js +11 -0
  140. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
  141. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2299 -0
  142. package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
  143. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +367 -0
  144. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
  145. package/dist/node_modules/@headlessui/react/dist/components/description/description.js +45 -0
  146. package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
  147. package/dist/node_modules/@headlessui/react/dist/components/label/label.js +62 -0
  148. package/dist/node_modules/@headlessui/react/dist/components/switch/switch.js +56 -0
  149. package/dist/node_modules/@headlessui/react/dist/hooks/use-active-press.js +33 -0
  150. package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +10 -0
  151. package/dist/node_modules/@headlessui/react/dist/hooks/use-default-value.js +8 -0
  152. package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +9 -0
  153. package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +9 -0
  154. package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +8 -0
  155. package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +11 -0
  156. package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +12 -0
  157. package/dist/node_modules/@headlessui/react/dist/hooks/use-slot.js +7 -0
  158. package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +16 -0
  159. package/dist/node_modules/@headlessui/react/dist/internal/disabled.js +8 -0
  160. package/dist/node_modules/@headlessui/react/dist/internal/form-fields.js +35 -0
  161. package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +13 -0
  162. package/dist/node_modules/@headlessui/react/dist/internal/id.js +8 -0
  163. package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +19 -0
  164. package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +6 -0
  165. package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +40 -0
  166. package/dist/node_modules/@headlessui/react/dist/utils/dom.js +34 -0
  167. package/dist/node_modules/@headlessui/react/dist/utils/env.js +34 -0
  168. package/dist/node_modules/@headlessui/react/dist/utils/form.js +32 -0
  169. package/dist/node_modules/@headlessui/react/dist/utils/match.js +11 -0
  170. package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +8 -0
  171. package/dist/node_modules/@headlessui/react/dist/utils/owner.js +8 -0
  172. package/dist/node_modules/@headlessui/react/dist/utils/render.js +126 -0
  173. package/dist/node_modules/@js-temporal/polyfill/dist/index.esm.js +3913 -0
  174. package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +83 -0
  175. package/dist/node_modules/@react-aria/focus/dist/useFocusRing.js +38 -0
  176. package/dist/node_modules/@react-aria/interactions/dist/useFocus.js +31 -0
  177. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +99 -0
  178. package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.js +59 -0
  179. package/dist/node_modules/@react-aria/interactions/dist/useHover.js +86 -0
  180. package/dist/node_modules/@react-aria/interactions/dist/utils.js +68 -0
  181. package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +32 -0
  182. package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +15 -0
  183. package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +45 -0
  184. package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +7 -0
  185. package/dist/node_modules/@react-aria/utils/dist/openLink.js +28 -0
  186. package/dist/node_modules/@react-aria/utils/dist/platform.js +47 -0
  187. package/dist/node_modules/@react-aria/utils/dist/useGlobalListeners.js +34 -0
  188. package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +6 -0
  189. package/dist/node_modules/@react-stately/flags/dist/import.js +7 -0
  190. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +94 -0
  191. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +38 -0
  192. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1954 -0
  193. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +575 -0
  194. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
  195. package/dist/node_modules/clsx/dist/clsx.js +17 -0
  196. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1204 -0
  197. package/dist/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js +126 -0
  198. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +24 -0
  199. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +35 -0
  200. package/dist/node_modules/jsbi/dist/jsbi.js +1040 -0
  201. package/dist/node_modules/react-use/esm/usePrevious.js +10 -0
  202. package/dist/static/no-results-image.png.js +4 -0
  203. package/dist/utils/date-patch-dashes.js +28 -0
  204. package/dist/utils/date.js +95 -0
  205. package/dist/utils/formatting.js +22 -0
  206. package/dist/utils/index.js +4 -0
  207. package/dist/utils/mergeObjectArrays.js +18 -0
  208. package/dist/utils.js +20 -0
  209. package/package.json +1 -1
  210. /package/dist/{pdf-l6QfMa5e.js → node_modules/pdfjs-dist/build/pdf.js} +0 -0
@@ -0,0 +1,43 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { clsx as d } from "../node_modules/clsx/dist/clsx.js";
3
+ import { typography as f, componentPaddingXUsingComponentGap as h } from "../classNames.js";
4
+ function w({
5
+ className: o,
6
+ color: e,
7
+ padded: a,
8
+ align: t = "left",
9
+ tall: n,
10
+ addOverflow: p,
11
+ children: i,
12
+ as: l = "p",
13
+ id: m,
14
+ testid: s,
15
+ ...r
16
+ }) {
17
+ return /* @__PURE__ */ c(
18
+ l,
19
+ {
20
+ id: m,
21
+ "data-testid": s,
22
+ ...r,
23
+ className: d(
24
+ f.paragraph,
25
+ o,
26
+ a && h,
27
+ t === "left" && "text-left",
28
+ t === "center" && "text-center",
29
+ t === "right" && "text-right",
30
+ n && "!leading-6",
31
+ p && "whitespace-nowrap text-ellipsis overflow-hidden"
32
+ ),
33
+ style: {
34
+ ...r.style,
35
+ color: e ? `var(--color-${e})` : void 0
36
+ },
37
+ children: i
38
+ }
39
+ );
40
+ }
41
+ export {
42
+ w as Paragraph
43
+ };
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { useState as m } from "react";
4
+ import { InputBase as a } from "./Input.js";
5
+ import { Icon as s } from "./Icon.js";
6
+ import { Tooltip as l } from "./Tooltip.js";
7
+ function y({
8
+ id: i,
9
+ testid: o,
10
+ ...e
11
+ }) {
12
+ const [t, n] = m(!1);
13
+ return /* @__PURE__ */ r(
14
+ a,
15
+ {
16
+ id: i,
17
+ testid: o,
18
+ ...e,
19
+ type: t ? "text" : "password",
20
+ after: /* @__PURE__ */ r(c, { id: i, testid: o, show: t, setShow: n })
21
+ }
22
+ );
23
+ }
24
+ function c({ id: i, testid: o, show: e, setShow: t }) {
25
+ return e ? /* @__PURE__ */ r(l, { message: "Show", children: /* @__PURE__ */ r(
26
+ s,
27
+ {
28
+ id: i ? `${i}-toggle-visibility` : void 0,
29
+ testid: o ? `${o}-toggle-visibility` : void 0,
30
+ name: "visibility_off",
31
+ className: "cursor-pointer",
32
+ onClick: () => t(!1)
33
+ }
34
+ ) }) : /* @__PURE__ */ r(l, { message: "Hide", children: /* @__PURE__ */ r(
35
+ s,
36
+ {
37
+ id: i ? `${i}-toggle-visibility` : void 0,
38
+ testid: o ? `${o}-toggle-visibility` : void 0,
39
+ name: "visibility",
40
+ className: "cursor-pointer",
41
+ onClick: () => t(!0)
42
+ }
43
+ ) });
44
+ }
45
+ export {
46
+ y as Password
47
+ };
@@ -0,0 +1,48 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { clsx as r } from "../../node_modules/clsx/dist/clsx.js";
3
+ function c({
4
+ images: a,
5
+ currentIndex: l,
6
+ onSelect: i,
7
+ className: n
8
+ }) {
9
+ return a?.length ? /* @__PURE__ */ e(
10
+ "div",
11
+ {
12
+ className: r(
13
+ "flex items-center justify-center w-full px-4 md:hidden",
14
+ n
15
+ ),
16
+ "aria-label": "Image navigation",
17
+ children: /* @__PURE__ */ e(
18
+ "div",
19
+ {
20
+ className: "grid gap-2 place-items-center",
21
+ style: {
22
+ gridTemplateColumns: `repeat(${Math.min(a.length, 8)}, 1fr)`
23
+ },
24
+ role: "tablist",
25
+ children: a.map((o, t) => /* @__PURE__ */ e(
26
+ "button",
27
+ {
28
+ type: "button",
29
+ onClick: () => i(t),
30
+ className: r(
31
+ "w-4 h-4 transition-all duration-200 focus:outline-none",
32
+ t === l ? "ring-2 ring-brand-400" : "ring ring-neutral-300"
33
+ ),
34
+ "aria-label": `Go to image ${t + 1}`,
35
+ role: "tab",
36
+ "aria-selected": t === l,
37
+ tabIndex: t === l ? 0 : -1
38
+ },
39
+ t
40
+ ))
41
+ }
42
+ )
43
+ }
44
+ ) : null;
45
+ }
46
+ export {
47
+ c as CarouselPagination
48
+ };
@@ -0,0 +1,146 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useRef as q, useState as u, useCallback as h, useEffect as C } from "react";
3
+ function H({
4
+ images: f,
5
+ currentIndex: s,
6
+ width: R = 483,
7
+ height: D = 483,
8
+ onChangeIndex: d,
9
+ onImageError: N,
10
+ className: S = ""
11
+ }) {
12
+ const l = q(null), [a, b] = u(!1), [w, E] = u(0), [v, g] = u(0), [c, k] = u(0), [m, z] = u(R), n = Math.min(m * 0.6, D * 0.6), p = 16, T = h(
13
+ (t) => {
14
+ const e = m / 2, o = n / 2, i = t * (n + p);
15
+ return e - o - i;
16
+ },
17
+ [m, n, p]
18
+ );
19
+ C(() => {
20
+ const t = T(s);
21
+ g(t), k(t);
22
+ }, [s, T]), C(() => {
23
+ const t = () => {
24
+ if (l.current) {
25
+ const o = l.current.getBoundingClientRect();
26
+ z(o.width);
27
+ }
28
+ };
29
+ t();
30
+ const e = new ResizeObserver(t);
31
+ return l.current && e.observe(l.current), () => e.disconnect();
32
+ }, []);
33
+ const y = h((t) => {
34
+ b(!0), E(t);
35
+ }, []), X = h(
36
+ (t) => {
37
+ if (!a) return;
38
+ const o = t - w;
39
+ g(c + o);
40
+ },
41
+ [a, w, c]
42
+ ), M = h(() => {
43
+ if (!a) return;
44
+ b(!1);
45
+ const t = v - c, e = n / 3;
46
+ let o = s;
47
+ t > e && s > 0 ? o = s - 1 : t < -e && s < f.length - 1 && (o = s + 1), o !== s ? d(o) : g(c);
48
+ }, [
49
+ a,
50
+ v,
51
+ c,
52
+ s,
53
+ n,
54
+ f.length,
55
+ d
56
+ ]), P = (t) => {
57
+ t.preventDefault(), y(t.clientX);
58
+ }, $ = (t) => {
59
+ t.preventDefault(), X(t.clientX);
60
+ }, O = () => {
61
+ M();
62
+ }, W = () => {
63
+ M();
64
+ }, j = (t) => {
65
+ y(t.touches[0].clientX);
66
+ }, L = (t) => {
67
+ X(t.touches[0].clientX);
68
+ }, U = () => {
69
+ M();
70
+ }, A = h(
71
+ (t) => {
72
+ !a && t !== s && d(t);
73
+ },
74
+ [a, s, d]
75
+ );
76
+ return f.length ? /* @__PURE__ */ r("div", { className: `md:hidden w-full ${S}`, children: /* @__PURE__ */ r(
77
+ "div",
78
+ {
79
+ ref: l,
80
+ className: "relative overflow-hidden cursor-grab active:cursor-grabbing select-none w-full",
81
+ style: {
82
+ height: n
83
+ },
84
+ onMouseDown: P,
85
+ onMouseMove: $,
86
+ onMouseUp: O,
87
+ onMouseLeave: W,
88
+ onTouchStart: j,
89
+ onTouchMove: L,
90
+ onTouchEnd: U,
91
+ children: /* @__PURE__ */ r(
92
+ "div",
93
+ {
94
+ className: "flex items-center",
95
+ style: {
96
+ transform: `translateX(${v}px)`,
97
+ transition: a ? "none" : "transform 0.3s ease-out",
98
+ gap: `${p}px`
99
+ },
100
+ children: f.map((t, e) => {
101
+ const o = e === s, i = Math.abs(e - s), B = i <= 2;
102
+ return /* @__PURE__ */ r(
103
+ "div",
104
+ {
105
+ className: "flex-shrink-0 transition-opacity duration-300",
106
+ style: {
107
+ width: n,
108
+ height: n,
109
+ opacity: o ? 1 : Math.max(0.3, 1 - i * 0.3)
110
+ },
111
+ onClick: () => A(e),
112
+ children: B ? /* @__PURE__ */ r(
113
+ "img",
114
+ {
115
+ src: t.src,
116
+ alt: t.alt || `Product image ${e + 1}`,
117
+ className: "w-full h-full object-contain",
118
+ draggable: !1,
119
+ loading: i <= 1 ? "eager" : "lazy",
120
+ onError: () => N?.(t.src),
121
+ style: {
122
+ aspectRatio: "1 / 1"
123
+ }
124
+ }
125
+ ) : /* @__PURE__ */ r(
126
+ "div",
127
+ {
128
+ className: "w-full h-full bg-neutral-100 rounded-md border border-gray-200",
129
+ style: {
130
+ aspectRatio: "1 / 1"
131
+ },
132
+ "aria-hidden": "true"
133
+ }
134
+ )
135
+ },
136
+ t.src + e
137
+ );
138
+ })
139
+ }
140
+ )
141
+ }
142
+ ) }) : null;
143
+ }
144
+ export {
145
+ H as MobileImageCarousel
146
+ };
@@ -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
+ };
@@ -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
+ };