@sonic-equipment/ui 141.0.0 → 142.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,61 @@
|
|
|
1
|
+
const english = {
|
|
2
|
+
cultureCode: 'en-GB',
|
|
3
|
+
description: 'English',
|
|
4
|
+
id: '1',
|
|
5
|
+
languageCode: 'EN',
|
|
6
|
+
};
|
|
7
|
+
const dutch = {
|
|
8
|
+
cultureCode: 'nl-NL',
|
|
9
|
+
description: 'Dutch',
|
|
10
|
+
id: '2',
|
|
11
|
+
languageCode: 'NL',
|
|
12
|
+
};
|
|
13
|
+
const french = {
|
|
14
|
+
cultureCode: 'fr-FR',
|
|
15
|
+
description: 'French',
|
|
16
|
+
id: '3',
|
|
17
|
+
languageCode: 'FR',
|
|
18
|
+
};
|
|
19
|
+
const german = {
|
|
20
|
+
cultureCode: 'de-DE',
|
|
21
|
+
description: 'German',
|
|
22
|
+
id: '4',
|
|
23
|
+
languageCode: 'DE',
|
|
24
|
+
};
|
|
25
|
+
const netherlands = {
|
|
26
|
+
abbreviation: 'NL',
|
|
27
|
+
currencyCode: 'EUR',
|
|
28
|
+
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f43',
|
|
29
|
+
languages: [dutch, english],
|
|
30
|
+
name: 'Netherlands',
|
|
31
|
+
};
|
|
32
|
+
const unitedKingdom = {
|
|
33
|
+
abbreviation: 'UK',
|
|
34
|
+
currencyCode: 'GBP',
|
|
35
|
+
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f42',
|
|
36
|
+
languages: [english],
|
|
37
|
+
name: 'United Kingdom',
|
|
38
|
+
};
|
|
39
|
+
const germany = {
|
|
40
|
+
abbreviation: 'DE',
|
|
41
|
+
currencyCode: 'EUR',
|
|
42
|
+
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f45',
|
|
43
|
+
languages: [german, english],
|
|
44
|
+
name: 'Germany',
|
|
45
|
+
};
|
|
46
|
+
const france = {
|
|
47
|
+
abbreviation: 'FR',
|
|
48
|
+
currencyCode: 'EUR',
|
|
49
|
+
id: '423f6a9b-0b7b-4b3b-8b3b-3b7b0b9a6f44',
|
|
50
|
+
languages: [french, english],
|
|
51
|
+
name: 'France',
|
|
52
|
+
};
|
|
53
|
+
const countries = [
|
|
54
|
+
netherlands,
|
|
55
|
+
unitedKingdom,
|
|
56
|
+
germany,
|
|
57
|
+
france,
|
|
58
|
+
];
|
|
59
|
+
const languages = [english, dutch, french, german];
|
|
60
|
+
|
|
61
|
+
export { countries, dutch, english, france, french, german, germany, languages, netherlands, unitedKingdom };
|
|
@@ -2,7 +2,7 @@ import { useState, useCallback, useEffect } from 'react';
|
|
|
2
2
|
import { getCurrentBreakpoints } from '../utils/breakpoints.js';
|
|
3
3
|
|
|
4
4
|
const useBreakpoint = () => {
|
|
5
|
-
const [device, setDevice] = useState(getCurrentBreakpoints
|
|
5
|
+
const [device, setDevice] = useState(getCurrentBreakpoints);
|
|
6
6
|
const handleResize = useCallback(() => {
|
|
7
7
|
const breakpoints = getCurrentBreakpoints();
|
|
8
8
|
setDevice(previousBreakpoints => {
|
|
@@ -14,7 +14,7 @@ const useBreakpoint = () => {
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (typeof window === 'undefined')
|
|
16
16
|
return;
|
|
17
|
-
handleResize()
|
|
17
|
+
// handleResize()
|
|
18
18
|
window.addEventListener('resize', handleResize);
|
|
19
19
|
return () => window?.removeEventListener('resize', handleResize);
|
|
20
20
|
}, [handleResize]);
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { useState
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import Cookies from 'js-cookie';
|
|
3
|
+
import { config } from '../../config.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const defaultCookieOptions = {
|
|
6
|
+
domain: config.COOKIE_DOMAIN,
|
|
7
|
+
expires: 365,
|
|
8
|
+
path: '/',
|
|
9
|
+
sameSite: 'None',
|
|
10
|
+
secure: true,
|
|
11
|
+
};
|
|
12
|
+
function useCookie(name, options = defaultCookieOptions) {
|
|
5
13
|
const cookieValue = Cookies.get()[name];
|
|
6
14
|
const [stateValue, setStateValue] = useState(cookieValue);
|
|
7
|
-
|
|
8
|
-
if (cookieValue === stateValue)
|
|
9
|
-
return;
|
|
15
|
+
if (cookieValue !== stateValue) {
|
|
10
16
|
setStateValue(cookieValue);
|
|
11
|
-
}
|
|
17
|
+
}
|
|
12
18
|
function setValue(valueOrFn) {
|
|
13
19
|
setStateValue(oldValue => {
|
|
14
20
|
const newValue = typeof valueOrFn === 'function' ? valueOrFn(oldValue) : valueOrFn;
|
|
@@ -24,4 +30,4 @@ function useCookie(name, options) {
|
|
|
24
30
|
return [stateValue, setValue];
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
export { useCookie };
|
|
33
|
+
export { defaultCookieOptions, useCookie };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
interface UseDisclosureReturnType {
|
|
2
|
-
close:
|
|
2
|
+
close: VoidFunction;
|
|
3
3
|
isClosed: boolean;
|
|
4
4
|
isOpen: boolean;
|
|
5
|
-
open:
|
|
5
|
+
open: VoidFunction;
|
|
6
6
|
setIsOpen: (isOpen: boolean) => void;
|
|
7
|
-
toggle:
|
|
7
|
+
toggle: VoidFunction;
|
|
8
8
|
}
|
|
9
9
|
export declare const useDisclosure: (initialState?: boolean) => UseDisclosureReturnType;
|
|
10
10
|
export {};
|
|
@@ -3,7 +3,7 @@ import { getCurrentBreakpoints } from '../utils/breakpoints.js';
|
|
|
3
3
|
|
|
4
4
|
function useIsBreakpoint(breakpoint) {
|
|
5
5
|
const checkIsMatch = useCallback(() => getCurrentBreakpoints()[breakpoint], [breakpoint]);
|
|
6
|
-
const [isMatch, setIsMatch] = useState(checkIsMatch
|
|
6
|
+
const [isMatch, setIsMatch] = useState(checkIsMatch);
|
|
7
7
|
const handleResize = useCallback(() => setIsMatch(checkIsMatch()), [checkIsMatch]);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
if (typeof window === 'undefined')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsScrolledBeyondElement(element: HTMLElement | undefined): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function getElementYPosition(element) {
|
|
4
|
+
if (!element)
|
|
5
|
+
return undefined;
|
|
6
|
+
const rect = element.getBoundingClientRect();
|
|
7
|
+
return rect.top + (window?.scrollY || 0);
|
|
8
|
+
}
|
|
9
|
+
function useIsScrolledBeyondElement(element) {
|
|
10
|
+
const [isScrolledBeyond, setIsScrolledBeyond] = useState(() => (window?.scrollY || 0) > (getElementYPosition(element) || 0));
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
function handleScroll() {
|
|
15
|
+
const elementY = getElementYPosition(element);
|
|
16
|
+
setIsScrolledBeyond((window?.scrollY || 0) + (window?.innerHeight || 0) > (elementY || 0));
|
|
17
|
+
}
|
|
18
|
+
window?.addEventListener('scroll', handleScroll);
|
|
19
|
+
return () => {
|
|
20
|
+
window?.removeEventListener('scroll', handleScroll);
|
|
21
|
+
};
|
|
22
|
+
}, [element]);
|
|
23
|
+
return isScrolledBeyond;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { useIsScrolledBeyondElement };
|
|
@@ -4,5 +4,5 @@ interface ScrollOptions {
|
|
|
4
4
|
scrollPadding?: number;
|
|
5
5
|
}
|
|
6
6
|
export declare const scrollToTop: (scrollOptions?: ScrollToOptions) => void;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const scrollTo: (ref: RefObject<HTMLElement>, scrollOptions?: ScrollOptions) => () => void;
|
|
8
8
|
export {};
|
|
@@ -4,7 +4,7 @@ const scrollToTop = (scrollOptions) => {
|
|
|
4
4
|
top: 0,
|
|
5
5
|
});
|
|
6
6
|
};
|
|
7
|
-
const
|
|
7
|
+
const scrollTo = (ref, scrollOptions) => () => {
|
|
8
8
|
if (!ref.current)
|
|
9
9
|
return;
|
|
10
10
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -16,4 +16,4 @@ const useScrollTo = (ref, scrollOptions) => () => {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { scrollTo, scrollToTop };
|
|
@@ -7,8 +7,10 @@ export interface Language {
|
|
|
7
7
|
}
|
|
8
8
|
export interface Country {
|
|
9
9
|
abbreviation: CountryCode;
|
|
10
|
+
currencyCode: string;
|
|
10
11
|
id: string;
|
|
11
12
|
languages: Language[];
|
|
12
13
|
name: string;
|
|
13
14
|
}
|
|
14
|
-
export
|
|
15
|
+
export declare function isLanguage(language: unknown): language is Language;
|
|
16
|
+
export declare function isCountry(country: unknown): country is Country;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isCultureCode, isLanguageCode, isCountryCode } from '../../intl/types.js';
|
|
2
|
+
|
|
3
|
+
function isLanguage(language) {
|
|
4
|
+
if (typeof language !== 'object' || language === null)
|
|
5
|
+
return false;
|
|
6
|
+
if (!('cultureCode' in language) || !isCultureCode(language.cultureCode))
|
|
7
|
+
return false;
|
|
8
|
+
if (!('description' in language) || typeof language.description !== 'string')
|
|
9
|
+
return false;
|
|
10
|
+
if (!('id' in language) || typeof language.id !== 'string')
|
|
11
|
+
return false;
|
|
12
|
+
if (!('languageCode' in language) || !isLanguageCode(language.languageCode))
|
|
13
|
+
return false;
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
function isCountry(country) {
|
|
17
|
+
if (typeof country !== 'object' || country === null)
|
|
18
|
+
return false;
|
|
19
|
+
if (!('abbreviation' in country) || isCountryCode(country.abbreviation))
|
|
20
|
+
return false;
|
|
21
|
+
if (!('id' in country) || typeof country.id !== 'string')
|
|
22
|
+
return false;
|
|
23
|
+
if (!('name' in country) || typeof country.name !== 'string')
|
|
24
|
+
return false;
|
|
25
|
+
if (!('currencyCode' in country) || typeof country.currencyCode !== 'string')
|
|
26
|
+
return false;
|
|
27
|
+
if (!('languages' in country) || !Array.isArray(country.languages))
|
|
28
|
+
return false;
|
|
29
|
+
return country.languages.every(isLanguage);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { isCountry, isLanguage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const voidFunction: VoidFunction;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface NavigationLink {
|
|
2
|
+
external: boolean;
|
|
3
|
+
key: string;
|
|
4
|
+
links: NavigationLink[];
|
|
5
|
+
openInNewTab: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
type: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LinkBlock {
|
|
11
|
+
key: string;
|
|
12
|
+
links: NavigationLink[];
|
|
13
|
+
title: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WishListLineModel, WishListModel } from '../api/storefront/model/storefront.model';
|
|
2
2
|
interface Props {
|
|
3
|
-
onFavoriteAdded?:
|
|
4
|
-
onFavoriteListAdded?:
|
|
5
|
-
onFavoriteRemoved?:
|
|
3
|
+
onFavoriteAdded?: VoidFunction;
|
|
4
|
+
onFavoriteListAdded?: VoidFunction;
|
|
5
|
+
onFavoriteRemoved?: VoidFunction;
|
|
6
6
|
signInUrl: string;
|
|
7
7
|
}
|
|
8
8
|
export declare function FavoriteProvider(props: Props): null;
|
|
@@ -66,7 +66,8 @@ function useGlobalState(key, initialState) {
|
|
|
66
66
|
const [rerenderState, setRerenderState] = useState(state.value);
|
|
67
67
|
useEffect(() => {
|
|
68
68
|
const updateState = (value) => {
|
|
69
|
-
setTimeout(() => setRerenderState(value), 0);
|
|
69
|
+
const timeoutId = setTimeout(() => setRerenderState(value), 0);
|
|
70
|
+
return () => clearTimeout(timeoutId);
|
|
70
71
|
};
|
|
71
72
|
state.addEventListener('stateChanged', updateState);
|
|
72
73
|
return () => {
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @see https://gitlab.com/kaictl/node/mock-local-storage */
|
|
3
|
-
declare const HAS_LOCAL_STORAGE_SUPPORT: boolean;
|
|
4
|
-
declare function mockStorage(): void;
|
|
5
|
-
declare const noopCallback: () => void;
|
|
6
|
-
declare function createStorage(): Record<string, string>;
|
|
7
|
-
declare const _: void;
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { voidFunction } from '../model/defaults.js';
|
|
2
|
+
|
|
2
3
|
/* eslint-disable no-prototype-builtins */
|
|
3
4
|
/** Mocks the localStorage and sessionStorage API in Node.js
|
|
4
5
|
* @see https://gitlab.com/kaictl/node/mock-local-storage */
|
|
@@ -37,11 +38,10 @@ function mockStorage() {
|
|
|
37
38
|
value: global.sessionStorage,
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
const noopCallback = () => { };
|
|
41
41
|
function createStorage() {
|
|
42
42
|
const UNSET = Symbol();
|
|
43
43
|
const s = {};
|
|
44
|
-
let _itemInsertionCallback =
|
|
44
|
+
let _itemInsertionCallback = voidFunction;
|
|
45
45
|
Object.defineProperty(s, 'setItem', {
|
|
46
46
|
get: () => {
|
|
47
47
|
return (k, v = UNSET) => {
|
|
@@ -96,7 +96,7 @@ function createStorage() {
|
|
|
96
96
|
},
|
|
97
97
|
set: v => {
|
|
98
98
|
if (!v || typeof v != 'function') {
|
|
99
|
-
v =
|
|
99
|
+
v = voidFunction;
|
|
100
100
|
}
|
|
101
101
|
_itemInsertionCallback = v;
|
|
102
102
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureNumber: (value: unknown, defaultNumber?: number) => number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const ensureNumber = (value, defaultNumber = 0) => {
|
|
2
|
+
if (typeof value === 'number')
|
|
3
|
+
return value;
|
|
4
|
+
if (typeof value !== 'string')
|
|
5
|
+
return defaultNumber;
|
|
6
|
+
const numberValue = Number.parseFloat(value);
|
|
7
|
+
return Number.isNaN(numberValue) ? defaultNumber : numberValue;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { ensureNumber };
|
|
@@ -28,7 +28,10 @@ function SidebarDetectBreakpoint() {
|
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (transition)
|
|
30
30
|
return;
|
|
31
|
-
setTimeout(() => setState(state => ({ ...state, transition: true })), 10);
|
|
31
|
+
const timeoutId = setTimeout(() => setState(state => ({ ...state, transition: true })), 10);
|
|
32
|
+
return () => {
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
};
|
|
32
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
36
|
}, [transition]);
|
|
34
37
|
return null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
+
import { voidFunction } from '../shared/model/defaults.js';
|
|
3
4
|
import { useGlobalState } from '../shared/providers/global-state-provider.js';
|
|
4
5
|
import { getCurrentBreakpoints } from '../shared/utils/breakpoints.js';
|
|
5
6
|
|
|
@@ -28,9 +29,9 @@ const useSidebar = () => {
|
|
|
28
29
|
};
|
|
29
30
|
const useSidebarActions = () => {
|
|
30
31
|
const [actions] = useGlobalState('sidebar-actions', {
|
|
31
|
-
close:
|
|
32
|
-
open:
|
|
33
|
-
toggle:
|
|
32
|
+
close: voidFunction,
|
|
33
|
+
open: voidFunction,
|
|
34
|
+
toggle: voidFunction,
|
|
34
35
|
});
|
|
35
36
|
return actions;
|
|
36
37
|
};
|
|
@@ -9,12 +9,13 @@ import { TextField } from '../forms/text-field/text-field.js';
|
|
|
9
9
|
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
10
10
|
import { Message } from '../message/message.js';
|
|
11
11
|
import { validateEmail } from '../shared/model/address.js';
|
|
12
|
+
import { voidFunction } from '../shared/model/defaults.js';
|
|
12
13
|
import { RouteLink } from '../shared/routing/route-link.js';
|
|
13
14
|
import { Heading } from '../typography/heading/heading.js';
|
|
14
15
|
import styles from './sign-in-form.module.css.js';
|
|
15
16
|
|
|
16
17
|
const GUEST_SIGN_IN_BUTTON_NAME = 'guestSignin';
|
|
17
|
-
function SignInForm({ allowGuestSignIn = false, createAccountPath, errorMessage, initialEmail, initialRememberMe, isDisabled: _isDisabled = false, isPendingGuestSignIn = false, isPendingUserSignIn = false, onRecoverPasswordDialogOpen =
|
|
18
|
+
function SignInForm({ allowGuestSignIn = false, createAccountPath, errorMessage, initialEmail, initialRememberMe, isDisabled: _isDisabled = false, isPendingGuestSignIn = false, isPendingUserSignIn = false, onRecoverPasswordDialogOpen = voidFunction, onSubmit = voidFunction, }) {
|
|
18
19
|
const t = useFormattedMessage();
|
|
19
20
|
const title = t('sign in');
|
|
20
21
|
const isDisabled = isPendingUserSignIn || isPendingGuestSignIn || _isDisabled;
|
package/dist/styles.css
CHANGED
|
@@ -259,12 +259,12 @@
|
|
|
259
259
|
linear-gradient(0deg, #000, #000);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
.address-module-
|
|
262
|
+
.address-info-display-module-CbRth {
|
|
263
263
|
font: inherit;
|
|
264
264
|
line-height: 1.5;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
.address-module-
|
|
267
|
+
.address-info-display-module-CbRth p {
|
|
268
268
|
margin: 0;
|
|
269
269
|
}
|
|
270
270
|
|
|
@@ -292,6 +292,10 @@
|
|
|
292
292
|
width: 12px;
|
|
293
293
|
height: 12px;
|
|
294
294
|
}
|
|
295
|
+
.link-module-xLqBn:focus-visible {
|
|
296
|
+
box-shadow: var(--shadow-focus-outline);
|
|
297
|
+
outline: none;
|
|
298
|
+
}
|
|
295
299
|
.link-module-xLqBn:where([data-disabled]) {
|
|
296
300
|
cursor: default;
|
|
297
301
|
opacity: 0.4;
|
|
@@ -1242,6 +1246,11 @@
|
|
|
1242
1246
|
color: var(--color-brand-dark-gray);
|
|
1243
1247
|
}
|
|
1244
1248
|
/* Don't show value-reveal button on empty password fields */
|
|
1249
|
+
.input-module-2woJR .input-module-zjVxG input[type='password'] {
|
|
1250
|
+
/* TODO: overwriting forced Spire style, remove !important in the future */
|
|
1251
|
+
font-family: 'Verdana', sans-serif !important;
|
|
1252
|
+
font-size: inherit !important;
|
|
1253
|
+
}
|
|
1245
1254
|
.input-module-2woJR .input-module-zjVxG input[type='password'] + .input-module-oeAz2 {
|
|
1246
1255
|
transition: all 0.2s ease;
|
|
1247
1256
|
}
|
|
@@ -1290,7 +1299,7 @@
|
|
|
1290
1299
|
}
|
|
1291
1300
|
|
|
1292
1301
|
.number-field-module-gmnog .number-field-module-8Lvgh:has(button[data-pressed]) input {
|
|
1293
|
-
animation: number-field-module-OlEoa 100ms
|
|
1302
|
+
animation: number-field-module-OlEoa 100ms;
|
|
1294
1303
|
}
|
|
1295
1304
|
|
|
1296
1305
|
.number-field-module-gmnog .number-field-module-8Lvgh button {
|
|
@@ -1554,7 +1563,8 @@
|
|
|
1554
1563
|
}
|
|
1555
1564
|
|
|
1556
1565
|
.badge-module-X5Au9:where(.badge-module-Q03Go) {
|
|
1557
|
-
animation: badge-module-YSs-l var(--animation-duration) ease-in-out
|
|
1566
|
+
animation: badge-module-YSs-l var(--animation-duration) ease-in-out;
|
|
1567
|
+
animation-iteration-count: 3;
|
|
1558
1568
|
}
|
|
1559
1569
|
|
|
1560
1570
|
.badge-module-X5Au9:where(.badge-module-kqfth) {
|
|
@@ -2094,6 +2104,18 @@
|
|
|
2094
2104
|
}
|
|
2095
2105
|
}
|
|
2096
2106
|
|
|
2107
|
+
/* Styles set as a module to PageContainer and Modal to override Spire's global styles
|
|
2108
|
+
Remove this file and references to it when we drop Spire.
|
|
2109
|
+
Also, see base.css (only used in Storybook) for more details */
|
|
2110
|
+
.reset-module-GKAEu {
|
|
2111
|
+
font-family: var(--font-family-sonic);
|
|
2112
|
+
font-size: var(--font-size-base);
|
|
2113
|
+
line-height: var(--line-height-24);
|
|
2114
|
+
}
|
|
2115
|
+
.reset-module-GKAEu :where(p) {
|
|
2116
|
+
margin-block: var(--space-16);
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2097
2119
|
.modal-module-rVFJc {
|
|
2098
2120
|
position: fixed;
|
|
2099
2121
|
z-index: calc(var(--modal-layer) - 1);
|
|
@@ -4985,6 +5007,10 @@ button.swiper-pagination-bullet {
|
|
|
4985
5007
|
padding-inline: var(--space-32)
|
|
4986
5008
|
}
|
|
4987
5009
|
|
|
5010
|
+
.header-layout-module-VlTuk .header-layout-module-oKPyL {
|
|
5011
|
+
inline-size: var(--space-100);
|
|
5012
|
+
}
|
|
5013
|
+
|
|
4988
5014
|
.header-layout-module-VlTuk .header-layout-module-aBOJL {
|
|
4989
5015
|
display: none;
|
|
4990
5016
|
}
|
|
@@ -4997,6 +5023,40 @@ button.swiper-pagination-bullet {
|
|
|
4997
5023
|
}
|
|
4998
5024
|
}
|
|
4999
5025
|
|
|
5026
|
+
.navigation-link-list-module-Ku9Sa {
|
|
5027
|
+
--max-width: 200px;
|
|
5028
|
+
|
|
5029
|
+
display: flex;
|
|
5030
|
+
padding: 0;
|
|
5031
|
+
margin: 0;
|
|
5032
|
+
gap: var(--space-40);
|
|
5033
|
+
list-style: none;
|
|
5034
|
+
}
|
|
5035
|
+
|
|
5036
|
+
.navigation-link-list-module-Ku9Sa .navigation-link-list-module-kj0Rj {
|
|
5037
|
+
display: flex;
|
|
5038
|
+
align-items: baseline;
|
|
5039
|
+
padding: 0;
|
|
5040
|
+
border: none;
|
|
5041
|
+
background: none;
|
|
5042
|
+
color: var(--color-black);
|
|
5043
|
+
cursor: pointer;
|
|
5044
|
+
font-family: inherit;
|
|
5045
|
+
font-size: var(--font-size-18);
|
|
5046
|
+
font-weight: var(--font-weight-bold);
|
|
5047
|
+
max-inline-size: var(--max-width);
|
|
5048
|
+
text-decoration: none;
|
|
5049
|
+
}
|
|
5050
|
+
|
|
5051
|
+
.navigation-link-list-module-Ku9Sa .navigation-link-list-module-kj0Rj:hover {
|
|
5052
|
+
color: var(--color-brand-red);
|
|
5053
|
+
}
|
|
5054
|
+
|
|
5055
|
+
.navigation-link-list-module-Ku9Sa .navigation-link-list-module-kj0Rj .navigation-link-list-module-QiKiA {
|
|
5056
|
+
flex-shrink: 0;
|
|
5057
|
+
margin-inline-start: var(--space-4);
|
|
5058
|
+
}
|
|
5059
|
+
|
|
5000
5060
|
.sonic-logo-module-5zzhF {
|
|
5001
5061
|
display: block;
|
|
5002
5062
|
}
|
|
@@ -5766,7 +5826,6 @@ button.swiper-pagination-bullet {
|
|
|
5766
5826
|
|
|
5767
5827
|
display: grid;
|
|
5768
5828
|
overflow: clip;
|
|
5769
|
-
font-family: var(--font-family-sonic);
|
|
5770
5829
|
grid-template: minmax(0, min-content) 1fr minmax(0, min-content) / 100%;
|
|
5771
5830
|
grid-template-areas:
|
|
5772
5831
|
'page-header'
|
|
@@ -6077,6 +6136,10 @@ button.swiper-pagination-bullet {
|
|
|
6077
6136
|
}
|
|
6078
6137
|
}
|
|
6079
6138
|
|
|
6139
|
+
.edit-address-form-module-lLT5t {
|
|
6140
|
+
margin-block-start: var(--space-8);
|
|
6141
|
+
}
|
|
6142
|
+
|
|
6080
6143
|
.edit-address-form-module-2bfdq {
|
|
6081
6144
|
display: flex;
|
|
6082
6145
|
flex-wrap: wrap;
|
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useRef, useMemo, cloneElement } from 'react';
|
|
3
3
|
import { usePress } from 'react-aria';
|
|
4
4
|
import { DialogTrigger, Popover, OverlayArrow, Dialog } from 'react-aria-components';
|
|
@@ -13,12 +13,15 @@ function InfoIcon(props) {
|
|
|
13
13
|
}
|
|
14
14
|
function TriggerButton({ buttonRef, className, trigger, }) {
|
|
15
15
|
const { pressProps } = usePress({ ref: buttonRef });
|
|
16
|
-
const triggerWithHandler = useMemo(() =>
|
|
16
|
+
const triggerWithHandler = useMemo(() =>
|
|
17
|
+
// eslint-disable-next-line @eslint-react/no-clone-element
|
|
18
|
+
cloneElement(trigger, {
|
|
17
19
|
...pressProps,
|
|
18
20
|
}), [trigger, pressProps]);
|
|
19
21
|
return (jsx("div", { ref: buttonRef, className: clsx(className, styles['trigger-wrapper']), children: triggerWithHandler }));
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
const defaultTrigger = jsx(InfoIcon, {});
|
|
24
|
+
function Tooltip({ children, className, offset, placement = 'bottom', trigger = defaultTrigger, }) {
|
|
22
25
|
const { isOpen, setIsOpen } = useDisclosure();
|
|
23
26
|
const triggerRef = useRef(null);
|
|
24
27
|
return (jsxs(DialogTrigger, { isOpen: isOpen, onOpenChange: setIsOpen, children: [jsx(TriggerButton, { buttonRef: triggerRef, className: className, trigger: trigger }), jsxs(Popover, { className: styles.popover, offset: offset, placement: placement, triggerRef: triggerRef, children: [jsx(OverlayArrow, { className: styles.arrow, children: jsx("svg", { height: 12, viewBox: "0 0 12 12", width: 12, children: jsx("path", { d: "M0 0 L6 6 L12 0" }) }) }), jsx(Dialog, { className: styles.dialog, children: children })] })] }));
|