@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,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses suggestion text containing <mark>...</mark> and returns React nodes
|
|
3
|
+
* with the marked segments rendered as styled elements. Safe: inner content
|
|
4
|
+
* is rendered as text, not HTML.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
const defaultMarkStyle = {
|
|
8
|
+
backgroundColor: 'var(--seekora-highlight-bg, rgba(251, 191, 36, 0.4))',
|
|
9
|
+
fontWeight: 500,
|
|
10
|
+
borderRadius: '2px',
|
|
11
|
+
padding: '0 2px',
|
|
12
|
+
};
|
|
13
|
+
/** Compute styles based on highlight options */
|
|
14
|
+
function computeHighlightStyles(options) {
|
|
15
|
+
const style = options.highlightStyle || 'background';
|
|
16
|
+
const base = {};
|
|
17
|
+
switch (style) {
|
|
18
|
+
case 'background':
|
|
19
|
+
base.backgroundColor = options.highlightColor || 'var(--seekora-highlight-bg, rgba(251, 191, 36, 0.4))';
|
|
20
|
+
base.borderRadius = '2px';
|
|
21
|
+
base.padding = '0 2px';
|
|
22
|
+
break;
|
|
23
|
+
case 'underline':
|
|
24
|
+
base.textDecoration = 'underline';
|
|
25
|
+
base.textDecorationColor = options.highlightColor || 'var(--seekora-highlight-bg, rgba(251, 191, 36, 0.8))';
|
|
26
|
+
base.textUnderlineOffset = '2px';
|
|
27
|
+
break;
|
|
28
|
+
case 'bold':
|
|
29
|
+
// Only bold, no background
|
|
30
|
+
break;
|
|
31
|
+
case 'color-only':
|
|
32
|
+
// Only color, no background
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (options.highlightTextColor) {
|
|
36
|
+
base.color = options.highlightTextColor;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
base.color = 'var(--seekora-highlight-color, inherit)';
|
|
40
|
+
}
|
|
41
|
+
base.fontWeight = options.highlightFontWeight || 'var(--seekora-highlight-weight, 500)';
|
|
42
|
+
return base;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts a string like "lined <mark>blue</mark>" into React nodes with
|
|
46
|
+
* the marked part rendered as a styled element. When no <mark> tags are
|
|
47
|
+
* present, returns the string as-is.
|
|
48
|
+
*/
|
|
49
|
+
export function parseHighlightMarkup(text, options = {}) {
|
|
50
|
+
if (text == null || typeof text !== 'string')
|
|
51
|
+
return text;
|
|
52
|
+
const parts = text.split(/(<mark>[\s\S]*?<\/mark>)/g);
|
|
53
|
+
if (parts.length <= 1)
|
|
54
|
+
return text;
|
|
55
|
+
const { markClassName, markStyle, highlightTag } = options;
|
|
56
|
+
const Tag = (highlightTag || 'mark');
|
|
57
|
+
// Compute styles: if no custom options provided, use legacy defaults
|
|
58
|
+
const hasCustomOptions = options.highlightColor || options.highlightTextColor
|
|
59
|
+
|| options.highlightFontWeight || options.highlightStyle;
|
|
60
|
+
const computedStyle = hasCustomOptions
|
|
61
|
+
? computeHighlightStyles(options)
|
|
62
|
+
: defaultMarkStyle;
|
|
63
|
+
return (React.createElement(React.Fragment, null, parts.map((part, i) => {
|
|
64
|
+
const m = part.match(/^<mark>([\s\S]*)<\/mark>$/);
|
|
65
|
+
if (m) {
|
|
66
|
+
return (React.createElement(Tag, { key: i, className: markClassName, style: { ...computedStyle, ...markStyle } }, m[1]));
|
|
67
|
+
}
|
|
68
|
+
return part;
|
|
69
|
+
})));
|
|
70
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable suggestions primitives
|
|
3
|
+
*
|
|
4
|
+
* Generic: ItemCard, ItemGrid (domain-agnostic).
|
|
5
|
+
* E-commerce: ProductCard, ProductGrid.
|
|
6
|
+
* Suggestions: SearchInput, SuggestionList, SuggestionItem, CategoriesTabs,
|
|
7
|
+
* RecentSearchesList, TrendingList, DropdownPanel, SuggestionsError.
|
|
8
|
+
*/
|
|
9
|
+
export { SuggestionsContext, useSuggestionsContext } from './SuggestionsContext';
|
|
10
|
+
export type { SuggestionsContextValue } from './SuggestionsContext';
|
|
11
|
+
export { SuggestionsProvider } from './SuggestionsProvider';
|
|
12
|
+
export type { SuggestionsProviderProps } from './SuggestionsProvider';
|
|
13
|
+
export { SearchInput } from './SearchInput';
|
|
14
|
+
export type { SearchInputProps } from './SearchInput';
|
|
15
|
+
export { DropdownPanel } from './DropdownPanel';
|
|
16
|
+
export type { DropdownPanelProps } from './DropdownPanel';
|
|
17
|
+
export { SuggestionList } from './SuggestionList';
|
|
18
|
+
export type { SuggestionListProps } from './SuggestionList';
|
|
19
|
+
export { SuggestionItem } from './SuggestionItem';
|
|
20
|
+
export type { SuggestionItemProps } from './SuggestionItem';
|
|
21
|
+
export { parseHighlightMarkup } from './highlightMarkup';
|
|
22
|
+
export type { HighlightMarkupOptions } from './highlightMarkup';
|
|
23
|
+
export { ItemCard, type GenericItem, type ItemCardProps, type ImageDisplayVariant as ItemCardImageVariant } from './ItemCard';
|
|
24
|
+
export { ItemGrid, type ItemGridProps } from './ItemGrid';
|
|
25
|
+
export { ProductCard } from './ProductCard';
|
|
26
|
+
export type { ProductCardProps, ProductCardImageVariant } from './ProductCard';
|
|
27
|
+
export { ProductGrid } from './ProductGrid';
|
|
28
|
+
export type { ProductGridProps } from './ProductGrid';
|
|
29
|
+
export { CategoriesTabs } from './CategoriesTabs';
|
|
30
|
+
export type { CategoriesTabsProps } from './CategoriesTabs';
|
|
31
|
+
export { RecentSearchesList } from './RecentSearchesList';
|
|
32
|
+
export type { RecentSearchesListProps } from './RecentSearchesList';
|
|
33
|
+
export { TrendingList } from './TrendingList';
|
|
34
|
+
export type { TrendingListProps } from './TrendingList';
|
|
35
|
+
export { SuggestionsError } from './SuggestionsError';
|
|
36
|
+
export type { SuggestionsErrorProps } from './SuggestionsError';
|
|
37
|
+
export { SuggestionsDropdownComposition } from './SuggestionsDropdownComposition';
|
|
38
|
+
export type { SuggestionsDropdownCompositionProps } from './SuggestionsDropdownComposition';
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACjF,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC9H,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,YAAY,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable suggestions primitives
|
|
3
|
+
*
|
|
4
|
+
* Generic: ItemCard, ItemGrid (domain-agnostic).
|
|
5
|
+
* E-commerce: ProductCard, ProductGrid.
|
|
6
|
+
* Suggestions: SearchInput, SuggestionList, SuggestionItem, CategoriesTabs,
|
|
7
|
+
* RecentSearchesList, TrendingList, DropdownPanel, SuggestionsError.
|
|
8
|
+
*/
|
|
9
|
+
export { SuggestionsContext, useSuggestionsContext } from './SuggestionsContext';
|
|
10
|
+
export { SuggestionsProvider } from './SuggestionsProvider';
|
|
11
|
+
export { SearchInput } from './SearchInput';
|
|
12
|
+
export { DropdownPanel } from './DropdownPanel';
|
|
13
|
+
export { SuggestionList } from './SuggestionList';
|
|
14
|
+
export { SuggestionItem } from './SuggestionItem';
|
|
15
|
+
export { parseHighlightMarkup } from './highlightMarkup';
|
|
16
|
+
export { ItemCard } from './ItemCard';
|
|
17
|
+
export { ItemGrid } from './ItemGrid';
|
|
18
|
+
export { ProductCard } from './ProductCard';
|
|
19
|
+
export { ProductGrid } from './ProductGrid';
|
|
20
|
+
export { CategoriesTabs } from './CategoriesTabs';
|
|
21
|
+
export { RecentSearchesList } from './RecentSearchesList';
|
|
22
|
+
export { TrendingList } from './TrendingList';
|
|
23
|
+
export { SuggestionsError } from './SuggestionsError';
|
|
24
|
+
export { SuggestionsDropdownComposition } from './SuggestionsDropdownComposition';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { DocSearchProps } from "../types";
|
|
3
|
+
export declare function DocSearch({ storeId, storeSecret, seekoraApiEndpoint, apiEndpoint, apiKey, sources, placeholder, maxResults, debounceMs, onSelect, onClose, translations, renderButton, buttonComponent: ButtonComponent, initialOpen, disableShortcut, shortcutKey, processGroupedResults, className, }: DocSearchProps): React.JSX.Element;
|
|
4
|
+
//# sourceMappingURL=DocSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocSearch.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/DocSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAS7D,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,UAAU,CAAC;AAElB,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,OAAO,EACP,WAAuC,EACvC,UAAe,EACf,UAAgB,EAChB,QAAQ,EACR,OAAO,EACP,YAAiB,EACjB,YAAmB,EACnB,eAAe,EAAE,eAAiC,EAClD,WAAmB,EACnB,eAAuB,EACvB,WAAiB,EACjB,qBAAqB,EACrB,SAAS,GACV,EAAE,cAAc,qBAqJhB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useState, useCallback, useRef } from "react";
|
|
2
|
+
import { Modal } from "./Modal";
|
|
3
|
+
import { SearchBox } from "./SearchBox";
|
|
4
|
+
import { Results } from "./Results";
|
|
5
|
+
import { Footer } from "./Footer";
|
|
6
|
+
import { DocSearchButton } from "./DocSearchButton";
|
|
7
|
+
import { useDocSearch } from "../hooks/useDocSearch";
|
|
8
|
+
import { useSeekoraSearch } from "../hooks/useSeekoraSearch";
|
|
9
|
+
import { useKeyboard } from "../hooks/useKeyboard";
|
|
10
|
+
export function DocSearch({ storeId, storeSecret, seekoraApiEndpoint, apiEndpoint, apiKey, sources, placeholder = "Search documentation...", maxResults = 10, debounceMs = 200, onSelect, onClose, translations = {}, renderButton = true, buttonComponent: ButtonComponent = DocSearchButton, initialOpen = false, disableShortcut = false, shortcutKey = "k", processGroupedResults, className, }) {
|
|
11
|
+
const [isOpen, setIsOpen] = useState(initialOpen);
|
|
12
|
+
const scrollSelectionIntoViewRef = useRef(false);
|
|
13
|
+
const useSeekoraSDK = !!storeId;
|
|
14
|
+
const seekoraSearch = useSeekoraSearch({
|
|
15
|
+
storeId: storeId || "",
|
|
16
|
+
storeSecret,
|
|
17
|
+
apiEndpoint: seekoraApiEndpoint,
|
|
18
|
+
maxResults,
|
|
19
|
+
debounceMs,
|
|
20
|
+
analyticsTags: ["docsearch"],
|
|
21
|
+
});
|
|
22
|
+
const legacySearch = useDocSearch({
|
|
23
|
+
apiEndpoint,
|
|
24
|
+
apiKey,
|
|
25
|
+
sources,
|
|
26
|
+
maxResults,
|
|
27
|
+
debounceMs,
|
|
28
|
+
processGroupedResults,
|
|
29
|
+
});
|
|
30
|
+
const { query, suggestions, isLoading, error, selectedIndex, setQuery, selectNext, selectPrev, setSelectedIndex, reset, getSelectedItem, } = useSeekoraSDK ? seekoraSearch : legacySearch;
|
|
31
|
+
const groupedSuggestions = useSeekoraSDK
|
|
32
|
+
? undefined
|
|
33
|
+
: legacySearch.groupedSuggestions;
|
|
34
|
+
const results = useSeekoraSDK ? suggestions : legacySearch.results;
|
|
35
|
+
const mode = useSeekoraSDK ? "suggestions" : legacySearch.mode;
|
|
36
|
+
const searchSources = useSeekoraSDK
|
|
37
|
+
? [{ id: "seekora", name: "Results", endpoint: "" }]
|
|
38
|
+
: legacySearch.sources;
|
|
39
|
+
const handleOpen = useCallback(() => setIsOpen(true), []);
|
|
40
|
+
const handleClose = useCallback(() => {
|
|
41
|
+
setIsOpen(false);
|
|
42
|
+
reset();
|
|
43
|
+
onClose?.();
|
|
44
|
+
}, [reset, onClose]);
|
|
45
|
+
const handleSelect = useCallback((hit) => {
|
|
46
|
+
if (useSeekoraSDK && seekoraSearch.trackDocClick) {
|
|
47
|
+
seekoraSearch.trackDocClick(hit, selectedIndex + 1);
|
|
48
|
+
}
|
|
49
|
+
if (onSelect) {
|
|
50
|
+
onSelect(hit);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
window.location.href = hit.url;
|
|
54
|
+
}
|
|
55
|
+
handleClose();
|
|
56
|
+
}, [onSelect, handleClose, useSeekoraSDK, seekoraSearch, selectedIndex]);
|
|
57
|
+
const handleEnter = useCallback(() => {
|
|
58
|
+
const selectedItem = getSelectedItem();
|
|
59
|
+
if (selectedItem)
|
|
60
|
+
handleSelect(selectedItem);
|
|
61
|
+
}, [getSelectedItem, handleSelect]);
|
|
62
|
+
const handleSelectNext = useCallback(() => {
|
|
63
|
+
scrollSelectionIntoViewRef.current = true;
|
|
64
|
+
selectNext();
|
|
65
|
+
}, [selectNext]);
|
|
66
|
+
const handleSelectPrev = useCallback(() => {
|
|
67
|
+
scrollSelectionIntoViewRef.current = true;
|
|
68
|
+
selectPrev();
|
|
69
|
+
}, [selectPrev]);
|
|
70
|
+
const { handleModalKeyDown } = useKeyboard({
|
|
71
|
+
isOpen,
|
|
72
|
+
onOpen: handleOpen,
|
|
73
|
+
onClose: handleClose,
|
|
74
|
+
onSelectNext: handleSelectNext,
|
|
75
|
+
onSelectPrev: handleSelectPrev,
|
|
76
|
+
onEnter: handleEnter,
|
|
77
|
+
disableShortcut,
|
|
78
|
+
shortcutKey,
|
|
79
|
+
});
|
|
80
|
+
const handleKeyDown = useCallback((event) => handleModalKeyDown(event), [handleModalKeyDown]);
|
|
81
|
+
const displayHits = mode === "results" ? results : suggestions;
|
|
82
|
+
return (React.createElement(React.Fragment, null,
|
|
83
|
+
renderButton && (React.createElement(ButtonComponent, { onClick: handleOpen, placeholder: translations.buttonText || placeholder, className: className })),
|
|
84
|
+
React.createElement(Modal, { isOpen: isOpen, onClose: handleClose, className: className },
|
|
85
|
+
React.createElement("div", { className: "seekora-docsearch-modal", onKeyDown: handleKeyDown },
|
|
86
|
+
React.createElement("header", { className: "seekora-docsearch-header" },
|
|
87
|
+
React.createElement(SearchBox, { value: query, onChange: setQuery, placeholder: placeholder, onClear: reset }),
|
|
88
|
+
React.createElement("button", { type: "button", className: "seekora-docsearch-close", onClick: handleClose, "aria-label": "Close search" },
|
|
89
|
+
React.createElement("span", { className: "seekora-docsearch-close-text" }, "esc"))),
|
|
90
|
+
React.createElement("div", { className: "seekora-docsearch-body" },
|
|
91
|
+
React.createElement(Results, { hits: displayHits, groupedHits: groupedSuggestions, selectedIndex: selectedIndex, onSelect: handleSelect, onHover: setSelectedIndex, scrollSelectionIntoViewRef: scrollSelectionIntoViewRef, query: query, isLoading: isLoading, error: error, translations: translations, sources: searchSources })),
|
|
92
|
+
React.createElement(Footer, { translations: translations })))));
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocSearchButton.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/DocSearchButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,WAAuC,EACvC,SAAS,GACV,EAAE,oBAAoB,qBAgCtB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { getShortcutText } from "../hooks/useKeyboard";
|
|
3
|
+
export function DocSearchButton({ onClick, placeholder = "Search documentation...", className, }) {
|
|
4
|
+
const shortcutText = getShortcutText("K");
|
|
5
|
+
return (React.createElement("button", { type: "button", className: `seekora-docsearch-button${className ? ` ${className}` : ""}`, onClick: onClick, "aria-label": "Search documentation" },
|
|
6
|
+
React.createElement("span", { className: "seekora-docsearch-button-icon" },
|
|
7
|
+
React.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
8
|
+
React.createElement("path", { d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", fill: "currentColor" }))),
|
|
9
|
+
React.createElement("span", { className: "seekora-docsearch-button-placeholder" }, placeholder),
|
|
10
|
+
React.createElement("span", { className: "seekora-docsearch-button-keys" },
|
|
11
|
+
React.createElement("kbd", { className: "seekora-docsearch-button-key" }, shortcutText))));
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocSearchTranslations } from '../types';
|
|
3
|
+
interface FooterProps {
|
|
4
|
+
translations?: DocSearchTranslations;
|
|
5
|
+
}
|
|
6
|
+
export declare function Footer({ translations }: FooterProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Footer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAuBD,wBAAgB,MAAM,CAAC,EAAE,YAAiB,EAAE,EAAE,WAAW,qBAkCxD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function SeekoraLogo() {
|
|
3
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 844.6 192", height: "20", "aria-hidden": "true", style: { width: 'auto' } },
|
|
4
|
+
React.createElement("path", { fill: "#03d1ff", d: "M73.06,85.38l-21.36,21.21-2.03,2.03c-3.19,3.19-8.3,2.84-11.07-.32-.52-.59-.95-1.27-1.27-2.04-.01-.03-.03-.07-.04-.1-.33-.79-.63-1.6-.92-2.41-1.59-4.57-2.44-9.48-2.42-14.6h.05c-.01-.13-.01-.27-.02-.4-.02-.46-.02-.92-.02-1.39,0-27.3,22.13-49.43,49.43-49.43,6.64,0,12.98,1.31,18.76,3.69-2.19,2.23-3.28,5.47-2.63,8.76.31,1.52.95,2.89,1.84,4.04.27.36.58.7.9,1.02-.12-.07-.25-.15-.38-.22-5.45-3.15-11.76-4.94-18.49-4.94-20.48,0-37.08,16.6-37.08,37.08,0,.42,0,.83.02,1.25h0c.08,2.58.43,5.09,1.02,7.5l.18-.18,4.98-4.99,10.15-10.15,4.32-4.32c2.43-2.43,5.96-3.35,9.26-2.41.01,0,.03,0,.04.01.05.01.1.02.15.04,2.04.62,3.76,1.88,4.94,3.55.78,1.08,1.32,2.33,1.59,3.67l1.28,6.5.32,1.63.02.14.42-.44,14.99-15.62,3.29-3.43,7.25-7.57,1.18-1.22,2.43-2.54,5.02-5.24.91-.95,1.71-1.78-1.31.25-2.68.53-.47.09-3.52.7h0s-4.01.8-4.01.8c-2.55.5-5.04-1.16-5.55-3.71-.45-2.26.8-4.47,2.87-5.3.27-.11.55-.19.85-.25l9.8-1.94,7.42-1.47,3.23-.63,4.96-.98c.12-.02.25-.05.37-.06.11-.01.22-.02.32-.03.22-.01.43,0,.65.01.96.08,1.89.47,2.65,1.12.81.69,1.35,1.62,1.56,2.64.03.15.05.29.07.44.02.23.03.45.02.68l-.23,6.05-.14,4.01-.05,1.44-.49,13.48v.24c-.09,2.55-2.19,4.55-4.72,4.55-.06,0-.11,0-.17,0-1.1-.04-2.1-.45-2.88-1.11-1.07-.9-1.73-2.27-1.67-3.78l.02-.59.09-2.55.12-3.52.12-3.51-50.81,54.4-5.17-27.42Z" }),
|
|
5
|
+
React.createElement("path", { fill: "#4d66fe", d: "M23.04,158.85c-.27-1.39.15-2.83,1.12-3.85l22.71-23.81,3.29-3.43,7.25-7.57,1.18-1.22,7.46-7.77,1.77-1.85,2.56,12.48.14.31h0c2.32.86,4.75,1.49,7.27,1.88v12.46c-5.94-.67-11.56-2.39-16.67-4.98l-35.87,38.45-2.2-11.08Z" }),
|
|
6
|
+
React.createElement("path", { fill: "#4d66fe", d: "M90.69,106.76v29.36c-2.22.31-4.49.47-6.79.47-.34,0-.67,0-1.01-.02v-21.93l7.8-7.88Z" }),
|
|
7
|
+
React.createElement("polygon", { fill: "#4d66fe", points: "102.78 132.84 102.78 118.68 102.79 93.73 94.96 101.92 94.96 135.35 102.78 132.84" }),
|
|
8
|
+
React.createElement("polygon", { fill: "#4d66fe", points: "114.86 125.64 114.87 104.87 114.88 81.6 107.05 89.78 107.05 130.82 114.86 125.64" }),
|
|
9
|
+
React.createElement("path", { fill: "#4d66fe", d: "M126.98,69.42l-.02,23.28v18.6c-2.13,3.83-4.77,7.35-7.81,10.45v-44.13l7.83-8.19Z" }),
|
|
10
|
+
React.createElement("path", { fill: "currentColor", d: "M455.59,136.31h-14.71l-.11-98.11h14.71l.11,98.11ZM520.86,136.65h-18.17l-27.34-32.14c-2.31-2.88-4.04-5.72-5.19-8.51-1.15-2.79-1.73-5.53-1.73-8.22s.55-5.57,1.66-8.36c1.1-2.79,2.86-5.63,5.26-8.51l27.73-32.54h16.87l-31.05,36.87c-1.92,2.4-3.39,4.57-4.4,6.49-1.01,1.92-1.51,3.8-1.51,5.62s.5,3.65,1.51,5.48c1.01,1.83,2.47,3.94,4.4,6.35l31.96,37.47Z" }),
|
|
11
|
+
React.createElement("path", { fill: "currentColor", d: "M710.73,117.25c-2.6-5.48-5.14-10.12-7.64-13.92-2.5-3.8-5.48-6.68-8.94-8.65-.31-.18-.64-.33-.96-.49,2.69-.58,5.18-1.44,7.45-2.61,4.52-2.31,8.05-5.53,10.6-9.66,2.55-4.13,3.82-8.89,3.82-14.28,0-6.63-1.61-12.11-4.83-16.44-3.22-4.33-7.6-7.55-13.12-9.66-5.53-2.11-11.71-3.17-18.53-3.17h-33.61v98.14h14.42l.13-36.69h11.99c4.52,0,8.2.79,11.03,2.38,2.84,1.59,5.24,3.8,7.21,6.63,1.97,2.84,3.92,6.13,5.84,9.88l8.89,17.8h15.87l-9.61-19.24ZM659.55,86.67l.12-34.76h19.04c3.94,0,7.52.6,10.75,1.8,3.22,1.2,5.77,3.03,7.64,5.48,1.88,2.45,2.81,5.7,2.81,9.74s-.91,7.09-2.74,9.74c-1.83,2.65-4.38,4.64-7.64,5.99-3.27,1.35-6.97,2.02-11.11,2.02h-18.87Z" }),
|
|
12
|
+
React.createElement("path", { fill: "currentColor", d: "M618.36,62.91c-2.26-4.27-5.09-8.11-8.5-11.53-4.5-4.49-9.72-8.01-15.65-10.55-5.94-2.54-12.39-3.8-19.38-3.8s-13.47,1.27-19.45,3.8c-5.98,2.54-11.22,6.06-15.72,10.55-4.5,4.5-8.02,9.74-10.55,15.72-2.54,5.98-3.81,12.47-3.81,19.45s1.27,13.66,3.81,19.74c2.53,6.08,6.05,11.37,10.55,15.86,4.49,4.5,9.74,8.02,15.72,10.55,5.98,2.54,12.46,3.81,19.45,3.81s13.44-1.27,19.38-3.81c5.94-2.53,11.15-6.05,15.65-10.55,4.23-4.23,7.58-9.18,10.03-14.82.15-.35.3-.69.44-1.04.57-1.4,1.08-2.83,1.52-4.28l12.51,4.15-2.67-20.65-2.66-20.65-7.32,6.03-9.78,8.06-3.24,2.67-13.86,11.43,12.73,4.23c-.32,1.16-.71,2.3-1.15,3.42-.26.65-.53,1.28-.82,1.9-1.64,3.58-3.81,6.74-6.5,9.52-3.16,3.25-6.82,5.81-10.98,7.68-4.16,1.87-8.59,2.8-13.28,2.8s-9.28-.93-13.5-2.8c-4.21-1.87-7.87-4.43-10.98-7.68-3.11-3.26-5.55-7.06-7.32-11.42-1.77-4.35-2.66-9.06-2.66-14.14s.89-9.62,2.66-13.93c1.77-4.31,4.21-8.09,7.32-11.34s6.77-5.79,10.98-7.61c4.21-1.82,8.71-2.73,13.5-2.73s9.24.91,13.35,2.73c4.11,1.82,7.75,4.36,10.91,7.61,3.16,3.25,5.6,7.03,7.32,11.34l11.95-9.72Z" }),
|
|
13
|
+
React.createElement("circle", { fill: "currentColor", cx: "575.56", cy: "86.71", r: "9.38" }),
|
|
14
|
+
React.createElement("path", { fill: "currentColor", d: "M206.51,137.4c-8.17,0-15.43-1.78-21.78-5.34-6.35-3.56-11.01-8.65-13.99-15.29l12.4-6.06c1.83,4.14,4.76,7.31,8.8,9.52,4.04,2.21,8.89,3.32,14.57,3.32,3.75,0,7.11-.55,10.1-1.66,2.98-1.1,5.36-2.79,7.14-5.05,1.78-2.26,2.67-4.98,2.67-8.15,0-3.56-.96-6.27-2.88-8.15-1.92-1.88-4.5-3.27-7.72-4.18-3.22-.91-6.76-1.71-10.6-2.38-3.66-.77-7.38-1.71-11.18-2.81-3.8-1.1-7.33-2.67-10.6-4.69-3.27-2.02-5.89-4.69-7.86-8-1.97-3.32-2.96-7.52-2.96-12.62,0-5.38,1.46-10.19,4.4-14.42,2.93-4.23,6.87-7.57,11.83-10.02,4.95-2.45,10.5-3.68,16.66-3.68,7.4,0,14.13,1.71,20.19,5.12,6.06,3.41,10.53,8.44,13.41,15.07l-12.26,6.35c-1.83-4.04-4.62-7.19-8.37-9.45-3.75-2.26-8.27-3.39-13.56-3.39-3.27,0-6.23.6-8.87,1.8-2.65,1.2-4.78,2.84-6.42,4.9-1.64,2.07-2.45,4.5-2.45,7.28,0,3.46,1.01,6.13,3.03,8.01,2.02,1.87,4.69,3.32,8,4.33,3.32,1.01,6.95,1.9,10.89,2.67,3.65.77,7.36,1.71,11.11,2.81,3.75,1.11,7.19,2.67,10.31,4.69,3.12,2.02,5.67,4.69,7.64,8,1.97,3.32,2.96,7.52,2.96,12.62,0,5.67-1.54,10.65-4.62,14.93-3.08,4.28-7.24,7.67-12.48,10.17-5.24,2.5-11.08,3.75-17.52,3.75Z" }),
|
|
15
|
+
React.createElement("path", { fill: "currentColor", d: "M276.75,123.07v-28.94h49.04v-13.41h-49.04v-28.94h51.92v-13.41h-53.08c-5,0-8.51,1.18-10.53,3.53-2.02,2.36-3.03,5.6-3.03,9.74v71.58c0,4.04,1.01,7.26,3.03,9.66,2.02,2.41,5.53,3.61,10.53,3.61h54.09v-13.41h-52.93Z" }),
|
|
16
|
+
React.createElement("path", { fill: "currentColor", d: "M365.12,123.24v-28.94h49.04v-13.41h-49.04v-28.94h51.92v-13.41h-53.08c-5,0-8.51,1.18-10.53,3.53-2.02,2.36-3.03,5.6-3.03,9.74v71.58c0,4.04,1.01,7.26,3.03,9.66,2.02,2.41,5.53,3.61,10.53,3.61h54.09v-13.41h-52.93Z" }),
|
|
17
|
+
React.createElement("path", { fill: "currentColor", d: "M806.12,136.49h15l-26.59-85.62c-1.44-4.52-3.8-7.88-7.07-10.1-3.27-2.21-6.97-3.32-11.11-3.32s-7.57,1.11-10.89,3.32c-3.32,2.21-5.7,5.58-7.14,10.1l-26.6,85.46h14.86l8.95-29.72,41.68-.11,8.91,29.99ZM759.57,93.2l11.45-38.01c.87-2.98,2.69-4.47,5.48-4.47s4.52,1.49,5.48,4.47l11.29,38.01h-33.7Z" })));
|
|
18
|
+
}
|
|
19
|
+
export function Footer({ translations = {} }) {
|
|
20
|
+
return (React.createElement("footer", { className: "seekora-docsearch-footer" },
|
|
21
|
+
React.createElement("div", { className: "seekora-docsearch-footer-commands" },
|
|
22
|
+
React.createElement("ul", { className: "seekora-docsearch-footer-commands-list" },
|
|
23
|
+
React.createElement("li", null,
|
|
24
|
+
React.createElement("span", { className: "seekora-docsearch-footer-command" },
|
|
25
|
+
React.createElement("kbd", { className: "seekora-docsearch-key" }, "\u21B5"),
|
|
26
|
+
React.createElement("span", null, "to select"))),
|
|
27
|
+
React.createElement("li", null,
|
|
28
|
+
React.createElement("span", { className: "seekora-docsearch-footer-command" },
|
|
29
|
+
React.createElement("kbd", { className: "seekora-docsearch-key" }, "\u2191"),
|
|
30
|
+
React.createElement("kbd", { className: "seekora-docsearch-key" }, "\u2193"),
|
|
31
|
+
React.createElement("span", null, "to navigate"))),
|
|
32
|
+
React.createElement("li", null,
|
|
33
|
+
React.createElement("span", { className: "seekora-docsearch-footer-command" },
|
|
34
|
+
React.createElement("kbd", { className: "seekora-docsearch-key" }, "esc"),
|
|
35
|
+
React.createElement("span", null, translations.closeText || 'to close'))))),
|
|
36
|
+
React.createElement("div", { className: "seekora-docsearch-footer-logo" },
|
|
37
|
+
React.createElement("span", { className: "seekora-docsearch-footer-logo-text" }, translations.searchByText || 'Search by'),
|
|
38
|
+
React.createElement("a", { href: "https://seekora.ai", target: "_blank", rel: "noopener noreferrer", className: "seekora-docsearch-footer-logo-link" },
|
|
39
|
+
React.createElement(SeekoraLogo, null)))));
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface HighlightProps {
|
|
3
|
+
value: string;
|
|
4
|
+
highlightedValue?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function Highlight({ value, highlightedValue }: HighlightProps): React.JSX.Element;
|
|
7
|
+
export declare function truncateAroundMatch(content: string, maxLength?: number): string;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=Highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Highlight.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/Highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAkBD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,cAAc,qBAKpE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,CAqBpF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function sanitizeHtml(html) {
|
|
3
|
+
const escaped = html
|
|
4
|
+
.replace(/&/g, '&')
|
|
5
|
+
.replace(/</g, '<')
|
|
6
|
+
.replace(/>/g, '>')
|
|
7
|
+
.replace(/"/g, '"')
|
|
8
|
+
.replace(/'/g, ''');
|
|
9
|
+
return escaped
|
|
10
|
+
.replace(/<mark>/g, '<mark>')
|
|
11
|
+
.replace(/<\/mark>/g, '</mark>')
|
|
12
|
+
.replace(/<ais-highlight>/g, '<mark>')
|
|
13
|
+
.replace(/<\/ais-highlight>/g, '</mark>')
|
|
14
|
+
.replace(/<em>/g, '<mark>')
|
|
15
|
+
.replace(/<\/em>/g, '</mark>');
|
|
16
|
+
}
|
|
17
|
+
export function Highlight({ value, highlightedValue }) {
|
|
18
|
+
if (!highlightedValue)
|
|
19
|
+
return React.createElement("span", null, value);
|
|
20
|
+
return (React.createElement("span", { className: "seekora-docsearch-highlight", dangerouslySetInnerHTML: { __html: sanitizeHtml(highlightedValue) } }));
|
|
21
|
+
}
|
|
22
|
+
export function truncateAroundMatch(content, maxLength = 150) {
|
|
23
|
+
const markIndex = content.indexOf('<mark>');
|
|
24
|
+
if (markIndex === -1 || content.length <= maxLength) {
|
|
25
|
+
if (content.length <= maxLength)
|
|
26
|
+
return content;
|
|
27
|
+
return content.slice(0, maxLength) + '...';
|
|
28
|
+
}
|
|
29
|
+
const halfLength = Math.floor(maxLength / 2);
|
|
30
|
+
let start = Math.max(0, markIndex - halfLength);
|
|
31
|
+
let end = Math.min(content.length, markIndex + halfLength);
|
|
32
|
+
if (start > 0) {
|
|
33
|
+
const spaceIndex = content.indexOf(' ', start);
|
|
34
|
+
if (spaceIndex !== -1 && spaceIndex < markIndex)
|
|
35
|
+
start = spaceIndex + 1;
|
|
36
|
+
}
|
|
37
|
+
if (end < content.length) {
|
|
38
|
+
const spaceIndex = content.lastIndexOf(' ', end);
|
|
39
|
+
if (spaceIndex !== -1 && spaceIndex > markIndex)
|
|
40
|
+
end = spaceIndex;
|
|
41
|
+
}
|
|
42
|
+
let result = content.slice(start, end);
|
|
43
|
+
if (start > 0)
|
|
44
|
+
result = '...' + result;
|
|
45
|
+
if (end < content.length)
|
|
46
|
+
result = result + '...';
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocSearchHit, DocSearchSuggestion } from '../types';
|
|
3
|
+
interface HitProps {
|
|
4
|
+
hit: DocSearchHit | DocSearchSuggestion;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
onMouseEnter: () => void;
|
|
8
|
+
openInNewTab?: boolean;
|
|
9
|
+
isChild?: boolean;
|
|
10
|
+
isLastChild?: boolean;
|
|
11
|
+
hierarchyType?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function Hit({ hit, isSelected, onClick, onMouseEnter, openInNewTab, isChild, isLastChild, hierarchyType }: HitProps): React.JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=Hit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hit.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/Hit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAElE,UAAU,QAAQ;IAChB,GAAG,EAAE,YAAY,GAAG,mBAAmB,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,GAAG,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,QAAQ,qBA2E1H"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Highlight, truncateAroundMatch } from './Highlight';
|
|
3
|
+
export function Hit({ hit, isSelected, onClick, onMouseEnter, openInNewTab, isChild, isLastChild, hierarchyType }) {
|
|
4
|
+
const isFullHit = 'objectID' in hit;
|
|
5
|
+
const suggestion = hit;
|
|
6
|
+
const hitType = hierarchyType || suggestion.type;
|
|
7
|
+
const breadcrumb = suggestion.parentTitle
|
|
8
|
+
? `${suggestion.category || ''} › ${suggestion.parentTitle}`.replace(/^› /, '')
|
|
9
|
+
: suggestion.category || '';
|
|
10
|
+
const title = getTitleForType(hit, hitType);
|
|
11
|
+
let highlightedTitle = title;
|
|
12
|
+
let highlightedContent = hit.content || suggestion.description || '';
|
|
13
|
+
if (isFullHit) {
|
|
14
|
+
const fullHit = hit;
|
|
15
|
+
if (fullHit._highlightResult) {
|
|
16
|
+
highlightedTitle = fullHit._highlightResult.title?.value || title;
|
|
17
|
+
highlightedContent = fullHit._highlightResult.content?.value || hit.content || '';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (suggestion.highlight) {
|
|
22
|
+
highlightedTitle = suggestion.highlight.title || title;
|
|
23
|
+
highlightedContent = suggestion.highlight.content || hit.content || suggestion.description || '';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const displayContent = highlightedContent ? truncateAroundMatch(highlightedContent, 120) : '';
|
|
27
|
+
const url = hit.url || suggestion.route || '#';
|
|
28
|
+
const classNames = ['seekora-docsearch-hit'];
|
|
29
|
+
if (isSelected)
|
|
30
|
+
classNames.push('seekora-docsearch-hit--selected');
|
|
31
|
+
if (isChild)
|
|
32
|
+
classNames.push('seekora-docsearch-hit--child');
|
|
33
|
+
if (isLastChild)
|
|
34
|
+
classNames.push('seekora-docsearch-hit--last-child');
|
|
35
|
+
return (React.createElement("a", { href: url, className: classNames.join(' '), onClick: (e) => { e.preventDefault(); onClick(); }, onMouseEnter: onMouseEnter, role: "option", "aria-selected": isSelected, target: openInNewTab ? '_blank' : undefined, rel: openInNewTab ? 'noopener noreferrer' : undefined },
|
|
36
|
+
isChild && (React.createElement("div", { className: "seekora-docsearch-hit-tree" },
|
|
37
|
+
React.createElement(TreeConnector, { isLast: isLastChild }))),
|
|
38
|
+
React.createElement("div", { className: "seekora-docsearch-hit-icon" },
|
|
39
|
+
React.createElement(HitIcon, { type: getHitTypeFromLevel(hitType) })),
|
|
40
|
+
React.createElement("div", { className: "seekora-docsearch-hit-content" },
|
|
41
|
+
!isChild && breadcrumb && React.createElement("span", { className: "seekora-docsearch-hit-breadcrumb" }, breadcrumb),
|
|
42
|
+
React.createElement("span", { className: "seekora-docsearch-hit-title" },
|
|
43
|
+
React.createElement(Highlight, { value: title, highlightedValue: highlightedTitle })),
|
|
44
|
+
displayContent && (React.createElement("span", { className: "seekora-docsearch-hit-description" },
|
|
45
|
+
React.createElement(Highlight, { value: hit.content || '', highlightedValue: displayContent })))),
|
|
46
|
+
React.createElement("div", { className: "seekora-docsearch-hit-action" }, openInNewTab ? (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true" },
|
|
47
|
+
React.createElement("path", { d: "M6 3H3v10h10v-3M9 3h4v4M14 2L7 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }))) : (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true" },
|
|
48
|
+
React.createElement("path", { d: "M6.75 3.25L11.5 8L6.75 12.75", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }))))));
|
|
49
|
+
}
|
|
50
|
+
function getTitleForType(hit, type) {
|
|
51
|
+
const hierarchy = hit.hierarchy || {};
|
|
52
|
+
if (!type)
|
|
53
|
+
return hit.title || hierarchy.lvl1 || hierarchy.lvl0 || 'Untitled';
|
|
54
|
+
const match = type.match(/^lvl(\d+)$/);
|
|
55
|
+
if (match) {
|
|
56
|
+
const level = parseInt(match[1], 10);
|
|
57
|
+
const levelKey = `lvl${level}`;
|
|
58
|
+
const levelTitle = hierarchy[levelKey];
|
|
59
|
+
if (levelTitle)
|
|
60
|
+
return levelTitle;
|
|
61
|
+
}
|
|
62
|
+
return hit.title || hierarchy.lvl1 || hierarchy.lvl0 || 'Untitled';
|
|
63
|
+
}
|
|
64
|
+
function getHitTypeFromLevel(type) {
|
|
65
|
+
if (!type)
|
|
66
|
+
return 'page';
|
|
67
|
+
const match = type.match(/^lvl(\d+)$/);
|
|
68
|
+
if (match) {
|
|
69
|
+
const level = parseInt(match[1], 10);
|
|
70
|
+
if (level === 1)
|
|
71
|
+
return 'page';
|
|
72
|
+
if (level <= 3)
|
|
73
|
+
return 'section';
|
|
74
|
+
return 'content';
|
|
75
|
+
}
|
|
76
|
+
return 'page';
|
|
77
|
+
}
|
|
78
|
+
function HitIcon({ type }) {
|
|
79
|
+
switch (type) {
|
|
80
|
+
case 'page':
|
|
81
|
+
return (React.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true" },
|
|
82
|
+
React.createElement("path", { d: "M4.5 3.5h11a1 1 0 011 1v11a1 1 0 01-1 1h-11a1 1 0 01-1-1v-11a1 1 0 011-1z", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }),
|
|
83
|
+
React.createElement("path", { d: "M7 7h6M7 10h6M7 13h4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })));
|
|
84
|
+
case 'section':
|
|
85
|
+
return (React.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true" },
|
|
86
|
+
React.createElement("path", { d: "M4 5.5h12M4 10h12M4 14.5h8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })));
|
|
87
|
+
case 'content':
|
|
88
|
+
return (React.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true" },
|
|
89
|
+
React.createElement("path", { d: "M4 6h12M4 10h8M4 14h10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function TreeConnector({ isLast }) {
|
|
93
|
+
return (React.createElement("svg", { width: "16", height: "20", viewBox: "0 0 16 20", fill: "none", "aria-hidden": "true", className: "seekora-docsearch-hit-tree-icon" }, isLast ? (React.createElement("path", { d: "M8 0V10H14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })) : (React.createElement(React.Fragment, null,
|
|
94
|
+
React.createElement("path", { d: "M8 0V20", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
95
|
+
React.createElement("path", { d: "M8 10H14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })))));
|
|
96
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function Modal({ isOpen, onClose, children, className }: ModalProps): React.ReactPortal | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,UAAU,UAAU;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,UAAU,4BAqEzE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
export function Modal({ isOpen, onClose, children, className }) {
|
|
4
|
+
const overlayRef = useRef(null);
|
|
5
|
+
const containerRef = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const handleClickOutside = (event) => {
|
|
8
|
+
if (containerRef.current &&
|
|
9
|
+
!containerRef.current.contains(event.target)) {
|
|
10
|
+
onClose();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
if (isOpen)
|
|
14
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
15
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
16
|
+
}, [isOpen, onClose]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (isOpen) {
|
|
19
|
+
const originalOverflow = document.body.style.overflow;
|
|
20
|
+
document.body.style.overflow = "hidden";
|
|
21
|
+
return () => {
|
|
22
|
+
document.body.style.overflow = originalOverflow;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, [isOpen]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!isOpen || !containerRef.current)
|
|
28
|
+
return;
|
|
29
|
+
const container = containerRef.current;
|
|
30
|
+
const focusableElements = container.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
31
|
+
const firstElement = focusableElements[0];
|
|
32
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
33
|
+
const handleTabKey = (e) => {
|
|
34
|
+
if (e.key !== "Tab")
|
|
35
|
+
return;
|
|
36
|
+
if (e.shiftKey) {
|
|
37
|
+
if (document.activeElement === firstElement) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
lastElement?.focus();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (document.activeElement === lastElement) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
firstElement?.focus();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
container.addEventListener("keydown", handleTabKey);
|
|
50
|
+
return () => container.removeEventListener("keydown", handleTabKey);
|
|
51
|
+
}, [isOpen]);
|
|
52
|
+
if (!isOpen || typeof document === "undefined")
|
|
53
|
+
return null;
|
|
54
|
+
const modalContent = (React.createElement("div", { ref: overlayRef, className: `seekora-docsearch-overlay${className ? ` ${className}` : ""}`, role: "dialog", "aria-modal": "true", "aria-label": "Search documentation" },
|
|
55
|
+
React.createElement("div", { ref: containerRef, className: "seekora-docsearch-container" }, children)));
|
|
56
|
+
return createPortal(modalContent, document.body);
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocSearchHit, DocSearchSuggestion, DocSearchTranslations, SearchSource } from '../types';
|
|
3
|
+
interface GroupedHits {
|
|
4
|
+
source: SearchSource;
|
|
5
|
+
items: DocSearchSuggestion[];
|
|
6
|
+
}
|
|
7
|
+
interface ResultsProps {
|
|
8
|
+
hits: (DocSearchHit | DocSearchSuggestion)[];
|
|
9
|
+
groupedHits?: GroupedHits[];
|
|
10
|
+
selectedIndex: number;
|
|
11
|
+
onSelect: (hit: DocSearchHit | DocSearchSuggestion) => void;
|
|
12
|
+
onHover: (index: number) => void;
|
|
13
|
+
/** When true, scroll the selected item into view (set by keyboard nav only; avoids scroll-on-hover jump) */
|
|
14
|
+
scrollSelectionIntoViewRef?: React.MutableRefObject<boolean>;
|
|
15
|
+
query: string;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
error: string | null;
|
|
18
|
+
translations?: DocSearchTranslations;
|
|
19
|
+
sources?: SearchSource[];
|
|
20
|
+
}
|
|
21
|
+
export declare function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSelectionIntoViewRef, query, isLoading, error, translations, sources: _sources, }: ResultsProps): React.JSX.Element;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=Results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Results.d.ts","sourceRoot":"","sources":["../../../src/docsearch/components/Results.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEvG,UAAU,WAAW;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAC9B;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,CAAC,YAAY,GAAG,mBAAmB,CAAC,EAAE,CAAC;IAC7C,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,GAAG,EAAE,YAAY,GAAG,mBAAmB,KAAK,IAAI,CAAC;IAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,4GAA4G;IAC5G,0BAA0B,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAuGD,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,WAAW,EACX,aAAa,EACb,QAAQ,EACR,OAAO,EACP,0BAA0B,EAC1B,KAAK,EACL,SAAS,EACT,KAAK,EACL,YAAiB,EACjB,OAAO,EAAE,QAAa,GACvB,EAAE,YAAY,qBA4Fd"}
|