@sonic-equipment/ui 163.0.0 → 165.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/algolia/algolia-categories-filters.js +9 -7
- package/dist/background-overlay/background-overlay-manager.d.ts +178 -0
- package/dist/background-overlay/background-overlay-manager.js +291 -0
- package/dist/background-overlay/background-overlay.d.ts +12 -2
- package/dist/background-overlay/background-overlay.js +28 -27
- package/dist/badges/badge/badge.d.ts +2 -1
- package/dist/badges/badge/badge.js +2 -2
- package/dist/badges/badge/icon-with-badge/icon-with-badge.d.ts +2 -1
- package/dist/badges/badge/icon-with-badge/icon-with-badge.js +2 -2
- package/dist/cards/orderline-card/orderline-card.js +5 -1
- package/dist/cards/product-card/product-card.js +5 -1
- package/dist/collapsables/cascading-component/cascading-component.d.ts +6 -2
- package/dist/collapsables/cascading-component/cascading-component.js +5 -5
- package/dist/collapsables/unmounter/unmounter.js +2 -2
- package/dist/country-select/country-select.js +1 -1
- package/dist/country-selector/connected-country-selector.js +20 -2
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +1 -1
- package/dist/country-selector/use-countries-languages.d.ts +17 -1
- package/dist/country-selector/use-countries-languages.js +58 -29
- package/dist/delivery-time/delivery-time.d.ts +1 -1
- package/dist/delivery-time/delivery-time.js +20 -8
- package/dist/delivery-time/delivery-time.module.css.js +1 -1
- package/dist/drawer/drawer.d.ts +26 -0
- package/dist/drawer/drawer.js +37 -0
- package/dist/drawer/drawer.module.css.js +3 -0
- package/dist/drawer/use-drawer.d.ts +17 -0
- package/dist/drawer/use-drawer.js +71 -0
- package/dist/exports.d.ts +12 -0
- package/dist/global-search/global-search-provider/global-search-provider.js +1 -2
- package/dist/global-search/global-search.module.css.js +1 -1
- package/dist/header/cart-icon/connected-cart-icon.js +4 -4
- package/dist/icons/solid/solid-login-icon.js +7 -0
- package/dist/index.js +13 -1
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/layout/center.d.ts +5 -0
- package/dist/layout/center.js +9 -0
- package/dist/layout/center.module.css.js +3 -0
- package/dist/lists/menu-list/menu-list.d.ts +4 -2
- package/dist/lists/menu-list/menu-list.js +2 -2
- package/dist/lists/menu-list/menu-list.module.css.js +1 -1
- package/dist/lists/orderline-list/orderline-list.js +1 -2
- package/dist/navigation/account-icon/account-icon.d.ts +5 -0
- package/dist/navigation/account-icon/account-icon.js +12 -0
- package/dist/navigation/cart-icon/cart-icon.d.ts +5 -0
- package/dist/navigation/cart-icon/cart-icon.js +12 -0
- package/dist/navigation/favorite-icon/favorite-icon.d.ts +5 -0
- package/dist/navigation/favorite-icon/favorite-icon.js +12 -0
- package/dist/navigation/mobile-navigation/mobile-navigation.d.ts +5 -0
- package/dist/navigation/mobile-navigation/mobile-navigation.js +20 -0
- package/dist/navigation/panel-navigation/panel-navigation.d.ts +28 -0
- package/dist/navigation/panel-navigation/panel-navigation.js +69 -0
- package/dist/navigation/panel-navigation/panel-navigation.module.css.js +3 -0
- package/dist/pages/checkout/payment-page/components/payment.js +9 -9
- package/dist/pages/paths.d.ts +1 -0
- package/dist/pages/paths.js +1 -0
- package/dist/shared/hooks/use-global-disclosure.d.ts +10 -0
- package/dist/shared/hooks/use-global-disclosure.js +25 -0
- package/dist/shared/hooks/use-watch-css-property.d.ts +1 -1
- package/dist/shared/hooks/use-watch-css-property.js +2 -3
- package/dist/shared/model/category.d.ts +5 -0
- package/dist/shared/model/category.js +7 -1
- package/dist/shared/model/price.d.ts +2 -2
- package/dist/shared/utils/css.d.ts +1 -0
- package/dist/shared/utils/css.js +13 -0
- package/dist/shared/utils/date.d.ts +1 -12
- package/dist/shared/utils/date.js +8 -64
- package/dist/shared/utils/refs.d.ts +2 -0
- package/dist/shared/utils/refs.js +14 -0
- package/dist/sidebar/sidebar-provider.js +1 -1
- package/dist/styles.css +278 -66
- package/package.json +1 -1
- package/dist/background-overlay/background-overlay.module.css.js +0 -3
- package/dist/shared/utils/date.test.d.ts +0 -1
|
@@ -4,12 +4,16 @@ import { Tag } from '../../badges/tag/tag.js';
|
|
|
4
4
|
import { Price } from '../../display/price/price.js';
|
|
5
5
|
import { ProductSku } from '../../display/product-sku/product-sku.js';
|
|
6
6
|
import { FormattedMessage } from '../../intl/formatted-message.js';
|
|
7
|
+
import { logger } from '../../logging/logger.js';
|
|
7
8
|
import { Image } from '../../media/image/image.js';
|
|
8
9
|
import { RouteLink } from '../../shared/routing/route-link.js';
|
|
9
10
|
import styles from './product-card.module.css.js';
|
|
10
11
|
|
|
11
12
|
function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, id, image, onClick, price, sku, tags, title, }) {
|
|
12
|
-
|
|
13
|
+
if (!price.currencyCode) {
|
|
14
|
+
logger.error(`Product '${sku}' does not have a currency code`);
|
|
15
|
+
}
|
|
16
|
+
return (jsx("div", { className: styles['product-card-container'], children: jsxs("article", { "aria-labelledby": `title-${id}`, className: styles['product-card'], "data-product-id": sku, id: id, children: [jsx(RouteLink, { className: styles.title, href: href, id: `title-${id}`, onClick: onClick, children: title }), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(ProductSku, { className: styles.sku, sku: sku }), price.currencyCode && (jsx(Price, { className: styles.price, currencyCode: price.currencyCode, isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price, variant: "sonic" })), jsx("div", { className: styles['image-container'], children: jsx(Image, { ...image, fit: "contain" }) }), jsx("div", { className: styles['add-to-cart-button'], children: AddToCartButton }), jsx("div", { className: styles['favorite-button'], children: FavoriteButton && FavoriteButton })] }) }));
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export { ProductCard };
|
|
@@ -5,9 +5,13 @@ interface CascadingComponentProps<TElement extends HTMLElement = HTMLElement, Re
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
isVisible?: boolean;
|
|
7
7
|
nodeRef: React.Ref<RefElement>;
|
|
8
|
+
onEnter?: VoidFunction;
|
|
9
|
+
onEntered?: VoidFunction;
|
|
10
|
+
onExit?: VoidFunction;
|
|
11
|
+
onExited?: VoidFunction;
|
|
8
12
|
onUnmounted?: () => void;
|
|
9
13
|
timeout?: number;
|
|
10
14
|
}
|
|
11
|
-
export declare function CascadingComponent<TElement extends HTMLElement = HTMLElement, RefElement extends RefHTMLElement<TElement> = undefined>({ children, isVisible, nodeRef, onClose, onUnmounted, timeout, }: CascadingComponentProps<TElement, RefElement> & CascadingComponentContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare function InternalCascadingComponent<TElement extends HTMLElement = HTMLElement, RefElement extends RefHTMLElement<TElement> = undefined>({ children, isVisible: _isVisible, nodeRef, onUnmounted, timeout: timeout, }: CascadingComponentProps<TElement, RefElement>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function CascadingComponent<TElement extends HTMLElement = HTMLElement, RefElement extends RefHTMLElement<TElement> = undefined>({ children, isVisible, nodeRef, onClose, onEnter, onEntered, onExit, onExited, onUnmounted, timeout, }: CascadingComponentProps<TElement, RefElement> & CascadingComponentContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function InternalCascadingComponent<TElement extends HTMLElement = HTMLElement, RefElement extends RefHTMLElement<TElement> = undefined>({ children, isVisible: _isVisible, nodeRef, onEnter, onEntered, onExit, onExited, onUnmounted, timeout: timeout, }: CascadingComponentProps<TElement, RefElement>): import("react/jsx-runtime").JSX.Element;
|
|
13
17
|
export {};
|
|
@@ -6,14 +6,14 @@ import { createAddEndListener } from '../unmounter/utils.js';
|
|
|
6
6
|
import { CascadingComponentContainerProvider } from './cascading-component-container-provider.js';
|
|
7
7
|
import { useCascadingComponentContainer } from './use-cascading-component-container.js';
|
|
8
8
|
|
|
9
|
-
function CascadingComponent({ children, isVisible = false, nodeRef, onClose, onUnmounted, timeout, }) {
|
|
9
|
+
function CascadingComponent({ children, isVisible = false, nodeRef, onClose, onEnter, onEntered, onExit, onExited, onUnmounted, timeout, }) {
|
|
10
10
|
const context = useCascadingComponentContainer();
|
|
11
11
|
if (!context) {
|
|
12
|
-
return (jsx(Fragment, { children: jsx(CascadingComponentContainerProvider, { onClose: onClose, timeout: timeout, children: jsx(InternalCascadingComponent, { isVisible: isVisible, nodeRef: nodeRef, onUnmounted: onUnmounted, timeout: timeout, children: children }) }) }));
|
|
12
|
+
return (jsx(Fragment, { children: jsx(CascadingComponentContainerProvider, { onClose: onClose, timeout: timeout, children: jsx(InternalCascadingComponent, { isVisible: isVisible, nodeRef: nodeRef, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, onUnmounted: onUnmounted, timeout: timeout, children: children }) }) }));
|
|
13
13
|
}
|
|
14
|
-
return (jsx(InternalCascadingComponent, { isVisible: isVisible, nodeRef: nodeRef, onUnmounted: onUnmounted, timeout: timeout || context.timeout, children: children }));
|
|
14
|
+
return (jsx(InternalCascadingComponent, { isVisible: isVisible, nodeRef: nodeRef, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, onUnmounted: onUnmounted, timeout: timeout || context.timeout, children: children }));
|
|
15
15
|
}
|
|
16
|
-
function InternalCascadingComponent({ children, isVisible: _isVisible = false, nodeRef, onUnmounted, timeout: timeout, }) {
|
|
16
|
+
function InternalCascadingComponent({ children, isVisible: _isVisible = false, nodeRef, onEnter, onEntered, onExit, onExited, onUnmounted, timeout: timeout, }) {
|
|
17
17
|
const [isVisible, setIsVisible] = useState(_isVisible);
|
|
18
18
|
const [unmount, setUnmount] = useState(false);
|
|
19
19
|
useEffect(() => {
|
|
@@ -36,7 +36,7 @@ function InternalCascadingComponent({ children, isVisible: _isVisible = false, n
|
|
|
36
36
|
const onClose = useCallback(() => {
|
|
37
37
|
setUnmount(true);
|
|
38
38
|
}, []);
|
|
39
|
-
return (jsx(CSSTransition, { mountOnEnter: true, unmountOnExit: true, ...(timeout === undefined
|
|
39
|
+
return (jsx(CSSTransition, { mountOnEnter: true, unmountOnExit: true, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, ...(timeout === undefined
|
|
40
40
|
? { addEndListener: createAddEndListener(nodeRef) }
|
|
41
41
|
: { timeout }), in: isVisible, nodeRef: nodeRef, children: jsx(Unmounter, { onUnmounted: onUnmounted, onUnmountReady: onUnmountReady, unmount: unmount, children: jsx(CascadingComponentContainerProvider, { onClose: onClose, timeout: timeout, children: children }) }) }));
|
|
42
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext,
|
|
2
|
+
import { createContext, useState, useEffect, useMemo, useContext } from 'react';
|
|
3
3
|
|
|
4
4
|
const UnmounterContext = createContext(null);
|
|
5
5
|
function useUnmount() {
|
|
@@ -12,7 +12,7 @@ function Unmounter({ children: children, onUnmounted, onUnmountReady, unmount: _
|
|
|
12
12
|
const [childCount, updateChildCount] = useState(0);
|
|
13
13
|
const unmount = Boolean(_unmount || parentContext?.unmount);
|
|
14
14
|
useEffect(() => {
|
|
15
|
-
return
|
|
15
|
+
return onUnmounted;
|
|
16
16
|
}, [onUnmounted]);
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
if (!parentContext)
|
|
@@ -20,7 +20,7 @@ function CountrySelect({ countries, countryNameInLanguageOfCountry = false, 'dat
|
|
|
20
20
|
}), {}),
|
|
21
21
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
22
|
[countries]);
|
|
23
|
-
return (jsx(SelectField, { "data-key": selectedCountry?.id, "data-test-selector": dataTestSelector, defaultSelectedOption: defaultSelectedCountry?.id, isDisabled: isDisabled, isLoading: isLoading, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel,
|
|
23
|
+
return (jsx(SelectField, { "data-key": selectedCountry?.id, "data-test-selector": dataTestSelector, defaultSelectedOption: defaultSelectedCountry?.id, isDisabled: isDisabled, isLoading: isLoading, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, placeholder: t('Select a country'), selectedOption: selectedCountry?.id, showLabel: showLabel, variant: "solid" }));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { CountrySelect };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useMemo, useEffect } from 'react';
|
|
4
|
+
import { logger } from '../logging/logger.js';
|
|
4
5
|
import { useDisclosure } from '../shared/hooks/use-disclosure.js';
|
|
5
6
|
import { CountrySelectorDialog } from './country-selector-dialog/country-selector-dialog.js';
|
|
6
7
|
import { CountrySelectorTrigger } from './country-selector-trigger/country-selector-trigger.js';
|
|
@@ -8,18 +9,35 @@ import { useCountriesLanguages } from './use-countries-languages.js';
|
|
|
8
9
|
|
|
9
10
|
function ConnectedCountrySelector({ defaultCountryCode, defaultLanguageCode, onChange, showCountry = true, }) {
|
|
10
11
|
const { close, isOpen, open, setIsOpen } = useDisclosure(false);
|
|
11
|
-
const { countries, defaultCountry, defaultLanguage, isFetching, selectedCountry, selectedLanguage, updateCountryLanguage, } = useCountriesLanguages({
|
|
12
|
+
const { countries, defaultCountry, defaultLanguage, error, isFetching, selectedCountry, selectedLanguage, updateCountryLanguage, } = useCountriesLanguages({
|
|
12
13
|
defaultCountryCode,
|
|
13
14
|
defaultLanguageCode,
|
|
14
15
|
});
|
|
15
16
|
const isCountryLanguageSelected = useMemo(() => selectedCountry !== undefined && selectedLanguage !== undefined, [selectedCountry, selectedLanguage]);
|
|
16
17
|
const isDismissable = isCountryLanguageSelected;
|
|
17
18
|
useEffect(() => {
|
|
19
|
+
if (!isFetching) {
|
|
20
|
+
if (selectedCountry === undefined && selectedLanguage === undefined) {
|
|
21
|
+
logger.info('Opening country selector dialog because no country or language is selected');
|
|
22
|
+
}
|
|
23
|
+
else if (selectedCountry === undefined) {
|
|
24
|
+
logger.info('Opening country selector dialog because no country is selected');
|
|
25
|
+
}
|
|
26
|
+
else if (selectedLanguage === undefined) {
|
|
27
|
+
logger.info('Opening country selector dialog because no language is selected');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (isOpen)
|
|
31
|
+
return;
|
|
18
32
|
setIsOpen(!isFetching && !isCountryLanguageSelected);
|
|
19
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
-
}, [isFetching, isCountryLanguageSelected]);
|
|
34
|
+
}, [isFetching, isCountryLanguageSelected, isOpen]);
|
|
21
35
|
if (isFetching)
|
|
22
36
|
return null;
|
|
37
|
+
if (error !== undefined) {
|
|
38
|
+
logger.error('Error fetching countries and languages:', error);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
23
41
|
return (jsxs(Fragment, { children: [jsx(CountrySelectorTrigger, { onClick: open, selectedCountry: selectedCountry, selectedLanguage: selectedLanguage, showCountry: showCountry }), jsx(CountrySelectorDialog, { countries: countries, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: open => {
|
|
24
42
|
if (!isDismissable)
|
|
25
43
|
return;
|
|
@@ -32,7 +32,7 @@ function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange,
|
|
|
32
32
|
onSubmit({ country: currentCountry, language: currentLanguage });
|
|
33
33
|
e.preventDefault();
|
|
34
34
|
e.stopPropagation();
|
|
35
|
-
}, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { countries: countries, countryNameInLanguageOfCountry: true, "data-test-selector": "clSelector_country", onCountryChange: onCountryChange, selectedCountry: currentCountry })), jsx(Select, { "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
|
|
35
|
+
}, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { isRequired: true, countries: countries, countryNameInLanguageOfCountry: true, "data-test-selector": "clSelector_country", onCountryChange: onCountryChange, selectedCountry: currentCountry })), jsx(Select, { isRequired: true, "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, placeholder: t('Select a language'), selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { CountrySelectorDialog };
|
|
@@ -4,10 +4,24 @@ interface UseCountriesLanguagesArgs {
|
|
|
4
4
|
defaultCountryCode: CountryCode;
|
|
5
5
|
defaultLanguageCode: LanguageCode;
|
|
6
6
|
}
|
|
7
|
+
interface UseCountriesLanguagesReturnTypeError {
|
|
8
|
+
countries: undefined;
|
|
9
|
+
defaultCountry: undefined;
|
|
10
|
+
defaultLanguage: undefined;
|
|
11
|
+
error: object | Error | string;
|
|
12
|
+
isFetching: false;
|
|
13
|
+
selectedCountry: undefined;
|
|
14
|
+
selectedLanguage: undefined;
|
|
15
|
+
updateCountryLanguage(args: {
|
|
16
|
+
country: Country;
|
|
17
|
+
language: Language;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
}
|
|
7
20
|
interface UseCountriesLanguagesReturnTypeFetching {
|
|
8
21
|
countries: undefined;
|
|
9
22
|
defaultCountry: undefined;
|
|
10
23
|
defaultLanguage: undefined;
|
|
24
|
+
error: undefined;
|
|
11
25
|
isFetching: true;
|
|
12
26
|
selectedCountry: undefined;
|
|
13
27
|
selectedLanguage: undefined;
|
|
@@ -20,6 +34,7 @@ interface UseCountriesLanguagesReturnTypeSelected {
|
|
|
20
34
|
countries: Country[];
|
|
21
35
|
defaultCountry: Country;
|
|
22
36
|
defaultLanguage: Language;
|
|
37
|
+
error: undefined;
|
|
23
38
|
isFetching: false;
|
|
24
39
|
selectedCountry: Country;
|
|
25
40
|
selectedLanguage: Language;
|
|
@@ -32,6 +47,7 @@ interface UseCountriesLanguagesReturnType {
|
|
|
32
47
|
countries: Country[];
|
|
33
48
|
defaultCountry: Country;
|
|
34
49
|
defaultLanguage: Language;
|
|
50
|
+
error: undefined;
|
|
35
51
|
isFetching: false;
|
|
36
52
|
selectedCountry: Country | undefined;
|
|
37
53
|
selectedLanguage: Language | undefined;
|
|
@@ -40,5 +56,5 @@ interface UseCountriesLanguagesReturnType {
|
|
|
40
56
|
language: Language;
|
|
41
57
|
}): Promise<void>;
|
|
42
58
|
}
|
|
43
|
-
export declare function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }: UseCountriesLanguagesArgs): UseCountriesLanguagesReturnType | UseCountriesLanguagesReturnTypeFetching | UseCountriesLanguagesReturnTypeSelected;
|
|
59
|
+
export declare function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }: UseCountriesLanguagesArgs): UseCountriesLanguagesReturnType | UseCountriesLanguagesReturnTypeError | UseCountriesLanguagesReturnTypeFetching | UseCountriesLanguagesReturnTypeSelected;
|
|
44
60
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { config } from '../config.js';
|
|
4
|
+
import { logger } from '../logging/logger.js';
|
|
4
5
|
import { useFetchCountriesWithLanguages } from '../shared/api/storefront/hooks/website/use-fetch-countries-with-languages.js';
|
|
5
6
|
import { updateLocale } from '../shared/api/storefront/services/website-service.js';
|
|
6
7
|
import { useCookie } from '../shared/hooks/use-cookie.js';
|
|
@@ -17,8 +18,8 @@ const cookieOptions = {
|
|
|
17
18
|
function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
|
|
18
19
|
const [sessionCountries, setSessionCountries] = useSessionStorage('countries-v1');
|
|
19
20
|
const [currentCountryId] = useCookie('CurrentCountryId', cookieOptions);
|
|
21
|
+
// const [currentLanguageId] = ['be71b608-4876-420a-b1f5-adfe0093a72a'] // useCookie('CurrentLanguageId', cookieOptions)
|
|
20
22
|
const [currentLanguageId] = useCookie('CurrentLanguageId', cookieOptions);
|
|
21
|
-
const [contextLanguageCode] = useCookie('SetContextLanguageCode', cookieOptions);
|
|
22
23
|
const hasSessionCountries = Boolean(sessionCountries?.length);
|
|
23
24
|
const { data: apiCountries, error, isFetching, } = useFetchCountriesWithLanguages({
|
|
24
25
|
enabled: !hasSessionCountries,
|
|
@@ -32,44 +33,72 @@ function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
|
|
|
32
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
34
|
}, [apiCountries]);
|
|
34
35
|
async function updateCountryLanguage({ country, language, }) {
|
|
35
|
-
await updateLocale({
|
|
36
|
+
await updateLocale({
|
|
37
|
+
countryId: country.id,
|
|
38
|
+
languageId: language.id,
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
logger.info('CountryID from cookie', currentCountryId, countries?.find(country => country.id === currentCountryId)?.name ||
|
|
43
|
+
'Unknown');
|
|
44
|
+
}, [countries, currentCountryId]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
logger.info('LanguageID from cookie', currentLanguageId, countries
|
|
47
|
+
?.find(country => country.id === currentCountryId)
|
|
48
|
+
?.languages.find(language => language.id === currentLanguageId)
|
|
49
|
+
?.description || 'Unknown');
|
|
50
|
+
}, [countries, currentCountryId, currentLanguageId]);
|
|
51
|
+
try {
|
|
52
|
+
if (error)
|
|
53
|
+
throw error;
|
|
54
|
+
if (isFetching) {
|
|
55
|
+
return {
|
|
56
|
+
countries: undefined,
|
|
57
|
+
defaultCountry: undefined,
|
|
58
|
+
defaultLanguage: undefined,
|
|
59
|
+
error: undefined,
|
|
60
|
+
isFetching,
|
|
61
|
+
selectedCountry: undefined,
|
|
62
|
+
selectedLanguage: undefined,
|
|
63
|
+
updateCountryLanguage,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (!countries || countries.length === 0)
|
|
67
|
+
throw new Error('No countries found');
|
|
68
|
+
const defaultCountry = countries.find(country => country.abbreviation.toUpperCase() ===
|
|
69
|
+
defaultCountryCode.toUpperCase()) || countries[0];
|
|
70
|
+
if (!defaultCountry)
|
|
71
|
+
throw new Error(`Unable to find the default country ${defaultCountryCode}`);
|
|
72
|
+
const defaultLanguage = defaultCountry.languages.find(language => language.languageCode.toUpperCase() ===
|
|
73
|
+
defaultLanguageCode.toUpperCase()) || defaultCountry.languages[0];
|
|
74
|
+
if (!defaultLanguage)
|
|
75
|
+
throw new Error(`Unable to find the default language ${defaultLanguageCode} for country ${defaultCountry.name}`);
|
|
76
|
+
const selectedCountry = countries.find(country => country.id === currentCountryId);
|
|
77
|
+
const selectedLanguage = selectedCountry &&
|
|
78
|
+
selectedCountry.languages.find(language => language.id === currentLanguageId);
|
|
79
|
+
return {
|
|
80
|
+
countries,
|
|
81
|
+
defaultCountry,
|
|
82
|
+
defaultLanguage,
|
|
83
|
+
error: undefined,
|
|
84
|
+
isFetching,
|
|
85
|
+
selectedCountry,
|
|
86
|
+
selectedLanguage,
|
|
87
|
+
updateCountryLanguage,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
40
91
|
return {
|
|
41
92
|
countries: undefined,
|
|
42
93
|
defaultCountry: undefined,
|
|
43
94
|
defaultLanguage: undefined,
|
|
44
|
-
|
|
95
|
+
error: error,
|
|
96
|
+
isFetching: false,
|
|
45
97
|
selectedCountry: undefined,
|
|
46
98
|
selectedLanguage: undefined,
|
|
47
99
|
updateCountryLanguage,
|
|
48
100
|
};
|
|
49
101
|
}
|
|
50
|
-
if (!countries || countries.length === 0)
|
|
51
|
-
throw new Error('No countries found');
|
|
52
|
-
const defaultCountry = countries.find(country => country.abbreviation.toUpperCase() === defaultCountryCode.toUpperCase()) || countries[0];
|
|
53
|
-
if (!defaultCountry)
|
|
54
|
-
throw new Error(`Unable to find the default country ${defaultCountryCode}`);
|
|
55
|
-
const defaultLanguage = defaultCountry.languages.find(language => language.languageCode.toUpperCase() ===
|
|
56
|
-
defaultLanguageCode.toUpperCase()) || defaultCountry.languages[0];
|
|
57
|
-
if (!defaultLanguage)
|
|
58
|
-
throw new Error(`Unable to find the default language ${defaultLanguageCode} for country ${defaultCountry.name}`);
|
|
59
|
-
const selectedCountry = countries.find(country => country.id === currentCountryId);
|
|
60
|
-
const selectedLanguage = selectedCountry &&
|
|
61
|
-
(selectedCountry.languages.find(language => language.id === currentLanguageId) ||
|
|
62
|
-
selectedCountry.languages.find(language => language.languageCode.toUpperCase() ===
|
|
63
|
-
contextLanguageCode?.toUpperCase()));
|
|
64
|
-
return {
|
|
65
|
-
countries,
|
|
66
|
-
defaultCountry,
|
|
67
|
-
defaultLanguage,
|
|
68
|
-
isFetching,
|
|
69
|
-
selectedCountry,
|
|
70
|
-
selectedLanguage,
|
|
71
|
-
updateCountryLanguage,
|
|
72
|
-
};
|
|
73
102
|
}
|
|
74
103
|
|
|
75
104
|
export { useCountriesLanguages };
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { FormattedMessage } from '../intl/formatted-message.js';
|
|
5
|
-
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
6
|
-
import { getDateUnitObject } from '../shared/utils/date.js';
|
|
7
5
|
import { InfoIconTooltip } from '../info-icon-tooltip/info-icon-tooltip.js';
|
|
6
|
+
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
7
|
+
import { useIntl } from '../intl/use-intl.js';
|
|
8
|
+
import { formatDateToLocaleString } from '../shared/utils/date.js';
|
|
8
9
|
import styles from './delivery-time.module.css.js';
|
|
9
10
|
|
|
10
11
|
function DeliveryTime({ className, deliveryDate }) {
|
|
12
|
+
const { cultureCode } = useIntl();
|
|
11
13
|
const t = useFormattedMessage();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (!deliveryDate) {
|
|
15
|
+
return (jsx("div", { className: clsx(styles['delivery-time'], className), children: jsx("p", {
|
|
16
|
+
// eslint-disable-next-line @eslint-react/dom/no-dangerously-set-innerhtml
|
|
17
|
+
dangerouslySetInnerHTML: {
|
|
18
|
+
__html: t('Availability unknown, please contact customer support for lead time or alternatives.'),
|
|
19
|
+
}, "data-test-selector": "deliveryTime_unknown" }) }));
|
|
20
|
+
}
|
|
21
|
+
const localeDate = formatDateToLocaleString(deliveryDate, cultureCode, {
|
|
22
|
+
day: 'numeric',
|
|
23
|
+
month: 'short',
|
|
24
|
+
year: 'numeric',
|
|
25
|
+
});
|
|
26
|
+
return (jsxs("div", { className: clsx(styles['delivery-time'], className), children: [jsx("p", { "data-test-selector": "deliveryTime", children: jsx(FormattedMessage, { id: "Delivery expected on {0}", replacementValues: {
|
|
27
|
+
'0': localeDate,
|
|
28
|
+
} }) }), jsx(InfoIconTooltip, { className: styles['info'], variant: "stroke", children: jsx(FormattedMessage, { id: "The expected delivery is an indication based on the product availability and the shipping location." }) })] }));
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
export { DeliveryTime };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChildrenFunctionArgs {
|
|
3
|
+
close: VoidFunction;
|
|
4
|
+
groupId?: string;
|
|
5
|
+
instanceId: string;
|
|
6
|
+
isClosed: boolean;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
open: VoidFunction;
|
|
9
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
10
|
+
toggle: VoidFunction;
|
|
11
|
+
}
|
|
12
|
+
export interface DrawerProps {
|
|
13
|
+
allowCloseOnBackgroundClick?: boolean;
|
|
14
|
+
children: ReactNode | ((args: ChildrenFunctionArgs) => ReactNode);
|
|
15
|
+
className?: string;
|
|
16
|
+
groupId?: string;
|
|
17
|
+
instanceId?: string;
|
|
18
|
+
isInitialOpen?: boolean;
|
|
19
|
+
isOpen?: boolean;
|
|
20
|
+
onClose?: VoidFunction;
|
|
21
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
22
|
+
showBackgroundOverlay?: boolean;
|
|
23
|
+
showUnderHeader?: boolean;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function Drawer({ allowCloseOnBackgroundClick, children, className, groupId, instanceId, isInitialOpen, isOpen: isOpenControlled, onClose, position, showBackgroundOverlay, showUnderHeader, timeout, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { CSSTransition } from 'react-transition-group';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { BackgroundOverlay } from '../background-overlay/background-overlay.js';
|
|
6
|
+
import { createAddEndListener } from '../collapsables/unmounter/utils.js';
|
|
7
|
+
import { useDrawer } from './use-drawer.js';
|
|
8
|
+
import styles from './drawer.module.css.js';
|
|
9
|
+
|
|
10
|
+
function Drawer({ allowCloseOnBackgroundClick, children, className, groupId, instanceId, isInitialOpen = false, isOpen: isOpenControlled, onClose, position, showBackgroundOverlay, showUnderHeader = false, timeout, }) {
|
|
11
|
+
const wasOpenRef = useRef(isInitialOpen);
|
|
12
|
+
const asideRef = useRef(null);
|
|
13
|
+
const useDrawerResult = useDrawer({
|
|
14
|
+
groupId,
|
|
15
|
+
instanceId,
|
|
16
|
+
isInitialOpen,
|
|
17
|
+
isOpen: isOpenControlled,
|
|
18
|
+
});
|
|
19
|
+
const { close, isControlled, isOpen } = useDrawerResult;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (wasOpenRef.current && !isOpen)
|
|
22
|
+
onClose?.();
|
|
23
|
+
wasOpenRef.current = isOpen;
|
|
24
|
+
}, [instanceId, isOpen, onClose]);
|
|
25
|
+
return (jsxs(Fragment, { children: [jsx(CSSTransition, { mountOnEnter: true, unmountOnExit: true, addEndListener: createAddEndListener(asideRef), in: isOpen, nodeRef: asideRef, timeout: timeout, children: jsx("aside", { ref: asideRef, className: clsx(styles.drawer, styles[position], showUnderHeader && styles['under-header'], className), children: children instanceof Function ? children(useDrawerResult) : children }, `${groupId}-${instanceId}`) }, groupId), showBackgroundOverlay && (jsx(BackgroundOverlay, { isOpen: isOpen, onClick: () => {
|
|
26
|
+
if (!allowCloseOnBackgroundClick)
|
|
27
|
+
return;
|
|
28
|
+
if (isControlled) {
|
|
29
|
+
onClose?.();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
close();
|
|
33
|
+
}
|
|
34
|
+
}, position: showUnderHeader ? 'behind-header' : 'in-front' }))] }));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { Drawer };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface UseDrawerReturnType {
|
|
2
|
+
close: VoidFunction;
|
|
3
|
+
groupId?: string;
|
|
4
|
+
instanceId: string;
|
|
5
|
+
isClosed: boolean;
|
|
6
|
+
isControlled: boolean;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
open: VoidFunction;
|
|
9
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
10
|
+
toggle: VoidFunction;
|
|
11
|
+
}
|
|
12
|
+
export declare function useDrawer({ groupId: _groupId, instanceId: _instanceId, isInitialOpen, isOpen: isOpenControlled, }?: {
|
|
13
|
+
groupId?: string;
|
|
14
|
+
instanceId?: string;
|
|
15
|
+
isInitialOpen?: boolean;
|
|
16
|
+
isOpen?: boolean;
|
|
17
|
+
}): UseDrawerReturnType;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useGlobalState } from '../shared/providers/global-state-provider.js';
|
|
3
|
+
import { createUUID } from '../shared/utils/uuid.js';
|
|
4
|
+
|
|
5
|
+
function useDrawer({ groupId: _groupId, instanceId: _instanceId, isInitialOpen, isOpen: isOpenControlled, } = {}) {
|
|
6
|
+
const groupIdRef = useRef(_groupId);
|
|
7
|
+
const groupId = groupIdRef.current;
|
|
8
|
+
const instanceIdRef = useRef(_instanceId || createUUID());
|
|
9
|
+
const instanceId = instanceIdRef.current;
|
|
10
|
+
const isControlled = isOpenControlled !== undefined;
|
|
11
|
+
const [openInstanceId, setOpenInstanceId] = useGlobalState(`drawer-${groupId || instanceId}`);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (isInitialOpen || isOpen)
|
|
14
|
+
setOpenInstanceId(instanceId);
|
|
15
|
+
return () => {
|
|
16
|
+
if (isOpen) {
|
|
17
|
+
setOpenInstanceId(undefined);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (isOpenControlled) {
|
|
24
|
+
setOpenInstanceId(instanceId);
|
|
25
|
+
}
|
|
26
|
+
else if (openInstanceId === instanceId) {
|
|
27
|
+
setOpenInstanceId(undefined);
|
|
28
|
+
}
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
}, [isOpenControlled]);
|
|
31
|
+
const open = useCallback(() => {
|
|
32
|
+
if (isControlled)
|
|
33
|
+
return;
|
|
34
|
+
setOpenInstanceId(instanceId);
|
|
35
|
+
}, [setOpenInstanceId, instanceId, isControlled]);
|
|
36
|
+
const close = useCallback(() => {
|
|
37
|
+
if (isControlled)
|
|
38
|
+
return;
|
|
39
|
+
setOpenInstanceId(undefined);
|
|
40
|
+
}, [setOpenInstanceId, isControlled]);
|
|
41
|
+
const toggle = useCallback(() => {
|
|
42
|
+
if (openInstanceId === instanceId) {
|
|
43
|
+
close();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
open();
|
|
47
|
+
}
|
|
48
|
+
}, [close, instanceId, open, openInstanceId]);
|
|
49
|
+
const setIsOpen = useCallback((isOpen) => {
|
|
50
|
+
if (isOpen) {
|
|
51
|
+
open();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
close();
|
|
55
|
+
}
|
|
56
|
+
}, [close, open]);
|
|
57
|
+
const isOpen = useMemo(() => (isControlled ? isOpenControlled : openInstanceId === instanceId), [isControlled, isOpenControlled, openInstanceId, instanceId]);
|
|
58
|
+
return {
|
|
59
|
+
close,
|
|
60
|
+
groupId,
|
|
61
|
+
instanceId,
|
|
62
|
+
isClosed: !isOpen,
|
|
63
|
+
isControlled,
|
|
64
|
+
isOpen,
|
|
65
|
+
open,
|
|
66
|
+
setIsOpen,
|
|
67
|
+
toggle,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { useDrawer };
|
package/dist/exports.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from './algolia/use-algolia-insights-provider-global-state';
|
|
|
27
27
|
export * from './algolia/use-algolia-instant-search-state';
|
|
28
28
|
export * from './algolia/use-algolia-search';
|
|
29
29
|
export * from './background-overlay/background-overlay';
|
|
30
|
+
export * from './background-overlay/background-overlay-manager';
|
|
30
31
|
export * from './badges/badge/badge';
|
|
31
32
|
export * from './badges/badge/icon-with-badge/icon-with-badge';
|
|
32
33
|
export * from './badges/tag/tag';
|
|
@@ -80,6 +81,8 @@ export * from './delivery-time/delivery-time';
|
|
|
80
81
|
export * from './display/info-display/info-display';
|
|
81
82
|
export * from './display/price/price';
|
|
82
83
|
export * from './display/product-sku/product-sku';
|
|
84
|
+
export * from './drawer/drawer';
|
|
85
|
+
export * from './drawer/use-drawer';
|
|
83
86
|
export * from './filters/active-filters/active-filters';
|
|
84
87
|
export * from './filters/multi-select/multi-select';
|
|
85
88
|
export * from './filters/pagination/pagination';
|
|
@@ -146,6 +149,7 @@ export * from './intl/use-formatted-message';
|
|
|
146
149
|
export * from './intl/use-intl';
|
|
147
150
|
export * from './intl/use-language-code';
|
|
148
151
|
export * from './intl/utils';
|
|
152
|
+
export * from './layout/center';
|
|
149
153
|
export * from './lists/download-document-list/download-document-list';
|
|
150
154
|
export * from './lists/feature-list/feature-list';
|
|
151
155
|
export * from './lists/icon-list/icon-list';
|
|
@@ -171,6 +175,11 @@ export * from './modals/favorite/add-to-favorite-dialog';
|
|
|
171
175
|
export * from './modals/modal/modal';
|
|
172
176
|
export * from './modals/recover-password/recover-password-dialog';
|
|
173
177
|
export * from './modals/signin/sign-in-dialog';
|
|
178
|
+
export * from './navigation/account-icon/account-icon';
|
|
179
|
+
export * from './navigation/cart-icon/cart-icon';
|
|
180
|
+
export * from './navigation/favorite-icon/favorite-icon';
|
|
181
|
+
export * from './navigation/mobile-navigation/mobile-navigation';
|
|
182
|
+
export * from './navigation/panel-navigation/panel-navigation';
|
|
174
183
|
export * from './notifications/announcements/announcement';
|
|
175
184
|
export * from './notifications/announcements/announcement-provider';
|
|
176
185
|
export * from './notifications/announcements/connected-announcement';
|
|
@@ -305,6 +314,7 @@ export * from './shared/hooks/use-css-link';
|
|
|
305
314
|
export * from './shared/hooks/use-debounced-callback';
|
|
306
315
|
export * from './shared/hooks/use-disclosure';
|
|
307
316
|
export * from './shared/hooks/use-enable-mobile-zoom';
|
|
317
|
+
export * from './shared/hooks/use-global-disclosure';
|
|
308
318
|
export * from './shared/hooks/use-intersection-observer';
|
|
309
319
|
export * from './shared/hooks/use-is-breakpoint';
|
|
310
320
|
export * from './shared/hooks/use-is-scrolled-beyond-element';
|
|
@@ -340,6 +350,7 @@ export * from './shared/routing/use-on-navigate';
|
|
|
340
350
|
export * from './shared/routing/with-routing';
|
|
341
351
|
export * from './shared/utils/array';
|
|
342
352
|
export * from './shared/utils/breakpoints';
|
|
353
|
+
export * from './shared/utils/css';
|
|
343
354
|
export * from './shared/utils/date';
|
|
344
355
|
export * from './shared/utils/debug';
|
|
345
356
|
export * from './shared/utils/environment';
|
|
@@ -349,6 +360,7 @@ export * from './shared/utils/number';
|
|
|
349
360
|
export * from './shared/utils/price';
|
|
350
361
|
export * from './shared/utils/promise';
|
|
351
362
|
export * from './shared/utils/random';
|
|
363
|
+
export * from './shared/utils/refs';
|
|
352
364
|
export * from './shared/utils/string';
|
|
353
365
|
export * from './shared/utils/time';
|
|
354
366
|
export * from './shared/utils/types';
|
|
@@ -4,13 +4,12 @@ import { createContext, useMemo } from 'react';
|
|
|
4
4
|
import { AlgoliaSearchProvider } from '../../algolia/algolia-search-provider.js';
|
|
5
5
|
import { BackgroundOverlay } from '../../background-overlay/background-overlay.js';
|
|
6
6
|
import { useDisclosure } from '../../shared/hooks/use-disclosure.js';
|
|
7
|
-
import styles from '../global-search.module.css.js';
|
|
8
7
|
|
|
9
8
|
const GlobalSearchDisclosureContext = createContext(null);
|
|
10
9
|
function GlobalSearchProvider({ children, searchClient, }) {
|
|
11
10
|
const { close, isOpen, open, toggle } = useDisclosure(false);
|
|
12
11
|
const value = useMemo(() => ({ close, isOpen, open, toggle }), [close, isOpen, open, toggle]);
|
|
13
|
-
return (jsx(AlgoliaSearchProvider, { searchClient: searchClient, children: jsxs(GlobalSearchDisclosureContext.Provider, { value: value, children: [children, jsx(BackgroundOverlay, {
|
|
12
|
+
return (jsx(AlgoliaSearchProvider, { searchClient: searchClient, children: jsxs(GlobalSearchDisclosureContext.Provider, { value: value, children: [children, jsx(BackgroundOverlay, { isOpen: isOpen, onClick: close, position: "behind-header" })] }) }));
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export { GlobalSearchDisclosureContext, GlobalSearchProvider };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"
|
|
1
|
+
var styles = {"search-wrapper":"global-search-module-d2g2F","search-root":"global-search-module-Sx8Lx","search-container":"global-search-module--orCF","input":"global-search-module-vXnL6","entering":"global-search-module-MYwlp","entered":"global-search-module-Jmt3c","exiting":"global-search-module-gQQfY","exited":"global-search-module-AABcw"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|