@sonic-equipment/ui 0.0.32 → 0.0.34

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 (26) hide show
  1. package/dist/algolia/algolia-index-config.d.ts +5 -65
  2. package/dist/algolia/algolia-provider.d.ts +2 -1
  3. package/dist/algolia/algolia-query-string-routing.d.ts +2 -1
  4. package/dist/forms/select/select.d.ts +2 -1
  5. package/dist/global-search/global-search-provider/global-search-container.d.ts +2 -0
  6. package/dist/global-search/global-search-provider/use-search-disclosure.d.ts +2 -0
  7. package/dist/index.d.ts +18 -10
  8. package/dist/index.js +198 -135
  9. package/dist/intl/intl-context.d.ts +2 -0
  10. package/dist/intl/intl-provider.d.ts +2 -1
  11. package/dist/intl/translation-id.d.ts +1 -1
  12. package/dist/intl/use-format-message.d.ts +1 -1
  13. package/dist/intl/use-language-code.d.ts +2 -0
  14. package/dist/pages/{page-layout/page-layout.d.ts → page-container/page-container.d.ts} +1 -1
  15. package/dist/pages/{page-layout/page-layout.stories.d.ts → page-container/page-container.stories.d.ts} +2 -2
  16. package/dist/pages/product-listing-page/product-listing-page.d.ts +3 -3
  17. package/dist/pages/product-listing-page/product-listing-page.stories.d.ts +3 -1
  18. package/dist/pages/product-listing-page/use-fetch-product-listing-page/use-fetch-product-listing-page-data.d.ts +5 -1
  19. package/dist/pages/product-listing-page/use-fetch-product-listing-page/use-fetch-product-listing-page-data.stories.d.ts +3 -1
  20. package/dist/shared/hooks/use-breakpoint.d.ts +2 -2
  21. package/dist/shared/hooks/use-is-breakpoint.d.ts +2 -0
  22. package/dist/shared/utils/environment.d.ts +1 -1
  23. package/dist/sidebar/sidebar-context.d.ts +2 -0
  24. package/dist/sidebar/sidebar-provider.d.ts +1 -0
  25. package/dist/styles.css +81 -41
  26. package/package.json +21 -21
@@ -1,3 +1,5 @@
1
+ type Environment = string;
2
+ type LanguageCode = string;
1
3
  export interface Indexes {
2
4
  default: string;
3
5
  sort: {
@@ -5,68 +7,6 @@ export interface Indexes {
5
7
  name: string;
6
8
  }[];
7
9
  }
8
- export declare const algoliaIndexesPerEnvironment: {
9
- readonly production: {
10
- readonly default: "prod_sonic_products_en";
11
- readonly sort: [{
12
- readonly index: "prod_sonic_products_en";
13
- readonly name: "relevance";
14
- }, {
15
- readonly index: "prod_sonic_products_en_is-new_desc";
16
- readonly name: "newest";
17
- }, {
18
- readonly index: "prod_sonic_products_en_price_asc";
19
- readonly name: "price_asc";
20
- }, {
21
- readonly index: "prod_sonic_products_en_price_desc";
22
- readonly name: "price_desc";
23
- }];
24
- };
25
- readonly sandbox: {
26
- readonly default: "dev_sonic_products_en";
27
- readonly sort: [{
28
- readonly index: "dev_sonic_products_en";
29
- readonly name: "relevance";
30
- }, {
31
- readonly index: "dev_sonic_products_en_is-new_desc";
32
- readonly name: "newest";
33
- }, {
34
- readonly index: "dev_sonic_products_en_price_asc";
35
- readonly name: "price_asc";
36
- }, {
37
- readonly index: "dev_sonic_products_en_price_desc";
38
- readonly name: "price_desc";
39
- }];
40
- };
41
- };
42
- export declare const currentIndexes: {
43
- readonly default: "prod_sonic_products_en";
44
- readonly sort: [{
45
- readonly index: "prod_sonic_products_en";
46
- readonly name: "relevance";
47
- }, {
48
- readonly index: "prod_sonic_products_en_is-new_desc";
49
- readonly name: "newest";
50
- }, {
51
- readonly index: "prod_sonic_products_en_price_asc";
52
- readonly name: "price_asc";
53
- }, {
54
- readonly index: "prod_sonic_products_en_price_desc";
55
- readonly name: "price_desc";
56
- }];
57
- } | {
58
- readonly default: "dev_sonic_products_en";
59
- readonly sort: [{
60
- readonly index: "dev_sonic_products_en";
61
- readonly name: "relevance";
62
- }, {
63
- readonly index: "dev_sonic_products_en_is-new_desc";
64
- readonly name: "newest";
65
- }, {
66
- readonly index: "dev_sonic_products_en_price_asc";
67
- readonly name: "price_asc";
68
- }, {
69
- readonly index: "dev_sonic_products_en_price_desc";
70
- readonly name: "price_desc";
71
- }];
72
- } | undefined;
10
+ export declare const algoliaIndexesPerEnvironment: Record<Environment, Indexes>;
11
+ export declare const getAlgoliaIndex: (environment: Environment, languageCode: LanguageCode) => Indexes;
12
+ export {};
@@ -10,11 +10,12 @@ interface AlgoliaContextType {
10
10
  interface AlgoliaProviderProps {
11
11
  category: string[] | undefined;
12
12
  children: ReactNode;
13
+ languageCode: string;
13
14
  offlineSearchClient?: SearchClient;
14
15
  online?: boolean;
15
16
  routing?: boolean | RouterProps<UiState, UiState> | undefined;
16
17
  searchClient: SearchClient;
17
18
  }
18
- export declare function AlgoliaProvider({ category, children, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function AlgoliaProvider({ category, children, languageCode, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): import("react/jsx-runtime").JSX.Element | null;
19
20
  export declare function useAlgolia(): AlgoliaContextType;
20
21
  export {};
@@ -1,3 +1,4 @@
1
1
  import { RouterProps } from 'instantsearch.js/es/middlewares/createRouterMiddleware';
2
2
  import { UiState } from 'instantsearch.js/es/types';
3
- export declare const queryStringRouting: RouterProps<UiState, UiState>;
3
+ import { Indexes } from './algolia-index-config';
4
+ export declare function createQueryStringRouting(algoliaIndex: Indexes): RouterProps<UiState, UiState>;
@@ -5,5 +5,6 @@ export interface SelectProps<T> {
5
5
  options: T;
6
6
  selectedOption?: keyof T;
7
7
  showLabel?: boolean;
8
+ size?: 'sm' | 'md';
8
9
  }
9
- export declare function Select<T extends object>({ isDisabled, label, onChange, options, selectedOption, showLabel, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function Select<T extends object>({ isDisabled, label, onChange, options, selectedOption, showLabel, size, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,7 @@
1
1
  export declare const GlobalSearchDisclosureContext: React.Context<{
2
+ close: VoidFunction;
2
3
  isOpen: boolean;
4
+ open: VoidFunction;
3
5
  toggle: VoidFunction;
4
6
  } | null>;
5
7
  export declare function GlobalSearchContainer({ children, }: {
@@ -1,4 +1,6 @@
1
1
  export declare const useGlobalSearchDisclosure: () => {
2
+ close: VoidFunction;
2
3
  isOpen: boolean;
4
+ open: VoidFunction;
3
5
  toggle: VoidFunction;
4
6
  };
package/dist/index.d.ts CHANGED
@@ -437,8 +437,9 @@ interface SelectProps<T> {
437
437
  options: T;
438
438
  selectedOption?: keyof T;
439
439
  showLabel?: boolean;
440
+ size?: 'sm' | 'md';
440
441
  }
441
- declare function Select<T extends object>({ isDisabled, label, onChange, options, selectedOption, showLabel, }: SelectProps<T>): react_jsx_runtime.JSX.Element;
442
+ declare function Select<T extends object>({ isDisabled, label, onChange, options, selectedOption, showLabel, size, }: SelectProps<T>): react_jsx_runtime.JSX.Element;
442
443
 
443
444
  interface TextFieldProps {
444
445
  autoFocus?: boolean;
@@ -485,7 +486,7 @@ declare function FavoriteOutlinedIcon(props: React.SVGProps<SVGSVGElement>): rea
485
486
 
486
487
  declare function HashedOutlinedIcon(props: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
487
488
 
488
- type TranslationId = 'Chosen filters' | 'Clear' | 'Clear filters' | 'Excl. VAT' | 'Hide filters' | 'Incl. VAT' | 'Show' | 'Show all' | 'Show filters' | 'Show less' | 'Sort by' | 'Submit' | 'articles' | 'article' | 'of' | 'sort.relevance' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc';
489
+ type TranslationId = 'Chosen filters' | 'Clear' | 'Clear filters' | 'Excl. VAT' | 'Hide filters' | 'Incl. VAT' | 'Show' | 'Show all' | 'Show filters' | 'Show less' | 'Sort by' | 'Submit' | 'articles' | 'article' | 'of' | 'sort.relevance' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'tag.new' | 'facet.weight' | 'facet.height';
489
490
 
490
491
  interface FormattedMessageProps {
491
492
  fallbackValue?: string;
@@ -500,15 +501,16 @@ type FormatMessageFunction = (id: string, ...replacementValues: readonly string[
500
501
  interface IntlProviderProps {
501
502
  children: React.ReactNode;
502
503
  formatMessage: FormatMessageFunction;
504
+ languageCode: string;
503
505
  }
504
- declare function IntlProvider({ children, formatMessage }: IntlProviderProps): react_jsx_runtime.JSX.Element;
506
+ declare function IntlProvider({ children, formatMessage, languageCode: _languageCode, }: IntlProviderProps): react_jsx_runtime.JSX.Element;
505
507
 
506
508
  type FormattedMessageFunction = (id: TranslationId, options?: {
507
509
  fallbackValue?: string;
508
510
  optional?: boolean;
509
511
  replacementValues?: Record<string, string>;
510
512
  }) => string;
511
- declare const useFormattedMessage: () => FormattedMessageFunction;
513
+ declare function useFormattedMessage(): FormattedMessageFunction;
512
514
 
513
515
  interface ProductOverviewGridProps {
514
516
  children?: ReactNode;
@@ -518,7 +520,7 @@ declare function ProductOverviewGrid({ children }: ProductOverviewGridProps): re
518
520
  type ImageProps = ImageSource;
519
521
  declare function Image({ alt, className, fallbackSrc, fit, height, loading, sizes: sizesProp, src, srcSet: srcSetProp, title, width, }: ImageProps): react_jsx_runtime.JSX.Element;
520
522
 
521
- declare function PageLayout({ children, className, }: {
523
+ declare function PageContainer({ children, className, }: {
522
524
  children: ReactNode;
523
525
  className?: string;
524
526
  }): react_jsx_runtime.JSX.Element;
@@ -539,12 +541,12 @@ interface Filters {
539
541
  }[];
540
542
  };
541
543
  }
542
- type ProductListingPageProps = {
544
+ interface ProductListingPageProps {
543
545
  bffUrl: string;
544
546
  pageUrl: string;
545
547
  searchClient?: SearchClient;
546
- };
547
- declare function ProductListingPage({ bffUrl, pageUrl, searchClient, }: ProductListingPageProps): react_jsx_runtime.JSX.Element;
548
+ }
549
+ declare function ProductListingPage({ bffUrl, pageUrl, searchClient, }: ProductListingPageProps): react_jsx_runtime.JSX.Element | null;
548
550
 
549
551
  interface SidebarProps {
550
552
  children: React.ReactNode;
@@ -554,6 +556,7 @@ declare function Sidebar({ children }: SidebarProps): react_jsx_runtime.JSX.Elem
554
556
  interface SidebarProviderProps {
555
557
  children: ReactElement;
556
558
  }
559
+ declare function SidebarDetectBreakpoint(): react_jsx_runtime.JSX.Element | null;
557
560
  declare function SidebarProvider({ children }: SidebarProviderProps): react_jsx_runtime.JSX.Element;
558
561
 
559
562
  declare function AlgoliaCategories(): react_jsx_runtime.JSX.Element;
@@ -600,12 +603,13 @@ interface AlgoliaContextType {
600
603
  interface AlgoliaProviderProps {
601
604
  category: string[] | undefined;
602
605
  children: ReactNode;
606
+ languageCode: string;
603
607
  offlineSearchClient?: SearchClient;
604
608
  online?: boolean;
605
609
  routing?: boolean | RouterProps<UiState, UiState> | undefined;
606
610
  searchClient: SearchClient;
607
611
  }
608
- declare function AlgoliaProvider({ category, children, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): react_jsx_runtime.JSX.Element;
612
+ declare function AlgoliaProvider({ category, children, languageCode, offlineSearchClient, online: _online, routing, searchClient, }: AlgoliaProviderProps): react_jsx_runtime.JSX.Element | null;
609
613
  declare function useAlgolia(): AlgoliaContextType;
610
614
 
611
615
  declare function AlgoliaResultsCount(): string | null;
@@ -627,7 +631,9 @@ interface GlobalSearchProps {
627
631
  declare function GlobalSearch({ children, searchClient }: GlobalSearchProps): react_jsx_runtime.JSX.Element;
628
632
 
629
633
  declare const GlobalSearchDisclosureContext: React.Context<{
634
+ close: VoidFunction;
630
635
  isOpen: boolean;
636
+ open: VoidFunction;
631
637
  toggle: VoidFunction;
632
638
  } | null>;
633
639
  declare function GlobalSearchContainer({ children, }: {
@@ -769,8 +775,10 @@ declare function useAlgoliaSearch(): {
769
775
  };
770
776
 
771
777
  declare const useGlobalSearchDisclosure: () => {
778
+ close: VoidFunction;
772
779
  isOpen: boolean;
780
+ open: VoidFunction;
773
781
  toggle: VoidFunction;
774
782
  };
775
783
 
776
- export { Accordion, AddToCartButton, AlgoliaCategories, AlgoliaFilterPanel, type AlgoliaFilterPanelProps, AlgoliaFilterSection, AlgoliaMultiSelectFilterSection, AlgoliaPagination, AlgoliaProvider, AlgoliaResultsCount, AlgoliaSortBy, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type Cart, CartFilledIcon, type CartLine, CartOutlinedIcon, CartProvider, CategoryCarousel, type CategoryCarouselProps, Checkbox, type CheckboxProps$1 as CheckboxProps, ColorCheckbox, type ColorCheckboxProps, ConnectedAddToCartButton, ConnectedBreadcrumb, DehashedOutlinedIcon, FavoriteButton, type FavoriteButtonProps, FavoriteFilledIcon, FavoriteOutlinedIcon, FavoriteProvider, type FilterOption, type Filters, FormattedMessage, type FormattedMessageFunction, type FormattedMessageProps, GlobalSearch, GlobalSearchContainer, GlobalSearchDisclosureContext, GlobalStateProvider, GlobalStateProviderContext, HashedOutlinedIcon, IconButton, type IconButtonProps, Image, IntlProvider, LeftArrowFilledIcon, LinkButton, type LinkButtonProps, MultiSelect, type MultiSelectProps, NumberField, type NumberFieldSize, Page, PageLayout, type PageProps, ProductCard, type ProductCardProps, type ProductHit$3 as ProductHit, ProductListingPage, type ProductListingPageProps, ProductOverviewGrid, type ProductOverviewGridProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, type RefinementListItem, RightArrowFilledIcon, Select, type SelectProps, ShowAll, type ShowAllProps, Sidebar, type SidebarProps, SidebarProvider, TextAlignedArrowIcon, TextField, createSonicSearchClient, useAlgolia, useAlgoliaSearch, useBreakpoint, useCart, useDebouncedCallback, useDisclosure, useFavorite, useFormattedMessage, useGlobalSearchDisclosure, useGlobalState, useProductCartLine, useScrollLock };
784
+ export { Accordion, AddToCartButton, AlgoliaCategories, AlgoliaFilterPanel, type AlgoliaFilterPanelProps, AlgoliaFilterSection, AlgoliaMultiSelectFilterSection, AlgoliaPagination, AlgoliaProvider, AlgoliaResultsCount, AlgoliaSortBy, Breadcrumb, type BreadcrumbProps, type Breakpoint$1 as Breakpoint, Button, type ButtonProps, type Cart, CartFilledIcon, type CartLine, CartOutlinedIcon, CartProvider, CategoryCarousel, type CategoryCarouselProps, Checkbox, type CheckboxProps$1 as CheckboxProps, ColorCheckbox, type ColorCheckboxProps, ConnectedAddToCartButton, ConnectedBreadcrumb, DehashedOutlinedIcon, FavoriteButton, type FavoriteButtonProps, FavoriteFilledIcon, FavoriteOutlinedIcon, FavoriteProvider, type FilterOption, type Filters, FormattedMessage, type FormattedMessageFunction, type FormattedMessageProps, GlobalSearch, GlobalSearchContainer, GlobalSearchDisclosureContext, GlobalStateProvider, GlobalStateProviderContext, HashedOutlinedIcon, IconButton, type IconButtonProps, Image, IntlProvider, LeftArrowFilledIcon, LinkButton, type LinkButtonProps, MultiSelect, type MultiSelectProps, NumberField, type NumberFieldSize, Page, PageContainer, type PageProps, ProductCard, type ProductCardProps, type ProductHit$3 as ProductHit, ProductListingPage, type ProductListingPageProps, ProductOverviewGrid, type ProductOverviewGridProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, type RefinementListItem, RightArrowFilledIcon, Select, type SelectProps, ShowAll, type ShowAllProps, Sidebar, SidebarDetectBreakpoint, type SidebarProps, SidebarProvider, TextAlignedArrowIcon, TextField, breakpoints, createSonicSearchClient, useAlgolia, useAlgoliaSearch, useBreakpoint, useCart, useDebouncedCallback, useDisclosure, useFavorite, useFormattedMessage, useGlobalSearchDisclosure, useGlobalState, useProductCartLine, useScrollLock };