@wonderflow/react-components 14.2.2 → 14.2.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"product-card-media.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-media/product-card-media.tsx"],"names":[],"mappings":";AA6BA,oBAAY,qBAAqB,GAAG,cAAc,CAAC;IACjD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAA;AAEF,oBAAY,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAAC,qBAAqB,CAAC,CAAA;AAQ9F,eAAO,MAAM,gBAAgB,2BAiFE,CAAC"}
1
+ {"version":3,"file":"product-card-media.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-media/product-card-media.tsx"],"names":[],"mappings":";AA6BA,oBAAY,qBAAqB,GAAG,cAAc,CAAC;IACjD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAA;AAEF,oBAAY,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAAC,qBAAqB,CAAC,CAAA;AAQ9F,eAAO,MAAM,gBAAgB,2BAyFE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /*
3
- * Copyright 2023 Wonderflow Design Team
3
+ * Copyright 2023-2025 Wonderflow Design Team
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -28,22 +28,29 @@ export const ProductCardMedia = forwardRef(({ source = [], ratio = '1', isLoadin
28
28
  img.onerror = () => resolve(placeholder);
29
29
  img.onabort = () => resolve(placeholder);
30
30
  });
31
- const images = source.slice(0, 4).map(async (s) => preloadImage(s));
32
- Promise.all(images)
33
- .then((urls) => {
34
- const t = urls.map((el, i) => ({
35
- row: i < 2 ? '1' : '2',
36
- col: i % 2 === 0 ? '1' : '2',
37
- val: el,
38
- }));
39
- if (t.length === 3)
40
- t[1].row = '1 / 3';
41
- setImgs(t);
42
- })
43
- // eslint-disable-next-line no-console
44
- .catch(err => console.error(err));
45
- // eslint-disable-next-line react-hooks/exhaustive-deps
46
- }, []);
31
+ const preloadImages = async () => {
32
+ const images = source.slice(0, 4).map(async (s) => preloadImage(s));
33
+ try {
34
+ const urls = await Promise.all(images);
35
+ const t = urls.map((el, i) => ({
36
+ row: i < 2 ? '1' : '2',
37
+ col: i % 2 === 0 ? '1' : '2',
38
+ val: el,
39
+ }));
40
+ if (t.length === 3)
41
+ t[1].row = '1 / 3';
42
+ setImgs(t);
43
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
+ }
45
+ catch (err) {
46
+ setImgs([]);
47
+ }
48
+ };
49
+ void preloadImages();
50
+ return () => {
51
+ setImgs([]);
52
+ };
53
+ }, [source]);
47
54
  if (source.length === 0)
48
55
  return null;
49
56
  return (_jsx("div", { ref: forwardedRef, className: className, style: { ...style }, ...otherProps, children: _jsx(AspectRatio, { ratio: ratio, children: isLoading
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "14.2.2",
3
+ "version": "14.2.3",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "Apache-2.0",
@@ -82,9 +82,9 @@
82
82
  "@types/react-dom": "17.0.14",
83
83
  "@types/react-table": "7.7.20",
84
84
  "@types/react-test-renderer": "18.0.7",
85
- "@wonderflow/config": "14.2.2",
86
- "@wonderflow/tokens": "14.2.2",
87
- "@wonderflow/charts": "14.2.2",
85
+ "@wonderflow/config": "14.2.3",
86
+ "@wonderflow/tokens": "14.2.3",
87
+ "@wonderflow/charts": "14.2.3",
88
88
  "@types/uuid": "9.0.8",
89
89
  "babel-loader": "8.2.5",
90
90
  "cpy-cli": "3.1.1",