@sonic-equipment/ui 0.0.42 → 0.0.43
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,4 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { PressEvent } from 'react-aria-components';
|
|
2
3
|
import type { ImageSource } from 'shared/types/image';
|
|
3
4
|
import type { ProductPrice as ProductPriceType } from 'shared/types/price';
|
|
4
5
|
export interface ProductCardProps {
|
|
@@ -6,9 +7,10 @@ export interface ProductCardProps {
|
|
|
6
7
|
favoriteButton?: ReactElement;
|
|
7
8
|
href: string;
|
|
8
9
|
image: ImageSource;
|
|
10
|
+
onPress?: (e: PressEvent) => void;
|
|
9
11
|
price: ProductPriceType;
|
|
10
12
|
sku: string;
|
|
11
13
|
tags?: string[];
|
|
12
14
|
title: string;
|
|
13
15
|
}
|
|
14
|
-
export declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, price, sku, tags, title, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, onPress, price, sku, tags, title, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { ReactElement, MutableRefObject, ReactNode, RefAttributes, HTMLAttributeAnchorTarget, FormEventHandler, KeyboardEvent, ComponentType } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { LinkProps, ButtonProps as ButtonProps$1 } from 'react-aria-components';
|
|
4
|
+
import { LinkProps, ButtonProps as ButtonProps$1, PressEvent } from 'react-aria-components';
|
|
5
5
|
import * as algoliasearch from 'algoliasearch';
|
|
6
6
|
import { SearchClient } from 'algoliasearch';
|
|
7
7
|
import { RouterProps } from 'instantsearch.js/es/middlewares/createRouterMiddleware';
|
|
@@ -3684,12 +3684,13 @@ interface ProductCardProps {
|
|
|
3684
3684
|
favoriteButton?: ReactElement;
|
|
3685
3685
|
href: string;
|
|
3686
3686
|
image: ImageSource;
|
|
3687
|
+
onPress?: (e: PressEvent) => void;
|
|
3687
3688
|
price: ProductPrice$1;
|
|
3688
3689
|
sku: string;
|
|
3689
3690
|
tags?: string[];
|
|
3690
3691
|
title: string;
|
|
3691
3692
|
}
|
|
3692
|
-
declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, price, sku, tags, title, }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
3693
|
+
declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, onPress, price, sku, tags, title, }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
3693
3694
|
|
|
3694
3695
|
interface CategoryCarouselProps {
|
|
3695
3696
|
categoryCards: ReactNode[];
|
package/dist/index.js
CHANGED
|
@@ -992,8 +992,8 @@ function Image({ alt, className, fallbackSrc = 'https://res.cloudinary.com/dkz9e
|
|
|
992
992
|
|
|
993
993
|
var styles$s = {"product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","content":"product-card-module-e0kMu","top":"product-card-module-Q0VvF","tag":"product-card-module-HkWBE","title":"product-card-module-CStNi","bottom":"product-card-module-kD2tU","image":"product-card-module-p-zoi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
|
|
994
994
|
|
|
995
|
-
function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, price, sku, tags, title, }) {
|
|
996
|
-
return (jsxs(RouteLink, { className: styles$s['product-card'], href: href, children: [jsx("div", { className: styles$s.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$s['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$s.content, children: [jsxs("div", { className: styles$s.top, children: [jsx("div", { className: styles$s.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$s.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$s.bottom, children: [jsx("div", { className: styles$s.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$s['add-to-cart-button'], children: AddToCartButton })] })] })] }));
|
|
995
|
+
function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image, onPress, price, sku, tags, title, }) {
|
|
996
|
+
return (jsxs(RouteLink, { className: styles$s['product-card'], href: href, onPress: onPress, children: [jsx("div", { className: styles$s.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$s['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$s.content, children: [jsxs("div", { className: styles$s.top, children: [jsx("div", { className: styles$s.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$s.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$s.bottom, children: [jsx("div", { className: styles$s.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$s['add-to-cart-button'], children: AddToCartButton })] })] })] }));
|
|
997
997
|
}
|
|
998
998
|
|
|
999
999
|
/**
|
|
@@ -7491,6 +7491,7 @@ function SuggestionsSection() {
|
|
|
7491
7491
|
}), children: [jsx("div", { children: item.listCategories[item.listCategories.length - 1] }), jsx("div", { style: { fontSize: '14px' }, children: item.listCategories.slice(0, -1).join(' > ') })] }, item.objectID))) }))] })] }));
|
|
7492
7492
|
}
|
|
7493
7493
|
function ProductResultsSection() {
|
|
7494
|
+
const { close } = useGlobalSearchDisclosure();
|
|
7494
7495
|
const { autocomplete, products: collection } = useAlgoliaSearch();
|
|
7495
7496
|
if (!collection)
|
|
7496
7497
|
return null;
|
|
@@ -7501,11 +7502,11 @@ function ProductResultsSection() {
|
|
|
7501
7502
|
src: product.images?.find(image => image.quality === 'medium')
|
|
7502
7503
|
?.url || '',
|
|
7503
7504
|
title: product.name,
|
|
7504
|
-
}, price: {
|
|
7505
|
+
}, onPress: () => close(), price: {
|
|
7505
7506
|
isVatIncluded: product.isVatIncluded,
|
|
7506
7507
|
originalPrice: product.originalPrice,
|
|
7507
7508
|
price: product.price,
|
|
7508
|
-
}, productId:
|
|
7509
|
+
}, productId: product.storefrontId, sku: product.id, tags: product.labels, title: product.name }, product.id))) }) })] }));
|
|
7509
7510
|
}
|
|
7510
7511
|
|
|
7511
7512
|
function PanelContent() {
|