@seekora-ai/ui-sdk-react 0.2.12 → 0.2.13
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/InfiniteHits.d.ts +2 -0
- package/dist/components/InfiniteHits.d.ts.map +1 -1
- package/dist/components/InfiniteHits.js +6 -3
- package/dist/components/QuerySuggestions.d.ts +2 -0
- package/dist/components/QuerySuggestions.d.ts.map +1 -1
- package/dist/components/QuerySuggestions.js +4 -3
- package/dist/components/QuerySuggestionsDropdown.d.ts +1 -1
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -1
- package/dist/components/QuerySuggestionsDropdown.js +4 -4
- package/dist/components/Recommendations.d.ts +6 -0
- package/dist/components/Recommendations.d.ts.map +1 -1
- package/dist/components/Recommendations.js +12 -6
- package/dist/components/RichQuerySuggestions.d.ts +4 -0
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +2 -3
- package/dist/components/SearchBar.d.ts +2 -0
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +5 -9
- package/dist/components/SearchResults.d.ts +2 -0
- package/dist/components/SearchResults.d.ts.map +1 -1
- package/dist/components/SearchResults.js +4 -2
- package/dist/components/section-primitives/SectionItemGrid.d.ts +3 -1
- package/dist/components/section-primitives/SectionItemGrid.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionItemGrid.js +3 -2
- package/dist/components/suggestions/AmazonDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/AmazonDropdown.js +2 -2
- package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/GoogleDropdown.js +2 -2
- package/dist/components/suggestions/MinimalDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MinimalDropdown.js +2 -2
- package/dist/components/suggestions/MobileSheetDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MobileSheetDropdown.js +2 -2
- package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/PinterestDropdown.js +2 -2
- package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/ShopifyDropdown.js +2 -2
- package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/SpotlightDropdown.js +2 -2
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -1
- package/dist/components/suggestions/SuggestionSearchBar.js +1 -0
- package/dist/components/suggestions/types.d.ts +2 -0
- package/dist/components/suggestions/types.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +8 -1
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.js +7 -4
- package/dist/components/suggestions-primitives/SuggestionsDropdownComposition.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionsDropdownComposition.js +0 -2
- package/dist/docsearch/components/Results.d.ts +3 -1
- package/dist/docsearch/components/Results.d.ts.map +1 -1
- package/dist/docsearch/components/Results.js +6 -2
- package/dist/hooks/useQuerySuggestionsEnhanced.js +2 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +32 -3
- package/dist/src/index.esm.js +85 -68
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +85 -68
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/dist/src/index.esm.js
CHANGED
|
@@ -1511,7 +1511,7 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
|
|
|
1511
1511
|
*
|
|
1512
1512
|
* Interactive search input component with query suggestions support
|
|
1513
1513
|
*/
|
|
1514
|
-
const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounceMs = 300, minQueryLength = 2, maxSuggestions = 10, onSearch, onQueryChange, onSuggestionSelect, onSearchStateChange, searchOptions, className, style, theme: customTheme, renderSuggestion, renderLoading, }) => {
|
|
1514
|
+
const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounceMs = 300, minQueryLength = 2, maxSuggestions = 10, onSearch, onQueryChange, onSuggestionSelect, onSearchStateChange, searchOptions, className, style, theme: customTheme, showLoadingState = false, renderSuggestion, renderLoading, }) => {
|
|
1515
1515
|
const { client, theme, enableAnalytics, autoTrackSearch } = useSearchContext();
|
|
1516
1516
|
const { query, setQuery, search: triggerSearch, results, loading: searchLoading, error: searchError } = useSearchState();
|
|
1517
1517
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -1644,13 +1644,9 @@ const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounce
|
|
|
1644
1644
|
const defaultRenderLoading = () => (React.createElement("div", { style: { padding: theme.spacing.medium, textAlign: 'center' } }, "Loading suggestions..."));
|
|
1645
1645
|
const searchBarTheme = customTheme || {};
|
|
1646
1646
|
const isLoading = suggestionsLoading || searchLoading;
|
|
1647
|
-
//
|
|
1648
|
-
// 1. Input is focused
|
|
1649
|
-
// 2. Suggestions are enabled
|
|
1650
|
-
// 3. Query is long enough
|
|
1651
|
-
// 4. AND (we have suggestions to show OR we're currently loading suggestions)
|
|
1647
|
+
// Show list when we have suggestions (including previous while loading) or when loading and showLoadingState
|
|
1652
1648
|
const hasSuggestions = displayedSuggestions.length > 0;
|
|
1653
|
-
const showSuggestionsList = isFocused && showSuggestions && query.length >= minQueryLength && (hasSuggestions || isLoading);
|
|
1649
|
+
const showSuggestionsList = isFocused && showSuggestions && query.length >= minQueryLength && (hasSuggestions || (isLoading && showLoadingState));
|
|
1654
1650
|
// Get processing time from results
|
|
1655
1651
|
const res = results;
|
|
1656
1652
|
const processingTime = res?.processingTimeMS
|
|
@@ -1701,8 +1697,8 @@ const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounce
|
|
|
1701
1697
|
overflowY: 'auto',
|
|
1702
1698
|
zIndex: 1000,
|
|
1703
1699
|
} },
|
|
1704
|
-
isLoading && (renderLoading ? renderLoading() : defaultRenderLoading()),
|
|
1705
|
-
|
|
1700
|
+
isLoading && displayedSuggestions.length === 0 && showLoadingState && (renderLoading ? renderLoading() : defaultRenderLoading()),
|
|
1701
|
+
displayedSuggestions.length > 0 && (React.createElement(React.Fragment, null, displayedSuggestions.map((suggestion, index) => {
|
|
1706
1702
|
const isSelected = index === selectedIndex;
|
|
1707
1703
|
const renderFn = renderSuggestion || defaultRenderSuggestion;
|
|
1708
1704
|
return (React.createElement("div", { key: index, className: clsx(searchBarTheme.suggestionItem, isSelected && searchBarTheme.suggestionItemActive), onClick: () => handleSuggestionSelect(suggestion.query), onMouseEnter: () => setSelectedIndex(index), style: {
|
|
@@ -1744,7 +1740,7 @@ const formatPrice$1 = (value, currency = '₹') => {
|
|
|
1744
1740
|
}
|
|
1745
1741
|
return String(value);
|
|
1746
1742
|
};
|
|
1747
|
-
const SearchResults = ({ results: resultsProp, loading: loadingProp, error: errorProp, onResultClick, renderResult, renderEmpty, renderLoading, renderError, className, style, theme: customTheme, itemsPerPage = 20, showPagination = false, viewMode = 'list', fieldMapping, extractResults, enableKeyboardNavigation = true, autoFocus = false, }) => {
|
|
1743
|
+
const SearchResults = ({ results: resultsProp, loading: loadingProp, error: errorProp, onResultClick, renderResult, renderEmpty, showLoadingState = false, renderLoading, renderError, className, style, theme: customTheme, itemsPerPage = 20, showPagination = false, viewMode = 'list', fieldMapping, extractResults, enableKeyboardNavigation = true, autoFocus = false, }) => {
|
|
1748
1744
|
const { theme, client, enableAnalytics } = useSearchContext();
|
|
1749
1745
|
const { results: stateResults, loading: stateLoading, error: stateError, currentPage, itemsPerPage: stateItemsPerPage } = useSearchState();
|
|
1750
1746
|
const searchResultsTheme = customTheme || {};
|
|
@@ -2111,10 +2107,12 @@ const SearchResults = ({ results: resultsProp, loading: loadingProp, error: erro
|
|
|
2111
2107
|
hasError: !!error,
|
|
2112
2108
|
isLoading: loading,
|
|
2113
2109
|
});
|
|
2114
|
-
if (loading)
|
|
2110
|
+
// When loading with no previous results, show loading only if showLoadingState (default: show previous results, no loading screen)
|
|
2111
|
+
if (loading && resultItems.length === 0 && showLoadingState) {
|
|
2115
2112
|
log.verbose('SearchResults: Rendering loading state');
|
|
2116
2113
|
return (React.createElement("div", { className: clsx(searchResultsTheme.container, className), style: style }, renderLoading ? renderLoading() : defaultRenderLoading()));
|
|
2117
2114
|
}
|
|
2115
|
+
// When loading with previous results, fall through and render them (no loading screen)
|
|
2118
2116
|
if (error) {
|
|
2119
2117
|
log.error('SearchResults: Rendering error state', {
|
|
2120
2118
|
error: error.message,
|
|
@@ -3086,7 +3084,7 @@ const HitsPerPage = ({ items, onHitsPerPageChange, renderSelect, className, styl
|
|
|
3086
3084
|
* Displays search results with infinite scroll or "Show More" button
|
|
3087
3085
|
* Accumulates results as user loads more pages
|
|
3088
3086
|
*/
|
|
3089
|
-
const InfiniteHits = ({ renderHit, renderEmpty, renderLoading, renderShowMore, showMoreButton = true, useInfiniteScroll = false, scrollThreshold = 0.1, fieldMapping, showMoreLabel = 'Show more', loadingLabel = 'Loading...', onHitClick, className, style, theme: customTheme, syncWithState = true, }) => {
|
|
3087
|
+
const InfiniteHits = ({ renderHit, renderEmpty, showInitialLoading = false, renderLoading, renderShowMore, showMoreButton = true, useInfiniteScroll = false, scrollThreshold = 0.1, fieldMapping, showMoreLabel = 'Show more', loadingLabel = 'Loading...', onHitClick, className, style, theme: customTheme, syncWithState = true, }) => {
|
|
3090
3088
|
const { theme, stateManager } = useSearchContext();
|
|
3091
3089
|
const { results, loading, currentPage, setPage } = useSearchState();
|
|
3092
3090
|
const infiniteHitsTheme = customTheme || {};
|
|
@@ -3241,10 +3239,13 @@ const InfiniteHits = ({ renderHit, renderEmpty, renderLoading, renderShowMore, s
|
|
|
3241
3239
|
cursor: isLastPage || isLoadingMore ? 'not-allowed' : 'pointer',
|
|
3242
3240
|
transition: theme.transitions?.fast || '150ms ease-in-out',
|
|
3243
3241
|
} }, isLoadingMore ? loadingLabel : isLastPage ? 'No more results' : showMoreLabel));
|
|
3244
|
-
// Initial loading state
|
|
3245
|
-
if (loading && accumulatedHits.length === 0) {
|
|
3242
|
+
// Initial loading state (only when showInitialLoading: default no loading screen)
|
|
3243
|
+
if (loading && accumulatedHits.length === 0 && showInitialLoading) {
|
|
3246
3244
|
return (React.createElement("div", { className: clsx(infiniteHitsTheme.root, className), style: style }, renderLoading ? renderLoading() : defaultRenderLoading()));
|
|
3247
3245
|
}
|
|
3246
|
+
if (loading && accumulatedHits.length === 0) {
|
|
3247
|
+
return React.createElement("div", { className: clsx(infiniteHitsTheme.root, className), style: style });
|
|
3248
|
+
}
|
|
3248
3249
|
// Empty state
|
|
3249
3250
|
if (!loading && accumulatedHits.length === 0) {
|
|
3250
3251
|
return (React.createElement("div", { className: clsx(infiniteHitsTheme.root, className), style: style }, renderEmpty ? renderEmpty() : defaultRenderEmpty()));
|
|
@@ -4126,36 +4127,40 @@ const MobileFiltersButton = ({ onClick, text = 'Filters', showCount = true, clas
|
|
|
4126
4127
|
* - FrequentlyBoughtTogether: Bundle recommendations
|
|
4127
4128
|
* - RecentlyViewed: User's recently viewed items
|
|
4128
4129
|
*/
|
|
4129
|
-
const RelatedProducts = ({ productId, items: itemsProp, loading: loadingProp = false, title = 'Related Products', maxItems = 6, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4130
|
+
const RelatedProducts = ({ productId, items: itemsProp, loading: loadingProp = false, showLoadingState = false, title = 'Related Products', maxItems = 6, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4130
4131
|
const { theme } = useSearchContext();
|
|
4131
4132
|
const recommendationTheme = customTheme || {};
|
|
4132
4133
|
// If items are provided, use them directly
|
|
4133
4134
|
const items = itemsProp?.slice(0, maxItems) || [];
|
|
4134
4135
|
const loading = loadingProp;
|
|
4135
|
-
if (loading) {
|
|
4136
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
4136
4137
|
return (React.createElement("div", { className: clsx(recommendationTheme.root, className), style: style },
|
|
4137
4138
|
React.createElement("div", { className: recommendationTheme.loading, style: getLoadingStyle(theme) }, "Loading related products...")));
|
|
4138
4139
|
}
|
|
4140
|
+
if (loading && items.length === 0)
|
|
4141
|
+
return null;
|
|
4139
4142
|
if (items.length === 0) {
|
|
4140
4143
|
return null;
|
|
4141
4144
|
}
|
|
4142
4145
|
return (React.createElement(RecommendationSection, { title: title, items: items, renderItem: renderItem, onItemClick: onItemClick, className: className, style: style, theme: customTheme, layout: layout, currencySymbol: currencySymbol }));
|
|
4143
4146
|
};
|
|
4144
|
-
const TrendingItems = ({ items: itemsProp, loading: loadingProp = false, title = 'Trending Now', maxItems = 8, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4147
|
+
const TrendingItems = ({ items: itemsProp, loading: loadingProp = false, showLoadingState = false, title = 'Trending Now', maxItems = 8, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4145
4148
|
const { theme } = useSearchContext();
|
|
4146
4149
|
const recommendationTheme = customTheme || {};
|
|
4147
4150
|
const items = itemsProp?.slice(0, maxItems) || [];
|
|
4148
4151
|
const loading = loadingProp;
|
|
4149
|
-
if (loading) {
|
|
4152
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
4150
4153
|
return (React.createElement("div", { className: clsx(recommendationTheme.root, className), style: style },
|
|
4151
4154
|
React.createElement("div", { className: recommendationTheme.loading, style: getLoadingStyle(theme) }, "Loading trending items...")));
|
|
4152
4155
|
}
|
|
4156
|
+
if (loading && items.length === 0)
|
|
4157
|
+
return null;
|
|
4153
4158
|
if (items.length === 0) {
|
|
4154
4159
|
return null;
|
|
4155
4160
|
}
|
|
4156
4161
|
return (React.createElement(RecommendationSection, { title: title, items: items, renderItem: renderItem, onItemClick: onItemClick, className: className, style: style, theme: customTheme, layout: layout, currencySymbol: currencySymbol }));
|
|
4157
4162
|
};
|
|
4158
|
-
const FrequentlyBoughtTogether = ({ productId, items: itemsProp, loading: loadingProp = false, title = 'Frequently Bought Together', maxItems = 4, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', showAddAllButton = true, onAddAll, }) => {
|
|
4163
|
+
const FrequentlyBoughtTogether = ({ productId, items: itemsProp, loading: loadingProp = false, showLoadingState = false, title = 'Frequently Bought Together', maxItems = 4, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', showAddAllButton = true, onAddAll, }) => {
|
|
4159
4164
|
const { theme } = useSearchContext();
|
|
4160
4165
|
const recommendationTheme = customTheme || {};
|
|
4161
4166
|
const items = itemsProp?.slice(0, maxItems) || [];
|
|
@@ -4168,10 +4173,12 @@ const FrequentlyBoughtTogether = ({ productId, items: itemsProp, loading: loadin
|
|
|
4168
4173
|
return sum + price;
|
|
4169
4174
|
}, 0);
|
|
4170
4175
|
}, [items]);
|
|
4171
|
-
if (loading) {
|
|
4176
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
4172
4177
|
return (React.createElement("div", { className: clsx(recommendationTheme.root, className), style: style },
|
|
4173
4178
|
React.createElement("div", { className: recommendationTheme.loading, style: getLoadingStyle(theme) }, "Loading recommendations...")));
|
|
4174
4179
|
}
|
|
4180
|
+
if (loading && items.length === 0)
|
|
4181
|
+
return null;
|
|
4175
4182
|
if (items.length === 0) {
|
|
4176
4183
|
return null;
|
|
4177
4184
|
}
|
|
@@ -4390,7 +4397,7 @@ function getLoadingStyle(theme) {
|
|
|
4390
4397
|
*
|
|
4391
4398
|
* Standalone component for displaying query suggestions
|
|
4392
4399
|
*/
|
|
4393
|
-
const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, minQueryLength = 2, onSuggestionClick, renderSuggestion, renderLoading, renderEmpty, showTitle = false, title = 'Suggestions', className, style, theme: customTheme, }) => {
|
|
4400
|
+
const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, minQueryLength = 2, onSuggestionClick, renderSuggestion, showLoadingState = false, renderLoading, renderEmpty, showTitle = false, title = 'Suggestions', className, style, theme: customTheme, }) => {
|
|
4394
4401
|
const { client, theme } = useSearchContext();
|
|
4395
4402
|
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
4396
4403
|
const { suggestions, loading, error } = useQuerySuggestions({
|
|
@@ -4427,7 +4434,8 @@ const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, m
|
|
|
4427
4434
|
if (query.length < minQueryLength) {
|
|
4428
4435
|
return null;
|
|
4429
4436
|
}
|
|
4430
|
-
if (loading)
|
|
4437
|
+
// When loading with no previous results, show loading only if showLoadingState (default: show previous results, no loading screen)
|
|
4438
|
+
if (loading && displayedSuggestions.length === 0 && showLoadingState) {
|
|
4431
4439
|
return (React.createElement("div", { className: clsx(suggestionsTheme.container, className), style: style },
|
|
4432
4440
|
showTitle && (React.createElement("div", { className: suggestionsTheme.title, style: {
|
|
4433
4441
|
fontSize: theme.typography.fontSize.large,
|
|
@@ -4437,7 +4445,7 @@ const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, m
|
|
|
4437
4445
|
} }, title)),
|
|
4438
4446
|
renderLoading ? renderLoading() : defaultRenderLoading()));
|
|
4439
4447
|
}
|
|
4440
|
-
if (error || displayedSuggestions.length === 0) {
|
|
4448
|
+
if (error || (!loading && displayedSuggestions.length === 0)) {
|
|
4441
4449
|
return (React.createElement("div", { className: clsx(suggestionsTheme.container, className), style: style },
|
|
4442
4450
|
showTitle && (React.createElement("div", { className: suggestionsTheme.title, style: {
|
|
4443
4451
|
fontSize: theme.typography.fontSize.large,
|
|
@@ -4565,7 +4573,8 @@ function transformFilteredTab(raw) {
|
|
|
4565
4573
|
// Main Hook
|
|
4566
4574
|
// ============================================================================
|
|
4567
4575
|
function useQuerySuggestionsEnhanced(options) {
|
|
4568
|
-
const { client, query, enabled = true, debounceMs = 200, maxSuggestions = 10, minQueryLength = 1, includeDropdownRecommendations = false, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, includeFacets =
|
|
4576
|
+
const { client, query, enabled = true, debounceMs = 200, maxSuggestions = 10, minQueryLength = 1, includeDropdownRecommendations = false, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, includeFacets = true, // CHANGED: Enable facets by default
|
|
4577
|
+
maxCategories = 3, maxFacets = 5, filteredTabs, minPopularity, timeRange, disableTypoTolerance, analyticsTags, enableRecentSearches = true, maxRecentSearches = MAX_RECENT_SEARCHES_DEFAULT, recentSearchesKey = RECENT_SEARCHES_DEFAULT_KEY, onSuggestionsLoaded, onError, } = options;
|
|
4569
4578
|
// State
|
|
4570
4579
|
const [suggestions, setSuggestions] = useState([]);
|
|
4571
4580
|
const [loading, setLoading] = useState(false);
|
|
@@ -5021,7 +5030,7 @@ const LoadingSpinner = ({ style }) => (React.createElement("svg", { style: { ani
|
|
|
5021
5030
|
// Component
|
|
5022
5031
|
// ============================================================================
|
|
5023
5032
|
const QuerySuggestionsDropdown = forwardRef(function QuerySuggestionsDropdown(props, ref) {
|
|
5024
|
-
const { query, isOpen = true, maxSuggestions = 8, minQueryLength = 1, debounceMs = 200, showRecentSearches = true, maxRecentSearches = 5, showCounts = true, showLoading =
|
|
5033
|
+
const { query, isOpen = true, maxSuggestions = 8, minQueryLength = 1, debounceMs = 200, showRecentSearches = true, maxRecentSearches = 5, showCounts = true, showLoading = false, showEmptyState = true, highlight = { enabled: true, preTag: '<mark>', postTag: '</mark>' }, keyboardNav = { enabled: true }, animation = { enabled: true, duration: 150, entrance: 'fade' }, classNames = {}, style, renderSuggestion, renderRecentSearch, renderLoading, renderEmpty, footer, position = 'absolute', width = '100%', zIndex = 1000, closeOnClickOutside = true, closeOnEscape = true, ariaLabel = 'Search suggestions', onSuggestionSelect, onRecentSearchClick, onRecentSearchRemove, onOpen, onClose, onNavigate, } = props;
|
|
5025
5034
|
const { client, theme } = useSearchContext();
|
|
5026
5035
|
const containerRef = useRef(null);
|
|
5027
5036
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
@@ -5206,7 +5215,7 @@ const QuerySuggestionsDropdown = forwardRef(function QuerySuggestionsDropdown(pr
|
|
|
5206
5215
|
loading && showLoading && (React.createElement("div", { className: classNames.loadingState, style: defaultStyles$1.loadingState }, renderLoading ? renderLoading() : (React.createElement(React.Fragment, null,
|
|
5207
5216
|
React.createElement(LoadingSpinner, null),
|
|
5208
5217
|
React.createElement("span", null, "Searching..."))))),
|
|
5209
|
-
|
|
5218
|
+
showRecent && (React.createElement("div", { className: clsx('seekora-suggestions-section', classNames.section, classNames.recentSearches) },
|
|
5210
5219
|
React.createElement("div", { className: classNames.sectionTitle, style: defaultStyles$1.sectionTitle }, "Recent Searches"),
|
|
5211
5220
|
recentSearches.slice(0, maxRecentSearches).map((search, index) => {
|
|
5212
5221
|
const isActive = activeIndex === index;
|
|
@@ -5214,8 +5223,8 @@ const QuerySuggestionsDropdown = forwardRef(function QuerySuggestionsDropdown(pr
|
|
|
5214
5223
|
onRecentSearchClick?.(search);
|
|
5215
5224
|
}, onMouseEnter: () => setActiveIndex(index) }, renderRecentSearchItem(search, index, isActive)));
|
|
5216
5225
|
}))),
|
|
5217
|
-
|
|
5218
|
-
|
|
5226
|
+
showRecent && showSuggestions && (React.createElement("div", { style: defaultStyles$1.divider })),
|
|
5227
|
+
showSuggestions && (React.createElement("div", { className: clsx('seekora-suggestions-section', classNames.section, classNames.suggestionsList) },
|
|
5219
5228
|
query.length > 0 && (React.createElement("div", { className: classNames.sectionTitle, style: defaultStyles$1.sectionTitle }, "Suggestions")),
|
|
5220
5229
|
suggestions.map((suggestion, index) => {
|
|
5221
5230
|
const itemIndex = showRecent ? recentSearches.length + index : index;
|
|
@@ -5477,7 +5486,7 @@ const CloseIcon = () => (React.createElement("svg", { viewBox: "0 0 20 20", fill
|
|
|
5477
5486
|
// Component
|
|
5478
5487
|
// ============================================================================
|
|
5479
5488
|
const RichQuerySuggestions = forwardRef(function RichQuerySuggestions(props, ref) {
|
|
5480
|
-
const { query, isOpen = true, sections = DEFAULT_SECTIONS, maxSuggestionsPerSection = 8, minQueryLength = 0, debounceMs = 200, includeDropdownRecommendations = true, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, maxCategories = 3, showCounts = true, showCategoryCounts = true, showSectionHeaders = true, classNames = {}, style, renderSuggestion, renderCategory, renderTrendingItem, renderRecentItem, header, footer, width = '100%', maxHeight = '480px', zIndex = 1000, ariaLabel = 'Search suggestions', analyticsTags, onSuggestionSelect, onCategoryClick, onRecentSearchClick, onRecentSearchRemove, onViewAllClick, onOpen, onClose, } = props;
|
|
5489
|
+
const { query, isOpen = true, sections = DEFAULT_SECTIONS, maxSuggestionsPerSection = 8, minQueryLength = 0, debounceMs = 200, includeDropdownRecommendations = true, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, maxCategories = 3, showCounts = true, showCategoryCounts = true, showSectionHeaders = true, classNames = {}, style, renderSuggestion, renderCategory, renderTrendingItem, renderRecentItem, header, footer, width = '100%', maxHeight = '480px', zIndex = 1000, ariaLabel = 'Search suggestions', analyticsTags, onSuggestionSelect, onCategoryClick, onRecentSearchClick, onRecentSearchRemove, onViewAllClick, onOpen, onClose, showLoadingOverlay = false, renderLoading, } = props;
|
|
5481
5490
|
const { client } = useSearchContext();
|
|
5482
5491
|
const containerRef = useRef(null);
|
|
5483
5492
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
@@ -5696,8 +5705,7 @@ const RichQuerySuggestions = forwardRef(function RichQuerySuggestions(props, ref
|
|
|
5696
5705
|
} },
|
|
5697
5706
|
header && React.createElement("div", { style: styles$2.header }, header),
|
|
5698
5707
|
React.createElement("div", { style: { ...styles$2.content, maxHeight } },
|
|
5699
|
-
loading && (React.createElement("div", { style: styles$2.loadingOverlay },
|
|
5700
|
-
React.createElement("span", null, "Loading..."))),
|
|
5708
|
+
loading && showLoadingOverlay && (React.createElement("div", { style: styles$2.loadingOverlay }, renderLoading ? renderLoading() : React.createElement("span", null, "Loading..."))),
|
|
5701
5709
|
enabledSections.map((section, index) => {
|
|
5702
5710
|
let content = null;
|
|
5703
5711
|
switch (section.id) {
|
|
@@ -7182,21 +7190,6 @@ function SuggestionItem({ suggestion, index, isActive, onSelect, className, styl
|
|
|
7182
7190
|
suggestion.count != null ? (React.createElement("span", { className: "seekora-suggestions-item-count", style: { marginLeft: 8, color: 'var(--seekora-text-secondary, #6b7280)', fontSize: '0.875em' } }, suggestion.count)) : null));
|
|
7183
7191
|
}
|
|
7184
7192
|
|
|
7185
|
-
/**
|
|
7186
|
-
* SuggestionsLoading – loading indicator (primitive)
|
|
7187
|
-
*/
|
|
7188
|
-
function SuggestionsLoading({ className, style, text = 'Loading...' }) {
|
|
7189
|
-
const { loading } = useSuggestionsContext();
|
|
7190
|
-
if (!loading)
|
|
7191
|
-
return null;
|
|
7192
|
-
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: {
|
|
7193
|
-
padding: 16,
|
|
7194
|
-
color: 'var(--seekora-text-secondary, #6b7280)',
|
|
7195
|
-
fontSize: '0.875rem',
|
|
7196
|
-
...style,
|
|
7197
|
-
} }, text));
|
|
7198
|
-
}
|
|
7199
|
-
|
|
7200
7193
|
/**
|
|
7201
7194
|
* SuggestionList – container for text suggestions (primitive)
|
|
7202
7195
|
*
|
|
@@ -7208,15 +7201,19 @@ const listStyle = {
|
|
|
7208
7201
|
margin: 0,
|
|
7209
7202
|
padding: '4px 0',
|
|
7210
7203
|
};
|
|
7211
|
-
function SuggestionList({ maxItems = 10, className, style, listClassName, enableHighlightMarkup = true, highlightMarkupOptions, renderItem, }) {
|
|
7204
|
+
function SuggestionList({ maxItems = 10, className, style, listClassName, showLoadingState = false, renderLoading, enableHighlightMarkup = true, highlightMarkupOptions, renderItem, }) {
|
|
7212
7205
|
const { suggestions, activeIndex, loading, selectSuggestion, getAllNavigableItems, } = useSuggestionsContext();
|
|
7213
7206
|
const items = suggestions.slice(0, maxItems);
|
|
7214
7207
|
const navigableItems = getAllNavigableItems();
|
|
7215
7208
|
const suggestionStartIndex = navigableItems.findIndex((n) => n.type === 'suggestion');
|
|
7216
7209
|
const activeIsInSuggestions = suggestionStartIndex >= 0 && activeIndex >= suggestionStartIndex && activeIndex < suggestionStartIndex + items.length;
|
|
7217
|
-
if (loading)
|
|
7218
|
-
|
|
7210
|
+
// When loading with no previous results, show loading only if showLoadingState (default: don't show loading screen)
|
|
7211
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
7212
|
+
if (renderLoading)
|
|
7213
|
+
return React.createElement(React.Fragment, null, renderLoading());
|
|
7214
|
+
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: { padding: 16, color: 'var(--seekora-text-secondary, #6b7280)', fontSize: '0.875rem', ...style } }, "Loading..."));
|
|
7219
7215
|
}
|
|
7216
|
+
// When loading with previous results, show previous results (no loading UI)
|
|
7220
7217
|
if (items.length === 0)
|
|
7221
7218
|
return null;
|
|
7222
7219
|
return (React.createElement("div", { className: clsx('seekora-suggestions-list', className), style: style },
|
|
@@ -9128,6 +9125,21 @@ function TrendingList({ title = 'Trending', maxItems = 8, className, style, list
|
|
|
9128
9125
|
}))));
|
|
9129
9126
|
}
|
|
9130
9127
|
|
|
9128
|
+
/**
|
|
9129
|
+
* SuggestionsLoading – loading indicator (primitive)
|
|
9130
|
+
*/
|
|
9131
|
+
function SuggestionsLoading({ className, style, text = 'Loading...' }) {
|
|
9132
|
+
const { loading } = useSuggestionsContext();
|
|
9133
|
+
if (!loading)
|
|
9134
|
+
return null;
|
|
9135
|
+
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: {
|
|
9136
|
+
padding: 16,
|
|
9137
|
+
color: 'var(--seekora-text-secondary, #6b7280)',
|
|
9138
|
+
fontSize: '0.875rem',
|
|
9139
|
+
...style,
|
|
9140
|
+
} }, text));
|
|
9141
|
+
}
|
|
9142
|
+
|
|
9131
9143
|
/**
|
|
9132
9144
|
* SuggestionsError – error message (primitive)
|
|
9133
9145
|
*/
|
|
@@ -9159,7 +9171,6 @@ function SuggestionsDropdownComposition({ showRecentSearches = true, showTrendin
|
|
|
9159
9171
|
React.createElement(SearchInput, { placeholder: placeholder }),
|
|
9160
9172
|
React.createElement(DropdownPanel, null,
|
|
9161
9173
|
React.createElement(SuggestionsError, null),
|
|
9162
|
-
React.createElement(SuggestionsLoading, null),
|
|
9163
9174
|
showRecentSearches ? React.createElement(RecentSearchesList, null) : null,
|
|
9164
9175
|
React.createElement(SuggestionList, null),
|
|
9165
9176
|
showTabs ? React.createElement(CategoriesTabs, null) : null,
|
|
@@ -9630,12 +9641,13 @@ function SectionError({ className, style, render }) {
|
|
|
9630
9641
|
/**
|
|
9631
9642
|
* SectionItemGrid – generic grid of items from SectionSearchProvider (primitive)
|
|
9632
9643
|
*/
|
|
9633
|
-
function SectionItemGrid({ columns = 4, maxItems = 12, className, style, getItemId = (i) => i.id ?? String(i?.objectID ?? ''), getItemTitle = (i) => i.title ?? i?.title ?? '', getItemImage = (i) => i.image ?? i?.image, getItemDescription = (i) => i.description ?? i?.description, getItemUrl = (i) => i.url ?? i?.url, renderItem, }) {
|
|
9644
|
+
function SectionItemGrid({ columns = 4, maxItems = 12, className, style, showLoadingState = false, getItemId = (i) => i.id ?? String(i?.objectID ?? ''), getItemTitle = (i) => i.title ?? i?.title ?? '', getItemImage = (i) => i.image ?? i?.image, getItemDescription = (i) => i.description ?? i?.description, getItemUrl = (i) => i.url ?? i?.url, renderItem, }) {
|
|
9634
9645
|
const { items, loading, error, trackClick } = useSectionSearchContext();
|
|
9635
|
-
if (loading)
|
|
9646
|
+
if (loading && items.length === 0 && showLoadingState)
|
|
9636
9647
|
return React.createElement(SectionLoading, { className: className, style: style });
|
|
9637
9648
|
if (error)
|
|
9638
9649
|
return React.createElement(SectionError, { className: className, style: style });
|
|
9650
|
+
// When loading with previous items, show them (no loading screen)
|
|
9639
9651
|
return (React.createElement(ItemGrid, { items: items, maxItems: maxItems, columns: columns, className: className, style: style, getItemId: getItemId, getItemTitle: getItemTitle, getItemImage: getItemImage, getItemDescription: getItemDescription, getItemUrl: getItemUrl, renderItem: renderItem, onItemClick: (item, index) => trackClick(item, index) }));
|
|
9640
9652
|
}
|
|
9641
9653
|
|
|
@@ -10372,7 +10384,7 @@ const RatingStars = ({ rating, count }) => {
|
|
|
10372
10384
|
")"))));
|
|
10373
10385
|
};
|
|
10374
10386
|
const AmazonDropdown = forwardRef(function AmazonDropdown(props, ref) {
|
|
10375
|
-
const { query, isOpen = true, loading = false, suggestions = [], products = [], categories = [], recentSearches = [], trendingSearches = [], filteredTabs = [], activeTab = 'all', suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, categoryFields = { id: 'id', label: 'label' }, productDisplay = {}, theme = {}, showDepartments = true, currentDepartment, departments = [], showPrime = false, width = '700px', maxHeight = '500px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onRecentClick, onRecentRemove, onRecentClearAll, onViewAll, onClose, header, footer, renderLoading, renderEmpty, } = props;
|
|
10387
|
+
const { query, isOpen = true, loading = false, suggestions = [], products = [], categories = [], recentSearches = [], trendingSearches = [], filteredTabs = [], activeTab = 'all', suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, categoryFields = { id: 'id', label: 'label' }, productDisplay = {}, theme = {}, showDepartments = true, currentDepartment, departments = [], showPrime = false, width = '700px', maxHeight = '500px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onRecentClick, onRecentRemove, onRecentClearAll, onViewAll, onClose, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
10376
10388
|
// Inject global responsive styles
|
|
10377
10389
|
useInjectResponsiveStyles();
|
|
10378
10390
|
// Responsive state
|
|
@@ -10469,7 +10481,7 @@ const AmazonDropdown = forwardRef(function AmazonDropdown(props, ref) {
|
|
|
10469
10481
|
}
|
|
10470
10482
|
`),
|
|
10471
10483
|
header,
|
|
10472
|
-
loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10484
|
+
(loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10473
10485
|
React.createElement("div", { style: styles.spinner }),
|
|
10474
10486
|
React.createElement("span", null, "Searching...")))) : (React.createElement(React.Fragment, null,
|
|
10475
10487
|
filteredTabs.length > 0 && (React.createElement("div", { style: {
|
|
@@ -10803,7 +10815,7 @@ const TrendingIcon$2 = () => (React.createElement("svg", { width: "20", height:
|
|
|
10803
10815
|
const ArrowIcon$1 = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", width: "20", height: "20" },
|
|
10804
10816
|
React.createElement("path", { d: "M9 5l-4 4 4 4", stroke: "currentColor", strokeWidth: "2", fill: "none", transform: "rotate(-90 12 12)" })));
|
|
10805
10817
|
const GoogleDropdown = forwardRef(function GoogleDropdown(props, ref) {
|
|
10806
|
-
const { query, isOpen = true, loading = false, suggestions = [], recentSearches = [], trendingSearches = [], suggestionFields = { query: 'query' }, theme = {}, showFeelingLucky = true, feelingLuckyText = "I'm Feeling Lucky", showRemoveRecent = true, showVoiceSearch = false, showTrendingIndicator = true, width = '100%', maxHeight = '400px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onRecentClick, onRecentRemove, onVoiceSearch, onFeelingLucky, onClose, onSearchSubmit, header, footer, renderLoading, renderEmpty, } = props;
|
|
10818
|
+
const { query, isOpen = true, loading = false, suggestions = [], recentSearches = [], trendingSearches = [], suggestionFields = { query: 'query' }, theme = {}, showFeelingLucky = true, feelingLuckyText = "I'm Feeling Lucky", showRemoveRecent = true, showVoiceSearch = false, showTrendingIndicator = true, width = '100%', maxHeight = '400px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onRecentClick, onRecentRemove, onVoiceSearch, onFeelingLucky, onClose, onSearchSubmit, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
10807
10819
|
// Inject global responsive styles
|
|
10808
10820
|
useInjectResponsiveStyles();
|
|
10809
10821
|
// Responsive state
|
|
@@ -10922,7 +10934,7 @@ const GoogleDropdown = forwardRef(function GoogleDropdown(props, ref) {
|
|
|
10922
10934
|
}
|
|
10923
10935
|
`),
|
|
10924
10936
|
header,
|
|
10925
|
-
loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10937
|
+
(loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10926
10938
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
10927
10939
|
React.createElement("ul", { style: styles.list },
|
|
10928
10940
|
showRecent && (React.createElement(React.Fragment, null,
|
|
@@ -11257,7 +11269,7 @@ const ImageIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill
|
|
|
11257
11269
|
React.createElement("polyline", { points: "21 15 16 10 5 21" })));
|
|
11258
11270
|
const PinterestDropdown = forwardRef(function PinterestDropdown(props, ref) {
|
|
11259
11271
|
const { query, isOpen = true, loading = false, suggestions = [], products = [], categories = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, categoryFields = { id: 'id', label: 'label' }, productDisplay = {}, theme = {}, showSaveButton = true, activeCategory: initialActiveCategory, activeTab, // From BaseDropdownProps
|
|
11260
|
-
showPriceOverlay = true, gridColumns = 4, width = '800px', maxHeight = '600px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onSaveProduct, onViewAll, onClose, header, footer, renderLoading, renderEmpty, } = props;
|
|
11272
|
+
showPriceOverlay = true, gridColumns = 4, width = '800px', maxHeight = '600px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onSaveProduct, onViewAll, onClose, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
11261
11273
|
// Inject global responsive styles
|
|
11262
11274
|
useInjectResponsiveStyles();
|
|
11263
11275
|
// Responsive state
|
|
@@ -11351,7 +11363,7 @@ const PinterestDropdown = forwardRef(function PinterestDropdown(props, ref) {
|
|
|
11351
11363
|
"(",
|
|
11352
11364
|
cat.count,
|
|
11353
11365
|
")"))))))))),
|
|
11354
|
-
React.createElement("div", { style: { ...styles.content, maxHeight } }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11366
|
+
React.createElement("div", { style: { ...styles.content, maxHeight } }, (loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11355
11367
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
11356
11368
|
processedSuggestions.length > 0 && (React.createElement("div", { style: styles.suggestionsRow }, processedSuggestions.slice(0, 8).map((s, idx) => (React.createElement("button", { key: s.id || idx, "data-index": idx, style: mergeStyles(styles.suggestionPill, activeIndex === idx ? styles.suggestionPillActive : undefined, hoveredSuggestion === idx && activeIndex !== idx ? styles.suggestionPillHover : undefined), onClick: () => onSuggestionSelect?.(s._raw, idx), onMouseEnter: () => {
|
|
11357
11369
|
setHoveredSuggestion(idx);
|
|
@@ -11695,7 +11707,7 @@ const ShoppingIcon = () => (React.createElement("svg", { viewBox: "0 0 20 20", f
|
|
|
11695
11707
|
const ClockIcon$1 = () => (React.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", width: "16", height: "16" },
|
|
11696
11708
|
React.createElement("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z", clipRule: "evenodd" })));
|
|
11697
11709
|
const SpotlightDropdown = forwardRef(function SpotlightDropdown(props, ref) {
|
|
11698
|
-
const { query, isOpen = true, loading = false, suggestions = [], products = [], recentSearches = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, productDisplay = {}, theme = {}, showPreview = true, asOverlay = true, placeholder = 'Search...', showShortcuts = true, actions = [], width = '680px', maxHeight = '500px', zIndex = 9999, className, style, classNames = {}, inputRef, onSuggestionSelect, onProductClick, onRecentClick, onClose, onSearchSubmit, header, footer, renderLoading, renderEmpty, } = props;
|
|
11710
|
+
const { query, isOpen = true, loading = false, suggestions = [], products = [], recentSearches = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, productDisplay = {}, theme = {}, showPreview = true, asOverlay = true, placeholder = 'Search...', showShortcuts = true, actions = [], width = '680px', maxHeight = '500px', zIndex = 9999, className, style, classNames = {}, inputRef, onSuggestionSelect, onProductClick, onRecentClick, onClose, onSearchSubmit, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
11699
11711
|
// Inject global responsive styles
|
|
11700
11712
|
useInjectResponsiveStyles();
|
|
11701
11713
|
// Responsive state
|
|
@@ -11849,7 +11861,7 @@ const SpotlightDropdown = forwardRef(function SpotlightDropdown(props, ref) {
|
|
|
11849
11861
|
React.createElement("span", { style: styles.kbd }, "K")))),
|
|
11850
11862
|
header,
|
|
11851
11863
|
React.createElement("div", { style: styles.content },
|
|
11852
|
-
React.createElement("div", { ref: listRef, style: { ...styles.resultsColumn, maxHeight } }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11864
|
+
React.createElement("div", { ref: listRef, style: { ...styles.resultsColumn, maxHeight } }, (loading && allItems.length === 0 && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11853
11865
|
React.createElement("div", { style: styles.spinner })))) : allItems.length === 0 ? (renderEmpty ? renderEmpty(query) : (React.createElement("div", { style: styles.empty },
|
|
11854
11866
|
"No results for \"",
|
|
11855
11867
|
query,
|
|
@@ -12248,7 +12260,7 @@ const SearchIcon$1 = () => (React.createElement("svg", { width: "18", height: "1
|
|
|
12248
12260
|
const ArrowIcon = () => (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "currentColor" },
|
|
12249
12261
|
React.createElement("path", { fillRule: "evenodd", d: "M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z", clipRule: "evenodd" })));
|
|
12250
12262
|
const ShopifyDropdown = forwardRef(function ShopifyDropdown(props, ref) {
|
|
12251
|
-
const { query, isOpen = true, loading = false, suggestions = [], products = [], categories = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, categoryFields = { id: 'id', label: 'label' }, productDisplay = {}, theme = {}, showHeroProduct = true, showCollections = true, showAddToCart = true, addToCartText = 'Quick Add', showComparePrice = true, width = '100%', maxHeight = '500px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onAddToCart, onViewAll, onClose, header, footer, renderLoading, renderEmpty, } = props;
|
|
12263
|
+
const { query, isOpen = true, loading = false, suggestions = [], products = [], categories = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, categoryFields = { id: 'id', label: 'label' }, productDisplay = {}, theme = {}, showHeroProduct = true, showCollections = true, showAddToCart = true, addToCartText = 'Quick Add', showComparePrice = true, width = '100%', maxHeight = '500px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onAddToCart, onViewAll, onClose, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
12252
12264
|
// Inject global responsive styles
|
|
12253
12265
|
useInjectResponsiveStyles();
|
|
12254
12266
|
// Responsive state
|
|
@@ -12320,7 +12332,7 @@ const ShopifyDropdown = forwardRef(function ShopifyDropdown(props, ref) {
|
|
|
12320
12332
|
}
|
|
12321
12333
|
`),
|
|
12322
12334
|
header,
|
|
12323
|
-
loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12335
|
+
(loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12324
12336
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement("div", { style: styles.layout },
|
|
12325
12337
|
React.createElement("div", { style: styles.leftPanel },
|
|
12326
12338
|
React.createElement("div", { style: styles.section },
|
|
@@ -12655,7 +12667,7 @@ const ChevronIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fi
|
|
|
12655
12667
|
const ArrowUpIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "20", height: "20" },
|
|
12656
12668
|
React.createElement("path", { d: "M7 17l5-5-5-5M13 17l5-5-5-5" })));
|
|
12657
12669
|
const MobileSheetDropdown = forwardRef(function MobileSheetDropdown(props, ref) {
|
|
12658
|
-
const { query, isOpen = true, loading = false, suggestions = [], products = [], recentSearches = [], trendingSearches = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, productDisplay = {}, theme = {}, showSearchInput = true, showCancel = true, cancelText = 'Cancel', showDragHandle = true, swipeToDismiss = true, footerButtonText = 'Search', showFooterButton = true, width = '100%', maxHeight = '85vh', zIndex = 9999, className, style, classNames = {}, inputRef, onSuggestionSelect, onProductClick, onRecentClick, onRecentClearAll, onSearchSubmit, onClose, header, footer, renderLoading, renderEmpty, } = props;
|
|
12670
|
+
const { query, isOpen = true, loading = false, suggestions = [], products = [], recentSearches = [], trendingSearches = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, productDisplay = {}, theme = {}, showSearchInput = true, showCancel = true, cancelText = 'Cancel', showDragHandle = true, swipeToDismiss = true, footerButtonText = 'Search', showFooterButton = true, width = '100%', maxHeight = '85vh', zIndex = 9999, className, style, classNames = {}, inputRef, onSuggestionSelect, onProductClick, onRecentClick, onRecentClearAll, onSearchSubmit, onClose, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
12659
12671
|
// Inject global responsive styles
|
|
12660
12672
|
useInjectResponsiveStyles();
|
|
12661
12673
|
const styles = useMemo(() => createStyles$2(), []);
|
|
@@ -12797,7 +12809,7 @@ const MobileSheetDropdown = forwardRef(function MobileSheetDropdown(props, ref)
|
|
|
12797
12809
|
}
|
|
12798
12810
|
}, style: styles.searchInput, autoFocus: true })),
|
|
12799
12811
|
showCancel && (React.createElement("button", { style: styles.cancelBtn, onClick: onClose }, cancelText)))))),
|
|
12800
|
-
React.createElement("div", { style: styles.content }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12812
|
+
React.createElement("div", { style: styles.content }, (loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12801
12813
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
12802
12814
|
showRecent && (React.createElement("div", { style: styles.section },
|
|
12803
12815
|
React.createElement("div", { style: styles.sectionHeader },
|
|
@@ -13033,7 +13045,7 @@ const createStyles$1 = () => ({
|
|
|
13033
13045
|
},
|
|
13034
13046
|
});
|
|
13035
13047
|
const MinimalDropdown = forwardRef(function MinimalDropdown(props, ref) {
|
|
13036
|
-
const { query, isOpen = true, loading = false, suggestions = [], products = [], recentSearches = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, productDisplay = {}, theme = {}, showIndices = false, showTypeLabels = false, showSectionDividers = true, width = '100%', maxHeight = '400px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onRecentClick, onClose, onSearchSubmit, header, footer, renderLoading, renderEmpty, } = props;
|
|
13048
|
+
const { query, isOpen = true, loading = false, suggestions = [], products = [], recentSearches = [], suggestionFields = { query: 'query' }, productFields = { id: 'id', title: 'title' }, productDisplay = {}, theme = {}, showIndices = false, showTypeLabels = false, showSectionDividers = true, width = '100%', maxHeight = '400px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onRecentClick, onClose, onSearchSubmit, header, footer, showLoadingState = false, renderLoading, renderEmpty, } = props;
|
|
13037
13049
|
// Inject global responsive styles
|
|
13038
13050
|
useInjectResponsiveStyles();
|
|
13039
13051
|
// Responsive state
|
|
@@ -13119,7 +13131,7 @@ const MinimalDropdown = forwardRef(function MinimalDropdown(props, ref) {
|
|
|
13119
13131
|
}
|
|
13120
13132
|
`),
|
|
13121
13133
|
header,
|
|
13122
|
-
React.createElement("div", { ref: listRef, style: { maxHeight, overflowY: 'auto' } }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading }, "Loading..."))) : allItems.length === 0 ? (renderEmpty ? renderEmpty(query) : (React.createElement("div", { style: styles.empty }, query ? `No results for "${query}"` : 'Start typing to search'))) : (React.createElement(React.Fragment, null,
|
|
13134
|
+
React.createElement("div", { ref: listRef, style: { maxHeight, overflowY: 'auto' } }, (loading && allItems.length === 0 && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading }, "Loading..."))) : allItems.length === 0 ? (renderEmpty ? renderEmpty(query) : (React.createElement("div", { style: styles.empty }, query ? `No results for "${query}"` : 'Start typing to search'))) : (React.createElement(React.Fragment, null,
|
|
13123
13135
|
showRecent && (React.createElement(React.Fragment, null,
|
|
13124
13136
|
showSectionDividers && (React.createElement("div", { style: styles.divider }, "Recent")),
|
|
13125
13137
|
recentQueries.map((q, idx) => {
|
|
@@ -13454,6 +13466,7 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
13454
13466
|
include_dropdown_product_list: includeDropdownProductList,
|
|
13455
13467
|
include_filtered_tabs: includeFilteredTabs,
|
|
13456
13468
|
include_categories: includeCategories,
|
|
13469
|
+
include_facets: true, // Enable facet-based suggestions
|
|
13457
13470
|
filtered_tabs: filteredTabs,
|
|
13458
13471
|
analytics_tags: analyticsTags,
|
|
13459
13472
|
returnFullResponse: true, // Required to get tabs and products
|
|
@@ -14135,7 +14148,7 @@ function getHitKey(hit, index) {
|
|
|
14135
14148
|
return hit.objectID;
|
|
14136
14149
|
return `suggestion-${hit.url}-${index}`;
|
|
14137
14150
|
}
|
|
14138
|
-
function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSelectionIntoViewRef, query, isLoading, error, translations = {}, sources: _sources = [], }) {
|
|
14151
|
+
function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSelectionIntoViewRef, query, isLoading, showLoadingState = false, error, translations = {}, sources: _sources = [], }) {
|
|
14139
14152
|
const listRef = useRef(null);
|
|
14140
14153
|
useEffect(() => {
|
|
14141
14154
|
if (!listRef.current || hits.length === 0)
|
|
@@ -14169,7 +14182,7 @@ function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSe
|
|
|
14169
14182
|
return (React.createElement("div", { className: "seekora-docsearch-empty" },
|
|
14170
14183
|
React.createElement("p", { className: "seekora-docsearch-empty-text" }, translations.searchPlaceholder || 'Type to start searching...')));
|
|
14171
14184
|
}
|
|
14172
|
-
if (isLoading && hits.length === 0) {
|
|
14185
|
+
if (isLoading && hits.length === 0 && showLoadingState) {
|
|
14173
14186
|
return (React.createElement("div", { className: "seekora-docsearch-loading" },
|
|
14174
14187
|
React.createElement("div", { className: "seekora-docsearch-loading-spinner" },
|
|
14175
14188
|
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", "aria-hidden": "true" },
|
|
@@ -14177,6 +14190,10 @@ function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSe
|
|
|
14177
14190
|
React.createElement("animateTransform", { attributeName: "transform", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" })))),
|
|
14178
14191
|
React.createElement("p", { className: "seekora-docsearch-loading-text" }, translations.loadingText || 'Searching...')));
|
|
14179
14192
|
}
|
|
14193
|
+
if (isLoading && hits.length === 0) {
|
|
14194
|
+
return React.createElement("div", { className: "seekora-docsearch-empty" });
|
|
14195
|
+
}
|
|
14196
|
+
// When loading with previous hits, fall through and show them (no loading screen)
|
|
14180
14197
|
if (error) {
|
|
14181
14198
|
return (React.createElement("div", { className: "seekora-docsearch-error" },
|
|
14182
14199
|
React.createElement("p", { className: "seekora-docsearch-error-text" }, translations.errorText || error)));
|