@seekora-ai/ui-sdk-react 0.0.0-stage-20260517092419
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 +81 -0
- package/dist/components/CurrentRefinements.d.ts +63 -0
- package/dist/components/CurrentRefinements.d.ts.map +1 -0
- package/dist/components/CurrentRefinements.js +302 -0
- 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 +118 -0
- package/dist/components/Facets.d.ts.map +1 -0
- package/dist/components/Facets.js +785 -0
- package/dist/components/FederatedDropdown.d.ts +98 -0
- package/dist/components/FederatedDropdown.d.ts.map +1 -0
- package/dist/components/FederatedDropdown.js +526 -0
- package/dist/components/HierarchicalMenu.d.ts +55 -0
- package/dist/components/HierarchicalMenu.d.ts.map +1 -0
- package/dist/components/HierarchicalMenu.js +276 -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 +82 -0
- package/dist/components/InfiniteHits.d.ts +51 -0
- package/dist/components/InfiniteHits.d.ts.map +1 -0
- package/dist/components/InfiniteHits.js +173 -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 +90 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +298 -0
- package/dist/components/QuerySuggestions.d.ts +36 -0
- package/dist/components/QuerySuggestions.d.ts.map +1 -0
- package/dist/components/QuerySuggestions.js +71 -0
- package/dist/components/QuerySuggestionsDropdown.d.ts +82 -0
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -0
- package/dist/components/QuerySuggestionsDropdown.js +394 -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 +262 -0
- package/dist/components/Recommendations.d.ts +89 -0
- package/dist/components/Recommendations.d.ts.map +1 -0
- package/dist/components/Recommendations.js +256 -0
- package/dist/components/RichQuerySuggestions.d.ts +88 -0
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -0
- package/dist/components/RichQuerySuggestions.js +498 -0
- package/dist/components/SearchBar.d.ts +57 -0
- package/dist/components/SearchBar.d.ts.map +1 -0
- package/dist/components/SearchBar.js +361 -0
- package/dist/components/SearchBarWithSuggestions.d.ts +105 -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 +61 -0
- package/dist/components/SearchProvider.d.ts +35 -0
- package/dist/components/SearchProvider.d.ts.map +1 -0
- package/dist/components/SearchProvider.js +53 -0
- package/dist/components/SearchResults.d.ts +57 -0
- package/dist/components/SearchResults.d.ts.map +1 -0
- package/dist/components/SearchResults.js +456 -0
- package/dist/components/SortBy.d.ts +84 -0
- package/dist/components/SortBy.d.ts.map +1 -0
- package/dist/components/SortBy.js +183 -0
- package/dist/components/Stats.d.ts +51 -0
- package/dist/components/Stats.d.ts.map +1 -0
- package/dist/components/Stats.js +201 -0
- package/dist/components/primitives/ActionButtons.d.ts +27 -0
- package/dist/components/primitives/ActionButtons.d.ts.map +1 -0
- package/dist/components/primitives/ActionButtons.js +102 -0
- package/dist/components/primitives/AnalyticsProvider.d.ts +22 -0
- package/dist/components/primitives/AnalyticsProvider.d.ts.map +1 -0
- package/dist/components/primitives/AnalyticsProvider.js +87 -0
- package/dist/components/primitives/BadgeList.d.ts +14 -0
- package/dist/components/primitives/BadgeList.d.ts.map +1 -0
- package/dist/components/primitives/BadgeList.js +65 -0
- 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/ImageDisplay.d.ts +28 -0
- package/dist/components/primitives/ImageDisplay.d.ts.map +1 -0
- package/dist/components/primitives/ImageDisplay.js +127 -0
- package/dist/components/primitives/ImageZoom.d.ts +33 -0
- package/dist/components/primitives/ImageZoom.d.ts.map +1 -0
- package/dist/components/primitives/ImageZoom.js +433 -0
- package/dist/components/primitives/PriceDisplay.d.ts +21 -0
- package/dist/components/primitives/PriceDisplay.d.ts.map +1 -0
- package/dist/components/primitives/PriceDisplay.js +44 -0
- package/dist/components/primitives/RatingDisplay.d.ts +43 -0
- package/dist/components/primitives/RatingDisplay.d.ts.map +1 -0
- package/dist/components/primitives/RatingDisplay.js +114 -0
- package/dist/components/primitives/VariantSelector.d.ts +30 -0
- package/dist/components/primitives/VariantSelector.d.ts.map +1 -0
- package/dist/components/primitives/VariantSelector.js +155 -0
- package/dist/components/primitives/VariantSwatches.d.ts +28 -0
- package/dist/components/primitives/VariantSwatches.d.ts.map +1 -0
- package/dist/components/primitives/VariantSwatches.js +188 -0
- package/dist/components/primitives/index.d.ts +12 -0
- package/dist/components/primitives/index.d.ts.map +1 -0
- package/dist/components/primitives/index.js +11 -0
- package/dist/components/primitives/withAnalytics.d.ts +24 -0
- package/dist/components/primitives/withAnalytics.d.ts.map +1 -0
- package/dist/components/primitives/withAnalytics.js +73 -0
- package/dist/components/product-page/ProductGallery.d.ts +26 -0
- package/dist/components/product-page/ProductGallery.d.ts.map +1 -0
- package/dist/components/product-page/ProductGallery.js +13 -0
- package/dist/components/product-page/ProductInfo.d.ts +44 -0
- package/dist/components/product-page/ProductInfo.d.ts.map +1 -0
- package/dist/components/product-page/ProductInfo.js +34 -0
- package/dist/components/product-page/ProductRecommendations.d.ts +21 -0
- package/dist/components/product-page/ProductRecommendations.d.ts.map +1 -0
- package/dist/components/product-page/ProductRecommendations.js +17 -0
- package/dist/components/product-page/index.d.ts +4 -0
- package/dist/components/product-page/index.d.ts.map +1 -0
- package/dist/components/product-page/index.js +3 -0
- package/dist/components/section-primitives/SectionError.d.ts +11 -0
- package/dist/components/section-primitives/SectionError.d.ts.map +1 -0
- package/dist/components/section-primitives/SectionError.js +13 -0
- package/dist/components/section-primitives/SectionItemGrid.d.ts +18 -0
- package/dist/components/section-primitives/SectionItemGrid.d.ts.map +1 -0
- package/dist/components/section-primitives/SectionItemGrid.js +14 -0
- package/dist/components/section-primitives/SectionLoading.d.ts +11 -0
- package/dist/components/section-primitives/SectionLoading.d.ts.map +1 -0
- package/dist/components/section-primitives/SectionLoading.js +11 -0
- package/dist/components/section-primitives/SectionSearchContext.d.ts +17 -0
- package/dist/components/section-primitives/SectionSearchContext.d.ts.map +1 -0
- package/dist/components/section-primitives/SectionSearchContext.js +17 -0
- package/dist/components/section-primitives/SectionSearchProvider.d.ts +25 -0
- package/dist/components/section-primitives/SectionSearchProvider.d.ts.map +1 -0
- package/dist/components/section-primitives/SectionSearchProvider.js +106 -0
- package/dist/components/section-primitives/index.d.ts +5 -0
- package/dist/components/section-primitives/index.d.ts.map +1 -0
- package/dist/components/section-primitives/index.js +4 -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 +509 -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 +349 -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 +312 -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 +483 -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 +446 -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 +448 -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 +544 -0
- package/dist/components/suggestions/SuggestionSearchBar.d.ts +127 -0
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -0
- package/dist/components/suggestions/SuggestionSearchBar.js +644 -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 +511 -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 +259 -0
- package/dist/components/suggestions/utils.d.ts.map +1 -0
- package/dist/components/suggestions/utils.js +668 -0
- package/dist/components/suggestions-primitives/CategoriesTabs.d.ts +13 -0
- package/dist/components/suggestions-primitives/CategoriesTabs.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/CategoriesTabs.js +35 -0
- package/dist/components/suggestions-primitives/DropdownPanel.d.ts +24 -0
- package/dist/components/suggestions-primitives/DropdownPanel.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/DropdownPanel.js +67 -0
- package/dist/components/suggestions-primitives/ItemCard.d.ts +48 -0
- package/dist/components/suggestions-primitives/ItemCard.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/ItemCard.js +103 -0
- package/dist/components/suggestions-primitives/ItemGrid.d.ts +28 -0
- package/dist/components/suggestions-primitives/ItemGrid.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/ItemGrid.js +55 -0
- package/dist/components/suggestions-primitives/ProductCard.d.ts +45 -0
- package/dist/components/suggestions-primitives/ProductCard.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/ProductCard.js +177 -0
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts +44 -0
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +137 -0
- package/dist/components/suggestions-primitives/ProductGrid.d.ts +22 -0
- package/dist/components/suggestions-primitives/ProductGrid.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/ProductGrid.js +41 -0
- package/dist/components/suggestions-primitives/RecentSearchesList.d.ts +17 -0
- package/dist/components/suggestions-primitives/RecentSearchesList.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/RecentSearchesList.js +46 -0
- package/dist/components/suggestions-primitives/SearchInput.d.ts +23 -0
- package/dist/components/suggestions-primitives/SearchInput.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SearchInput.js +114 -0
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts +31 -0
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionItem.js +47 -0
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +26 -0
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionList.js +35 -0
- package/dist/components/suggestions-primitives/SuggestionsContext.d.ts +44 -0
- package/dist/components/suggestions-primitives/SuggestionsContext.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionsContext.js +18 -0
- package/dist/components/suggestions-primitives/SuggestionsDropdownComposition.d.ts +24 -0
- package/dist/components/suggestions-primitives/SuggestionsDropdownComposition.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionsDropdownComposition.js +30 -0
- package/dist/components/suggestions-primitives/SuggestionsError.d.ts +11 -0
- package/dist/components/suggestions-primitives/SuggestionsError.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionsError.js +19 -0
- package/dist/components/suggestions-primitives/SuggestionsLoading.d.ts +11 -0
- package/dist/components/suggestions-primitives/SuggestionsLoading.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionsLoading.js +17 -0
- package/dist/components/suggestions-primitives/SuggestionsProvider.d.ts +38 -0
- package/dist/components/suggestions-primitives/SuggestionsProvider.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/SuggestionsProvider.js +259 -0
- package/dist/components/suggestions-primitives/TrendingList.d.ts +17 -0
- package/dist/components/suggestions-primitives/TrendingList.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/TrendingList.js +48 -0
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts +31 -0
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/highlightMarkup.js +70 -0
- package/dist/components/suggestions-primitives/index.d.ts +39 -0
- package/dist/components/suggestions-primitives/index.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/index.js +24 -0
- package/dist/docsearch/components/DocSearch.d.ts +4 -0
- package/dist/docsearch/components/DocSearch.d.ts.map +1 -0
- package/dist/docsearch/components/DocSearch.js +93 -0
- package/dist/docsearch/components/DocSearchButton.d.ts +4 -0
- package/dist/docsearch/components/DocSearchButton.d.ts.map +1 -0
- package/dist/docsearch/components/DocSearchButton.js +12 -0
- package/dist/docsearch/components/Footer.d.ts +8 -0
- package/dist/docsearch/components/Footer.d.ts.map +1 -0
- package/dist/docsearch/components/Footer.js +40 -0
- package/dist/docsearch/components/Highlight.d.ts +9 -0
- package/dist/docsearch/components/Highlight.d.ts.map +1 -0
- package/dist/docsearch/components/Highlight.js +48 -0
- package/dist/docsearch/components/Hit.d.ts +15 -0
- package/dist/docsearch/components/Hit.d.ts.map +1 -0
- package/dist/docsearch/components/Hit.js +96 -0
- package/dist/docsearch/components/Modal.d.ts +10 -0
- package/dist/docsearch/components/Modal.d.ts.map +1 -0
- package/dist/docsearch/components/Modal.js +57 -0
- package/dist/docsearch/components/Results.d.ts +23 -0
- package/dist/docsearch/components/Results.d.ts.map +1 -0
- package/dist/docsearch/components/Results.js +141 -0
- package/dist/docsearch/components/SearchBox.d.ts +11 -0
- package/dist/docsearch/components/SearchBox.d.ts.map +1 -0
- package/dist/docsearch/components/SearchBox.js +16 -0
- package/dist/docsearch/hooks/useDocSearch.d.ts +33 -0
- package/dist/docsearch/hooks/useDocSearch.d.ts.map +1 -0
- package/dist/docsearch/hooks/useDocSearch.js +224 -0
- package/dist/docsearch/hooks/useKeyboard.d.ts +17 -0
- package/dist/docsearch/hooks/useKeyboard.d.ts.map +1 -0
- package/dist/docsearch/hooks/useKeyboard.js +71 -0
- package/dist/docsearch/hooks/useSeekoraSearch.d.ts +27 -0
- package/dist/docsearch/hooks/useSeekoraSearch.d.ts.map +1 -0
- package/dist/docsearch/hooks/useSeekoraSearch.js +213 -0
- package/dist/docsearch/index.d.ts +13 -0
- package/dist/docsearch/index.d.ts.map +1 -0
- package/dist/docsearch/index.js +11 -0
- package/dist/docsearch/types.d.ts +175 -0
- package/dist/docsearch/types.d.ts.map +1 -0
- package/dist/docsearch/types.js +4 -0
- package/dist/docsearch.css +234 -0
- package/dist/hooks/useAnalytics.d.ts +24 -0
- package/dist/hooks/useAnalytics.d.ts.map +1 -0
- package/dist/hooks/useAnalytics.js +67 -0
- package/dist/hooks/useClickTracking.d.ts +36 -0
- package/dist/hooks/useClickTracking.d.ts.map +1 -0
- package/dist/hooks/useClickTracking.js +89 -0
- package/dist/hooks/useExperiment.d.ts +25 -0
- package/dist/hooks/useExperiment.d.ts.map +1 -0
- package/dist/hooks/useExperiment.js +123 -0
- package/dist/hooks/useFilters.d.ts +27 -0
- package/dist/hooks/useFilters.d.ts.map +1 -0
- package/dist/hooks/useFilters.js +86 -0
- package/dist/hooks/useKeyboardNavigation.d.ts +51 -0
- package/dist/hooks/useKeyboardNavigation.d.ts.map +1 -0
- package/dist/hooks/useKeyboardNavigation.js +113 -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/useProductAnalytics.d.ts +49 -0
- package/dist/hooks/useProductAnalytics.d.ts.map +1 -0
- package/dist/hooks/useProductAnalytics.js +116 -0
- package/dist/hooks/useQuerySuggestions.d.ts +21 -0
- package/dist/hooks/useQuerySuggestions.d.ts.map +1 -0
- package/dist/hooks/useQuerySuggestions.js +84 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts +120 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts.map +1 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.js +444 -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 +93 -0
- package/dist/hooks/useSuggestionsAnalytics.d.ts.map +1 -0
- package/dist/hooks/useSuggestionsAnalytics.js +239 -0
- package/dist/hooks/useVariantSelection.d.ts +28 -0
- package/dist/hooks/useVariantSelection.d.ts.map +1 -0
- package/dist/hooks/useVariantSelection.js +44 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +110 -0
- package/dist/index.umd.js +1 -0
- package/dist/src/index.d.ts +4469 -0
- package/dist/src/index.esm.js +18952 -0
- package/dist/src/index.esm.js.map +1 -0
- package/dist/src/index.js +19086 -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/dist/utils/responsive.d.ts +130 -0
- package/dist/utils/responsive.d.ts.map +1 -0
- package/dist/utils/responsive.js +225 -0
- package/package.json +68 -0
- package/src/docsearch/docsearch.css +234 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FederatedDropdown Component
|
|
3
|
+
*
|
|
4
|
+
* Full-featured federated search dropdown with:
|
|
5
|
+
* - Multi-column layout (suggestions + products)
|
|
6
|
+
* - Filtered tabs with product results
|
|
7
|
+
* - Popular brands
|
|
8
|
+
* - Trending products
|
|
9
|
+
* - Category navigation
|
|
10
|
+
* - Responsive design
|
|
11
|
+
* - Rich product cards
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import type { SuggestionItem, ProductItem, FilteredTab, PopularBrand, QuerySuggestionsClassNames, QuerySuggestionsEventHandlers } from '@seekora-ai/ui-sdk-types';
|
|
15
|
+
export interface FederatedDropdownProps extends QuerySuggestionsEventHandlers {
|
|
16
|
+
/** Current query string */
|
|
17
|
+
query: string;
|
|
18
|
+
/** Whether the dropdown is visible */
|
|
19
|
+
isOpen?: boolean;
|
|
20
|
+
/** Maximum suggestions to show */
|
|
21
|
+
maxSuggestions?: number;
|
|
22
|
+
/** Maximum products to show per section */
|
|
23
|
+
maxProducts?: number;
|
|
24
|
+
/** Maximum brands to show */
|
|
25
|
+
maxBrands?: number;
|
|
26
|
+
/** Minimum query length */
|
|
27
|
+
minQueryLength?: number;
|
|
28
|
+
/** Debounce delay in ms */
|
|
29
|
+
debounceMs?: number;
|
|
30
|
+
/** Filtered tabs configuration */
|
|
31
|
+
filteredTabs?: Array<{
|
|
32
|
+
id?: string;
|
|
33
|
+
label: string;
|
|
34
|
+
filter: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Show products section */
|
|
37
|
+
showProducts?: boolean;
|
|
38
|
+
/** Show brands section */
|
|
39
|
+
showBrands?: boolean;
|
|
40
|
+
/** Show filtered tabs */
|
|
41
|
+
showFilteredTabs?: boolean;
|
|
42
|
+
/** Show recent searches */
|
|
43
|
+
showRecentSearches?: boolean;
|
|
44
|
+
/** Layout mode */
|
|
45
|
+
layout?: 'side-by-side' | 'stacked' | 'full-width';
|
|
46
|
+
/** Products column width (for side-by-side) */
|
|
47
|
+
productsColumnWidth?: string;
|
|
48
|
+
/** Suggestions column width (for side-by-side) */
|
|
49
|
+
suggestionsColumnWidth?: string;
|
|
50
|
+
/** Show product prices */
|
|
51
|
+
showPrices?: boolean;
|
|
52
|
+
/** Currency symbol */
|
|
53
|
+
currencySymbol?: string;
|
|
54
|
+
/** Custom class names */
|
|
55
|
+
classNames?: QuerySuggestionsClassNames;
|
|
56
|
+
/** Custom styles */
|
|
57
|
+
style?: React.CSSProperties;
|
|
58
|
+
/** Custom product card renderer */
|
|
59
|
+
renderProduct?: (product: ProductItem, index: number) => React.ReactNode;
|
|
60
|
+
/** Custom suggestion renderer */
|
|
61
|
+
renderSuggestion?: (suggestion: SuggestionItem, index: number, isActive: boolean) => React.ReactNode;
|
|
62
|
+
/** Custom brand renderer */
|
|
63
|
+
renderBrand?: (brand: PopularBrand, index: number) => React.ReactNode;
|
|
64
|
+
/** Custom tab renderer */
|
|
65
|
+
renderTab?: (tab: FilteredTab, isActive: boolean) => React.ReactNode;
|
|
66
|
+
/** Header content */
|
|
67
|
+
header?: React.ReactNode;
|
|
68
|
+
/** Footer content */
|
|
69
|
+
footer?: React.ReactNode;
|
|
70
|
+
/** View all products link */
|
|
71
|
+
viewAllProductsLink?: string;
|
|
72
|
+
/** Width */
|
|
73
|
+
width?: string | number;
|
|
74
|
+
/** Max height */
|
|
75
|
+
maxHeight?: string | number;
|
|
76
|
+
/** Z-index */
|
|
77
|
+
zIndex?: number;
|
|
78
|
+
/** Analytics tags */
|
|
79
|
+
analyticsTags?: string[];
|
|
80
|
+
/** Include facets in suggestions API response */
|
|
81
|
+
includeFacets?: boolean;
|
|
82
|
+
/** Include categories in suggestions API response */
|
|
83
|
+
includeCategories?: boolean;
|
|
84
|
+
/** Include dropdown recommendations (trending products, top searches, etc.) */
|
|
85
|
+
includeDropdownRecommendations?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface FederatedDropdownRef {
|
|
88
|
+
getActiveIndex: () => number;
|
|
89
|
+
setActiveIndex: (index: number) => void;
|
|
90
|
+
selectActive: () => void;
|
|
91
|
+
navigateNext: () => void;
|
|
92
|
+
navigatePrevious: () => void;
|
|
93
|
+
getActiveTab: () => string | null;
|
|
94
|
+
setActiveTab: (tabId: string) => void;
|
|
95
|
+
}
|
|
96
|
+
export declare const FederatedDropdown: React.ForwardRefExoticComponent<FederatedDropdownProps & React.RefAttributes<FederatedDropdownRef>>;
|
|
97
|
+
export default FederatedDropdown;
|
|
98
|
+
//# sourceMappingURL=FederatedDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FederatedDropdown.d.ts","sourceRoot":"","sources":["../../src/components/FederatedDropdown.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FederatedDropdown Component
|
|
3
|
+
*
|
|
4
|
+
* Full-featured federated search dropdown with:
|
|
5
|
+
* - Multi-column layout (suggestions + products)
|
|
6
|
+
* - Filtered tabs with product results
|
|
7
|
+
* - Popular brands
|
|
8
|
+
* - Trending products
|
|
9
|
+
* - Category navigation
|
|
10
|
+
* - Responsive design
|
|
11
|
+
* - Rich product cards
|
|
12
|
+
*/
|
|
13
|
+
import React, { useState, useRef, useCallback, useMemo, forwardRef, useImperativeHandle, } from 'react';
|
|
14
|
+
import { useSearchContext } from './SearchProvider';
|
|
15
|
+
import { useQuerySuggestionsEnhanced } from '../hooks/useQuerySuggestionsEnhanced';
|
|
16
|
+
import { clsx } from 'clsx';
|
|
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
|
+
// ============================================================================
|
|
32
|
+
// Styles
|
|
33
|
+
// ============================================================================
|
|
34
|
+
const styles = {
|
|
35
|
+
container: {
|
|
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)`,
|
|
39
|
+
boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
},
|
|
42
|
+
header: {
|
|
43
|
+
padding: '12px 20px',
|
|
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))',
|
|
46
|
+
},
|
|
47
|
+
content: {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
overflowY: 'auto',
|
|
50
|
+
},
|
|
51
|
+
contentStacked: {
|
|
52
|
+
flexDirection: 'column',
|
|
53
|
+
},
|
|
54
|
+
suggestionsColumn: {
|
|
55
|
+
borderRight: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
56
|
+
overflowY: 'auto',
|
|
57
|
+
},
|
|
58
|
+
productsColumn: {
|
|
59
|
+
flex: 1,
|
|
60
|
+
overflowY: 'auto',
|
|
61
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
62
|
+
},
|
|
63
|
+
section: {
|
|
64
|
+
padding: '12px 0',
|
|
65
|
+
},
|
|
66
|
+
sectionHeader: {
|
|
67
|
+
display: 'flex',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'space-between',
|
|
70
|
+
padding: '0 20px 8px',
|
|
71
|
+
},
|
|
72
|
+
sectionTitle: {
|
|
73
|
+
fontSize: '11px',
|
|
74
|
+
fontWeight: 700,
|
|
75
|
+
color: 'var(--seekora-text-tertiary, #9ca3af)',
|
|
76
|
+
textTransform: 'uppercase',
|
|
77
|
+
letterSpacing: '0.08em',
|
|
78
|
+
margin: 0,
|
|
79
|
+
},
|
|
80
|
+
viewAllLink: {
|
|
81
|
+
fontSize: '12px',
|
|
82
|
+
color: 'var(--seekora-primary, #3b82f6)',
|
|
83
|
+
textDecoration: 'none',
|
|
84
|
+
fontWeight: 600,
|
|
85
|
+
cursor: 'pointer',
|
|
86
|
+
},
|
|
87
|
+
suggestionItem: {
|
|
88
|
+
display: 'flex',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
padding: '10px 20px',
|
|
91
|
+
cursor: 'pointer',
|
|
92
|
+
transition: `background-color ${TRANSITIONS.fast}`,
|
|
93
|
+
gap: '12px',
|
|
94
|
+
},
|
|
95
|
+
suggestionItemActive: {
|
|
96
|
+
backgroundColor: 'var(--seekora-bg-hover, #f3f4f6)',
|
|
97
|
+
},
|
|
98
|
+
suggestionIcon: {
|
|
99
|
+
width: '16px',
|
|
100
|
+
height: '16px',
|
|
101
|
+
color: 'var(--seekora-text-secondary, #6b7280)',
|
|
102
|
+
flexShrink: 0,
|
|
103
|
+
},
|
|
104
|
+
suggestionText: {
|
|
105
|
+
flex: 1,
|
|
106
|
+
fontSize: '14px',
|
|
107
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
108
|
+
fontWeight: 500,
|
|
109
|
+
overflow: 'hidden',
|
|
110
|
+
textOverflow: 'ellipsis',
|
|
111
|
+
whiteSpace: 'nowrap',
|
|
112
|
+
},
|
|
113
|
+
suggestionArrow: {
|
|
114
|
+
width: '16px',
|
|
115
|
+
height: '16px',
|
|
116
|
+
color: 'var(--seekora-text-tertiary, #d1d5db)',
|
|
117
|
+
opacity: 0,
|
|
118
|
+
transition: 'opacity 100ms ease',
|
|
119
|
+
},
|
|
120
|
+
suggestionArrowVisible: {
|
|
121
|
+
opacity: 1,
|
|
122
|
+
},
|
|
123
|
+
suggestionCount: {
|
|
124
|
+
fontSize: '12px',
|
|
125
|
+
color: 'var(--seekora-text-tertiary, #9ca3af)',
|
|
126
|
+
},
|
|
127
|
+
tabsContainer: {
|
|
128
|
+
display: 'flex',
|
|
129
|
+
gap: '4px',
|
|
130
|
+
padding: '12px 20px',
|
|
131
|
+
borderBottom: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
132
|
+
overflowX: 'auto',
|
|
133
|
+
},
|
|
134
|
+
tab: {
|
|
135
|
+
display: 'flex',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
gap: '6px',
|
|
138
|
+
padding: '8px 16px',
|
|
139
|
+
fontSize: '13px',
|
|
140
|
+
fontWeight: 500,
|
|
141
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
142
|
+
backgroundColor: 'transparent',
|
|
143
|
+
border: '1px solid transparent',
|
|
144
|
+
borderRadius: `${BORDER_RADIUS.full}px`,
|
|
145
|
+
cursor: 'pointer',
|
|
146
|
+
whiteSpace: 'nowrap',
|
|
147
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
148
|
+
},
|
|
149
|
+
tabActive: {
|
|
150
|
+
color: 'var(--seekora-primary, #3b82f6)',
|
|
151
|
+
backgroundColor: 'var(--seekora-primary-light, #eff6ff)',
|
|
152
|
+
borderColor: 'var(--seekora-primary, #3b82f6)',
|
|
153
|
+
},
|
|
154
|
+
tabCount: {
|
|
155
|
+
fontSize: '11px',
|
|
156
|
+
fontWeight: 600,
|
|
157
|
+
padding: '2px 6px',
|
|
158
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
159
|
+
backgroundColor: 'var(--seekora-bg-tertiary, rgba(255, 255, 255, 0.1))',
|
|
160
|
+
},
|
|
161
|
+
tabCountActive: {
|
|
162
|
+
backgroundColor: 'var(--seekora-primary, #3b82f6)',
|
|
163
|
+
color: 'white',
|
|
164
|
+
},
|
|
165
|
+
productsGrid: {
|
|
166
|
+
display: 'grid',
|
|
167
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(140px, 1fr))',
|
|
168
|
+
gap: '16px',
|
|
169
|
+
padding: '16px 20px',
|
|
170
|
+
},
|
|
171
|
+
productCard: {
|
|
172
|
+
display: 'flex',
|
|
173
|
+
flexDirection: 'column',
|
|
174
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
175
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
176
|
+
overflow: 'hidden',
|
|
177
|
+
cursor: 'pointer',
|
|
178
|
+
transition: `transform ${TRANSITIONS.fast}, box-shadow ${TRANSITIONS.fast}`,
|
|
179
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
180
|
+
},
|
|
181
|
+
productCardHover: {
|
|
182
|
+
transform: 'translateY(-2px)',
|
|
183
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',
|
|
184
|
+
},
|
|
185
|
+
productImage: {
|
|
186
|
+
width: '100%',
|
|
187
|
+
aspectRatio: '1',
|
|
188
|
+
objectFit: 'cover',
|
|
189
|
+
backgroundColor: 'var(--seekora-bg-secondary, #f3f4f6)',
|
|
190
|
+
},
|
|
191
|
+
productInfo: {
|
|
192
|
+
padding: '10px',
|
|
193
|
+
},
|
|
194
|
+
productTitle: {
|
|
195
|
+
fontSize: '13px',
|
|
196
|
+
fontWeight: 500,
|
|
197
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
198
|
+
margin: 0,
|
|
199
|
+
overflow: 'hidden',
|
|
200
|
+
textOverflow: 'ellipsis',
|
|
201
|
+
display: '-webkit-box',
|
|
202
|
+
WebkitLineClamp: 2,
|
|
203
|
+
WebkitBoxOrient: 'vertical',
|
|
204
|
+
lineHeight: 1.3,
|
|
205
|
+
},
|
|
206
|
+
productPrice: {
|
|
207
|
+
fontSize: '14px',
|
|
208
|
+
fontWeight: 700,
|
|
209
|
+
color: 'var(--seekora-primary, #3b82f6)',
|
|
210
|
+
marginTop: '4px',
|
|
211
|
+
},
|
|
212
|
+
brandsGrid: {
|
|
213
|
+
display: 'flex',
|
|
214
|
+
flexWrap: 'wrap',
|
|
215
|
+
gap: '8px',
|
|
216
|
+
padding: '8px 20px 16px',
|
|
217
|
+
},
|
|
218
|
+
brandChip: {
|
|
219
|
+
display: 'inline-flex',
|
|
220
|
+
alignItems: 'center',
|
|
221
|
+
gap: '8px',
|
|
222
|
+
padding: '8px 14px',
|
|
223
|
+
fontSize: '13px',
|
|
224
|
+
fontWeight: 500,
|
|
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`,
|
|
229
|
+
cursor: 'pointer',
|
|
230
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
231
|
+
},
|
|
232
|
+
brandChipHover: {
|
|
233
|
+
borderColor: 'var(--seekora-primary, #3b82f6)',
|
|
234
|
+
backgroundColor: 'var(--seekora-primary-light, #eff6ff)',
|
|
235
|
+
},
|
|
236
|
+
brandLogo: {
|
|
237
|
+
width: '20px',
|
|
238
|
+
height: '20px',
|
|
239
|
+
borderRadius: `${BORDER_RADIUS.sm}px`,
|
|
240
|
+
objectFit: 'contain',
|
|
241
|
+
backgroundColor: 'var(--seekora-bg-secondary, #f3f4f6)',
|
|
242
|
+
},
|
|
243
|
+
footer: {
|
|
244
|
+
padding: '12px 20px',
|
|
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))',
|
|
247
|
+
display: 'flex',
|
|
248
|
+
alignItems: 'center',
|
|
249
|
+
justifyContent: 'space-between',
|
|
250
|
+
fontSize: '12px',
|
|
251
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
252
|
+
},
|
|
253
|
+
emptyState: {
|
|
254
|
+
padding: '48px 20px',
|
|
255
|
+
textAlign: 'center',
|
|
256
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
257
|
+
},
|
|
258
|
+
highlight: {
|
|
259
|
+
backgroundColor: 'var(--seekora-highlight-bg, #fef9c3)',
|
|
260
|
+
fontWeight: 600,
|
|
261
|
+
padding: '0 2px',
|
|
262
|
+
borderRadius: `${BORDER_RADIUS.sm / 2}px`,
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
// ============================================================================
|
|
266
|
+
// Icons
|
|
267
|
+
// ============================================================================
|
|
268
|
+
const SearchIcon = ({ style }) => (React.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", style: { ...styles.suggestionIcon, ...style } },
|
|
269
|
+
React.createElement("path", { fillRule: "evenodd", d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z", clipRule: "evenodd" })));
|
|
270
|
+
const ClockIcon = ({ style }) => (React.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", style: { ...styles.suggestionIcon, ...style } },
|
|
271
|
+
React.createElement("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z", clipRule: "evenodd" })));
|
|
272
|
+
const ArrowRightIcon = ({ style }) => (React.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", style: { ...styles.suggestionArrow, ...style } },
|
|
273
|
+
React.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" })));
|
|
274
|
+
const TrendingIcon = ({ style }) => (React.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", style: { width: 14, height: 14, color: '#10b981', ...style } },
|
|
275
|
+
React.createElement("path", { fillRule: "evenodd", d: "M12 7a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0V8.414l-4.293 4.293a1 1 0 01-1.414 0L8 10.414l-4.293 4.293a1 1 0 01-1.414-1.414l5-5a1 1 0 011.414 0L11 10.586 14.586 7H12z", clipRule: "evenodd" })));
|
|
276
|
+
const ImagePlaceholder = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", style: { width: '40%', height: '40%', color: '#d1d5db' } },
|
|
277
|
+
React.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2", strokeWidth: "2" }),
|
|
278
|
+
React.createElement("circle", { cx: "8.5", cy: "8.5", r: "1.5", strokeWidth: "2" }),
|
|
279
|
+
React.createElement("polyline", { points: "21 15 16 10 5 21", strokeWidth: "2" })));
|
|
280
|
+
// ============================================================================
|
|
281
|
+
// Component
|
|
282
|
+
// ============================================================================
|
|
283
|
+
export const FederatedDropdown = forwardRef(function FederatedDropdown(props, ref) {
|
|
284
|
+
const { query, isOpen = true, maxSuggestions = 8, maxProducts = 8, maxBrands = 8, minQueryLength = 0, debounceMs = 200, filteredTabs: tabsConfig, showProducts = true, showBrands = true, showFilteredTabs = true, showRecentSearches = true, layout = 'side-by-side', productsColumnWidth = '60%', suggestionsColumnWidth = '40%', showPrices = true, currencySymbol = '$', classNames = {}, style, renderProduct, renderSuggestion, renderBrand, renderTab, header, footer, viewAllProductsLink, width = '800px', maxHeight = '600px', zIndex = 1000, analyticsTags, includeFacets: includeFacetsProp = true, includeCategories: includeCategoriesProp = true, includeDropdownRecommendations: includeDropdownRecommendationsProp = true, onSuggestionSelect, onProductClick, onBrandClick, onTabSelect, onRecentSearchClick, onRecentSearchRemove, onViewAllClick, onOpen, onClose, } = props;
|
|
285
|
+
const { client } = useSearchContext();
|
|
286
|
+
const containerRef = useRef(null);
|
|
287
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
288
|
+
const [activeTab, setActiveTab] = useState('all');
|
|
289
|
+
const [hoveredProduct, setHoveredProduct] = useState(null);
|
|
290
|
+
const [hoveredBrand, setHoveredBrand] = useState(null);
|
|
291
|
+
// Use enhanced hook
|
|
292
|
+
const { suggestions, loading, filteredTabs, trendingProducts, popularBrands, recentSearches, addRecentSearch, removeRecentSearch, hasContent, } = useQuerySuggestionsEnhanced({
|
|
293
|
+
client,
|
|
294
|
+
query,
|
|
295
|
+
enabled: isOpen,
|
|
296
|
+
debounceMs,
|
|
297
|
+
maxSuggestions,
|
|
298
|
+
minQueryLength,
|
|
299
|
+
includeDropdownRecommendations: includeDropdownRecommendationsProp,
|
|
300
|
+
includeCategories: includeCategoriesProp,
|
|
301
|
+
includeFacets: includeFacetsProp,
|
|
302
|
+
filteredTabs: tabsConfig,
|
|
303
|
+
analyticsTags,
|
|
304
|
+
enableRecentSearches: showRecentSearches,
|
|
305
|
+
});
|
|
306
|
+
// Get products for current tab
|
|
307
|
+
const currentTabProducts = useMemo(() => {
|
|
308
|
+
if (activeTab === 'all') {
|
|
309
|
+
// Combine trending products with first tab products
|
|
310
|
+
const allProducts = [...trendingProducts];
|
|
311
|
+
filteredTabs.forEach(tab => {
|
|
312
|
+
if (tab.products) {
|
|
313
|
+
tab.products.forEach(product => {
|
|
314
|
+
if (!allProducts.find(p => p.id === product.id)) {
|
|
315
|
+
allProducts.push(product);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
return allProducts.slice(0, maxProducts);
|
|
321
|
+
}
|
|
322
|
+
const tab = filteredTabs.find(t => t.id === activeTab);
|
|
323
|
+
return tab?.products?.slice(0, maxProducts) || [];
|
|
324
|
+
}, [activeTab, filteredTabs, trendingProducts, maxProducts]);
|
|
325
|
+
// All navigable items
|
|
326
|
+
const allItems = useMemo(() => {
|
|
327
|
+
const items = [];
|
|
328
|
+
// Recent searches (when no query)
|
|
329
|
+
if (query.length === 0 && showRecentSearches) {
|
|
330
|
+
recentSearches.slice(0, 5).forEach(search => {
|
|
331
|
+
items.push({ type: 'recent', data: search });
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
// Suggestions
|
|
335
|
+
suggestions.forEach(suggestion => {
|
|
336
|
+
items.push({ type: 'suggestion', data: suggestion });
|
|
337
|
+
});
|
|
338
|
+
return items;
|
|
339
|
+
}, [query, showRecentSearches, recentSearches, suggestions]);
|
|
340
|
+
// Navigation
|
|
341
|
+
const navigateNext = useCallback(() => {
|
|
342
|
+
setActiveIndex(prev => (prev < allItems.length - 1 ? prev + 1 : 0));
|
|
343
|
+
}, [allItems.length]);
|
|
344
|
+
const navigatePrevious = useCallback(() => {
|
|
345
|
+
setActiveIndex(prev => (prev > 0 ? prev - 1 : allItems.length - 1));
|
|
346
|
+
}, [allItems.length]);
|
|
347
|
+
const selectActive = useCallback(() => {
|
|
348
|
+
if (activeIndex < 0 || activeIndex >= allItems.length)
|
|
349
|
+
return;
|
|
350
|
+
const item = allItems[activeIndex];
|
|
351
|
+
if (item.type === 'recent') {
|
|
352
|
+
onRecentSearchClick?.(item.data);
|
|
353
|
+
}
|
|
354
|
+
else if (item.type === 'suggestion') {
|
|
355
|
+
onSuggestionSelect?.(item.data);
|
|
356
|
+
addRecentSearch(item.data.query);
|
|
357
|
+
}
|
|
358
|
+
}, [activeIndex, allItems, onRecentSearchClick, onSuggestionSelect, addRecentSearch]);
|
|
359
|
+
// Expose ref
|
|
360
|
+
useImperativeHandle(ref, () => ({
|
|
361
|
+
getActiveIndex: () => activeIndex,
|
|
362
|
+
setActiveIndex,
|
|
363
|
+
selectActive,
|
|
364
|
+
navigateNext,
|
|
365
|
+
navigatePrevious,
|
|
366
|
+
getActiveTab: () => activeTab,
|
|
367
|
+
setActiveTab,
|
|
368
|
+
}), [activeIndex, selectActive, navigateNext, navigatePrevious, activeTab]);
|
|
369
|
+
// Highlight query in text
|
|
370
|
+
const highlightQuery = (text) => {
|
|
371
|
+
if (!query)
|
|
372
|
+
return text;
|
|
373
|
+
const parts = text.split(new RegExp(`(${query})`, 'gi'));
|
|
374
|
+
return parts.map((part, i) => part.toLowerCase() === query.toLowerCase() ? (React.createElement("span", { key: i, style: styles.highlight }, part)) : part);
|
|
375
|
+
};
|
|
376
|
+
// Format price
|
|
377
|
+
const formatPrice = (price, currency) => {
|
|
378
|
+
if (price === undefined)
|
|
379
|
+
return '';
|
|
380
|
+
const symbol = currency || currencySymbol;
|
|
381
|
+
return `${symbol}${price.toLocaleString()}`;
|
|
382
|
+
};
|
|
383
|
+
// Handle tab change
|
|
384
|
+
const handleTabChange = (tabId) => {
|
|
385
|
+
setActiveTab(tabId);
|
|
386
|
+
const tab = filteredTabs.find(t => t.id === tabId);
|
|
387
|
+
if (tab) {
|
|
388
|
+
onTabSelect?.(tab);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
if (!isOpen)
|
|
392
|
+
return null;
|
|
393
|
+
const showTabs = showFilteredTabs && (filteredTabs.length > 0 || trendingProducts.length > 0);
|
|
394
|
+
const showProductsSection = showProducts && currentTabProducts.length > 0;
|
|
395
|
+
const showBrandsSection = showBrands && popularBrands.length > 0;
|
|
396
|
+
const showRecent = showRecentSearches && query.length === 0 && recentSearches.length > 0;
|
|
397
|
+
const showSuggestions = suggestions.length > 0;
|
|
398
|
+
const isStackedLayout = layout === 'stacked' || layout === 'full-width';
|
|
399
|
+
return (React.createElement("div", { ref: containerRef, role: "listbox", "aria-label": "Search suggestions and products", className: clsx('seekora-federated-dropdown', classNames.root, classNames.container), style: {
|
|
400
|
+
position: 'absolute',
|
|
401
|
+
width,
|
|
402
|
+
zIndex,
|
|
403
|
+
...styles.container,
|
|
404
|
+
...style,
|
|
405
|
+
} },
|
|
406
|
+
header && React.createElement("div", { style: styles.header }, header),
|
|
407
|
+
showTabs && (React.createElement("div", { style: styles.tabsContainer, className: classNames.tabsList },
|
|
408
|
+
React.createElement("button", { style: {
|
|
409
|
+
...styles.tab,
|
|
410
|
+
...(activeTab === 'all' ? styles.tabActive : {}),
|
|
411
|
+
}, onClick: () => handleTabChange('all'), className: clsx(classNames.tabItem, activeTab === 'all' && classNames.tabActive) },
|
|
412
|
+
"All Results",
|
|
413
|
+
trendingProducts.length > 0 && (React.createElement("span", { style: {
|
|
414
|
+
...styles.tabCount,
|
|
415
|
+
...(activeTab === 'all' ? styles.tabCountActive : {}),
|
|
416
|
+
} },
|
|
417
|
+
trendingProducts.length,
|
|
418
|
+
"+"))),
|
|
419
|
+
filteredTabs.map((tab) => (renderTab ? renderTab(tab, activeTab === tab.id) : (React.createElement("button", { key: tab.id, style: {
|
|
420
|
+
...styles.tab,
|
|
421
|
+
...(activeTab === tab.id ? styles.tabActive : {}),
|
|
422
|
+
}, onClick: () => handleTabChange(tab.id), className: clsx(classNames.tabItem, activeTab === tab.id && classNames.tabActive) },
|
|
423
|
+
tab.label,
|
|
424
|
+
tab.nb_hits !== undefined && (React.createElement("span", { style: {
|
|
425
|
+
...styles.tabCount,
|
|
426
|
+
...(activeTab === tab.id ? styles.tabCountActive : {}),
|
|
427
|
+
} }, tab.nb_hits)))))))),
|
|
428
|
+
React.createElement("div", { style: {
|
|
429
|
+
...styles.content,
|
|
430
|
+
...(isStackedLayout ? styles.contentStacked : {}),
|
|
431
|
+
maxHeight,
|
|
432
|
+
} },
|
|
433
|
+
React.createElement("div", { style: {
|
|
434
|
+
...styles.suggestionsColumn,
|
|
435
|
+
width: isStackedLayout ? '100%' : suggestionsColumnWidth,
|
|
436
|
+
minWidth: isStackedLayout ? undefined : '280px',
|
|
437
|
+
borderRight: isStackedLayout ? 'none' : styles.suggestionsColumn.borderRight,
|
|
438
|
+
} },
|
|
439
|
+
showRecent && (React.createElement("div", { style: styles.section, className: classNames.recentSearches },
|
|
440
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
441
|
+
React.createElement("h3", { style: styles.sectionTitle }, "Recent Searches")),
|
|
442
|
+
recentSearches.slice(0, 5).map((search, index) => {
|
|
443
|
+
const isActive = activeIndex === index;
|
|
444
|
+
return (React.createElement("div", { key: `recent-${search.query}`, role: "option", "aria-selected": isActive, style: {
|
|
445
|
+
...styles.suggestionItem,
|
|
446
|
+
...(isActive ? styles.suggestionItemActive : {}),
|
|
447
|
+
}, onClick: () => onRecentSearchClick?.(search), onMouseEnter: () => setActiveIndex(index), className: clsx(classNames.recentItem, isActive && classNames.suggestionItemActive) },
|
|
448
|
+
React.createElement(ClockIcon, null),
|
|
449
|
+
React.createElement("span", { style: styles.suggestionText }, search.query),
|
|
450
|
+
React.createElement(ArrowRightIcon, { style: isActive ? styles.suggestionArrowVisible : {} })));
|
|
451
|
+
}))),
|
|
452
|
+
showSuggestions && (React.createElement("div", { style: styles.section, className: classNames.suggestionsList },
|
|
453
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
454
|
+
React.createElement("h3", { style: styles.sectionTitle }, query ? 'Suggestions' : 'Popular Searches')),
|
|
455
|
+
suggestions.slice(0, maxSuggestions).map((suggestion, index) => {
|
|
456
|
+
const itemIndex = showRecent ? recentSearches.length + index : index;
|
|
457
|
+
const isActive = activeIndex === itemIndex;
|
|
458
|
+
return renderSuggestion ? renderSuggestion(suggestion, index, isActive) : (React.createElement("div", { key: suggestion.objectID || `suggestion-${index}`, role: "option", "aria-selected": isActive, style: {
|
|
459
|
+
...styles.suggestionItem,
|
|
460
|
+
...(isActive ? styles.suggestionItemActive : {}),
|
|
461
|
+
}, onClick: () => {
|
|
462
|
+
onSuggestionSelect?.(suggestion);
|
|
463
|
+
addRecentSearch(suggestion.query);
|
|
464
|
+
}, onMouseEnter: () => setActiveIndex(itemIndex), className: clsx(classNames.suggestionItem, isActive && classNames.suggestionItemActive) },
|
|
465
|
+
React.createElement(SearchIcon, null),
|
|
466
|
+
React.createElement("span", { style: styles.suggestionText }, highlightQuery(suggestion.query)),
|
|
467
|
+
suggestion.count !== undefined && (React.createElement("span", { style: styles.suggestionCount }, suggestion.count.toLocaleString())),
|
|
468
|
+
React.createElement(ArrowRightIcon, { style: isActive ? styles.suggestionArrowVisible : {} })));
|
|
469
|
+
}))),
|
|
470
|
+
showBrandsSection && (React.createElement("div", { style: styles.section, className: classNames.brandsList },
|
|
471
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
472
|
+
React.createElement("h3", { style: styles.sectionTitle }, "Popular Brands")),
|
|
473
|
+
React.createElement("div", { style: styles.brandsGrid }, popularBrands.slice(0, maxBrands).map((brand, index) => (renderBrand ? renderBrand(brand, index) : (React.createElement("button", { key: `brand-${brand.name}`, style: {
|
|
474
|
+
...styles.brandChip,
|
|
475
|
+
...(hoveredBrand === brand.name ? styles.brandChipHover : {}),
|
|
476
|
+
}, onClick: () => onBrandClick?.(brand), onMouseEnter: () => setHoveredBrand(brand.name), onMouseLeave: () => setHoveredBrand(null), className: classNames.brandItem },
|
|
477
|
+
brand.logo && (React.createElement("img", { src: brand.logo, alt: brand.name, style: styles.brandLogo, onError: (e) => {
|
|
478
|
+
e.target.style.display = 'none';
|
|
479
|
+
} })),
|
|
480
|
+
React.createElement("span", null, brand.name))))))))),
|
|
481
|
+
showProductsSection && !isStackedLayout && (React.createElement("div", { style: {
|
|
482
|
+
...styles.productsColumn,
|
|
483
|
+
width: productsColumnWidth,
|
|
484
|
+
} },
|
|
485
|
+
React.createElement("div", { style: styles.section },
|
|
486
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
487
|
+
React.createElement("h3", { style: styles.sectionTitle }, activeTab === 'all' ? 'Trending Products' : `Products in ${filteredTabs.find(t => t.id === activeTab)?.label || activeTab}`),
|
|
488
|
+
viewAllProductsLink && (React.createElement("a", { href: viewAllProductsLink, style: styles.viewAllLink, onClick: (e) => {
|
|
489
|
+
e.preventDefault();
|
|
490
|
+
onViewAllClick?.('products');
|
|
491
|
+
} }, "View all"))),
|
|
492
|
+
React.createElement("div", { style: styles.productsGrid, className: classNames.productsList }, currentTabProducts.map((product, index) => (renderProduct ? renderProduct(product, index) : (React.createElement("div", { key: product.id || product.objectID, style: {
|
|
493
|
+
...styles.productCard,
|
|
494
|
+
...(hoveredProduct === product.id ? styles.productCardHover : {}),
|
|
495
|
+
}, onClick: () => onProductClick?.(product), onMouseEnter: () => setHoveredProduct(product.id), onMouseLeave: () => setHoveredProduct(null), className: classNames.productItem },
|
|
496
|
+
product.image ? (React.createElement("img", { src: product.image, alt: product.title || product.name || '', style: styles.productImage, onError: (e) => {
|
|
497
|
+
e.target.style.display = 'none';
|
|
498
|
+
} })) : (React.createElement("div", { style: {
|
|
499
|
+
...styles.productImage,
|
|
500
|
+
display: 'flex',
|
|
501
|
+
alignItems: 'center',
|
|
502
|
+
justifyContent: 'center',
|
|
503
|
+
} },
|
|
504
|
+
React.createElement(ImagePlaceholder, null))),
|
|
505
|
+
React.createElement("div", { style: styles.productInfo },
|
|
506
|
+
React.createElement("h4", { style: styles.productTitle }, product.title || product.name),
|
|
507
|
+
showPrices && product.price !== undefined && (React.createElement("p", { style: styles.productPrice }, formatPrice(product.price, product.currency))))))))))))),
|
|
508
|
+
footer ? (React.createElement("div", { style: styles.footer }, footer)) : (React.createElement("div", { style: styles.footer },
|
|
509
|
+
React.createElement("span", null, "Press \u21B5 to search, \u2191\u2193 to navigate"),
|
|
510
|
+
query && (React.createElement("button", { style: { ...styles.viewAllLink, background: 'none', border: 'none' }, onClick: () => onViewAllClick?.('suggestions') },
|
|
511
|
+
"See all results for \"",
|
|
512
|
+
query,
|
|
513
|
+
"\"")))),
|
|
514
|
+
React.createElement("style", null, `
|
|
515
|
+
.seekora-federated-dropdown mark {
|
|
516
|
+
background-color: var(--seekora-highlight-bg, #fef9c3);
|
|
517
|
+
font-weight: 600;
|
|
518
|
+
border-radius: 2px;
|
|
519
|
+
padding: 0 2px;
|
|
520
|
+
}
|
|
521
|
+
.seekora-federated-dropdown [role="option"]:hover svg:last-child {
|
|
522
|
+
opacity: 1;
|
|
523
|
+
}
|
|
524
|
+
`)));
|
|
525
|
+
});
|
|
526
|
+
export default FederatedDropdown;
|