@dmsi/wedgekit-react 0.0.1229 → 0.0.1230

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 (46) hide show
  1. package/dist/{chunk-YCDDBSVU.js → chunk-65HTZ3R2.js} +3 -1
  2. package/dist/{chunk-6R5GQV6W.js → chunk-ICJARSLG.js} +35 -11
  3. package/dist/{chunk-3X3Y4TMS.js → chunk-JRNU5BZ4.js} +3 -1
  4. package/dist/{chunk-2IKT6IHB.js → chunk-S4XW2XZW.js} +2 -0
  5. package/dist/{chunk-AJGTMNW5.js → chunk-XW4B4CUY.js} +59 -40
  6. package/dist/components/CalendarRange.cjs +26 -25
  7. package/dist/components/CalendarRange.js +5 -5
  8. package/dist/components/CompactImagesPreview.cjs +34 -10
  9. package/dist/components/CompactImagesPreview.js +1 -1
  10. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +16 -15
  11. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +5 -5
  12. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +19 -18
  13. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +5 -5
  14. package/dist/components/DataGrid/PinnedColumns.cjs +21 -20
  15. package/dist/components/DataGrid/PinnedColumns.js +5 -5
  16. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +14 -13
  17. package/dist/components/DataGrid/TableBody/LoadingCell.js +5 -5
  18. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +16 -15
  19. package/dist/components/DataGrid/TableBody/TableBodyRow.js +5 -5
  20. package/dist/components/DataGrid/TableBody/index.cjs +16 -15
  21. package/dist/components/DataGrid/TableBody/index.js +5 -5
  22. package/dist/components/DataGrid/index.cjs +39 -38
  23. package/dist/components/DataGrid/index.js +5 -5
  24. package/dist/components/DataGrid/utils.cjs +14 -13
  25. package/dist/components/DataGrid/utils.js +5 -5
  26. package/dist/components/DateInput.cjs +38 -37
  27. package/dist/components/DateInput.js +5 -5
  28. package/dist/components/DateRangeInput.cjs +39 -38
  29. package/dist/components/DateRangeInput.js +5 -5
  30. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +18 -17
  31. package/dist/components/MobileDataGrid/ColumnSelector/index.js +5 -5
  32. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +18 -17
  33. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +5 -5
  34. package/dist/components/MobileDataGrid/index.cjs +41 -40
  35. package/dist/components/MobileDataGrid/index.js +5 -5
  36. package/dist/components/ProductImagePreview/MobileImageCarousel.cjs +2 -0
  37. package/dist/components/ProductImagePreview/MobileImageCarousel.js +1 -1
  38. package/dist/components/ProductImagePreview/ProductPrimaryImage.cjs +3 -1
  39. package/dist/components/ProductImagePreview/ProductPrimaryImage.js +1 -1
  40. package/dist/components/ProductImagePreview/Thumbnail.cjs +3 -1
  41. package/dist/components/ProductImagePreview/Thumbnail.js +1 -1
  42. package/dist/components/ProductImagePreview/index.cjs +64 -39
  43. package/dist/components/ProductImagePreview/index.js +4 -4
  44. package/dist/components/index.cjs +138 -89
  45. package/dist/components/index.js +5 -5
  46. package/package.json +1 -1
@@ -16,6 +16,7 @@ function ProductPrimaryImage({
16
16
  scrollToZoomEnabled = false,
17
17
  className = "",
18
18
  isPlaceholder = false,
19
+ onImageError,
19
20
  onZoomPositionChange,
20
21
  onScrollZoom
21
22
  }) {
@@ -105,12 +106,13 @@ function ProductPrimaryImage({
105
106
  }, [scrollToZoomEnabled, zoomEnabled, active, onScrollZoom]);
106
107
  const handleImgError = useCallback(
107
108
  (e) => {
109
+ onImageError == null ? void 0 : onImageError(imageSrc);
108
110
  if (!placeholderImageUri) return;
109
111
  const img = e.currentTarget;
110
112
  if (img.src === placeholderImageUri) return;
111
113
  img.src = placeholderImageUri;
112
114
  },
113
- []
115
+ [imageSrc, onImageError]
114
116
  );
115
117
  const pt = lastPointRef.current;
116
118
  let lensStyle;
@@ -6,9 +6,13 @@ import {
6
6
  } from "./chunk-MVDGHWKO.js";
7
7
 
8
8
  // src/components/CompactImagesPreview.tsx
9
- import { useCallback } from "react";
9
+ import { useCallback, useEffect, useMemo, useState } from "react";
10
10
  import clsx from "clsx";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
+ function hasValidSourceUri(uri, placeholderImageUri) {
13
+ const normalizedUri = uri == null ? void 0 : uri.trim();
14
+ return !!normalizedUri && normalizedUri !== placeholderImageUri && !normalizedUri.endsWith("/placeholder.svg") && !normalizedUri.includes("/placeholder.svg?");
15
+ }
12
16
  function CompactImagesPreview(props) {
13
17
  const {
14
18
  sources,
@@ -25,16 +29,36 @@ function CompactImagesPreview(props) {
25
29
  testid
26
30
  } = props;
27
31
  const isMobile = useMatchesMobile();
28
- const imagesCount = sources.length;
32
+ const [failedSourceUris, setFailedSourceUris] = useState([]);
33
+ const sourceKey = useMemo(
34
+ () => sources.map((source) => source.uri).join("|"),
35
+ [sources]
36
+ );
37
+ const validSources = useMemo(
38
+ () => sources.filter(
39
+ (source) => hasValidSourceUri(source.uri, placeholderImageUri) && failedSourceUris.indexOf(source.uri) === -1
40
+ ),
41
+ [failedSourceUris, placeholderImageUri, sources]
42
+ );
43
+ const imagesCount = validSources.length;
44
+ const safeCurrentSourceIndex = currentSourceIndex >= 0 && currentSourceIndex < imagesCount ? currentSourceIndex : 0;
45
+ useEffect(() => {
46
+ setFailedSourceUris([]);
47
+ }, [sourceKey]);
29
48
  const handleImgError = useCallback(
30
- (e) => {
49
+ (e, failedUri) => {
50
+ if (failedUri) {
51
+ setFailedSourceUris(
52
+ (previousUris) => previousUris.indexOf(failedUri) >= 0 ? previousUris : [...previousUris, failedUri]
53
+ );
54
+ }
31
55
  if (!placeholderImageUri) return;
32
56
  const img = e.currentTarget;
33
57
  if (img.src === placeholderImageUri) return;
34
58
  img.src = placeholderImageUri;
35
59
  if (!img.alt) img.alt = placeholderAlt;
36
60
  },
37
- [placeholderImageUri, placeholderAlt]
61
+ [placeholderAlt, placeholderImageUri]
38
62
  );
39
63
  const handleThumbnailClick = useCallback(
40
64
  (newIndex) => {
@@ -44,7 +68,7 @@ function CompactImagesPreview(props) {
44
68
  },
45
69
  [currentSourceIndex, onChangeSource, imagesCount]
46
70
  );
47
- if (!sources.length || currentSourceIndex >= sources.length || typeof isMobile === "undefined")
71
+ if (!validSources.length || typeof isMobile === "undefined")
48
72
  return /* @__PURE__ */ jsx(
49
73
  "img",
50
74
  {
@@ -58,11 +82,11 @@ function CompactImagesPreview(props) {
58
82
  },
59
83
  src: placeholderImageUri,
60
84
  alt: placeholderAlt,
61
- onError: handleImgError,
85
+ onError: (event) => handleImgError(event),
62
86
  onClick: onMainImageClick
63
87
  }
64
88
  );
65
- const currentSource = sources[currentSourceIndex];
89
+ const currentSource = validSources[safeCurrentSourceIndex];
66
90
  return /* @__PURE__ */ jsxs(Stack, { "data-testid": testid, sizing: "layout", children: [
67
91
  /* @__PURE__ */ jsx(
68
92
  "img",
@@ -77,11 +101,11 @@ function CompactImagesPreview(props) {
77
101
  },
78
102
  src: currentSource.uri,
79
103
  alt: currentSource.name,
80
- onError: handleImgError,
104
+ onError: (event) => handleImgError(event, currentSource.uri),
81
105
  onClick: onMainImageClick
82
106
  }
83
107
  ),
84
- imagesCount > 1 && /* @__PURE__ */ jsx("div", { className: "flex flex-row flex-wrap items-center gap-3", children: sources.slice(0, 4).map((source, index) => /* @__PURE__ */ jsx(
108
+ imagesCount > 1 && /* @__PURE__ */ jsx("div", { className: "flex flex-row flex-wrap items-center gap-3", children: validSources.slice(0, 4).map((source, index) => /* @__PURE__ */ jsx(
85
109
  "button",
86
110
  {
87
111
  "data-testid": testid ? `${testid}-thumbnail-${index}` : void 0,
@@ -91,7 +115,7 @@ function CompactImagesPreview(props) {
91
115
  },
92
116
  className: clsx(
93
117
  "cursor-pointer",
94
- currentSourceIndex === index && enableThumbnailBorder ? "ring-2 ring-offset-2 ring-brand-400 transition-discrete duration-300" : "ring-brand-400/0"
118
+ safeCurrentSourceIndex === index && enableThumbnailBorder ? "ring-2 ring-offset-2 ring-brand-400 transition-discrete duration-300" : "ring-brand-400/0"
95
119
  ),
96
120
  children: /* @__PURE__ */ jsx(
97
121
  "img",
@@ -104,7 +128,7 @@ function CompactImagesPreview(props) {
104
128
  objectPosition: "center",
105
129
  objectFit: "cover"
106
130
  },
107
- onError: handleImgError
131
+ onError: (event) => handleImgError(event, source.uri)
108
132
  }
109
133
  )
110
134
  },
@@ -12,7 +12,8 @@ function Thumbnail({
12
12
  alt,
13
13
  isActive,
14
14
  onClick,
15
- isPlaceholder = false
15
+ isPlaceholder = false,
16
+ onImageError
16
17
  }) {
17
18
  const [imageError, setImageError] = useState(false);
18
19
  return /* @__PURE__ */ jsx(
@@ -37,6 +38,7 @@ function Thumbnail({
37
38
  draggable: false,
38
39
  loading: "lazy",
39
40
  onError: () => {
41
+ onImageError == null ? void 0 : onImageError(src);
40
42
  setImageError(true);
41
43
  }
42
44
  }
@@ -7,6 +7,7 @@ function MobileImageCarousel({
7
7
  width = 483,
8
8
  height = 483,
9
9
  onChangeIndex,
10
+ onImageError,
10
11
  className = ""
11
12
  }) {
12
13
  const containerRef = useRef(null);
@@ -161,6 +162,7 @@ function MobileImageCarousel({
161
162
  className: "w-full h-full object-cover",
162
163
  draggable: false,
163
164
  loading: distance <= 1 ? "eager" : "lazy",
165
+ onError: () => onImageError == null ? void 0 : onImageError(image.src),
164
166
  style: {
165
167
  aspectRatio: "1 / 1"
166
168
  }
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-MBZ55T2D.js";
4
4
  import {
5
5
  MobileImageCarousel
6
- } from "./chunk-2IKT6IHB.js";
6
+ } from "./chunk-S4XW2XZW.js";
7
7
  import {
8
8
  ProductPrimaryImage
9
- } from "./chunk-YCDDBSVU.js";
9
+ } from "./chunk-65HTZ3R2.js";
10
10
  import {
11
11
  Thumbnail
12
- } from "./chunk-3X3Y4TMS.js";
12
+ } from "./chunk-JRNU5BZ4.js";
13
13
  import {
14
14
  ZoomWindow
15
15
  } from "./chunk-BQNPOGD5.js";
@@ -139,12 +139,13 @@ function useProductImagePreview(props) {
139
139
  }
140
140
 
141
141
  // src/components/ProductImagePreview/index.tsx
142
+ import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
142
143
  import { jsx, jsxs } from "react/jsx-runtime";
143
144
  var placeholderImageUri = "/placeholder.svg";
144
- var PLACEHOLDER_IMAGES = [
145
- { src: "", alt: "placeholder" },
146
- { src: "", alt: "placeholder" }
147
- ];
145
+ function hasValidImageSource(src) {
146
+ const normalizedSrc = src == null ? void 0 : src.trim();
147
+ return !!normalizedSrc && normalizedSrc !== placeholderImageUri && !normalizedSrc.endsWith("/placeholder.svg") && !normalizedSrc.includes("/placeholder.svg?");
148
+ }
148
149
  function ProductImagePreview(props) {
149
150
  const {
150
151
  width = 483,
@@ -161,6 +162,26 @@ function ProductImagePreview(props) {
161
162
  zoomWindowOffset = 10,
162
163
  testid
163
164
  } = props;
165
+ const [failedImageSources, setFailedImageSources] = useState2([]);
166
+ const imageSourceKey = useMemo2(
167
+ () => images.map((image) => image.src).join("|"),
168
+ [images]
169
+ );
170
+ const validImages = useMemo2(
171
+ () => images.filter(
172
+ (image) => hasValidImageSource(image.src) && failedImageSources.indexOf(image.src) === -1
173
+ ),
174
+ [failedImageSources, images]
175
+ );
176
+ const handleImageError = useCallback2((src) => {
177
+ if (!src) return;
178
+ setFailedImageSources(
179
+ (previousSources) => previousSources.indexOf(src) >= 0 ? previousSources : [...previousSources, src]
180
+ );
181
+ }, []);
182
+ useEffect2(() => {
183
+ setFailedImageSources([]);
184
+ }, [imageSourceKey]);
164
185
  const isMobile = useMatchesMobile();
165
186
  const {
166
187
  zoomPoint,
@@ -174,7 +195,7 @@ function ProductImagePreview(props) {
174
195
  handleZoomPositionChange,
175
196
  handleScrollZoom
176
197
  } = useProductImagePreview({
177
- images,
198
+ images: validImages,
178
199
  currentIndex,
179
200
  zoomEnabled,
180
201
  zoomFactor,
@@ -183,7 +204,7 @@ function ProductImagePreview(props) {
183
204
  isMobile
184
205
  });
185
206
  if (typeof isMobile === "undefined") return null;
186
- if (isMobile && !images.length)
207
+ if (isMobile && !validImages.length)
187
208
  return /* @__PURE__ */ jsx(
188
209
  "img",
189
210
  {
@@ -200,7 +221,7 @@ function ProductImagePreview(props) {
200
221
  }
201
222
  );
202
223
  const effectiveZoomEnabled = zoomEnabled && !isMobile;
203
- const showDesktopThumbnails = images.length !== 1;
224
+ const showDesktopThumbnails = validImages.length > 1;
204
225
  return /* @__PURE__ */ jsxs(
205
226
  Stack,
206
227
  {
@@ -220,7 +241,8 @@ function ProductImagePreview(props) {
220
241
  scrollToZoomEnabled: scrollToZoomEnabled && !isMobile,
221
242
  onZoomPositionChange: handleZoomPositionChange,
222
243
  onScrollZoom: handleScrollZoom,
223
- isPlaceholder: images.length === 0
244
+ isPlaceholder: validImages.length === 0,
245
+ onImageError: handleImageError
224
246
  }
225
247
  ) }),
226
248
  effectiveZoomEnabled && /* @__PURE__ */ jsx(
@@ -241,31 +263,30 @@ function ProductImagePreview(props) {
241
263
  isMobile && /* @__PURE__ */ jsx(
242
264
  MobileImageCarousel,
243
265
  {
244
- images,
266
+ images: validImages,
245
267
  currentIndex: safeIndex,
246
268
  width,
247
269
  height,
248
- onChangeIndex: handleSelect
270
+ onChangeIndex: handleSelect,
271
+ onImageError: handleImageError
249
272
  }
250
273
  ),
251
- showDesktopThumbnails && /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: images.length <= 3 ? /* @__PURE__ */ jsx(
274
+ showDesktopThumbnails && /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: validImages.length <= 3 ? /* @__PURE__ */ jsx(
252
275
  "div",
253
276
  {
254
277
  className: "flex justify-center gap-4",
255
278
  style: { width: "100%", maxWidth: width },
256
279
  "aria-label": "Product image thumbnails",
257
- children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
258
- (img, i) => /* @__PURE__ */ jsx("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ jsx(
259
- Thumbnail,
260
- {
261
- src: img.src,
262
- alt: img.alt || `Thumbnail ${i + 1}`,
263
- isActive: i === safeIndex,
264
- onClick: () => handleSelect(i),
265
- isPlaceholder: images.length === 0
266
- }
267
- ) }, img.src + i)
268
- )
280
+ children: validImages.map((img, i) => /* @__PURE__ */ jsx("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ jsx(
281
+ Thumbnail,
282
+ {
283
+ src: img.src,
284
+ alt: img.alt || `Thumbnail ${i + 1}`,
285
+ isActive: i === safeIndex,
286
+ onClick: () => handleSelect(i),
287
+ onImageError: handleImageError
288
+ }
289
+ ) }, img.src + i))
269
290
  }
270
291
  ) : /* @__PURE__ */ jsx(
271
292
  Grid,
@@ -277,25 +298,23 @@ function ProductImagePreview(props) {
277
298
  maxWidth: width
278
299
  },
279
300
  columns: thumbsPerRow > 12 ? 12 : thumbsPerRow < 1 ? 1 : thumbsPerRow,
280
- children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
281
- (img, i) => /* @__PURE__ */ jsx(
282
- Thumbnail,
283
- {
284
- src: img.src,
285
- alt: img.alt || `Thumbnail ${i + 1}`,
286
- isActive: i === safeIndex,
287
- onClick: () => handleSelect(i),
288
- isPlaceholder: images.length === 0
289
- },
290
- img.src + i
291
- )
292
- )
301
+ children: validImages.map((img, i) => /* @__PURE__ */ jsx(
302
+ Thumbnail,
303
+ {
304
+ src: img.src,
305
+ alt: img.alt || `Thumbnail ${i + 1}`,
306
+ isActive: i === safeIndex,
307
+ onClick: () => handleSelect(i),
308
+ onImageError: handleImageError
309
+ },
310
+ img.src + i
311
+ ))
293
312
  }
294
313
  ) }),
295
314
  /* @__PURE__ */ jsx(
296
315
  CarouselPagination,
297
316
  {
298
- images,
317
+ images: validImages,
299
318
  currentIndex: safeIndex,
300
319
  onSelect: handleSelect
301
320
  }
@@ -242,7 +242,7 @@ function Icon(_a) {
242
242
  }
243
243
 
244
244
  // src/components/CalendarRange.tsx
245
- var import_react43 = __toESM(require("react"), 1);
245
+ var import_react44 = __toESM(require("react"), 1);
246
246
  var import_polyfill = require("@js-temporal/polyfill");
247
247
 
248
248
  // src/components/DataGridCell.tsx
@@ -5751,10 +5751,11 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
5751
5751
  var import_react32 = require("react");
5752
5752
 
5753
5753
  // src/components/ProductImagePreview/index.tsx
5754
+ var import_react33 = require("react");
5754
5755
  var import_jsx_runtime52 = require("react/jsx-runtime");
5755
5756
 
5756
5757
  // src/components/CompactImagesPreview.tsx
5757
- var import_react33 = require("react");
5758
+ var import_react34 = require("react");
5758
5759
  var import_clsx35 = __toESM(require("clsx"), 1);
5759
5760
  var import_jsx_runtime53 = require("react/jsx-runtime");
5760
5761
 
@@ -5763,12 +5764,12 @@ var import_clsx36 = __toESM(require("clsx"), 1);
5763
5764
  var import_jsx_runtime54 = require("react/jsx-runtime");
5764
5765
 
5765
5766
  // src/components/ListGroup.tsx
5766
- var import_react34 = require("react");
5767
+ var import_react35 = require("react");
5767
5768
  var import_clsx37 = __toESM(require("clsx"), 1);
5768
5769
  var import_jsx_runtime55 = require("react/jsx-runtime");
5769
5770
 
5770
5771
  // src/components/Pagination.tsx
5771
- var import_react35 = require("react");
5772
+ var import_react36 = require("react");
5772
5773
  var import_clsx38 = __toESM(require("clsx"), 1);
5773
5774
  var import_jsx_runtime56 = require("react/jsx-runtime");
5774
5775
  var Pagination = ({
@@ -5780,7 +5781,7 @@ var Pagination = ({
5780
5781
  className,
5781
5782
  disabled
5782
5783
  }) => {
5783
- const goTo = (0, import_react35.useCallback)(
5784
+ const goTo = (0, import_react36.useCallback)(
5784
5785
  (page) => {
5785
5786
  if (disabled) return;
5786
5787
  onPageChange(page);
@@ -5797,7 +5798,7 @@ var Pagination = ({
5797
5798
  goTo(currentPage + 1);
5798
5799
  }
5799
5800
  };
5800
- const pageTokens = (0, import_react35.useMemo)(() => {
5801
+ const pageTokens = (0, import_react36.useMemo)(() => {
5801
5802
  if (totalPages <= 5) {
5802
5803
  return Array.from({ length: totalPages }, (_, i) => i + 1);
5803
5804
  }
@@ -5920,21 +5921,21 @@ var import_jsx_runtime57 = require("react/jsx-runtime");
5920
5921
  var import_jsx_runtime58 = require("react/jsx-runtime");
5921
5922
 
5922
5923
  // src/components/SearchResultImage/index.tsx
5923
- var import_react36 = require("react");
5924
+ var import_react37 = require("react");
5924
5925
  var import_jsx_runtime59 = require("react/jsx-runtime");
5925
5926
 
5926
5927
  // src/components/Alert.tsx
5927
5928
  var import_clsx39 = __toESM(require("clsx"), 1);
5928
- var import_react37 = require("react");
5929
+ var import_react38 = require("react");
5929
5930
  var import_jsx_runtime60 = require("react/jsx-runtime");
5930
5931
 
5931
5932
  // src/components/OrderCheckIcon.tsx
5932
5933
  var import_jsx_runtime61 = require("react/jsx-runtime");
5933
5934
 
5934
5935
  // src/components/EditingContext.tsx
5935
- var import_react38 = require("react");
5936
+ var import_react39 = require("react");
5936
5937
  var import_jsx_runtime62 = require("react/jsx-runtime");
5937
- var EditingContext = (0, import_react38.createContext)(null);
5938
+ var EditingContext = (0, import_react39.createContext)(null);
5938
5939
 
5939
5940
  // src/components/AccessCard.tsx
5940
5941
  var import_clsx41 = __toESM(require("clsx"), 1);
@@ -6068,11 +6069,11 @@ var import_jsx_runtime64 = require("react/jsx-runtime");
6068
6069
 
6069
6070
  // src/components/AccessCardGroup.tsx
6070
6071
  var import_clsx42 = __toESM(require("clsx"), 1);
6071
- var import_react39 = require("react");
6072
+ var import_react40 = require("react");
6072
6073
  var import_jsx_runtime65 = require("react/jsx-runtime");
6073
6074
 
6074
6075
  // src/components/EmblaCarousel/index.tsx
6075
- var import_react42 = __toESM(require("react"), 1);
6076
+ var import_react43 = __toESM(require("react"), 1);
6076
6077
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
6077
6078
  var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"), 1);
6078
6079
 
@@ -6080,7 +6081,7 @@ var import_embla_carousel_autoplay = __toESM(require("embla-carousel-autoplay"),
6080
6081
  var import_jsx_runtime66 = require("react/jsx-runtime");
6081
6082
 
6082
6083
  // src/components/EmblaCarousel/useSelectedSnapDisplay.ts
6083
- var import_react40 = require("react");
6084
+ var import_react41 = require("react");
6084
6085
 
6085
6086
  // src/components/EmblaCarousel/ArrowButtons.tsx
6086
6087
  var import_clsx43 = __toESM(require("clsx"), 1);
@@ -6090,7 +6091,7 @@ var arrowButtonStyles = (0, import_clsx43.default)(
6090
6091
  );
6091
6092
 
6092
6093
  // src/components/EmblaCarousel/usePrevNextButtons.ts
6093
- var import_react41 = require("react");
6094
+ var import_react42 = require("react");
6094
6095
 
6095
6096
  // src/components/EmblaCarousel/index.tsx
6096
6097
  var import_clsx44 = __toESM(require("clsx"), 1);
@@ -6211,20 +6212,20 @@ function CalendarRange({
6211
6212
  const fromDate = parseDate(from);
6212
6213
  const toDate = parseDate(to);
6213
6214
  const today = import_polyfill.Temporal.Now.plainDateISO();
6214
- const [baseMonth, setBaseMonth] = (0, import_react43.useState)(
6215
+ const [baseMonth, setBaseMonth] = (0, import_react44.useState)(
6215
6216
  fromDate != null ? fromDate : today.with({ day: 1 })
6216
6217
  );
6217
- const [selecting, setSelecting] = (0, import_react43.useState)("from");
6218
- const [pendingFrom, setPendingFrom] = (0, import_react43.useState)(void 0);
6219
- const [hoveredDate, setHoveredDate] = (0, import_react43.useState)(void 0);
6220
- (0, import_react43.useEffect)(() => {
6218
+ const [selecting, setSelecting] = (0, import_react44.useState)("from");
6219
+ const [pendingFrom, setPendingFrom] = (0, import_react44.useState)(void 0);
6220
+ const [hoveredDate, setHoveredDate] = (0, import_react44.useState)(void 0);
6221
+ (0, import_react44.useEffect)(() => {
6221
6222
  if (fromDate) {
6222
6223
  setBaseMonth(fromDate.with({ day: 1 }));
6223
6224
  } else if (toDate) {
6224
6225
  setBaseMonth(toDate.with({ day: 1 }));
6225
6226
  }
6226
6227
  }, [from, to]);
6227
- (0, import_react43.useEffect)(() => {
6228
+ (0, import_react44.useEffect)(() => {
6228
6229
  if (fromDate && toDate) {
6229
6230
  setSelecting("from");
6230
6231
  setPendingFrom(void 0);
@@ -6370,14 +6371,14 @@ function CalendarPane({
6370
6371
  const years = Array.from({ length: 100 }).map(
6371
6372
  (_, i) => baseMonth.year - 50 + i
6372
6373
  );
6373
- const [monthMenuOpen, setMonthMenuOpen] = (0, import_react43.useState)(false);
6374
- const [yearMenuOpen, setYearMenuOpen] = (0, import_react43.useState)(false);
6375
- const monthMenuRef = (0, import_react43.useRef)(null);
6376
- const yearMenuRef = (0, import_react43.useRef)(null);
6374
+ const [monthMenuOpen, setMonthMenuOpen] = (0, import_react44.useState)(false);
6375
+ const [yearMenuOpen, setYearMenuOpen] = (0, import_react44.useState)(false);
6376
+ const monthMenuRef = (0, import_react44.useRef)(null);
6377
+ const yearMenuRef = (0, import_react44.useRef)(null);
6377
6378
  const month = getMonthData(offset);
6378
6379
  const totalCells = 42;
6379
6380
  const emptyCells = month.firstDayOffset;
6380
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_react43.default.Fragment, { children: [
6381
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_react44.default.Fragment, { children: [
6381
6382
  /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
6382
6383
  "div",
6383
6384
  {
@@ -7,11 +7,11 @@ import "../chunk-3UPUZBP5.js";
7
7
  import "../chunk-7ZJIGTFN.js";
8
8
  import "../chunk-E3FOCECQ.js";
9
9
  import "../chunk-Y5GD2FJA.js";
10
- import "../chunk-AJGTMNW5.js";
10
+ import "../chunk-XW4B4CUY.js";
11
11
  import "../chunk-MBZ55T2D.js";
12
- import "../chunk-2IKT6IHB.js";
13
- import "../chunk-YCDDBSVU.js";
14
- import "../chunk-3X3Y4TMS.js";
12
+ import "../chunk-S4XW2XZW.js";
13
+ import "../chunk-65HTZ3R2.js";
14
+ import "../chunk-JRNU5BZ4.js";
15
15
  import "../chunk-BQNPOGD5.js";
16
16
  import "../chunk-YULGJORA.js";
17
17
  import "../chunk-Z2HPSFEQ.js";
@@ -49,7 +49,7 @@ import "../chunk-PABII472.js";
49
49
  import "../chunk-4UGMSWWA.js";
50
50
  import "../chunk-WVUIIBRR.js";
51
51
  import "../chunk-I3W5K76C.js";
52
- import "../chunk-6R5GQV6W.js";
52
+ import "../chunk-ICJARSLG.js";
53
53
  import "../chunk-ZRFXUER3.js";
54
54
  import "../chunk-WVGXD7HT.js";
55
55
  import "../chunk-VXWSAIB5.js";
@@ -471,6 +471,10 @@ var import_react5 = require("react");
471
471
 
472
472
  // src/components/CompactImagesPreview.tsx
473
473
  var import_jsx_runtime2 = require("react/jsx-runtime");
474
+ function hasValidSourceUri(uri, placeholderImageUri) {
475
+ const normalizedUri = uri == null ? void 0 : uri.trim();
476
+ return !!normalizedUri && normalizedUri !== placeholderImageUri && !normalizedUri.endsWith("/placeholder.svg") && !normalizedUri.includes("/placeholder.svg?");
477
+ }
474
478
  function CompactImagesPreview(props) {
475
479
  const {
476
480
  sources,
@@ -487,16 +491,36 @@ function CompactImagesPreview(props) {
487
491
  testid
488
492
  } = props;
489
493
  const isMobile = useMatchesMobile();
490
- const imagesCount = sources.length;
494
+ const [failedSourceUris, setFailedSourceUris] = (0, import_react6.useState)([]);
495
+ const sourceKey = (0, import_react6.useMemo)(
496
+ () => sources.map((source) => source.uri).join("|"),
497
+ [sources]
498
+ );
499
+ const validSources = (0, import_react6.useMemo)(
500
+ () => sources.filter(
501
+ (source) => hasValidSourceUri(source.uri, placeholderImageUri) && failedSourceUris.indexOf(source.uri) === -1
502
+ ),
503
+ [failedSourceUris, placeholderImageUri, sources]
504
+ );
505
+ const imagesCount = validSources.length;
506
+ const safeCurrentSourceIndex = currentSourceIndex >= 0 && currentSourceIndex < imagesCount ? currentSourceIndex : 0;
507
+ (0, import_react6.useEffect)(() => {
508
+ setFailedSourceUris([]);
509
+ }, [sourceKey]);
491
510
  const handleImgError = (0, import_react6.useCallback)(
492
- (e) => {
511
+ (e, failedUri) => {
512
+ if (failedUri) {
513
+ setFailedSourceUris(
514
+ (previousUris) => previousUris.indexOf(failedUri) >= 0 ? previousUris : [...previousUris, failedUri]
515
+ );
516
+ }
493
517
  if (!placeholderImageUri) return;
494
518
  const img = e.currentTarget;
495
519
  if (img.src === placeholderImageUri) return;
496
520
  img.src = placeholderImageUri;
497
521
  if (!img.alt) img.alt = placeholderAlt;
498
522
  },
499
- [placeholderImageUri, placeholderAlt]
523
+ [placeholderAlt, placeholderImageUri]
500
524
  );
501
525
  const handleThumbnailClick = (0, import_react6.useCallback)(
502
526
  (newIndex) => {
@@ -506,7 +530,7 @@ function CompactImagesPreview(props) {
506
530
  },
507
531
  [currentSourceIndex, onChangeSource, imagesCount]
508
532
  );
509
- if (!sources.length || currentSourceIndex >= sources.length || typeof isMobile === "undefined")
533
+ if (!validSources.length || typeof isMobile === "undefined")
510
534
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
511
535
  "img",
512
536
  {
@@ -520,11 +544,11 @@ function CompactImagesPreview(props) {
520
544
  },
521
545
  src: placeholderImageUri,
522
546
  alt: placeholderAlt,
523
- onError: handleImgError,
547
+ onError: (event) => handleImgError(event),
524
548
  onClick: onMainImageClick
525
549
  }
526
550
  );
527
- const currentSource = sources[currentSourceIndex];
551
+ const currentSource = validSources[safeCurrentSourceIndex];
528
552
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Stack, { "data-testid": testid, sizing: "layout", children: [
529
553
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
530
554
  "img",
@@ -539,11 +563,11 @@ function CompactImagesPreview(props) {
539
563
  },
540
564
  src: currentSource.uri,
541
565
  alt: currentSource.name,
542
- onError: handleImgError,
566
+ onError: (event) => handleImgError(event, currentSource.uri),
543
567
  onClick: onMainImageClick
544
568
  }
545
569
  ),
546
- imagesCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex flex-row flex-wrap items-center gap-3", children: sources.slice(0, 4).map((source, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
570
+ imagesCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex flex-row flex-wrap items-center gap-3", children: validSources.slice(0, 4).map((source, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
547
571
  "button",
548
572
  {
549
573
  "data-testid": testid ? `${testid}-thumbnail-${index}` : void 0,
@@ -553,7 +577,7 @@ function CompactImagesPreview(props) {
553
577
  },
554
578
  className: (0, import_clsx3.default)(
555
579
  "cursor-pointer",
556
- currentSourceIndex === index && enableThumbnailBorder ? "ring-2 ring-offset-2 ring-brand-400 transition-discrete duration-300" : "ring-brand-400/0"
580
+ safeCurrentSourceIndex === index && enableThumbnailBorder ? "ring-2 ring-offset-2 ring-brand-400 transition-discrete duration-300" : "ring-brand-400/0"
557
581
  ),
558
582
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
559
583
  "img",
@@ -566,7 +590,7 @@ function CompactImagesPreview(props) {
566
590
  objectPosition: "center",
567
591
  objectFit: "cover"
568
592
  },
569
- onError: handleImgError
593
+ onError: (event) => handleImgError(event, source.uri)
570
594
  }
571
595
  )
572
596
  },
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CompactImagesPreview
3
- } from "../chunk-6R5GQV6W.js";
3
+ } from "../chunk-ICJARSLG.js";
4
4
  import "../chunk-ZRFXUER3.js";
5
5
  import "../chunk-WVGXD7HT.js";
6
6
  import "../chunk-VXWSAIB5.js";