@sonic-equipment/ui 1.0.0 → 1.1.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-insights-provider.d.ts +1 -1
- package/dist/algolia/use-algolia-search.d.ts +3 -3
- package/dist/authentication/authenticated-container.d.ts +1 -1
- package/dist/buttons/button/button.d.ts +6 -1
- package/dist/buttons/button/button.js +3 -3
- package/dist/buttons/icon-button/icon-button.d.ts +1 -1
- package/dist/buttons/link/link.d.ts +6 -1
- package/dist/buttons/link/link.js +2 -3
- package/dist/cards/table-card/table-card.d.ts +1 -1
- package/dist/carousel/carousel-navigation-button.d.ts +1 -1
- package/dist/collapsables/cascading-component/cascading-component-container-context.d.ts +1 -1
- package/dist/collapsables/unmounter/unmounter.d.ts +1 -1
- package/dist/collapsables/unmounter/unmounter.js +1 -1
- package/dist/cookies/cookie-context.d.ts +1 -1
- package/dist/country-language-selector/country-language-selector.js +1 -1
- package/dist/forms/elements/textarea/textarea.js +5 -6
- package/dist/forms/fields/number-field/number-field.d.ts +8 -3
- package/dist/forms/fields/number-field/number-field.js +3 -3
- package/dist/forms/fields/text-field/text-field.d.ts +2 -2
- package/dist/global-search/search-input/search-input.d.ts +2 -2
- package/dist/global-search/types.d.ts +3 -3
- package/dist/intl/intl-context.d.ts +1 -1
- package/dist/intl/missing-translation-provider.d.ts +1 -1
- package/dist/lists/menu-list/menu-list-provider.d.ts +1 -1
- package/dist/navigation/panel-navigation/panel-navigation.js +6 -8
- package/dist/notifications/announcements/announcement.d.ts +1 -1
- package/dist/observers/intersection-observer.d.ts +1 -1
- package/dist/pages/account/sign-in-page/sign-in-page.d.ts +2 -1
- package/dist/pages/account/sign-in-page/sign-in-page.js +8 -5
- package/dist/pages/checkout/payment-page/components/adyen-payment.d.ts +2 -2
- package/dist/pages/checkout/shipping-page/shipping-page.js +1 -1
- package/dist/pages/product/product-listing-page/product-listing-page-provider/product-listing-page-context.d.ts +1 -1
- package/dist/shared/hooks/use-debounced-callback.js +1 -1
- package/dist/shared/hooks/use-inert.d.ts +1 -1
- package/dist/shared/hooks/use-intersection-observer.d.ts +1 -1
- package/dist/shared/local-storage/local-storage-context.d.ts +1 -1
- package/dist/shared/providers/global-state-provider.d.ts +3 -3
- package/dist/shared/routing/route-context.d.ts +1 -1
- package/dist/shared/routing/use-route-link-element.d.ts +1 -1
- package/dist/shared/routing/use-route-link.d.ts +1 -1
- package/dist/shared/routing/with-routing.d.ts +2 -2
- package/dist/shared/utils/refs.d.ts +2 -2
- package/dist/shared/utils/refs.js +4 -2
- package/dist/shared/utils/scrolling.d.ts +1 -1
- package/dist/table/elements/table-context.d.ts +1 -1
- package/dist/table/elements/table-row-context.d.ts +1 -1
- package/dist/toast/toast.d.ts +1 -1
- package/dist/toast/use-toast.js +4 -1
- package/dist/typography/heading/heading.d.ts +2 -2
- package/package.json +5 -5
|
@@ -4,7 +4,7 @@ export interface AlgoliaInsightsProviderState extends AlgoliaInsightsProviderGlo
|
|
|
4
4
|
objectId?: string | string[] | undefined;
|
|
5
5
|
position?: number | number[] | undefined;
|
|
6
6
|
}
|
|
7
|
-
export declare const AlgoliaInsightsProviderContext:
|
|
7
|
+
export declare const AlgoliaInsightsProviderContext: import("react").Context<AlgoliaInsightsProviderState>;
|
|
8
8
|
export declare function AlgoliaInsightsProvider({ children, value, }: {
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
value?: AlgoliaInsightsProviderState;
|
|
@@ -25,10 +25,10 @@ export declare function useAlgoliaSearch(): {
|
|
|
25
25
|
quickAccess: AutocompleteCollection<QuickAccessHit> | undefined;
|
|
26
26
|
recentSearches: ExtendedAutoCompleteCollection<RecentSearchHit> | undefined;
|
|
27
27
|
autocomplete: import("..").Autocomplete;
|
|
28
|
-
formRef: React.RefObject<HTMLFormElement>;
|
|
28
|
+
formRef: React.RefObject<HTMLFormElement | null>;
|
|
29
29
|
indexes: import("./algolia-index-config").Indexes;
|
|
30
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
31
|
-
panelRef: React.RefObject<HTMLDivElement>;
|
|
30
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
31
|
+
panelRef: React.RefObject<HTMLDivElement | null>;
|
|
32
32
|
productsIndexName: string;
|
|
33
33
|
productsQuerySuggestionsIndexName: string;
|
|
34
34
|
searchClient: import("algoliasearch").SearchClient;
|
|
@@ -6,4 +6,4 @@ export declare function AuthenticatedContainer({ children, onUnauthenticated, vi
|
|
|
6
6
|
unauthenticated?: ReactNode;
|
|
7
7
|
undetermined?: ReactNode;
|
|
8
8
|
};
|
|
9
|
-
}): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null;
|
|
9
|
+
}): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
@@ -26,4 +26,9 @@ export interface ButtonProps {
|
|
|
26
26
|
variant?: 'solid' | 'outline' | 'ghost';
|
|
27
27
|
withArrow?: boolean;
|
|
28
28
|
}
|
|
29
|
-
export declare const Button:
|
|
29
|
+
export declare const Button: {
|
|
30
|
+
({ _pseudo, "aria-label": ariaLabel, children: _children, className, color, condensed, "data-test-selector": dataTestSelector, download, form, href, icon, iconPosition, isDisabled, isLoading, isValidating, light, name, onClick, ref, route, size, type, value, variant, withArrow, }: ButtonProps & {
|
|
31
|
+
ref?: React.RefObject<HTMLButtonElement | null>;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { isValidElement } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { Icon } from '../../icon/icon.js';
|
|
6
6
|
import { ProgressCircle } from '../../loading/progress-circle.js';
|
|
7
7
|
import { useRouteLink } from '../../shared/routing/use-route-link.js';
|
|
8
8
|
import buttonStyles from './button.module.css.js';
|
|
9
9
|
|
|
10
|
-
const Button =
|
|
10
|
+
const Button = ({ _pseudo = 'none', 'aria-label': ariaLabel, children: _children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, download, form, href, icon, iconPosition = 'left', isDisabled, isLoading = false, isValidating = true, light = false, name, onClick, ref, route, size = 'lg', type = 'button', value, variant = 'solid', withArrow = false, }) => {
|
|
11
11
|
const { getRouteLinkProps, RouteLinkElement } = useRouteLink();
|
|
12
12
|
const handleButtonClick = (e) => {
|
|
13
13
|
if (onClick)
|
|
@@ -30,7 +30,7 @@ const Button = forwardRef(({ _pseudo = 'none', 'aria-label': ariaLabel, children
|
|
|
30
30
|
return (jsx(RouteLinkElement, { "aria-label": ariaLabel, className: classNames, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, download: download, onClick: onClick, type: type, ...getRouteLinkProps(href, route), children: children }));
|
|
31
31
|
}
|
|
32
32
|
return (jsx("button", { ref: ref, "aria-label": ariaLabel, className: classNames, "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, form: form, formNoValidate: isValidating ? undefined : true, name: name, onClick: handleButtonClick, type: type, value: value, children: children }));
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
34
|
Button.displayName = 'Button';
|
|
35
35
|
|
|
36
36
|
export { Button };
|
|
@@ -22,4 +22,4 @@ export interface IconButtonProps {
|
|
|
22
22
|
theme?: 'default' | 'secondary' | 'light';
|
|
23
23
|
type?: 'button' | 'submit' | 'reset';
|
|
24
24
|
}
|
|
25
|
-
export declare const IconButton:
|
|
25
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -20,4 +20,9 @@ export interface LinkProps {
|
|
|
20
20
|
target?: string;
|
|
21
21
|
title?: string;
|
|
22
22
|
}
|
|
23
|
-
export declare const Link:
|
|
23
|
+
export declare const Link: {
|
|
24
|
+
({ children, className: _className, color, hasUnderline, href, hrefLang, id, ignoreLocalePrefix, isDisabled, lang, onClick, onKeyUp, ref, rel, role, route, tabIndex, target, title, ...rest }: LinkProps & {
|
|
25
|
+
ref?: React.RefObject<HTMLElement | null>;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import { useRouteLink } from '../../shared/routing/use-route-link.js';
|
|
6
5
|
import styles from './link.module.css.js';
|
|
7
6
|
|
|
8
|
-
const Link =
|
|
7
|
+
const Link = ({ children, className: _className, color, hasUnderline, href, hrefLang, id, ignoreLocalePrefix, isDisabled, lang, onClick, onKeyUp, ref, rel, role, route, tabIndex, target, title, ...rest }) => {
|
|
9
8
|
const { getRouteLinkProps, RouteLinkElement } = useRouteLink(ignoreLocalePrefix);
|
|
10
9
|
const className = clsx(styles['link'], hasUnderline && styles['has-underline'], color && styles[color], _className);
|
|
11
10
|
if (href) {
|
|
12
11
|
return (jsx(RouteLinkElement, { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, hrefLang: hrefLang, id: id, lang: lang, onClick: onClick, onKeyUp: onKeyUp, rel: rel, role: role, tabIndex: isDisabled ? -1 : tabIndex, target: target, title: title, ...getRouteLinkProps(href, route), ...rest, children: children }));
|
|
13
12
|
}
|
|
14
13
|
return (jsx("button", { ref: ref, className: className, "data-disabled": isDisabled ? true : undefined, disabled: isDisabled ? true : undefined, id: id, lang: lang, onClick: onClick, onKeyUp: onKeyUp, rel: rel, role: role, tabIndex: isDisabled ? -1 : tabIndex, title: title, type: "button", ...rest, children: children }));
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
Link.displayName = 'Link';
|
|
17
16
|
|
|
18
17
|
export { Link };
|
|
@@ -12,4 +12,4 @@ export interface TableCardProps {
|
|
|
12
12
|
stickyHeader?: boolean;
|
|
13
13
|
title?: TranslationId;
|
|
14
14
|
}
|
|
15
|
-
export declare const TableCard:
|
|
15
|
+
export declare const TableCard: import("react").ForwardRefExoticComponent<TableCardProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -4,5 +4,5 @@ interface CarouselNavigationButtonProps {
|
|
|
4
4
|
direction: SwipeDirection;
|
|
5
5
|
onClick?: (direction: SwipeDirection) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const CarouselNavigationButton:
|
|
7
|
+
export declare const CarouselNavigationButton: import("react").ForwardRefExoticComponent<CarouselNavigationButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CascadingComponentContainerContextType } from './types';
|
|
2
|
-
export declare const CascadingComponentContainerContext:
|
|
2
|
+
export declare const CascadingComponentContainerContext: import("react").Context<CascadingComponentContainerContextType | null>;
|
|
@@ -4,7 +4,7 @@ export interface UnmounterContextType {
|
|
|
4
4
|
unmount: boolean;
|
|
5
5
|
unregisterChild: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const UnmounterContext:
|
|
7
|
+
export declare const UnmounterContext: import("react").Context<UnmounterContextType | null>;
|
|
8
8
|
export declare function useUnmount(): UnmounterContextType | null;
|
|
9
9
|
export declare function Unmounter({ children: children, onUnmounted, onUnmountReady, unmount: _unmount, }: {
|
|
10
10
|
children: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useState, useEffect, useMemo
|
|
3
|
+
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
const UnmounterContext = createContext(null);
|
|
6
6
|
function useUnmount() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CookieContextValue } from './types';
|
|
2
|
-
export declare const CookieContext:
|
|
2
|
+
export declare const CookieContext: import("react").Context<CookieContextValue | undefined>;
|
|
@@ -19,7 +19,7 @@ function CountryLanguageSelector({ className, defaultSelectedOption, isOpen, onC
|
|
|
19
19
|
const height = size.height;
|
|
20
20
|
document?.documentElement.style.setProperty('--clselector-height', `${height}px`);
|
|
21
21
|
});
|
|
22
|
-
const focusTimeoutRef = useRef();
|
|
22
|
+
const focusTimeoutRef = useRef(undefined);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
|
25
25
|
setIsInitialized(true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
import { useContextProps, TextAreaContext, TextArea as TextArea$1 } from 'react-aria-components';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import styles from './textarea.module.css.js';
|
|
@@ -11,7 +11,7 @@ import styles from './textarea.module.css.js';
|
|
|
11
11
|
* The initial height is calculated based on the style of the textarea.
|
|
12
12
|
* The height is updated everytime the user types.
|
|
13
13
|
*/
|
|
14
|
-
const TextArea =
|
|
14
|
+
const TextArea = ({ autoGrow, className, label, ref: _ref, size, variant = 'solid', ...textAreaProps }) => {
|
|
15
15
|
const textAreaRef = useRef(null);
|
|
16
16
|
const [props, ref] = useContextProps(textAreaProps, textAreaRef, TextAreaContext);
|
|
17
17
|
const initialHeight = useRef(null);
|
|
@@ -42,14 +42,13 @@ const TextArea = forwardRef(({ autoGrow, className, label, size, variant = 'soli
|
|
|
42
42
|
updateHeight();
|
|
43
43
|
}, [ref, autoGrow, updateHeight, size]);
|
|
44
44
|
return (jsx(Fragment, { children: jsx("div", { className: clsx(className, styles['input-container'], styles[variant]), children: jsx(TextArea$1, { "aria-label": label, ...textAreaProps, ref: node => {
|
|
45
|
-
ref.current =
|
|
46
|
-
|
|
47
|
-
return (textAreaRef.current = node);
|
|
45
|
+
ref.current = node;
|
|
46
|
+
textAreaRef.current = node;
|
|
48
47
|
}, onInput: e => {
|
|
49
48
|
updateHeight();
|
|
50
49
|
props.onInput?.(e);
|
|
51
50
|
} }) }) }));
|
|
52
|
-
}
|
|
51
|
+
};
|
|
53
52
|
TextArea.displayName = 'TextArea';
|
|
54
53
|
|
|
55
54
|
export { TextArea };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FocusEvent,
|
|
1
|
+
import { FocusEvent, SyntheticEvent } from 'react';
|
|
2
2
|
import { ValidateFunction } from '../../elements/field-error/field-error';
|
|
3
3
|
export interface NumberFieldProps {
|
|
4
4
|
autoFocus?: boolean;
|
|
@@ -21,7 +21,7 @@ export interface NumberFieldProps {
|
|
|
21
21
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
22
22
|
onChange?: (value: number) => void;
|
|
23
23
|
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
24
|
-
onInput?:
|
|
24
|
+
onInput?: (e: SyntheticEvent<HTMLInputElement>) => void;
|
|
25
25
|
onKeyUp?: (e: React.KeyboardEvent) => void;
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
showLabel?: boolean;
|
|
@@ -31,4 +31,9 @@ export interface NumberFieldProps {
|
|
|
31
31
|
value?: number;
|
|
32
32
|
withButtons?: boolean;
|
|
33
33
|
}
|
|
34
|
-
export declare const NumberField:
|
|
34
|
+
export declare const NumberField: {
|
|
35
|
+
({ autoGrow, className, "data-test-selector": dataTestSelector, defaultValue, formatOptions, info, inputMode, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onBlur, onChange, onFocus, onInput, onKeyUp, placeholder, ref, showLabel, size, step, value, withButtons, }: NumberFieldProps & {
|
|
36
|
+
ref?: React.RefObject<HTMLInputElement | null>;
|
|
37
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
displayName: string;
|
|
39
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { NumberField as NumberField$1, Button } from 'react-aria-components';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { Icon } from '../../../icon/icon.js';
|
|
@@ -24,7 +24,7 @@ function NumberFieldControls({ active, children, isDisabled, showReset, }) {
|
|
|
24
24
|
}
|
|
25
25
|
let debouncedChange;
|
|
26
26
|
let debouncedKeyup;
|
|
27
|
-
const NumberField =
|
|
27
|
+
const NumberField = ({ autoGrow, className, 'data-test-selector': dataTestSelector, defaultValue, formatOptions = defaultFormatOptions, info, inputMode = 'numeric', isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue = 0, name, onBlur, onChange, onFocus, onInput, onKeyUp, placeholder, ref, showLabel, size = 'lg', step = 1, value, withButtons, }) => {
|
|
28
28
|
const t = useFormattedMessage();
|
|
29
29
|
const inputRef = useRef(null);
|
|
30
30
|
const [showControlsReset, setShowControlsReset] = useState((defaultValue || value || 0) - step <= minValue);
|
|
@@ -49,7 +49,7 @@ const NumberField = forwardRef(({ autoGrow, className, 'data-test-selector': dat
|
|
|
49
49
|
return (jsx(NumberField$1, { "aria-label": label, className: clsx(styles['number-field'], styles[size], className), "data-test-selector": dataTestSelector, decrementAriaLabel: t('Decrease'), defaultValue: defaultValue, formatOptions: formatOptions, incrementAriaLabel: t('Increase'), isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxValue: maxValue, minValue: minValue, name: name, onChange: value => {
|
|
50
50
|
handleChange(value);
|
|
51
51
|
}, onInput: onInput, onKeyUp: handleKeyUp, step: step, value: value, children: jsx(FormFieldLayout, { errorSlot: jsx(FieldError, {}), infoSlot: info && jsx(InfoIconTooltip, { children: info }), labelSlot: showLabel && jsx(Label, { isRequired: isRequired, children: label }), children: jsx(NumberFieldControls, { active: withButtons, isDisabled: isDisabled, showReset: showControlsReset, children: jsx(Input, { ref: multiRef(inputRef, ref), autoGrow: autoGrow, "data-test-selector": "value", inputMode: inputMode, label: label, maxLength: maxLength, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, size: size }) }) }) }));
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
NumberField.displayName = 'NumberField';
|
|
54
54
|
|
|
55
55
|
export { NumberField };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FocusEvent,
|
|
1
|
+
import { FocusEvent, SyntheticEvent } from 'react';
|
|
2
2
|
import { ValidateFunction } from '../../elements/field-error/field-error';
|
|
3
3
|
interface TextFieldPropsBase {
|
|
4
4
|
autoComplete?: string;
|
|
@@ -19,7 +19,7 @@ interface TextFieldPropsBase {
|
|
|
19
19
|
minLength?: number;
|
|
20
20
|
name?: string;
|
|
21
21
|
onChange?: (value: string) => void;
|
|
22
|
-
onInput?:
|
|
22
|
+
onInput?: (e: SyntheticEvent<HTMLInputElement>) => void;
|
|
23
23
|
onKeyUp?: (e: React.KeyboardEvent) => void;
|
|
24
24
|
placeholder?: string;
|
|
25
25
|
role?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Autocomplete } from '../types';
|
|
2
2
|
export interface SearchInputProps {
|
|
3
3
|
autocomplete?: Autocomplete;
|
|
4
|
-
formRef: React.RefObject<HTMLFormElement>;
|
|
5
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
4
|
+
formRef: React.RefObject<HTMLFormElement | null>;
|
|
5
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
6
6
|
onCancel?: VoidFunction;
|
|
7
7
|
onSubmit?: VoidFunction;
|
|
8
8
|
placeholder?: string;
|
|
@@ -13,10 +13,10 @@ export type Autocomplete = AutocompleteApi<AutocompleteItem, React.BaseSynthetic
|
|
|
13
13
|
export type AutocompleteState = _AutocompleteState<AutocompleteItem>;
|
|
14
14
|
export type GlobalSearchContextValue = {
|
|
15
15
|
autocomplete: Autocomplete;
|
|
16
|
-
formRef: React.RefObject<HTMLFormElement>;
|
|
16
|
+
formRef: React.RefObject<HTMLFormElement | null>;
|
|
17
17
|
indexes: Indexes;
|
|
18
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
19
|
-
panelRef: React.RefObject<HTMLDivElement>;
|
|
18
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
19
|
+
panelRef: React.RefObject<HTMLDivElement | null>;
|
|
20
20
|
productsIndexName: string;
|
|
21
21
|
productsQuerySuggestionsIndexName: string;
|
|
22
22
|
searchClient: SearchClient;
|
|
@@ -13,4 +13,4 @@ export interface IntlContextType {
|
|
|
13
13
|
updateCultureCode?: UpdateCultureCode;
|
|
14
14
|
updateCurrencyCode?: UpdateCurrencyCode;
|
|
15
15
|
}
|
|
16
|
-
export declare const IntlContext:
|
|
16
|
+
export declare const IntlContext: import("react").Context<IntlContextType | undefined>;
|
|
@@ -2,5 +2,5 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
interface MissingTranslationProviderProps {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
}
|
|
5
|
-
export declare function MissingTranslationProvider({ children, }: MissingTranslationProviderProps): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
|
|
5
|
+
export declare function MissingTranslationProvider({ children, }: MissingTranslationProviderProps): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
6
6
|
export {};
|
|
@@ -3,7 +3,7 @@ export interface MenuListContextValue {
|
|
|
3
3
|
canCollapse: boolean;
|
|
4
4
|
registerCanCollapse: (canCollapse: boolean) => () => void;
|
|
5
5
|
}
|
|
6
|
-
export declare const MenuListContext:
|
|
6
|
+
export declare const MenuListContext: import("react").Context<MenuListContextValue | undefined>;
|
|
7
7
|
export declare function MenuListProvider({ children, }: {
|
|
8
8
|
children: ReactNode | ((args: {
|
|
9
9
|
canCollapse: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, Fragment
|
|
3
|
-
import {
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { CascadingComponent } from '../../collapsables/cascading-component/cascading-component.js';
|
|
6
6
|
import { CascadingComponentContainer } from '../../collapsables/cascading-component/cascading-component-container.js';
|
|
@@ -19,8 +19,8 @@ const focusableSelectors = [
|
|
|
19
19
|
'select:not([disabled])',
|
|
20
20
|
'[tabindex]:not([tabindex="-1"])',
|
|
21
21
|
].join(',');
|
|
22
|
-
const NavigationMenu =
|
|
23
|
-
const menuRef = useRef();
|
|
22
|
+
const NavigationMenu = ({ allowBack, back, children, className, header, id, isNarrow, linkItems, ref, scrollable, variant, }) => {
|
|
23
|
+
const menuRef = useRef(null);
|
|
24
24
|
const submenuRef = useRef(null);
|
|
25
25
|
const [selectedNavigationLink, setSelectedNavigationLink] = useState();
|
|
26
26
|
const [selectedNavigationVisible, setSelectedNavigationVisible] = useState(false);
|
|
@@ -35,9 +35,7 @@ const NavigationMenu = forwardRef(({ allowBack, back, children, className, heade
|
|
|
35
35
|
setSelectedNavigationVisible(Boolean(selectedNavigationLink));
|
|
36
36
|
}, [selectedNavigationLink]);
|
|
37
37
|
const t = useFormattedMessage();
|
|
38
|
-
return (jsxs(Fragment, { children: [jsxs("div", { ref: multiRef(ref, menuRef), className: clsx(styles['panel'], isNarrow && styles['narrow'], className), "data-test-selector": "panelNavigation", id: id, children: [jsx(MenuList, { back: back, header: header, scrollable: scrollable, variant: variant, children: linkItems?.map(link => link.type === 'link-group' && link.items.length > 0 ? (jsx(MenuListItem, { hasChildren: true, "aria-controls": `menu-${link.key}`, "data-test-selector": "panelNavigationItem", image: link.image, isSelected: selectedNavigationLink?.key === link.key, onClick: () => setSelectedNavigationLink(selectedNavigationLink?.key === link.key
|
|
39
|
-
? undefined
|
|
40
|
-
: link), children: link.label }, link.key)) : (jsx(MenuListItem, { "data-test-selector": "panelNavigationItem", href: link.href, image: link.image, openInNewTab: link.openInNewTab, children: link.label }, link.key))) }), children] }), jsx(CascadingComponent, { isVisible: selectedNavigationVisible, nodeRef: submenuRef, onEntered: onFocus(submenuRef), onExited: () => {
|
|
38
|
+
return (jsxs(Fragment, { children: [jsxs("div", { ref: multiRef(ref, menuRef), className: clsx(styles['panel'], isNarrow && styles['narrow'], className), "data-test-selector": "panelNavigation", id: id, children: [jsx(MenuList, { back: back, header: header, scrollable: scrollable, variant: variant, children: linkItems?.map(link => link.type === 'link-group' && link.items.length > 0 ? (jsx(MenuListItem, { hasChildren: true, "aria-controls": `menu-${link.key}`, "data-test-selector": "panelNavigationItem", image: link.image, isSelected: selectedNavigationLink?.key === link.key, onClick: () => setSelectedNavigationLink(selectedNavigationLink?.key === link.key ? undefined : link), children: link.label }, link.key)) : (jsx(MenuListItem, { "data-test-selector": "panelNavigationItem", href: link.href, image: link.image, openInNewTab: link.openInNewTab, children: link.label }, link.key))) }), children] }), jsx(CascadingComponent, { isVisible: selectedNavigationVisible, nodeRef: submenuRef, onEntered: onFocus(submenuRef), onExited: () => {
|
|
41
39
|
onFocus(menuRef);
|
|
42
40
|
setSelectedNavigationLink(undefined);
|
|
43
41
|
}, children: jsx(NavigationMenu, { ref: submenuRef, allowBack: allowBack, back: allowBack
|
|
@@ -57,7 +55,7 @@ const NavigationMenu = forwardRef(({ allowBack, back, children, className, heade
|
|
|
57
55
|
isNavigationLinkGroup(selectedNavigationLink)
|
|
58
56
|
? selectedNavigationLink.items
|
|
59
57
|
: [] }, selectedNavigationLink?.key) })] }));
|
|
60
|
-
}
|
|
58
|
+
};
|
|
61
59
|
NavigationMenu.displayName = 'NavigationMenu';
|
|
62
60
|
function PanelNavigation({ allowBack, children, className, 'data-test-selector': dataTestSelector, header, id, isNarrow, linkItems, variant, }) {
|
|
63
61
|
return (jsx("section", { className: clsx(styles['panel-navigation'], className), "data-test-selector": dataTestSelector, id: id, children: jsx(CascadingComponentContainer, { children: jsx("div", { className: clsx(styles['panels'], isNarrow && styles['narrow']), children: jsx(NavigationMenu, { allowBack: allowBack, className: children ? styles['top-panel'] : undefined, header: header, id: "panel-navigation-first-level", isNarrow: isNarrow, linkItems: linkItems, scrollable: children ? false : undefined, variant: variant, children: children }) }) }) }));
|
|
@@ -4,4 +4,4 @@ export interface AnnouncementProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
onDismiss?: (id: string) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const Announcement:
|
|
7
|
+
export declare const Announcement: import("react").ForwardRefExoticComponent<AnnouncementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -12,5 +12,5 @@ interface IntersectionObserverProps {
|
|
|
12
12
|
/** Callback when the intersection state changes */
|
|
13
13
|
onIntersectingChange?: (isIntersecting: boolean) => void;
|
|
14
14
|
}
|
|
15
|
-
export declare function IntersectionObserverComponent({ children, intersectionObserverInit, isDisabled, isPlaceholder, onIntersectingChange, }: IntersectionObserverProps): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
|
|
15
|
+
export declare function IntersectionObserverComponent({ children, intersectionObserverInit, isDisabled, isPlaceholder, onIntersectingChange, }: IntersectionObserverProps): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
16
16
|
export {};
|
|
@@ -18,7 +18,7 @@ import { ChangePasswordDialog } from '../../my-sonic/actions/change-password/cha
|
|
|
18
18
|
import { SignInForm } from '../components/sign-in-form/sign-in-form.js';
|
|
19
19
|
import { SignInPageLayout } from '../layouts/sign-in-page-layout/sign-in-page-layout.js';
|
|
20
20
|
|
|
21
|
-
function SignInPage({ returnUrl } = {}) {
|
|
21
|
+
function SignInPage({ onSuccess, returnUrl, } = {}) {
|
|
22
22
|
const paths = usePaths();
|
|
23
23
|
const { navigate } = useNavigate();
|
|
24
24
|
const [userName, setUserName] = useState();
|
|
@@ -48,9 +48,10 @@ function SignInPage({ returnUrl } = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
return 'Unexpected error';
|
|
50
50
|
}, [errorCreateGuest, errorSignIn, setChangePasswordDialogOpen]);
|
|
51
|
-
const onSignInSuccess = () => {
|
|
51
|
+
const onSignInSuccess = async () => {
|
|
52
52
|
setIsSuccess(true);
|
|
53
|
-
|
|
53
|
+
const overrideUrl = await onSuccess?.();
|
|
54
|
+
navigate(overrideUrl ?? returnUrl ?? paths.HOME, { reload: true });
|
|
54
55
|
};
|
|
55
56
|
const decodedReturnUrl = returnUrl
|
|
56
57
|
? decodeURIComponent(returnUrl).toLowerCase()
|
|
@@ -61,8 +62,10 @@ function SignInPage({ returnUrl } = {}) {
|
|
|
61
62
|
resetSignIn();
|
|
62
63
|
resetCreateGuest();
|
|
63
64
|
if (data.guestSignIn) {
|
|
64
|
-
if (session?.isGuest && session.isAuthenticated)
|
|
65
|
-
|
|
65
|
+
if (session?.isGuest && session.isAuthenticated) {
|
|
66
|
+
void onSignInSuccess();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
66
69
|
createGuest(void undefined, { onSuccess: onSignInSuccess });
|
|
67
70
|
}
|
|
68
71
|
else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
2
|
import Dropin from '@adyen/adyen-web/dist/types/components/Dropin';
|
|
3
3
|
import { CountryCode, CurrencyCode } from '../../../../intl/types';
|
|
4
4
|
import { AdyenPaymentModel } from '../../../../shared/api/storefront/model/storefront.model';
|
|
@@ -9,7 +9,7 @@ interface AdyenPaymentProps {
|
|
|
9
9
|
countryCode: CountryCode;
|
|
10
10
|
currencyCode: CurrencyCode;
|
|
11
11
|
customerId: string;
|
|
12
|
-
dropinRef:
|
|
12
|
+
dropinRef: RefObject<Dropin | null>;
|
|
13
13
|
environment: 'test' | 'live' | 'live-us' | 'live-au' | 'live-apse' | 'live-in';
|
|
14
14
|
isDisabled?: boolean;
|
|
15
15
|
onComplete: (result: AdyenPaymentModel) => Promise<void>;
|
|
@@ -34,7 +34,7 @@ function ShippingPage() {
|
|
|
34
34
|
? countries.find(country => country.id === cart.billTo?.country?.id)
|
|
35
35
|
: selectedCountry;
|
|
36
36
|
const { close: closeCurrencyWarningDialog, isOpen: currencyWarningDialogIsOpen, open: openCurrencyWarningDialog, toggle: toggleCurrencyWarningDialog, } = useDisclosure();
|
|
37
|
-
const formData = useRef();
|
|
37
|
+
const formData = useRef(undefined);
|
|
38
38
|
const { data: fulfillmentMethods, isLoading: isLoadingFulfillmentMethods } = useFetchFulfillmentMethodsForCurrentCart();
|
|
39
39
|
const { isLoading: isPatchingSession, mutate: patchSession } = usePatchSession();
|
|
40
40
|
const { error: errorPatchBillingAddress, isError, isLoading: isPatching, isSuccess, mutate: patchShippingDetails, } = usePatchShippingDetails();
|
|
@@ -5,4 +5,4 @@ export interface ProductListingPageContextType {
|
|
|
5
5
|
isError?: boolean;
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const ProductListingPageContext:
|
|
8
|
+
export declare const ProductListingPageContext: import("react").Context<ProductListingPageContextType>;
|
|
@@ -3,7 +3,7 @@ import { useRef, useCallback } from 'react';
|
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
5
|
function useDebouncedCallback(func, delay) {
|
|
6
|
-
const timeoutId = useRef();
|
|
6
|
+
const timeoutId = useRef(undefined);
|
|
7
7
|
const debounced = (...args) => new Promise(resolve => {
|
|
8
8
|
if (typeof window === 'undefined')
|
|
9
9
|
return resolve(func(...args));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LocalStorageContextValue } from './types';
|
|
2
|
-
export declare const LocalStorageContext:
|
|
2
|
+
export declare const LocalStorageContext: import("react").Context<LocalStorageContextValue | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { EventEmitter } from '../utils/event-emitter';
|
|
3
3
|
declare class State<T> extends EventEmitter<T | undefined> {
|
|
4
4
|
private _state;
|
|
@@ -10,12 +10,12 @@ declare class State<T> extends EventEmitter<T | undefined> {
|
|
|
10
10
|
}
|
|
11
11
|
declare class GlobalState {
|
|
12
12
|
private states;
|
|
13
|
-
constructor(states:
|
|
13
|
+
constructor(states: RefObject<Record<string | symbol, State<any>>>);
|
|
14
14
|
get<T>(key: string | symbol): State<T>;
|
|
15
15
|
get<T>(key: string | symbol, initialState: T | undefined): State<T>;
|
|
16
16
|
set<T>(key: string | symbol, state: State<T>): void;
|
|
17
17
|
}
|
|
18
|
-
export declare const GlobalStateProviderContext:
|
|
18
|
+
export declare const GlobalStateProviderContext: import("react").Context<GlobalState>;
|
|
19
19
|
interface GlobalStateProviderProps {
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RouteContextValue } from './types';
|
|
2
|
-
export declare const RouteContext:
|
|
2
|
+
export declare const RouteContext: import("react").Context<RouteContextValue | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useRouteLinkElement():
|
|
1
|
+
export declare function useRouteLinkElement(): import("react").ElementType<import("./types").RouteLinkElementProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavigateOptions } from './types';
|
|
2
2
|
export declare function useRouteLink(ignoreLocalePrefix?: boolean): {
|
|
3
|
-
RouteLinkElement:
|
|
3
|
+
RouteLinkElement: import("react").ElementType<import("./types").RouteLinkElementProps>;
|
|
4
4
|
getRouteLinkProps: (href: string, route?: NavigateOptions) => {
|
|
5
5
|
href: string;
|
|
6
6
|
onNavigate: () => void;
|
|
@@ -4,5 +4,5 @@ export interface WithRoutingProps {
|
|
|
4
4
|
href?: string;
|
|
5
5
|
route?: NavigateOptions;
|
|
6
6
|
}
|
|
7
|
-
export declare function withRouting(component: ElementType<RouteLinkElementProps>):
|
|
8
|
-
export declare const FallbackRouteLink:
|
|
7
|
+
export declare function withRouting(component: ElementType<RouteLinkElementProps>): import("react").FunctionComponent<RouteLinkElementProps>;
|
|
8
|
+
export declare const FallbackRouteLink: import("react").FunctionComponent<RouteLinkElementProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ForwardedRef,
|
|
2
|
-
export declare function multiRef<T extends HTMLElement>(...refs: (ForwardedRef<T> |
|
|
1
|
+
import { ForwardedRef, Ref, RefObject } from 'react';
|
|
2
|
+
export declare function multiRef<T extends HTMLElement>(...refs: (ForwardedRef<T> | RefObject<T | null | undefined> | null | undefined)[]): Ref<T>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
function multiRef(...refs) {
|
|
2
2
|
return function (el) {
|
|
3
3
|
for (const ref of refs) {
|
|
4
|
-
if (ref
|
|
4
|
+
if (!ref)
|
|
5
|
+
continue;
|
|
6
|
+
if (ref instanceof Function) {
|
|
5
7
|
ref(el);
|
|
6
8
|
}
|
|
7
|
-
else
|
|
9
|
+
else {
|
|
8
10
|
ref.current = el;
|
|
9
11
|
}
|
|
10
12
|
}
|
|
@@ -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 scrollIntoViewRef: (ref: RefObject<HTMLElement>, scrollOptions?: ScrollOptions) => void;
|
|
7
|
+
export declare const scrollIntoViewRef: (ref: RefObject<HTMLElement | null>, scrollOptions?: ScrollOptions) => void;
|
|
8
8
|
export {};
|
package/dist/toast/toast.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export interface ToastProps {
|
|
|
5
5
|
onClose?: (id: string) => void;
|
|
6
6
|
toastMessage: ToastMessage;
|
|
7
7
|
}
|
|
8
|
-
export declare const Toast:
|
|
8
|
+
export declare const Toast: import("react").ForwardRefExoticComponent<ToastProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/toast/use-toast.js
CHANGED
|
@@ -10,7 +10,10 @@ function useToast() {
|
|
|
10
10
|
return {
|
|
11
11
|
addToast(toastMessage, toastOptions) {
|
|
12
12
|
const id = createUUID();
|
|
13
|
-
toast(jsx(Toast, { ref: el =>
|
|
13
|
+
toast(jsx(Toast, { ref: el => {
|
|
14
|
+
if (el)
|
|
15
|
+
el.style.zIndex = (count.current++).toString();
|
|
16
|
+
}, id: id, onClose: id => toast.dismiss(id), toastMessage: toastMessage }), {
|
|
14
17
|
toastId: id,
|
|
15
18
|
...toastOptions,
|
|
16
19
|
});
|
|
@@ -15,9 +15,9 @@ export interface HeadingProps {
|
|
|
15
15
|
tag?: Tag;
|
|
16
16
|
uppercase?: boolean;
|
|
17
17
|
}
|
|
18
|
-
export declare function Heading({ bold, breakpoints, children, className, 'data-test-selector': dataTestSelector, id, italic, size, tag, uppercase, }: HeadingProps):
|
|
18
|
+
export declare function Heading({ bold, breakpoints, children, className, 'data-test-selector': dataTestSelector, id, italic, size, tag, uppercase, }: HeadingProps): import("react").ReactElement<{
|
|
19
19
|
className: string;
|
|
20
20
|
'data-test-selector': string;
|
|
21
21
|
id: string | undefined;
|
|
22
|
-
}, string |
|
|
22
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
23
23
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonic-equipment/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"@types/js-cookie": "3.0.6",
|
|
68
68
|
"@types/node": "24.3.0",
|
|
69
69
|
"@types/postcss-import": "14.0.3",
|
|
70
|
-
"@types/react": "
|
|
71
|
-
"@types/react-dom": "
|
|
70
|
+
"@types/react": "^19.0.0",
|
|
71
|
+
"@types/react-dom": "^19.0.0",
|
|
72
72
|
"@typescript-eslint/eslint-plugin": "8.41.0",
|
|
73
73
|
"@typescript-eslint/parser": "8.41.0",
|
|
74
74
|
"@typescript/lib-dom": "npm:typescript-partial-lib-dom@^1.1.0",
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"postcss-import": "16.1.1",
|
|
107
107
|
"postcss-nested": "7.0.2",
|
|
108
108
|
"prettier": "3.6.2",
|
|
109
|
-
"react": "
|
|
110
|
-
"react-dom": "
|
|
109
|
+
"react": "^19.1.0",
|
|
110
|
+
"react-dom": "^19.1.0",
|
|
111
111
|
"react-json-view": "1.21.3",
|
|
112
112
|
"rimraf": "6.0.1",
|
|
113
113
|
"rollup": "4.49.0",
|