@seekora-ai/ui-sdk-react 0.2.15 → 0.2.16
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/FacetDropdown.d.ts +2 -0
- package/dist/components/FacetDropdown.d.ts.map +1 -1
- package/dist/components/FacetDropdown.js +47 -25
- package/dist/components/Facets.d.ts +4 -0
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +21 -2
- package/dist/components/InfiniteHits.d.ts +0 -7
- package/dist/components/InfiniteHits.d.ts.map +1 -1
- package/dist/components/InfiniteHits.js +2 -13
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +27 -9
- package/dist/components/QuerySuggestions.d.ts +0 -4
- package/dist/components/QuerySuggestions.d.ts.map +1 -1
- package/dist/components/QuerySuggestions.js +1 -17
- package/dist/components/QuerySuggestionsDropdown.d.ts +0 -4
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -1
- package/dist/components/QuerySuggestionsDropdown.js +1 -16
- package/dist/components/Recommendations.d.ts +0 -7
- package/dist/components/Recommendations.d.ts.map +1 -1
- package/dist/components/Recommendations.js +3 -23
- package/dist/components/RichQuerySuggestions.d.ts +0 -4
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +1 -10
- package/dist/components/SearchBar.d.ts +0 -4
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +2 -4
- package/dist/components/SearchBarWithSuggestions.js +1 -1
- package/dist/components/SearchLayout.d.ts.map +1 -1
- package/dist/components/SearchLayout.js +13 -17
- package/dist/components/SearchProvider.d.ts.map +1 -1
- package/dist/components/SearchProvider.js +1 -3
- package/dist/components/SearchResults.d.ts +0 -6
- package/dist/components/SearchResults.d.ts.map +1 -1
- package/dist/components/SearchResults.js +1 -14
- package/dist/components/primitives/ImageDisplay.d.ts.map +1 -1
- package/dist/components/primitives/ImageDisplay.js +24 -14
- package/dist/components/primitives/ImageZoom.d.ts.map +1 -1
- package/dist/components/primitives/ImageZoom.js +59 -4
- package/dist/components/primitives/VariantSwatches.d.ts.map +1 -1
- package/dist/components/primitives/VariantSwatches.js +25 -10
- package/dist/components/section-primitives/SectionItemGrid.d.ts +1 -3
- package/dist/components/section-primitives/SectionItemGrid.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionItemGrid.js +1 -4
- package/dist/components/section-primitives/index.d.ts +0 -1
- package/dist/components/section-primitives/index.d.ts.map +1 -1
- package/dist/components/section-primitives/index.js +0 -1
- package/dist/components/suggestions/AmazonDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/AmazonDropdown.js +3 -21
- package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/GoogleDropdown.js +3 -20
- 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 +60 -60
- package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/PinterestDropdown.js +41 -41
- package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/ShopifyDropdown.js +3 -4
- package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/SpotlightDropdown.js +2 -3
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -1
- package/dist/components/suggestions/SuggestionSearchBar.js +2 -15
- package/dist/components/suggestions/types.d.ts +0 -6
- package/dist/components/suggestions/types.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemCard.js +32 -8
- package/dist/components/suggestions-primitives/ItemGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemGrid.js +9 -2
- package/dist/components/suggestions-primitives/ProductCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCard.js +14 -5
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +32 -12
- package/dist/components/suggestions-primitives/ProductGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductGrid.js +8 -3
- package/dist/components/suggestions-primitives/RecentSearchesList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/RecentSearchesList.js +12 -5
- package/dist/components/suggestions-primitives/SearchInput.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SearchInput.js +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +5 -3
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +1 -8
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.js +1 -7
- package/dist/components/suggestions-primitives/TrendingList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/TrendingList.js +14 -7
- package/dist/components/suggestions-primitives/index.d.ts +1 -3
- package/dist/components/suggestions-primitives/index.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/index.js +1 -2
- package/dist/docsearch/components/DocSearch.d.ts.map +1 -1
- package/dist/docsearch/components/DocSearch.js +1 -1
- package/dist/docsearch/components/Results.d.ts +1 -3
- package/dist/docsearch/components/Results.d.ts.map +1 -1
- package/dist/docsearch/components/Results.js +1 -9
- package/dist/docsearch/components/SearchBox.d.ts +1 -2
- package/dist/docsearch/components/SearchBox.d.ts.map +1 -1
- package/dist/docsearch/components/SearchBox.js +4 -6
- package/dist/docsearch/hooks/useSeekoraSearch.d.ts.map +1 -1
- package/dist/docsearch/hooks/useSeekoraSearch.js +6 -0
- package/dist/docsearch/types.d.ts +0 -1
- package/dist/docsearch/types.d.ts.map +1 -1
- package/dist/docsearch.css +2 -5
- package/dist/hooks/useClickTracking.d.ts.map +1 -1
- package/dist/hooks/useClickTracking.js +4 -11
- package/dist/hooks/useExperiment.d.ts.map +1 -1
- package/dist/hooks/useExperiment.js +10 -33
- package/dist/hooks/useFilters.d.ts +27 -0
- package/dist/hooks/useFilters.d.ts.map +1 -0
- package/dist/hooks/useFilters.js +66 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +39 -79
- package/dist/src/index.esm.js +800 -452
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +800 -453
- package/dist/src/index.js.map +1 -1
- package/dist/utils/responsive.d.ts +130 -0
- package/dist/utils/responsive.d.ts.map +1 -0
- package/dist/utils/responsive.js +231 -0
- package/package.json +5 -5
- package/src/docsearch/docsearch.css +2 -5
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
|
+
import { useIsMobile } from '../../utils/responsive';
|
|
8
9
|
const COLOR_NAMES = {
|
|
9
10
|
black: '#000', white: '#fff', red: '#ef4444', blue: '#3b82f6',
|
|
10
11
|
green: '#22c55e', yellow: '#eab308', orange: '#f97316', purple: '#a855f7',
|
|
@@ -61,6 +62,12 @@ const getAvailability = (optionName, value, options, variants, selectedValues) =
|
|
|
61
62
|
};
|
|
62
63
|
export function VariantSwatches({ options, visibleOptions, maxValues = 5, colorMap, selectedValues, variants, showAvailability = true, onSwatchHover, onSwatchClick, className, style, }) {
|
|
63
64
|
const [expandedOptions, setExpandedOptions] = useState(new Set());
|
|
65
|
+
const isMobile = useIsMobile();
|
|
66
|
+
// Responsive sizing
|
|
67
|
+
const colorSwatchSize = isMobile ? 20 : 14; // Larger on mobile for touch
|
|
68
|
+
const textSwatchPadding = isMobile ? '4px 10px' : '1px 6px';
|
|
69
|
+
const textSwatchFontSize = isMobile ? '0.75rem' : '0.6875rem';
|
|
70
|
+
const gap = isMobile ? 6 : 4;
|
|
64
71
|
if (!options || options.length === 0)
|
|
65
72
|
return null;
|
|
66
73
|
const filtered = visibleOptions
|
|
@@ -81,14 +88,14 @@ export function VariantSwatches({ options, visibleOptions, maxValues = 5, colorM
|
|
|
81
88
|
return next;
|
|
82
89
|
});
|
|
83
90
|
};
|
|
84
|
-
return (React.createElement("div", { className: clsx('seekora-variant-swatches', className), style: { display: 'flex', flexDirection: 'column', gap
|
|
91
|
+
return (React.createElement("div", { className: clsx('seekora-variant-swatches', className), style: { display: 'flex', flexDirection: 'column', gap, ...style } }, filtered.map((option) => {
|
|
85
92
|
const isColor = isColorOption(option.name);
|
|
86
93
|
const isExpanded = expandedOptions.has(option.name);
|
|
87
94
|
const visible = isExpanded ? option.values : option.values.slice(0, maxValues);
|
|
88
95
|
const overflow = option.values.length - maxValues;
|
|
89
96
|
const hasOverflow = overflow > 0;
|
|
90
97
|
const selectedValue = selectedValues?.[option.name];
|
|
91
|
-
return (React.createElement("div", { key: option.name, className: "seekora-variant-swatch-group", style: { display: 'flex', alignItems: 'center', gap
|
|
98
|
+
return (React.createElement("div", { key: option.name, className: "seekora-variant-swatch-group", style: { display: 'flex', alignItems: 'center', gap, flexWrap: 'wrap' } },
|
|
92
99
|
visible.map((value) => {
|
|
93
100
|
const color = isColor ? resolveColor(value, colorMap) : null;
|
|
94
101
|
const isSelected = selectedValue === value;
|
|
@@ -97,9 +104,13 @@ export function VariantSwatches({ options, visibleOptions, maxValues = 5, colorM
|
|
|
97
104
|
: true;
|
|
98
105
|
if (color) {
|
|
99
106
|
return (React.createElement("span", { key: value, className: clsx('seekora-variant-swatch', 'seekora-variant-swatch--color', isSelected && 'seekora-variant-swatch--selected', !isAvailable && 'seekora-variant-swatch--unavailable'), title: `${value}${!isAvailable ? ' (Unavailable)' : ''}`, style: {
|
|
100
|
-
display: 'inline-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
display: 'inline-flex',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
width: colorSwatchSize,
|
|
111
|
+
height: colorSwatchSize,
|
|
112
|
+
minWidth: colorSwatchSize,
|
|
113
|
+
minHeight: colorSwatchSize,
|
|
103
114
|
borderRadius: '50%',
|
|
104
115
|
backgroundColor: color,
|
|
105
116
|
border: isSelected
|
|
@@ -131,9 +142,12 @@ export function VariantSwatches({ options, visibleOptions, maxValues = 5, colorM
|
|
|
131
142
|
} }))));
|
|
132
143
|
}
|
|
133
144
|
return (React.createElement("span", { key: value, className: clsx('seekora-variant-swatch', 'seekora-variant-swatch--text', isSelected && 'seekora-variant-swatch--selected', !isAvailable && 'seekora-variant-swatch--unavailable'), style: {
|
|
134
|
-
display: 'inline-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
display: 'inline-flex',
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
padding: textSwatchPadding,
|
|
149
|
+
minHeight: isMobile ? 32 : 24, // Minimum touch target on mobile
|
|
150
|
+
fontSize: textSwatchFontSize,
|
|
137
151
|
borderRadius: 3,
|
|
138
152
|
border: isSelected
|
|
139
153
|
? '1px solid var(--seekora-primary, #111827)'
|
|
@@ -160,11 +174,12 @@ export function VariantSwatches({ options, visibleOptions, maxValues = 5, colorM
|
|
|
160
174
|
} }, value));
|
|
161
175
|
}),
|
|
162
176
|
hasOverflow && (React.createElement("button", { type: "button", className: "seekora-variant-swatch--overflow", onClick: (e) => toggleExpanded(option.name, e), style: {
|
|
163
|
-
fontSize:
|
|
177
|
+
fontSize: textSwatchFontSize,
|
|
164
178
|
color: 'var(--seekora-primary, #2563eb)',
|
|
165
179
|
background: 'none',
|
|
166
180
|
border: 'none',
|
|
167
|
-
padding: 0,
|
|
181
|
+
padding: isMobile ? '4px 8px' : 0,
|
|
182
|
+
minHeight: isMobile ? 32 : 'auto', // Touch target on mobile
|
|
168
183
|
cursor: 'pointer',
|
|
169
184
|
textDecoration: 'underline',
|
|
170
185
|
fontWeight: 500,
|
|
@@ -7,8 +7,6 @@ export interface SectionItemGridProps {
|
|
|
7
7
|
maxItems?: number;
|
|
8
8
|
className?: string;
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
|
-
/** Show loading state when fetching and no previous items (default false: show previous results until new render) */
|
|
11
|
-
showLoadingState?: boolean;
|
|
12
10
|
getItemId?: (item: unknown) => string;
|
|
13
11
|
getItemTitle?: (item: unknown) => string;
|
|
14
12
|
getItemImage?: (item: unknown) => string | undefined;
|
|
@@ -16,5 +14,5 @@ export interface SectionItemGridProps {
|
|
|
16
14
|
getItemUrl?: (item: unknown) => string | undefined;
|
|
17
15
|
renderItem?: (item: unknown, index: number) => React.ReactNode;
|
|
18
16
|
}
|
|
19
|
-
export declare function SectionItemGrid({ columns, maxItems, className, style,
|
|
17
|
+
export declare function SectionItemGrid({ columns, maxItems, className, style, getItemId, getItemTitle, getItemImage, getItemDescription, getItemUrl, renderItem, }: SectionItemGridProps): React.JSX.Element;
|
|
20
18
|
//# sourceMappingURL=SectionItemGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionItemGrid.d.ts","sourceRoot":"","sources":["../../../src/components/section-primitives/SectionItemGrid.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SectionItemGrid.d.ts","sourceRoot":"","sources":["../../../src/components/section-primitives/SectionItemGrid.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,CAAC;IACzC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IACrD,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IAC3D,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IACnD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CAChE;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAW,EACX,QAAa,EACb,SAAS,EACT,KAAK,EACL,SAA8E,EAC9E,YAAyE,EACzE,YAAmE,EACnE,kBAAqF,EACrF,UAA6D,EAC7D,UAAU,GACX,EAAE,oBAAoB,qBAsBtB"}
|
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useSectionSearchContext } from './SectionSearchContext';
|
|
6
6
|
import { ItemGrid } from '../suggestions-primitives/ItemGrid';
|
|
7
|
-
import { SectionLoading } from './SectionLoading';
|
|
8
7
|
import { SectionError } from './SectionError';
|
|
9
|
-
export function SectionItemGrid({ columns = 4, maxItems = 12, className, style,
|
|
8
|
+
export 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, }) {
|
|
10
9
|
const { items, loading, error, trackClick } = useSectionSearchContext();
|
|
11
|
-
if (loading && items.length === 0 && showLoadingState)
|
|
12
|
-
return React.createElement(SectionLoading, { className: className, style: style });
|
|
13
10
|
if (error)
|
|
14
11
|
return React.createElement(SectionError, { className: className, style: style });
|
|
15
12
|
// When loading with previous items, show them (no loading screen)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { SectionSearchProvider, type RefinementInput, type SectionSearchProviderProps } from './SectionSearchProvider';
|
|
2
2
|
export { SectionSearchContext, useSectionSearchContext, type SectionSearchContextValue } from './SectionSearchContext';
|
|
3
3
|
export { SectionItemGrid, type SectionItemGridProps } from './SectionItemGrid';
|
|
4
|
-
export { SectionLoading, type SectionLoadingProps } from './SectionLoading';
|
|
5
4
|
export { SectionError, type SectionErrorProps } from './SectionError';
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/section-primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACvH,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/section-primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACvH,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { SectionSearchProvider } from './SectionSearchProvider';
|
|
2
2
|
export { SectionSearchContext, useSectionSearchContext } from './SectionSearchContext';
|
|
3
3
|
export { SectionItemGrid } from './SectionItemGrid';
|
|
4
|
-
export { SectionLoading } from './SectionLoading';
|
|
5
4
|
export { SectionError } from './SectionError';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/AmazonDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"AmazonDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/AmazonDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAkU9D,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4BAA4B;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,yFAsc1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -225,22 +225,6 @@ const createStyles = (theme = {}, isMobile = false) => ({
|
|
|
225
225
|
fontWeight: 700,
|
|
226
226
|
color: 'var(--seekora-text-primary, #0f1111)',
|
|
227
227
|
},
|
|
228
|
-
loading: {
|
|
229
|
-
display: 'flex',
|
|
230
|
-
alignItems: 'center',
|
|
231
|
-
justifyContent: 'center',
|
|
232
|
-
padding: '40px',
|
|
233
|
-
color: 'var(--seekora-text-secondary, #565959)',
|
|
234
|
-
gap: '10px',
|
|
235
|
-
},
|
|
236
|
-
spinner: {
|
|
237
|
-
width: '20px',
|
|
238
|
-
height: '20px',
|
|
239
|
-
border: '2px solid var(--seekora-border-color, #ddd)',
|
|
240
|
-
borderTopColor: 'var(--seekora-primary, #f90)',
|
|
241
|
-
borderRadius: '50%',
|
|
242
|
-
animation: 'seekora-spin 0.8s linear infinite',
|
|
243
|
-
},
|
|
244
228
|
empty: {
|
|
245
229
|
padding: '40px 20px',
|
|
246
230
|
textAlign: 'center',
|
|
@@ -306,7 +290,7 @@ const RatingStars = ({ rating, count }) => {
|
|
|
306
290
|
")"))));
|
|
307
291
|
};
|
|
308
292
|
export const AmazonDropdown = forwardRef(function AmazonDropdown(props, ref) {
|
|
309
|
-
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,
|
|
293
|
+
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, renderEmpty, } = props;
|
|
310
294
|
// Inject global responsive styles
|
|
311
295
|
useInjectResponsiveStyles();
|
|
312
296
|
// Responsive state
|
|
@@ -403,9 +387,7 @@ export const AmazonDropdown = forwardRef(function AmazonDropdown(props, ref) {
|
|
|
403
387
|
}
|
|
404
388
|
`),
|
|
405
389
|
header,
|
|
406
|
-
|
|
407
|
-
React.createElement("div", { style: styles.spinner }),
|
|
408
|
-
React.createElement("span", null, "Searching...")))) : (React.createElement(React.Fragment, null,
|
|
390
|
+
React.createElement(React.Fragment, null,
|
|
409
391
|
filteredTabs.length > 0 && (React.createElement("div", { style: {
|
|
410
392
|
display: 'flex',
|
|
411
393
|
gap: '8px',
|
|
@@ -510,7 +492,7 @@ export const AmazonDropdown = forwardRef(function AmazonDropdown(props, ref) {
|
|
|
510
492
|
currency: '',
|
|
511
493
|
priceDecimals: productDisplay.priceDecimals
|
|
512
494
|
}))),
|
|
513
|
-
product.rating && (React.createElement(RatingStars, { rating: parseFloat(String(product.rating)), count: product.reviewCount ? parseInt(String(product.reviewCount)) : undefined }))))))))))
|
|
495
|
+
product.rating && (React.createElement(RatingStars, { rating: parseFloat(String(product.rating)), count: product.reviewCount ? parseInt(String(product.reviewCount)) : undefined })))))))))),
|
|
514
496
|
footer !== undefined ? footer : (React.createElement("div", { style: styles.footer },
|
|
515
497
|
React.createElement("div", { style: styles.keyboard },
|
|
516
498
|
React.createElement("span", { style: styles.key }, "\u2191"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/GoogleDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"GoogleDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/GoogleDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiO9D,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+BAA+B;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2BAA2B;IAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,4BAA4B;IAC5B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,8BAA8B;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,cAAc,yFA6T1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -177,22 +177,6 @@ const createStyles = (isMobile = false) => ({
|
|
|
177
177
|
backgroundColor: 'var(--seekora-bg-hover, #f1f3f4)',
|
|
178
178
|
color: 'var(--seekora-text-primary, #202124)',
|
|
179
179
|
},
|
|
180
|
-
loading: {
|
|
181
|
-
display: 'flex',
|
|
182
|
-
alignItems: 'center',
|
|
183
|
-
justifyContent: 'center',
|
|
184
|
-
padding: '24px',
|
|
185
|
-
color: 'var(--seekora-text-secondary, #5f6368)',
|
|
186
|
-
gap: '12px',
|
|
187
|
-
},
|
|
188
|
-
spinner: {
|
|
189
|
-
width: '24px',
|
|
190
|
-
height: '24px',
|
|
191
|
-
border: '3px solid var(--seekora-border-color, #e8eaed)',
|
|
192
|
-
borderTopColor: 'var(--seekora-primary, #4285f4)',
|
|
193
|
-
borderRadius: '50%',
|
|
194
|
-
animation: 'seekora-spin 0.8s linear infinite',
|
|
195
|
-
},
|
|
196
180
|
empty: {
|
|
197
181
|
padding: '24px',
|
|
198
182
|
textAlign: 'center',
|
|
@@ -214,7 +198,7 @@ const RemoveIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fil
|
|
|
214
198
|
const ArrowIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", width: "20", height: "20" },
|
|
215
199
|
React.createElement("path", { d: "M9 5l-4 4 4 4", stroke: "currentColor", strokeWidth: "2", fill: "none", transform: "rotate(-90 12 12)" })));
|
|
216
200
|
export const GoogleDropdown = forwardRef(function GoogleDropdown(props, ref) {
|
|
217
|
-
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,
|
|
201
|
+
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, renderEmpty, } = props;
|
|
218
202
|
// Inject global responsive styles
|
|
219
203
|
useInjectResponsiveStyles();
|
|
220
204
|
// Responsive state
|
|
@@ -329,8 +313,7 @@ export const GoogleDropdown = forwardRef(function GoogleDropdown(props, ref) {
|
|
|
329
313
|
}
|
|
330
314
|
`),
|
|
331
315
|
header,
|
|
332
|
-
|
|
333
|
-
React.createElement("div", { style: styles.spinner })))) : (React.createElement(React.Fragment, null,
|
|
316
|
+
React.createElement(React.Fragment, null,
|
|
334
317
|
React.createElement("ul", { style: styles.list },
|
|
335
318
|
showRecent && (React.createElement(React.Fragment, null,
|
|
336
319
|
recentQueries.map((q, idx) => {
|
|
@@ -360,7 +343,7 @@ export const GoogleDropdown = forwardRef(function GoogleDropdown(props, ref) {
|
|
|
360
343
|
"\"")))),
|
|
361
344
|
(showFeelingLucky || showVoiceSearch) && (React.createElement("div", { style: styles.footer }, showFeelingLucky && (React.createElement(React.Fragment, null,
|
|
362
345
|
React.createElement("button", { style: mergeStyles(styles.footerButton, hoveredBtn === 'search' ? styles.footerButtonHover : undefined), onMouseEnter: () => setHoveredBtn('search'), onMouseLeave: () => setHoveredBtn(null), onClick: () => onSearchSubmit?.(query || (activeIndex >= 0 ? allItems[activeIndex]?.query : '')) }, "Search"),
|
|
363
|
-
React.createElement("button", { style: mergeStyles(styles.footerButton, hoveredBtn === 'lucky' ? styles.footerButtonHover : undefined), onMouseEnter: () => setHoveredBtn('lucky'), onMouseLeave: () => setHoveredBtn(null), onClick: () => onFeelingLucky?.(query || (activeIndex >= 0 ? allItems[activeIndex]?.query : '')) }, feelingLuckyText))))))
|
|
346
|
+
React.createElement("button", { style: mergeStyles(styles.footerButton, hoveredBtn === 'lucky' ? styles.footerButtonHover : undefined), onMouseEnter: () => setHoveredBtn('lucky'), onMouseLeave: () => setHoveredBtn(null), onClick: () => onFeelingLucky?.(query || (activeIndex >= 0 ? allItems[activeIndex]?.query : '')) }, feelingLuckyText)))))),
|
|
364
347
|
footer));
|
|
365
348
|
});
|
|
366
349
|
export default GoogleDropdown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimalDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/MinimalDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA6K9D,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4BAA4B;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"MinimalDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/MinimalDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA6K9D,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4BAA4B;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,0FA4T3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -164,7 +164,7 @@ const createStyles = () => ({
|
|
|
164
164
|
},
|
|
165
165
|
});
|
|
166
166
|
export const MinimalDropdown = forwardRef(function MinimalDropdown(props, ref) {
|
|
167
|
-
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,
|
|
167
|
+
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, renderEmpty, } = props;
|
|
168
168
|
// Inject global responsive styles
|
|
169
169
|
useInjectResponsiveStyles();
|
|
170
170
|
// Responsive state
|
|
@@ -250,7 +250,7 @@ export const MinimalDropdown = forwardRef(function MinimalDropdown(props, ref) {
|
|
|
250
250
|
}
|
|
251
251
|
`),
|
|
252
252
|
header,
|
|
253
|
-
React.createElement("div", { ref: listRef, style: { maxHeight, overflowY: 'auto' } },
|
|
253
|
+
React.createElement("div", { ref: listRef, style: { maxHeight, overflowY: 'auto' } }, 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,
|
|
254
254
|
showRecent && (React.createElement(React.Fragment, null,
|
|
255
255
|
showSectionDividers && (React.createElement("div", { style: styles.divider }, "Recent")),
|
|
256
256
|
recentQueries.map((q, idx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileSheetDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/MobileSheetDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAwS9D,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yBAAyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"MobileSheetDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/MobileSheetDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAwS9D,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yBAAyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,8FAmb/B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -267,7 +267,7 @@ const ChevronIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fi
|
|
|
267
267
|
const ArrowUpIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "20", height: "20" },
|
|
268
268
|
React.createElement("path", { d: "M7 17l5-5-5-5M13 17l5-5-5-5" })));
|
|
269
269
|
export const MobileSheetDropdown = forwardRef(function MobileSheetDropdown(props, ref) {
|
|
270
|
-
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,
|
|
270
|
+
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, renderEmpty, } = props;
|
|
271
271
|
// Inject global responsive styles
|
|
272
272
|
useInjectResponsiveStyles();
|
|
273
273
|
const styles = useMemo(() => createStyles(), []);
|
|
@@ -386,7 +386,7 @@ export const MobileSheetDropdown = forwardRef(function MobileSheetDropdown(props
|
|
|
386
386
|
React.createElement("div", { style: styles.searchContainer },
|
|
387
387
|
React.createElement("div", { style: styles.searchIcon },
|
|
388
388
|
React.createElement(SearchIcon, null)),
|
|
389
|
-
React.createElement("input", { ref: inputRef, type: "text", placeholder: "
|
|
389
|
+
React.createElement("input", { ref: inputRef, type: "text", placeholder: "Powered by Seekora", value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: (e) => {
|
|
390
390
|
if (e.key === 'Enter') {
|
|
391
391
|
e.preventDefault();
|
|
392
392
|
if (activeIndex >= 0) {
|
|
@@ -409,70 +409,70 @@ export const MobileSheetDropdown = forwardRef(function MobileSheetDropdown(props
|
|
|
409
409
|
}
|
|
410
410
|
}, style: styles.searchInput, autoFocus: true })),
|
|
411
411
|
showCancel && (React.createElement("button", { style: styles.cancelBtn, onClick: onClose }, cancelText)))))),
|
|
412
|
-
React.createElement("div", { style: styles.content },
|
|
413
|
-
React.createElement(
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
onRecentClick?.(q);
|
|
420
|
-
setInputValue(q);
|
|
421
|
-
}, onMouseEnter: () => setActiveIndex(idx) },
|
|
422
|
-
React.createElement("div", { style: styles.itemIcon },
|
|
423
|
-
React.createElement(ClockIcon, null)),
|
|
424
|
-
React.createElement("div", { style: styles.itemContent },
|
|
425
|
-
React.createElement("div", { style: styles.itemTitle }, q)),
|
|
426
|
-
React.createElement("div", { style: styles.itemAction },
|
|
427
|
-
React.createElement(ArrowUpIcon, null))))))),
|
|
428
|
-
showTrending && (React.createElement("div", { style: styles.section },
|
|
429
|
-
React.createElement("div", { style: styles.sectionHeader },
|
|
430
|
-
React.createElement("span", { style: styles.sectionTitle }, "Trending")),
|
|
431
|
-
trendingQueries.map((q, idx) => {
|
|
432
|
-
const globalIdx = recentQueries.length + idx;
|
|
433
|
-
return (React.createElement("div", { key: `trending-${q}`, "data-index": globalIdx, style: mergeStyles(styles.item, activeIndex === globalIdx ? styles.itemActive : undefined), onClick: () => {
|
|
412
|
+
React.createElement("div", { style: styles.content },
|
|
413
|
+
React.createElement(React.Fragment, null,
|
|
414
|
+
showRecent && (React.createElement("div", { style: styles.section },
|
|
415
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
416
|
+
React.createElement("span", { style: styles.sectionTitle }, "Recent"),
|
|
417
|
+
React.createElement("button", { style: styles.clearBtn, onClick: onRecentClearAll }, "Clear")),
|
|
418
|
+
recentQueries.map((q, idx) => (React.createElement("div", { key: `recent-${q}`, "data-index": idx, style: mergeStyles(styles.item, activeIndex === idx ? styles.itemActive : undefined), onClick: () => {
|
|
434
419
|
onRecentClick?.(q);
|
|
435
420
|
setInputValue(q);
|
|
436
|
-
}, onMouseEnter: () => setActiveIndex(
|
|
421
|
+
}, onMouseEnter: () => setActiveIndex(idx) },
|
|
437
422
|
React.createElement("div", { style: styles.itemIcon },
|
|
438
|
-
React.createElement(
|
|
423
|
+
React.createElement(ClockIcon, null)),
|
|
439
424
|
React.createElement("div", { style: styles.itemContent },
|
|
440
425
|
React.createElement("div", { style: styles.itemTitle }, q)),
|
|
441
426
|
React.createElement("div", { style: styles.itemAction },
|
|
442
|
-
React.createElement(
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
427
|
+
React.createElement(ArrowUpIcon, null))))))),
|
|
428
|
+
showTrending && (React.createElement("div", { style: styles.section },
|
|
429
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
430
|
+
React.createElement("span", { style: styles.sectionTitle }, "Trending")),
|
|
431
|
+
trendingQueries.map((q, idx) => {
|
|
432
|
+
const globalIdx = recentQueries.length + idx;
|
|
433
|
+
return (React.createElement("div", { key: `trending-${q}`, "data-index": globalIdx, style: mergeStyles(styles.item, activeIndex === globalIdx ? styles.itemActive : undefined), onClick: () => {
|
|
434
|
+
onRecentClick?.(q);
|
|
435
|
+
setInputValue(q);
|
|
436
|
+
}, onMouseEnter: () => setActiveIndex(globalIdx) },
|
|
437
|
+
React.createElement("div", { style: styles.itemIcon },
|
|
438
|
+
React.createElement(TrendingIcon, null)),
|
|
439
|
+
React.createElement("div", { style: styles.itemContent },
|
|
440
|
+
React.createElement("div", { style: styles.itemTitle }, q)),
|
|
441
|
+
React.createElement("div", { style: styles.itemAction },
|
|
442
|
+
React.createElement(ChevronIcon, null))));
|
|
443
|
+
}))),
|
|
444
|
+
inputValue && processedSuggestions.length > 0 && (React.createElement("div", { style: styles.section },
|
|
445
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
446
|
+
React.createElement("span", { style: styles.sectionTitle }, "Suggestions")),
|
|
447
|
+
processedSuggestions.map((s, idx) => {
|
|
448
|
+
const globalIdx = recentQueries.length + trendingQueries.length + idx;
|
|
449
|
+
return (React.createElement("div", { key: s.id || idx, "data-index": globalIdx, style: mergeStyles(styles.item, activeIndex === globalIdx ? styles.itemActive : undefined), onClick: () => onSuggestionSelect?.(s._raw, idx), onMouseEnter: () => setActiveIndex(globalIdx) },
|
|
450
|
+
React.createElement("div", { style: styles.itemIcon },
|
|
451
|
+
React.createElement(SearchIcon, null)),
|
|
452
|
+
React.createElement("div", { style: styles.itemContent },
|
|
453
|
+
React.createElement("div", { style: styles.itemTitle }, highlightTextReact(s.query, inputValue, { tag: 'strong' })),
|
|
454
|
+
s.count && (React.createElement("div", { style: styles.itemSubtitle },
|
|
455
|
+
s.count,
|
|
456
|
+
" results"))),
|
|
457
|
+
React.createElement("div", { style: styles.itemAction },
|
|
458
|
+
React.createElement(ChevronIcon, null))));
|
|
459
|
+
}))),
|
|
460
|
+
showProducts && (React.createElement("div", { style: styles.section },
|
|
461
|
+
React.createElement("div", { style: styles.sectionHeader },
|
|
462
|
+
React.createElement("span", { style: styles.sectionTitle }, "Products")),
|
|
463
|
+
React.createElement("div", { style: styles.productsScroll }, processedProducts.slice(0, 8).map((p, idx) => (React.createElement("div", { key: p.id, style: styles.productCard, onClick: () => onProductClick?.(p._raw, idx) },
|
|
464
|
+
p.image ? (React.createElement("img", { src: p.image, alt: p.title, style: styles.productImage, loading: "lazy" })) : (React.createElement("div", { style: styles.productImage })),
|
|
465
|
+
React.createElement("div", { style: styles.productTitle }, p.title),
|
|
466
|
+
p.price !== undefined && (React.createElement("div", { style: styles.productPrice }, formatPrice(p.price, {
|
|
467
|
+
currency: productDisplay.currency || p.currency || '$'
|
|
468
|
+
}))))))))),
|
|
469
|
+
inputValue && processedSuggestions.length === 0 && !loading && (renderEmpty ? renderEmpty(inputValue) : (React.createElement("div", { style: styles.empty },
|
|
470
|
+
React.createElement("div", { style: styles.emptyIcon },
|
|
471
|
+
React.createElement(SearchIcon, null)),
|
|
472
|
+
React.createElement("p", null,
|
|
473
|
+
"No results for \"",
|
|
474
|
+
inputValue,
|
|
475
|
+
"\"")))))),
|
|
476
476
|
footer !== undefined ? footer : (showFooterButton && inputValue && (React.createElement("div", { style: styles.footer },
|
|
477
477
|
React.createElement("button", { style: styles.footerBtn, onClick: () => onSearchSubmit?.(inputValue) },
|
|
478
478
|
footerButtonText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PinterestDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/PinterestDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAuU9D,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,uCAAuC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0BAA0B;IAC1B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,yBAAyB;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,eAAe,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;CACvD;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"PinterestDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/PinterestDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAuU9D,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,uCAAuC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0BAA0B;IAC1B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,yBAAyB;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,eAAe,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;CACvD;AAED,eAAO,MAAM,iBAAiB,4FA4W7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -302,7 +302,7 @@ const ImageIcon = () => (React.createElement("svg", { viewBox: "0 0 24 24", fill
|
|
|
302
302
|
React.createElement("polyline", { points: "21 15 16 10 5 21" })));
|
|
303
303
|
export const PinterestDropdown = forwardRef(function PinterestDropdown(props, ref) {
|
|
304
304
|
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
|
|
305
|
-
showPriceOverlay = true, gridColumns = 4, width = '800px', maxHeight = '600px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onSaveProduct, onViewAll, onClose, header, footer,
|
|
305
|
+
showPriceOverlay = true, gridColumns = 4, width = '800px', maxHeight = '600px', zIndex = 1000, className, style, classNames = {}, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, onSaveProduct, onViewAll, onClose, header, footer, renderEmpty, } = props;
|
|
306
306
|
// Inject global responsive styles
|
|
307
307
|
useInjectResponsiveStyles();
|
|
308
308
|
// Responsive state
|
|
@@ -396,47 +396,47 @@ export const PinterestDropdown = forwardRef(function PinterestDropdown(props, re
|
|
|
396
396
|
"(",
|
|
397
397
|
cat.count,
|
|
398
398
|
")"))))))))),
|
|
399
|
-
React.createElement("div", { style: { ...styles.content, maxHeight } },
|
|
400
|
-
React.createElement(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
399
|
+
React.createElement("div", { style: { ...styles.content, maxHeight } },
|
|
400
|
+
React.createElement(React.Fragment, null,
|
|
401
|
+
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: () => {
|
|
402
|
+
setHoveredSuggestion(idx);
|
|
403
|
+
setActiveIndex(idx);
|
|
404
|
+
}, onMouseLeave: () => setHoveredSuggestion(-1) },
|
|
405
|
+
React.createElement("span", { style: styles.suggestionIcon }, query ? highlightTextReact(s.query, query, { tag: 'strong' }) : s.query)))))),
|
|
406
|
+
displayProducts.length > 0 && (React.createElement(React.Fragment, null,
|
|
407
|
+
React.createElement("div", { style: styles.sectionTitle },
|
|
408
|
+
React.createElement(TrendingIcon, null),
|
|
409
|
+
"Ideas for you"),
|
|
410
|
+
React.createElement("div", { style: {
|
|
411
|
+
...styles.productsGrid,
|
|
412
|
+
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`,
|
|
413
|
+
} }, displayProducts.slice(0, 12).map((product, idx) => (React.createElement("div", { key: product.id, style: mergeStyles(styles.productCard, hoveredProduct === product.id ? styles.productCardHover : undefined), onClick: () => onProductClick?.(product._raw, idx), onMouseEnter: () => setHoveredProduct(product.id), onMouseLeave: () => setHoveredProduct(null) },
|
|
414
|
+
React.createElement("div", { style: styles.productImageContainer },
|
|
415
|
+
product.image ? (React.createElement("img", { src: product.image, alt: product.title, style: styles.productImage, loading: "lazy" })) : (React.createElement("div", { style: styles.productImagePlaceholder },
|
|
416
|
+
React.createElement(ImageIcon, null))),
|
|
417
|
+
showSaveButton && (React.createElement("button", { style: mergeStyles(styles.productSaveBtn, hoveredProduct === product.id ? styles.productSaveBtnVisible : undefined), onClick: (e) => {
|
|
418
|
+
e.stopPropagation();
|
|
419
|
+
onSaveProduct?.(product._raw);
|
|
420
|
+
}, "aria-label": "Save" },
|
|
421
|
+
React.createElement(HeartIcon, null))),
|
|
422
|
+
showPriceOverlay && product.price !== undefined && (React.createElement("div", { style: mergeStyles(styles.productOverlay, hoveredProduct === product.id ? styles.productOverlayVisible : undefined) },
|
|
423
|
+
React.createElement("div", { style: styles.productTitleOverlay }, product.title),
|
|
424
|
+
React.createElement("div", { style: styles.productPriceOverlay }, formatPrice(product.price, {
|
|
425
|
+
currency: productDisplay.currency || product.currency || '$'
|
|
426
|
+
}))))),
|
|
427
|
+
!showPriceOverlay && (React.createElement("div", { style: styles.productInfo },
|
|
428
|
+
React.createElement("div", { style: styles.productTitle }, product.title),
|
|
429
|
+
product.price !== undefined && (React.createElement("div", { style: styles.productPrice }, formatPrice(product.price, {
|
|
425
430
|
currency: productDisplay.currency || product.currency || '$'
|
|
426
|
-
}))))),
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
React.createElement(
|
|
435
|
-
React.createElement("p", null,
|
|
436
|
-
"No ideas found for \"",
|
|
437
|
-
query,
|
|
438
|
-
"\""),
|
|
439
|
-
React.createElement("p", { style: { fontSize: '14px', marginTop: '8px' } }, "Try searching for something else"))))))),
|
|
431
|
+
}))))))))))),
|
|
432
|
+
!loading && displayProducts.length === 0 && processedSuggestions.length === 0 && (renderEmpty ? renderEmpty(query) : (React.createElement("div", { style: styles.empty },
|
|
433
|
+
React.createElement("div", { style: styles.emptyIcon },
|
|
434
|
+
React.createElement(SearchIcon, null)),
|
|
435
|
+
React.createElement("p", null,
|
|
436
|
+
"No ideas found for \"",
|
|
437
|
+
query,
|
|
438
|
+
"\""),
|
|
439
|
+
React.createElement("p", { style: { fontSize: '14px', marginTop: '8px' } }, "Try searching for something else")))))),
|
|
440
440
|
footer !== undefined ? footer : (displayProducts.length > 0 && (React.createElement("div", { style: styles.footer },
|
|
441
441
|
React.createElement("span", { style: { color: 'var(--seekora-text-secondary, #767676)', fontSize: '14px' } },
|
|
442
442
|
displayProducts.length,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopifyDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/ShopifyDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAuU9D,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8BAA8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"ShopifyDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/ShopifyDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAuU9D,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8BAA8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,0FAiW3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|