@sonic-equipment/ui 141.0.0 → 143.0.0
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/address-info-display/address-info-display.d.ts +6 -0
- package/dist/{address/address.js → address-info-display/address-info-display.js} +3 -3
- package/dist/address-info-display/address-info-display.module.css.js +3 -0
- package/dist/algolia/algolia-filter-panel.js +2 -2
- package/dist/algolia/algolia-search-provider.js +22 -11
- package/dist/background-overlay/background-overlay.js +4 -7
- package/dist/badges/badge/badge.js +4 -8
- package/dist/base.css +2 -0
- package/dist/breadcrumbs/breadcrumb.js +4 -4
- package/dist/buttons/add-to-cart-button/add-to-cart-button.js +27 -40
- package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +19 -2
- package/dist/buttons/favorite/connected-favorite-button.js +12 -18
- package/dist/buttons/favorite/favorite-button.d.ts +1 -1
- package/dist/buttons/icon-button/icon-button.d.ts +4 -2
- package/dist/buttons/icon-button/icon-button.js +5 -2
- package/dist/buttons/link/link.d.ts +12 -5
- package/dist/buttons/link/link.js +10 -4
- package/dist/carousel/card-carousel/card-carousel.js +3 -2
- package/dist/carousel/carousel-navigation-button.js +1 -1
- package/dist/carousel/carousel.js +8 -8
- package/dist/carousel/pagination/pagination.d.ts +1 -1
- package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +3 -1
- package/dist/carousel/usp-carousel/product-usp-carousel.js +1 -1
- package/dist/carousel/usp-carousel/usp-carousel.js +3 -1
- package/dist/country-select/country-select.d.ts +27 -0
- package/dist/{country-selector/country-select → country-select}/country-select.js +7 -4
- package/dist/country-select/hooks/use-countries.d.ts +12 -0
- package/dist/country-select/hooks/use-countries.js +51 -0
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +11 -9
- package/dist/country-selector/country-selector-trigger/country-selector-trigger.d.ts +1 -1
- package/dist/country-selector/use-countries-languages.d.ts +3 -3
- package/dist/country-selector/use-countries-languages.js +3 -1
- package/dist/exports.d.ts +12 -4
- package/dist/filters/active-filters/active-filters.d.ts +1 -1
- package/dist/forms/number-field/number-field.js +5 -1
- package/dist/forms/select/select.js +3 -2
- package/dist/forms/textarea/textarea.js +1 -1
- package/dist/global-search/global-search-provider/global-search-provider.js +3 -2
- package/dist/global-search/search-highlight/highlight.js +1 -0
- package/dist/global-search/search-result-panel/sections/no-search.js +3 -1
- package/dist/header/header.d.ts +5 -1
- package/dist/header/header.js +5 -2
- package/dist/header/link-list/navigation-link-list.d.ts +6 -0
- package/dist/header/link-list/navigation-link-list.js +15 -0
- package/dist/header/link-list/navigation-link-list.module.css.js +3 -0
- package/dist/index.js +15 -7
- package/dist/info-icon-tooltip/info-icon-tooltip.d.ts +3 -1
- package/dist/info-icon-tooltip/info-icon-tooltip.js +5 -5
- package/dist/intl/intl-context.js +2 -1
- package/dist/intl/intl-provider.js +7 -6
- package/dist/intl/missing-translation-provider.js +6 -5
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/lists/feature-list/feature-list.js +3 -1
- package/dist/lists/orderline-list/orderline-list.d.ts +1 -1
- package/dist/lists/orderline-list/orderline-list.js +6 -1
- package/dist/lists/product-overview-grid/product-overview-grid.js +5 -1
- package/dist/media/image/image.d.ts +1 -1
- package/dist/media/image-lightbox/image-lightbox.js +6 -2
- package/dist/media/zoom-image/zoom-image.d.ts +1 -1
- package/dist/message/message.d.ts +2 -1
- package/dist/message/message.js +2 -2
- package/dist/modals/favorite/add-to-favorite-dialog.d.ts +1 -1
- package/dist/modals/modal/modal.js +2 -1
- package/dist/notifications/announcements/connected-announcement.js +1 -1
- package/dist/pages/checkout/components/billing-and-invoice-information.js +2 -2
- package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.js +3 -1
- package/dist/pages/checkout/payment-page/components/payment.js +1 -2
- package/dist/pages/checkout/shipping-page/components/currency-change-dialog.d.ts +6 -0
- package/dist/pages/checkout/shipping-page/components/currency-change-dialog.js +13 -0
- package/dist/pages/checkout/shipping-page/components/edit-address-form.d.ts +12 -10
- package/dist/pages/checkout/shipping-page/components/edit-address-form.js +11 -4
- package/dist/pages/checkout/shipping-page/components/edit-address-form.module.css.js +1 -1
- package/dist/pages/checkout/shipping-page/components/readonly-address.d.ts +2 -2
- package/dist/pages/checkout/shipping-page/components/readonly-address.js +6 -4
- package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.d.ts +4 -4
- package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.js +8 -4
- package/dist/pages/checkout/shipping-page/shipping-page.js +68 -17
- package/dist/pages/components/page-container/page-container.js +2 -1
- package/dist/pages/error-page/error-page.js +4 -1
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +3 -1
- package/dist/pages/product/product-listing-page/no-results/no-results.js +3 -3
- package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +1 -1
- package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +3 -2
- package/dist/pages/product/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js +1 -1
- package/dist/promos/promo-banners/promo-banners.d.ts +6 -5
- package/dist/promos/promo-banners/promo-banners.js +6 -5
- package/dist/promos/promo-card/promo-card.d.ts +1 -1
- package/dist/shared/api/bff/model/bff.model.d.ts +13 -0
- package/dist/shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.d.ts +2 -2
- package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.d.ts +2 -2
- package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.d.ts +2 -2
- package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.d.ts +4 -2
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.js +3 -2
- package/dist/shared/api/storefront/hooks/website/{use-fetch-countries.d.ts → use-fetch-country-models.d.ts} +1 -1
- package/dist/shared/api/storefront/hooks/website/use-fetch-country-models.js +16 -0
- package/dist/shared/api/storefront/model/storefront.model.d.ts +21 -1
- package/dist/shared/api/storefront/services/customer-service.d.ts +3 -3
- package/dist/shared/api/storefront/services/customer-service.js +1 -1
- package/dist/shared/api/storefront/services/website-service.d.ts +1 -3
- package/dist/shared/api/storefront/services/website-service.js +4 -45
- package/dist/shared/data/cart.data.d.ts +2 -0
- package/dist/shared/data/cart.data.js +650 -0
- package/dist/shared/data/countries-languages.data.d.ts +11 -0
- package/dist/shared/data/countries-languages.data.js +61 -0
- package/dist/shared/hooks/use-breakpoint.js +2 -2
- package/dist/shared/hooks/use-cookie.d.ts +1 -0
- package/dist/shared/hooks/use-cookie.js +13 -7
- package/dist/shared/hooks/use-disclosure.d.ts +3 -3
- package/dist/shared/hooks/use-is-breakpoint.js +1 -1
- package/dist/shared/hooks/use-is-scrolled-beyond-element.d.ts +1 -0
- package/dist/shared/hooks/use-is-scrolled-beyond-element.js +26 -0
- package/dist/shared/hooks/use-scroll-to.d.ts +1 -1
- package/dist/shared/hooks/use-scroll-to.js +2 -2
- package/dist/shared/model/countries-languages.d.ts +3 -1
- package/dist/shared/model/countries-languages.js +32 -0
- package/dist/shared/model/defaults.d.ts +1 -0
- package/dist/shared/model/defaults.js +3 -0
- package/dist/shared/model/image.d.ts +1 -1
- package/dist/shared/model/link.d.ts +15 -0
- package/dist/shared/providers/favorite-provider.d.ts +3 -3
- package/dist/shared/providers/global-state-provider.js +2 -1
- package/dist/shared/reset.module.css.js +3 -0
- package/dist/shared/routing/with-routing.js +1 -0
- package/dist/shared/utils/local-storage.d.ts +1 -7
- package/dist/shared/utils/local-storage.js +4 -4
- package/dist/shared/utils/number.d.ts +1 -0
- package/dist/shared/utils/number.js +10 -0
- package/dist/sidebar/sidebar-provider.js +4 -1
- package/dist/sidebar/use-sidebar.js +4 -3
- package/dist/sign-in-form/sign-in-form.js +2 -1
- package/dist/styles.css +68 -5
- package/dist/tooltip/tooltip.js +6 -3
- package/package.json +17 -14
- package/dist/address/address.d.ts +0 -6
- package/dist/address/address.module.css.js +0 -3
- package/dist/country-selector/country-select/country-select.d.ts +0 -27
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +0 -15
- package/dist/shared/model/countries.d.ts +0 -225
- package/dist/shared/model/countries.js +0 -260
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AddressType } from '../shared/model/address';
|
|
2
|
+
export interface AddressProps {
|
|
3
|
+
address: AddressType;
|
|
4
|
+
'data-test-selector'?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function AddressInfoDisplay({ address, 'data-test-selector': dataTestSelector, }: AddressProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { capitalizeFirstLetter } from '../shared/utils/string.js';
|
|
3
|
-
import styles from './address.module.css.js';
|
|
3
|
+
import styles from './address-info-display.module.css.js';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function AddressInfoDisplay({ address, 'data-test-selector': dataTestSelector, }) {
|
|
6
6
|
const { address1, address2, address3, city, companyName, country, email, firstName, lastName, phone, postalCode, } = address;
|
|
7
7
|
return (jsxs("address", { className: styles.address, "data-test-selector": dataTestSelector, children: [(firstName || lastName) && (jsx("p", { "data-test-selector": "addressInfoDisplay_name", children: `${firstName} ${lastName}` })), companyName && (jsx("p", { "data-test-selector": "addressInfoDisplay_companyName", children: companyName })), address1 && (jsx("p", { "data-test-selector": "addressInfoDisplay_address1", children: address1 })), address2 && (jsx("p", { "data-test-selector": "addressInfoDisplay_address2", children: address2 })), address3 && (jsx("p", { "data-test-selector": "addressInfoDisplay_address3", children: address3 })), (postalCode || city) && (jsxs("p", { "data-test-selector": "addressInfoDisplay_postalCodeAndCity", children: [postalCode, " ", city ? capitalizeFirstLetter(city) : ''] })), country && (jsx("p", { "data-test-selector": "addressInfoDisplay_country", children: country })), phone && jsx("p", { "data-test-selector": "addressInfoDisplay_phone", children: phone }), email && jsx("p", { "data-test-selector": "addressInfoDisplay_email", children: email })] }));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export {
|
|
10
|
+
export { AddressInfoDisplay };
|
|
@@ -34,8 +34,8 @@ function AlgoliaFilterPanel({ showActiveCategories = false, showCategoriesFilter
|
|
|
34
34
|
});
|
|
35
35
|
return (jsx("div", { className: styles['filter-panel'], children: jsxs("div", { className: styles['scroll-container'], children: [showActiveCategories && jsx(AlgoliaActiveCategories, {}), showCategoriesFilters && jsx(AlgoliaCategoriesFilters, {}), jsx(AlgoliaActiveFilters, {}), attributesToRender.length === 0 ? (jsx(AlgoliaDummyRefinementListConsumer, {})) : (jsx("section", { children: attributesToRender
|
|
36
36
|
.filter(attribute => !MULTISELECT_ATTRIBUTE_IGNORE_LIST.includes(attribute))
|
|
37
|
-
.map(
|
|
38
|
-
return (jsx(AlgoliaMultiSelectFilterSection, { attribute: attribute }, `attribute-${
|
|
37
|
+
.map(attribute => {
|
|
38
|
+
return (jsx(AlgoliaMultiSelectFilterSection, { attribute: attribute }, `attribute-${attribute}`));
|
|
39
39
|
}) })), jsx(PanelCloseButton, {})] }) }));
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -142,17 +142,28 @@ function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
|
142
142
|
window?.removeEventListener('touchmove', onTouchMove);
|
|
143
143
|
};
|
|
144
144
|
}, [getEnvironmentProps, state.isOpen]);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
145
|
+
const value = useMemo(() => ({
|
|
146
|
+
autocomplete,
|
|
147
|
+
formRef,
|
|
148
|
+
inputRef,
|
|
149
|
+
panelRef,
|
|
150
|
+
productsIndexName,
|
|
151
|
+
productsQuerySuggestionsIndexName,
|
|
152
|
+
searchClient,
|
|
153
|
+
setState,
|
|
154
|
+
state,
|
|
155
|
+
}), [
|
|
156
|
+
autocomplete,
|
|
157
|
+
formRef,
|
|
158
|
+
inputRef,
|
|
159
|
+
panelRef,
|
|
160
|
+
productsIndexName,
|
|
161
|
+
productsQuerySuggestionsIndexName,
|
|
162
|
+
searchClient,
|
|
163
|
+
setState,
|
|
164
|
+
state,
|
|
165
|
+
]);
|
|
166
|
+
return (jsx(AlgoliaInsightsProvider, { value: { index: productsIndexName }, children: jsx(GlobalSearchContext.Provider, { value: value, children: typeof children === 'function' ? children(autocomplete) : children }) }));
|
|
156
167
|
}
|
|
157
168
|
|
|
158
169
|
export { AlgoliaSearchProvider, GlobalSearchContext };
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import styles from './background-overlay.module.css.js';
|
|
7
7
|
|
|
8
8
|
function BackgroundOverlay({ className, isOpen, onClose, }) {
|
|
9
|
-
const [, setRender] = useState(isOpen);
|
|
10
9
|
const nodeRef = useRef(null);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (isOpen)
|
|
13
|
-
setRender(isOpen);
|
|
14
|
-
}, [isOpen]);
|
|
15
10
|
useEffect(() => {
|
|
16
11
|
const node = nodeRef.current;
|
|
17
12
|
if (!node || isOpen)
|
|
18
13
|
return;
|
|
19
14
|
const handleAnimationEnd = () => {
|
|
20
|
-
setRender(false);
|
|
21
15
|
node.removeEventListener('animationend', handleAnimationEnd);
|
|
22
16
|
};
|
|
23
17
|
node.addEventListener('animationend', handleAnimationEnd);
|
|
18
|
+
return () => {
|
|
19
|
+
node.removeEventListener('animationend', handleAnimationEnd);
|
|
20
|
+
};
|
|
24
21
|
}, [isOpen]);
|
|
25
22
|
if (typeof document === 'undefined')
|
|
26
23
|
return null;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import styles from './badge.module.css.js';
|
|
6
6
|
|
|
7
7
|
const ANIMATION_DURATION = 600;
|
|
8
8
|
function Badge({ count, variant = 'red' }) {
|
|
9
|
-
const
|
|
9
|
+
const lastCount = useRef(null);
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
|
|
12
|
-
return;
|
|
13
|
-
setIsAnimating(true);
|
|
14
|
-
const timer = setTimeout(() => setIsAnimating(false), ANIMATION_DURATION);
|
|
15
|
-
return () => clearTimeout(timer);
|
|
11
|
+
lastCount.current = count;
|
|
16
12
|
}, [count]);
|
|
17
13
|
return (jsx("span", { className: clsx(styles.badge, styles[variant], {
|
|
18
|
-
[styles['is-animating']]:
|
|
14
|
+
[styles['is-animating']]: count !== undefined && count !== lastCount.current,
|
|
19
15
|
}), style: { '--animation-duration': `${ANIMATION_DURATION}ms` }, children: count !== undefined && jsx("span", { className: styles.count, children: count }) }, count));
|
|
20
16
|
}
|
|
21
17
|
|
package/dist/base.css
CHANGED
|
@@ -4,7 +4,7 @@ import { Breadcrumbs, Breadcrumb as Breadcrumb$1 } from 'react-aria-components';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { GlyphsChevronsSlimLeftIcon } from '../icons/glyph/glyphs-chevrons-slim-left-icon.js';
|
|
6
6
|
import { SolidHomeIcon } from '../icons/solid/solid-home-icon.js';
|
|
7
|
-
import {
|
|
7
|
+
import { useIsBreakpoint } from '../shared/hooks/use-is-breakpoint.js';
|
|
8
8
|
import { RouteLink } from '../shared/routing/route-link.js';
|
|
9
9
|
import styles from './breadcrumb.module.css.js';
|
|
10
10
|
|
|
@@ -24,13 +24,13 @@ function BreadcrumbLong({ links }) {
|
|
|
24
24
|
const homeLink = links[0];
|
|
25
25
|
if (!homeLink)
|
|
26
26
|
return null;
|
|
27
|
-
return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsx(RouteLink, { className: styles.link, href: homeLink.href, title: homeLink.label, children: jsx(SolidHomeIcon, { className: clsx(styles['home-icon'], styles.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, index)))] }));
|
|
27
|
+
return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsx(RouteLink, { className: styles.link, href: homeLink.href, title: homeLink.label, children: jsx(SolidHomeIcon, { className: clsx(styles['home-icon'], styles.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, link.href + link.label || index)))] }));
|
|
28
28
|
}
|
|
29
29
|
function Breadcrumb({ links }) {
|
|
30
|
-
const
|
|
30
|
+
const isLg = useIsBreakpoint('lg');
|
|
31
31
|
if (links.length <= 1)
|
|
32
32
|
return null;
|
|
33
|
-
return
|
|
33
|
+
return isLg ? BreadcrumbLong({ links }) : BreadcrumbShort({ links });
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export { Breadcrumb };
|
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useState,
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
4
4
|
import { NumberField } from '../../forms/number-field/number-field.js';
|
|
5
5
|
import { SolidCartIcon } from '../../icons/solid/solid-cart-icon.js';
|
|
6
6
|
import { useDebouncedCallback } from '../../shared/hooks/use-debounced-callback.js';
|
|
7
|
+
import { ensureNumber } from '../../shared/utils/number.js';
|
|
7
8
|
import { Button } from '../button/button.js';
|
|
8
9
|
import styles from './add-to-cart-button.module.css.js';
|
|
9
10
|
|
|
10
11
|
function AddToCartButton({ initialState = 'initial', isDisabled = false, onChange, quantity, }) {
|
|
12
|
+
return (jsx(InternalAddToCartButton, { initialState: initialState, isDisabled: isDisabled, onChange: onChange, quantity: quantity }, quantity));
|
|
13
|
+
}
|
|
14
|
+
function InternalAddToCartButton({ initialState = 'initial', isDisabled = false, onChange: _onChange, quantity: _quantity, }) {
|
|
15
|
+
const [quantity, setQuantity] = useState(_quantity);
|
|
11
16
|
const [currentState, setState] = useState(quantity > 0 ? 'spinner' : initialState);
|
|
12
17
|
const [manualInputQuantity, setManualInputQuantity] = useState(null);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return (jsxs("div", { "data-test-selector": "addToCartButton", children: [currentState === 'initial' && (jsx(InitialState, { isDisabled: isDisabled, onAddToCart: () => {
|
|
32
|
-
onChange(1);
|
|
33
|
-
} })), currentState === 'spinner' && (jsx(SpinnerState, { isDisabled: isDisabled, onChange: value => {
|
|
34
|
-
onChange(value);
|
|
35
|
-
}, onManualInput: value => {
|
|
18
|
+
function computeCurrentState() {
|
|
19
|
+
if (currentState === 'initial' && quantity > 0)
|
|
20
|
+
return 'spinner';
|
|
21
|
+
if (currentState === 'spinner' && quantity === 0)
|
|
22
|
+
return 'initial';
|
|
23
|
+
if (currentState === 'manual-input' && quantity === 0)
|
|
24
|
+
return 'initial';
|
|
25
|
+
if (currentState === 'manual-input' && manualInputQuantity === null)
|
|
26
|
+
return 'initial';
|
|
27
|
+
return currentState;
|
|
28
|
+
}
|
|
29
|
+
if (currentState !== computeCurrentState())
|
|
30
|
+
setState(computeCurrentState());
|
|
31
|
+
const onChange = useCallback((quantity) => {
|
|
32
|
+
_onChange(quantity);
|
|
33
|
+
setQuantity(quantity);
|
|
34
|
+
}, [_onChange]);
|
|
35
|
+
return (jsxs("div", { "data-test-selector": "addToCartButton", children: [currentState === 'initial' && (jsx(InitialState, { isDisabled: isDisabled, onAddToCart: () => onChange(1) })), currentState === 'spinner' && (jsx(SpinnerState, { isDisabled: isDisabled, onChange: onChange, onManualInput: value => {
|
|
36
36
|
setManualInputQuantity(value);
|
|
37
37
|
setState('manual-input');
|
|
38
|
-
}, quantity: quantity })), currentState === 'manual-input' && (jsx(ManualInputState, { isDisabled: isDisabled, onCancel: () => setState('spinner'), onConfirm:
|
|
39
|
-
onChange(value);
|
|
40
|
-
}, quantity: manualInputQuantity || '' }))] }));
|
|
38
|
+
}, quantity: quantity }, quantity)), currentState === 'manual-input' && (jsx(ManualInputState, { isDisabled: isDisabled, onCancel: () => setState('spinner'), onConfirm: onChange, quantity: manualInputQuantity || '' }))] }));
|
|
41
39
|
}
|
|
42
40
|
function InitialState({ isDisabled, onAddToCart, }) {
|
|
43
41
|
return (jsx(Button, { condensed: true, icon: jsx(SolidCartIcon, {}), isDisabled: isDisabled, onClick: e => {
|
|
@@ -46,14 +44,6 @@ function InitialState({ isDisabled, onAddToCart, }) {
|
|
|
46
44
|
onAddToCart();
|
|
47
45
|
}, size: "md" }));
|
|
48
46
|
}
|
|
49
|
-
const ensureNumber = (value) => {
|
|
50
|
-
if (typeof value === 'number')
|
|
51
|
-
return value;
|
|
52
|
-
if (typeof value !== 'string')
|
|
53
|
-
return 0;
|
|
54
|
-
const numberValue = Number.parseFloat(value);
|
|
55
|
-
return Number.isNaN(numberValue) ? 0 : numberValue;
|
|
56
|
-
};
|
|
57
47
|
function SpinnerState({ isDisabled, onChange, onManualInput, quantity, }) {
|
|
58
48
|
const [internalQuantity, setInternalQuantity] = useState(quantity);
|
|
59
49
|
const mounted = useRef(false);
|
|
@@ -62,16 +52,13 @@ function SpinnerState({ isDisabled, onChange, onManualInput, quantity, }) {
|
|
|
62
52
|
if (!mounted.current)
|
|
63
53
|
return;
|
|
64
54
|
onChange(value);
|
|
65
|
-
},
|
|
55
|
+
}, 1500);
|
|
66
56
|
useEffect(() => {
|
|
67
57
|
mounted.current = true;
|
|
68
58
|
return () => {
|
|
69
59
|
mounted.current = false;
|
|
70
60
|
};
|
|
71
61
|
}, []);
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
setInternalQuantity(quantity);
|
|
74
|
-
}, [quantity]);
|
|
75
62
|
return (jsx(NumberField, { withButtons: true, autoGrow: true, "data-test-selector": "quantity", formatOptions: {
|
|
76
63
|
maximumFractionDigits: 0,
|
|
77
64
|
style: 'decimal',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import { FormattedMessage } from '../../intl/formatted-message.js';
|
|
4
5
|
import { useAddProductToCurrentCart } from '../../shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js';
|
|
5
6
|
import { useDeleteCartLineById } from '../../shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js';
|
|
@@ -11,9 +12,10 @@ import { useToast } from '../../toast/use-toast.js';
|
|
|
11
12
|
import { AddToCartButton } from './add-to-cart-button.js';
|
|
12
13
|
|
|
13
14
|
const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
15
|
+
const [isUpdatingCartLine, setIsUpdatingCartLine] = useState(false);
|
|
14
16
|
const { createEcommerceEvent, dataLayer } = useDataLayer();
|
|
15
17
|
const { isPending: isPendingAddToCart, mutate: addToCart } = useAddProductToCurrentCart();
|
|
16
|
-
const { data: cartLines
|
|
18
|
+
const { data: cartLines } = useFetchCurrentCartLines();
|
|
17
19
|
const { isPending: isPendingDeleteCartLine, mutate: deleteCartLine } = useDeleteCartLineById();
|
|
18
20
|
const { mutate: updateCartLine } = usePatchCartLineById();
|
|
19
21
|
const { addToast } = useToast();
|
|
@@ -57,6 +59,18 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
57
59
|
},
|
|
58
60
|
onSuccess: () => {
|
|
59
61
|
onCartLineUpdated?.({ ...cartLine, qtyOrdered: quantity });
|
|
62
|
+
const updatedQuantity = quantity - (cartLine.qtyOrdered || 0);
|
|
63
|
+
if (updatedQuantity > 0) {
|
|
64
|
+
dataLayer.push(createEcommerceEvent({
|
|
65
|
+
cartLine: {
|
|
66
|
+
...cartLine,
|
|
67
|
+
qtyOrdered: updatedQuantity,
|
|
68
|
+
},
|
|
69
|
+
event: {
|
|
70
|
+
event: 'add_to_cart',
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
60
74
|
addToast({
|
|
61
75
|
body: (jsx(FormattedMessage, { id: "The product has been updated in your cart." })),
|
|
62
76
|
isUserDismissable: false,
|
|
@@ -67,6 +81,7 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
67
81
|
}
|
|
68
82
|
}
|
|
69
83
|
else {
|
|
84
|
+
setIsUpdatingCartLine(true);
|
|
70
85
|
addToCart({ productId, qtyOrdered: quantity, unitOfMeasure: '' }, {
|
|
71
86
|
onError: error => {
|
|
72
87
|
onCartLineError?.(error, cartLine);
|
|
@@ -75,6 +90,7 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
75
90
|
isUserDismissable: false,
|
|
76
91
|
messageType: 'danger',
|
|
77
92
|
});
|
|
93
|
+
setIsUpdatingCartLine(false);
|
|
78
94
|
},
|
|
79
95
|
onSuccess: cartLine => {
|
|
80
96
|
onAddToCart?.({ cartLine });
|
|
@@ -90,11 +106,12 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
90
106
|
isUserDismissable: false,
|
|
91
107
|
messageType: 'success',
|
|
92
108
|
});
|
|
109
|
+
setIsUpdatingCartLine(false);
|
|
93
110
|
},
|
|
94
111
|
});
|
|
95
112
|
}
|
|
96
113
|
};
|
|
97
|
-
return (jsx(AddToCartButton, { isDisabled: isPendingDeleteCartLine ||
|
|
114
|
+
return (jsx(AddToCartButton, { isDisabled: isPendingDeleteCartLine || isPendingAddToCart || isUpdatingCartLine, onChange: handleChange, quantity: quantity }));
|
|
98
115
|
};
|
|
99
116
|
|
|
100
117
|
export { ConnectedAddToCartButton };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useState
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
import { SignInDialog } from '../../modals/signin/sign-in-dialog.js';
|
|
5
5
|
import { useFetchSession } from '../../shared/api/storefront/hooks/authentication/use-fetch-session.js';
|
|
6
6
|
import { useIsAuthenticated } from '../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
|
|
@@ -16,8 +16,10 @@ function ConnectedFavoriteButton({ onFavorited: _onFavorited, onFavoriting: _onF
|
|
|
16
16
|
const { isFavorite: _isFavorite, isFetching, wishList, wishListItem, } = useFavoriteProduct(productId);
|
|
17
17
|
const [showSignInDialog, setShowSignInDialog] = useState(false);
|
|
18
18
|
const { error: addWishListItemToCurrentWishListError, mutate: addWishListItemToCurrentWishList, } = useAddWishListItemToCurrentWishList();
|
|
19
|
-
const {
|
|
19
|
+
const { mutate: deleteWishListItemFromWishList } = useDeleteWishListItemFromWishList();
|
|
20
20
|
const [isFavorite, setIsFavorite] = useState(_isFavorite);
|
|
21
|
+
if (_isFavorite !== isFavorite)
|
|
22
|
+
setIsFavorite(_isFavorite);
|
|
21
23
|
function onFavorite() {
|
|
22
24
|
if (!(wishList && wishListItem))
|
|
23
25
|
_onFavoriting?.();
|
|
@@ -39,23 +41,15 @@ function ConnectedFavoriteButton({ onFavorited: _onFavorited, onFavoriting: _onF
|
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
setIsFavorite(_isFavorite);
|
|
44
|
-
}, [_isFavorite]);
|
|
45
|
-
useEffect(() => {
|
|
44
|
+
if (isFavorite !== Boolean(wishList && wishListItem)) {
|
|
46
45
|
setIsFavorite(Boolean(wishList && wishListItem));
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
addWishListItemToCurrentWishListError
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
addWishListItemToCurrentWishListError instanceof UnauthorizedRequestError) {
|
|
55
|
-
refetch();
|
|
56
|
-
return setShowSignInDialog(true);
|
|
57
|
-
}
|
|
58
|
-
}, [addWishListItemToCurrentWishListError, refetch]);
|
|
46
|
+
}
|
|
47
|
+
if ((!showSignInDialog &&
|
|
48
|
+
addWishListItemToCurrentWishListError instanceof ForbiddenRequestError) ||
|
|
49
|
+
addWishListItemToCurrentWishListError instanceof UnauthorizedRequestError) {
|
|
50
|
+
setShowSignInDialog(true);
|
|
51
|
+
refetch();
|
|
52
|
+
}
|
|
59
53
|
if (isFetching)
|
|
60
54
|
return null;
|
|
61
55
|
return (jsxs(Fragment, { children: [jsx(FavoriteButton, { isDisabled: isFetching, isFavorite: isFavorite, onClick: onFavorite }), jsx(SignInDialog, { isOpen: showSignInDialog, onOpenChange: setShowSignInDialog })] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface FavoriteButtonProps {
|
|
2
2
|
isDisabled?: boolean;
|
|
3
3
|
isFavorite: boolean;
|
|
4
|
-
onClick:
|
|
4
|
+
onClick: VoidFunction;
|
|
5
5
|
}
|
|
6
6
|
export declare function FavoriteButton({ isDisabled, isFavorite, onClick: onClick, }: FavoriteButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,10 +2,12 @@ export interface IconButtonProps {
|
|
|
2
2
|
children: React.ReactNode;
|
|
3
3
|
className?: string;
|
|
4
4
|
color?: 'primary' | 'secondary' | 'current-color';
|
|
5
|
+
href?: string;
|
|
5
6
|
isDisabled?: boolean;
|
|
6
|
-
onClick?: (event: React.MouseEvent<
|
|
7
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
7
8
|
size?: 'md' | 'lg';
|
|
9
|
+
target?: string;
|
|
8
10
|
title?: string;
|
|
9
11
|
type?: 'button' | 'submit' | 'reset';
|
|
10
12
|
}
|
|
11
|
-
export declare function IconButton({ children, className, color, isDisabled, onClick: _onClick, size, title, type,
|
|
13
|
+
export declare function IconButton({ children, className, color, href, isDisabled, onClick: _onClick, size, target, title, type, }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,13 +3,16 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './icon-button.module.css.js';
|
|
5
5
|
|
|
6
|
-
function IconButton({ children, className, color = 'primary', isDisabled, onClick: _onClick, size = 'md', title, type = 'button',
|
|
6
|
+
function IconButton({ children, className, color = 'primary', href, isDisabled, onClick: _onClick, size = 'md', target, title, type = 'button', }) {
|
|
7
7
|
const onClick = (e) => {
|
|
8
8
|
e.preventDefault();
|
|
9
9
|
e.stopPropagation();
|
|
10
10
|
_onClick?.(e);
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
if (href) {
|
|
13
|
+
return (jsx("a", { className: clsx(styles['icon-button'], styles[size], styles[color], className), "data-disabled": isDisabled ? true : undefined, href: href, onClick: onClick, target: target, title: title, children: children }));
|
|
14
|
+
}
|
|
15
|
+
return (jsx("button", { className: clsx(styles['icon-button'], styles[size], styles[color], className), "data-disabled": isDisabled ? true : undefined, disabled: isDisabled, onClick: onClick, title: title, type: type, children: children }));
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export { IconButton };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface LinkProps
|
|
3
|
-
|
|
1
|
+
import { KeyboardEvent, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
export interface LinkProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
4
5
|
color?: 'primary' | 'secondary';
|
|
5
6
|
hasUnderline?: boolean;
|
|
7
|
+
href?: string;
|
|
8
|
+
id?: string;
|
|
6
9
|
isDisabled?: boolean;
|
|
7
|
-
|
|
10
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
11
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
12
|
+
tabIndex?: number;
|
|
13
|
+
target?: string;
|
|
14
|
+
title?: string;
|
|
8
15
|
}
|
|
9
|
-
export declare function Link({ children, className, color, hasUnderline, isDisabled, onClick, onKeyUp, ...
|
|
16
|
+
export declare function Link({ children, className, color, hasUnderline, href, id, isDisabled, onClick, onKeyUp, tabIndex, target, title, ...rest }: LinkProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,11 +3,17 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './link.module.css.js';
|
|
5
5
|
|
|
6
|
-
function Link({ children, className, color, hasUnderline, isDisabled, onClick, onKeyUp, ...
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function Link({ children, className, color, hasUnderline, href, id, isDisabled, onClick, onKeyUp, tabIndex, target, title, ...rest }) {
|
|
7
|
+
if (href) {
|
|
8
|
+
return (jsx("a", { className: clsx({
|
|
9
|
+
[styles.hover]: Boolean(href || onClick),
|
|
10
|
+
[styles['has-underline']]: hasUnderline,
|
|
11
|
+
}, styles['link'], color && styles[color], className), "data-disabled": isDisabled ? true : undefined, href: href, id: id, onClick: onClick, onKeyUp: onKeyUp, tabIndex: isDisabled ? -1 : tabIndex, target: target, title: title, ...rest, children: children }));
|
|
12
|
+
}
|
|
13
|
+
return (jsx("button", { className: clsx({
|
|
14
|
+
[styles.hover]: Boolean(href || onClick),
|
|
9
15
|
[styles['has-underline']]: hasUnderline,
|
|
10
|
-
}, styles['link'], color && styles[color], className), "data-disabled": isDisabled ? true : undefined, onClick: onClick, onKeyUp: onKeyUp,
|
|
16
|
+
}, styles['link'], color && styles[color], className), "data-disabled": isDisabled ? true : undefined, disabled: isDisabled ? true : undefined, id: id, onClick: onClick, onKeyUp: onKeyUp, tabIndex: isDisabled ? -1 : tabIndex, title: title, type: "button", ...rest, children: children }));
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export { Link };
|
|
@@ -8,11 +8,12 @@ import { ProductOverviewGrid } from '../../lists/product-overview-grid/product-o
|
|
|
8
8
|
import { Carousel } from '../carousel.js';
|
|
9
9
|
import styles from './card-carousel.module.css.js';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const defaultCardsPerView = {
|
|
12
12
|
md: 2,
|
|
13
13
|
sm: 1,
|
|
14
14
|
xxl: 3,
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
function CardCarousel({ allowExpandToGrid = false, cards, cardsPerView = defaultCardsPerView, cardWidth = 'auto', hasOverflow = false, }) {
|
|
16
17
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
17
18
|
if (!isExpanded) {
|
|
18
19
|
return (jsxs("div", { className: styles['carousel-container'], children: [jsx(Carousel, { hasOverflow: hasOverflow, navigationButtonsPosition: "center", slideClasses: clsx(styles.slide, styles[`width-${cardWidth}`]), slides: cards, slidesPerView: cardsPerView, spaceBetween: 16 }), allowExpandToGrid && (jsx(Button, { withArrow: true, className: styles.button, color: "secondary", onClick: () => setIsExpanded(true), variant: "outline", children: jsx(FormattedMessage, { id: "Show all" }) }))] }));
|
|
@@ -7,7 +7,7 @@ import { GlyphsArrowBoldCapsRightIcon } from '../icons/glyph/glyphs-arrow-boldca
|
|
|
7
7
|
import styles from './carousel-navigation-button.module.css.js';
|
|
8
8
|
|
|
9
9
|
const CarouselNavigationButton = forwardRef(function NavigationButton({ className, direction, onClick }, ref) {
|
|
10
|
-
return (jsx("button", { ref: ref, className: clsx(styles['carousel-navigation-button'], className), onClick: () => onClick?.(direction), children: direction === 'previous' ? (jsx(GlyphsArrowBoldCapsLeftIcon, {})) : (jsx(GlyphsArrowBoldCapsRightIcon, {})) }));
|
|
10
|
+
return (jsx("button", { ref: ref, className: clsx(styles['carousel-navigation-button'], className), onClick: () => onClick?.(direction), type: "button", children: direction === 'previous' ? (jsx(GlyphsArrowBoldCapsLeftIcon, {})) : (jsx(GlyphsArrowBoldCapsRightIcon, {})) }));
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export { CarouselNavigationButton };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useRef,
|
|
3
|
+
import { useState, useRef, useMemo } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import Navigation from '../node_modules/.pnpm/swiper@11.2.1/node_modules/swiper/modules/navigation.js';
|
|
6
6
|
import freeMode from '../node_modules/.pnpm/swiper@11.2.1/node_modules/swiper/modules/free-mode.js';
|
|
@@ -21,11 +21,14 @@ function generateSlidesPerViewBreakpoints(slidesPerView) {
|
|
|
21
21
|
function Carousel({ breakpoints: _breakpoints, className, hasNavigation = true, hasOverflow = true, navigationButtonsPosition = 'top', slideClasses, slides, slidesPerView: _slidesPerView = 'auto', spaceBetween, }) {
|
|
22
22
|
const [isDragging, setIsDragging] = useState(false);
|
|
23
23
|
const [isReady, setIsReady] = useState(false);
|
|
24
|
-
const [amountOfSlides, setAmountOfSlides] = useState(0)
|
|
24
|
+
// const [amountOfSlides, setAmountOfSlides] = useState(0)
|
|
25
25
|
const nextEl = useRef(null);
|
|
26
26
|
const prevEl = useRef(null);
|
|
27
27
|
const swiperRef = useRef(null);
|
|
28
28
|
const slidesPerView = typeof _slidesPerView === 'object' ? undefined : _slidesPerView;
|
|
29
|
+
const amountOfSlides = useMemo(() => typeof swiperRef.current?.params.slidesPerView === 'number'
|
|
30
|
+
? swiperRef.current.params.slidesPerView
|
|
31
|
+
: swiperRef.current?.slidesPerViewDynamic() || 1, []);
|
|
29
32
|
function handleNavigationButtonClick(direction) {
|
|
30
33
|
if (!swiperRef.current)
|
|
31
34
|
return;
|
|
@@ -36,11 +39,6 @@ function Carousel({ breakpoints: _breakpoints, className, hasNavigation = true,
|
|
|
36
39
|
swiperRef.current.slideTo(swiperRef.current.activeIndex - amountOfSlides - 1);
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
setAmountOfSlides(typeof swiperRef.current?.params.slidesPerView === 'number'
|
|
41
|
-
? swiperRef.current.params.slidesPerView
|
|
42
|
-
: swiperRef.current?.slidesPerViewDynamic() || 1);
|
|
43
|
-
}, [swiperRef]);
|
|
44
42
|
if (typeof _slidesPerView === 'object') {
|
|
45
43
|
const slidesPerViewBreakpoints = generateSlidesPerViewBreakpoints(_slidesPerView);
|
|
46
44
|
_breakpoints = deepMerge(_breakpoints, slidesPerViewBreakpoints);
|
|
@@ -63,7 +61,9 @@ function Carousel({ breakpoints: _breakpoints, className, hasNavigation = true,
|
|
|
63
61
|
}, onBeforeInit: swiper => (swiperRef.current = swiper), onSliderMove: () => setIsDragging(true), onSlidesUpdated: () => {
|
|
64
62
|
if (!isReady)
|
|
65
63
|
setIsReady(true);
|
|
66
|
-
}, onTouchEnd: () => setIsDragging(false), slidesPerGroupAuto: slidesPerView === 'auto', slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: slides.map((slide, index) => (
|
|
64
|
+
}, onTouchEnd: () => setIsDragging(false), slidesPerGroupAuto: slidesPerView === 'auto', slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: slides.map((slide, index) => (
|
|
65
|
+
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
66
|
+
jsx(SwiperSlide, { className: clsx(styles.slide, slideClasses), children: slide }, index))) }), hasNavigation && (jsxs("div", { className: clsx(styles['navigation-buttons'], styles[navigationButtonsPosition]), children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles['navigation-button'], styles['navigation-button-prev']), direction: "previous", onClick: direction => handleNavigationButtonClick(direction) }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles['navigation-button'], styles['navigation-button-next']), direction: "next", onClick: direction => handleNavigationButtonClick(direction) })] }))] }));
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export { Carousel };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface PaginationButtonProps {
|
|
2
2
|
index: number;
|
|
3
3
|
onChange?: (index: number, target: Element, size: DOMRectReadOnly, position: DOMRectReadOnly | undefined) => void;
|
|
4
|
-
onClick?:
|
|
4
|
+
onClick?: VoidFunction;
|
|
5
5
|
}
|
|
6
6
|
export declare function PaginationButton({ index, onChange, onClick, }: PaginationButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
interface PaginationProps {
|
|
@@ -4,7 +4,9 @@ import { Heading } from '../../typography/heading/heading.js';
|
|
|
4
4
|
import styles from './usp-carousel.module.css.js';
|
|
5
5
|
|
|
6
6
|
function ProductUsp({ usp }) {
|
|
7
|
-
return (jsxs("div", { className: styles['product-usp'], children: [jsx("div", { className: styles.left, children: jsx(Image, { className: styles.image, fit: "cover", image: usp.image, title: usp.image.altText }) }), jsx("div", { className: styles.right, children: jsxs("div", { "data-content": true, className: styles.content, children: [jsx(Image, { className: styles.icon, image: usp.icon, title: usp.icon.altText }), jsx(Heading, { italic: true, uppercase: true, className: styles.title, size: "xs", children: usp.heading }), jsx("div", { className: styles.text,
|
|
7
|
+
return (jsxs("div", { className: styles['product-usp'], children: [jsx("div", { className: styles.left, children: jsx(Image, { className: styles.image, fit: "cover", image: usp.image, title: usp.image.altText }) }), jsx("div", { className: styles.right, children: jsxs("div", { "data-content": true, className: styles.content, children: [jsx(Image, { className: styles.icon, image: usp.icon, title: usp.icon.altText }), jsx(Heading, { italic: true, uppercase: true, className: styles.title, size: "xs", children: usp.heading }), jsx("div", { className: styles.text,
|
|
8
|
+
// eslint-disable-next-line @eslint-react/dom/no-dangerously-set-innerhtml
|
|
9
|
+
dangerouslySetInnerHTML: { __html: usp.text } })] }) })] }));
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export { ProductUsp };
|
|
@@ -3,7 +3,7 @@ import { ProductUsp } from './product-usp-carousel-slide.js';
|
|
|
3
3
|
import { USPCarousel } from './usp-carousel.js';
|
|
4
4
|
|
|
5
5
|
function ProductUSPCarousel({ usps }) {
|
|
6
|
-
return (jsx(USPCarousel, { slides: usps.map((usp, index) => (jsx(ProductUsp, { usp: usp }, index))) }));
|
|
6
|
+
return (jsx(USPCarousel, { slides: usps.map((usp, index) => (jsx(ProductUsp, { usp: usp }, usp.heading + usp.text || index))) }));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { ProductUSPCarousel };
|
|
@@ -41,7 +41,9 @@ const USPCarousel = ({ slides }) => {
|
|
|
41
41
|
}, onSetTranslate: setTranslate, onSwiper: swiper => {
|
|
42
42
|
swiper.update();
|
|
43
43
|
swiperRef.current = swiper;
|
|
44
|
-
}, speed: DURATION_IN_MS, virtualTranslate: true, watchSlidesProgress: true, children: [slides.map((slide, index) => (
|
|
44
|
+
}, speed: DURATION_IN_MS, virtualTranslate: true, watchSlidesProgress: true, children: [slides.map((slide, index) => (
|
|
45
|
+
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
46
|
+
jsx(SwiperSlide, { children: slide }, index))), jsx("div", { className: styles.pagination, id: "pagination" }), jsx("div", { className: styles.pagination, children: jsx(CarouselPagination, { currentPage: currentIndex + 1, numberOfPages: slides.length, onChange: pageNumber => swiperRef.current?.slideTo(pageNumber - 1) }) })] }));
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
export { USPCarousel };
|