@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,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SortBy Component
|
|
3
|
+
*
|
|
4
|
+
* Displays sort options for search results in multiple display variants:
|
|
5
|
+
* - dropdown (default) — native select element
|
|
6
|
+
* - button-group — horizontal row of toggle buttons
|
|
7
|
+
* - radio-group — vertical list of radio inputs
|
|
8
|
+
*
|
|
9
|
+
* Integrates with SearchStateManager for automatic state sync.
|
|
10
|
+
*
|
|
11
|
+
* CSS Variables (apply on a parent element to customize):
|
|
12
|
+
* --seekora-sort-bg — background color
|
|
13
|
+
* --seekora-sort-color — text color
|
|
14
|
+
* --seekora-sort-border — border color
|
|
15
|
+
* --seekora-sort-active-bg — active item background
|
|
16
|
+
* --seekora-sort-active-color — active item text color
|
|
17
|
+
*/
|
|
18
|
+
import React, { useCallback, useEffect, useId } from 'react';
|
|
19
|
+
import { useSearchContext } from './SearchProvider';
|
|
20
|
+
import { useSearchState } from '../hooks/useSearchState';
|
|
21
|
+
import { clsx } from 'clsx';
|
|
22
|
+
import { CustomSelect } from './primitives/CustomSelect';
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Helpers
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
/** Map a size token to theme fontSize and spacing values. */
|
|
27
|
+
function sizeStyles(size, theme) {
|
|
28
|
+
switch (size) {
|
|
29
|
+
case 'small':
|
|
30
|
+
return { fontSize: theme.typography.fontSize.small, padding: theme.spacing.small };
|
|
31
|
+
case 'large':
|
|
32
|
+
return { fontSize: theme.typography.fontSize.large, padding: theme.spacing.medium };
|
|
33
|
+
case 'medium':
|
|
34
|
+
default:
|
|
35
|
+
return { fontSize: theme.typography.fontSize.medium, padding: theme.spacing.small };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function resolveBorderRadius(br) {
|
|
39
|
+
return typeof br === 'string' ? br : br.medium;
|
|
40
|
+
}
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// Component
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
export const SortBy = ({ options, value: valueProp, defaultValue, onSortChange, renderSelect, className, style, theme: customTheme, placeholder = 'Sort by...', syncWithState = true, variant = 'dropdown', label, showLabel, size = 'medium', }) => {
|
|
45
|
+
const { theme } = useSearchContext();
|
|
46
|
+
const { sortBy: stateManagerSortBy, setSortBy } = useSearchState();
|
|
47
|
+
const sortByTheme = customTheme || {};
|
|
48
|
+
const instanceId = useId();
|
|
49
|
+
// Determine whether the label should render.
|
|
50
|
+
const shouldShowLabel = showLabel !== undefined ? showLabel : !!label;
|
|
51
|
+
// ------ State ----------------------------------------------------------
|
|
52
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue || options[0]?.value || '');
|
|
53
|
+
// Sync with StateManager on mount if defaultValue is set
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (syncWithState && defaultValue && !stateManagerSortBy) {
|
|
56
|
+
setSortBy(defaultValue, false); // Don't trigger search on initial sync
|
|
57
|
+
}
|
|
58
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
59
|
+
// Determine the current value: controlled prop > StateManager > internal
|
|
60
|
+
const value = valueProp !== undefined
|
|
61
|
+
? valueProp
|
|
62
|
+
: syncWithState && stateManagerSortBy
|
|
63
|
+
? stateManagerSortBy
|
|
64
|
+
: internalValue;
|
|
65
|
+
// ------ Handlers -------------------------------------------------------
|
|
66
|
+
const handleChange = (e) => {
|
|
67
|
+
applyValue(e.target.value);
|
|
68
|
+
};
|
|
69
|
+
const applyValue = useCallback((newValue) => {
|
|
70
|
+
setInternalValue(newValue);
|
|
71
|
+
if (syncWithState) {
|
|
72
|
+
setSortBy(newValue);
|
|
73
|
+
}
|
|
74
|
+
if (onSortChange) {
|
|
75
|
+
onSortChange(newValue);
|
|
76
|
+
}
|
|
77
|
+
}, [syncWithState, setSortBy, onSortChange]);
|
|
78
|
+
// ------ Derived styles -------------------------------------------------
|
|
79
|
+
const { fontSize, padding } = sizeStyles(size, theme);
|
|
80
|
+
const borderRadius = resolveBorderRadius(theme.borderRadius);
|
|
81
|
+
const cssVarStyle = {
|
|
82
|
+
'--seekora-sort-bg': theme.colors.background,
|
|
83
|
+
'--seekora-sort-color': theme.colors.text,
|
|
84
|
+
'--seekora-sort-border': theme.colors.border,
|
|
85
|
+
'--seekora-sort-active-bg': theme.colors.primary,
|
|
86
|
+
'--seekora-sort-active-color': theme.colors.background,
|
|
87
|
+
};
|
|
88
|
+
// ------ Label ----------------------------------------------------------
|
|
89
|
+
const labelElement = shouldShowLabel && label ? (React.createElement("span", { className: clsx(sortByTheme.label), style: {
|
|
90
|
+
display: 'block',
|
|
91
|
+
marginBottom: theme.spacing.small,
|
|
92
|
+
fontSize,
|
|
93
|
+
color: 'var(--seekora-sort-color)',
|
|
94
|
+
fontWeight: 500,
|
|
95
|
+
} }, label)) : null;
|
|
96
|
+
// ------ Dropdown variant (original) ------------------------------------
|
|
97
|
+
if (variant === 'dropdown') {
|
|
98
|
+
if (renderSelect) {
|
|
99
|
+
return (React.createElement("div", { className: clsx(sortByTheme.container, className), style: { ...cssVarStyle, ...style } },
|
|
100
|
+
labelElement,
|
|
101
|
+
renderSelect({
|
|
102
|
+
value,
|
|
103
|
+
onChange: handleChange,
|
|
104
|
+
options,
|
|
105
|
+
})));
|
|
106
|
+
}
|
|
107
|
+
return (React.createElement("div", { className: clsx(sortByTheme.container, className), style: { ...cssVarStyle, ...style } },
|
|
108
|
+
labelElement,
|
|
109
|
+
React.createElement(CustomSelect, { value: value, onChange: applyValue, options: options, placeholder: placeholder, "aria-label": label || 'Sort results', className: clsx(sortByTheme.select), style: {
|
|
110
|
+
width: '100%',
|
|
111
|
+
'--seekora-select-font-size': fontSize,
|
|
112
|
+
'--seekora-select-border': 'var(--seekora-sort-border)',
|
|
113
|
+
'--seekora-select-radius': borderRadius,
|
|
114
|
+
'--seekora-select-bg': 'var(--seekora-sort-bg)',
|
|
115
|
+
'--seekora-select-color': 'var(--seekora-sort-color)',
|
|
116
|
+
} })));
|
|
117
|
+
}
|
|
118
|
+
// ------ Button group variant -------------------------------------------
|
|
119
|
+
if (variant === 'button-group') {
|
|
120
|
+
return (React.createElement("div", { className: clsx(sortByTheme.container, className), style: { ...cssVarStyle, ...style } },
|
|
121
|
+
labelElement,
|
|
122
|
+
React.createElement("div", { role: "group", "aria-label": label || 'Sort results', className: clsx(sortByTheme.buttonGroup), style: {
|
|
123
|
+
display: 'inline-flex',
|
|
124
|
+
borderRadius,
|
|
125
|
+
overflow: 'hidden',
|
|
126
|
+
border: '1px solid var(--seekora-sort-border)',
|
|
127
|
+
} }, options.map((option, index) => {
|
|
128
|
+
const isActive = option.value === value;
|
|
129
|
+
return (React.createElement("button", { key: option.value, type: "button", role: "button", "aria-pressed": isActive, onClick: () => applyValue(option.value), className: clsx(sortByTheme.buttonGroupItem, isActive && sortByTheme.buttonGroupItemActive), style: {
|
|
130
|
+
padding,
|
|
131
|
+
fontSize,
|
|
132
|
+
border: 'none',
|
|
133
|
+
borderRight: index < options.length - 1
|
|
134
|
+
? '1px solid var(--seekora-sort-border)'
|
|
135
|
+
: 'none',
|
|
136
|
+
backgroundColor: isActive
|
|
137
|
+
? 'var(--seekora-sort-active-bg)'
|
|
138
|
+
: 'var(--seekora-sort-bg)',
|
|
139
|
+
color: isActive
|
|
140
|
+
? 'var(--seekora-sort-active-color)'
|
|
141
|
+
: 'var(--seekora-sort-color)',
|
|
142
|
+
cursor: 'pointer',
|
|
143
|
+
fontWeight: isActive ? 600 : 400,
|
|
144
|
+
transition: 'background-color 0.15s ease, color 0.15s ease',
|
|
145
|
+
outline: 'none',
|
|
146
|
+
} }, option.label));
|
|
147
|
+
}))));
|
|
148
|
+
}
|
|
149
|
+
// ------ Radio group variant --------------------------------------------
|
|
150
|
+
if (variant === 'radio-group') {
|
|
151
|
+
const radioName = `seekora-sort-${instanceId}`;
|
|
152
|
+
return (React.createElement("div", { className: clsx(sortByTheme.container, className), style: { ...cssVarStyle, ...style } },
|
|
153
|
+
labelElement,
|
|
154
|
+
React.createElement("div", { role: "radiogroup", "aria-label": label || 'Sort results', className: clsx(sortByTheme.radioGroup), style: {
|
|
155
|
+
display: 'flex',
|
|
156
|
+
flexDirection: 'column',
|
|
157
|
+
gap: theme.spacing.small,
|
|
158
|
+
} }, options.map((option) => {
|
|
159
|
+
const isActive = option.value === value;
|
|
160
|
+
const radioId = `${radioName}-${option.value}`;
|
|
161
|
+
return (React.createElement("label", { key: option.value, htmlFor: radioId, className: clsx(sortByTheme.radioItem, isActive && sortByTheme.radioItemActive), style: {
|
|
162
|
+
display: 'flex',
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
gap: theme.spacing.small,
|
|
165
|
+
padding,
|
|
166
|
+
borderRadius,
|
|
167
|
+
cursor: 'pointer',
|
|
168
|
+
backgroundColor: isActive
|
|
169
|
+
? 'var(--seekora-sort-active-bg)'
|
|
170
|
+
: 'transparent',
|
|
171
|
+
color: isActive
|
|
172
|
+
? 'var(--seekora-sort-active-color)'
|
|
173
|
+
: 'var(--seekora-sort-color)',
|
|
174
|
+
fontWeight: isActive ? 600 : 400,
|
|
175
|
+
transition: 'background-color 0.15s ease, color 0.15s ease',
|
|
176
|
+
} },
|
|
177
|
+
React.createElement("input", { type: "radio", id: radioId, name: radioName, value: option.value, checked: isActive, onChange: () => applyValue(option.value), style: { margin: 0 } }),
|
|
178
|
+
React.createElement("span", { className: clsx(sortByTheme.radioLabel), style: { fontSize } }, option.label)));
|
|
179
|
+
}))));
|
|
180
|
+
}
|
|
181
|
+
// Fallback — should never reach here, but satisfies TS exhaustiveness
|
|
182
|
+
return null;
|
|
183
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Component
|
|
3
|
+
*
|
|
4
|
+
* Displays search statistics (total results, processing time, etc.)
|
|
5
|
+
* Supports inline, badge, and detailed display variants.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { SearchResponse } from '@seekora-ai/search-sdk';
|
|
9
|
+
export interface StatsTheme {
|
|
10
|
+
container?: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
highlight?: string;
|
|
13
|
+
separator?: string;
|
|
14
|
+
badge?: string;
|
|
15
|
+
badgeLabel?: string;
|
|
16
|
+
badgeValue?: string;
|
|
17
|
+
detailed?: string;
|
|
18
|
+
detailedRow?: string;
|
|
19
|
+
detailedLabel?: string;
|
|
20
|
+
detailedValue?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StatsProps {
|
|
23
|
+
/** Search results response */
|
|
24
|
+
results?: SearchResponse | null;
|
|
25
|
+
/** Custom render function */
|
|
26
|
+
renderStats?: (stats: {
|
|
27
|
+
totalResults: number;
|
|
28
|
+
processingTime?: number;
|
|
29
|
+
query?: string;
|
|
30
|
+
}) => React.ReactNode;
|
|
31
|
+
/** Custom className */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Custom styles */
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
/** Custom theme */
|
|
36
|
+
theme?: StatsTheme;
|
|
37
|
+
/** Show processing time */
|
|
38
|
+
showProcessingTime?: boolean;
|
|
39
|
+
/** Show query */
|
|
40
|
+
showQuery?: boolean;
|
|
41
|
+
/** Custom separator between stats */
|
|
42
|
+
separator?: string;
|
|
43
|
+
/** Display variant */
|
|
44
|
+
variant?: 'inline' | 'badge' | 'detailed';
|
|
45
|
+
/** Show result count (default: true) */
|
|
46
|
+
showResultCount?: boolean;
|
|
47
|
+
/** Custom number formatter (default: toLocaleString) */
|
|
48
|
+
formatNumber?: (n: number) => string;
|
|
49
|
+
}
|
|
50
|
+
export declare const Stats: React.FC<StatsProps>;
|
|
51
|
+
//# sourceMappingURL=Stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stats.d.ts","sourceRoot":"","sources":["../../src/components/Stats.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,6BAA6B;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,mBAAmB;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;IAC1C,wCAAwC;IACxC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wDAAwD;IACxD,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC;AA8BD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAsTtC,CAAC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Component
|
|
3
|
+
*
|
|
4
|
+
* Displays search statistics (total results, processing time, etc.)
|
|
5
|
+
* Supports inline, badge, and detailed display variants.
|
|
6
|
+
*/
|
|
7
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
8
|
+
import { useSearchContext } from './SearchProvider';
|
|
9
|
+
import { useSearchState } from '../hooks/useSearchState';
|
|
10
|
+
import { clsx } from 'clsx';
|
|
11
|
+
/** CSS class name used for the animated count fade transition */
|
|
12
|
+
const ANIMATE_CLASS = 'seekora-stats-animate';
|
|
13
|
+
/** Inline <style> for the count-change animation and CSS custom properties */
|
|
14
|
+
const statsStyleId = 'seekora-stats-styles';
|
|
15
|
+
function ensureStatsStyles() {
|
|
16
|
+
if (typeof document === 'undefined')
|
|
17
|
+
return;
|
|
18
|
+
if (document.getElementById(statsStyleId))
|
|
19
|
+
return;
|
|
20
|
+
const style = document.createElement('style');
|
|
21
|
+
style.id = statsStyleId;
|
|
22
|
+
style.textContent = `
|
|
23
|
+
.seekora-stats-root {
|
|
24
|
+
--seekora-stats-color: inherit;
|
|
25
|
+
--seekora-stats-bg: transparent;
|
|
26
|
+
--seekora-stats-font-size: inherit;
|
|
27
|
+
--seekora-stats-badge-bg: inherit;
|
|
28
|
+
--seekora-stats-badge-color: inherit;
|
|
29
|
+
}
|
|
30
|
+
.${ANIMATE_CLASS} {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
transition: opacity 250ms ease-in-out;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
document.head.appendChild(style);
|
|
36
|
+
}
|
|
37
|
+
export const Stats = ({ results: resultsProp, renderStats, className, style, theme: customTheme, showProcessingTime = false, showQuery = false, separator = ' \u2022 ', variant = 'inline', showResultCount = true, formatNumber, }) => {
|
|
38
|
+
const { theme } = useSearchContext();
|
|
39
|
+
const { results: stateResults } = useSearchState();
|
|
40
|
+
const statsTheme = customTheme || {};
|
|
41
|
+
// Use results from prop if provided, otherwise from state manager
|
|
42
|
+
const results = resultsProp || stateResults;
|
|
43
|
+
// Inject keyframe / transition styles once
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
ensureStatsStyles();
|
|
46
|
+
}, []);
|
|
47
|
+
// Extract stats from results
|
|
48
|
+
const res = results;
|
|
49
|
+
const totalResults = res?.totalResults
|
|
50
|
+
|| res?.data?.total_results
|
|
51
|
+
|| res?.data?.data?.total_results
|
|
52
|
+
|| 0;
|
|
53
|
+
const processingTime = res?.processingTimeMS
|
|
54
|
+
|| res?.data?.processingTimeMS
|
|
55
|
+
|| res?.data?.data?.processingTimeMS;
|
|
56
|
+
const query = (res?.query ?? '');
|
|
57
|
+
// Number formatter
|
|
58
|
+
const fmt = formatNumber || ((n) => n.toLocaleString());
|
|
59
|
+
// Animated count change — toggle a CSS class briefly on totalResults change
|
|
60
|
+
const countRef = useRef(null);
|
|
61
|
+
const prevTotalRef = useRef(totalResults);
|
|
62
|
+
const [animating, setAnimating] = useState(false);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (prevTotalRef.current !== totalResults) {
|
|
65
|
+
prevTotalRef.current = totalResults;
|
|
66
|
+
setAnimating(true);
|
|
67
|
+
// After a frame, remove the class so the transition plays (opacity 0 -> 1)
|
|
68
|
+
const raf = requestAnimationFrame(() => {
|
|
69
|
+
setAnimating(false);
|
|
70
|
+
});
|
|
71
|
+
return () => cancelAnimationFrame(raf);
|
|
72
|
+
}
|
|
73
|
+
}, [totalResults]);
|
|
74
|
+
// Helper: border radius value from theme
|
|
75
|
+
const borderRadiusSmall = typeof theme.borderRadius === 'string'
|
|
76
|
+
? theme.borderRadius
|
|
77
|
+
: theme.borderRadius.small;
|
|
78
|
+
// ─── Custom render ────────────────────────────────────────
|
|
79
|
+
if (renderStats) {
|
|
80
|
+
return (React.createElement("div", { className: clsx('seekora-stats-root', statsTheme.container, className), style: style }, renderStats({
|
|
81
|
+
totalResults,
|
|
82
|
+
processingTime,
|
|
83
|
+
query,
|
|
84
|
+
})));
|
|
85
|
+
}
|
|
86
|
+
// ─── Inline variant (original behaviour) ──────────────────
|
|
87
|
+
if (variant === 'inline') {
|
|
88
|
+
const parts = [];
|
|
89
|
+
if (showResultCount) {
|
|
90
|
+
if (totalResults > 0) {
|
|
91
|
+
parts.push(React.createElement("span", { key: "count", className: statsTheme.text },
|
|
92
|
+
React.createElement("span", { ref: countRef, className: clsx(animating && ANIMATE_CLASS), style: { transition: 'opacity 250ms ease-in-out' } }, fmt(totalResults)),
|
|
93
|
+
` result${totalResults !== 1 ? 's' : ''}`));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
parts.push(React.createElement("span", { key: "count", className: statsTheme.text }, "No results"));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (showProcessingTime && processingTime !== undefined) {
|
|
100
|
+
parts.push(React.createElement("span", { key: "time", className: statsTheme.text },
|
|
101
|
+
fmt(processingTime),
|
|
102
|
+
"ms"));
|
|
103
|
+
}
|
|
104
|
+
if (showQuery && query) {
|
|
105
|
+
parts.push(React.createElement("span", { key: "query", className: statsTheme.text },
|
|
106
|
+
"for \"",
|
|
107
|
+
query,
|
|
108
|
+
"\""));
|
|
109
|
+
}
|
|
110
|
+
return (React.createElement("div", { className: clsx('seekora-stats-root', statsTheme.container, className), style: {
|
|
111
|
+
fontSize: 'var(--seekora-stats-font-size,' + theme.typography.fontSize.medium + ')',
|
|
112
|
+
color: 'var(--seekora-stats-color,' + theme.colors.text + ')',
|
|
113
|
+
backgroundColor: 'var(--seekora-stats-bg, transparent)',
|
|
114
|
+
...style,
|
|
115
|
+
} }, parts.map((part, index) => (React.createElement("span", { key: index },
|
|
116
|
+
index > 0 && (React.createElement("span", { className: statsTheme.separator, style: { margin: `0 ${theme.spacing.small}` } }, separator)),
|
|
117
|
+
part)))));
|
|
118
|
+
}
|
|
119
|
+
// ─── Badge variant ────────────────────────────────────────
|
|
120
|
+
if (variant === 'badge') {
|
|
121
|
+
const badges = [];
|
|
122
|
+
const badgeStyle = {
|
|
123
|
+
display: 'inline-flex',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
gap: theme.spacing.small,
|
|
126
|
+
padding: `${theme.spacing.small} ${theme.spacing.medium}`,
|
|
127
|
+
borderRadius: borderRadiusSmall,
|
|
128
|
+
backgroundColor: `var(--seekora-stats-badge-bg, ${theme.colors.primary}1A)`, // 10 % opacity hex
|
|
129
|
+
color: `var(--seekora-stats-badge-color, ${theme.colors.primary})`,
|
|
130
|
+
fontSize: theme.typography.fontSize.small,
|
|
131
|
+
fontWeight: 500,
|
|
132
|
+
};
|
|
133
|
+
if (showResultCount) {
|
|
134
|
+
badges.push(React.createElement("span", { key: "count", className: clsx(statsTheme.badge), style: badgeStyle },
|
|
135
|
+
React.createElement("span", { className: statsTheme.badgeLabel }, "Results"),
|
|
136
|
+
React.createElement("span", { className: clsx(statsTheme.badgeValue, animating && ANIMATE_CLASS), style: { fontWeight: 600, transition: 'opacity 250ms ease-in-out' } }, totalResults > 0 ? fmt(totalResults) : '0')));
|
|
137
|
+
}
|
|
138
|
+
if (showQuery && query) {
|
|
139
|
+
badges.push(React.createElement("span", { key: "query", className: clsx(statsTheme.badge), style: badgeStyle },
|
|
140
|
+
React.createElement("span", { className: statsTheme.badgeLabel }, "Query"),
|
|
141
|
+
React.createElement("span", { className: statsTheme.badgeValue, style: { fontWeight: 600 } }, query)));
|
|
142
|
+
}
|
|
143
|
+
if (showProcessingTime && processingTime !== undefined) {
|
|
144
|
+
badges.push(React.createElement("span", { key: "time", className: clsx(statsTheme.badge), style: badgeStyle },
|
|
145
|
+
React.createElement("span", { className: statsTheme.badgeLabel }, "Time"),
|
|
146
|
+
React.createElement("span", { className: statsTheme.badgeValue, style: { fontWeight: 600 } },
|
|
147
|
+
fmt(processingTime),
|
|
148
|
+
"ms")));
|
|
149
|
+
}
|
|
150
|
+
return (React.createElement("div", { className: clsx('seekora-stats-root', statsTheme.container, className), style: {
|
|
151
|
+
display: 'flex',
|
|
152
|
+
flexWrap: 'wrap',
|
|
153
|
+
gap: theme.spacing.small,
|
|
154
|
+
fontSize: 'var(--seekora-stats-font-size,' + theme.typography.fontSize.small + ')',
|
|
155
|
+
color: 'var(--seekora-stats-color,' + theme.colors.text + ')',
|
|
156
|
+
backgroundColor: 'var(--seekora-stats-bg, transparent)',
|
|
157
|
+
...style,
|
|
158
|
+
} }, badges));
|
|
159
|
+
}
|
|
160
|
+
// ─── Detailed variant ─────────────────────────────────────
|
|
161
|
+
if (variant === 'detailed') {
|
|
162
|
+
const rows = [];
|
|
163
|
+
if (showResultCount) {
|
|
164
|
+
rows.push({
|
|
165
|
+
label: 'Total Results',
|
|
166
|
+
value: (React.createElement("span", { className: clsx(animating && ANIMATE_CLASS), style: { transition: 'opacity 250ms ease-in-out' } }, fmt(totalResults))),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (showQuery && query) {
|
|
170
|
+
rows.push({ label: 'Query', value: query });
|
|
171
|
+
}
|
|
172
|
+
if (showProcessingTime && processingTime !== undefined) {
|
|
173
|
+
rows.push({ label: 'Time', value: `${fmt(processingTime)}ms` });
|
|
174
|
+
}
|
|
175
|
+
return (React.createElement("div", { className: clsx('seekora-stats-root', statsTheme.detailed, statsTheme.container, className), style: {
|
|
176
|
+
display: 'flex',
|
|
177
|
+
flexDirection: 'column',
|
|
178
|
+
gap: theme.spacing.small,
|
|
179
|
+
fontSize: 'var(--seekora-stats-font-size,' + theme.typography.fontSize.medium + ')',
|
|
180
|
+
color: 'var(--seekora-stats-color,' + theme.colors.text + ')',
|
|
181
|
+
backgroundColor: 'var(--seekora-stats-bg, transparent)',
|
|
182
|
+
...style,
|
|
183
|
+
} }, rows.map((row, index) => (React.createElement("div", { key: index, className: statsTheme.detailedRow, style: {
|
|
184
|
+
display: 'flex',
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
gap: theme.spacing.small,
|
|
187
|
+
} },
|
|
188
|
+
React.createElement("span", { className: statsTheme.detailedLabel, style: {
|
|
189
|
+
color: theme.colors.textSecondary,
|
|
190
|
+
fontWeight: 500,
|
|
191
|
+
} },
|
|
192
|
+
row.label,
|
|
193
|
+
":"),
|
|
194
|
+
React.createElement("span", { className: statsTheme.detailedValue, style: {
|
|
195
|
+
color: theme.colors.text,
|
|
196
|
+
fontWeight: 600,
|
|
197
|
+
} }, row.value))))));
|
|
198
|
+
}
|
|
199
|
+
// Fallback (should not be reached)
|
|
200
|
+
return null;
|
|
201
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActionButtons – card action buttons (add to cart, wishlist, buy now, quick view)
|
|
3
|
+
*
|
|
4
|
+
* Renders a set of action buttons for product cards. Can be positioned absolutely
|
|
5
|
+
* over the image (on hover) or inline below the card content.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export type ActionButtonType = 'addToCart' | 'wishlist' | 'buyNow' | 'quickView' | 'compare';
|
|
9
|
+
export interface ActionButton {
|
|
10
|
+
type: ActionButtonType;
|
|
11
|
+
label?: string;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ActionButtonsProps {
|
|
18
|
+
buttons: ActionButton[];
|
|
19
|
+
layout?: 'horizontal' | 'vertical' | 'overlay';
|
|
20
|
+
position?: 'top-right' | 'bottom-center' | 'inline';
|
|
21
|
+
showLabels?: boolean;
|
|
22
|
+
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
export declare function ActionButtons({ buttons, layout, position, showLabels, size, className, style, }: ActionButtonsProps): React.JSX.Element;
|
|
27
|
+
//# sourceMappingURL=ActionButtons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionButtons.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/ActionButtons.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AA+B1B,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,CAAC;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAwBD,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,MAAqB,EACrB,QAAmB,EACnB,UAAkB,EAClB,IAAe,EACf,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,qBAqFpB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActionButtons – card action buttons (add to cart, wishlist, buy now, quick view)
|
|
3
|
+
*
|
|
4
|
+
* Renders a set of action buttons for product cards. Can be positioned absolutely
|
|
5
|
+
* over the image (on hover) or inline below the card content.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { clsx } from 'clsx';
|
|
9
|
+
const SPACING = {
|
|
10
|
+
xs: 4,
|
|
11
|
+
sm: 8,
|
|
12
|
+
md: 12,
|
|
13
|
+
lg: 16,
|
|
14
|
+
xl: 24,
|
|
15
|
+
};
|
|
16
|
+
const TRANSITIONS = {
|
|
17
|
+
fast: '150ms ease-in-out',
|
|
18
|
+
normal: '200ms ease-in-out',
|
|
19
|
+
slow: '300ms ease-in-out',
|
|
20
|
+
};
|
|
21
|
+
const BORDER_RADIUS = {
|
|
22
|
+
sm: 4,
|
|
23
|
+
md: 6,
|
|
24
|
+
lg: 8,
|
|
25
|
+
full: 9999,
|
|
26
|
+
};
|
|
27
|
+
const SHADOWS = {
|
|
28
|
+
sm: '0 1px 2px rgba(0,0,0,0.05)',
|
|
29
|
+
md: '0 2px 4px rgba(0,0,0,0.1)',
|
|
30
|
+
lg: '0 4px 6px rgba(0,0,0,0.1)',
|
|
31
|
+
xl: '0 10px 15px rgba(0,0,0,0.1)',
|
|
32
|
+
};
|
|
33
|
+
const DEFAULT_ICONS = {
|
|
34
|
+
addToCart: '🛒',
|
|
35
|
+
wishlist: '♡',
|
|
36
|
+
buyNow: '⚡',
|
|
37
|
+
quickView: '👁',
|
|
38
|
+
compare: '⚖',
|
|
39
|
+
};
|
|
40
|
+
const DEFAULT_LABELS = {
|
|
41
|
+
addToCart: 'Add to Cart',
|
|
42
|
+
wishlist: 'Wishlist',
|
|
43
|
+
buyNow: 'Buy Now',
|
|
44
|
+
quickView: 'Quick View',
|
|
45
|
+
compare: 'Compare',
|
|
46
|
+
};
|
|
47
|
+
const BUTTON_SIZES = {
|
|
48
|
+
small: { width: 44, height: 44, fontSize: '0.75rem', iconSize: '1rem' },
|
|
49
|
+
medium: { width: 44, height: 44, fontSize: '0.875rem', iconSize: '1.25rem' },
|
|
50
|
+
large: { width: 44, height: 44, fontSize: '1rem', iconSize: '1.5rem' },
|
|
51
|
+
};
|
|
52
|
+
export function ActionButtons({ buttons, layout = 'horizontal', position = 'inline', showLabels = false, size = 'medium', className, style, }) {
|
|
53
|
+
const sizeConfig = BUTTON_SIZES[size];
|
|
54
|
+
const isOverlay = position !== 'inline';
|
|
55
|
+
const containerStyle = {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flexDirection: layout === 'vertical' ? 'column' : 'row',
|
|
58
|
+
gap: SPACING.sm,
|
|
59
|
+
...(isOverlay ? {
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
...(position === 'top-right' ? { top: SPACING.sm, right: SPACING.sm } : {}),
|
|
62
|
+
...(position === 'bottom-center' ? { bottom: SPACING.sm, left: '50%', transform: 'translateX(-50%)' } : {}),
|
|
63
|
+
} : {}),
|
|
64
|
+
...style,
|
|
65
|
+
};
|
|
66
|
+
const buttonBaseStyle = {
|
|
67
|
+
display: 'flex',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
gap: 4,
|
|
71
|
+
padding: showLabels ? '0 12px' : 0,
|
|
72
|
+
width: showLabels ? 'auto' : sizeConfig.width,
|
|
73
|
+
height: sizeConfig.height,
|
|
74
|
+
fontSize: sizeConfig.fontSize,
|
|
75
|
+
fontWeight: 500,
|
|
76
|
+
border: 'none',
|
|
77
|
+
borderRadius: BORDER_RADIUS.md,
|
|
78
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
79
|
+
color: 'var(--seekora-text, inherit)',
|
|
80
|
+
cursor: 'pointer',
|
|
81
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
82
|
+
boxShadow: SHADOWS.md,
|
|
83
|
+
};
|
|
84
|
+
const handleClick = (btn, e) => {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
if (btn.onClick && !btn.disabled && !btn.loading) {
|
|
88
|
+
btn.onClick(e);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return (React.createElement("div", { className: clsx('seekora-action-buttons', `seekora-action-buttons--${layout}`, className), style: containerStyle }, buttons.map((btn, i) => {
|
|
92
|
+
const icon = btn.icon ?? DEFAULT_ICONS[btn.type];
|
|
93
|
+
const label = btn.label ?? DEFAULT_LABELS[btn.type];
|
|
94
|
+
return (React.createElement("button", { key: i, type: "button", className: clsx('seekora-action-button', `seekora-action-button--${btn.type}`, btn.disabled && 'seekora-action-button--disabled', btn.loading && 'seekora-action-button--loading'), style: {
|
|
95
|
+
...buttonBaseStyle,
|
|
96
|
+
opacity: btn.disabled ? 0.5 : 1,
|
|
97
|
+
cursor: btn.disabled ? 'not-allowed' : 'pointer',
|
|
98
|
+
}, onClick: (e) => handleClick(btn, e), disabled: btn.disabled, "aria-label": label, title: label }, btn.loading ? (React.createElement("span", { style: { fontSize: sizeConfig.iconSize } }, "\u23F3")) : (React.createElement(React.Fragment, null,
|
|
99
|
+
React.createElement("span", { style: { fontSize: sizeConfig.iconSize } }, icon),
|
|
100
|
+
showLabels && React.createElement("span", null, label)))));
|
|
101
|
+
})));
|
|
102
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnalyticsProvider – context + delegated event listener for data-seekora-* attribute-based analytics
|
|
3
|
+
*
|
|
4
|
+
* Installs a delegated click listener on a container. Any descendant with
|
|
5
|
+
* data-seekora-track="click"|"add-to-cart" and data-seekora-product-id="..."
|
|
6
|
+
* automatically fires analytics events without React wiring.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { SeekoraClient, SearchContext } from '@seekora-ai/search-sdk';
|
|
10
|
+
export interface AnalyticsProviderProps {
|
|
11
|
+
client: SeekoraClient;
|
|
12
|
+
context?: SearchContext | Partial<SearchContext>;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
interface AnalyticsContextValue {
|
|
16
|
+
client: SeekoraClient;
|
|
17
|
+
context?: SearchContext | Partial<SearchContext>;
|
|
18
|
+
}
|
|
19
|
+
export declare const useAnalyticsProvider: () => AnalyticsContextValue | null;
|
|
20
|
+
export declare function AnalyticsProvider({ client, context, children }: AnalyticsProviderProps): React.JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=AnalyticsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyticsProvider.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/AnalyticsProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAoE,MAAM,OAAO,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG3E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,UAAU,qBAAqB;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAClD;AAID,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AAEvE,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,sBAAsB,qBAsFtF"}
|