@sonic-equipment/ui 0.0.42 → 0.0.44
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
|
/**
|
|
@@ -6413,7 +6413,9 @@ function Select({ isDisabled = false, label, onChange, options, selectedOption,
|
|
|
6413
6413
|
window.addEventListener('resize', updateWidth);
|
|
6414
6414
|
return () => window.removeEventListener('resize', updateWidth);
|
|
6415
6415
|
}, []);
|
|
6416
|
-
return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles$m.select, styles$m[size]), isDisabled: isDisabled, onSelectionChange: selected => onChange(selected), placeholder: label, selectedKey: String(selectedOption), children: [showLabel && jsx(Label, { children: label }), jsxs(Button$1, { className: styles$m.button, children: [jsx(SelectValue, {}), jsx(GlyphsChevronsSlimDownIcon, { "aria-hidden": "true", className: styles$m.chevron })] }), jsx(Popover, {
|
|
6416
|
+
return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles$m.select, styles$m[size]), isDisabled: isDisabled, onSelectionChange: selected => onChange(selected), placeholder: label, selectedKey: String(selectedOption), children: [showLabel && jsx(Label, { children: label }), jsxs(Button$1, { className: styles$m.button, children: [jsx(SelectValue, {}), jsx(GlyphsChevronsSlimDownIcon, { "aria-hidden": "true", className: styles$m.chevron })] }), jsx(Popover, { ref: ref =>
|
|
6417
|
+
// Workaround for react/react-aria #1513
|
|
6418
|
+
ref?.addEventListener('touchend', e => e.preventDefault()), className: styles$m.popover, placement: "bottom left", triggerRef: selectRef, children: jsx(ListBox, { className: styles$m.listbox, children: jsxs(Section, { children: [jsx(Header, { className: styles$m.header, children: label }), Object.entries(options).map(([key, value]) => (jsxs(ListBoxItem, { "aria-label": value, className: styles$m.item, id: key, textValue: value, children: [selectedOption === key && (jsx("span", { slot: "description", children: jsx(StrokeCheckmarkIcon, { className: styles$m.check }) })), jsx("span", { slot: "label", children: value })] }, key)))] }) }) })] }));
|
|
6417
6419
|
}
|
|
6418
6420
|
|
|
6419
6421
|
var styles$l = {"input-container":"textarea-module-C6Xr1","lg":"textarea-module-vksG-","md":"textarea-module-6JrQJ"};
|
|
@@ -7491,6 +7493,7 @@ function SuggestionsSection() {
|
|
|
7491
7493
|
}), 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
7494
|
}
|
|
7493
7495
|
function ProductResultsSection() {
|
|
7496
|
+
const { close } = useGlobalSearchDisclosure();
|
|
7494
7497
|
const { autocomplete, products: collection } = useAlgoliaSearch();
|
|
7495
7498
|
if (!collection)
|
|
7496
7499
|
return null;
|
|
@@ -7501,11 +7504,11 @@ function ProductResultsSection() {
|
|
|
7501
7504
|
src: product.images?.find(image => image.quality === 'medium')
|
|
7502
7505
|
?.url || '',
|
|
7503
7506
|
title: product.name,
|
|
7504
|
-
}, price: {
|
|
7507
|
+
}, onPress: () => close(), price: {
|
|
7505
7508
|
isVatIncluded: product.isVatIncluded,
|
|
7506
7509
|
originalPrice: product.originalPrice,
|
|
7507
7510
|
price: product.price,
|
|
7508
|
-
}, productId:
|
|
7511
|
+
}, productId: product.storefrontId, sku: product.id, tags: product.labels, title: product.name }, product.id))) }) })] }));
|
|
7509
7512
|
}
|
|
7510
7513
|
|
|
7511
7514
|
function PanelContent() {
|