@seekora-ai/ui-sdk-react 0.2.22 → 0.2.24
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/Facets.d.ts +4 -0
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +12 -5
- package/dist/components/HitsPerPage.d.ts.map +1 -1
- package/dist/components/HitsPerPage.js +21 -11
- package/dist/components/SortBy.d.ts.map +1 -1
- package/dist/components/SortBy.js +8 -11
- package/dist/components/primitives/CustomSelect.d.ts +40 -0
- package/dist/components/primitives/CustomSelect.d.ts.map +1 -0
- package/dist/components/primitives/CustomSelect.js +196 -0
- package/dist/components/primitives/ImageZoom.d.ts.map +1 -1
- package/dist/components/primitives/ImageZoom.js +37 -16
- package/dist/components/primitives/VariantSelector.d.ts.map +1 -1
- package/dist/components/primitives/VariantSelector.js +17 -24
- package/dist/components/primitives/index.d.ts +1 -0
- package/dist/components/primitives/index.d.ts.map +1 -1
- package/dist/components/primitives/index.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +46 -2
- package/dist/src/index.esm.js +313 -82
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +313 -81
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -481,6 +481,10 @@ interface FacetsProps {
|
|
|
481
481
|
useFiltersApi?: boolean;
|
|
482
482
|
/** Fields that should use disjunctive (OR) faceting (only with useFiltersApi) */
|
|
483
483
|
disjunctiveFacets?: string[];
|
|
484
|
+
/** Hide facets that have no selectable values (default: true) */
|
|
485
|
+
hideEmptyFacets?: boolean;
|
|
486
|
+
/** Fields that should start collapsed (collapsible variant only). Overrides defaultCollapsed for listed fields. */
|
|
487
|
+
defaultCollapsedFields?: string[];
|
|
484
488
|
}
|
|
485
489
|
declare const Facets: React__default.FC<FacetsProps>;
|
|
486
490
|
|
|
@@ -2914,6 +2918,46 @@ interface AnalyticsContextValue {
|
|
|
2914
2918
|
declare const useAnalyticsProvider: () => AnalyticsContextValue | null;
|
|
2915
2919
|
declare function AnalyticsProvider({ client, context, children }: AnalyticsProviderProps): React__default.JSX.Element;
|
|
2916
2920
|
|
|
2921
|
+
/**
|
|
2922
|
+
* CustomSelect — lightweight, accessible custom dropdown replacement for native <select>.
|
|
2923
|
+
*
|
|
2924
|
+
* CSS Variables (apply on a parent element to customize):
|
|
2925
|
+
* --seekora-select-bg — background color (default: #fff)
|
|
2926
|
+
* --seekora-select-color — text color (default: inherit)
|
|
2927
|
+
* --seekora-select-border — border color (default: rgba(128,128,128,0.3))
|
|
2928
|
+
* --seekora-select-hover-bg — option hover background (default: #f3f4f6)
|
|
2929
|
+
* --seekora-select-active-bg — selected option background (default: #eff6ff)
|
|
2930
|
+
* --seekora-select-active-color — selected option text color (default: inherit)
|
|
2931
|
+
* --seekora-select-radius — border radius (default: 6px)
|
|
2932
|
+
* --seekora-select-font-size — font size (default: 0.875rem)
|
|
2933
|
+
*/
|
|
2934
|
+
|
|
2935
|
+
interface CustomSelectOption {
|
|
2936
|
+
value: string;
|
|
2937
|
+
label: string;
|
|
2938
|
+
disabled?: boolean;
|
|
2939
|
+
}
|
|
2940
|
+
interface CustomSelectTheme {
|
|
2941
|
+
trigger?: string;
|
|
2942
|
+
menu?: string;
|
|
2943
|
+
option?: string;
|
|
2944
|
+
optionActive?: string;
|
|
2945
|
+
optionDisabled?: string;
|
|
2946
|
+
}
|
|
2947
|
+
interface CustomSelectProps {
|
|
2948
|
+
value: string;
|
|
2949
|
+
onChange: (value: string) => void;
|
|
2950
|
+
options: CustomSelectOption[];
|
|
2951
|
+
placeholder?: string;
|
|
2952
|
+
className?: string;
|
|
2953
|
+
style?: React__default.CSSProperties;
|
|
2954
|
+
theme?: CustomSelectTheme;
|
|
2955
|
+
/** aria-label for the trigger button */
|
|
2956
|
+
'aria-label'?: string;
|
|
2957
|
+
disabled?: boolean;
|
|
2958
|
+
}
|
|
2959
|
+
declare const CustomSelect: React__default.FC<CustomSelectProps>;
|
|
2960
|
+
|
|
2917
2961
|
/**
|
|
2918
2962
|
* SectionSearchProvider – preset query + filter section
|
|
2919
2963
|
*
|
|
@@ -4411,5 +4455,5 @@ declare function updateSuggestionsStyles(theme: SuggestionsThemeVariables): void
|
|
|
4411
4455
|
|
|
4412
4456
|
declare const createTheme: (config: ThemeConfig) => _seekora_ai_ui_sdk_types.Theme;
|
|
4413
4457
|
|
|
4414
|
-
export { ActionButtons, AmazonDropdown, AnalyticsProvider, BadgeList, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, DocSearch, DocSearchButton, DropdownPanel, FacetDropdown, Facets, FederatedDropdown, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight, HitsPerPage, ImageDisplay, ImageZoom, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, PriceDisplay, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RatingDisplay, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem$1 as SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsCache, SuggestionsDropdownComposition, SuggestionsError, SuggestionsProvider, TrendingItems, TrendingList, VariantSelector, VariantSwatches, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBadges, extractBrand, extractCategory, extractProduct, extractSuggestion, findVariantBySelections, formatParsedFilters, formatPriceRange, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getAvailableValuesForOption, getPriceRange, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, minimalTheme, minimalThemeVariables, parseHighlightMarkup, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useAnalyticsProvider, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useFilters, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useProductAnalytics, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext, useVariantSelection, withAnalytics };
|
|
4415
|
-
export type { ActionButton, ActionButtonType, ActionButtonsProps, AnalyticsConfig, AnalyticsEventPayload, AnalyticsProviderProps, BadgeListProps, BaseDropdownProps, BrandFieldMapping, BreadcrumbItem, BreadcrumbProps, BreadcrumbTheme, CategoriesTabsProps, CategoryFieldMapping, ClearRefinementsProps, ClearRefinementsTheme, DocSearchAction, DocSearchButtonProps, DocSearchHit, DocSearchProps, DocSearchResponse, DocSearchState, DocSearchSuggestion, DocSearchSuggestionsResponse, DocSearchTranslations, DropdownClassNames, DropdownEventHandlers, DropdownPanelProps, DropdownRef, DropdownThemeConfig, Facet, FacetDropdownOption, FacetDropdownProps, FacetDropdownTheme, FacetItem, FacetRangeConfig, FacetRangeItem, FacetSize, FacetStats, FacetVariant, FacetsProps, FacetsTheme, FederatedDropdownProps, FederatedDropdownRef, FrequentlyBoughtTogetherProps, GenericItem, HierarchicalMenuItem, HierarchicalMenuProps, HierarchicalMenuTheme, HighlightMarkupOptions, HighlightProps, HighlightTheme, HitsPerPageItem, HitsPerPageProps, HitsPerPageTheme, ImageDisplayProps, ImageDisplayVariant, ImageZoomMode, ImageZoomProps, InfiniteHitsProps, InfiniteHitsTheme, ImageDisplayVariant$1 as ItemCardImageVariant, ItemCardProps, ItemGridProps, MobileFiltersButtonProps, MobileFiltersProps, MobileFiltersTheme, NaturalLanguageFiltersOptions, NaturalLanguageResult, NavigableItem, PaginationProps, PaginationTheme, ParsedFilter, PriceDisplayProps, ProductCardImageVariant, ProductCardProps, ProductClickEventData, ProductDisplayConfig, ProductFieldMapping, ProductGalleryProps, ProductGridProps, ProductInfoProps, ProductRecommendationsProps, QuerySuggestionsDropdownProps, QuerySuggestionsDropdownRef, QuerySuggestionsProps, QuerySuggestionsTheme, RangeSliderProps, RangeSliderTheme, RatingDisplayProps, RatingSize, RatingVariant, RecentSearchesListProps, RecentlyViewedProps, RecommendationItem, RecommendationTheme, RefinementInput, RelatedProductsProps, ResponsiveState, RichQuerySuggestionsProps, RichQuerySuggestionsRef, SearchBarProps, SearchBarSize, SearchBarTheme, SearchBarWithSuggestionsProps, SearchBarWithSuggestionsRef, SearchInputProps, SearchProviderProps, SearchResultsProps, SearchResultsTheme, SearchSource, SectionConfig, SectionErrorProps, SectionItemGridProps, SectionSearchContextValue, SectionSearchProviderProps, SmartSuggestion, SmartSuggestionsOptions, SnippetProps, SnippetTheme, SortByProps, SortBySize, SortByTheme, SortByVariant, SortOption, SuggestionClickEventData, SuggestionDisplayConfig, SuggestionDropdownVariant, SuggestionFieldMapping, SuggestionImpressionEventData, SuggestionItemProps, SuggestionListProps, SuggestionSearchBarProps, SuggestionSearchBarRef, SuggestionsContextValue, SuggestionsDropdownCompositionProps, SuggestionsErrorProps, SuggestionsProviderProps, SuggestionsThemeVariables, TrendingItemsProps, TrendingListProps, UseAnalyticsOptions, UseAnalyticsReturn, UseSeekoraSearchOptions$1 as UseDocSearchSeekoraSearchOptions, UseSeekoraSearchResult as UseDocSearchSeekoraSearchResult, UseFiltersOptions, UseFiltersReturn, UseProductAnalyticsOptions, UseProductAnalyticsReturn, UseQuerySuggestionsEnhancedOptions, UseQuerySuggestionsEnhancedReturn, UseSmartSuggestionsReturn, UseSuggestionsAnalyticsOptions, UseSuggestionsAnalyticsReturn, UseVariantSelectionOptions, UseVariantSelectionReturn, VariantSelectorProps, VariantSwatchesProps, WithAnalyticsConfig, WithAnalyticsInjectedProps };
|
|
4458
|
+
export { ActionButtons, AmazonDropdown, AnalyticsProvider, BadgeList, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, CustomSelect, DocSearch, DocSearchButton, DropdownPanel, FacetDropdown, Facets, FederatedDropdown, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight, HitsPerPage, ImageDisplay, ImageZoom, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, PriceDisplay, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RatingDisplay, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem$1 as SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsCache, SuggestionsDropdownComposition, SuggestionsError, SuggestionsProvider, TrendingItems, TrendingList, VariantSelector, VariantSwatches, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBadges, extractBrand, extractCategory, extractProduct, extractSuggestion, findVariantBySelections, formatParsedFilters, formatPriceRange, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getAvailableValuesForOption, getPriceRange, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, minimalTheme, minimalThemeVariables, parseHighlightMarkup, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useAnalyticsProvider, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useFilters, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useProductAnalytics, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext, useVariantSelection, withAnalytics };
|
|
4459
|
+
export type { ActionButton, ActionButtonType, ActionButtonsProps, AnalyticsConfig, AnalyticsEventPayload, AnalyticsProviderProps, BadgeListProps, BaseDropdownProps, BrandFieldMapping, BreadcrumbItem, BreadcrumbProps, BreadcrumbTheme, CategoriesTabsProps, CategoryFieldMapping, ClearRefinementsProps, ClearRefinementsTheme, CustomSelectOption, CustomSelectProps, CustomSelectTheme, DocSearchAction, DocSearchButtonProps, DocSearchHit, DocSearchProps, DocSearchResponse, DocSearchState, DocSearchSuggestion, DocSearchSuggestionsResponse, DocSearchTranslations, DropdownClassNames, DropdownEventHandlers, DropdownPanelProps, DropdownRef, DropdownThemeConfig, Facet, FacetDropdownOption, FacetDropdownProps, FacetDropdownTheme, FacetItem, FacetRangeConfig, FacetRangeItem, FacetSize, FacetStats, FacetVariant, FacetsProps, FacetsTheme, FederatedDropdownProps, FederatedDropdownRef, FrequentlyBoughtTogetherProps, GenericItem, HierarchicalMenuItem, HierarchicalMenuProps, HierarchicalMenuTheme, HighlightMarkupOptions, HighlightProps, HighlightTheme, HitsPerPageItem, HitsPerPageProps, HitsPerPageTheme, ImageDisplayProps, ImageDisplayVariant, ImageZoomMode, ImageZoomProps, InfiniteHitsProps, InfiniteHitsTheme, ImageDisplayVariant$1 as ItemCardImageVariant, ItemCardProps, ItemGridProps, MobileFiltersButtonProps, MobileFiltersProps, MobileFiltersTheme, NaturalLanguageFiltersOptions, NaturalLanguageResult, NavigableItem, PaginationProps, PaginationTheme, ParsedFilter, PriceDisplayProps, ProductCardImageVariant, ProductCardProps, ProductClickEventData, ProductDisplayConfig, ProductFieldMapping, ProductGalleryProps, ProductGridProps, ProductInfoProps, ProductRecommendationsProps, QuerySuggestionsDropdownProps, QuerySuggestionsDropdownRef, QuerySuggestionsProps, QuerySuggestionsTheme, RangeSliderProps, RangeSliderTheme, RatingDisplayProps, RatingSize, RatingVariant, RecentSearchesListProps, RecentlyViewedProps, RecommendationItem, RecommendationTheme, RefinementInput, RelatedProductsProps, ResponsiveState, RichQuerySuggestionsProps, RichQuerySuggestionsRef, SearchBarProps, SearchBarSize, SearchBarTheme, SearchBarWithSuggestionsProps, SearchBarWithSuggestionsRef, SearchInputProps, SearchProviderProps, SearchResultsProps, SearchResultsTheme, SearchSource, SectionConfig, SectionErrorProps, SectionItemGridProps, SectionSearchContextValue, SectionSearchProviderProps, SmartSuggestion, SmartSuggestionsOptions, SnippetProps, SnippetTheme, SortByProps, SortBySize, SortByTheme, SortByVariant, SortOption, SuggestionClickEventData, SuggestionDisplayConfig, SuggestionDropdownVariant, SuggestionFieldMapping, SuggestionImpressionEventData, SuggestionItemProps, SuggestionListProps, SuggestionSearchBarProps, SuggestionSearchBarRef, SuggestionsContextValue, SuggestionsDropdownCompositionProps, SuggestionsErrorProps, SuggestionsProviderProps, SuggestionsThemeVariables, TrendingItemsProps, TrendingListProps, UseAnalyticsOptions, UseAnalyticsReturn, UseSeekoraSearchOptions$1 as UseDocSearchSeekoraSearchOptions, UseSeekoraSearchResult as UseDocSearchSeekoraSearchResult, UseFiltersOptions, UseFiltersReturn, UseProductAnalyticsOptions, UseProductAnalyticsReturn, UseQuerySuggestionsEnhancedOptions, UseQuerySuggestionsEnhancedReturn, UseSmartSuggestionsReturn, UseSuggestionsAnalyticsOptions, UseSuggestionsAnalyticsReturn, UseVariantSelectionOptions, UseVariantSelectionReturn, VariantSelectorProps, VariantSwatchesProps, WithAnalyticsConfig, WithAnalyticsInjectedProps };
|
package/dist/src/index.esm.js
CHANGED
|
@@ -301,6 +301,7 @@ class SearchStateManager {
|
|
|
301
301
|
constructor(config) {
|
|
302
302
|
this.listeners = [];
|
|
303
303
|
this.debounceTimer = null;
|
|
304
|
+
this.notifyScheduled = false;
|
|
304
305
|
this.client = config.client;
|
|
305
306
|
this.autoSearch = config.autoSearch !== false;
|
|
306
307
|
this.debounceMs = config.debounceMs || 300;
|
|
@@ -548,19 +549,27 @@ class SearchStateManager {
|
|
|
548
549
|
this.state = { ...this.state, ...updates };
|
|
549
550
|
this.notifyListeners();
|
|
550
551
|
}
|
|
551
|
-
// Notify all listeners of state changes
|
|
552
|
+
// Notify all listeners of state changes, batched via microtask.
|
|
553
|
+
// Multiple synchronous mutations (e.g. addRefinement + page reset)
|
|
554
|
+
// coalesce into a single listener notification.
|
|
552
555
|
notifyListeners() {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
|
|
556
|
+
if (this.notifyScheduled)
|
|
557
|
+
return;
|
|
558
|
+
this.notifyScheduled = true;
|
|
559
|
+
queueMicrotask(() => {
|
|
560
|
+
this.notifyScheduled = false;
|
|
561
|
+
const state = this.getState();
|
|
562
|
+
this.listeners.forEach(listener => {
|
|
563
|
+
try {
|
|
564
|
+
listener(state);
|
|
565
|
+
}
|
|
566
|
+
catch (err) {
|
|
567
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
568
|
+
log.error('SearchStateManager: Error in listener', {
|
|
569
|
+
error: error.message,
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
});
|
|
564
573
|
});
|
|
565
574
|
}
|
|
566
575
|
/** Explicitly clear results (bypasses keepResultsOnClear) */
|
|
@@ -606,10 +615,13 @@ class SearchStateManager {
|
|
|
606
615
|
async fetchFilters(options) {
|
|
607
616
|
log.verbose('SearchStateManager: Fetching filters', { options });
|
|
608
617
|
try {
|
|
609
|
-
|
|
618
|
+
// Do NOT pass refinement-based filters to the Filters API.
|
|
619
|
+
// Facets should be generated from the search query only, not narrowed
|
|
620
|
+
// by active filter selections. This keeps facet options stable when
|
|
621
|
+
// users toggle filters (same behaviour as performSimplifiedFacetSearch
|
|
622
|
+
// in the search API).
|
|
610
623
|
const response = await this.client.getFilters({
|
|
611
624
|
q: this.state.query || undefined,
|
|
612
|
-
filter: filterString || undefined,
|
|
613
625
|
...options,
|
|
614
626
|
});
|
|
615
627
|
log.info('SearchStateManager: Filters fetched', {
|
|
@@ -3112,6 +3124,201 @@ const Pagination = ({ results: resultsProp, currentPage: currentPageProp, itemsP
|
|
|
3112
3124
|
resolvedShowPageInfo && (React.createElement("li", { style: { marginLeft: theme.spacing.small } }, pageInfoElement)))));
|
|
3113
3125
|
};
|
|
3114
3126
|
|
|
3127
|
+
/**
|
|
3128
|
+
* CustomSelect — lightweight, accessible custom dropdown replacement for native <select>.
|
|
3129
|
+
*
|
|
3130
|
+
* CSS Variables (apply on a parent element to customize):
|
|
3131
|
+
* --seekora-select-bg — background color (default: #fff)
|
|
3132
|
+
* --seekora-select-color — text color (default: inherit)
|
|
3133
|
+
* --seekora-select-border — border color (default: rgba(128,128,128,0.3))
|
|
3134
|
+
* --seekora-select-hover-bg — option hover background (default: #f3f4f6)
|
|
3135
|
+
* --seekora-select-active-bg — selected option background (default: #eff6ff)
|
|
3136
|
+
* --seekora-select-active-color — selected option text color (default: inherit)
|
|
3137
|
+
* --seekora-select-radius — border radius (default: 6px)
|
|
3138
|
+
* --seekora-select-font-size — font size (default: 0.875rem)
|
|
3139
|
+
*/
|
|
3140
|
+
// ---------------------------------------------------------------------------
|
|
3141
|
+
// Component
|
|
3142
|
+
// ---------------------------------------------------------------------------
|
|
3143
|
+
const CustomSelect = ({ value, onChange, options, placeholder = 'Select...', className, style, theme: customTheme, 'aria-label': ariaLabel, disabled = false, }) => {
|
|
3144
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
3145
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
3146
|
+
const containerRef = useRef(null);
|
|
3147
|
+
const menuRef = useRef(null);
|
|
3148
|
+
const instanceId = useId();
|
|
3149
|
+
const t = customTheme || {};
|
|
3150
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
3151
|
+
const displayLabel = selectedOption?.label ?? placeholder;
|
|
3152
|
+
// Close on click outside
|
|
3153
|
+
useEffect(() => {
|
|
3154
|
+
if (!isOpen)
|
|
3155
|
+
return;
|
|
3156
|
+
const handleMouseDown = (e) => {
|
|
3157
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
3158
|
+
setIsOpen(false);
|
|
3159
|
+
setActiveIndex(-1);
|
|
3160
|
+
}
|
|
3161
|
+
};
|
|
3162
|
+
document.addEventListener('mousedown', handleMouseDown);
|
|
3163
|
+
return () => document.removeEventListener('mousedown', handleMouseDown);
|
|
3164
|
+
}, [isOpen]);
|
|
3165
|
+
// Scroll active item into view
|
|
3166
|
+
useEffect(() => {
|
|
3167
|
+
if (!isOpen || activeIndex < 0 || !menuRef.current)
|
|
3168
|
+
return;
|
|
3169
|
+
const item = menuRef.current.children[activeIndex];
|
|
3170
|
+
item?.scrollIntoView?.({ block: 'nearest' });
|
|
3171
|
+
}, [activeIndex, isOpen]);
|
|
3172
|
+
const toggle = useCallback(() => {
|
|
3173
|
+
if (disabled)
|
|
3174
|
+
return;
|
|
3175
|
+
setIsOpen((prev) => {
|
|
3176
|
+
if (!prev) {
|
|
3177
|
+
// Opening — highlight current selection
|
|
3178
|
+
const idx = options.findIndex((o) => o.value === value);
|
|
3179
|
+
setActiveIndex(idx >= 0 ? idx : 0);
|
|
3180
|
+
}
|
|
3181
|
+
return !prev;
|
|
3182
|
+
});
|
|
3183
|
+
}, [disabled, options, value]);
|
|
3184
|
+
const selectOption = useCallback((opt) => {
|
|
3185
|
+
if (opt.disabled)
|
|
3186
|
+
return;
|
|
3187
|
+
onChange(opt.value);
|
|
3188
|
+
setIsOpen(false);
|
|
3189
|
+
setActiveIndex(-1);
|
|
3190
|
+
}, [onChange]);
|
|
3191
|
+
// Find next non-disabled index in given direction
|
|
3192
|
+
const findNextEnabled = (from, dir) => {
|
|
3193
|
+
let idx = from;
|
|
3194
|
+
for (let i = 0; i < options.length; i++) {
|
|
3195
|
+
idx += dir;
|
|
3196
|
+
if (idx < 0)
|
|
3197
|
+
idx = options.length - 1;
|
|
3198
|
+
if (idx >= options.length)
|
|
3199
|
+
idx = 0;
|
|
3200
|
+
if (!options[idx].disabled)
|
|
3201
|
+
return idx;
|
|
3202
|
+
}
|
|
3203
|
+
return from;
|
|
3204
|
+
};
|
|
3205
|
+
const handleKeyDown = useCallback((e) => {
|
|
3206
|
+
if (disabled)
|
|
3207
|
+
return;
|
|
3208
|
+
if (!isOpen) {
|
|
3209
|
+
if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(e.key)) {
|
|
3210
|
+
e.preventDefault();
|
|
3211
|
+
toggle();
|
|
3212
|
+
}
|
|
3213
|
+
return;
|
|
3214
|
+
}
|
|
3215
|
+
switch (e.key) {
|
|
3216
|
+
case 'ArrowDown':
|
|
3217
|
+
e.preventDefault();
|
|
3218
|
+
setActiveIndex((prev) => findNextEnabled(prev, 1));
|
|
3219
|
+
break;
|
|
3220
|
+
case 'ArrowUp':
|
|
3221
|
+
e.preventDefault();
|
|
3222
|
+
setActiveIndex((prev) => findNextEnabled(prev, -1));
|
|
3223
|
+
break;
|
|
3224
|
+
case 'Enter':
|
|
3225
|
+
case ' ':
|
|
3226
|
+
e.preventDefault();
|
|
3227
|
+
if (activeIndex >= 0 && !options[activeIndex].disabled) {
|
|
3228
|
+
selectOption(options[activeIndex]);
|
|
3229
|
+
}
|
|
3230
|
+
break;
|
|
3231
|
+
case 'Escape':
|
|
3232
|
+
e.preventDefault();
|
|
3233
|
+
setIsOpen(false);
|
|
3234
|
+
setActiveIndex(-1);
|
|
3235
|
+
break;
|
|
3236
|
+
case 'Home':
|
|
3237
|
+
e.preventDefault();
|
|
3238
|
+
setActiveIndex(findNextEnabled(-1, 1));
|
|
3239
|
+
break;
|
|
3240
|
+
case 'End':
|
|
3241
|
+
e.preventDefault();
|
|
3242
|
+
setActiveIndex(findNextEnabled(options.length, -1));
|
|
3243
|
+
break;
|
|
3244
|
+
case 'Tab':
|
|
3245
|
+
setIsOpen(false);
|
|
3246
|
+
setActiveIndex(-1);
|
|
3247
|
+
break;
|
|
3248
|
+
}
|
|
3249
|
+
}, [disabled, isOpen, activeIndex, options, toggle, selectOption]);
|
|
3250
|
+
const menuId = `seekora-select-menu-${instanceId}`;
|
|
3251
|
+
return (React.createElement("div", { ref: containerRef, className: clsx('seekora-select', className), style: { position: 'relative', display: 'inline-block', ...style }, onKeyDown: handleKeyDown },
|
|
3252
|
+
React.createElement("button", { type: "button", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": menuId, "aria-label": ariaLabel, "aria-activedescendant": isOpen && activeIndex >= 0
|
|
3253
|
+
? `${menuId}-opt-${activeIndex}`
|
|
3254
|
+
: undefined, disabled: disabled, onClick: toggle, className: clsx('seekora-select__trigger', t.trigger), style: {
|
|
3255
|
+
display: 'flex',
|
|
3256
|
+
alignItems: 'center',
|
|
3257
|
+
justifyContent: 'space-between',
|
|
3258
|
+
gap: 8,
|
|
3259
|
+
width: '100%',
|
|
3260
|
+
padding: '8px 12px',
|
|
3261
|
+
fontSize: 'var(--seekora-select-font-size, 0.875rem)',
|
|
3262
|
+
lineHeight: 1.4,
|
|
3263
|
+
border: '1px solid var(--seekora-select-border, rgba(128,128,128,0.3))',
|
|
3264
|
+
borderRadius: 'var(--seekora-select-radius, 6px)',
|
|
3265
|
+
backgroundColor: 'var(--seekora-select-bg, #fff)',
|
|
3266
|
+
color: 'var(--seekora-select-color, inherit)',
|
|
3267
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
3268
|
+
outline: 'none',
|
|
3269
|
+
textAlign: 'left',
|
|
3270
|
+
fontFamily: 'inherit',
|
|
3271
|
+
opacity: disabled ? 0.5 : 1,
|
|
3272
|
+
} },
|
|
3273
|
+
React.createElement("span", { style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, displayLabel),
|
|
3274
|
+
React.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", style: {
|
|
3275
|
+
flexShrink: 0,
|
|
3276
|
+
transition: 'transform 0.15s ease',
|
|
3277
|
+
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
3278
|
+
} },
|
|
3279
|
+
React.createElement("path", { d: "M2.5 4.5L6 8L9.5 4.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }))),
|
|
3280
|
+
isOpen && (React.createElement("div", { ref: menuRef, id: menuId, role: "listbox", className: clsx('seekora-select__menu', t.menu), style: {
|
|
3281
|
+
position: 'absolute',
|
|
3282
|
+
top: '100%',
|
|
3283
|
+
left: 0,
|
|
3284
|
+
right: 0,
|
|
3285
|
+
zIndex: 9999,
|
|
3286
|
+
marginTop: 4,
|
|
3287
|
+
padding: '4px 0',
|
|
3288
|
+
border: '1px solid var(--seekora-select-border, rgba(128,128,128,0.3))',
|
|
3289
|
+
borderRadius: 'var(--seekora-select-radius, 6px)',
|
|
3290
|
+
backgroundColor: 'var(--seekora-select-bg, #fff)',
|
|
3291
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.1)',
|
|
3292
|
+
maxHeight: 220,
|
|
3293
|
+
overflowY: 'auto',
|
|
3294
|
+
} }, options.map((opt, idx) => {
|
|
3295
|
+
const isSelected = opt.value === value;
|
|
3296
|
+
const isHighlighted = idx === activeIndex;
|
|
3297
|
+
return (React.createElement("div", { key: opt.value, id: `${menuId}-opt-${idx}`, role: "option", "aria-selected": isSelected, "aria-disabled": opt.disabled || undefined, className: clsx('seekora-select__option', t.option, isSelected && 'seekora-select__option--selected', isHighlighted && (t.optionActive || 'seekora-select__option--highlighted'), opt.disabled && (t.optionDisabled || 'seekora-select__option--disabled')), onMouseEnter: () => !opt.disabled && setActiveIndex(idx), onMouseDown: (e) => {
|
|
3298
|
+
e.preventDefault(); // Prevent blur
|
|
3299
|
+
if (!opt.disabled)
|
|
3300
|
+
selectOption(opt);
|
|
3301
|
+
}, style: {
|
|
3302
|
+
padding: '6px 12px',
|
|
3303
|
+
fontSize: 'var(--seekora-select-font-size, 0.875rem)',
|
|
3304
|
+
cursor: opt.disabled ? 'not-allowed' : 'pointer',
|
|
3305
|
+
backgroundColor: isHighlighted
|
|
3306
|
+
? 'var(--seekora-select-hover-bg, #f3f4f6)'
|
|
3307
|
+
: isSelected
|
|
3308
|
+
? 'var(--seekora-select-active-bg, #eff6ff)'
|
|
3309
|
+
: 'transparent',
|
|
3310
|
+
color: opt.disabled
|
|
3311
|
+
? 'rgba(128,128,128,0.5)'
|
|
3312
|
+
: isSelected
|
|
3313
|
+
? 'var(--seekora-select-active-color, inherit)'
|
|
3314
|
+
: 'var(--seekora-select-color, inherit)',
|
|
3315
|
+
fontWeight: isSelected ? 500 : 400,
|
|
3316
|
+
opacity: opt.disabled ? 0.5 : 1,
|
|
3317
|
+
transition: 'background-color 0.1s ease',
|
|
3318
|
+
} }, opt.label));
|
|
3319
|
+
})))));
|
|
3320
|
+
};
|
|
3321
|
+
|
|
3115
3322
|
/**
|
|
3116
3323
|
* SortBy Component
|
|
3117
3324
|
*
|
|
@@ -3215,18 +3422,14 @@ const SortBy = ({ options, value: valueProp, defaultValue, onSortChange, renderS
|
|
|
3215
3422
|
}
|
|
3216
3423
|
return (React.createElement("div", { className: clsx(sortByTheme.container, className), style: { ...cssVarStyle, ...style } },
|
|
3217
3424
|
labelElement,
|
|
3218
|
-
React.createElement(
|
|
3219
|
-
padding,
|
|
3220
|
-
paddingRight: theme.spacing.medium,
|
|
3221
|
-
fontSize,
|
|
3222
|
-
border: '1px solid var(--seekora-sort-border)',
|
|
3223
|
-
borderRadius,
|
|
3224
|
-
backgroundColor: 'var(--seekora-sort-bg)',
|
|
3225
|
-
color: 'var(--seekora-sort-color)',
|
|
3226
|
-
cursor: 'pointer',
|
|
3227
|
-
outline: 'none',
|
|
3425
|
+
React.createElement(CustomSelect, { value: value, onChange: applyValue, options: options, placeholder: placeholder, "aria-label": label || 'Sort results', className: clsx(sortByTheme.select), style: {
|
|
3228
3426
|
width: '100%',
|
|
3229
|
-
|
|
3427
|
+
'--seekora-select-font-size': fontSize,
|
|
3428
|
+
'--seekora-select-border': 'var(--seekora-sort-border)',
|
|
3429
|
+
'--seekora-select-radius': borderRadius,
|
|
3430
|
+
'--seekora-select-bg': 'var(--seekora-sort-bg)',
|
|
3431
|
+
'--seekora-select-color': 'var(--seekora-sort-color)',
|
|
3432
|
+
} })));
|
|
3230
3433
|
}
|
|
3231
3434
|
// ------ Button group variant -------------------------------------------
|
|
3232
3435
|
if (variant === 'button-group') {
|
|
@@ -3676,7 +3879,7 @@ const CSS_VAR_DEFAULTS = {
|
|
|
3676
3879
|
// ---------------------------------------------------------------------------
|
|
3677
3880
|
// Component
|
|
3678
3881
|
// ---------------------------------------------------------------------------
|
|
3679
|
-
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, }) => {
|
|
3882
|
+
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, hideEmptyFacets = true, defaultCollapsedFields, }) => {
|
|
3680
3883
|
const { theme } = useSearchContext();
|
|
3681
3884
|
const { results: stateResults, refinements, addRefinement, removeRefinement } = useSearchState();
|
|
3682
3885
|
const facetsTheme = customTheme || {};
|
|
@@ -3753,7 +3956,10 @@ const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange, rende
|
|
|
3753
3956
|
});
|
|
3754
3957
|
return extracted;
|
|
3755
3958
|
};
|
|
3756
|
-
const
|
|
3959
|
+
const rawFacetList = extractFacets();
|
|
3960
|
+
const facets = hideEmptyFacets
|
|
3961
|
+
? rawFacetList.filter(f => f.items.length > 0 || f.stats != null)
|
|
3962
|
+
: rawFacetList;
|
|
3757
3963
|
// -------------------------------------------------------------------
|
|
3758
3964
|
// Handlers
|
|
3759
3965
|
// -------------------------------------------------------------------
|
|
@@ -3790,17 +3996,21 @@ const Facets = ({ results: resultsProp, facets: facetsProp, onFacetChange, rende
|
|
|
3790
3996
|
}));
|
|
3791
3997
|
};
|
|
3792
3998
|
/** For collapsible variant — determine if a facet group is open. */
|
|
3999
|
+
const isFieldDefaultCollapsed = (field) => {
|
|
4000
|
+
if (defaultCollapsedFields?.includes(field))
|
|
4001
|
+
return true;
|
|
4002
|
+
return defaultCollapsed;
|
|
4003
|
+
};
|
|
3793
4004
|
const isFacetGroupOpen = (field) => {
|
|
3794
4005
|
if (field in expandedFacets) {
|
|
3795
4006
|
return expandedFacets[field];
|
|
3796
4007
|
}
|
|
3797
|
-
|
|
3798
|
-
return !defaultCollapsed;
|
|
4008
|
+
return !isFieldDefaultCollapsed(field);
|
|
3799
4009
|
};
|
|
3800
4010
|
const toggleCollapsible = (field) => {
|
|
3801
4011
|
setExpandedFacets((prev) => ({
|
|
3802
4012
|
...prev,
|
|
3803
|
-
[field]: !(prev[field] ?? !
|
|
4013
|
+
[field]: !(prev[field] ?? !isFieldDefaultCollapsed(field)),
|
|
3804
4014
|
}));
|
|
3805
4015
|
};
|
|
3806
4016
|
const getSearchTerm = (field) => searchTerms[field] || '';
|
|
@@ -5437,19 +5647,28 @@ const HitsPerPage = ({ items, onHitsPerPageChange, renderSelect, className, styl
|
|
|
5437
5647
|
fontSize: theme.typography.fontSize.medium,
|
|
5438
5648
|
color: theme.colors.text,
|
|
5439
5649
|
} }, label)),
|
|
5440
|
-
React.createElement(
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5650
|
+
React.createElement(CustomSelect, { value: String(value), onChange: (val) => {
|
|
5651
|
+
const newValue = parseInt(val, 10);
|
|
5652
|
+
setInternalValue(newValue);
|
|
5653
|
+
if (syncWithState) {
|
|
5654
|
+
stateManager.setItemsPerPage(newValue, false);
|
|
5655
|
+
setPage(1, true);
|
|
5656
|
+
}
|
|
5657
|
+
if (onHitsPerPageChange) {
|
|
5658
|
+
onHitsPerPageChange(newValue);
|
|
5659
|
+
}
|
|
5660
|
+
}, options: items.map((item) => ({
|
|
5661
|
+
value: String(item.value),
|
|
5662
|
+
label: item.label,
|
|
5663
|
+
})), "aria-label": "Results per page", className: hitsPerPageTheme.select, style: {
|
|
5664
|
+
'--seekora-select-font-size': theme.typography.fontSize.medium,
|
|
5665
|
+
'--seekora-select-border': theme.colors.border,
|
|
5666
|
+
'--seekora-select-radius': typeof theme.borderRadius === 'string'
|
|
5446
5667
|
? theme.borderRadius
|
|
5447
5668
|
: theme.borderRadius.medium,
|
|
5448
|
-
|
|
5449
|
-
color: theme.colors.text,
|
|
5450
|
-
|
|
5451
|
-
outline: 'none',
|
|
5452
|
-
}, "aria-label": "Results per page" }, items.map((item) => (React.createElement("option", { key: item.value, value: item.value, className: hitsPerPageTheme.option }, item.label))))));
|
|
5669
|
+
'--seekora-select-bg': theme.colors.background,
|
|
5670
|
+
'--seekora-select-color': theme.colors.text,
|
|
5671
|
+
} })));
|
|
5453
5672
|
};
|
|
5454
5673
|
|
|
5455
5674
|
/**
|
|
@@ -9718,13 +9937,30 @@ function ImageZoom({ src, alt = '', mode = 'both', zoomLevel = 2.5, className, s
|
|
|
9718
9937
|
objectFit: 'cover',
|
|
9719
9938
|
display: 'block',
|
|
9720
9939
|
};
|
|
9940
|
+
// Compute the indicator rectangle (what portion of the image the zoom panel shows).
|
|
9941
|
+
// indW / containerW = 1 / zoomLevel (the panel shows 1/zoomLevel of the image width).
|
|
9942
|
+
// indH is derived from the zoom panel's aspect ratio so it's consistent with what the
|
|
9943
|
+
// panel actually renders — no need for the image's natural dimensions.
|
|
9944
|
+
const getIndicatorRect = useCallback(() => {
|
|
9945
|
+
if (!containerRef.current)
|
|
9946
|
+
return { indL: 0, indT: 0, indW: 0, indH: 0 };
|
|
9947
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
9948
|
+
const indW = rect.width / zoomLevel;
|
|
9949
|
+
const indH = (zoomPanelSize.height / zoomPanelSize.width) * rect.width / zoomLevel;
|
|
9950
|
+
const indL = Math.max(0, Math.min(rect.width - indW, cursorPos.x - indW / 2));
|
|
9951
|
+
const indT = Math.max(0, Math.min(rect.height - indH, cursorPos.y - indH / 2));
|
|
9952
|
+
return { indL, indT, indW, indH };
|
|
9953
|
+
}, [cursorPos, zoomLevel, zoomPanelSize]);
|
|
9721
9954
|
// Calculate zoom panel background position (Amazon-style)
|
|
9722
9955
|
const getZoomPanelStyle = () => {
|
|
9723
9956
|
if (!containerRef.current || !imageLoaded)
|
|
9724
9957
|
return { display: 'none' };
|
|
9725
9958
|
const rect = containerRef.current.getBoundingClientRect();
|
|
9726
|
-
const
|
|
9727
|
-
|
|
9959
|
+
const { indL, indT, indW, indH } = getIndicatorRect();
|
|
9960
|
+
// bgPos is derived from the clamped indicator position, not the raw cursor.
|
|
9961
|
+
// At indL=0 → bgPosX=0% (show left), at indL=containerW-indW → bgPosX=100% (show right).
|
|
9962
|
+
const bgPosX = (rect.width - indW) > 0 ? (indL / (rect.width - indW)) * 100 : 0;
|
|
9963
|
+
const bgPosY = (rect.height - indH) > 0 ? (indT / (rect.height - indH)) * 100 : 0;
|
|
9728
9964
|
// Calculate available space in all directions
|
|
9729
9965
|
const viewportWidth = window.innerWidth;
|
|
9730
9966
|
const viewportHeight = window.innerHeight;
|
|
@@ -9852,19 +10088,22 @@ function ImageZoom({ src, alt = '', mode = 'both', zoomLevel = 2.5, className, s
|
|
|
9852
10088
|
} }, "\uD83D\uDD0D")),
|
|
9853
10089
|
supportsLens && isHovering && imageLoaded && (React.createElement("div", { style: getLensStyle() },
|
|
9854
10090
|
React.createElement("img", { src: src, alt: "", style: getLensImageStyle() }))),
|
|
9855
|
-
supportsHover && isHovering && imageLoaded && containerRef.current && (
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
10091
|
+
supportsHover && isHovering && imageLoaded && containerRef.current && (() => {
|
|
10092
|
+
const { indL, indT, indW, indH } = getIndicatorRect();
|
|
10093
|
+
return (React.createElement("div", { style: {
|
|
10094
|
+
position: 'absolute',
|
|
10095
|
+
left: indL,
|
|
10096
|
+
top: indT,
|
|
10097
|
+
width: indW,
|
|
10098
|
+
height: indH,
|
|
10099
|
+
border: 'var(--seekora-hover-area-border, 2px solid rgba(0,0,0,0.3))',
|
|
10100
|
+
backgroundColor: 'var(--seekora-hover-area-bg, rgba(255,255,255,0.1))',
|
|
10101
|
+
pointerEvents: 'none',
|
|
10102
|
+
zIndex: 50,
|
|
10103
|
+
} }));
|
|
10104
|
+
})()),
|
|
10105
|
+
supportsHover && isHovering && imageLoaded && typeof document !== 'undefined' && createPortal(React.createElement("div", { style: getZoomPanelStyle() }), document.body),
|
|
10106
|
+
isLightboxOpen && typeof document !== 'undefined' && createPortal(React.createElement("div", { className: "seekora-image-zoom-lightbox", style: {
|
|
9868
10107
|
position: 'fixed',
|
|
9869
10108
|
top: 0,
|
|
9870
10109
|
left: 0,
|
|
@@ -10019,7 +10258,7 @@ function ImageZoom({ src, alt = '', mode = 'both', zoomLevel = 2.5, className, s
|
|
|
10019
10258
|
backgroundColor: 'var(--seekora-lightbox-instructions-bg, rgba(0,0,0,0.5))',
|
|
10020
10259
|
padding: '8px 16px',
|
|
10021
10260
|
borderRadius: 12,
|
|
10022
|
-
} }, hasMultipleImages ? 'Use arrow keys or click thumbnails to navigate • ESC to close' : 'Click outside or press ESC to close')))));
|
|
10261
|
+
} }, hasMultipleImages ? 'Use arrow keys or click thumbnails to navigate • ESC to close' : 'Click outside or press ESC to close')), document.body)));
|
|
10023
10262
|
}
|
|
10024
10263
|
|
|
10025
10264
|
/**
|
|
@@ -11850,30 +12089,22 @@ function VariantSelector({ options, variants, selections, onSelectionChange, opt
|
|
|
11850
12089
|
} },
|
|
11851
12090
|
option.name,
|
|
11852
12091
|
selected && (React.createElement("span", { style: { fontWeight: 400, marginLeft: 6, color: 'var(--seekora-text-secondary, inherit)' } }, selected))),
|
|
11853
|
-
mode === 'dropdown' ? (React.createElement("
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
option.
|
|
11869
|
-
option.values.map((value) => {
|
|
11870
|
-
const available = showAvailability
|
|
11871
|
-
? getAvailability(option.name, value, options, variants, selections)
|
|
11872
|
-
: true;
|
|
11873
|
-
return (React.createElement("option", { key: value, value: value, disabled: !available },
|
|
11874
|
-
value,
|
|
11875
|
-
!available ? ' (Unavailable)' : ''));
|
|
11876
|
-
}))) : (React.createElement("div", { className: "seekora-variant-buttons", style: { display: 'flex', flexWrap: 'wrap', gap: 8 } }, option.values.map((value) => {
|
|
12092
|
+
mode === 'dropdown' ? (React.createElement("div", { onMouseDown: (e) => e.stopPropagation(), onClick: (e) => e.stopPropagation() },
|
|
12093
|
+
React.createElement(CustomSelect, { className: "seekora-variant-dropdown", value: selected ?? '', onChange: (val) => onSelectionChange(option.name, val), placeholder: `Select ${option.name}`, "aria-label": `Select ${option.name}`, options: option.values.map((val) => {
|
|
12094
|
+
const available = showAvailability
|
|
12095
|
+
? getAvailability(option.name, val, options, variants, selections)
|
|
12096
|
+
: true;
|
|
12097
|
+
return {
|
|
12098
|
+
value: val,
|
|
12099
|
+
label: available ? val : `${val} (Unavailable)`,
|
|
12100
|
+
disabled: !available,
|
|
12101
|
+
};
|
|
12102
|
+
}), style: {
|
|
12103
|
+
minWidth: 120,
|
|
12104
|
+
'--seekora-select-border': 'var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
12105
|
+
'--seekora-select-bg': 'var(--seekora-bg-surface, transparent)',
|
|
12106
|
+
'--seekora-select-color': 'var(--seekora-text-primary, inherit)',
|
|
12107
|
+
} }))) : (React.createElement("div", { className: "seekora-variant-buttons", style: { display: 'flex', flexWrap: 'wrap', gap: 8 } }, option.values.map((value) => {
|
|
11877
12108
|
const isActive = selected === value;
|
|
11878
12109
|
const available = showAvailability
|
|
11879
12110
|
? getAvailability(option.name, value, options, variants, selections)
|
|
@@ -18637,5 +18868,5 @@ function updateSuggestionsStyles(theme) {
|
|
|
18637
18868
|
injectSuggestionsStyles(theme, true);
|
|
18638
18869
|
}
|
|
18639
18870
|
|
|
18640
|
-
export { ActionButtons, AmazonDropdown, AnalyticsProvider, BadgeList, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, DocSearch, DocSearchButton, DropdownPanel, FacetDropdown, Facets, FederatedDropdown, Fingerprint, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight$1 as Highlight, HitsPerPage, ImageDisplay, ImageZoom, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, PriceDisplay, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RatingDisplay, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsDropdownComposition, SuggestionsError, SuggestionsProvider, TrendingItems, TrendingList, VariantSelector, VariantSwatches, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBadges, extractBrand, extractCategory, extractProduct, extractSuggestion, findVariantBySelections, formatParsedFilters, formatPriceRange, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getAvailableValuesForOption, getFingerprint, getPriceRange, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, mergeThemes, minimalTheme, minimalThemeVariables, parseHighlightMarkup, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useAnalyticsProvider, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useFilters, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useProductAnalytics, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext, useVariantSelection, withAnalytics };
|
|
18871
|
+
export { ActionButtons, AmazonDropdown, AnalyticsProvider, BadgeList, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, CustomSelect, DocSearch, DocSearchButton, DropdownPanel, FacetDropdown, Facets, FederatedDropdown, Fingerprint, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight$1 as Highlight, HitsPerPage, ImageDisplay, ImageZoom, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, PriceDisplay, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RatingDisplay, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsDropdownComposition, SuggestionsError, SuggestionsProvider, TrendingItems, TrendingList, VariantSelector, VariantSwatches, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBadges, extractBrand, extractCategory, extractProduct, extractSuggestion, findVariantBySelections, formatParsedFilters, formatPriceRange, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getAvailableValuesForOption, getFingerprint, getPriceRange, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, mergeThemes, minimalTheme, minimalThemeVariables, parseHighlightMarkup, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useAnalyticsProvider, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useFilters, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useProductAnalytics, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext, useVariantSelection, withAnalytics };
|
|
18641
18872
|
//# sourceMappingURL=index.esm.js.map
|