@seekora-ai/ui-sdk-react 1.0.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/components/Breadcrumb.d.ts +43 -0
- package/dist/components/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb.js +119 -0
- package/dist/components/ClearRefinements.d.ts +42 -0
- package/dist/components/ClearRefinements.d.ts.map +1 -0
- package/dist/components/ClearRefinements.js +80 -0
- package/dist/components/CurrentRefinements.d.ts +41 -0
- package/dist/components/CurrentRefinements.d.ts.map +1 -0
- package/dist/components/CurrentRefinements.js +83 -0
- package/dist/components/Facets.d.ts +53 -0
- package/dist/components/Facets.d.ts.map +1 -0
- package/dist/components/Facets.js +195 -0
- package/dist/components/FederatedDropdown.d.ts +92 -0
- package/dist/components/FederatedDropdown.d.ts.map +1 -0
- package/dist/components/FederatedDropdown.js +510 -0
- package/dist/components/HierarchicalMenu.d.ts +55 -0
- package/dist/components/HierarchicalMenu.d.ts.map +1 -0
- package/dist/components/HierarchicalMenu.js +168 -0
- package/dist/components/Highlight.d.ts +51 -0
- package/dist/components/Highlight.d.ts.map +1 -0
- package/dist/components/Highlight.js +155 -0
- package/dist/components/HitsPerPage.d.ts +41 -0
- package/dist/components/HitsPerPage.d.ts.map +1 -0
- package/dist/components/HitsPerPage.js +72 -0
- package/dist/components/InfiniteHits.d.ts +56 -0
- package/dist/components/InfiniteHits.d.ts.map +1 -0
- package/dist/components/InfiniteHits.js +181 -0
- package/dist/components/MobileFilters.d.ts +71 -0
- package/dist/components/MobileFilters.d.ts.map +1 -0
- package/dist/components/MobileFilters.js +242 -0
- package/dist/components/Pagination.d.ts +44 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +142 -0
- package/dist/components/QuerySuggestions.d.ts +38 -0
- package/dist/components/QuerySuggestions.d.ts.map +1 -0
- package/dist/components/QuerySuggestions.js +86 -0
- package/dist/components/QuerySuggestionsDropdown.d.ts +86 -0
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -0
- package/dist/components/QuerySuggestionsDropdown.js +395 -0
- package/dist/components/RangeInput.d.ts +58 -0
- package/dist/components/RangeInput.d.ts.map +1 -0
- package/dist/components/RangeInput.js +203 -0
- package/dist/components/RangeSlider.d.ts +51 -0
- package/dist/components/RangeSlider.d.ts.map +1 -0
- package/dist/components/RangeSlider.js +193 -0
- package/dist/components/Recommendations.d.ts +90 -0
- package/dist/components/Recommendations.d.ts.map +1 -0
- package/dist/components/Recommendations.js +270 -0
- package/dist/components/RichQuerySuggestions.d.ts +77 -0
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -0
- package/dist/components/RichQuerySuggestions.js +492 -0
- package/dist/components/SearchBar.d.ts +40 -0
- package/dist/components/SearchBar.d.ts.map +1 -0
- package/dist/components/SearchBar.js +217 -0
- package/dist/components/SearchBarWithSuggestions.d.ts +99 -0
- package/dist/components/SearchBarWithSuggestions.d.ts.map +1 -0
- package/dist/components/SearchBarWithSuggestions.js +275 -0
- package/dist/components/SearchLayout.d.ts +35 -0
- package/dist/components/SearchLayout.d.ts.map +1 -0
- package/dist/components/SearchLayout.js +56 -0
- package/dist/components/SearchProvider.d.ts +28 -0
- package/dist/components/SearchProvider.d.ts.map +1 -0
- package/dist/components/SearchProvider.js +43 -0
- package/dist/components/SearchResults.d.ts +51 -0
- package/dist/components/SearchResults.d.ts.map +1 -0
- package/dist/components/SearchResults.js +485 -0
- package/dist/components/SortBy.d.ts +44 -0
- package/dist/components/SortBy.d.ts.map +1 -0
- package/dist/components/SortBy.js +61 -0
- package/dist/components/Stats.d.ts +37 -0
- package/dist/components/Stats.d.ts.map +1 -0
- package/dist/components/Stats.js +52 -0
- package/dist/components/suggestions/AmazonDropdown.d.ts +30 -0
- package/dist/components/suggestions/AmazonDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/AmazonDropdown.js +529 -0
- package/dist/components/suggestions/GoogleDropdown.d.ts +31 -0
- package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/GoogleDropdown.js +370 -0
- package/dist/components/suggestions/MinimalDropdown.d.ts +24 -0
- package/dist/components/suggestions/MinimalDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/MinimalDropdown.js +314 -0
- package/dist/components/suggestions/MobileSheetDropdown.d.ts +31 -0
- package/dist/components/suggestions/MobileSheetDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/MobileSheetDropdown.js +485 -0
- package/dist/components/suggestions/PinterestDropdown.d.ts +29 -0
- package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/PinterestDropdown.js +450 -0
- package/dist/components/suggestions/ShopifyDropdown.d.ts +27 -0
- package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/ShopifyDropdown.js +451 -0
- package/dist/components/suggestions/SpotlightDropdown.d.ts +33 -0
- package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -0
- package/dist/components/suggestions/SpotlightDropdown.js +547 -0
- package/dist/components/suggestions/SuggestionSearchBar.d.ts +123 -0
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -0
- package/dist/components/suggestions/SuggestionSearchBar.js +652 -0
- package/dist/components/suggestions/index.d.ts +37 -0
- package/dist/components/suggestions/index.d.ts.map +1 -0
- package/dist/components/suggestions/index.js +59 -0
- package/dist/components/suggestions/styles/index.d.ts +11 -0
- package/dist/components/suggestions/styles/index.d.ts.map +1 -0
- package/dist/components/suggestions/styles/index.js +289 -0
- package/dist/components/suggestions/styles/responsive.d.ts +107 -0
- package/dist/components/suggestions/styles/responsive.d.ts.map +1 -0
- package/dist/components/suggestions/styles/responsive.js +237 -0
- package/dist/components/suggestions/types.d.ts +489 -0
- package/dist/components/suggestions/types.d.ts.map +1 -0
- package/dist/components/suggestions/types.js +6 -0
- package/dist/components/suggestions/utils.d.ts +213 -0
- package/dist/components/suggestions/utils.d.ts.map +1 -0
- package/dist/components/suggestions/utils.js +514 -0
- package/dist/hooks/useAnalytics.d.ts +20 -0
- package/dist/hooks/useAnalytics.d.ts.map +1 -0
- package/dist/hooks/useAnalytics.js +62 -0
- package/dist/hooks/useNaturalLanguageFilters.d.ts +48 -0
- package/dist/hooks/useNaturalLanguageFilters.d.ts.map +1 -0
- package/dist/hooks/useNaturalLanguageFilters.js +221 -0
- package/dist/hooks/useQuerySuggestions.d.ts +21 -0
- package/dist/hooks/useQuerySuggestions.d.ts.map +1 -0
- package/dist/hooks/useQuerySuggestions.js +68 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts +114 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts.map +1 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.js +376 -0
- package/dist/hooks/useSearchState.d.ts +35 -0
- package/dist/hooks/useSearchState.d.ts.map +1 -0
- package/dist/hooks/useSearchState.js +68 -0
- package/dist/hooks/useSeekoraSearch.d.ts +20 -0
- package/dist/hooks/useSeekoraSearch.d.ts.map +1 -0
- package/dist/hooks/useSeekoraSearch.js +63 -0
- package/dist/hooks/useSmartSuggestions.d.ts +55 -0
- package/dist/hooks/useSmartSuggestions.d.ts.map +1 -0
- package/dist/hooks/useSmartSuggestions.js +236 -0
- package/dist/hooks/useSuggestionsAnalytics.d.ts +91 -0
- package/dist/hooks/useSuggestionsAnalytics.d.ts.map +1 -0
- package/dist/hooks/useSuggestionsAnalytics.js +226 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.umd.js +1 -0
- package/dist/src/index.d.ts +2849 -0
- package/dist/src/index.esm.js +11679 -0
- package/dist/src/index.esm.js.map +1 -0
- package/dist/src/index.js +11761 -0
- package/dist/src/index.js.map +1 -0
- package/dist/themes/createTheme.d.ts +8 -0
- package/dist/themes/createTheme.d.ts.map +1 -0
- package/dist/themes/createTheme.js +10 -0
- package/dist/themes/dark.d.ts +6 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +34 -0
- package/dist/themes/default.d.ts +6 -0
- package/dist/themes/default.d.ts.map +1 -0
- package/dist/themes/default.js +71 -0
- package/dist/themes/mergeThemes.d.ts +7 -0
- package/dist/themes/mergeThemes.d.ts.map +1 -0
- package/dist/themes/mergeThemes.js +6 -0
- package/dist/themes/minimal.d.ts +6 -0
- package/dist/themes/minimal.d.ts.map +1 -0
- package/dist/themes/minimal.js +34 -0
- package/dist/themes/suggestions.d.ts +216 -0
- package/dist/themes/suggestions.d.ts.map +1 -0
- package/dist/themes/suggestions.js +546 -0
- package/dist/themes/types.d.ts +7 -0
- package/dist/themes/types.d.ts.map +1 -0
- package/dist/themes/types.js +6 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/package.json +65 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SortBy Component
|
|
3
|
+
*
|
|
4
|
+
* Displays sort options for search results
|
|
5
|
+
* Integrates with SearchStateManager for automatic state sync
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface SortOption {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SortByTheme {
|
|
13
|
+
container?: string;
|
|
14
|
+
select?: string;
|
|
15
|
+
option?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SortByProps {
|
|
18
|
+
/** Available sort options */
|
|
19
|
+
options: SortOption[];
|
|
20
|
+
/** Current sort value (controlled mode - overrides StateManager) */
|
|
21
|
+
value?: string;
|
|
22
|
+
/** Default sort value */
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
/** Callback when sort changes */
|
|
25
|
+
onSortChange?: (value: string) => void;
|
|
26
|
+
/** Custom render function for select */
|
|
27
|
+
renderSelect?: (props: {
|
|
28
|
+
value: string;
|
|
29
|
+
onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
30
|
+
options: SortOption[];
|
|
31
|
+
}) => React.ReactNode;
|
|
32
|
+
/** Custom className */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Custom styles */
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
/** Custom theme */
|
|
37
|
+
theme?: SortByTheme;
|
|
38
|
+
/** Placeholder text */
|
|
39
|
+
placeholder?: string;
|
|
40
|
+
/** Whether to sync with SearchStateManager (default: true) */
|
|
41
|
+
syncWithState?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare const SortBy: React.FC<SortByProps>;
|
|
44
|
+
//# sourceMappingURL=SortBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortBy.d.ts","sourceRoot":"","sources":["../../src/components/SortBy.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAoB,MAAM,OAAO,CAAC;AAKzC,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,wCAAwC;IACxC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;QAC5D,OAAO,EAAE,UAAU,EAAE,CAAC;KACvB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,mBAAmB;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8FxC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SortBy Component
|
|
3
|
+
*
|
|
4
|
+
* Displays sort options for search results
|
|
5
|
+
* Integrates with SearchStateManager for automatic state sync
|
|
6
|
+
*/
|
|
7
|
+
import React, { useEffect } from 'react';
|
|
8
|
+
import { useSearchContext } from './SearchProvider';
|
|
9
|
+
import { useSearchState } from '../hooks/useSearchState';
|
|
10
|
+
import { clsx } from 'clsx';
|
|
11
|
+
export const SortBy = ({ options, value: valueProp, defaultValue, onSortChange, renderSelect, className, style, theme: customTheme, placeholder = 'Sort by...', syncWithState = true, }) => {
|
|
12
|
+
const { theme } = useSearchContext();
|
|
13
|
+
const { sortBy: stateManagerSortBy, setSortBy } = useSearchState();
|
|
14
|
+
const sortByTheme = customTheme || {};
|
|
15
|
+
// Initialize with defaultValue or first option
|
|
16
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue || options[0]?.value || '');
|
|
17
|
+
// Sync with StateManager on mount if defaultValue is set
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (syncWithState && defaultValue && !stateManagerSortBy) {
|
|
20
|
+
setSortBy(defaultValue, false); // Don't trigger search on initial sync
|
|
21
|
+
}
|
|
22
|
+
}, []);
|
|
23
|
+
// Determine the current value: controlled prop > StateManager > internal
|
|
24
|
+
const value = valueProp !== undefined
|
|
25
|
+
? valueProp
|
|
26
|
+
: (syncWithState && stateManagerSortBy)
|
|
27
|
+
? stateManagerSortBy
|
|
28
|
+
: internalValue;
|
|
29
|
+
const handleChange = (e) => {
|
|
30
|
+
const newValue = e.target.value;
|
|
31
|
+
setInternalValue(newValue);
|
|
32
|
+
// Update StateManager (automatically triggers search)
|
|
33
|
+
if (syncWithState) {
|
|
34
|
+
setSortBy(newValue);
|
|
35
|
+
}
|
|
36
|
+
// Call callback for backwards compatibility
|
|
37
|
+
if (onSortChange) {
|
|
38
|
+
onSortChange(newValue);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const defaultRenderSelect = () => (React.createElement("select", { value: value, onChange: handleChange, className: clsx(sortByTheme.select, className), style: {
|
|
42
|
+
padding: theme.spacing.small,
|
|
43
|
+
paddingRight: theme.spacing.medium,
|
|
44
|
+
fontSize: theme.typography.fontSize.medium,
|
|
45
|
+
border: `1px solid ${theme.colors.border}`,
|
|
46
|
+
borderRadius: typeof theme.borderRadius === 'string' ? theme.borderRadius : theme.borderRadius.medium,
|
|
47
|
+
backgroundColor: theme.colors.background,
|
|
48
|
+
color: theme.colors.text,
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
outline: 'none',
|
|
51
|
+
...style,
|
|
52
|
+
}, "aria-label": "Sort results" }, options.map((option) => (React.createElement("option", { key: option.value, value: option.value, className: sortByTheme.option }, option.label)))));
|
|
53
|
+
if (renderSelect) {
|
|
54
|
+
return (React.createElement("div", { className: clsx(sortByTheme.container, className), style: style }, renderSelect({
|
|
55
|
+
value,
|
|
56
|
+
onChange: handleChange,
|
|
57
|
+
options,
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
return defaultRenderSelect();
|
|
61
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Component
|
|
3
|
+
*
|
|
4
|
+
* Displays search statistics (total results, processing time, etc.)
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { SearchResponse } from '@seekora-ai/search-sdk';
|
|
8
|
+
export interface StatsTheme {
|
|
9
|
+
container?: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
highlight?: string;
|
|
12
|
+
separator?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface StatsProps {
|
|
15
|
+
/** Search results response */
|
|
16
|
+
results?: SearchResponse | null;
|
|
17
|
+
/** Custom render function */
|
|
18
|
+
renderStats?: (stats: {
|
|
19
|
+
totalResults: number;
|
|
20
|
+
processingTime?: number;
|
|
21
|
+
query?: string;
|
|
22
|
+
}) => React.ReactNode;
|
|
23
|
+
/** Custom className */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Custom styles */
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
/** Custom theme */
|
|
28
|
+
theme?: StatsTheme;
|
|
29
|
+
/** Show processing time */
|
|
30
|
+
showProcessingTime?: boolean;
|
|
31
|
+
/** Show query */
|
|
32
|
+
showQuery?: boolean;
|
|
33
|
+
/** Custom separator between stats */
|
|
34
|
+
separator?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const Stats: React.FC<StatsProps>;
|
|
37
|
+
//# sourceMappingURL=Stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stats.d.ts","sourceRoot":"","sources":["../../src/components/Stats.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,6BAA6B;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,mBAAmB;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA2EtC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Component
|
|
3
|
+
*
|
|
4
|
+
* Displays search statistics (total results, processing time, etc.)
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useSearchContext } from './SearchProvider';
|
|
8
|
+
import { clsx } from 'clsx';
|
|
9
|
+
export const Stats = ({ results, renderStats, className, style, theme: customTheme, showProcessingTime = false, showQuery = false, separator = ' • ', }) => {
|
|
10
|
+
const { theme } = useSearchContext();
|
|
11
|
+
const statsTheme = customTheme || {};
|
|
12
|
+
// Extract stats from results
|
|
13
|
+
const res = results;
|
|
14
|
+
const totalResults = res?.totalResults
|
|
15
|
+
|| res?.data?.total_results
|
|
16
|
+
|| res?.data?.data?.total_results
|
|
17
|
+
|| 0;
|
|
18
|
+
const processingTime = res?.processingTimeMS
|
|
19
|
+
|| res?.data?.processingTimeMS
|
|
20
|
+
|| res?.data?.data?.processingTimeMS;
|
|
21
|
+
const query = (res?.query ?? '');
|
|
22
|
+
const defaultRenderStats = () => {
|
|
23
|
+
const parts = [];
|
|
24
|
+
if (totalResults > 0) {
|
|
25
|
+
parts.push(`${totalResults.toLocaleString()} result${totalResults !== 1 ? 's' : ''}`);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
parts.push('No results');
|
|
29
|
+
}
|
|
30
|
+
if (showProcessingTime && processingTime !== undefined) {
|
|
31
|
+
parts.push(`${processingTime}ms`);
|
|
32
|
+
}
|
|
33
|
+
if (showQuery && query) {
|
|
34
|
+
parts.push(`for "${query}"`);
|
|
35
|
+
}
|
|
36
|
+
return (React.createElement("div", { className: clsx(statsTheme.container, className), style: {
|
|
37
|
+
fontSize: theme.typography.fontSize.medium,
|
|
38
|
+
color: theme.colors.text,
|
|
39
|
+
...style,
|
|
40
|
+
} }, parts.map((part, index) => (React.createElement("span", { key: index },
|
|
41
|
+
index > 0 && React.createElement("span", { className: statsTheme.separator, style: { margin: `0 ${theme.spacing.small}` } }, separator),
|
|
42
|
+
React.createElement("span", { className: statsTheme.text }, part))))));
|
|
43
|
+
};
|
|
44
|
+
if (renderStats) {
|
|
45
|
+
return (React.createElement("div", { className: clsx(statsTheme.container, className), style: style }, renderStats({
|
|
46
|
+
totalResults,
|
|
47
|
+
processingTime,
|
|
48
|
+
query,
|
|
49
|
+
})));
|
|
50
|
+
}
|
|
51
|
+
return defaultRenderStats();
|
|
52
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AmazonDropdown - Amazon-style Search Suggestions
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Department/category scoping in search
|
|
6
|
+
* - Suggestions with category context
|
|
7
|
+
* - Product grid with images
|
|
8
|
+
* - "in Department" suffix for scoped searches
|
|
9
|
+
* - Clean, functional design
|
|
10
|
+
*/
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import type { BaseDropdownProps, DropdownRef } from './types';
|
|
13
|
+
export interface AmazonDropdownProps extends BaseDropdownProps {
|
|
14
|
+
/** Show department scoping in suggestions */
|
|
15
|
+
showDepartments?: boolean;
|
|
16
|
+
/** Current department filter */
|
|
17
|
+
currentDepartment?: string;
|
|
18
|
+
/** Available departments */
|
|
19
|
+
departments?: Array<{
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}>;
|
|
23
|
+
/** Show Prime badge */
|
|
24
|
+
showPrime?: boolean;
|
|
25
|
+
/** Prime icon URL */
|
|
26
|
+
primeIconUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const AmazonDropdown: React.ForwardRefExoticComponent<AmazonDropdownProps & React.RefAttributes<DropdownRef>>;
|
|
29
|
+
export default AmazonDropdown;
|
|
30
|
+
//# sourceMappingURL=AmazonDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmazonDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/AmazonDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiV9D,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4BAA4B;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,yFAmd1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|