@seekora-ai/ui-sdk-react 0.2.14 → 0.2.16
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/CurrentRefinements.d.ts.map +1 -1
- package/dist/components/CurrentRefinements.js +69 -9
- package/dist/components/FacetDropdown.d.ts +94 -0
- package/dist/components/FacetDropdown.d.ts.map +1 -0
- package/dist/components/FacetDropdown.js +396 -0
- package/dist/components/Facets.d.ts +30 -0
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +215 -7
- package/dist/components/FederatedDropdown.d.ts.map +1 -1
- package/dist/components/FederatedDropdown.js +45 -31
- package/dist/components/InfiniteHits.d.ts +0 -7
- package/dist/components/InfiniteHits.d.ts.map +1 -1
- package/dist/components/InfiniteHits.js +2 -13
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +27 -9
- package/dist/components/QuerySuggestions.d.ts +0 -4
- package/dist/components/QuerySuggestions.d.ts.map +1 -1
- package/dist/components/QuerySuggestions.js +1 -17
- package/dist/components/QuerySuggestionsDropdown.d.ts +0 -4
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -1
- package/dist/components/QuerySuggestionsDropdown.js +32 -33
- package/dist/components/RangeInput.d.ts.map +1 -1
- package/dist/components/RangeInput.js +6 -6
- package/dist/components/RangeSlider.d.ts.map +1 -1
- package/dist/components/RangeSlider.js +54 -32
- package/dist/components/Recommendations.d.ts +0 -7
- package/dist/components/Recommendations.d.ts.map +1 -1
- package/dist/components/Recommendations.js +3 -23
- package/dist/components/RichQuerySuggestions.d.ts +0 -4
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +40 -35
- package/dist/components/SearchBar.d.ts +0 -4
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +17 -11
- package/dist/components/SearchBarWithSuggestions.js +4 -4
- package/dist/components/SearchLayout.d.ts.map +1 -1
- package/dist/components/SearchLayout.js +22 -17
- package/dist/components/SearchProvider.d.ts.map +1 -1
- package/dist/components/SearchProvider.js +1 -3
- package/dist/components/SearchResults.d.ts +0 -6
- package/dist/components/SearchResults.d.ts.map +1 -1
- package/dist/components/SearchResults.js +38 -39
- package/dist/components/primitives/ActionButtons.d.ts.map +1 -1
- package/dist/components/primitives/ActionButtons.js +34 -10
- package/dist/components/primitives/BadgeList.d.ts.map +1 -1
- package/dist/components/primitives/BadgeList.js +33 -13
- package/dist/components/primitives/ImageDisplay.d.ts.map +1 -1
- package/dist/components/primitives/ImageDisplay.js +32 -19
- package/dist/components/primitives/ImageZoom.d.ts.map +1 -1
- package/dist/components/primitives/ImageZoom.js +85 -30
- package/dist/components/primitives/VariantSelector.js +10 -10
- package/dist/components/primitives/VariantSwatches.d.ts.map +1 -1
- package/dist/components/primitives/VariantSwatches.js +28 -13
- package/dist/components/product-page/ProductGallery.d.ts +8 -1
- package/dist/components/product-page/ProductGallery.d.ts.map +1 -1
- package/dist/components/product-page/ProductGallery.js +2 -2
- package/dist/components/section-primitives/SectionItemGrid.d.ts +1 -3
- package/dist/components/section-primitives/SectionItemGrid.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionItemGrid.js +1 -4
- package/dist/components/section-primitives/SectionSearchProvider.d.ts +3 -1
- package/dist/components/section-primitives/SectionSearchProvider.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionSearchProvider.js +3 -2
- package/dist/components/section-primitives/index.d.ts +0 -1
- package/dist/components/section-primitives/index.d.ts.map +1 -1
- package/dist/components/section-primitives/index.js +0 -1
- package/dist/components/suggestions/AmazonDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/AmazonDropdown.js +3 -21
- package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/GoogleDropdown.js +3 -20
- package/dist/components/suggestions/MinimalDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MinimalDropdown.js +2 -2
- package/dist/components/suggestions/MobileSheetDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MobileSheetDropdown.js +78 -78
- package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/PinterestDropdown.js +41 -41
- package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/ShopifyDropdown.js +40 -41
- package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/SpotlightDropdown.js +2 -3
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -1
- package/dist/components/suggestions/SuggestionSearchBar.js +2 -15
- package/dist/components/suggestions/types.d.ts +0 -6
- package/dist/components/suggestions/types.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/DropdownPanel.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/DropdownPanel.js +15 -2
- package/dist/components/suggestions-primitives/ItemCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemCard.js +48 -11
- package/dist/components/suggestions-primitives/ItemGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemGrid.js +18 -5
- package/dist/components/suggestions-primitives/ProductCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCard.js +36 -12
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +52 -20
- package/dist/components/suggestions-primitives/ProductGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductGrid.js +8 -3
- package/dist/components/suggestions-primitives/RecentSearchesList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/RecentSearchesList.js +12 -5
- package/dist/components/suggestions-primitives/SearchInput.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SearchInput.js +29 -10
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +8 -3
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +1 -8
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.js +1 -7
- package/dist/components/suggestions-primitives/TrendingList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/TrendingList.js +14 -7
- package/dist/components/suggestions-primitives/index.d.ts +1 -3
- package/dist/components/suggestions-primitives/index.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/index.js +1 -2
- package/dist/docsearch/components/DocSearch.d.ts.map +1 -1
- package/dist/docsearch/components/DocSearch.js +1 -1
- package/dist/docsearch/components/Results.d.ts +1 -3
- package/dist/docsearch/components/Results.d.ts.map +1 -1
- package/dist/docsearch/components/Results.js +1 -9
- package/dist/docsearch/components/SearchBox.d.ts +1 -2
- package/dist/docsearch/components/SearchBox.d.ts.map +1 -1
- package/dist/docsearch/components/SearchBox.js +4 -6
- package/dist/docsearch/hooks/useSeekoraSearch.d.ts.map +1 -1
- package/dist/docsearch/hooks/useSeekoraSearch.js +6 -0
- package/dist/docsearch/types.d.ts +0 -1
- package/dist/docsearch/types.d.ts.map +1 -1
- package/dist/docsearch.css +2 -5
- package/dist/hooks/useClickTracking.d.ts.map +1 -1
- package/dist/hooks/useClickTracking.js +4 -11
- package/dist/hooks/useExperiment.d.ts.map +1 -1
- package/dist/hooks/useExperiment.js +10 -33
- package/dist/hooks/useFilters.d.ts +27 -0
- package/dist/hooks/useFilters.d.ts.map +1 -0
- package/dist/hooks/useFilters.js +66 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +166 -81
- package/dist/src/index.esm.js +2141 -1048
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +2142 -1049
- package/dist/src/index.js.map +1 -1
- package/dist/utils/responsive.d.ts +130 -0
- package/dist/utils/responsive.d.ts.map +1 -0
- package/dist/utils/responsive.js +231 -0
- package/package.json +7 -7
- package/src/docsearch/docsearch.css +2 -5
|
@@ -11,10 +11,26 @@ export interface FacetItem {
|
|
|
11
11
|
count: number;
|
|
12
12
|
selected?: boolean;
|
|
13
13
|
}
|
|
14
|
+
export interface FacetStats {
|
|
15
|
+
min: number;
|
|
16
|
+
max: number;
|
|
17
|
+
avg?: number;
|
|
18
|
+
sum?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface FacetRangeItem {
|
|
21
|
+
label: string;
|
|
22
|
+
from?: number;
|
|
23
|
+
to?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface FacetRangeConfig {
|
|
26
|
+
field: string;
|
|
27
|
+
ranges: FacetRangeItem[];
|
|
28
|
+
}
|
|
14
29
|
export interface Facet {
|
|
15
30
|
field: string;
|
|
16
31
|
label?: string;
|
|
17
32
|
items: FacetItem[];
|
|
33
|
+
stats?: FacetStats;
|
|
18
34
|
}
|
|
19
35
|
export interface FacetsTheme {
|
|
20
36
|
container?: string;
|
|
@@ -41,6 +57,14 @@ export interface FacetsTheme {
|
|
|
41
57
|
collapsibleIcon?: string;
|
|
42
58
|
/** Count badge pill */
|
|
43
59
|
countBadge?: string;
|
|
60
|
+
/** Range button (pre-configured range option) */
|
|
61
|
+
rangeButton?: string;
|
|
62
|
+
/** Active range button */
|
|
63
|
+
rangeButtonActive?: string;
|
|
64
|
+
/** Count badge on range button */
|
|
65
|
+
rangeButtonCount?: string;
|
|
66
|
+
/** Clear button for range filters */
|
|
67
|
+
rangeClear?: string;
|
|
44
68
|
}
|
|
45
69
|
export type FacetVariant = 'checkbox' | 'color-swatch' | 'collapsible';
|
|
46
70
|
export type FacetSize = 'small' | 'medium' | 'large';
|
|
@@ -77,6 +101,12 @@ export interface FacetsProps {
|
|
|
77
101
|
defaultCollapsed?: boolean;
|
|
78
102
|
/** Size preset: small, medium (default), or large */
|
|
79
103
|
size?: FacetSize;
|
|
104
|
+
/** Pre-configured range button definitions for numeric facets */
|
|
105
|
+
facetRanges?: FacetRangeConfig[];
|
|
106
|
+
/** Use dedicated Filters API instead of extracting facets from search results */
|
|
107
|
+
useFiltersApi?: boolean;
|
|
108
|
+
/** Fields that should use disjunctive (OR) faceting (only with useFiltersApi) */
|
|
109
|
+
disjunctiveFacets?: string[];
|
|
80
110
|
}
|
|
81
111
|
export declare const Facets: React.FC<FacetsProps>;
|
|
82
112
|
//# sourceMappingURL=Facets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Facets.d.ts","sourceRoot":"","sources":["../../src/components/Facets.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Facets.d.ts","sourceRoot":"","sources":["../../src/components/Facets.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,W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C,WAAW,CAilCxC,CAAC"}
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
import React, { useState, useMemo } from 'react';
|
|
8
8
|
import { useSearchContext } from './SearchProvider';
|
|
9
9
|
import { useSearchState } from '../hooks/useSearchState';
|
|
10
|
+
import { useFilters } from '../hooks/useFilters';
|
|
10
11
|
import { log } from '@seekora-ai/ui-sdk-core';
|
|
11
12
|
import { clsx } from 'clsx';
|
|
13
|
+
import { RangeSlider } from './RangeSlider';
|
|
12
14
|
// ---------------------------------------------------------------------------
|
|
13
15
|
// Helpers
|
|
14
16
|
// ---------------------------------------------------------------------------
|
|
@@ -52,20 +54,24 @@ const CheckmarkIcon = ({ size = 16 }) => (React.createElement("svg", { width: si
|
|
|
52
54
|
// CSS variable defaults
|
|
53
55
|
// ---------------------------------------------------------------------------
|
|
54
56
|
const CSS_VAR_DEFAULTS = {
|
|
55
|
-
'--seekora-facet-bg': '
|
|
57
|
+
'--seekora-facet-bg': 'transparent',
|
|
56
58
|
'--seekora-facet-border': '#dee2e6',
|
|
57
|
-
'--seekora-facet-active-bg': '
|
|
59
|
+
'--seekora-facet-active-bg': 'rgba(0, 0, 0, 0.05)',
|
|
58
60
|
'--seekora-facet-swatch-size': '32px',
|
|
59
61
|
'--seekora-facet-count-bg': '#e9ecef',
|
|
60
62
|
'--seekora-facet-count-color': '#495057',
|
|
63
|
+
'--seekora-primary': '#3b82f6',
|
|
64
|
+
'--seekora-primary-text': '#ffffff',
|
|
61
65
|
};
|
|
62
66
|
// ---------------------------------------------------------------------------
|
|
63
67
|
// Component
|
|
64
68
|
// ---------------------------------------------------------------------------
|
|
65
|
-
export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange, renderFacet, renderFacetItem, maxItems = 10, showMore = true, className, style, theme: customTheme, variant = 'checkbox', searchable = false, showCounts = true, colorMap, defaultCollapsed = false, size = 'medium', }) => {
|
|
69
|
+
export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange, renderFacet, renderFacetItem, maxItems = 10, showMore = true, className, style, theme: customTheme, variant = 'checkbox', searchable = false, showCounts = true, colorMap, defaultCollapsed = false, size = 'medium', facetRanges, useFiltersApi = false, disjunctiveFacets, }) => {
|
|
66
70
|
const { theme } = useSearchContext();
|
|
67
71
|
const { results: stateResults, refinements, addRefinement, removeRefinement } = useSearchState();
|
|
68
72
|
const facetsTheme = customTheme || {};
|
|
73
|
+
// Use dedicated Filters API when useFiltersApi is enabled
|
|
74
|
+
const { filters: filtersApiData, searchFacetValues } = useFilters(useFiltersApi ? { disjunctiveFacets } : { autoFetch: false });
|
|
69
75
|
// expandedFacets is used for "Show more/less" in checkbox/color-swatch variants
|
|
70
76
|
// AND for collapse/expand in collapsible variant.
|
|
71
77
|
const [expandedFacets, setExpandedFacets] = useState({});
|
|
@@ -73,11 +79,27 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
73
79
|
// Use results from prop if provided, otherwise from state manager
|
|
74
80
|
const results = resultsProp || stateResults;
|
|
75
81
|
// -------------------------------------------------------------------
|
|
76
|
-
// Extract facets from results
|
|
82
|
+
// Extract facets from results (or Filters API)
|
|
77
83
|
// -------------------------------------------------------------------
|
|
78
84
|
const extractFacets = () => {
|
|
79
85
|
if (facetsProp)
|
|
80
86
|
return facetsProp;
|
|
87
|
+
// When using Filters API, convert FilterField[] to Facet[]
|
|
88
|
+
if (useFiltersApi && filtersApiData.length > 0) {
|
|
89
|
+
log.verbose('Facets: Using Filters API data', { filterCount: filtersApiData.length });
|
|
90
|
+
return filtersApiData.map((filter) => ({
|
|
91
|
+
field: filter.field || '',
|
|
92
|
+
label: filter.field || '',
|
|
93
|
+
items: (filter.values || []).map((v) => ({
|
|
94
|
+
value: v.value || '',
|
|
95
|
+
count: v.count || 0,
|
|
96
|
+
selected: refinements.some(r => r.field === filter.field && r.value === v.value),
|
|
97
|
+
})),
|
|
98
|
+
stats: filter.stats?.min != null && filter.stats?.max != null
|
|
99
|
+
? { min: filter.stats.min, max: filter.stats.max, avg: filter.stats.avg, sum: filter.stats.sum }
|
|
100
|
+
: undefined,
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
81
103
|
// Try to get facets from various locations in the response
|
|
82
104
|
// Primary location: data.facets (widget_mode response structure)
|
|
83
105
|
const rawFacets = results?.data?.facets
|
|
@@ -112,6 +134,7 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
112
134
|
count: count.count,
|
|
113
135
|
selected: refinements.some(r => r.field === fieldName && r.value === count.value),
|
|
114
136
|
})) : [],
|
|
137
|
+
stats: facet.stats || undefined,
|
|
115
138
|
};
|
|
116
139
|
});
|
|
117
140
|
log.verbose('Facets: Extracted facets', {
|
|
@@ -189,7 +212,7 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
189
212
|
const sizeScale = useMemo(() => {
|
|
190
213
|
switch (size) {
|
|
191
214
|
case 'small':
|
|
192
|
-
return { font: theme.typography.fontSize.small, padding: '0.
|
|
215
|
+
return { font: theme.typography.fontSize.small, padding: '0.5rem', gap: '0.5rem' };
|
|
193
216
|
case 'large':
|
|
194
217
|
return { font: theme.typography.fontSize.large, padding: '0.75rem', gap: '0.75rem' };
|
|
195
218
|
case 'medium':
|
|
@@ -258,6 +281,7 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
258
281
|
? 'var(--seekora-facet-active-bg, ' + theme.colors.hover + ')'
|
|
259
282
|
: 'transparent',
|
|
260
283
|
transition: 'background-color 0.2s ease',
|
|
284
|
+
boxSizing: 'border-box',
|
|
261
285
|
} },
|
|
262
286
|
React.createElement("input", { type: "checkbox", checked: refinements.some(r => r.field === facet.field && r.value === item.value) || item.selected || false, onChange: () => handleFacetToggle(facet.field, item.value, item.selected || false), className: facetsTheme.checkbox, style: {
|
|
263
287
|
marginRight: sizeScale.gap,
|
|
@@ -266,6 +290,7 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
266
290
|
React.createElement("span", { className: facetsTheme.facetItemLabel, style: {
|
|
267
291
|
flex: 1,
|
|
268
292
|
fontSize: sizeScale.font,
|
|
293
|
+
lineHeight: 1.5,
|
|
269
294
|
color: theme.colors.text,
|
|
270
295
|
} }, item.value),
|
|
271
296
|
renderCountBadge(item.count)));
|
|
@@ -294,13 +319,13 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
294
319
|
borderRadius: '50%',
|
|
295
320
|
backgroundColor: color,
|
|
296
321
|
border: isChecked
|
|
297
|
-
? `3px solid ${theme.colors.primary}`
|
|
322
|
+
? `3px solid var(--seekora-primary, ${theme.colors.primary})`
|
|
298
323
|
: `2px solid var(--seekora-facet-border, ${theme.colors.border})`,
|
|
299
324
|
display: 'flex',
|
|
300
325
|
alignItems: 'center',
|
|
301
326
|
justifyContent: 'center',
|
|
302
327
|
transition: 'border 0.2s ease, box-shadow 0.2s ease',
|
|
303
|
-
boxShadow: isChecked ? `0 0 0 2px ${theme.colors.primary}33` : 'none',
|
|
328
|
+
boxShadow: isChecked ? `0 0 0 2px var(--seekora-primary-alpha, ${theme.colors.primary}33)` : 'none',
|
|
304
329
|
position: 'relative',
|
|
305
330
|
} }, isChecked && (React.createElement("span", { className: clsx(facetsTheme.colorSwatchInner), style: {
|
|
306
331
|
display: 'flex',
|
|
@@ -526,9 +551,192 @@ export const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange
|
|
|
526
551
|
} }, "Show less"))))));
|
|
527
552
|
};
|
|
528
553
|
// -------------------------------------------------------------------
|
|
554
|
+
// Render-type detection for numeric / range facets
|
|
555
|
+
// -------------------------------------------------------------------
|
|
556
|
+
const determineFacetRenderType = (fieldName, stats) => {
|
|
557
|
+
// If explicit range config exists for this field → range buttons
|
|
558
|
+
if (facetRanges?.some((rc) => rc.field === fieldName)) {
|
|
559
|
+
return 'range-buttons';
|
|
560
|
+
}
|
|
561
|
+
// If stats with valid min/max → range slider
|
|
562
|
+
if (stats && typeof stats.min === 'number' && typeof stats.max === 'number' && stats.min !== stats.max) {
|
|
563
|
+
return 'range-slider';
|
|
564
|
+
}
|
|
565
|
+
return 'list';
|
|
566
|
+
};
|
|
567
|
+
// -------------------------------------------------------------------
|
|
568
|
+
// Range button facet renderer
|
|
569
|
+
// -------------------------------------------------------------------
|
|
570
|
+
const renderRangeButtonFacet = (facet, _index) => {
|
|
571
|
+
const rangeConfig = facetRanges?.find((rc) => rc.field === facet.field);
|
|
572
|
+
if (!rangeConfig)
|
|
573
|
+
return null;
|
|
574
|
+
// Build a lookup from item value → count
|
|
575
|
+
const countMap = new Map();
|
|
576
|
+
facet.items.forEach((item) => countMap.set(item.value, item.count));
|
|
577
|
+
// Detect currently active range from refinements
|
|
578
|
+
const activeMin = refinements.find((r) => r.field === facet.field && r.value.startsWith('>='));
|
|
579
|
+
const activeMax = refinements.find((r) => r.field === facet.field && r.value.startsWith('<='));
|
|
580
|
+
const activeFromVal = activeMin ? parseFloat(activeMin.value.slice(2)) : undefined;
|
|
581
|
+
const activeToVal = activeMax ? parseFloat(activeMax.value.slice(2)) : undefined;
|
|
582
|
+
const isRangeActive = (range) => {
|
|
583
|
+
const fromMatch = range.from === undefined
|
|
584
|
+
? activeFromVal === undefined
|
|
585
|
+
: activeFromVal === range.from;
|
|
586
|
+
const toMatch = range.to === undefined
|
|
587
|
+
? activeToVal === undefined
|
|
588
|
+
: activeToVal === range.to;
|
|
589
|
+
return fromMatch && toMatch;
|
|
590
|
+
};
|
|
591
|
+
const handleRangeClick = (range) => {
|
|
592
|
+
// Clear existing range refinements for this field
|
|
593
|
+
refinements
|
|
594
|
+
.filter((r) => r.field === facet.field)
|
|
595
|
+
.forEach((r) => removeRefinement(facet.field, r.value, false));
|
|
596
|
+
if (isRangeActive(range)) {
|
|
597
|
+
// Was active → just clear (already removed above), trigger search
|
|
598
|
+
addRefinement(facet.field, '__noop__', false);
|
|
599
|
+
removeRefinement(facet.field, '__noop__', true);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
// Set new range
|
|
603
|
+
if (range.from !== undefined) {
|
|
604
|
+
addRefinement(facet.field, `>=${range.from}`, false);
|
|
605
|
+
}
|
|
606
|
+
if (range.to !== undefined) {
|
|
607
|
+
addRefinement(facet.field, `<=${range.to}`, true);
|
|
608
|
+
}
|
|
609
|
+
else if (range.from !== undefined) {
|
|
610
|
+
// Only "from" set — trigger search
|
|
611
|
+
addRefinement(facet.field, `>=${range.from}`, true);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
const hasActiveRange = activeMin !== undefined || activeMax !== undefined;
|
|
615
|
+
const handleClear = () => {
|
|
616
|
+
refinements
|
|
617
|
+
.filter((r) => r.field === facet.field)
|
|
618
|
+
.forEach((r) => removeRefinement(facet.field, r.value, false));
|
|
619
|
+
// Trigger search after clearing
|
|
620
|
+
addRefinement(facet.field, '__noop__', false);
|
|
621
|
+
removeRefinement(facet.field, '__noop__', true);
|
|
622
|
+
};
|
|
623
|
+
return (React.createElement("div", { key: facet.field, className: facetsTheme.facet, style: {
|
|
624
|
+
marginBottom: theme.spacing.large,
|
|
625
|
+
padding: theme.spacing.medium,
|
|
626
|
+
backgroundColor: 'var(--seekora-facet-bg, ' + theme.colors.background + ')',
|
|
627
|
+
border: `1px solid var(--seekora-facet-border, ${theme.colors.border})`,
|
|
628
|
+
borderRadius: typeof theme.borderRadius === 'string' ? theme.borderRadius : theme.borderRadius.medium,
|
|
629
|
+
} },
|
|
630
|
+
React.createElement("h3", { className: facetsTheme.facetTitle, style: {
|
|
631
|
+
fontSize: theme.typography.fontSize.large,
|
|
632
|
+
fontWeight: 'bold',
|
|
633
|
+
margin: 0,
|
|
634
|
+
marginBottom: theme.spacing.medium,
|
|
635
|
+
color: theme.colors.text,
|
|
636
|
+
} }, facet.label || facet.field),
|
|
637
|
+
React.createElement("div", { style: {
|
|
638
|
+
display: 'flex',
|
|
639
|
+
flexWrap: 'wrap',
|
|
640
|
+
gap: sizeScale.gap,
|
|
641
|
+
} }, rangeConfig.ranges.map((range) => {
|
|
642
|
+
const count = countMap.get(range.label) ?? 0;
|
|
643
|
+
const active = isRangeActive(range);
|
|
644
|
+
return (React.createElement("button", { key: range.label, type: "button", className: clsx(facetsTheme.rangeButton, active && facetsTheme.rangeButtonActive), disabled: count === 0 && !active, onClick: () => handleRangeClick(range), style: {
|
|
645
|
+
display: 'inline-flex',
|
|
646
|
+
alignItems: 'center',
|
|
647
|
+
gap: '0.35em',
|
|
648
|
+
padding: `${sizeScale.padding} 0.75em`,
|
|
649
|
+
fontSize: sizeScale.font,
|
|
650
|
+
border: `1px solid ${active ? 'var(--seekora-primary, ' + theme.colors.primary + ')' : 'var(--seekora-facet-border, ' + theme.colors.border + ')'}`,
|
|
651
|
+
borderRadius: typeof theme.borderRadius === 'string' ? theme.borderRadius : theme.borderRadius.full,
|
|
652
|
+
backgroundColor: active ? 'var(--seekora-primary, ' + theme.colors.primary + ')' : 'var(--seekora-facet-bg, ' + theme.colors.background + ')',
|
|
653
|
+
color: active ? 'var(--seekora-primary-text, #fff)' : theme.colors.text,
|
|
654
|
+
cursor: count === 0 && !active ? 'not-allowed' : 'pointer',
|
|
655
|
+
opacity: count === 0 && !active ? 0.5 : 1,
|
|
656
|
+
transition: 'all 0.2s ease',
|
|
657
|
+
} },
|
|
658
|
+
range.label,
|
|
659
|
+
showCounts && (React.createElement("span", { className: clsx(facetsTheme.rangeButtonCount), style: {
|
|
660
|
+
fontSize: theme.typography.fontSize.small,
|
|
661
|
+
opacity: 0.8,
|
|
662
|
+
} },
|
|
663
|
+
"(",
|
|
664
|
+
count,
|
|
665
|
+
")"))));
|
|
666
|
+
})),
|
|
667
|
+
hasActiveRange && (React.createElement("button", { type: "button", className: clsx(facetsTheme.rangeClear), onClick: handleClear, style: {
|
|
668
|
+
marginTop: sizeScale.gap,
|
|
669
|
+
padding: sizeScale.padding,
|
|
670
|
+
border: 'none',
|
|
671
|
+
backgroundColor: 'transparent',
|
|
672
|
+
color: theme.colors.primary,
|
|
673
|
+
cursor: 'pointer',
|
|
674
|
+
fontSize: theme.typography.fontSize.small,
|
|
675
|
+
textDecoration: 'underline',
|
|
676
|
+
} }, "Clear"))));
|
|
677
|
+
};
|
|
678
|
+
// -------------------------------------------------------------------
|
|
679
|
+
// Range slider facet renderer
|
|
680
|
+
// -------------------------------------------------------------------
|
|
681
|
+
const renderRangeSliderFacet = (facet, _index) => {
|
|
682
|
+
if (!facet.stats)
|
|
683
|
+
return null;
|
|
684
|
+
const { min: statsMin, max: statsMax } = facet.stats;
|
|
685
|
+
// Auto-detect formatting for common field names
|
|
686
|
+
const fieldLower = facet.field.toLowerCase();
|
|
687
|
+
const isPriceField = fieldLower.includes('price') || fieldLower.includes('cost') || fieldLower.includes('amount');
|
|
688
|
+
const formatValue = isPriceField
|
|
689
|
+
? (v) => `$${v.toFixed(2)}`
|
|
690
|
+
: (v) => v.toString();
|
|
691
|
+
// Determine step: use 0.01 for price, 1 for integer ranges, 0.1 otherwise
|
|
692
|
+
const range = statsMax - statsMin;
|
|
693
|
+
const step = isPriceField ? 0.01 : range > 10 ? 1 : 0.1;
|
|
694
|
+
// Check if there's an active range refinement
|
|
695
|
+
const hasActiveRange = refinements.some((r) => r.field === facet.field && (r.value.startsWith('>=') || r.value.startsWith('<=')));
|
|
696
|
+
const handleClear = () => {
|
|
697
|
+
refinements
|
|
698
|
+
.filter((r) => r.field === facet.field && (r.value.startsWith('>=') || r.value.startsWith('<=')))
|
|
699
|
+
.forEach((r) => removeRefinement(facet.field, r.value, false));
|
|
700
|
+
// Trigger search after clearing
|
|
701
|
+
addRefinement(facet.field, '__noop__', false);
|
|
702
|
+
removeRefinement(facet.field, '__noop__', true);
|
|
703
|
+
};
|
|
704
|
+
return (React.createElement("div", { key: facet.field, className: facetsTheme.facet, style: {
|
|
705
|
+
marginBottom: theme.spacing.large,
|
|
706
|
+
padding: theme.spacing.medium,
|
|
707
|
+
backgroundColor: 'var(--seekora-facet-bg, ' + theme.colors.background + ')',
|
|
708
|
+
border: `1px solid var(--seekora-facet-border, ${theme.colors.border})`,
|
|
709
|
+
borderRadius: typeof theme.borderRadius === 'string' ? theme.borderRadius : theme.borderRadius.medium,
|
|
710
|
+
} },
|
|
711
|
+
React.createElement("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: theme.spacing.small } },
|
|
712
|
+
React.createElement("h3", { className: facetsTheme.facetTitle, style: {
|
|
713
|
+
fontSize: theme.typography.fontSize.large,
|
|
714
|
+
fontWeight: 'bold',
|
|
715
|
+
margin: 0,
|
|
716
|
+
color: theme.colors.text,
|
|
717
|
+
} }, facet.label || facet.field),
|
|
718
|
+
hasActiveRange && (React.createElement("button", { type: "button", className: clsx(facetsTheme.rangeClear), onClick: handleClear, style: {
|
|
719
|
+
padding: '0.15em 0.5em',
|
|
720
|
+
border: 'none',
|
|
721
|
+
backgroundColor: 'transparent',
|
|
722
|
+
color: theme.colors.primary,
|
|
723
|
+
cursor: 'pointer',
|
|
724
|
+
fontSize: theme.typography.fontSize.small,
|
|
725
|
+
textDecoration: 'underline',
|
|
726
|
+
} }, "Clear"))),
|
|
727
|
+
React.createElement(RangeSlider, { field: facet.field, min: statsMin, max: statsMax, step: step, formatValue: formatValue, syncWithState: true })));
|
|
728
|
+
};
|
|
729
|
+
// -------------------------------------------------------------------
|
|
529
730
|
// Default facet renderer dispatcher
|
|
530
731
|
// -------------------------------------------------------------------
|
|
531
732
|
const defaultRenderFacet = (facet, index) => {
|
|
733
|
+
const renderType = determineFacetRenderType(facet.field, facet.stats);
|
|
734
|
+
if (renderType === 'range-buttons') {
|
|
735
|
+
return renderRangeButtonFacet(facet, index);
|
|
736
|
+
}
|
|
737
|
+
if (renderType === 'range-slider') {
|
|
738
|
+
return renderRangeSliderFacet(facet, index);
|
|
739
|
+
}
|
|
532
740
|
switch (variant) {
|
|
533
741
|
case 'color-swatch':
|
|
534
742
|
return renderColorSwatchFacet(facet, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederatedDropdown.d.ts","sourceRoot":"","sources":["../../src/components/FederatedDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EAEZ,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"FederatedDropdown.d.ts","sourceRoot":"","sources":["../../src/components/FederatedDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EAEZ,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAuBlC,MAAM,WAAW,sBAAuB,SAAQ,6BAA6B;IAC3E,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,4BAA4B;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IA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,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iDAAiD;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+EAA+E;IAC/E,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAsRD,eAAO,MAAM,iBAAiB,qGAye7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -15,20 +15,34 @@ import { useSearchContext } from './SearchProvider';
|
|
|
15
15
|
import { useQuerySuggestionsEnhanced } from '../hooks/useQuerySuggestionsEnhanced';
|
|
16
16
|
import { clsx } from 'clsx';
|
|
17
17
|
// ============================================================================
|
|
18
|
+
// Constants
|
|
19
|
+
// ============================================================================
|
|
20
|
+
const TRANSITIONS = {
|
|
21
|
+
fast: '150ms ease-in-out',
|
|
22
|
+
normal: '200ms ease-in-out',
|
|
23
|
+
slow: '300ms ease-in-out',
|
|
24
|
+
};
|
|
25
|
+
const BORDER_RADIUS = {
|
|
26
|
+
sm: 4,
|
|
27
|
+
md: 6,
|
|
28
|
+
lg: 8,
|
|
29
|
+
full: 9999,
|
|
30
|
+
};
|
|
31
|
+
// ============================================================================
|
|
18
32
|
// Styles
|
|
19
33
|
// ============================================================================
|
|
20
34
|
const styles = {
|
|
21
35
|
container: {
|
|
22
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
23
|
-
border: '1px solid var(--seekora-border-color,
|
|
24
|
-
borderRadius:
|
|
36
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
37
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
38
|
+
borderRadius: `var(--seekora-border-radius-lg, ${BORDER_RADIUS.lg * 1.5}px)`,
|
|
25
39
|
boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
|
|
26
40
|
overflow: 'hidden',
|
|
27
41
|
},
|
|
28
42
|
header: {
|
|
29
43
|
padding: '12px 20px',
|
|
30
|
-
borderBottom: '1px solid var(--seekora-border-color,
|
|
31
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
44
|
+
borderBottom: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
45
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
32
46
|
},
|
|
33
47
|
content: {
|
|
34
48
|
display: 'flex',
|
|
@@ -38,13 +52,13 @@ const styles = {
|
|
|
38
52
|
flexDirection: 'column',
|
|
39
53
|
},
|
|
40
54
|
suggestionsColumn: {
|
|
41
|
-
borderRight: '1px solid var(--seekora-border-color,
|
|
55
|
+
borderRight: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
42
56
|
overflowY: 'auto',
|
|
43
57
|
},
|
|
44
58
|
productsColumn: {
|
|
45
59
|
flex: 1,
|
|
46
60
|
overflowY: 'auto',
|
|
47
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
61
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
48
62
|
},
|
|
49
63
|
section: {
|
|
50
64
|
padding: '12px 0',
|
|
@@ -75,7 +89,7 @@ const styles = {
|
|
|
75
89
|
alignItems: 'center',
|
|
76
90
|
padding: '10px 20px',
|
|
77
91
|
cursor: 'pointer',
|
|
78
|
-
transition:
|
|
92
|
+
transition: `background-color ${TRANSITIONS.fast}`,
|
|
79
93
|
gap: '12px',
|
|
80
94
|
},
|
|
81
95
|
suggestionItemActive: {
|
|
@@ -90,7 +104,7 @@ const styles = {
|
|
|
90
104
|
suggestionText: {
|
|
91
105
|
flex: 1,
|
|
92
106
|
fontSize: '14px',
|
|
93
|
-
color: 'var(--seekora-text-primary,
|
|
107
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
94
108
|
fontWeight: 500,
|
|
95
109
|
overflow: 'hidden',
|
|
96
110
|
textOverflow: 'ellipsis',
|
|
@@ -114,7 +128,7 @@ const styles = {
|
|
|
114
128
|
display: 'flex',
|
|
115
129
|
gap: '4px',
|
|
116
130
|
padding: '12px 20px',
|
|
117
|
-
borderBottom: '1px solid var(--seekora-border-color,
|
|
131
|
+
borderBottom: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
118
132
|
overflowX: 'auto',
|
|
119
133
|
},
|
|
120
134
|
tab: {
|
|
@@ -124,13 +138,13 @@ const styles = {
|
|
|
124
138
|
padding: '8px 16px',
|
|
125
139
|
fontSize: '13px',
|
|
126
140
|
fontWeight: 500,
|
|
127
|
-
color: 'var(--seekora-text-secondary,
|
|
141
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
128
142
|
backgroundColor: 'transparent',
|
|
129
143
|
border: '1px solid transparent',
|
|
130
|
-
borderRadius:
|
|
144
|
+
borderRadius: `${BORDER_RADIUS.full}px`,
|
|
131
145
|
cursor: 'pointer',
|
|
132
146
|
whiteSpace: 'nowrap',
|
|
133
|
-
transition:
|
|
147
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
134
148
|
},
|
|
135
149
|
tabActive: {
|
|
136
150
|
color: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -141,8 +155,8 @@ const styles = {
|
|
|
141
155
|
fontSize: '11px',
|
|
142
156
|
fontWeight: 600,
|
|
143
157
|
padding: '2px 6px',
|
|
144
|
-
borderRadius:
|
|
145
|
-
backgroundColor: 'var(--seekora-bg-tertiary,
|
|
158
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
159
|
+
backgroundColor: 'var(--seekora-bg-tertiary, rgba(255, 255, 255, 0.1))',
|
|
146
160
|
},
|
|
147
161
|
tabCountActive: {
|
|
148
162
|
backgroundColor: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -157,12 +171,12 @@ const styles = {
|
|
|
157
171
|
productCard: {
|
|
158
172
|
display: 'flex',
|
|
159
173
|
flexDirection: 'column',
|
|
160
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
161
|
-
borderRadius:
|
|
174
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
175
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
162
176
|
overflow: 'hidden',
|
|
163
177
|
cursor: 'pointer',
|
|
164
|
-
transition:
|
|
165
|
-
border: '1px solid var(--seekora-border-color,
|
|
178
|
+
transition: `transform ${TRANSITIONS.fast}, box-shadow ${TRANSITIONS.fast}`,
|
|
179
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
166
180
|
},
|
|
167
181
|
productCardHover: {
|
|
168
182
|
transform: 'translateY(-2px)',
|
|
@@ -180,7 +194,7 @@ const styles = {
|
|
|
180
194
|
productTitle: {
|
|
181
195
|
fontSize: '13px',
|
|
182
196
|
fontWeight: 500,
|
|
183
|
-
color: 'var(--seekora-text-primary,
|
|
197
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
184
198
|
margin: 0,
|
|
185
199
|
overflow: 'hidden',
|
|
186
200
|
textOverflow: 'ellipsis',
|
|
@@ -208,12 +222,12 @@ const styles = {
|
|
|
208
222
|
padding: '8px 14px',
|
|
209
223
|
fontSize: '13px',
|
|
210
224
|
fontWeight: 500,
|
|
211
|
-
color: 'var(--seekora-text-primary,
|
|
212
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
213
|
-
border: '1px solid var(--seekora-border-color,
|
|
214
|
-
borderRadius:
|
|
225
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
226
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
227
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
228
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
215
229
|
cursor: 'pointer',
|
|
216
|
-
transition:
|
|
230
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
217
231
|
},
|
|
218
232
|
brandChipHover: {
|
|
219
233
|
borderColor: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -222,30 +236,30 @@ const styles = {
|
|
|
222
236
|
brandLogo: {
|
|
223
237
|
width: '20px',
|
|
224
238
|
height: '20px',
|
|
225
|
-
borderRadius:
|
|
239
|
+
borderRadius: `${BORDER_RADIUS.sm}px`,
|
|
226
240
|
objectFit: 'contain',
|
|
227
241
|
backgroundColor: 'var(--seekora-bg-secondary, #f3f4f6)',
|
|
228
242
|
},
|
|
229
243
|
footer: {
|
|
230
244
|
padding: '12px 20px',
|
|
231
|
-
borderTop: '1px solid var(--seekora-border-color,
|
|
232
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
245
|
+
borderTop: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
246
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
233
247
|
display: 'flex',
|
|
234
248
|
alignItems: 'center',
|
|
235
249
|
justifyContent: 'space-between',
|
|
236
250
|
fontSize: '12px',
|
|
237
|
-
color: 'var(--seekora-text-secondary,
|
|
251
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
238
252
|
},
|
|
239
253
|
emptyState: {
|
|
240
254
|
padding: '48px 20px',
|
|
241
255
|
textAlign: 'center',
|
|
242
|
-
color: 'var(--seekora-text-secondary,
|
|
256
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
243
257
|
},
|
|
244
258
|
highlight: {
|
|
245
259
|
backgroundColor: 'var(--seekora-highlight-bg, #fef9c3)',
|
|
246
260
|
fontWeight: 600,
|
|
247
261
|
padding: '0 2px',
|
|
248
|
-
borderRadius:
|
|
262
|
+
borderRadius: `${BORDER_RADIUS.sm / 2}px`,
|
|
249
263
|
},
|
|
250
264
|
};
|
|
251
265
|
// ============================================================================
|
|
@@ -12,7 +12,6 @@ export interface InfiniteHitsTheme {
|
|
|
12
12
|
item?: string;
|
|
13
13
|
loadMore?: string;
|
|
14
14
|
loadMoreDisabled?: string;
|
|
15
|
-
loading?: string;
|
|
16
15
|
empty?: string;
|
|
17
16
|
sentinel?: string;
|
|
18
17
|
}
|
|
@@ -21,10 +20,6 @@ export interface InfiniteHitsProps {
|
|
|
21
20
|
renderHit?: (hit: ResultItem, index: number) => React.ReactNode;
|
|
22
21
|
/** Custom render for empty state */
|
|
23
22
|
renderEmpty?: () => React.ReactNode;
|
|
24
|
-
/** Show initial loading when fetching and no hits yet (default false: no loading screen) */
|
|
25
|
-
showInitialLoading?: boolean;
|
|
26
|
-
/** Custom render for loading state */
|
|
27
|
-
renderLoading?: () => React.ReactNode;
|
|
28
23
|
/** Custom render for "Show More" button */
|
|
29
24
|
renderShowMore?: (props: {
|
|
30
25
|
isLoading: boolean;
|
|
@@ -41,8 +36,6 @@ export interface InfiniteHitsProps {
|
|
|
41
36
|
fieldMapping?: FieldMapping;
|
|
42
37
|
/** Text for "Show More" button */
|
|
43
38
|
showMoreLabel?: string;
|
|
44
|
-
/** Text for loading state */
|
|
45
|
-
loadingLabel?: string;
|
|
46
39
|
/** Callback when a hit is clicked */
|
|
47
40
|
onHitClick?: (hit: ResultItem, index: number) => void;
|
|
48
41
|
/** Custom className */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfiniteHits.d.ts","sourceRoot":"","sources":["../../src/components/InfiniteHits.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4D,MAAM,O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