@sonic-equipment/ui 169.0.0 → 171.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.
Files changed (113) hide show
  1. package/dist/algolia/algolia-active-categories.js +2 -2
  2. package/dist/algolia/algolia-query-string-routing.js +2 -2
  3. package/dist/breadcrumbs/breadcrumb.js +4 -4
  4. package/dist/buttons/button/button.d.ts +5 -2
  5. package/dist/buttons/button/button.js +19 -11
  6. package/dist/buttons/icon-button/icon-button.d.ts +7 -3
  7. package/dist/buttons/icon-button/icon-button.js +9 -5
  8. package/dist/buttons/link/link.d.ts +2 -0
  9. package/dist/buttons/link/link.js +10 -9
  10. package/dist/cards/category-card/category-card.d.ts +3 -1
  11. package/dist/cards/category-card/category-card.js +4 -4
  12. package/dist/cards/orderline-card/orderline-card.js +2 -2
  13. package/dist/cards/product-card/connected-product-card.d.ts +2 -0
  14. package/dist/cards/product-card/product-card.d.ts +3 -1
  15. package/dist/cards/product-card/product-card.js +3 -3
  16. package/dist/carousel/carousel.js +3 -3
  17. package/dist/carousel/usp-carousel/usp-carousel.js +1 -1
  18. package/dist/collapsables/show-all/show-all.js +2 -2
  19. package/dist/drawer/drawer.d.ts +2 -1
  20. package/dist/drawer/drawer.js +2 -2
  21. package/dist/drawer/use-drawer.js +1 -0
  22. package/dist/exports.d.ts +3 -3
  23. package/dist/filters/active-filters/active-filters.js +2 -2
  24. package/dist/footer/footer.js +6 -6
  25. package/dist/forms/select-field/select-field.js +1 -0
  26. package/dist/global-search/search-result-panel/sections/no-search.js +2 -2
  27. package/dist/global-search/search-result-panel/sections/with-results.js +5 -6
  28. package/dist/header/buttons/account/connected-account-button.js +2 -2
  29. package/dist/header/buttons/cart/connected-cart-button.js +2 -2
  30. package/dist/header/buttons/favorites/connected-favorites-button.js +2 -2
  31. package/dist/header/buttons/search/search-button.js +2 -2
  32. package/dist/header/drawers/desktop-navigation-drawer.js +2 -1
  33. package/dist/header/drawers/mobile-navigation-drawer.js +2 -1
  34. package/dist/header/drawers/search-drawer.js +1 -1
  35. package/dist/header/header.js +1 -1
  36. package/dist/header/link-list/navigation-link-list.d.ts +2 -1
  37. package/dist/header/link-list/navigation-link-list.js +6 -5
  38. package/dist/header/sonic-logo/sonic-logo.d.ts +2 -1
  39. package/dist/header/sonic-logo/sonic-logo.js +4 -4
  40. package/dist/index.js +3 -3
  41. package/dist/lists/menu-list/menu-list-back-button.d.ts +2 -1
  42. package/dist/lists/menu-list/menu-list-back-button.js +2 -2
  43. package/dist/lists/menu-list/menu-list-header.d.ts +2 -1
  44. package/dist/lists/menu-list/menu-list-header.js +3 -3
  45. package/dist/lists/menu-list/menu-list-item.d.ts +2 -1
  46. package/dist/lists/menu-list/menu-list-item.js +3 -3
  47. package/dist/lists/menu-list/menu-list.js +1 -1
  48. package/dist/media/image-lightbox/image-lightbox.js +3 -3
  49. package/dist/modals/signin/sign-in-dialog.js +2 -2
  50. package/dist/navigation/cart-icon/cart-icon.js +1 -1
  51. package/dist/navigation/mobile-navigation/mobile-navigation.js +1 -1
  52. package/dist/navigation/panel-navigation/panel-navigation.d.ts +2 -1
  53. package/dist/navigation/panel-navigation/panel-navigation.js +4 -4
  54. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/modules/free-mode.js +1 -1
  55. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/modules/thumbs.js +1 -1
  56. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/shared/swiper-core.js +30 -15
  57. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/shared/update-on-virtual-data.js +1 -0
  58. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/shared/update-swiper.js +4 -2
  59. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/shared/utils.js +13 -1
  60. package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/swiper-react.js +2 -2
  61. package/dist/notifications/announcements/announcement-list.js +1 -1
  62. package/dist/notifications/announcements/announcement.js +3 -3
  63. package/dist/pages/account/components/sign-in-form/sign-in-form.js +1 -2
  64. package/dist/pages/account/create-account-page/create-account-page.js +2 -2
  65. package/dist/pages/checkout/cart-page/cart-page.js +4 -6
  66. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +3 -3
  67. package/dist/pages/checkout/payment-page/hooks/use-get-adyen-redirect-result.js +1 -0
  68. package/dist/pages/checkout/shipping-page/components/currency-change-dialog.js +2 -2
  69. package/dist/pages/checkout/shipping-page/components/readonly-address.js +3 -3
  70. package/dist/pages/product/components/product-overview.d.ts +2 -0
  71. package/dist/pages/product/components/product-overview.js +1 -1
  72. package/dist/pages/product/product-listing-page/no-results/no-results.js +2 -2
  73. package/dist/pages/product/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +1 -1
  74. package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +1 -1
  75. package/dist/promos/promo-banner/promo-banner.js +2 -2
  76. package/dist/promos/promo-card/promo-card.js +2 -2
  77. package/dist/shared/api/storefront/hooks/cart/use-fetch-cart-by-id.d.ts +1 -1
  78. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.d.ts +1 -1
  79. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.d.ts +1 -1
  80. package/dist/shared/hooks/use-debounced-callback.js +1 -0
  81. package/dist/shared/hooks/use-enable-mobile-zoom.js +1 -0
  82. package/dist/shared/hooks/use-intersection-observer.js +1 -0
  83. package/dist/shared/hooks/use-mutation-observer.js +1 -0
  84. package/dist/shared/hooks/use-resize-observer.js +1 -0
  85. package/dist/shared/routing/route-provider.d.ts +4 -3
  86. package/dist/shared/routing/route-provider.js +4 -2
  87. package/dist/shared/routing/route-utils.d.ts +4 -0
  88. package/dist/shared/routing/route-utils.js +8 -0
  89. package/dist/shared/routing/types.d.ts +8 -0
  90. package/dist/shared/routing/use-route-link-element.d.ts +1 -0
  91. package/dist/shared/routing/use-route-link-element.js +11 -0
  92. package/dist/shared/routing/use-route-link.d.ts +8 -0
  93. package/dist/shared/routing/use-route-link.js +24 -0
  94. package/dist/shared/routing/with-routing.d.ts +3 -6
  95. package/dist/shared/routing/with-routing.js +6 -6
  96. package/dist/shared/utils/price.d.ts +1 -1
  97. package/dist/styles.css +2 -2
  98. package/package.json +45 -45
  99. package/dist/shared/routing/route-button.d.ts +0 -1
  100. package/dist/shared/routing/route-button.js +0 -7
  101. package/dist/shared/routing/route-icon-button.d.ts +0 -1
  102. package/dist/shared/routing/route-icon-button.js +0 -7
  103. package/dist/shared/routing/route-link.d.ts +0 -1
  104. package/dist/shared/routing/route-link.js +0 -7
  105. /package/dist/node_modules/.pnpm/{instantsearch.js@4.78.0_algoliasearch@4.24.0 → instantsearch.js@4.78.3_algoliasearch@4.24.0}/node_modules/instantsearch.js/es/lib/routers/history.js +0 -0
  106. /package/dist/node_modules/.pnpm/{instantsearch.js@4.78.0_algoliasearch@4.24.0 → instantsearch.js@4.78.3_algoliasearch@4.24.0}/node_modules/instantsearch.js/es/lib/stateMappings/simple.js +0 -0
  107. /package/dist/node_modules/.pnpm/{instantsearch.js@4.78.0_algoliasearch@4.24.0 → instantsearch.js@4.78.3_algoliasearch@4.24.0}/node_modules/instantsearch.js/es/lib/utils/documentation.js +0 -0
  108. /package/dist/node_modules/.pnpm/{instantsearch.js@4.78.0_algoliasearch@4.24.0 → instantsearch.js@4.78.3_algoliasearch@4.24.0}/node_modules/instantsearch.js/es/lib/utils/logger.js +0 -0
  109. /package/dist/node_modules/.pnpm/{instantsearch.js@4.78.0_algoliasearch@4.24.0 → instantsearch.js@4.78.3_algoliasearch@4.24.0}/node_modules/instantsearch.js/es/lib/utils/noop.js +0 -0
  110. /package/dist/node_modules/.pnpm/{instantsearch.js@4.78.0_algoliasearch@4.24.0 → instantsearch.js@4.78.3_algoliasearch@4.24.0}/node_modules/instantsearch.js/es/lib/utils/safelyRunOnBrowser.js +0 -0
  111. /package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/modules/navigation.js +0 -0
  112. /package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/shared/create-element-if-not-defined.js +0 -0
  113. /package/dist/node_modules/.pnpm/{swiper@11.2.5 → swiper@11.2.8}/node_modules/swiper/shared/ssr-window.esm.js +0 -0
@@ -0,0 +1,8 @@
1
+ function buildHref({ basePath, href, }) {
2
+ if (basePath && href.startsWith('/') && !href.startsWith(`/${basePath}`)) {
3
+ return `/${basePath}${href}`;
4
+ }
5
+ return href;
6
+ }
7
+
8
+ export { buildHref };
@@ -1,10 +1,18 @@
1
+ import { ElementType } from 'react';
1
2
  export interface RouteContext {
3
+ Link?: ElementType<RouteLinkElementProps>;
2
4
  basePath?: string;
3
5
  navigate: NavigateFunction;
4
6
  }
7
+ export interface RouteLinkElementProps extends React.HTMLProps<HTMLAnchorElement> {
8
+ href: string;
9
+ onNavigate: () => void;
10
+ route?: NavigateOptions;
11
+ }
5
12
  export interface NavigateOptions {
6
13
  prefetch?: boolean;
7
14
  reload?: boolean;
8
15
  replace?: boolean;
16
+ scroll?: boolean;
9
17
  }
10
18
  export type NavigateFunction = (href: string, options?: NavigateOptions) => void;
@@ -0,0 +1 @@
1
+ export declare function useRouteLinkElement(): React.ElementType<import("./types").RouteLinkElementProps> | undefined;
@@ -0,0 +1,11 @@
1
+ import { useGlobalState } from '../providers/global-state-provider.js';
2
+
3
+ function useRouteLinkElement() {
4
+ const [state] = useGlobalState('routing');
5
+ if (!state) {
6
+ throw new Error('RouteProvider not found');
7
+ }
8
+ return state.Link;
9
+ }
10
+
11
+ export { useRouteLinkElement };
@@ -0,0 +1,8 @@
1
+ import { NavigateOptions } from './types';
2
+ export declare function useRouteLink(): {
3
+ RouteLinkElement: React.ElementType<import("./types").RouteLinkElementProps> | undefined;
4
+ getRouteLinkProps: (href: string, route?: NavigateOptions) => {
5
+ href: string;
6
+ onNavigate: () => void;
7
+ };
8
+ };
@@ -0,0 +1,24 @@
1
+ import { useCallback } from 'react';
2
+ import { buildHref } from './route-utils.js';
3
+ import { useBasePath } from './use-base-path.js';
4
+ import { useOnNavigate } from './use-on-navigate.js';
5
+ import { useRouteLinkElement } from './use-route-link-element.js';
6
+
7
+ function useRouteLink() {
8
+ const basePath = useBasePath();
9
+ const RouteLinkElement = useRouteLinkElement();
10
+ const triggerCallbacks = useOnNavigate();
11
+ const getRouteLinkProps = useCallback((href, route) => {
12
+ href = buildHref({ basePath, href });
13
+ return {
14
+ href,
15
+ onNavigate: () => triggerCallbacks(href, route),
16
+ };
17
+ }, [basePath, triggerCallbacks]);
18
+ return {
19
+ RouteLinkElement,
20
+ getRouteLinkProps,
21
+ };
22
+ }
23
+
24
+ export { useRouteLink };
@@ -1,10 +1,7 @@
1
- import { ComponentProps, ComponentType, MouseEventHandler } from 'react';
2
- import { NavigateOptions } from './types';
1
+ import { ElementType } from 'react';
2
+ import { NavigateOptions, RouteLinkElementProps } from './types';
3
3
  export interface WithRoutingProps {
4
4
  href?: string;
5
5
  route?: NavigateOptions;
6
6
  }
7
- export declare function withRouting<TComponent extends ComponentType<TProps>, TProps extends {
8
- children: React.ReactNode;
9
- onClick?: MouseEventHandler<TElement> | undefined;
10
- }, TElement extends HTMLElement>(component: TComponent): React.ForwardRefExoticComponent<React.PropsWithoutRef<ComponentProps<TComponent> & WithRoutingProps> & React.RefAttributes<HTMLElement>>;
7
+ export declare function withRouting(component: ElementType<RouteLinkElementProps>): React.FunctionComponent<RouteLinkElementProps>;
@@ -1,9 +1,9 @@
1
- import { forwardRef, createElement } from 'react';
1
+ import { createElement } from 'react';
2
2
  import { useBasePath } from './use-base-path.js';
3
3
  import { useNavigate } from './use-navigate.js';
4
4
 
5
5
  function withRouting(component) {
6
- const Component = forwardRef(({ href, onClick, route, ...rest }, ref) => {
6
+ const Component = ({ href, onClick, route, ...rest }) => {
7
7
  const { navigate } = useNavigate();
8
8
  const basePath = useBasePath();
9
9
  if (basePath &&
@@ -15,7 +15,7 @@ function withRouting(component) {
15
15
  const props = {
16
16
  ...rest,
17
17
  href,
18
- onClick(e) {
18
+ onClick: (e) => {
19
19
  onClick?.(e);
20
20
  if (!href)
21
21
  return;
@@ -28,11 +28,11 @@ function withRouting(component) {
28
28
  }
29
29
  return navigate(href, route);
30
30
  },
31
- ref,
31
+ route,
32
32
  };
33
33
  return createElement(component, props);
34
- });
35
- Component.displayName = `WithRouting(${component.displayName || component.name})`;
34
+ };
35
+ Component.displayName = `WithRouting(${component.toString()})`;
36
36
  return Component;
37
37
  }
38
38