@sonic-equipment/ui 0.0.19 → 0.0.21
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-active-filters.d.ts +7 -0
- package/dist/algolia/algolia-categories.d.ts +1 -0
- package/dist/algolia/algolia-filter-panel.d.ts +4 -0
- package/dist/algolia/algolia-multi-select.d.ts +5 -0
- package/dist/algolia/algolia-pagination.d.ts +1 -0
- package/dist/algolia/algolia-product-list.d.ts +1 -0
- package/dist/algolia/algolia-provider.d.ts +13 -0
- package/dist/algolia/algolia-results-count.d.ts +1 -0
- package/dist/algolia/algolia-searchclient-mock.d.ts +4 -0
- package/dist/algolia/algolia-sort-by.d.ts +1 -0
- package/dist/algolia/algolia.stories.d.ts +17 -0
- package/dist/buttons/add-to-cart-button/add-to-cart-button.stories.d.ts +1 -0
- package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.d.ts +5 -0
- package/dist/buttons/button/button.d.ts +5 -4
- package/dist/buttons/button/button.stories.d.ts +1 -0
- package/dist/buttons/icon-button/icon-button.d.ts +2 -1
- package/dist/buttons/link-button/link-button.d.ts +10 -0
- package/dist/buttons/link-button/link-button.stories.d.ts +19 -0
- package/dist/cards/product-card/connected-product-cart.d.ts +6 -0
- package/dist/cards/product-card/product-card.stories.d.ts +1 -0
- package/dist/collapsables/accordion/accordion-item.d.ts +2 -1
- package/dist/collapsables/accordion/accordion.d.ts +2 -1
- package/dist/collapsables/accordion/accordion.stories.d.ts +1 -1
- package/dist/collapsables/show-all/show-all.d.ts +9 -0
- package/dist/collapsables/show-all/show-all.stories.d.ts +17 -0
- package/dist/filters/active-filters/active-filters.d.ts +14 -0
- package/dist/filters/active-filters/active-filters.stories.d.ts +15 -0
- package/dist/filters/multi-select/multi-select.d.ts +19 -0
- package/dist/filters/multi-select/multi-select.stories.d.ts +20 -0
- package/dist/filters/pagination/pagination.d.ts +6 -0
- package/dist/filters/pagination/pagination.stories.d.ts +18 -0
- package/dist/forms/color-checkbox/color-checkbox.stories.d.ts +1 -0
- package/dist/forms/select/select.d.ts +5 -5
- package/dist/forms/select/select.stories.d.ts +10 -3
- package/dist/icons/chevrons/chevron-left-filled-icon.d.ts +2 -0
- package/dist/icons/chevrons/chevron-right-filled-icon.d.ts +2 -0
- package/dist/icons/close/close-filled-icon.d.ts +2 -0
- package/dist/icons/filter/filter-outlined-icon.d.ts +2 -0
- package/dist/index.d.ts +71 -32
- package/dist/index.js +402 -64
- package/dist/intl/translation-id.d.ts +1 -5
- package/dist/product-listing/product-listing.d.ts +12 -16
- package/dist/product-listing/product-listing.stories.d.ts +7 -2
- package/dist/shared/hooks/use-breakpoint.d.ts +5 -0
- package/dist/shared/hooks/use-debounce-callback.d.ts +1 -0
- package/dist/shared/hooks/use-disclosure.d.ts +9 -0
- package/dist/shared/hooks/use-scroll-lock.d.ts +1 -0
- package/dist/shared/providers/cart-provider.d.ts +33 -0
- package/dist/shared/providers/global-state-provider.d.ts +23 -0
- package/dist/shared/types/cart.d.ts +8 -0
- package/dist/shared/utils/event-emitter.d.ts +9 -0
- package/dist/sidebar/sidebar-context.d.ts +6 -0
- package/dist/sidebar/sidebar-provider.d.ts +6 -0
- package/dist/sidebar/sidebar.d.ts +5 -0
- package/dist/sidebar/sidebar.stories.d.ts +8 -0
- package/dist/sidebar/toggle-sidebar-button.d.ts +1 -0
- package/dist/sidebar/use-sidebar.d.ts +2 -0
- package/dist/styles.css +435 -12
- package/dist/typography/heading/heading.d.ts +1 -1
- package/package.json +37 -32
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
'Excl. VAT': string;
|
|
3
|
-
'Incl. VAT': string;
|
|
4
|
-
}
|
|
5
|
-
export type TranslationId = keyof Translations;
|
|
1
|
+
export type TranslationId = 'Chosen filters' | 'Clear filters' | 'Excl. VAT' | 'Incl. VAT' | 'Show' | 'Show all' | 'Show filters' | 'Show less' | 'Sort' | 'articles' | 'article' | 'of';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
1
|
export interface Filters {
|
|
3
2
|
color: {
|
|
4
3
|
options: {
|
|
@@ -8,28 +7,25 @@ export interface Filters {
|
|
|
8
7
|
}[];
|
|
9
8
|
};
|
|
10
9
|
}
|
|
10
|
+
declare const sortOptions: {
|
|
11
|
+
readonly new: "New";
|
|
12
|
+
readonly popular: "Popular";
|
|
13
|
+
readonly price_asc: "Price: Low - High";
|
|
14
|
+
readonly price_desc: "Price: High - Low";
|
|
15
|
+
readonly recommended: "Recommended";
|
|
16
|
+
};
|
|
17
|
+
type SortKey = keyof typeof sortOptions;
|
|
11
18
|
export type ActiveFilters = {
|
|
12
19
|
colors: string[];
|
|
13
20
|
};
|
|
14
|
-
export type Sort = {
|
|
15
|
-
by: string;
|
|
16
|
-
direction: string;
|
|
17
|
-
};
|
|
18
21
|
export type ProductListingProps = {
|
|
19
22
|
activeFilters: ActiveFilters;
|
|
20
23
|
filters: Filters;
|
|
21
24
|
isLoading?: boolean;
|
|
22
25
|
onFilterChange: (filters: ActiveFilters) => void;
|
|
23
|
-
onSortChange: (sort:
|
|
24
|
-
|
|
25
|
-
products: {
|
|
26
|
-
id: string;
|
|
27
|
-
title: string;
|
|
28
|
-
}[];
|
|
29
|
-
sort: {
|
|
30
|
-
by: string;
|
|
31
|
-
direction: string;
|
|
32
|
-
};
|
|
26
|
+
onSortChange: (sort: SortKey) => void;
|
|
27
|
+
sort: SortKey;
|
|
33
28
|
total: number;
|
|
34
29
|
};
|
|
35
|
-
export declare function ProductListing({
|
|
30
|
+
export declare function ProductListing({ isLoading }: ProductListingProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
1
2
|
import { StoryObj } from '@storybook/react';
|
|
2
3
|
import { ProductListing } from './product-listing';
|
|
3
4
|
declare const meta: {
|
|
4
5
|
args: {
|
|
5
6
|
onFilterChange: import("@vitest/spy").Mock<[filters: import("./product-listing").ActiveFilters], void>;
|
|
6
|
-
onSortChange: import("@vitest/spy").Mock<[sort:
|
|
7
|
+
onSortChange: import("@vitest/spy").Mock<[sort: "new" | "popular" | "price_asc" | "price_desc" | "recommended"], void>;
|
|
8
|
+
online: false;
|
|
7
9
|
};
|
|
8
10
|
component: typeof ProductListing;
|
|
9
11
|
tags: string[];
|
|
10
12
|
title: string;
|
|
11
13
|
};
|
|
12
14
|
export default meta;
|
|
13
|
-
type
|
|
15
|
+
type StoryProps = ComponentProps<typeof ProductListing> & {
|
|
16
|
+
online: boolean;
|
|
17
|
+
};
|
|
18
|
+
type Story = StoryObj<StoryProps>;
|
|
14
19
|
export declare const Default: Story;
|
|
15
20
|
export declare const Loading: Story;
|
|
16
21
|
export declare const WithActiveFilters: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebouncedCallback<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useScrollLock: (lock: boolean) => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Cart, CartLine } from 'shared/types/cart';
|
|
2
|
+
interface Props {
|
|
3
|
+
addToCart: (args: {
|
|
4
|
+
productId: string;
|
|
5
|
+
quantity: number;
|
|
6
|
+
}) => void;
|
|
7
|
+
currentCart: Cart;
|
|
8
|
+
isLoaded: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
loadCurrentCart: VoidFunction;
|
|
11
|
+
removeCartLine: (args: {
|
|
12
|
+
cartLineId: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
updateCartLine: (cartLine: CartLine) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function CartProvider(props: Props): null;
|
|
17
|
+
export declare function useCart(): Props;
|
|
18
|
+
export declare function useProductCartLine(productId: string): {
|
|
19
|
+
addToCart: (args: {
|
|
20
|
+
productId: string;
|
|
21
|
+
quantity: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
cartLine: CartLine | undefined;
|
|
24
|
+
currentCart: Cart;
|
|
25
|
+
isLoaded: boolean;
|
|
26
|
+
isLoading: boolean;
|
|
27
|
+
loadCurrentCart: VoidFunction;
|
|
28
|
+
removeCartLine: (args: {
|
|
29
|
+
cartLineId: string;
|
|
30
|
+
}) => void;
|
|
31
|
+
updateCartLine: (cartLine: CartLine) => void;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { EventEmitter } from 'shared/utils/event-emitter';
|
|
3
|
+
declare class State<T> extends EventEmitter<T | undefined> {
|
|
4
|
+
private _state;
|
|
5
|
+
constructor(state?: T);
|
|
6
|
+
get value(): T | undefined;
|
|
7
|
+
set value(newState: T | undefined);
|
|
8
|
+
}
|
|
9
|
+
declare class GlobalState {
|
|
10
|
+
private states;
|
|
11
|
+
constructor(states: MutableRefObject<Record<string | symbol, State<any>>>);
|
|
12
|
+
get<T>(key: string | symbol): State<T>;
|
|
13
|
+
get<T>(key: string | symbol, initialState: T | undefined): State<T>;
|
|
14
|
+
set<T>(key: string | symbol, state: State<T>): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const GlobalStateProviderContext: React.Context<GlobalState>;
|
|
17
|
+
interface GlobalStateProviderProps {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare function GlobalStateProvider({ children, }: GlobalStateProviderProps): ReactElement | null;
|
|
21
|
+
export declare function useGlobalState<T>(key: string | symbol): [T | undefined, (value: T) => void];
|
|
22
|
+
export declare function useGlobalState<T>(key: string | symbol, initialState: T): [T, (value: T) => void];
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type EventCallback<T> = (data: T) => void;
|
|
2
|
+
export declare class EventEmitter<T> {
|
|
3
|
+
private listeners;
|
|
4
|
+
constructor();
|
|
5
|
+
addEventListener(event: string, listener: EventCallback<T>): void;
|
|
6
|
+
removeEventListener(event: string, listener: EventCallback<T>): void;
|
|
7
|
+
trigger(event: string, data: T): void;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SidebarProvider } from './sidebar-provider';
|
|
3
|
+
declare const meta: Meta<typeof SidebarProvider>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const SmallViewport: Story;
|
|
7
|
+
export declare const MediumViewport: Story;
|
|
8
|
+
export declare const LargeViewport: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ToggleSidebarButton: () => import("react/jsx-runtime").JSX.Element;
|