@sonic-equipment/ui 0.0.75 → 0.0.77
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/index.d.ts
CHANGED
|
@@ -4213,7 +4213,7 @@ interface ImageSource {
|
|
|
4213
4213
|
fallbackSrc?: string
|
|
4214
4214
|
fit?: 'contain' | 'cover'
|
|
4215
4215
|
height?: number
|
|
4216
|
-
image: Image$1 | ResponsiveImage
|
|
4216
|
+
image: Image$1 | ResponsiveImage | undefined
|
|
4217
4217
|
loading?: 'lazy' | 'eager'
|
|
4218
4218
|
onError?: () => void
|
|
4219
4219
|
title: string
|
|
@@ -4542,7 +4542,17 @@ interface ProgressCircleProps {
|
|
|
4542
4542
|
}
|
|
4543
4543
|
declare function ProgressCircle({ className }: ProgressCircleProps): react_jsx_runtime.JSX.Element;
|
|
4544
4544
|
|
|
4545
|
-
|
|
4545
|
+
interface ImageProps {
|
|
4546
|
+
className?: string;
|
|
4547
|
+
fallbackSrc?: string;
|
|
4548
|
+
fit?: 'contain' | 'cover';
|
|
4549
|
+
height?: number;
|
|
4550
|
+
image: Image$1 | ResponsiveImage | undefined;
|
|
4551
|
+
loading?: 'lazy' | 'eager';
|
|
4552
|
+
onError?: () => void;
|
|
4553
|
+
title: string;
|
|
4554
|
+
width?: number;
|
|
4555
|
+
}
|
|
4546
4556
|
declare function Image({ className, fallbackSrc, fit, height, image, loading, title, width, }: ImageProps): react_jsx_runtime.JSX.Element;
|
|
4547
4557
|
|
|
4548
4558
|
declare function PageContainer({ children, className, }: {
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query
|
|
|
19
19
|
import { createLocalStorageRecentSearchesPlugin, search } from '@algolia/autocomplete-plugin-recent-searches';
|
|
20
20
|
|
|
21
21
|
const environments = ['sandbox', 'production', 'local'];
|
|
22
|
-
const localUrls = /
|
|
22
|
+
const localUrls = /localhost:6006/i;
|
|
23
23
|
const sandboxUrls = /local|insitesandbox.com|azurestaticapps|ui.sonic-equipment.com|sandbox|accept|test/i;
|
|
24
24
|
const productionUrls = /sonic-equipment.com|production/i;
|
|
25
25
|
let environmentUrl;
|
|
@@ -1597,7 +1597,7 @@ function ProductSku({ sku }) {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
|
|
1599
1599
|
function isResponsiveImage(image) {
|
|
1600
|
-
return Boolean(image
|
|
1600
|
+
return Boolean(image?.lg);
|
|
1601
1601
|
}
|
|
1602
1602
|
|
|
1603
1603
|
var styles$K = {"image":"image-module-lg7Kj","contain":"image-module-KFEgG","cover":"image-module-tVKFe","has-error":"image-module-LM93B","picture":"image-module-pNYjR"};
|
|
@@ -1612,18 +1612,19 @@ function Image({ className, fallbackSrc = 'https://res.cloudinary.com/dkz9eknwh/
|
|
|
1612
1612
|
fallbackSrc,
|
|
1613
1613
|
fit,
|
|
1614
1614
|
height,
|
|
1615
|
-
image,
|
|
1616
1615
|
loading,
|
|
1617
1616
|
onError: handleError,
|
|
1618
1617
|
title,
|
|
1619
1618
|
width,
|
|
1620
1619
|
};
|
|
1621
1620
|
if (isResponsiveImage(image)) {
|
|
1622
|
-
return jsx(PictureComponent, { ...props, hasError: hasError });
|
|
1621
|
+
return jsx(PictureComponent, { ...props, hasError: hasError, image: image });
|
|
1623
1622
|
}
|
|
1624
|
-
return jsx(ImageComponent, { ...props, hasError: hasError });
|
|
1623
|
+
return jsx(ImageComponent, { ...props, hasError: hasError, image: image });
|
|
1625
1624
|
}
|
|
1626
1625
|
function ImageComponent({ className, fallbackSrc, fit = 'cover', hasError, image, ...rest }) {
|
|
1626
|
+
if (!image)
|
|
1627
|
+
return (jsx("img", { className: clsx(styles$K.image, className, styles$K[fit], styles$K['has-error']), src: fallbackSrc, ...rest }));
|
|
1627
1628
|
const srcSet = !hasError
|
|
1628
1629
|
? `${image[1]} 1x, ${image[2]} 2x, ${image[3]} 3x`
|
|
1629
1630
|
: undefined;
|
|
@@ -1632,8 +1633,8 @@ function ImageComponent({ className, fallbackSrc, fit = 'cover', hasError, image
|
|
|
1632
1633
|
}), src: !hasError ? image[3] : fallbackSrc, srcSet: srcSet, ...rest }));
|
|
1633
1634
|
}
|
|
1634
1635
|
function PictureComponent({ className, fallbackSrc, fit = 'cover', hasError, image, ...rest }) {
|
|
1635
|
-
if (!
|
|
1636
|
-
return
|
|
1636
|
+
if (!image)
|
|
1637
|
+
return (jsx("picture", { className: clsx(styles$K.picture, className), children: jsx("img", { className: clsx(styles$K[fit], styles$K['has-error']), src: fallbackSrc, ...rest }) }));
|
|
1637
1638
|
return (jsxs("picture", { className: clsx(styles$K.picture, className), children: [jsx("source", { media: "(max-width: 768px)", srcSet: `${image.sm[1]} 1x, ${image.sm[2]} 2x, ${image.sm[3]} 3x` }), jsx("source", { media: "(max-width: 1439px)", srcSet: `${image.md[1]} 1x, ${image.md[2]} 2x, ${image.md[3]} 3x` }), jsx("source", { media: "(min-width: 1440px)", srcSet: `${image.lg[1]} 1x, ${image.lg[2]} 2x, ${image.lg[3]} 3x` }), jsx("img", { className: clsx(styles$K[fit], {
|
|
1638
1639
|
[styles$K['has-error']]: hasError,
|
|
1639
1640
|
}), src: !hasError ? image.lg[3] : fallbackSrc, ...rest })] }));
|
|
@@ -7566,10 +7567,11 @@ function ProductDetailsPanel({ product }) {
|
|
|
7566
7567
|
flexDirection: 'column',
|
|
7567
7568
|
gap: '8px',
|
|
7568
7569
|
}, children: [jsx(Heading, { size: "xs", children: product.productTitle }), jsx(ProductSku, { sku: product.productNumber })] }), jsxs("div", { style: {
|
|
7570
|
+
alignItems: 'flex-end',
|
|
7569
7571
|
display: 'flex',
|
|
7570
7572
|
justifyContent: 'space-between',
|
|
7571
7573
|
width: '100%',
|
|
7572
|
-
}, children: [jsx(ProductPrice, { isVatIncluded: false, originalPrice: product.unitListPrice, price: product.unitListPrice }), jsxs("div", { style: { display: 'flex', gap: '8px' }, children: [product.canAddToCart && (jsx(ConnectedAddToCartButton, { productId: product.storefrontId })), product.canAddToWishlist && (jsx(ConnectedFavoriteButton, { productId: product.storefrontId }))] })] }), jsxs("div", { children: [jsx(Heading, { size: "xxs", children: jsx(FormattedMessage, { id: "Product Features" }) }), jsx(ShowAll, { initialHeight: 216, children: jsx("div", { className: styles$l.description, dangerouslySetInnerHTML: {
|
|
7574
|
+
}, children: [jsx(ProductPrice, { isVatIncluded: false, originalPrice: product.unitListPrice, price: product.unitListPrice }), jsxs("div", { style: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [product.canAddToCart && (jsx(ConnectedAddToCartButton, { productId: product.storefrontId })), product.canAddToWishlist && (jsx(ConnectedFavoriteButton, { productId: product.storefrontId }))] })] }), jsxs("div", { children: [jsx(Heading, { size: "xxs", children: jsx(FormattedMessage, { id: "Product Features" }) }), jsx(ShowAll, { initialHeight: 216, children: jsx("div", { className: styles$l.description, dangerouslySetInnerHTML: {
|
|
7573
7575
|
__html: product.content.htmlContent,
|
|
7574
7576
|
} }) })] }), jsx("div", { children: jsxs(Accordion, { indented: true, borderType: ['top', 'middle-accentuated'], children: [Boolean(product.attributeTypes.length) && (jsx(AccordionItem, { id: "specification", title: jsx(FormattedMessage, { id: "Specifications" }), children: jsx(FeatureList, { className: styles$l['feature-list'], features: product.attributeTypes.map(attribute => ({
|
|
7575
7577
|
id: `${attribute.id}`,
|
|
@@ -7599,15 +7601,17 @@ function ProductDetailsPage({ pageUrl }) {
|
|
|
7599
7601
|
if (!data || isFetching)
|
|
7600
7602
|
return jsx(LoadingPage, {});
|
|
7601
7603
|
const { breadCrumb, included, product, recentlyViewed } = data;
|
|
7602
|
-
return (jsx(Page, { breadCrumb: breadCrumb, children: jsx(ProductDetailsPageLayout, { imageGallery: jsx(ImagesGrid, { images: product.images }), included: included
|
|
7604
|
+
return (jsx(Page, { breadCrumb: breadCrumb, children: jsx(ProductDetailsPageLayout, { imageGallery: jsx(ImagesGrid, { images: product.images }), included: included !== undefined &&
|
|
7605
|
+
Boolean(included.length) && (jsxs(Fragment, { children: [jsx(Heading, { size: "s", tag: "h2", children: jsx(FormattedMessage, { id: "Includes" }) }), jsx(ProductCarousel, { allowExpandToGrid: true, hasOverflow: true, productCards: included.map(product => (jsx(ConnectedProductCard, { href: product.href, image: {
|
|
7603
7606
|
fit: 'contain',
|
|
7604
7607
|
image: product.image,
|
|
7605
|
-
title: product.image.
|
|
7606
|
-
}, price: product.price, productId: product.productId, sku: product.sku, tags: product.tags, title: product.title }, product.storefrontId))) })] })), productInformation: jsx(ProductDetailsPanel, { product: product }), recentlyViewed: recentlyViewed
|
|
7608
|
+
title: product.image?.altText || product.title,
|
|
7609
|
+
}, price: product.price, productId: product.productId, sku: product.sku, tags: product.tags, title: product.title }, product.storefrontId))) })] })), productInformation: jsx(ProductDetailsPanel, { product: product }), recentlyViewed: recentlyViewed !== undefined &&
|
|
7610
|
+
Boolean(recentlyViewed.length) && (jsxs(Fragment, { children: [jsx(Heading, { size: "s", tag: "h2", children: jsx(FormattedMessage, { id: "Recently viewed" }) }), jsx(ProductCarousel, { hasOverflow: true, productCards: recentlyViewed.map(product => (jsx(ConnectedProductCard, { href: product.href, image: {
|
|
7607
7611
|
fit: 'contain',
|
|
7608
7612
|
image: product.image,
|
|
7609
|
-
title: product.image.
|
|
7610
|
-
}, price: product.price, productId: product.productId, sku: product.sku, tags: product.tags, title: product.title }, product.storefrontId))) })] }))
|
|
7613
|
+
title: product.image?.altText || product.title,
|
|
7614
|
+
}, price: product.price, productId: product.productId, sku: product.sku, tags: product.tags, title: product.title }, product.storefrontId))) })] })), usp: jsx("div", { style: {
|
|
7611
7615
|
backgroundColor: '#bcbcbc',
|
|
7612
7616
|
display: 'grid',
|
|
7613
7617
|
fontWeight: 'bold',
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type Image as ImageType, ResponsiveImage } from 'shared/model/image';
|
|
2
|
+
interface ImageProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
fallbackSrc?: string;
|
|
5
|
+
fit?: 'contain' | 'cover';
|
|
6
|
+
height?: number;
|
|
7
|
+
image: ImageType | ResponsiveImage | undefined;
|
|
8
|
+
loading?: 'lazy' | 'eager';
|
|
9
|
+
onError?: () => void;
|
|
10
|
+
title: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
}
|
|
3
13
|
export declare function Image({ className, fallbackSrc, fit, height, image, loading, title, width, }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
4
14
|
export {};
|
|
@@ -11,7 +11,7 @@ export interface ImageSource {
|
|
|
11
11
|
fallbackSrc?: string;
|
|
12
12
|
fit?: 'contain' | 'cover';
|
|
13
13
|
height?: number;
|
|
14
|
-
image: Image | ResponsiveImage;
|
|
14
|
+
image: Image | ResponsiveImage | undefined;
|
|
15
15
|
loading?: 'lazy' | 'eager';
|
|
16
16
|
onError?: () => void;
|
|
17
17
|
title: string;
|
|
@@ -23,5 +23,5 @@ export interface ResponsiveImage {
|
|
|
23
23
|
md: DPRSrcSet;
|
|
24
24
|
sm: DPRSrcSet;
|
|
25
25
|
}
|
|
26
|
-
export declare function isResponsiveImage(image: Image | ResponsiveImage): image is ResponsiveImage;
|
|
26
|
+
export declare function isResponsiveImage(image: Image | ResponsiveImage | undefined): image is ResponsiveImage;
|
|
27
27
|
export {};
|