@websolutespa/bom-mixer-ui 1.7.14 → 1.7.15
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/CHANGELOG.md +8 -0
- package/dist/cjs/index.js +13 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/media/media-image.js +9 -18
- package/dist/esm/components/media/media-image.js.map +1 -1
- package/dist/esm/components/media/media-video.js +4 -5
- package/dist/esm/components/media/media-video.js.map +1 -1
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/media/media-video.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/button/__snapshots__/button.test.tsx.snap +61 -0
- package/src/components/media/media-image.tsx +17 -18
- package/src/components/media/media-video.tsx +6 -7
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -4439,7 +4439,7 @@ function getMediaSizes(mediaQuery, ratio, size, maxWidth, maxHeight) {
|
|
|
4439
4439
|
if (maxHeight === void 0) {
|
|
4440
4440
|
maxHeight = Number.POSITIVE_INFINITY;
|
|
4441
4441
|
}
|
|
4442
|
-
// console.log('getMediaSizes',
|
|
4442
|
+
// console.log('getMediaSizes', mediaQuery, ratio, size, maxWidth, maxHeight);
|
|
4443
4443
|
let sizes = [];
|
|
4444
4444
|
if (size) {
|
|
4445
4445
|
if (typeof size === 'number') {
|
|
@@ -4506,7 +4506,7 @@ function getImageProps(_a, mediaQuery) {
|
|
|
4506
4506
|
} else if (typeof height === 'number') {
|
|
4507
4507
|
useHeight = height;
|
|
4508
4508
|
}
|
|
4509
|
-
const ratio = getMediaRatio(props);
|
|
4509
|
+
const ratio = getMediaRatio(useWidth, useHeight, props.aspectRatio, props.aspectRatioSm, props.aspectRatioMd, props.aspectRatioLg, props.aspectRatioXl);
|
|
4510
4510
|
const sizes = getMediaSizes(mediaQuery, ratio, useSize, props.mediaWidth, props.mediaHeight);
|
|
4511
4511
|
const imageSrc = getImageSrc(src, sizes[0][0], sizes[0][2]);
|
|
4512
4512
|
const imageSrcSet = getImageSrcset(src, sizes);
|
|
@@ -4520,23 +4520,14 @@ function getImageProps(_a, mediaQuery) {
|
|
|
4520
4520
|
height: useHeight ? `${useHeight}px` : undefined
|
|
4521
4521
|
}, otherProps);
|
|
4522
4522
|
}
|
|
4523
|
-
function getMediaRatio(
|
|
4524
|
-
|
|
4525
|
-
let height = undefined;
|
|
4526
|
-
if (props.width) {
|
|
4527
|
-
width = parseInt(String(props.width));
|
|
4528
|
-
}
|
|
4529
|
-
props.width = width;
|
|
4530
|
-
if (props.height) {
|
|
4531
|
-
height = parseInt(String(props.height));
|
|
4532
|
-
}
|
|
4533
|
-
props.height = height;
|
|
4523
|
+
function getMediaRatio(width, height, aspectRatio, aspectRatioSm, aspectRatioMd, aspectRatioLg, aspectRatioXl) {
|
|
4524
|
+
// console.log('getMediaRatio', width, height, aspectRatio);
|
|
4534
4525
|
const defaultRatio = width && height ? width / height : 0;
|
|
4535
|
-
const xs = getRatio(
|
|
4536
|
-
const sm = getRatio(
|
|
4537
|
-
const md = getRatio(
|
|
4538
|
-
const lg = getRatio(
|
|
4539
|
-
const xl = getRatio(
|
|
4526
|
+
const xs = getRatio(aspectRatio, defaultRatio);
|
|
4527
|
+
const sm = getRatio(aspectRatioSm, xs);
|
|
4528
|
+
const md = getRatio(aspectRatioMd, sm);
|
|
4529
|
+
const lg = getRatio(aspectRatioLg, md);
|
|
4530
|
+
const xl = getRatio(aspectRatioXl, lg);
|
|
4540
4531
|
const ratio = {
|
|
4541
4532
|
xs,
|
|
4542
4533
|
sm,
|
|
@@ -4620,16 +4611,15 @@ const MediaVideo = _a => {
|
|
|
4620
4611
|
};
|
|
4621
4612
|
React.useEffect(() => {
|
|
4622
4613
|
if (videoRef.current && canLoad) {
|
|
4623
|
-
|
|
4614
|
+
const video = videoRef.current;
|
|
4615
|
+
if (video.readyState && video.readyState >= 2) {
|
|
4624
4616
|
if (typeof onLoaded === 'function') {
|
|
4625
4617
|
onLoaded(videoRef);
|
|
4626
4618
|
}
|
|
4627
4619
|
} else {
|
|
4628
|
-
|
|
4620
|
+
video.addEventListener('loadeddata', onLoad);
|
|
4629
4621
|
return () => {
|
|
4630
|
-
|
|
4631
|
-
videoRef.current.removeEventListener('loadeddata', onLoad);
|
|
4632
|
-
}
|
|
4622
|
+
video.removeEventListener('loadeddata', onLoad);
|
|
4633
4623
|
};
|
|
4634
4624
|
}
|
|
4635
4625
|
}
|