@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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ProductPrimaryImage
3
- } from "../../chunk-YCDDBSVU.js";
3
+ } from "../../chunk-65HTZ3R2.js";
4
4
  import "../../chunk-ORMEWXMH.js";
5
5
  export {
6
6
  ProductPrimaryImage
@@ -72,7 +72,8 @@ function Thumbnail({
72
72
  alt,
73
73
  isActive,
74
74
  onClick,
75
- isPlaceholder = false
75
+ isPlaceholder = false,
76
+ onImageError
76
77
  }) {
77
78
  const [imageError, setImageError] = (0, import_react2.useState)(false);
78
79
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -97,6 +98,7 @@ function Thumbnail({
97
98
  draggable: false,
98
99
  loading: "lazy",
99
100
  onError: () => {
101
+ onImageError == null ? void 0 : onImageError(src);
100
102
  setImageError(true);
101
103
  }
102
104
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Thumbnail
3
- } from "../../chunk-3X3Y4TMS.js";
3
+ } from "../../chunk-JRNU5BZ4.js";
4
4
  import "../../chunk-QVWYTQKL.js";
5
5
  import "../../chunk-ORMEWXMH.js";
6
6
  export {
@@ -96,7 +96,8 @@ function Thumbnail({
96
96
  alt,
97
97
  isActive,
98
98
  onClick,
99
- isPlaceholder = false
99
+ isPlaceholder = false,
100
+ onImageError
100
101
  }) {
101
102
  const [imageError, setImageError] = (0, import_react2.useState)(false);
102
103
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -121,6 +122,7 @@ function Thumbnail({
121
122
  draggable: false,
122
123
  loading: "lazy",
123
124
  onError: () => {
125
+ onImageError == null ? void 0 : onImageError(src);
124
126
  setImageError(true);
125
127
  }
126
128
  }
@@ -579,6 +581,7 @@ function ProductPrimaryImage({
579
581
  scrollToZoomEnabled = false,
580
582
  className = "",
581
583
  isPlaceholder = false,
584
+ onImageError,
582
585
  onZoomPositionChange,
583
586
  onScrollZoom
584
587
  }) {
@@ -668,12 +671,13 @@ function ProductPrimaryImage({
668
671
  }, [scrollToZoomEnabled, zoomEnabled, active, onScrollZoom]);
669
672
  const handleImgError = (0, import_react3.useCallback)(
670
673
  (e) => {
674
+ onImageError == null ? void 0 : onImageError(imageSrc);
671
675
  if (!placeholderImageUri) return;
672
676
  const img = e.currentTarget;
673
677
  if (img.src === placeholderImageUri) return;
674
678
  img.src = placeholderImageUri;
675
679
  },
676
- []
680
+ [imageSrc, onImageError]
677
681
  );
678
682
  const pt = lastPointRef.current;
679
683
  let lensStyle;
@@ -922,6 +926,7 @@ function MobileImageCarousel({
922
926
  width = 483,
923
927
  height = 483,
924
928
  onChangeIndex,
929
+ onImageError,
925
930
  className = ""
926
931
  }) {
927
932
  const containerRef = (0, import_react5.useRef)(null);
@@ -1076,6 +1081,7 @@ function MobileImageCarousel({
1076
1081
  className: "w-full h-full object-cover",
1077
1082
  draggable: false,
1078
1083
  loading: distance <= 1 ? "eager" : "lazy",
1084
+ onError: () => onImageError == null ? void 0 : onImageError(image.src),
1079
1085
  style: {
1080
1086
  aspectRatio: "1 / 1"
1081
1087
  }
@@ -1250,12 +1256,13 @@ function useProductImagePreview(props) {
1250
1256
  }
1251
1257
 
1252
1258
  // src/components/ProductImagePreview/index.tsx
1259
+ var import_react12 = require("react");
1253
1260
  var import_jsx_runtime10 = require("react/jsx-runtime");
1254
1261
  var placeholderImageUri2 = "/placeholder.svg";
1255
- var PLACEHOLDER_IMAGES = [
1256
- { src: "", alt: "placeholder" },
1257
- { src: "", alt: "placeholder" }
1258
- ];
1262
+ function hasValidImageSource(src) {
1263
+ const normalizedSrc = src == null ? void 0 : src.trim();
1264
+ return !!normalizedSrc && normalizedSrc !== placeholderImageUri2 && !normalizedSrc.endsWith("/placeholder.svg") && !normalizedSrc.includes("/placeholder.svg?");
1265
+ }
1259
1266
  function ProductImagePreview(props) {
1260
1267
  const {
1261
1268
  width = 483,
@@ -1272,6 +1279,26 @@ function ProductImagePreview(props) {
1272
1279
  zoomWindowOffset = 10,
1273
1280
  testid
1274
1281
  } = props;
1282
+ const [failedImageSources, setFailedImageSources] = (0, import_react12.useState)([]);
1283
+ const imageSourceKey = (0, import_react12.useMemo)(
1284
+ () => images.map((image) => image.src).join("|"),
1285
+ [images]
1286
+ );
1287
+ const validImages = (0, import_react12.useMemo)(
1288
+ () => images.filter(
1289
+ (image) => hasValidImageSource(image.src) && failedImageSources.indexOf(image.src) === -1
1290
+ ),
1291
+ [failedImageSources, images]
1292
+ );
1293
+ const handleImageError = (0, import_react12.useCallback)((src) => {
1294
+ if (!src) return;
1295
+ setFailedImageSources(
1296
+ (previousSources) => previousSources.indexOf(src) >= 0 ? previousSources : [...previousSources, src]
1297
+ );
1298
+ }, []);
1299
+ (0, import_react12.useEffect)(() => {
1300
+ setFailedImageSources([]);
1301
+ }, [imageSourceKey]);
1275
1302
  const isMobile = useMatchesMobile();
1276
1303
  const {
1277
1304
  zoomPoint,
@@ -1285,7 +1312,7 @@ function ProductImagePreview(props) {
1285
1312
  handleZoomPositionChange,
1286
1313
  handleScrollZoom
1287
1314
  } = useProductImagePreview({
1288
- images,
1315
+ images: validImages,
1289
1316
  currentIndex,
1290
1317
  zoomEnabled,
1291
1318
  zoomFactor,
@@ -1294,7 +1321,7 @@ function ProductImagePreview(props) {
1294
1321
  isMobile
1295
1322
  });
1296
1323
  if (typeof isMobile === "undefined") return null;
1297
- if (isMobile && !images.length)
1324
+ if (isMobile && !validImages.length)
1298
1325
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1299
1326
  "img",
1300
1327
  {
@@ -1311,7 +1338,7 @@ function ProductImagePreview(props) {
1311
1338
  }
1312
1339
  );
1313
1340
  const effectiveZoomEnabled = zoomEnabled && !isMobile;
1314
- const showDesktopThumbnails = images.length !== 1;
1341
+ const showDesktopThumbnails = validImages.length > 1;
1315
1342
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1316
1343
  Stack,
1317
1344
  {
@@ -1331,7 +1358,8 @@ function ProductImagePreview(props) {
1331
1358
  scrollToZoomEnabled: scrollToZoomEnabled && !isMobile,
1332
1359
  onZoomPositionChange: handleZoomPositionChange,
1333
1360
  onScrollZoom: handleScrollZoom,
1334
- isPlaceholder: images.length === 0
1361
+ isPlaceholder: validImages.length === 0,
1362
+ onImageError: handleImageError
1335
1363
  }
1336
1364
  ) }),
1337
1365
  effectiveZoomEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
@@ -1352,31 +1380,30 @@ function ProductImagePreview(props) {
1352
1380
  isMobile && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1353
1381
  MobileImageCarousel,
1354
1382
  {
1355
- images,
1383
+ images: validImages,
1356
1384
  currentIndex: safeIndex,
1357
1385
  width,
1358
1386
  height,
1359
- onChangeIndex: handleSelect
1387
+ onChangeIndex: handleSelect,
1388
+ onImageError: handleImageError
1360
1389
  }
1361
1390
  ),
1362
- showDesktopThumbnails && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "hidden md:block", children: images.length <= 3 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1391
+ showDesktopThumbnails && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "hidden md:block", children: validImages.length <= 3 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1363
1392
  "div",
1364
1393
  {
1365
1394
  className: "flex justify-center gap-4",
1366
1395
  style: { width: "100%", maxWidth: width },
1367
1396
  "aria-label": "Product image thumbnails",
1368
- children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
1369
- (img, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1370
- Thumbnail,
1371
- {
1372
- src: img.src,
1373
- alt: img.alt || `Thumbnail ${i + 1}`,
1374
- isActive: i === safeIndex,
1375
- onClick: () => handleSelect(i),
1376
- isPlaceholder: images.length === 0
1377
- }
1378
- ) }, img.src + i)
1379
- )
1397
+ children: validImages.map((img, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { maxWidth: "115px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1398
+ Thumbnail,
1399
+ {
1400
+ src: img.src,
1401
+ alt: img.alt || `Thumbnail ${i + 1}`,
1402
+ isActive: i === safeIndex,
1403
+ onClick: () => handleSelect(i),
1404
+ onImageError: handleImageError
1405
+ }
1406
+ ) }, img.src + i))
1380
1407
  }
1381
1408
  ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1382
1409
  Grid,
@@ -1388,25 +1415,23 @@ function ProductImagePreview(props) {
1388
1415
  maxWidth: width
1389
1416
  },
1390
1417
  columns: thumbsPerRow > 12 ? 12 : thumbsPerRow < 1 ? 1 : thumbsPerRow,
1391
- children: (images.length === 0 ? PLACEHOLDER_IMAGES : images).map(
1392
- (img, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1393
- Thumbnail,
1394
- {
1395
- src: img.src,
1396
- alt: img.alt || `Thumbnail ${i + 1}`,
1397
- isActive: i === safeIndex,
1398
- onClick: () => handleSelect(i),
1399
- isPlaceholder: images.length === 0
1400
- },
1401
- img.src + i
1402
- )
1403
- )
1418
+ children: validImages.map((img, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1419
+ Thumbnail,
1420
+ {
1421
+ src: img.src,
1422
+ alt: img.alt || `Thumbnail ${i + 1}`,
1423
+ isActive: i === safeIndex,
1424
+ onClick: () => handleSelect(i),
1425
+ onImageError: handleImageError
1426
+ },
1427
+ img.src + i
1428
+ ))
1404
1429
  }
1405
1430
  ) }),
1406
1431
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1407
1432
  CarouselPagination,
1408
1433
  {
1409
- images,
1434
+ images: validImages,
1410
1435
  currentIndex: safeIndex,
1411
1436
  onSelect: handleSelect
1412
1437
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ProductImagePreview
3
- } from "../../chunk-AJGTMNW5.js";
3
+ } from "../../chunk-XW4B4CUY.js";
4
4
  import "../../chunk-MBZ55T2D.js";
5
- import "../../chunk-2IKT6IHB.js";
6
- import "../../chunk-YCDDBSVU.js";
7
- import "../../chunk-3X3Y4TMS.js";
5
+ import "../../chunk-S4XW2XZW.js";
6
+ import "../../chunk-65HTZ3R2.js";
7
+ import "../../chunk-JRNU5BZ4.js";
8
8
  import "../../chunk-BQNPOGD5.js";
9
9
  import "../../chunk-AT4AWD6B.js";
10
10
  import "../../chunk-QVWYTQKL.js";