@asante-org/leybold-design-system 1.3.5 → 1.3.7-beta.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.
package/dist/index.scss CHANGED
@@ -3194,6 +3194,38 @@ h3.ProductCardHorizontal-module__productTitle___xBuu7 {
3194
3194
  .disabled-product-fields-section .qr-form-fields .qr-form-filed-wrapper.has-no-value {
3195
3195
  display: none;
3196
3196
  }
3197
+ .SearchTriggerButton-module__searchTrigger___PDbDB {
3198
+ display: inline-flex;
3199
+ align-items: center;
3200
+ gap: 0.5rem;
3201
+ padding: 0.5rem 1rem;
3202
+ background: transparent;
3203
+ border: 1px solid currentColor;
3204
+ border-radius: 0.25rem;
3205
+ color: inherit;
3206
+ font-size: 1rem;
3207
+ cursor: pointer;
3208
+ transition: all 0.2s ease-in-out;
3209
+ }
3210
+ .SearchTriggerButton-module__searchTrigger___PDbDB:hover {
3211
+ background-color: rgba(0, 0, 0, 0.05);
3212
+ }
3213
+ .SearchTriggerButton-module__searchTrigger___PDbDB:focus-visible {
3214
+ outline: 2px solid #0066cc;
3215
+ outline-offset: 2px;
3216
+ }
3217
+ .SearchTriggerButton-module__searchTrigger___PDbDB:active {
3218
+ transform: scale(0.98);
3219
+ }
3220
+
3221
+ .SearchTriggerButton-module__searchIcon___izByW {
3222
+ width: 1.25rem;
3223
+ height: 1.25rem;
3224
+ }
3225
+
3226
+ .SearchTriggerButton-module__label___mkS7T {
3227
+ font-weight: 500;
3228
+ }
3197
3229
  :root {
3198
3230
  --leybold-red: #e2001a;
3199
3231
  --leybold-black: #000000;
@@ -6084,36 +6116,4 @@ h3.ProductCardHorizontal-module__productTitle___xBuu7 {
6084
6116
  height: 4rem;
6085
6117
  margin-bottom: 1rem;
6086
6118
  }
6087
- }
6088
- .SearchTriggerButton-module__searchTrigger___PDbDB {
6089
- display: inline-flex;
6090
- align-items: center;
6091
- gap: 0.5rem;
6092
- padding: 0.5rem 1rem;
6093
- background: transparent;
6094
- border: 1px solid currentColor;
6095
- border-radius: 0.25rem;
6096
- color: inherit;
6097
- font-size: 1rem;
6098
- cursor: pointer;
6099
- transition: all 0.2s ease-in-out;
6100
- }
6101
- .SearchTriggerButton-module__searchTrigger___PDbDB:hover {
6102
- background-color: rgba(0, 0, 0, 0.05);
6103
- }
6104
- .SearchTriggerButton-module__searchTrigger___PDbDB:focus-visible {
6105
- outline: 2px solid #0066cc;
6106
- outline-offset: 2px;
6107
- }
6108
- .SearchTriggerButton-module__searchTrigger___PDbDB:active {
6109
- transform: scale(0.98);
6110
- }
6111
-
6112
- .SearchTriggerButton-module__searchIcon___izByW {
6113
- width: 1.25rem;
6114
- height: 1.25rem;
6115
- }
6116
-
6117
- .SearchTriggerButton-module__label___mkS7T {
6118
- font-weight: 500;
6119
6119
  }
@@ -1,2 +1,2 @@
1
1
  export { ContentCardHorizontal } from './ContentCardHorizontal';
2
- export type { ContentCardHorizontalProps } from '../../types/cards';
2
+ export type { ContentCardHorizontalProps } from '../../types/search';
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { FederatedSearchComponentProps } from "../../types/search";
3
+ export declare const FederatedSearch: React.FC<FederatedSearchComponentProps>;
@@ -1,2 +1,3 @@
1
+ export { FederatedSearch } from './FederatedSearch';
1
2
  export { FederatedSearchExperience } from './FederatedSearchExperience';
2
3
  export type { FederatedSearchProps } from '../../types/search';
@@ -0,0 +1,4 @@
1
+ import type { FederatedSearchAnalyticsEvent, FederatedSearchAnalyticsHandlers } from "../../types/search";
2
+ export declare const useSearchAnalytics: (analytics?: FederatedSearchAnalyticsHandlers) => {
3
+ emitAnalytics: (event: FederatedSearchAnalyticsEvent) => void;
4
+ };
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import type { SearchTab, SearchView } from "../../types/search";
3
+ interface UseSearchUIStateOptions {
4
+ debounceMs: number;
5
+ defaultTab?: SearchTab;
6
+ }
7
+ export declare const useSearchUIState: ({ debounceMs, defaultTab }: UseSearchUIStateOptions) => {
8
+ isOpen: boolean;
9
+ setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
10
+ query: string;
11
+ setQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
12
+ debouncedQuery: string;
13
+ activeView: SearchView;
14
+ setActiveView: import("react").Dispatch<import("react").SetStateAction<SearchView>>;
15
+ activeTab: SearchTab;
16
+ setActiveTab: import("react").Dispatch<import("react").SetStateAction<SearchTab>>;
17
+ currentPage: number;
18
+ setCurrentPage: import("react").Dispatch<import("react").SetStateAction<number>>;
19
+ totalPages: number;
20
+ setTotalPages: import("react").Dispatch<import("react").SetStateAction<number>>;
21
+ isFilterDrawerOpen: boolean;
22
+ setIsFilterDrawerOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
23
+ };
24
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Facet, UseFederatedSearchAlgoliaOptions } from "../../types/search";
2
+ export declare const CONTENT_ALL_FACET_VALUE = "All";
3
+ export declare const normalizeCategory: (rawCategory: unknown) => string | undefined;
4
+ export declare const stripHtml: (input: unknown) => string | undefined;
5
+ export declare const getValueAtPath: (obj: unknown, path: string) => unknown;
6
+ export declare const coerceStringValues: (value: unknown) => string[];
7
+ export declare const transformFacetsFromAlgolia: (algoliaFacets: Record<string, Record<string, number>>, facetConfigs: UseFederatedSearchAlgoliaOptions["config"]["productFacets"], refinements: Map<string, Set<string>>) => Facet[];
8
+ export declare const buildFacetWithAllOption: (config: UseFederatedSearchAlgoliaOptions["config"]["contentFacets"][number], values: Array<{
9
+ value: string;
10
+ count: number;
11
+ }>, refinements: Map<string, Set<string>>, allFacetLabel: string) => Facet[];
@@ -0,0 +1,37 @@
1
+ import type { ContentResult, Facet, ProductResult, SearchTab, SearchView, UseFederatedSearchAlgoliaOptions } from "../types/search";
2
+ export declare const useFederatedSearchAlgolia: ({ config, text, analytics, }: UseFederatedSearchAlgoliaOptions) => {
3
+ isOpen: boolean;
4
+ onOpen: () => void;
5
+ onClose: () => void;
6
+ query: string;
7
+ onQueryChange: (value: string) => void;
8
+ onSearchSubmit: () => void;
9
+ products: ProductResult[];
10
+ contents: ContentResult[];
11
+ isLoadingProducts: boolean;
12
+ isLoadingContents: boolean;
13
+ productsError: string | undefined;
14
+ contentsError: string | undefined;
15
+ onSeeAllProducts: () => void;
16
+ onSeeAllContents: () => void;
17
+ onSeeAllCombined: () => void;
18
+ activeView: SearchView;
19
+ onChangeView: (view: SearchView) => void;
20
+ activeTab: SearchTab;
21
+ onTabChange: (tab: SearchTab) => void;
22
+ currentPage: number;
23
+ totalPages: number;
24
+ onPageChange: (page: number) => void;
25
+ facets: Facet[];
26
+ onFacetToggle: (attribute: string, value: string) => void;
27
+ isFilterDrawerOpen: boolean;
28
+ onFilterDrawerToggle: () => void;
29
+ onFilterDrawerClose: () => void;
30
+ text: import("../types/search").FederatedSearchTextConfig | undefined;
31
+ isAlgoliaConfigured: boolean;
32
+ trackResultClick: (params: {
33
+ resultType: "product" | "content";
34
+ resultId: string;
35
+ metadata?: Record<string, unknown>;
36
+ }) => void;
37
+ };
@@ -10,8 +10,10 @@ export { AlgoliaDynamicSearchLeybold } from "./experience/algolia-dynamic-search
10
10
  export { QrFormLeybold } from "./experience/qr-form-journey";
11
11
  export { AlgoliaDynamicSearchLeybold as AlgoliaDynamicSearch } from "./experience/algolia-dynamic-search";
12
12
  export { QrFormLeybold as QrForm } from "./experience/qr-form-journey";
13
+ export { FederatedSearch } from "./experience/federated-search";
13
14
  export { FederatedSearchExperience } from "./experience/federated-search";
14
- export type { FederatedSearchProps } from "./types/search";
15
+ export type { FederatedSearchComponentProps, FederatedSearchProps } from "./types/search";
16
+ export { useFederatedSearchAlgolia } from "./hooks/useFederatedSearchAlgolia";
15
17
  export { SearchTriggerButton } from "./components/SearchTriggerButton";
16
18
  export { SearchModal, ModalCloseButton } from "./components/SearchModal";
17
19
  export { SearchBar, SearchIcon, SearchInput, SearchSubmitButton } from "./components/SearchBar";
@@ -25,7 +27,8 @@ export { ContentCardBase } from "./components/ContentCardBase";
25
27
  export { ContentCardHorizontal } from "./components/ContentCardHorizontal";
26
28
  export { FederatedResultsView, ResultsList } from "./components/ResultsView";
27
29
  export { FiltersPanel, FilterAccordion, FilterItem, FilterSearch, AppliedFilters, AppliedFilterTag, } from "./components/Filters";
28
- export type { ProductResult, ContentResult, SearchView, SearchTab, SearchTriggerButtonProps, SearchModalProps, SearchBarProps, FederatedInstantResultsLayoutProps, ResultsColumnProps, ProductCardHorizontalProps, ContentCardBaseProps, ContentCardHorizontalProps, FederatedResultsViewProps, ResultsListProps, Facet, FacetValue, } from "./types/search";
30
+ export type { ProductResult, ContentResult, SearchView, SearchTab, SearchTriggerButtonProps, SearchModalProps, SearchBarProps, FederatedInstantResultsLayoutProps, ResultsColumnProps, ProductCardHorizontalProps, ContentCardHorizontalProps, FederatedResultsViewProps, ResultsListProps, Facet, FacetValue, FederatedSearchTextConfig, FederatedFacetConfig, FederatedSearchAlgoliaConfig, FederatedSearchAnalyticsEvent, FederatedSearchAnalyticsHandlers, FederatedSearchComponentProps, UseFederatedSearchAlgoliaOptions, } from "./types/search";
31
+ export type { ContentCardBaseProps } from "./types/cards";
29
32
  export type { FiltersPanelProps, FilterAccordionProps, FilterItemProps, FilterSearchProps, AppliedFiltersProps, AppliedFilterTagProps, } from "./components/Filters";
30
33
  export type { ResultsCountProps } from "./components/ResultsCount";
31
34
  export type { SeeAllLinkButtonProps } from "./components/SeeAllLinkButton";
@@ -27,13 +27,13 @@ export interface ContentCardProps {
27
27
  excerpt?: string;
28
28
  className?: string;
29
29
  button?: ButtonProps;
30
- variant?: "content-view" | "career-view";
30
+ variant?: "content-view" | "career-view" | "instant-view" | "results-view";
31
31
  style?: React.CSSProperties;
32
32
  showButton?: boolean;
33
33
  }
34
34
  export interface ContentCardBaseProps {
35
35
  id?: string;
36
- variant?: "content-view" | "career-view";
36
+ variant?: "content-view" | "career-view" | "instant-view" | "results-view" | "product-view" | any;
37
37
  title: string;
38
38
  url: string;
39
39
  imageUrl?: string;
@@ -81,3 +81,5 @@ export interface ProductCardDetailsProps {
81
81
  showProductPrice?: boolean;
82
82
  showButton?: boolean;
83
83
  }
84
+ export interface ContentCardHorizontalProps {
85
+ }
@@ -31,6 +31,65 @@ export interface ContentResult {
31
31
  }
32
32
  export type SearchView = "instant" | "results";
33
33
  export type SearchTab = "all" | "products" | "content";
34
+ export interface FederatedSearchTextConfig {
35
+ modalTitle?: string;
36
+ instantSearchPlaceholder?: string;
37
+ resultsSearchPlaceholder?: string;
38
+ productsTabLabel?: string;
39
+ contentTabLabel?: string;
40
+ filterButtonLabel?: string;
41
+ showResultsLabel?: string;
42
+ seeAllProductsLabel?: string;
43
+ seeAllContentLabel?: string;
44
+ loadingProductsLabel?: string;
45
+ loadingContentLabel?: string;
46
+ loadingResultsLabel?: string;
47
+ noResultsTitle?: string;
48
+ noResultsDescription?: string;
49
+ buyOnlineLabel?: string;
50
+ allFacetValueLabel?: string;
51
+ }
52
+ export interface FederatedFacetConfig {
53
+ id: string;
54
+ label: string;
55
+ attribute: string;
56
+ searchable?: boolean;
57
+ defaultExpanded?: boolean;
58
+ }
59
+ export interface FederatedSearchAlgoliaConfig {
60
+ appId: string;
61
+ searchKey: string;
62
+ productsIndexName: string;
63
+ contentIndexName: string;
64
+ productFacets: FederatedFacetConfig[];
65
+ contentFacets: FederatedFacetConfig[];
66
+ hitsPerPage?: number;
67
+ debounceMs?: number;
68
+ }
69
+ export interface FederatedSearchAnalyticsEvent {
70
+ name: "search_open" | "search_close" | "search_submit" | "tab_change" | "facet_toggle" | "page_change" | "result_click";
71
+ query?: string;
72
+ tab?: SearchTab;
73
+ view?: SearchView;
74
+ attribute?: string;
75
+ value?: string;
76
+ page?: number;
77
+ resultType?: "product" | "content";
78
+ resultId?: string;
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ export interface FederatedSearchAnalyticsHandlers {
82
+ onGoogleAnalyticsEvent?: (event: FederatedSearchAnalyticsEvent) => void;
83
+ onAlgoliaAnalyticsEvent?: (event: FederatedSearchAnalyticsEvent) => void;
84
+ }
85
+ export interface UseFederatedSearchAlgoliaOptions {
86
+ config: FederatedSearchAlgoliaConfig;
87
+ text?: FederatedSearchTextConfig;
88
+ analytics?: FederatedSearchAnalyticsHandlers;
89
+ }
90
+ export interface FederatedSearchComponentProps extends UseFederatedSearchAlgoliaOptions {
91
+ trigger?: Omit<SearchTriggerButtonProps, "onOpen">;
92
+ }
34
93
  export interface FederatedSearchProps {
35
94
  isOpen: boolean;
36
95
  onOpen(): void;
@@ -59,6 +118,7 @@ export interface FederatedSearchProps {
59
118
  isFilterDrawerOpen?: boolean;
60
119
  onFilterDrawerToggle?: () => void;
61
120
  onFilterDrawerClose?: () => void;
121
+ text?: FederatedSearchTextConfig;
62
122
  }
63
123
  export interface SearchTriggerButtonProps {
64
124
  onOpen(): void;
@@ -94,6 +154,7 @@ export interface FederatedInstantResultsLayoutProps {
94
154
  onSeeAllProducts(): void;
95
155
  onSeeAllContents(): void;
96
156
  onSeeAllCombined(): void;
157
+ text?: FederatedSearchTextConfig;
97
158
  }
98
159
  export interface ResultsColumnProps {
99
160
  title: string;
@@ -124,6 +185,7 @@ export interface FederatedResultsViewProps {
124
185
  isFilterDrawerOpen?: boolean;
125
186
  onFilterDrawerToggle?: () => void;
126
187
  onFilterDrawerClose?: () => void;
188
+ text?: FederatedSearchTextConfig;
127
189
  }
128
190
  export interface FiltersPanelPropsOld {
129
191
  className?: string;
@@ -135,5 +197,6 @@ export interface ResultsListProps {
135
197
  isLoading: boolean;
136
198
  error?: string;
137
199
  className?: string;
200
+ text?: FederatedSearchTextConfig;
138
201
  }
139
202
  export type { ProductCardHorizontalProps, ContentCardHorizontalProps } from "./cards";