@sonic-equipment/ui 0.0.28 → 0.0.30
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-index-config.d.ts +72 -0
- package/dist/cards/product-card/product-card.d.ts +2 -2
- package/dist/cards/product-card/product-card.stories.d.ts +1 -1
- package/dist/display/product-price/product-price.d.ts +4 -4
- package/dist/display/product-price/product-price.stories.d.ts +1 -0
- package/dist/global-search/global-search-provider/global-search-provider.d.ts +8 -0
- package/dist/global-search/global-search-provider/use-global-search.d.ts +28 -0
- package/dist/{search/global-search → global-search}/global-search.d.ts +0 -7
- package/dist/{search/global-search → global-search}/global-search.stories.d.ts +3 -0
- package/dist/{search/global-search → global-search}/plugins/products-plugin.d.ts +2 -16
- package/dist/global-search/search-input/connected-search-input.d.ts +1 -0
- package/dist/{search → global-search}/search-input/search-input.d.ts +1 -1
- package/dist/global-search/search-result-panel/panel-content.d.ts +10 -0
- package/dist/global-search/search-result-panel/search-result-panel.d.ts +9 -0
- package/dist/global-search/search-root/search-root.d.ts +1 -0
- package/dist/{search/global-search → global-search}/types.d.ts +1 -0
- package/dist/index.d.ts +57 -13
- package/dist/index.js +721 -134
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/overlay-background/overlay-background.d.ts +7 -0
- package/dist/shared/types/price.d.ts +3 -3
- package/dist/shared/types/product.d.ts +34 -2
- package/dist/shared/utils/environment.d.ts +3 -0
- package/dist/styles.css +155 -3
- package/package.json +3 -1
- package/dist/pages/product-listing-page/types.d.ts +0 -34
- package/dist/search/global-search/clear-icon.d.ts +0 -2
- package/dist/search/global-search/search-icon.d.ts +0 -2
- /package/dist/{search/global-search → global-search}/plugins/categories-plugin.d.ts +0 -0
- /package/dist/{search/global-search → global-search}/plugins/popular-categories-plugin.d.ts +0 -0
- /package/dist/{search/global-search → global-search}/plugins/popular-searches-plugin.d.ts +0 -0
- /package/dist/{search/global-search → global-search}/plugins/query-suggestions-plugin.d.ts +0 -0
- /package/dist/{search/global-search → global-search}/plugins/quick-access-plugin.d.ts +0 -0
- /package/dist/{search/global-search → global-search}/plugins/recent-searches-plugin.d.ts +0 -0
- /package/dist/{search/global-search → global-search/search-highlight}/highlight.d.ts +0 -0
- /package/dist/{search → global-search}/search-input/search-input.stories.d.ts +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface Indexes {
|
|
2
|
+
default: string;
|
|
3
|
+
sort: {
|
|
4
|
+
index: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}[];
|
|
7
|
+
}
|
|
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;
|
|
@@ -12,7 +12,7 @@ export interface ProductCardProps {
|
|
|
12
12
|
onPress?: (e: PressEvent) => void;
|
|
13
13
|
price: ProductPriceType;
|
|
14
14
|
sku: string;
|
|
15
|
-
|
|
15
|
+
tags?: string[];
|
|
16
16
|
title: string;
|
|
17
17
|
}
|
|
18
|
-
export declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image: { alt, fit, src, title: imageTitle }, onClick, onPress, price, sku,
|
|
18
|
+
export declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image: { alt, fit, src, title: imageTitle }, onClick, onPress, price, sku, tags, title, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface ProductPriceProps {
|
|
2
2
|
className?: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
isVatIncluded: boolean;
|
|
4
|
+
originalPrice: number;
|
|
5
|
+
price: number;
|
|
6
6
|
}
|
|
7
|
-
export declare function ProductPrice({ className,
|
|
7
|
+
export declare function ProductPrice({ className, isVatIncluded, originalPrice, price, }: ProductPriceProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { SearchClient } from 'algoliasearch/lite';
|
|
3
|
+
import { Autocomplete, GlobalSearchContextValue } from 'global-search/types';
|
|
4
|
+
export declare const GlobalSearchContext: React.Context<GlobalSearchContextValue | null>;
|
|
5
|
+
export declare function GlobalSearchProvider({ children, searchClient, }: {
|
|
6
|
+
children?: ReactNode | ((autocomplete: Autocomplete) => ReactNode);
|
|
7
|
+
searchClient: SearchClient;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AutocompleteCollection } from '@algolia/autocomplete-core';
|
|
3
|
+
import { CategoryHit } from 'global-search/plugins/categories-plugin';
|
|
4
|
+
import { PopularCategoryHit } from 'global-search/plugins/popular-categories-plugin';
|
|
5
|
+
import { PopularSearchHit } from 'global-search/plugins/popular-searches-plugin';
|
|
6
|
+
import { ProductHit } from 'global-search/plugins/products-plugin';
|
|
7
|
+
import { QuerySuggestionHit } from 'global-search/plugins/query-suggestions-plugin';
|
|
8
|
+
import { QuickAccessHit } from 'global-search/plugins/quick-access-plugin';
|
|
9
|
+
import { RecentSearchHit } from 'global-search/plugins/recent-searches-plugin';
|
|
10
|
+
export declare function useGlobalSearch(): {
|
|
11
|
+
categories: AutocompleteCollection<CategoryHit> | undefined;
|
|
12
|
+
hasResults: boolean;
|
|
13
|
+
popularCategories: AutocompleteCollection<PopularCategoryHit> | undefined;
|
|
14
|
+
popularSearches: AutocompleteCollection<PopularSearchHit> | undefined;
|
|
15
|
+
products: AutocompleteCollection<ProductHit> | undefined;
|
|
16
|
+
querySuggestions: AutocompleteCollection<QuerySuggestionHit> | undefined;
|
|
17
|
+
quickAccess: AutocompleteCollection<QuickAccessHit> | undefined;
|
|
18
|
+
recentSearches: AutocompleteCollection<RecentSearchHit> | undefined;
|
|
19
|
+
autocomplete: import("../types").Autocomplete;
|
|
20
|
+
formRef: React.RefObject<HTMLFormElement>;
|
|
21
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
22
|
+
panelRef: React.RefObject<HTMLDivElement>;
|
|
23
|
+
productsIndexName: string;
|
|
24
|
+
productsQuerySuggestionsIndexName: string;
|
|
25
|
+
searchClient: import("algoliasearch/lite").SearchClient;
|
|
26
|
+
setState: React.Dispatch<React.SetStateAction<import("../types").AutocompleteState>>;
|
|
27
|
+
state: import("../types").AutocompleteState;
|
|
28
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
1
|
import { SearchClient } from 'algoliasearch/lite';
|
|
3
|
-
import { Autocomplete } from './types';
|
|
4
2
|
/**
|
|
5
3
|
* Global search using algolia autocomplete with a custom renderer
|
|
6
4
|
* https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/
|
|
@@ -12,8 +10,3 @@ import { Autocomplete } from './types';
|
|
|
12
10
|
export declare function GlobalSearch(props: {
|
|
13
11
|
searchClient: SearchClient;
|
|
14
12
|
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare function SearchForm(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare function GlobalSearchProvider({ children, searchClient, }: {
|
|
17
|
-
children?: ReactNode | ((autocomplete: Autocomplete) => ReactNode);
|
|
18
|
-
searchClient: SearchClient;
|
|
19
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import { AutocompletePlugin } from '@algolia/autocomplete-core';
|
|
2
2
|
import { Hit } from '@algolia/client-search';
|
|
3
3
|
import { SearchClient } from 'algoliasearch/lite';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
categories: string[];
|
|
7
|
-
discountedPrice: number;
|
|
8
|
-
ean: string;
|
|
9
|
-
id: string;
|
|
10
|
-
image: string;
|
|
11
|
-
images: {
|
|
12
|
-
quality: string;
|
|
13
|
-
url: string;
|
|
14
|
-
}[];
|
|
15
|
-
name: string;
|
|
16
|
-
objectID: string;
|
|
17
|
-
price: number;
|
|
18
|
-
slug: string;
|
|
19
|
-
}>;
|
|
4
|
+
import type { ProductHit as ProductHitType } from 'shared/types/product';
|
|
5
|
+
export type ProductHit = Hit<ProductHitType>;
|
|
20
6
|
export declare const productsPlugin: ({ productsIndexName, searchClient, }: {
|
|
21
7
|
productsIndexName: string;
|
|
22
8
|
searchClient: SearchClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConnectedSearchInput(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function PanelContent(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function NoSearch(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function PopularSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
export declare function RecentSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export declare function QuickAccessSection(): import("react/jsx-runtime").JSX.Element | undefined;
|
|
6
|
+
export declare function NoResults(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function PopularCategoriesSection(): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export declare function WithResults(): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SuggestionsSection(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function ProductResultsSection(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Autocomplete } from 'global-search/types';
|
|
3
|
+
export interface SearchResultPanelProps {
|
|
4
|
+
autocomplete: Autocomplete;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
closePanel: VoidFunction;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function SearchResultPanel(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SearchRoot(): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -148,9 +148,41 @@ interface Cart<T extends CartLine = CartLine> {
|
|
|
148
148
|
cartLines?: T[] | null;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
interface
|
|
151
|
+
interface ProductHit {
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
alternativeNumber: string;
|
|
154
|
+
categories: string[];
|
|
155
|
+
categoryPageId: string[];
|
|
156
|
+
consumerPrice: number;
|
|
157
|
+
discountedPrice: number;
|
|
158
|
+
drawerQuantity: string;
|
|
159
|
+
ean: string;
|
|
160
|
+
height: number;
|
|
161
|
+
hierarchicalCategories: {
|
|
162
|
+
lvl0: string;
|
|
163
|
+
lvl1: string;
|
|
164
|
+
};
|
|
152
165
|
id: string;
|
|
153
|
-
|
|
166
|
+
images: {
|
|
167
|
+
quality: string;
|
|
168
|
+
url: string;
|
|
169
|
+
}[] | undefined;
|
|
170
|
+
isVatIncluded: boolean;
|
|
171
|
+
labels: string[];
|
|
172
|
+
length: number;
|
|
173
|
+
listPrice: number;
|
|
174
|
+
moreInformation: string;
|
|
175
|
+
name: string;
|
|
176
|
+
originalPrice: number;
|
|
177
|
+
price: number;
|
|
178
|
+
relatedProducts: string;
|
|
179
|
+
restrictionGroups: string[];
|
|
180
|
+
salePrice: number;
|
|
181
|
+
slug: string;
|
|
182
|
+
storefrontId: string;
|
|
183
|
+
storefrontSlug: string;
|
|
184
|
+
weight: number;
|
|
185
|
+
width: number;
|
|
154
186
|
}
|
|
155
187
|
|
|
156
188
|
interface Link {
|
|
@@ -245,9 +277,9 @@ interface ImageSource {
|
|
|
245
277
|
}
|
|
246
278
|
|
|
247
279
|
interface ProductPrice$1 {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
280
|
+
isVatIncluded: boolean
|
|
281
|
+
originalPrice: number
|
|
282
|
+
price: number
|
|
251
283
|
}
|
|
252
284
|
|
|
253
285
|
interface ProductCardProps {
|
|
@@ -260,10 +292,10 @@ interface ProductCardProps {
|
|
|
260
292
|
onPress?: (e: PressEvent) => void;
|
|
261
293
|
price: ProductPrice$1;
|
|
262
294
|
sku: string;
|
|
263
|
-
|
|
295
|
+
tags?: string[];
|
|
264
296
|
title: string;
|
|
265
297
|
}
|
|
266
|
-
declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image: { alt, fit, src, title: imageTitle }, onClick, onPress, price, sku,
|
|
298
|
+
declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, image: { alt, fit, src, title: imageTitle }, onClick, onPress, price, sku, tags, title, }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
267
299
|
|
|
268
300
|
interface Category {
|
|
269
301
|
href: string
|
|
@@ -311,11 +343,11 @@ declare const ShowAll: ({ children, hasTransparency, initialHeight, isOpen, onTo
|
|
|
311
343
|
|
|
312
344
|
interface ProductPriceProps {
|
|
313
345
|
className?: string;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
346
|
+
isVatIncluded: boolean;
|
|
347
|
+
originalPrice: number;
|
|
348
|
+
price: number;
|
|
317
349
|
}
|
|
318
|
-
declare function ProductPrice({ className,
|
|
350
|
+
declare function ProductPrice({ className, isVatIncluded, originalPrice, price, }: ProductPriceProps): react_jsx_runtime.JSX.Element | undefined;
|
|
319
351
|
|
|
320
352
|
interface ProductSkuProps {
|
|
321
353
|
sku: string;
|
|
@@ -450,7 +482,7 @@ declare function FavoriteOutlinedIcon(props: React.SVGProps<SVGSVGElement>): rea
|
|
|
450
482
|
|
|
451
483
|
declare function HashedOutlinedIcon(props: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
452
484
|
|
|
453
|
-
type TranslationId = 'Chosen filters' | 'Clear' | 'Clear filters' | 'Excl. VAT' | 'Hide filters' | 'Incl. VAT' | 'Show' | 'Show all' | 'Show filters' | 'Show less' | 'Sort' | 'Submit' | 'articles' | 'article' | 'of';
|
|
485
|
+
type TranslationId = 'Chosen filters' | 'Clear' | 'Clear filters' | 'Excl. VAT' | 'Hide filters' | 'Incl. VAT' | 'Show' | 'Show all' | 'Show filters' | 'Show less' | 'Sort' | 'Submit' | 'articles' | 'article' | 'of' | 'sort.relevance' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc';
|
|
454
486
|
|
|
455
487
|
interface FormattedMessageProps {
|
|
456
488
|
fallbackValue?: string;
|
|
@@ -577,4 +609,16 @@ declare function AlgoliaResultsCount(): string | null;
|
|
|
577
609
|
|
|
578
610
|
declare function AlgoliaSortBy(): react_jsx_runtime.JSX.Element | null;
|
|
579
611
|
|
|
580
|
-
|
|
612
|
+
/**
|
|
613
|
+
* Global search using algolia autocomplete with a custom renderer
|
|
614
|
+
* https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/
|
|
615
|
+
*
|
|
616
|
+
* Highly influenced by the two column layout sandbox which
|
|
617
|
+
* uses the autocomplete widgets
|
|
618
|
+
* https://codesandbox.io/p/sandbox/github/algolia/autocomplete/tree/next/examples/two-column-layout
|
|
619
|
+
*/
|
|
620
|
+
declare function GlobalSearch(props: {
|
|
621
|
+
searchClient: SearchClient;
|
|
622
|
+
}): react_jsx_runtime.JSX.Element;
|
|
623
|
+
|
|
624
|
+
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, 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, 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, useBreakpoint, useCart, useDebouncedCallback, useDisclosure, useFavorite, useFormattedMessage, useGlobalState, useProductCartLine, useScrollLock };
|