hasting-swatchcart-module 1.0.32 → 1.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.
@@ -1,2 +1,12 @@
1
+ /**
2
+ * Demo application wrapper for {@link SwatchModule}.
3
+ *
4
+ * Provides local UI controls to:
5
+ * - toggle module open/close state
6
+ * - switch between different data input modes
7
+ * - handle output payload from the module
8
+ *
9
+ * @component
10
+ */
1
11
  declare function App(): import("react/jsx-runtime").JSX.Element;
2
12
  export default App;
@@ -1,7 +1,31 @@
1
1
  import { EActiveTab } from '../../../../shared/types/activeTab';
2
+ /**
3
+ * Props for {@link CartHeader}.
4
+ */
2
5
  interface ICartHeaderProps {
6
+ /**
7
+ * Optional callback for switching the active tab (e.g. back to swatches).
8
+ *
9
+ * @param arg - Active tab value
10
+ */
3
11
  onSetActiveTab?: (arg: EActiveTab) => void;
12
+ /**
13
+ * Callback for closing or toggling the sidebar.
14
+ */
4
15
  onToggleSidebar: () => void;
5
16
  }
17
+ /**
18
+ * Renders the cart header with navigation, count limit messaging, and close action.
19
+ *
20
+ * Displays:
21
+ * - back navigation button (optional tab switch)
22
+ * - cart title
23
+ * - max swatches warning when {@link MAX_SLOTS} is reached
24
+ * - close button to toggle the sidebar
25
+ *
26
+ * @component
27
+ *
28
+ * @param props - {@link ICartHeaderProps}
29
+ */
6
30
  export declare const CartHeader: ({ onSetActiveTab, onToggleSidebar, }: ICartHeaderProps) => import("react/jsx-runtime").JSX.Element;
7
31
  export {};
@@ -1,5 +1,25 @@
1
+ /**
2
+ * Props for {@link MultiProductItemCart}.
3
+ */
1
4
  interface IMultiProductItemCartProps {
5
+ /**
6
+ * Optional callback fired when user proceeds to shipping.
7
+ * Receives the current selected products payload.
8
+ */
2
9
  onSendData?: (data: unknown) => void;
3
10
  }
11
+ /**
12
+ * Renders a multi-product cart with grouped items, quantity controls, and totals.
13
+ *
14
+ * Features:
15
+ * - grouped rendering by product
16
+ * - increment/decrement/delete actions for cart items
17
+ * - synchronizes deletion with the swatches selected materials state
18
+ * - shows totals and a "Go to shipping" action
19
+ *
20
+ * @component
21
+ *
22
+ * @param props - {@link IMultiProductItemCartProps}
23
+ */
4
24
  export declare const MultiProductItemCart: ({ onSendData, }: IMultiProductItemCartProps) => import("react/jsx-runtime").JSX.Element;
5
25
  export {};
@@ -1 +1,14 @@
1
+ /**
2
+ * Renders the product list with category filtering, search, and sorting.
3
+ *
4
+ * Features:
5
+ * - fetches the product list on mount
6
+ * - builds unique categories for the slider
7
+ * - supports debounced text search
8
+ * - supports A–Z and Z–A sorting
9
+ * - hides the header image while the user scrolls down
10
+ * - shows swatch cart content when products are selected
11
+ *
12
+ * @component
13
+ */
1
14
  export declare const ProductList: () => import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,6 @@ export declare const swatchesSlice: import('@reduxjs/toolkit').Slice<ISwatchesSl
14
14
  materialCount: number;
15
15
  selectedMaterial: AttributeValue;
16
16
  selectedMaterials: AttributeValue[];
17
- limitCb?: () => void;
18
17
  }>): void;
19
18
  resetSelectedMaterials(state: import('immer').WritableDraft<ISwatchesSlice>): void;
20
19
  setSelectedProduct(state: import('immer').WritableDraft<ISwatchesSlice>, action: PayloadAction<IProductListItem>): void;
@@ -41,7 +40,6 @@ export declare const setMaterialSelect: import('@reduxjs/toolkit').ActionCreator
41
40
  materialCount: number;
42
41
  selectedMaterial: AttributeValue;
43
42
  selectedMaterials: AttributeValue[];
44
- limitCb?: () => void;
45
43
  }, "swatches/setSelectedMaterial">, clearMaterialFilter: import('@reduxjs/toolkit').ActionCreatorWithPayload<keyof IMaterialSelectState, "swatches/clearMaterialFilter">, clearAllMaterialFilters: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"swatches/clearAllMaterialFilters">, setSelectedProduct: import('@reduxjs/toolkit').ActionCreatorWithPayload<IProductListItem, "swatches/setSelectedProduct">, deleteSelectedProduct: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"swatches/deleteSelectedProduct">, setIsOpenMultiProductCart: import('@reduxjs/toolkit').ActionCreatorWithPayload<boolean, "swatches/setIsOpenMultiProductCart">, resetSelectedMaterials: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"swatches/resetSelectedMaterials">, removeItem: import('@reduxjs/toolkit').ActionCreatorWithPayload<{
46
44
  selectedMaterial: AttributeValue;
47
45
  }, "swatches/removeItem">, increment: import('@reduxjs/toolkit').ActionCreatorWithPayload<{
@@ -1,6 +1,28 @@
1
+ /**
2
+ * Props for {@link ProductElement}.
3
+ */
1
4
  interface IProductElementProps {
5
+ /**
6
+ * ClassName string applied to the outer container.
7
+ */
2
8
  containerStyles: string;
9
+ /**
10
+ * ClassName string applied to the {@link MultiSelect} component.
11
+ */
3
12
  selectStyles: string;
4
13
  }
14
+ /**
15
+ * Renders a product element filter based on a multi-select control.
16
+ *
17
+ * Builds selectable options from `allProductElementOptions` and
18
+ * applies filtering logic that:
19
+ * - updates selected product element values
20
+ * - remaps and prunes related filters based on available counts
21
+ * - updates the panel attributes list according to selection
22
+ *
23
+ * @component
24
+ *
25
+ * @param props - {@link IProductElementProps}
26
+ */
5
27
  export declare const ProductElement: ({ containerStyles, selectStyles, }: IProductElementProps) => import("react/jsx-runtime").JSX.Element;
6
28
  export {};
@@ -1,7 +1,28 @@
1
1
  import { AttributeValue } from '../../model/types';
2
+ /**
3
+ * Props for {@link SwatchesList}.
4
+ */
2
5
  interface ISwatchesListProps {
6
+ /**
7
+ * Optional className string applied to the outer container.
8
+ */
3
9
  containerStyles?: string;
10
+ /**
11
+ * Currently selected swatch materials.
12
+ */
4
13
  selectedMaterials: AttributeValue[];
5
14
  }
15
+ /**
16
+ * Renders the swatches list with selected materials and remaining empty slots.
17
+ *
18
+ * Displays:
19
+ * - header with selected count
20
+ * - selected swatches as list items
21
+ * - placeholder tiles for unused slots up to {@link MAX_SLOTS}
22
+ *
23
+ * @component
24
+ *
25
+ * @param props - {@link ISwatchesListProps}
26
+ */
6
27
  export declare const SwatchesList: ({ selectedMaterials, containerStyles, }: ISwatchesListProps) => import("react/jsx-runtime").JSX.Element;
7
28
  export {};
@@ -0,0 +1,18 @@
1
+ type WithCount = {
2
+ /**
3
+ * Numeric count value.
4
+ * Can be `null` when the item is not counted.
5
+ */
6
+ count: number | null;
7
+ };
8
+ /**
9
+ * Calculates the total count of items.
10
+ *
11
+ * Sums the `count` property of all provided items and
12
+ * memoizes the result to prevent unnecessary recalculations.
13
+ *
14
+ * @param items - Array of items containing a `count` field
15
+ * @returns Total count of all items
16
+ */
17
+ export declare function useCartCount<T extends WithCount>(items: T[]): number;
18
+ export {};