@seekora-ai/ui-sdk-react 0.2.26 → 0.2.27
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/dist/components/primitives/ImageDisplay.js +3 -3
- package/dist/components/suggestions/types.d.ts +2 -0
- package/dist/components/suggestions/types.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +6 -6
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.esm.js +9 -9
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +9 -9
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -2187,6 +2187,8 @@ interface ProductDisplayConfig {
|
|
|
2187
2187
|
showImage?: boolean;
|
|
2188
2188
|
/** Image aspect ratio */
|
|
2189
2189
|
imageAspectRatio?: '1:1' | '4:3' | '3:4' | '16:9' | 'auto';
|
|
2190
|
+
/** Image object-fit: 'cover' crops to fill (default), 'contain' fits entire image */
|
|
2191
|
+
imageObjectFit?: 'cover' | 'contain';
|
|
2190
2192
|
/** Show price */
|
|
2191
2193
|
showPrice?: boolean;
|
|
2192
2194
|
/** Show compare/original price */
|
package/dist/src/index.esm.js
CHANGED
|
@@ -10345,7 +10345,7 @@ function ImageDisplay({ images, variant = 'single', alt = '', className, style,
|
|
|
10345
10345
|
if (variant === 'hover') {
|
|
10346
10346
|
const showSecond = safeImages.length > 1 && hovering;
|
|
10347
10347
|
const src = showSecond ? safeImages[1] : safeImages[0];
|
|
10348
|
-
const hoverImgStyle = style?.aspectRatio ? { ...imgBaseStyle, aspectRatio: style.aspectRatio } : imgBaseStyle;
|
|
10348
|
+
const hoverImgStyle = style?.aspectRatio || style?.objectFit ? { ...imgBaseStyle, ...(style.aspectRatio ? { aspectRatio: style.aspectRatio } : {}), ...(style.objectFit ? { objectFit: style.objectFit } : {}) } : imgBaseStyle;
|
|
10349
10349
|
if (enableZoom) {
|
|
10350
10350
|
return (React.createElement("div", { className: clsx('seekora-img-display', 'seekora-img-hover', className), style: { position: 'relative', ...style }, onMouseEnter: () => setHovering(true), onMouseLeave: () => setHovering(false) },
|
|
10351
10351
|
React.createElement(ImageZoom, { src: src, alt: alt, mode: zoomMode, zoomLevel: zoomLevel, images: safeImages, currentIndex: showSecond ? 1 : 0, className: "seekora-img-hover-img", style: hoverImgStyle })));
|
|
@@ -10364,7 +10364,7 @@ function ImageDisplay({ images, variant = 'single', alt = '', className, style,
|
|
|
10364
10364
|
return next;
|
|
10365
10365
|
});
|
|
10366
10366
|
};
|
|
10367
|
-
const carouselImgStyle = style?.aspectRatio ? { ...imgBaseStyle, aspectRatio: style.aspectRatio } : imgBaseStyle;
|
|
10367
|
+
const carouselImgStyle = style?.aspectRatio || style?.objectFit ? { ...imgBaseStyle, ...(style.aspectRatio ? { aspectRatio: style.aspectRatio } : {}), ...(style.objectFit ? { objectFit: style.objectFit } : {}) } : imgBaseStyle;
|
|
10368
10368
|
const mainImage = enableZoom ? (React.createElement(ImageZoom, { src: current, alt: alt, mode: zoomMode, zoomLevel: zoomLevel, images: safeImages, currentIndex: index, className: "seekora-img-carousel-main", style: carouselImgStyle })) : (React.createElement("img", { src: current, alt: alt, className: "seekora-img-carousel-main", style: carouselImgStyle, loading: "lazy" }));
|
|
10369
10369
|
return (React.createElement("div", { className: clsx('seekora-img-display', 'seekora-img-carousel', className), style: { position: 'relative', ...style } },
|
|
10370
10370
|
mainImage,
|
|
@@ -10396,7 +10396,7 @@ function ImageDisplay({ images, variant = 'single', alt = '', className, style,
|
|
|
10396
10396
|
} })))))))));
|
|
10397
10397
|
}
|
|
10398
10398
|
if (variant === 'thumbStrip' || variant === 'thumbList') {
|
|
10399
|
-
const thumbMainStyle = style?.aspectRatio ? { ...imgBaseStyle, aspectRatio: style.aspectRatio } : imgBaseStyle;
|
|
10399
|
+
const thumbMainStyle = style?.aspectRatio || style?.objectFit ? { ...imgBaseStyle, ...(style.aspectRatio ? { aspectRatio: style.aspectRatio } : {}), ...(style.objectFit ? { objectFit: style.objectFit } : {}) } : imgBaseStyle;
|
|
10400
10400
|
const mainImage = enableZoom ? (React.createElement(ImageZoom, { src: current, alt: alt, mode: zoomMode, zoomLevel: zoomLevel, images: safeImages, currentIndex: index, className: "seekora-img-thumb-main", style: thumbMainStyle })) : (React.createElement("img", { src: current, alt: alt, className: "seekora-img-thumb-main", style: thumbMainStyle, loading: "lazy" }));
|
|
10401
10401
|
return (React.createElement("div", { className: clsx('seekora-img-display', 'seekora-img-thumbstrip', className), style: { display: 'flex', flexDirection: 'column', gap: responsiveGap, ...style } },
|
|
10402
10402
|
mainImage,
|
|
@@ -11579,15 +11579,15 @@ const imgPlaceholderStyle = {
|
|
|
11579
11579
|
borderRadius: BORDER_RADIUS$1.sm,
|
|
11580
11580
|
backgroundColor: 'var(--seekora-bg-secondary, rgba(0,0,0,0.04))',
|
|
11581
11581
|
};
|
|
11582
|
-
function ImageBlock({ images, title, imageVariant, aspectRatio, enableZoom, zoomMode, zoomLevel }) {
|
|
11582
|
+
function ImageBlock({ images, title, imageVariant, aspectRatio, objectFit, enableZoom, zoomMode, zoomLevel }) {
|
|
11583
11583
|
const ar = aspectRatio
|
|
11584
11584
|
? (aspectRatio.includes(':') ? aspectRatio.replace(':', '/') : aspectRatio)
|
|
11585
11585
|
: '1';
|
|
11586
11586
|
if (images.length > 0) {
|
|
11587
11587
|
return (React.createElement("div", { className: "seekora-product-card__image", style: { position: 'relative', overflow: 'hidden', borderRadius: BORDER_RADIUS$1.sm } },
|
|
11588
|
-
React.createElement(ImageDisplay, { images: images, variant: images.length > 1 ? imageVariant : 'single', alt: title, className: "seekora-suggestions-product-card-image", style: { aspectRatio: ar }, enableZoom: enableZoom, zoomMode: zoomMode, zoomLevel: zoomLevel })));
|
|
11588
|
+
React.createElement(ImageDisplay, { images: images, variant: images.length > 1 ? imageVariant : 'single', alt: title, className: "seekora-suggestions-product-card-image", style: { aspectRatio: ar, ...(objectFit ? { objectFit } : {}) }, enableZoom: enableZoom, zoomMode: zoomMode, zoomLevel: zoomLevel })));
|
|
11589
11589
|
}
|
|
11590
|
-
return React.createElement("div", { className: "seekora-product-card__image seekora-suggestions-product-card-placeholder", style: { ...imgPlaceholderStyle, aspectRatio: ar }, "aria-hidden": true });
|
|
11590
|
+
return React.createElement("div", { className: "seekora-product-card__image seekora-suggestions-product-card-placeholder", style: { ...imgPlaceholderStyle, aspectRatio: ar, ...(objectFit ? { objectFit } : {}) }, "aria-hidden": true });
|
|
11591
11591
|
}
|
|
11592
11592
|
/** minimal: image, title, price (current default behavior) */
|
|
11593
11593
|
function MinimalLayout({ images, title, price, product, imageVariant, displayConfig, enableImageZoom, imageZoomMode, imageZoomLevel }) {
|
|
@@ -11595,7 +11595,7 @@ function MinimalLayout({ images, title, price, product, imageVariant, displayCon
|
|
|
11595
11595
|
const titleFontSize = isMobile ? '0.9375rem' : '0.875rem'; // Slightly larger on mobile
|
|
11596
11596
|
const priceFontSize = isMobile ? '0.9375rem' : '0.875rem';
|
|
11597
11597
|
return (React.createElement(React.Fragment, null,
|
|
11598
|
-
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: displayConfig.imageAspectRatio, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
11598
|
+
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: displayConfig.imageAspectRatio, objectFit: displayConfig.imageObjectFit, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
11599
11599
|
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize: titleFontSize, fontWeight: 500, lineHeight: 1.4, overflow: 'hidden', textOverflow: 'ellipsis', display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical' } }, title),
|
|
11600
11600
|
price != null && !Number.isNaN(price) && (React.createElement("span", { className: "seekora-product-card__price seekora-suggestions-product-card-price", style: { fontSize: priceFontSize, color: 'inherit', opacity: 0.6 } },
|
|
11601
11601
|
product.currency ?? '$',
|
|
@@ -11613,7 +11613,7 @@ function StandardLayout({ images, title, price, comparePrice, brand, badges, opt
|
|
|
11613
11613
|
const isOverlayPosition = actionButtonsPosition?.startsWith('overlay');
|
|
11614
11614
|
return (React.createElement(React.Fragment, null,
|
|
11615
11615
|
React.createElement("div", { style: { position: 'relative' } },
|
|
11616
|
-
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: cfg.imageAspectRatio, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
11616
|
+
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: cfg.imageAspectRatio, objectFit: cfg.imageObjectFit, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
11617
11617
|
cfg.showBadges !== false && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "top-left", maxBadges: 2 })),
|
|
11618
11618
|
actionButtons && actionButtons.length > 0 && isOverlayPosition && (React.createElement(ActionButtons, { buttons: actionButtons, position: actionButtonsPosition === 'overlay-top-right' ? 'top-right' : 'bottom-center', showLabels: showActionLabels, size: "small" }))),
|
|
11619
11619
|
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap: bodyGap } },
|
|
@@ -11632,7 +11632,7 @@ function DetailedLayout({ images, title, price, comparePrice, brand, badges, pri
|
|
|
11632
11632
|
const isOverlayPosition = actionButtonsPosition?.startsWith('overlay');
|
|
11633
11633
|
return (React.createElement(React.Fragment, null,
|
|
11634
11634
|
React.createElement("div", { style: { position: 'relative' } },
|
|
11635
|
-
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: cfg.imageAspectRatio, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
11635
|
+
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: cfg.imageAspectRatio, objectFit: cfg.imageObjectFit, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
11636
11636
|
cfg.showBadges !== false && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "top-left" })),
|
|
11637
11637
|
actionButtons && actionButtons.length > 0 && isOverlayPosition && (React.createElement(ActionButtons, { buttons: actionButtons, position: actionButtonsPosition === 'overlay-top-right' ? 'top-right' : 'bottom-center', showLabels: showActionLabels, size: "small" }))),
|
|
11638
11638
|
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap: 4 } },
|