@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.js
CHANGED
|
@@ -1513,7 +1513,7 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
|
|
|
1513
1513
|
*
|
|
1514
1514
|
* Interactive search input component with query suggestions support
|
|
1515
1515
|
*/
|
|
1516
|
-
const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounceMs = 300, minQueryLength = 2, maxSuggestions = 10, onSearch, onQueryChange, onSuggestionSelect, onSearchStateChange, searchOptions, className, style, theme: customTheme, renderSuggestion, renderLoading, }) => {
|
|
1516
|
+
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, }) => {
|
|
1517
1517
|
const { client, theme, enableAnalytics, autoTrackSearch } = useSearchContext();
|
|
1518
1518
|
const { query, setQuery, search: triggerSearch, results, loading: searchLoading, error: searchError } = useSearchState();
|
|
1519
1519
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
@@ -1646,13 +1646,9 @@ const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounce
|
|
|
1646
1646
|
const defaultRenderLoading = () => (React.createElement("div", { style: { padding: theme.spacing.medium, textAlign: 'center' } }, "Loading suggestions..."));
|
|
1647
1647
|
const searchBarTheme = customTheme || {};
|
|
1648
1648
|
const isLoading = suggestionsLoading || searchLoading;
|
|
1649
|
-
//
|
|
1650
|
-
// 1. Input is focused
|
|
1651
|
-
// 2. Suggestions are enabled
|
|
1652
|
-
// 3. Query is long enough
|
|
1653
|
-
// 4. AND (we have suggestions to show OR we're currently loading suggestions)
|
|
1649
|
+
// Show list when we have suggestions (including previous while loading) or when loading and showLoadingState
|
|
1654
1650
|
const hasSuggestions = displayedSuggestions.length > 0;
|
|
1655
|
-
const showSuggestionsList = isFocused && showSuggestions && query.length >= minQueryLength && (hasSuggestions || isLoading);
|
|
1651
|
+
const showSuggestionsList = isFocused && showSuggestions && query.length >= minQueryLength && (hasSuggestions || (isLoading && showLoadingState));
|
|
1656
1652
|
// Get processing time from results
|
|
1657
1653
|
const res = results;
|
|
1658
1654
|
const processingTime = res?.processingTimeMS
|
|
@@ -1703,8 +1699,8 @@ const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, debounce
|
|
|
1703
1699
|
overflowY: 'auto',
|
|
1704
1700
|
zIndex: 1000,
|
|
1705
1701
|
} },
|
|
1706
|
-
isLoading && (renderLoading ? renderLoading() : defaultRenderLoading()),
|
|
1707
|
-
|
|
1702
|
+
isLoading && displayedSuggestions.length === 0 && showLoadingState && (renderLoading ? renderLoading() : defaultRenderLoading()),
|
|
1703
|
+
displayedSuggestions.length > 0 && (React.createElement(React.Fragment, null, displayedSuggestions.map((suggestion, index) => {
|
|
1708
1704
|
const isSelected = index === selectedIndex;
|
|
1709
1705
|
const renderFn = renderSuggestion || defaultRenderSuggestion;
|
|
1710
1706
|
return (React.createElement("div", { key: index, className: clsx(searchBarTheme.suggestionItem, isSelected && searchBarTheme.suggestionItemActive), onClick: () => handleSuggestionSelect(suggestion.query), onMouseEnter: () => setSelectedIndex(index), style: {
|
|
@@ -1746,7 +1742,7 @@ const formatPrice$1 = (value, currency = '₹') => {
|
|
|
1746
1742
|
}
|
|
1747
1743
|
return String(value);
|
|
1748
1744
|
};
|
|
1749
|
-
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, }) => {
|
|
1745
|
+
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, }) => {
|
|
1750
1746
|
const { theme, client, enableAnalytics } = useSearchContext();
|
|
1751
1747
|
const { results: stateResults, loading: stateLoading, error: stateError, currentPage, itemsPerPage: stateItemsPerPage } = useSearchState();
|
|
1752
1748
|
const searchResultsTheme = customTheme || {};
|
|
@@ -2113,10 +2109,12 @@ const SearchResults = ({ results: resultsProp, loading: loadingProp, error: erro
|
|
|
2113
2109
|
hasError: !!error,
|
|
2114
2110
|
isLoading: loading,
|
|
2115
2111
|
});
|
|
2116
|
-
if (loading)
|
|
2112
|
+
// When loading with no previous results, show loading only if showLoadingState (default: show previous results, no loading screen)
|
|
2113
|
+
if (loading && resultItems.length === 0 && showLoadingState) {
|
|
2117
2114
|
log.verbose('SearchResults: Rendering loading state');
|
|
2118
2115
|
return (React.createElement("div", { className: clsx(searchResultsTheme.container, className), style: style }, renderLoading ? renderLoading() : defaultRenderLoading()));
|
|
2119
2116
|
}
|
|
2117
|
+
// When loading with previous results, fall through and render them (no loading screen)
|
|
2120
2118
|
if (error) {
|
|
2121
2119
|
log.error('SearchResults: Rendering error state', {
|
|
2122
2120
|
error: error.message,
|
|
@@ -3088,7 +3086,7 @@ const HitsPerPage = ({ items, onHitsPerPageChange, renderSelect, className, styl
|
|
|
3088
3086
|
* Displays search results with infinite scroll or "Show More" button
|
|
3089
3087
|
* Accumulates results as user loads more pages
|
|
3090
3088
|
*/
|
|
3091
|
-
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, }) => {
|
|
3089
|
+
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, }) => {
|
|
3092
3090
|
const { theme, stateManager } = useSearchContext();
|
|
3093
3091
|
const { results, loading, currentPage, setPage } = useSearchState();
|
|
3094
3092
|
const infiniteHitsTheme = customTheme || {};
|
|
@@ -3243,10 +3241,13 @@ const InfiniteHits = ({ renderHit, renderEmpty, renderLoading, renderShowMore, s
|
|
|
3243
3241
|
cursor: isLastPage || isLoadingMore ? 'not-allowed' : 'pointer',
|
|
3244
3242
|
transition: theme.transitions?.fast || '150ms ease-in-out',
|
|
3245
3243
|
} }, isLoadingMore ? loadingLabel : isLastPage ? 'No more results' : showMoreLabel));
|
|
3246
|
-
// Initial loading state
|
|
3247
|
-
if (loading && accumulatedHits.length === 0) {
|
|
3244
|
+
// Initial loading state (only when showInitialLoading: default no loading screen)
|
|
3245
|
+
if (loading && accumulatedHits.length === 0 && showInitialLoading) {
|
|
3248
3246
|
return (React.createElement("div", { className: clsx(infiniteHitsTheme.root, className), style: style }, renderLoading ? renderLoading() : defaultRenderLoading()));
|
|
3249
3247
|
}
|
|
3248
|
+
if (loading && accumulatedHits.length === 0) {
|
|
3249
|
+
return React.createElement("div", { className: clsx(infiniteHitsTheme.root, className), style: style });
|
|
3250
|
+
}
|
|
3250
3251
|
// Empty state
|
|
3251
3252
|
if (!loading && accumulatedHits.length === 0) {
|
|
3252
3253
|
return (React.createElement("div", { className: clsx(infiniteHitsTheme.root, className), style: style }, renderEmpty ? renderEmpty() : defaultRenderEmpty()));
|
|
@@ -4128,36 +4129,40 @@ const MobileFiltersButton = ({ onClick, text = 'Filters', showCount = true, clas
|
|
|
4128
4129
|
* - FrequentlyBoughtTogether: Bundle recommendations
|
|
4129
4130
|
* - RecentlyViewed: User's recently viewed items
|
|
4130
4131
|
*/
|
|
4131
|
-
const RelatedProducts = ({ productId, items: itemsProp, loading: loadingProp = false, title = 'Related Products', maxItems = 6, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4132
|
+
const RelatedProducts = ({ productId, items: itemsProp, loading: loadingProp = false, showLoadingState = false, title = 'Related Products', maxItems = 6, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4132
4133
|
const { theme } = useSearchContext();
|
|
4133
4134
|
const recommendationTheme = customTheme || {};
|
|
4134
4135
|
// If items are provided, use them directly
|
|
4135
4136
|
const items = itemsProp?.slice(0, maxItems) || [];
|
|
4136
4137
|
const loading = loadingProp;
|
|
4137
|
-
if (loading) {
|
|
4138
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
4138
4139
|
return (React.createElement("div", { className: clsx(recommendationTheme.root, className), style: style },
|
|
4139
4140
|
React.createElement("div", { className: recommendationTheme.loading, style: getLoadingStyle(theme) }, "Loading related products...")));
|
|
4140
4141
|
}
|
|
4142
|
+
if (loading && items.length === 0)
|
|
4143
|
+
return null;
|
|
4141
4144
|
if (items.length === 0) {
|
|
4142
4145
|
return null;
|
|
4143
4146
|
}
|
|
4144
4147
|
return (React.createElement(RecommendationSection, { title: title, items: items, renderItem: renderItem, onItemClick: onItemClick, className: className, style: style, theme: customTheme, layout: layout, currencySymbol: currencySymbol }));
|
|
4145
4148
|
};
|
|
4146
|
-
const TrendingItems = ({ items: itemsProp, loading: loadingProp = false, title = 'Trending Now', maxItems = 8, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4149
|
+
const TrendingItems = ({ items: itemsProp, loading: loadingProp = false, showLoadingState = false, title = 'Trending Now', maxItems = 8, renderItem, onItemClick, className, style, theme: customTheme, layout = 'horizontal', currencySymbol = '$', }) => {
|
|
4147
4150
|
const { theme } = useSearchContext();
|
|
4148
4151
|
const recommendationTheme = customTheme || {};
|
|
4149
4152
|
const items = itemsProp?.slice(0, maxItems) || [];
|
|
4150
4153
|
const loading = loadingProp;
|
|
4151
|
-
if (loading) {
|
|
4154
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
4152
4155
|
return (React.createElement("div", { className: clsx(recommendationTheme.root, className), style: style },
|
|
4153
4156
|
React.createElement("div", { className: recommendationTheme.loading, style: getLoadingStyle(theme) }, "Loading trending items...")));
|
|
4154
4157
|
}
|
|
4158
|
+
if (loading && items.length === 0)
|
|
4159
|
+
return null;
|
|
4155
4160
|
if (items.length === 0) {
|
|
4156
4161
|
return null;
|
|
4157
4162
|
}
|
|
4158
4163
|
return (React.createElement(RecommendationSection, { title: title, items: items, renderItem: renderItem, onItemClick: onItemClick, className: className, style: style, theme: customTheme, layout: layout, currencySymbol: currencySymbol }));
|
|
4159
4164
|
};
|
|
4160
|
-
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, }) => {
|
|
4165
|
+
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, }) => {
|
|
4161
4166
|
const { theme } = useSearchContext();
|
|
4162
4167
|
const recommendationTheme = customTheme || {};
|
|
4163
4168
|
const items = itemsProp?.slice(0, maxItems) || [];
|
|
@@ -4170,10 +4175,12 @@ const FrequentlyBoughtTogether = ({ productId, items: itemsProp, loading: loadin
|
|
|
4170
4175
|
return sum + price;
|
|
4171
4176
|
}, 0);
|
|
4172
4177
|
}, [items]);
|
|
4173
|
-
if (loading) {
|
|
4178
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
4174
4179
|
return (React.createElement("div", { className: clsx(recommendationTheme.root, className), style: style },
|
|
4175
4180
|
React.createElement("div", { className: recommendationTheme.loading, style: getLoadingStyle(theme) }, "Loading recommendations...")));
|
|
4176
4181
|
}
|
|
4182
|
+
if (loading && items.length === 0)
|
|
4183
|
+
return null;
|
|
4177
4184
|
if (items.length === 0) {
|
|
4178
4185
|
return null;
|
|
4179
4186
|
}
|
|
@@ -4392,7 +4399,7 @@ function getLoadingStyle(theme) {
|
|
|
4392
4399
|
*
|
|
4393
4400
|
* Standalone component for displaying query suggestions
|
|
4394
4401
|
*/
|
|
4395
|
-
const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, minQueryLength = 2, onSuggestionClick, renderSuggestion, renderLoading, renderEmpty, showTitle = false, title = 'Suggestions', className, style, theme: customTheme, }) => {
|
|
4402
|
+
const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, minQueryLength = 2, onSuggestionClick, renderSuggestion, showLoadingState = false, renderLoading, renderEmpty, showTitle = false, title = 'Suggestions', className, style, theme: customTheme, }) => {
|
|
4396
4403
|
const { client, theme } = useSearchContext();
|
|
4397
4404
|
const [selectedIndex, setSelectedIndex] = React.useState(-1);
|
|
4398
4405
|
const { suggestions, loading, error } = useQuerySuggestions({
|
|
@@ -4429,7 +4436,8 @@ const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, m
|
|
|
4429
4436
|
if (query.length < minQueryLength) {
|
|
4430
4437
|
return null;
|
|
4431
4438
|
}
|
|
4432
|
-
if (loading)
|
|
4439
|
+
// When loading with no previous results, show loading only if showLoadingState (default: show previous results, no loading screen)
|
|
4440
|
+
if (loading && displayedSuggestions.length === 0 && showLoadingState) {
|
|
4433
4441
|
return (React.createElement("div", { className: clsx(suggestionsTheme.container, className), style: style },
|
|
4434
4442
|
showTitle && (React.createElement("div", { className: suggestionsTheme.title, style: {
|
|
4435
4443
|
fontSize: theme.typography.fontSize.large,
|
|
@@ -4439,7 +4447,7 @@ const QuerySuggestions = ({ query = '', maxSuggestions = 10, debounceMs = 300, m
|
|
|
4439
4447
|
} }, title)),
|
|
4440
4448
|
renderLoading ? renderLoading() : defaultRenderLoading()));
|
|
4441
4449
|
}
|
|
4442
|
-
if (error || displayedSuggestions.length === 0) {
|
|
4450
|
+
if (error || (!loading && displayedSuggestions.length === 0)) {
|
|
4443
4451
|
return (React.createElement("div", { className: clsx(suggestionsTheme.container, className), style: style },
|
|
4444
4452
|
showTitle && (React.createElement("div", { className: suggestionsTheme.title, style: {
|
|
4445
4453
|
fontSize: theme.typography.fontSize.large,
|
|
@@ -4567,7 +4575,8 @@ function transformFilteredTab(raw) {
|
|
|
4567
4575
|
// Main Hook
|
|
4568
4576
|
// ============================================================================
|
|
4569
4577
|
function useQuerySuggestionsEnhanced(options) {
|
|
4570
|
-
const { client, query, enabled = true, debounceMs = 200, maxSuggestions = 10, minQueryLength = 1, includeDropdownRecommendations = false, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, includeFacets =
|
|
4578
|
+
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
|
|
4579
|
+
maxCategories = 3, maxFacets = 5, filteredTabs, minPopularity, timeRange, disableTypoTolerance, analyticsTags, enableRecentSearches = true, maxRecentSearches = MAX_RECENT_SEARCHES_DEFAULT, recentSearchesKey = RECENT_SEARCHES_DEFAULT_KEY, onSuggestionsLoaded, onError, } = options;
|
|
4571
4580
|
// State
|
|
4572
4581
|
const [suggestions, setSuggestions] = React.useState([]);
|
|
4573
4582
|
const [loading, setLoading] = React.useState(false);
|
|
@@ -5023,7 +5032,7 @@ const LoadingSpinner = ({ style }) => (React.createElement("svg", { style: { ani
|
|
|
5023
5032
|
// Component
|
|
5024
5033
|
// ============================================================================
|
|
5025
5034
|
const QuerySuggestionsDropdown = React.forwardRef(function QuerySuggestionsDropdown(props, ref) {
|
|
5026
|
-
const { query, isOpen = true, maxSuggestions = 8, minQueryLength = 1, debounceMs = 200, showRecentSearches = true, maxRecentSearches = 5, showCounts = true, showLoading =
|
|
5035
|
+
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;
|
|
5027
5036
|
const { client, theme } = useSearchContext();
|
|
5028
5037
|
const containerRef = React.useRef(null);
|
|
5029
5038
|
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
@@ -5208,7 +5217,7 @@ const QuerySuggestionsDropdown = React.forwardRef(function QuerySuggestionsDropd
|
|
|
5208
5217
|
loading && showLoading && (React.createElement("div", { className: classNames.loadingState, style: defaultStyles$1.loadingState }, renderLoading ? renderLoading() : (React.createElement(React.Fragment, null,
|
|
5209
5218
|
React.createElement(LoadingSpinner, null),
|
|
5210
5219
|
React.createElement("span", null, "Searching..."))))),
|
|
5211
|
-
|
|
5220
|
+
showRecent && (React.createElement("div", { className: clsx('seekora-suggestions-section', classNames.section, classNames.recentSearches) },
|
|
5212
5221
|
React.createElement("div", { className: classNames.sectionTitle, style: defaultStyles$1.sectionTitle }, "Recent Searches"),
|
|
5213
5222
|
recentSearches.slice(0, maxRecentSearches).map((search, index) => {
|
|
5214
5223
|
const isActive = activeIndex === index;
|
|
@@ -5216,8 +5225,8 @@ const QuerySuggestionsDropdown = React.forwardRef(function QuerySuggestionsDropd
|
|
|
5216
5225
|
onRecentSearchClick?.(search);
|
|
5217
5226
|
}, onMouseEnter: () => setActiveIndex(index) }, renderRecentSearchItem(search, index, isActive)));
|
|
5218
5227
|
}))),
|
|
5219
|
-
|
|
5220
|
-
|
|
5228
|
+
showRecent && showSuggestions && (React.createElement("div", { style: defaultStyles$1.divider })),
|
|
5229
|
+
showSuggestions && (React.createElement("div", { className: clsx('seekora-suggestions-section', classNames.section, classNames.suggestionsList) },
|
|
5221
5230
|
query.length > 0 && (React.createElement("div", { className: classNames.sectionTitle, style: defaultStyles$1.sectionTitle }, "Suggestions")),
|
|
5222
5231
|
suggestions.map((suggestion, index) => {
|
|
5223
5232
|
const itemIndex = showRecent ? recentSearches.length + index : index;
|
|
@@ -5479,7 +5488,7 @@ const CloseIcon = () => (React.createElement("svg", { viewBox: "0 0 20 20", fill
|
|
|
5479
5488
|
// Component
|
|
5480
5489
|
// ============================================================================
|
|
5481
5490
|
const RichQuerySuggestions = React.forwardRef(function RichQuerySuggestions(props, ref) {
|
|
5482
|
-
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;
|
|
5491
|
+
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;
|
|
5483
5492
|
const { client } = useSearchContext();
|
|
5484
5493
|
const containerRef = React.useRef(null);
|
|
5485
5494
|
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
@@ -5698,8 +5707,7 @@ const RichQuerySuggestions = React.forwardRef(function RichQuerySuggestions(prop
|
|
|
5698
5707
|
} },
|
|
5699
5708
|
header && React.createElement("div", { style: styles$2.header }, header),
|
|
5700
5709
|
React.createElement("div", { style: { ...styles$2.content, maxHeight } },
|
|
5701
|
-
loading && (React.createElement("div", { style: styles$2.loadingOverlay },
|
|
5702
|
-
React.createElement("span", null, "Loading..."))),
|
|
5710
|
+
loading && showLoadingOverlay && (React.createElement("div", { style: styles$2.loadingOverlay }, renderLoading ? renderLoading() : React.createElement("span", null, "Loading..."))),
|
|
5703
5711
|
enabledSections.map((section, index) => {
|
|
5704
5712
|
let content = null;
|
|
5705
5713
|
switch (section.id) {
|
|
@@ -7184,21 +7192,6 @@ function SuggestionItem({ suggestion, index, isActive, onSelect, className, styl
|
|
|
7184
7192
|
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));
|
|
7185
7193
|
}
|
|
7186
7194
|
|
|
7187
|
-
/**
|
|
7188
|
-
* SuggestionsLoading – loading indicator (primitive)
|
|
7189
|
-
*/
|
|
7190
|
-
function SuggestionsLoading({ className, style, text = 'Loading...' }) {
|
|
7191
|
-
const { loading } = useSuggestionsContext();
|
|
7192
|
-
if (!loading)
|
|
7193
|
-
return null;
|
|
7194
|
-
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: {
|
|
7195
|
-
padding: 16,
|
|
7196
|
-
color: 'var(--seekora-text-secondary, #6b7280)',
|
|
7197
|
-
fontSize: '0.875rem',
|
|
7198
|
-
...style,
|
|
7199
|
-
} }, text));
|
|
7200
|
-
}
|
|
7201
|
-
|
|
7202
7195
|
/**
|
|
7203
7196
|
* SuggestionList – container for text suggestions (primitive)
|
|
7204
7197
|
*
|
|
@@ -7210,15 +7203,19 @@ const listStyle = {
|
|
|
7210
7203
|
margin: 0,
|
|
7211
7204
|
padding: '4px 0',
|
|
7212
7205
|
};
|
|
7213
|
-
function SuggestionList({ maxItems = 10, className, style, listClassName, enableHighlightMarkup = true, highlightMarkupOptions, renderItem, }) {
|
|
7206
|
+
function SuggestionList({ maxItems = 10, className, style, listClassName, showLoadingState = false, renderLoading, enableHighlightMarkup = true, highlightMarkupOptions, renderItem, }) {
|
|
7214
7207
|
const { suggestions, activeIndex, loading, selectSuggestion, getAllNavigableItems, } = useSuggestionsContext();
|
|
7215
7208
|
const items = suggestions.slice(0, maxItems);
|
|
7216
7209
|
const navigableItems = getAllNavigableItems();
|
|
7217
7210
|
const suggestionStartIndex = navigableItems.findIndex((n) => n.type === 'suggestion');
|
|
7218
7211
|
const activeIsInSuggestions = suggestionStartIndex >= 0 && activeIndex >= suggestionStartIndex && activeIndex < suggestionStartIndex + items.length;
|
|
7219
|
-
if (loading)
|
|
7220
|
-
|
|
7212
|
+
// When loading with no previous results, show loading only if showLoadingState (default: don't show loading screen)
|
|
7213
|
+
if (loading && items.length === 0 && showLoadingState) {
|
|
7214
|
+
if (renderLoading)
|
|
7215
|
+
return React.createElement(React.Fragment, null, renderLoading());
|
|
7216
|
+
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: { padding: 16, color: 'var(--seekora-text-secondary, #6b7280)', fontSize: '0.875rem', ...style } }, "Loading..."));
|
|
7221
7217
|
}
|
|
7218
|
+
// When loading with previous results, show previous results (no loading UI)
|
|
7222
7219
|
if (items.length === 0)
|
|
7223
7220
|
return null;
|
|
7224
7221
|
return (React.createElement("div", { className: clsx('seekora-suggestions-list', className), style: style },
|
|
@@ -9130,6 +9127,21 @@ function TrendingList({ title = 'Trending', maxItems = 8, className, style, list
|
|
|
9130
9127
|
}))));
|
|
9131
9128
|
}
|
|
9132
9129
|
|
|
9130
|
+
/**
|
|
9131
|
+
* SuggestionsLoading – loading indicator (primitive)
|
|
9132
|
+
*/
|
|
9133
|
+
function SuggestionsLoading({ className, style, text = 'Loading...' }) {
|
|
9134
|
+
const { loading } = useSuggestionsContext();
|
|
9135
|
+
if (!loading)
|
|
9136
|
+
return null;
|
|
9137
|
+
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: {
|
|
9138
|
+
padding: 16,
|
|
9139
|
+
color: 'var(--seekora-text-secondary, #6b7280)',
|
|
9140
|
+
fontSize: '0.875rem',
|
|
9141
|
+
...style,
|
|
9142
|
+
} }, text));
|
|
9143
|
+
}
|
|
9144
|
+
|
|
9133
9145
|
/**
|
|
9134
9146
|
* SuggestionsError – error message (primitive)
|
|
9135
9147
|
*/
|
|
@@ -9161,7 +9173,6 @@ function SuggestionsDropdownComposition({ showRecentSearches = true, showTrendin
|
|
|
9161
9173
|
React.createElement(SearchInput, { placeholder: placeholder }),
|
|
9162
9174
|
React.createElement(DropdownPanel, null,
|
|
9163
9175
|
React.createElement(SuggestionsError, null),
|
|
9164
|
-
React.createElement(SuggestionsLoading, null),
|
|
9165
9176
|
showRecentSearches ? React.createElement(RecentSearchesList, null) : null,
|
|
9166
9177
|
React.createElement(SuggestionList, null),
|
|
9167
9178
|
showTabs ? React.createElement(CategoriesTabs, null) : null,
|
|
@@ -9632,12 +9643,13 @@ function SectionError({ className, style, render }) {
|
|
|
9632
9643
|
/**
|
|
9633
9644
|
* SectionItemGrid – generic grid of items from SectionSearchProvider (primitive)
|
|
9634
9645
|
*/
|
|
9635
|
-
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, }) {
|
|
9646
|
+
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, }) {
|
|
9636
9647
|
const { items, loading, error, trackClick } = useSectionSearchContext();
|
|
9637
|
-
if (loading)
|
|
9648
|
+
if (loading && items.length === 0 && showLoadingState)
|
|
9638
9649
|
return React.createElement(SectionLoading, { className: className, style: style });
|
|
9639
9650
|
if (error)
|
|
9640
9651
|
return React.createElement(SectionError, { className: className, style: style });
|
|
9652
|
+
// When loading with previous items, show them (no loading screen)
|
|
9641
9653
|
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) }));
|
|
9642
9654
|
}
|
|
9643
9655
|
|
|
@@ -10374,7 +10386,7 @@ const RatingStars = ({ rating, count }) => {
|
|
|
10374
10386
|
")"))));
|
|
10375
10387
|
};
|
|
10376
10388
|
const AmazonDropdown = React.forwardRef(function AmazonDropdown(props, ref) {
|
|
10377
|
-
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;
|
|
10389
|
+
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;
|
|
10378
10390
|
// Inject global responsive styles
|
|
10379
10391
|
useInjectResponsiveStyles();
|
|
10380
10392
|
// Responsive state
|
|
@@ -10471,7 +10483,7 @@ const AmazonDropdown = React.forwardRef(function AmazonDropdown(props, ref) {
|
|
|
10471
10483
|
}
|
|
10472
10484
|
`),
|
|
10473
10485
|
header,
|
|
10474
|
-
loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10486
|
+
(loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10475
10487
|
React.createElement("div", { style: styles.spinner }),
|
|
10476
10488
|
React.createElement("span", null, "Searching...")))) : (React.createElement(React.Fragment, null,
|
|
10477
10489
|
filteredTabs.length > 0 && (React.createElement("div", { style: {
|
|
@@ -10805,7 +10817,7 @@ const TrendingIcon$2 = () => (React.createElement("svg", { width: "20", height:
|
|
|
10805
10817
|
const ArrowIcon$1 = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", width: "20", height: "20" },
|
|
10806
10818
|
React.createElement("path", { d: "M9 5l-4 4 4 4", stroke: "currentColor", strokeWidth: "2", fill: "none", transform: "rotate(-90 12 12)" })));
|
|
10807
10819
|
const GoogleDropdown = React.forwardRef(function GoogleDropdown(props, ref) {
|
|
10808
|
-
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;
|
|
10820
|
+
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;
|
|
10809
10821
|
// Inject global responsive styles
|
|
10810
10822
|
useInjectResponsiveStyles();
|
|
10811
10823
|
// Responsive state
|
|
@@ -10924,7 +10936,7 @@ const GoogleDropdown = React.forwardRef(function GoogleDropdown(props, ref) {
|
|
|
10924
10936
|
}
|
|
10925
10937
|
`),
|
|
10926
10938
|
header,
|
|
10927
|
-
loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10939
|
+
(loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
10928
10940
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
10929
10941
|
React.createElement("ul", { style: styles.list },
|
|
10930
10942
|
showRecent && (React.createElement(React.Fragment, null,
|
|
@@ -11259,7 +11271,7 @@ const ImageIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill
|
|
|
11259
11271
|
React.createElement("polyline", { points: "21 15 16 10 5 21" })));
|
|
11260
11272
|
const PinterestDropdown = React.forwardRef(function PinterestDropdown(props, ref) {
|
|
11261
11273
|
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
|
|
11262
|
-
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;
|
|
11274
|
+
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;
|
|
11263
11275
|
// Inject global responsive styles
|
|
11264
11276
|
useInjectResponsiveStyles();
|
|
11265
11277
|
// Responsive state
|
|
@@ -11353,7 +11365,7 @@ const PinterestDropdown = React.forwardRef(function PinterestDropdown(props, ref
|
|
|
11353
11365
|
"(",
|
|
11354
11366
|
cat.count,
|
|
11355
11367
|
")"))))))))),
|
|
11356
|
-
React.createElement("div", { style: { ...styles.content, maxHeight } }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11368
|
+
React.createElement("div", { style: { ...styles.content, maxHeight } }, (loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11357
11369
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
11358
11370
|
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: () => {
|
|
11359
11371
|
setHoveredSuggestion(idx);
|
|
@@ -11697,7 +11709,7 @@ const ShoppingIcon = () => (React.createElement("svg", { viewBox: "0 0 20 20", f
|
|
|
11697
11709
|
const ClockIcon$1 = () => (React.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", width: "16", height: "16" },
|
|
11698
11710
|
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" })));
|
|
11699
11711
|
const SpotlightDropdown = React.forwardRef(function SpotlightDropdown(props, ref) {
|
|
11700
|
-
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;
|
|
11712
|
+
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;
|
|
11701
11713
|
// Inject global responsive styles
|
|
11702
11714
|
useInjectResponsiveStyles();
|
|
11703
11715
|
// Responsive state
|
|
@@ -11851,7 +11863,7 @@ const SpotlightDropdown = React.forwardRef(function SpotlightDropdown(props, ref
|
|
|
11851
11863
|
React.createElement("span", { style: styles.kbd }, "K")))),
|
|
11852
11864
|
header,
|
|
11853
11865
|
React.createElement("div", { style: styles.content },
|
|
11854
|
-
React.createElement("div", { ref: listRef, style: { ...styles.resultsColumn, maxHeight } }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11866
|
+
React.createElement("div", { ref: listRef, style: { ...styles.resultsColumn, maxHeight } }, (loading && allItems.length === 0 && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
11855
11867
|
React.createElement("div", { style: styles.spinner })))) : allItems.length === 0 ? (renderEmpty ? renderEmpty(query) : (React.createElement("div", { style: styles.empty },
|
|
11856
11868
|
"No results for \"",
|
|
11857
11869
|
query,
|
|
@@ -12250,7 +12262,7 @@ const SearchIcon$1 = () => (React.createElement("svg", { width: "18", height: "1
|
|
|
12250
12262
|
const ArrowIcon = () => (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "currentColor" },
|
|
12251
12263
|
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" })));
|
|
12252
12264
|
const ShopifyDropdown = React.forwardRef(function ShopifyDropdown(props, ref) {
|
|
12253
|
-
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;
|
|
12265
|
+
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;
|
|
12254
12266
|
// Inject global responsive styles
|
|
12255
12267
|
useInjectResponsiveStyles();
|
|
12256
12268
|
// Responsive state
|
|
@@ -12322,7 +12334,7 @@ const ShopifyDropdown = React.forwardRef(function ShopifyDropdown(props, ref) {
|
|
|
12322
12334
|
}
|
|
12323
12335
|
`),
|
|
12324
12336
|
header,
|
|
12325
|
-
loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12337
|
+
(loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12326
12338
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement("div", { style: styles.layout },
|
|
12327
12339
|
React.createElement("div", { style: styles.leftPanel },
|
|
12328
12340
|
React.createElement("div", { style: styles.section },
|
|
@@ -12657,7 +12669,7 @@ const ChevronIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fi
|
|
|
12657
12669
|
const ArrowUpIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "20", height: "20" },
|
|
12658
12670
|
React.createElement("path", { d: "M7 17l5-5-5-5M13 17l5-5-5-5" })));
|
|
12659
12671
|
const MobileSheetDropdown = React.forwardRef(function MobileSheetDropdown(props, ref) {
|
|
12660
|
-
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;
|
|
12672
|
+
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;
|
|
12661
12673
|
// Inject global responsive styles
|
|
12662
12674
|
useInjectResponsiveStyles();
|
|
12663
12675
|
const styles = React.useMemo(() => createStyles$2(), []);
|
|
@@ -12799,7 +12811,7 @@ const MobileSheetDropdown = React.forwardRef(function MobileSheetDropdown(props,
|
|
|
12799
12811
|
}
|
|
12800
12812
|
}, style: styles.searchInput, autoFocus: true })),
|
|
12801
12813
|
showCancel && (React.createElement("button", { style: styles.cancelBtn, onClick: onClose }, cancelText)))))),
|
|
12802
|
-
React.createElement("div", { style: styles.content }, loading ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12814
|
+
React.createElement("div", { style: styles.content }, (loading && showLoadingState) ? (renderLoading ? renderLoading() : (React.createElement("div", { style: styles.loading },
|
|
12803
12815
|
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
12804
12816
|
showRecent && (React.createElement("div", { style: styles.section },
|
|
12805
12817
|
React.createElement("div", { style: styles.sectionHeader },
|
|
@@ -13035,7 +13047,7 @@ const createStyles$1 = () => ({
|
|
|
13035
13047
|
},
|
|
13036
13048
|
});
|
|
13037
13049
|
const MinimalDropdown = React.forwardRef(function MinimalDropdown(props, ref) {
|
|
13038
|
-
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;
|
|
13050
|
+
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;
|
|
13039
13051
|
// Inject global responsive styles
|
|
13040
13052
|
useInjectResponsiveStyles();
|
|
13041
13053
|
// Responsive state
|
|
@@ -13121,7 +13133,7 @@ const MinimalDropdown = React.forwardRef(function MinimalDropdown(props, ref) {
|
|
|
13121
13133
|
}
|
|
13122
13134
|
`),
|
|
13123
13135
|
header,
|
|
13124
|
-
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,
|
|
13136
|
+
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,
|
|
13125
13137
|
showRecent && (React.createElement(React.Fragment, null,
|
|
13126
13138
|
showSectionDividers && (React.createElement("div", { style: styles.divider }, "Recent")),
|
|
13127
13139
|
recentQueries.map((q, idx) => {
|
|
@@ -13456,6 +13468,7 @@ const SuggestionSearchBar = React.forwardRef(function SuggestionSearchBar(props,
|
|
|
13456
13468
|
include_dropdown_product_list: includeDropdownProductList,
|
|
13457
13469
|
include_filtered_tabs: includeFilteredTabs,
|
|
13458
13470
|
include_categories: includeCategories,
|
|
13471
|
+
include_facets: true, // Enable facet-based suggestions
|
|
13459
13472
|
filtered_tabs: filteredTabs,
|
|
13460
13473
|
analytics_tags: analyticsTags,
|
|
13461
13474
|
returnFullResponse: true, // Required to get tabs and products
|
|
@@ -14137,7 +14150,7 @@ function getHitKey(hit, index) {
|
|
|
14137
14150
|
return hit.objectID;
|
|
14138
14151
|
return `suggestion-${hit.url}-${index}`;
|
|
14139
14152
|
}
|
|
14140
|
-
function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSelectionIntoViewRef, query, isLoading, error, translations = {}, sources: _sources = [], }) {
|
|
14153
|
+
function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSelectionIntoViewRef, query, isLoading, showLoadingState = false, error, translations = {}, sources: _sources = [], }) {
|
|
14141
14154
|
const listRef = React.useRef(null);
|
|
14142
14155
|
React.useEffect(() => {
|
|
14143
14156
|
if (!listRef.current || hits.length === 0)
|
|
@@ -14171,7 +14184,7 @@ function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSe
|
|
|
14171
14184
|
return (React.createElement("div", { className: "seekora-docsearch-empty" },
|
|
14172
14185
|
React.createElement("p", { className: "seekora-docsearch-empty-text" }, translations.searchPlaceholder || 'Type to start searching...')));
|
|
14173
14186
|
}
|
|
14174
|
-
if (isLoading && hits.length === 0) {
|
|
14187
|
+
if (isLoading && hits.length === 0 && showLoadingState) {
|
|
14175
14188
|
return (React.createElement("div", { className: "seekora-docsearch-loading" },
|
|
14176
14189
|
React.createElement("div", { className: "seekora-docsearch-loading-spinner" },
|
|
14177
14190
|
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", "aria-hidden": "true" },
|
|
@@ -14179,6 +14192,10 @@ function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSe
|
|
|
14179
14192
|
React.createElement("animateTransform", { attributeName: "transform", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" })))),
|
|
14180
14193
|
React.createElement("p", { className: "seekora-docsearch-loading-text" }, translations.loadingText || 'Searching...')));
|
|
14181
14194
|
}
|
|
14195
|
+
if (isLoading && hits.length === 0) {
|
|
14196
|
+
return React.createElement("div", { className: "seekora-docsearch-empty" });
|
|
14197
|
+
}
|
|
14198
|
+
// When loading with previous hits, fall through and show them (no loading screen)
|
|
14182
14199
|
if (error) {
|
|
14183
14200
|
return (React.createElement("div", { className: "seekora-docsearch-error" },
|
|
14184
14201
|
React.createElement("p", { className: "seekora-docsearch-error-text" }, translations.errorText || error)));
|