@seekora-ai/ui-sdk-react 0.2.14 → 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/CurrentRefinements.d.ts.map +1 -1
- package/dist/components/CurrentRefinements.js +69 -9
- package/dist/components/FacetDropdown.d.ts +94 -0
- package/dist/components/FacetDropdown.d.ts.map +1 -0
- package/dist/components/FacetDropdown.js +396 -0
- package/dist/components/Facets.d.ts +30 -0
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +215 -7
- package/dist/components/FederatedDropdown.d.ts.map +1 -1
- package/dist/components/FederatedDropdown.js +45 -31
- 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 +32 -33
- package/dist/components/RangeInput.d.ts.map +1 -1
- package/dist/components/RangeInput.js +6 -6
- package/dist/components/RangeSlider.d.ts.map +1 -1
- package/dist/components/RangeSlider.js +54 -32
- 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 +40 -35
- package/dist/components/SearchBar.d.ts +0 -4
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +17 -11
- package/dist/components/SearchBarWithSuggestions.js +4 -4
- package/dist/components/SearchLayout.d.ts.map +1 -1
- package/dist/components/SearchLayout.js +22 -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 +38 -39
- package/dist/components/primitives/ActionButtons.d.ts.map +1 -1
- package/dist/components/primitives/ActionButtons.js +34 -10
- package/dist/components/primitives/BadgeList.d.ts.map +1 -1
- package/dist/components/primitives/BadgeList.js +33 -13
- package/dist/components/primitives/ImageDisplay.d.ts.map +1 -1
- package/dist/components/primitives/ImageDisplay.js +32 -19
- package/dist/components/primitives/ImageZoom.d.ts.map +1 -1
- package/dist/components/primitives/ImageZoom.js +85 -30
- package/dist/components/primitives/VariantSelector.js +10 -10
- package/dist/components/primitives/VariantSwatches.d.ts.map +1 -1
- package/dist/components/primitives/VariantSwatches.js +28 -13
- package/dist/components/product-page/ProductGallery.d.ts +8 -1
- package/dist/components/product-page/ProductGallery.d.ts.map +1 -1
- package/dist/components/product-page/ProductGallery.js +2 -2
- 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/SectionSearchProvider.d.ts +3 -1
- package/dist/components/section-primitives/SectionSearchProvider.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionSearchProvider.js +3 -2
- 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 +78 -78
- 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 +40 -41
- 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/DropdownPanel.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/DropdownPanel.js +15 -2
- package/dist/components/suggestions-primitives/ItemCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemCard.js +48 -11
- package/dist/components/suggestions-primitives/ItemGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemGrid.js +18 -5
- package/dist/components/suggestions-primitives/ProductCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCard.js +36 -12
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +52 -20
- 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 +29 -10
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +8 -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 +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +166 -81
- package/dist/src/index.esm.js +2141 -1048
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +2142 -1049
- 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 +7 -7
- package/src/docsearch/docsearch.css +2 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCard.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/ProductCard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAA2C,MAAM,0BAA0B,CAAC;AACrG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductCard.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/ProductCard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAA2C,MAAM,0BAA0B,CAAC;AACrG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAwBjE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,CAAC;AAEnG,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,wDAAwD;IACxD,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,uFAAuF;IACvF,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,8BAA8B;IAC9B,qBAAqB,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;IAC1E,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sCAAsC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kGAAkG;IAClG,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACpD,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAsBD,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,YAAuB,EACvB,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,qBAAgC,EAChC,gBAAwB,EACxB,eAAuB,EACvB,aAAsB,EACtB,cAAoB,GACrB,EAAE,gBAAgB,qBAkNlB"}
|
|
@@ -8,6 +8,17 @@ import React, { useMemo } from 'react';
|
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { ImageDisplay } from '../primitives/ImageDisplay';
|
|
10
10
|
import { extractBadges, getPriceRange, findVariantBySelections } from '../suggestions/utils';
|
|
11
|
+
const TRANSITIONS = {
|
|
12
|
+
fast: '150ms ease-in-out',
|
|
13
|
+
normal: '200ms ease-in-out',
|
|
14
|
+
slow: '300ms ease-in-out',
|
|
15
|
+
};
|
|
16
|
+
const BORDER_RADIUS = {
|
|
17
|
+
sm: 4,
|
|
18
|
+
md: 6,
|
|
19
|
+
lg: 8,
|
|
20
|
+
full: 9999,
|
|
21
|
+
};
|
|
11
22
|
import { MinimalLayout, StandardLayout, DetailedLayout, CompactLayout, HorizontalLayout, } from './ProductCardLayouts';
|
|
12
23
|
const cardStyle = {
|
|
13
24
|
display: 'flex',
|
|
@@ -16,19 +27,19 @@ const cardStyle = {
|
|
|
16
27
|
padding: 8,
|
|
17
28
|
cursor: 'pointer',
|
|
18
29
|
border: 'none',
|
|
19
|
-
borderRadius:
|
|
30
|
+
borderRadius: `var(--seekora-border-radius, ${BORDER_RADIUS.md}px)`,
|
|
20
31
|
backgroundColor: 'transparent',
|
|
21
32
|
textAlign: 'left',
|
|
22
|
-
transition:
|
|
33
|
+
transition: `background-color ${TRANSITIONS.fast}, box-shadow ${TRANSITIONS.fast}`,
|
|
23
34
|
};
|
|
24
35
|
const imgStyle = {
|
|
25
36
|
width: '100%',
|
|
26
37
|
aspectRatio: '1',
|
|
27
38
|
objectFit: 'cover',
|
|
28
|
-
borderRadius:
|
|
39
|
+
borderRadius: BORDER_RADIUS.sm,
|
|
29
40
|
backgroundColor: 'var(--seekora-bg-secondary, #f3f4f6)',
|
|
30
41
|
};
|
|
31
|
-
export function ProductCard({ product, position, section, tabId, onSelect, className, style, imageVariant = 'single', displayConfig, onVariantHover, onVariantClick, selectedVariants, asLink, actionButtons, actionButtonsPosition = '
|
|
42
|
+
export function ProductCard({ product, position, section, tabId, onSelect, className, style, imageVariant = 'single', displayConfig, onVariantHover, onVariantClick, selectedVariants, asLink, actionButtons, actionButtonsPosition = 'inline', showActionLabels = false, enableImageZoom = false, imageZoomMode = 'both', imageZoomLevel = 2.5, }) {
|
|
32
43
|
// Find selected variant if selections are provided
|
|
33
44
|
const selectedVariant = useMemo(() => {
|
|
34
45
|
if (!selectedVariants || !product.options || !product.variants)
|
|
@@ -71,11 +82,21 @@ export function ProductCard({ product, position, section, tabId, onSelect, class
|
|
|
71
82
|
const images = effectiveImages;
|
|
72
83
|
const title = effectiveTitle;
|
|
73
84
|
const price = effectivePrice;
|
|
85
|
+
// Hover state for card
|
|
86
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
87
|
+
const cardHoverStyle = isHovered
|
|
88
|
+
? {
|
|
89
|
+
backgroundColor: 'var(--seekora-card-hover-bg, var(--seekora-bg-hover, #f9fafb))',
|
|
90
|
+
boxShadow: 'var(--seekora-card-hover-shadow, 0 2px 8px rgba(0, 0, 0, 0.08))',
|
|
91
|
+
}
|
|
92
|
+
: {};
|
|
74
93
|
// If no displayConfig, render original minimal layout (backwards compat)
|
|
75
94
|
if (!displayConfig) {
|
|
76
|
-
return (React.createElement("
|
|
77
|
-
e.
|
|
78
|
-
|
|
95
|
+
return (React.createElement("div", { role: "button", tabIndex: 0, className: clsx('seekora-suggestions-product-card', isHovered && 'seekora-suggestions-product-card--hover', className), style: { ...cardStyle, ...cardHoverStyle, ...style }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => onSelect(), onKeyDown: (e) => {
|
|
96
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
onSelect();
|
|
99
|
+
}
|
|
79
100
|
}, "data-position": position, "data-section": section, "data-tab-id": tabId },
|
|
80
101
|
images.length > 0 ? (React.createElement(ImageDisplay, { images: images, variant: imageVariant, alt: title, className: "seekora-suggestions-product-card-image", enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel })) : (React.createElement("div", { className: "seekora-suggestions-product-card-placeholder", style: imgStyle, "aria-hidden": true })),
|
|
81
102
|
React.createElement("span", { className: "seekora-suggestions-product-card-title", style: { fontSize: '0.875rem', fontWeight: 500 } }, title),
|
|
@@ -132,22 +153,25 @@ export function ProductCard({ product, position, section, tabId, onSelect, class
|
|
|
132
153
|
horizontal: HorizontalLayout,
|
|
133
154
|
};
|
|
134
155
|
const LayoutComponent = layoutMap[layoutStyle] ?? MinimalLayout;
|
|
135
|
-
const rootClassName = clsx('seekora-product-card', `seekora-product-card--${layoutStyle}`, 'seekora-suggestions-product-card', className);
|
|
156
|
+
const rootClassName = clsx('seekora-product-card', `seekora-product-card--${layoutStyle}`, 'seekora-suggestions-product-card', isHovered && 'seekora-product-card--hover', className);
|
|
136
157
|
const rootStyle = {
|
|
137
158
|
...cardStyle,
|
|
138
159
|
...(layoutStyle === 'horizontal' ? { flexDirection: 'row' } : {}),
|
|
160
|
+
...cardHoverStyle,
|
|
139
161
|
...style,
|
|
140
162
|
};
|
|
141
163
|
if (asLink && product.url) {
|
|
142
|
-
return (React.createElement("a", { href: product.url, className: rootClassName, style: { ...rootStyle, textDecoration: 'none', color: 'inherit' }, onClick: (e) => {
|
|
164
|
+
return (React.createElement("a", { href: product.url, className: rootClassName, style: { ...rootStyle, textDecoration: 'none', color: 'inherit' }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: (e) => {
|
|
143
165
|
e.preventDefault();
|
|
144
166
|
onSelect();
|
|
145
167
|
}, "data-position": position, "data-section": section, "data-tab-id": tabId },
|
|
146
168
|
React.createElement(LayoutComponent, { ...layoutProps })));
|
|
147
169
|
}
|
|
148
|
-
return (React.createElement("
|
|
149
|
-
e.
|
|
150
|
-
|
|
170
|
+
return (React.createElement("div", { role: "button", tabIndex: 0, className: rootClassName, style: rootStyle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => onSelect(), onKeyDown: (e) => {
|
|
171
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
onSelect();
|
|
174
|
+
}
|
|
151
175
|
}, "data-position": position, "data-section": section, "data-tab-id": tabId },
|
|
152
176
|
React.createElement(LayoutComponent, { ...layoutProps })));
|
|
153
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCardLayouts.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/ProductCardLayouts.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductCardLayouts.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/ProductCardLayouts.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAUjE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,aAAa,EAAE,oBAAoB,CAAC;IACpC,YAAY,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,CAAC;IAC3E,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,qBAAqB,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA0CD,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,WAAW,qBA0BxJ;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EACtF,aAAa,EAAE,qBAAqB,EAAE,gBAAgB,EACtD,eAAe,EAAE,aAAa,EAAE,cAAc,GAC/C,EAAE,WAAW,qBA8Eb;AAED,qGAAqG;AACrG,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAChF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EACtF,aAAa,EAAE,qBAAqB,EAAE,gBAAgB,EACtD,eAAe,EAAE,aAAa,EAAE,cAAc,GAC/C,EAAE,WAAW,qBAyGb;AAED,kDAAkD;AAClD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,WAAW,qBA+BxJ;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EACtF,aAAa,EAAE,qBAAqB,EAAE,gBAAgB,EACtD,eAAe,EAAE,aAAa,EAAE,cAAc,GAC/C,EAAE,WAAW,qBAmFb"}
|
|
@@ -11,58 +11,79 @@ import { BadgeList } from '../primitives/BadgeList';
|
|
|
11
11
|
import { RatingDisplay } from '../primitives/RatingDisplay';
|
|
12
12
|
import { VariantSwatches } from '../primitives/VariantSwatches';
|
|
13
13
|
import { ActionButtons } from '../primitives/ActionButtons';
|
|
14
|
+
import { useIsMobile, useResponsiveGap } from '../../utils/responsive';
|
|
15
|
+
const BORDER_RADIUS = {
|
|
16
|
+
sm: 4,
|
|
17
|
+
md: 6,
|
|
18
|
+
lg: 8,
|
|
19
|
+
full: 9999,
|
|
20
|
+
};
|
|
14
21
|
const imgPlaceholderStyle = {
|
|
15
22
|
width: '100%',
|
|
16
23
|
aspectRatio: '1',
|
|
17
24
|
objectFit: 'cover',
|
|
18
|
-
borderRadius:
|
|
25
|
+
borderRadius: BORDER_RADIUS.sm,
|
|
19
26
|
backgroundColor: 'var(--seekora-bg-secondary, #f3f4f6)',
|
|
20
27
|
};
|
|
21
28
|
function ImageBlock({ images, title, imageVariant, aspectRatio, enableZoom, zoomMode, zoomLevel }) {
|
|
22
|
-
const ar = aspectRatio
|
|
29
|
+
const ar = aspectRatio
|
|
30
|
+
? (aspectRatio.includes(':') ? aspectRatio.replace(':', '/') : aspectRatio)
|
|
31
|
+
: '1';
|
|
23
32
|
if (images.length > 0) {
|
|
24
|
-
return (React.createElement("div", { className: "seekora-product-card__image", style: { position: 'relative', overflow: 'hidden', borderRadius:
|
|
33
|
+
return (React.createElement("div", { className: "seekora-product-card__image", style: { position: 'relative', overflow: 'hidden', borderRadius: BORDER_RADIUS.sm } },
|
|
25
34
|
React.createElement(ImageDisplay, { images: images, variant: images.length > 1 ? imageVariant : 'single', alt: title, className: "seekora-suggestions-product-card-image", style: { aspectRatio: ar }, enableZoom: enableZoom, zoomMode: zoomMode, zoomLevel: zoomLevel })));
|
|
26
35
|
}
|
|
27
36
|
return React.createElement("div", { className: "seekora-product-card__image seekora-suggestions-product-card-placeholder", style: { ...imgPlaceholderStyle, aspectRatio: ar }, "aria-hidden": true });
|
|
28
37
|
}
|
|
29
38
|
/** minimal: image, title, price (current default behavior) */
|
|
30
39
|
export function MinimalLayout({ images, title, price, product, imageVariant, displayConfig, enableImageZoom, imageZoomMode, imageZoomLevel }) {
|
|
40
|
+
const isMobile = useIsMobile();
|
|
41
|
+
const titleFontSize = isMobile ? '0.9375rem' : '0.875rem'; // Slightly larger on mobile
|
|
42
|
+
const priceFontSize = isMobile ? '0.9375rem' : '0.875rem';
|
|
31
43
|
return (React.createElement(React.Fragment, null,
|
|
32
44
|
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: displayConfig.imageAspectRatio, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
33
|
-
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize:
|
|
34
|
-
price != null && !Number.isNaN(price) && (React.createElement("span", { className: "seekora-product-card__price seekora-suggestions-product-card-price", style: { fontSize:
|
|
45
|
+
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize: titleFontSize, fontWeight: 500, lineHeight: 1.4, overflow: 'hidden', textOverflow: 'ellipsis', display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical' } }, title),
|
|
46
|
+
price != null && !Number.isNaN(price) && (React.createElement("span", { className: "seekora-product-card__price seekora-suggestions-product-card-price", style: { fontSize: priceFontSize, color: 'var(--seekora-text-secondary, #6b7280)' } },
|
|
35
47
|
product.currency ?? '$',
|
|
36
48
|
price.toFixed(2)))));
|
|
37
49
|
}
|
|
38
50
|
/** standard: image, badges, brand, title, price + compare price, color swatches */
|
|
39
51
|
export function StandardLayout({ images, title, price, comparePrice, brand, badges, options, variants, product, imageVariant, displayConfig, onVariantHover, onVariantClick, selectedVariants, actionButtons, actionButtonsPosition, showActionLabels, enableImageZoom, imageZoomMode, imageZoomLevel, }) {
|
|
40
52
|
const cfg = displayConfig;
|
|
53
|
+
const isMobile = useIsMobile();
|
|
54
|
+
const bodyGap = isMobile ? 6 : 4; // More gap on mobile
|
|
55
|
+
const titleFontSize = isMobile ? '0.9375rem' : '0.875rem';
|
|
56
|
+
const brandFontSize = isMobile ? '0.8125rem' : '0.75rem';
|
|
57
|
+
const priceFontSize = isMobile ? '0.9375rem' : '0.875rem';
|
|
58
|
+
// Normalize position: 'overlay-*' positions render over image, everything else renders inline
|
|
59
|
+
const isOverlayPosition = actionButtonsPosition?.startsWith('overlay');
|
|
41
60
|
return (React.createElement(React.Fragment, null,
|
|
42
61
|
React.createElement("div", { style: { position: 'relative' } },
|
|
43
62
|
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: cfg.imageAspectRatio, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
44
63
|
cfg.showBadges !== false && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "top-left", maxBadges: 2 })),
|
|
45
|
-
actionButtons && actionButtons.length > 0 &&
|
|
46
|
-
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap:
|
|
47
|
-
cfg.showBrand !== false && brand && (React.createElement("span", { className: "seekora-product-card__brand", style: { fontSize:
|
|
48
|
-
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize:
|
|
64
|
+
actionButtons && actionButtons.length > 0 && isOverlayPosition && (React.createElement(ActionButtons, { buttons: actionButtons, position: actionButtonsPosition === 'overlay-top-right' ? 'top-right' : 'bottom-center', showLabels: showActionLabels, size: "small" }))),
|
|
65
|
+
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap: bodyGap } },
|
|
66
|
+
cfg.showBrand !== false && brand && (React.createElement("span", { className: "seekora-product-card__brand", style: { fontSize: brandFontSize, color: 'var(--seekora-text-secondary, #6b7280)', textTransform: 'uppercase', letterSpacing: '0.02em' } }, brand)),
|
|
67
|
+
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize: titleFontSize, fontWeight: 500, lineHeight: 1.4, overflow: 'hidden', textOverflow: 'ellipsis', display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical' } }, title),
|
|
49
68
|
React.createElement("div", { className: "seekora-product-card__price" },
|
|
50
|
-
React.createElement(PriceDisplay, { price: price ?? undefined, comparePrice: comparePrice ?? undefined, currency: cfg.currency ?? product.currency, currencyPosition: cfg.currencyPosition, priceDecimals: cfg.priceDecimals, showDiscount: cfg.showDiscount, style: { fontSize:
|
|
69
|
+
React.createElement(PriceDisplay, { price: price ?? undefined, comparePrice: comparePrice ?? undefined, currency: cfg.currency ?? product.currency, currencyPosition: cfg.currencyPosition, priceDecimals: cfg.priceDecimals, showDiscount: cfg.showDiscount, style: { fontSize: priceFontSize } })),
|
|
51
70
|
cfg.showVariants !== false && options.length > 0 && (React.createElement(VariantSwatches, { options: options, visibleOptions: cfg.variantOptionsToShow, maxValues: cfg.maxVariantValues, selectedValues: selectedVariants, variants: variants, onSwatchHover: onVariantHover, onSwatchClick: onVariantClick })),
|
|
52
|
-
actionButtons && actionButtons.length > 0 &&
|
|
71
|
+
actionButtons && actionButtons.length > 0 && !isOverlayPosition && (React.createElement(ActionButtons, { buttons: actionButtons, position: "inline", showLabels: showActionLabels, size: "small", layout: "horizontal" })))));
|
|
53
72
|
}
|
|
54
73
|
/** detailed: image, badges, brand, title, price + compare + discount, rating, all swatches, stock */
|
|
55
74
|
export function DetailedLayout({ images, title, price, comparePrice, brand, badges, priceRange, options, variants, product, imageVariant, displayConfig, onVariantHover, onVariantClick, selectedVariants, actionButtons, actionButtonsPosition, showActionLabels, enableImageZoom, imageZoomMode, imageZoomLevel, }) {
|
|
56
75
|
const cfg = displayConfig;
|
|
57
76
|
const available = product.available;
|
|
77
|
+
// Normalize position: 'overlay-*' positions render over image, everything else renders inline
|
|
78
|
+
const isOverlayPosition = actionButtonsPosition?.startsWith('overlay');
|
|
58
79
|
return (React.createElement(React.Fragment, null,
|
|
59
80
|
React.createElement("div", { style: { position: 'relative' } },
|
|
60
81
|
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: cfg.imageAspectRatio, enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
61
82
|
cfg.showBadges !== false && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "top-left" })),
|
|
62
|
-
actionButtons && actionButtons.length > 0 &&
|
|
83
|
+
actionButtons && actionButtons.length > 0 && isOverlayPosition && (React.createElement(ActionButtons, { buttons: actionButtons, position: actionButtonsPosition === 'overlay-top-right' ? 'top-right' : 'bottom-center', showLabels: showActionLabels, size: "small" }))),
|
|
63
84
|
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap: 4 } },
|
|
64
85
|
cfg.showBrand !== false && brand && (React.createElement("span", { className: "seekora-product-card__brand", style: { fontSize: '0.75rem', color: 'var(--seekora-text-secondary, #6b7280)', textTransform: 'uppercase', letterSpacing: '0.02em' } }, brand)),
|
|
65
|
-
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize: '0.875rem', fontWeight: 500 } }, title),
|
|
86
|
+
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize: '0.875rem', fontWeight: 500, lineHeight: 1.4, overflow: 'hidden', textOverflow: 'ellipsis' } }, title),
|
|
66
87
|
cfg.showRating !== false && product.rating != null && (React.createElement(RatingDisplay, { rating: product.rating, reviewCount: product.reviewCount, variant: "compact", size: "small", showNumeric: false, showReviewCount: true, className: "seekora-product-card__rating" })),
|
|
67
88
|
React.createElement("div", { className: "seekora-product-card__price" }, cfg.showPriceRange && priceRange ? (React.createElement(PriceDisplay, { priceRange: priceRange, currency: cfg.currency ?? product.currency, currencyPosition: cfg.currencyPosition, priceDecimals: cfg.priceDecimals, style: { fontSize: '0.875rem' } })) : (React.createElement(PriceDisplay, { price: price ?? undefined, comparePrice: comparePrice ?? undefined, currency: cfg.currency ?? product.currency, currencyPosition: cfg.currencyPosition, priceDecimals: cfg.priceDecimals, showDiscount: cfg.showDiscount, style: { fontSize: '0.875rem' } }))),
|
|
68
89
|
cfg.showVariants !== false && options.length > 0 && (React.createElement(VariantSwatches, { options: options, visibleOptions: cfg.variantOptionsToShow, maxValues: cfg.maxVariantValues, selectedValues: selectedVariants, variants: variants, onSwatchHover: onVariantHover, onSwatchClick: onVariantClick })),
|
|
@@ -70,7 +91,7 @@ export function DetailedLayout({ images, title, price, comparePrice, brand, badg
|
|
|
70
91
|
fontSize: '0.75rem',
|
|
71
92
|
color: available ? 'var(--seekora-success, #22c55e)' : 'var(--seekora-error, #ef4444)',
|
|
72
93
|
} }, available ? 'In Stock' : 'Out of Stock')),
|
|
73
|
-
actionButtons && actionButtons.length > 0 &&
|
|
94
|
+
actionButtons && actionButtons.length > 0 && !isOverlayPosition && (React.createElement(ActionButtons, { buttons: actionButtons, position: "inline", showLabels: showActionLabels, size: "small", layout: "horizontal" })))));
|
|
74
95
|
}
|
|
75
96
|
/** compact: smaller image, 1-line title, price */
|
|
76
97
|
export function CompactLayout({ images, title, price, product, imageVariant, displayConfig, enableImageZoom, imageZoomMode, imageZoomLevel }) {
|
|
@@ -90,16 +111,27 @@ export function CompactLayout({ images, title, price, product, imageVariant, dis
|
|
|
90
111
|
/** horizontal: image left + content right (title, brand, price, swatches) */
|
|
91
112
|
export function HorizontalLayout({ images, title, price, comparePrice, brand, badges, options, variants, product, imageVariant, displayConfig, onVariantHover, onVariantClick, selectedVariants, actionButtons, actionButtonsPosition, showActionLabels, enableImageZoom, imageZoomMode, imageZoomLevel, }) {
|
|
92
113
|
const cfg = displayConfig;
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
const isMobile = useIsMobile();
|
|
115
|
+
const containerGap = useResponsiveGap(12);
|
|
116
|
+
const bodyGap = isMobile ? 6 : 4;
|
|
117
|
+
// Responsive image dimensions
|
|
118
|
+
const imageMinWidth = isMobile ? 60 : 80;
|
|
119
|
+
const imageMaxWidth = isMobile ? 100 : 120;
|
|
120
|
+
const imageFlex = isMobile ? '20%' : '25%';
|
|
121
|
+
// Responsive font sizes
|
|
122
|
+
const brandFontSize = isMobile ? '0.6875rem' : '0.75rem';
|
|
123
|
+
const titleFontSize = isMobile ? '0.875rem' : '0.875rem';
|
|
124
|
+
const priceFontSize = isMobile ? '0.875rem' : '0.875rem';
|
|
125
|
+
return (React.createElement("div", { style: { display: 'flex', gap: containerGap, alignItems: 'flex-start' } },
|
|
126
|
+
React.createElement("div", { style: { position: 'relative', minWidth: imageMinWidth, flexBasis: imageFlex, maxWidth: imageMaxWidth, flexShrink: 0 } },
|
|
95
127
|
React.createElement(ImageBlock, { images: images, title: title, imageVariant: imageVariant, aspectRatio: "1:1", enableZoom: enableImageZoom, zoomMode: imageZoomMode, zoomLevel: imageZoomLevel }),
|
|
96
128
|
cfg.showBadges !== false && badges.length > 0 && (React.createElement(BadgeList, { badges: badges, position: "top-left", maxBadges: 1 })),
|
|
97
129
|
actionButtons && actionButtons.length > 0 && actionButtonsPosition?.startsWith('overlay') && (React.createElement(ActionButtons, { buttons: actionButtons, position: actionButtonsPosition === 'overlay-top-right' ? 'top-right' : 'bottom-center', showLabels: showActionLabels, size: "small" }))),
|
|
98
|
-
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap:
|
|
99
|
-
cfg.showBrand !== false && brand && (React.createElement("span", { className: "seekora-product-card__brand", style: { fontSize:
|
|
100
|
-
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize:
|
|
130
|
+
React.createElement("div", { className: "seekora-product-card__body", style: { display: 'flex', flexDirection: 'column', gap: bodyGap, flex: 1, minWidth: 0 } },
|
|
131
|
+
cfg.showBrand !== false && brand && (React.createElement("span", { className: "seekora-product-card__brand", style: { fontSize: brandFontSize, color: 'var(--seekora-text-secondary, #6b7280)', textTransform: 'uppercase' } }, brand)),
|
|
132
|
+
React.createElement("span", { className: "seekora-product-card__title", style: { fontSize: titleFontSize, fontWeight: 500, lineHeight: 1.4, overflow: 'hidden', textOverflow: 'ellipsis', display: '-webkit-box', WebkitLineClamp: isMobile ? 3 : 2, WebkitBoxOrient: 'vertical' } }, title),
|
|
101
133
|
React.createElement("div", { className: "seekora-product-card__price" },
|
|
102
|
-
React.createElement(PriceDisplay, { price: price ?? undefined, comparePrice: comparePrice ?? undefined, currency: cfg.currency ?? product.currency, currencyPosition: cfg.currencyPosition, priceDecimals: cfg.priceDecimals, showDiscount: cfg.showDiscount, style: { fontSize:
|
|
134
|
+
React.createElement(PriceDisplay, { price: price ?? undefined, comparePrice: comparePrice ?? undefined, currency: cfg.currency ?? product.currency, currencyPosition: cfg.currencyPosition, priceDecimals: cfg.priceDecimals, showDiscount: cfg.showDiscount, style: { fontSize: priceFontSize } })),
|
|
103
135
|
cfg.showVariants !== false && options.length > 0 && (React.createElement(VariantSwatches, { options: options, visibleOptions: cfg.variantOptionsToShow, maxValues: cfg.maxVariantValues ?? 3, selectedValues: selectedVariants, variants: variants, onSwatchHover: onVariantHover, onSwatchClick: onVariantClick })),
|
|
104
136
|
actionButtons && actionButtons.length > 0 && actionButtonsPosition === 'inline' && (React.createElement(ActionButtons, { buttons: actionButtons, position: "inline", showLabels: showActionLabels, size: "small", layout: "horizontal" })))));
|
|
105
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductGrid.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/ProductGrid.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductGrid.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/ProductGrid.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,0DAA0D;IAC1D,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9D;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAY,EACZ,MAAmB,EACnB,OAAW,EACX,SAAS,EACT,KAAK,EACL,aAAa,EACb,aAAa,EACb,cAAc,GACf,EAAE,gBAAgB,4BAwDlB"}
|
|
@@ -7,8 +7,13 @@ import React, { useMemo } from 'react';
|
|
|
7
7
|
import { useSuggestionsContext } from './SuggestionsContext';
|
|
8
8
|
import { ProductCard } from './ProductCard';
|
|
9
9
|
import { clsx } from 'clsx';
|
|
10
|
+
import { useResponsiveColumns, useResponsiveGap, useResponsivePadding } from '../../utils/responsive';
|
|
10
11
|
export function ProductGrid({ maxItems = 8, source = 'trending', columns = 4, className, style, gridClassName, displayConfig, onVariantHover, }) {
|
|
11
12
|
const { trendingProducts, filteredTabs, activeTabId, selectProduct, getAllNavigableItems, } = useSuggestionsContext();
|
|
13
|
+
// Responsive columns and spacing
|
|
14
|
+
const responsiveColumns = useResponsiveColumns(columns);
|
|
15
|
+
const responsiveGap = useResponsiveGap(12);
|
|
16
|
+
const responsivePadding = useResponsivePadding(12);
|
|
12
17
|
const products = useMemo(() => {
|
|
13
18
|
if (source === 'trending')
|
|
14
19
|
return trendingProducts;
|
|
@@ -22,9 +27,9 @@ export function ProductGrid({ maxItems = 8, source = 'trending', columns = 4, cl
|
|
|
22
27
|
return null;
|
|
23
28
|
const gridStyle = {
|
|
24
29
|
display: 'grid',
|
|
25
|
-
gridTemplateColumns: `repeat(${
|
|
26
|
-
gap:
|
|
27
|
-
padding:
|
|
30
|
+
gridTemplateColumns: `repeat(${responsiveColumns}, minmax(0, 1fr))`,
|
|
31
|
+
gap: responsiveGap,
|
|
32
|
+
padding: responsivePadding,
|
|
28
33
|
};
|
|
29
34
|
return (React.createElement("div", { className: clsx('seekora-suggestions-product-grid', className), style: style },
|
|
30
35
|
React.createElement("div", { className: clsx('seekora-suggestions-product-grid-inner', gridClassName), style: gridStyle }, items.map((product, i) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecentSearchesList.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/RecentSearchesList.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CAC7F;
|
|
1
|
+
{"version":3,"file":"RecentSearchesList.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/RecentSearchesList.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CAC7F;AAwCD,wBAAgB,kBAAkB,CAAC,EACjC,KAAgB,EAChB,QAAY,EACZ,SAAS,EACT,KAAK,EACL,aAAa,EACb,UAAU,GACX,EAAE,uBAAuB,4BAiCzB"}
|
|
@@ -18,6 +18,17 @@ const itemStyle = {
|
|
|
18
18
|
color: 'var(--seekora-text-primary, #111827)',
|
|
19
19
|
transition: 'background-color 120ms ease',
|
|
20
20
|
};
|
|
21
|
+
function RecentSearchItem({ search, onSelect }) {
|
|
22
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
23
|
+
return (React.createElement("li", null,
|
|
24
|
+
React.createElement("button", { type: "button", className: clsx('seekora-suggestions-recent-item', isHovered && 'seekora-suggestions-recent-item--hover'), style: {
|
|
25
|
+
...itemStyle,
|
|
26
|
+
...(isHovered ? { backgroundColor: 'var(--seekora-bg-hover, #f3f4f6)' } : {}),
|
|
27
|
+
}, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onMouseDown: (e) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
onSelect();
|
|
30
|
+
} }, search.query)));
|
|
31
|
+
}
|
|
21
32
|
export function RecentSearchesList({ title = 'Recent', maxItems = 8, className, style, listClassName, renderItem, }) {
|
|
22
33
|
const { recentSearches, query, selectRecentSearch } = useSuggestionsContext();
|
|
23
34
|
const items = recentSearches.slice(0, maxItems);
|
|
@@ -30,10 +41,6 @@ export function RecentSearchesList({ title = 'Recent', maxItems = 8, className,
|
|
|
30
41
|
if (renderItem) {
|
|
31
42
|
return React.createElement("li", { key: `${search.query}-${search.timestamp}` }, renderItem(search, i, onSelect));
|
|
32
43
|
}
|
|
33
|
-
return (React.createElement(
|
|
34
|
-
React.createElement("button", { type: "button", className: "seekora-suggestions-recent-item", style: itemStyle, onMouseDown: (e) => {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
onSelect();
|
|
37
|
-
} }, search.query)));
|
|
44
|
+
return (React.createElement(RecentSearchItem, { key: `${search.query}-${search.timestamp}`, search: search, onSelect: onSelect }));
|
|
38
45
|
}))));
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/SearchInput.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/SearchInput.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAyBnD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,0FAA0F;IAC1F,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,wBAAgB,WAAW,CAAC,EAC1B,WAAkC,EAClC,SAAiB,EACjB,eAAsB,EACtB,WAAkB,EAClB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,EACd,UAAU,EACV,SAAoB,GACrB,EAAE,gBAAgB,qBA+GlB"}
|
|
@@ -7,6 +7,24 @@
|
|
|
7
7
|
import React, { useRef, useCallback } from 'react';
|
|
8
8
|
import { useSuggestionsContext } from './SuggestionsContext';
|
|
9
9
|
import { clsx } from 'clsx';
|
|
10
|
+
const SPACING = {
|
|
11
|
+
xs: 4,
|
|
12
|
+
sm: 8,
|
|
13
|
+
md: 12,
|
|
14
|
+
lg: 16,
|
|
15
|
+
xl: 24,
|
|
16
|
+
};
|
|
17
|
+
const TRANSITIONS = {
|
|
18
|
+
fast: '150ms ease-in-out',
|
|
19
|
+
normal: '200ms ease-in-out',
|
|
20
|
+
slow: '300ms ease-in-out',
|
|
21
|
+
};
|
|
22
|
+
const BORDER_RADIUS = {
|
|
23
|
+
sm: 4,
|
|
24
|
+
md: 6,
|
|
25
|
+
lg: 8,
|
|
26
|
+
full: 9999,
|
|
27
|
+
};
|
|
10
28
|
const defaultStyles = {
|
|
11
29
|
position: 'relative',
|
|
12
30
|
width: '100%',
|
|
@@ -14,25 +32,26 @@ const defaultStyles = {
|
|
|
14
32
|
const inputWrapperStyles = {
|
|
15
33
|
display: 'flex',
|
|
16
34
|
alignItems: 'center',
|
|
17
|
-
gap:
|
|
18
|
-
padding:
|
|
19
|
-
border: '1px solid var(--seekora-border-color,
|
|
20
|
-
borderRadius:
|
|
21
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
22
|
-
transition:
|
|
35
|
+
gap: `${SPACING.sm}px`,
|
|
36
|
+
padding: `${SPACING.sm}px ${SPACING.md}px`,
|
|
37
|
+
border: '1px solid var(--seekora-border-color, rgba(0,0,0,0.1))',
|
|
38
|
+
borderRadius: `var(--seekora-border-radius, ${BORDER_RADIUS.md}px)`,
|
|
39
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
40
|
+
transition: `border-color ${TRANSITIONS.fast}, box-shadow ${TRANSITIONS.fast}`,
|
|
41
|
+
boxSizing: 'border-box',
|
|
23
42
|
};
|
|
24
43
|
const inputStyles = {
|
|
25
44
|
flex: 1,
|
|
26
45
|
minWidth: 0,
|
|
27
|
-
padding:
|
|
46
|
+
padding: `${SPACING.sm}px 0`,
|
|
28
47
|
border: 'none',
|
|
29
48
|
outline: 'none',
|
|
30
49
|
backgroundColor: 'transparent',
|
|
31
50
|
fontSize: 'inherit',
|
|
32
|
-
color: 'var(--seekora-text-primary,
|
|
51
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
33
52
|
fontFamily: 'inherit',
|
|
34
53
|
};
|
|
35
|
-
export function SearchInput({ placeholder = '
|
|
54
|
+
export function SearchInput({ placeholder = 'Powered by Seekora', autoFocus = false, showClearButton = true, closeOnBlur = true, leftIcon, className, style, inputClassName, inputStyle, ariaLabel = 'Search', }) {
|
|
36
55
|
const { query, setQuery, isOpen, setIsOpen, navigateNext, navigatePrev, selectActive, close, } = useSuggestionsContext();
|
|
37
56
|
const inputRef = useRef(null);
|
|
38
57
|
const handleFocus = useCallback(() => {
|
|
@@ -78,7 +97,7 @@ export function SearchInput({ placeholder = 'Search...', autoFocus = false, show
|
|
|
78
97
|
leftIcon ? (React.createElement("span", { className: "seekora-suggestions-input-left-icon", style: { display: 'flex', flexShrink: 0, color: 'var(--seekora-text-secondary, #6b7280)' } }, leftIcon)) : null,
|
|
79
98
|
React.createElement("input", { ref: inputRef, type: "text", value: query, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown, placeholder: placeholder, autoFocus: autoFocus, autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, "aria-label": ariaLabel, "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-autocomplete": "list", role: "combobox", className: clsx('seekora-suggestions-input', inputClassName), style: { ...inputStyles, ...inputStyle } }),
|
|
80
99
|
showClearButton && query ? (React.createElement("button", { type: "button", onClick: handleClear, className: "seekora-suggestions-input-clear", "aria-label": "Clear search", style: {
|
|
81
|
-
padding:
|
|
100
|
+
padding: 8,
|
|
82
101
|
border: 'none',
|
|
83
102
|
background: 'transparent',
|
|
84
103
|
cursor: 'pointer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestionItem.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/SuggestionItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAErF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,2FAA2F;IAC3F,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,8FAA8F;IAC9F,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACrD;
|
|
1
|
+
{"version":3,"file":"SuggestionItem.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/SuggestionItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAErF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,2FAA2F;IAC3F,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,8FAA8F;IAC9F,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACrD;AAmBD,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,KAAK,EACL,qBAA4B,EAC5B,sBAAsB,EACtB,eAAe,GAChB,EAAE,mBAAmB,qBA8CrB"}
|
|
@@ -21,19 +21,24 @@ const defaultItemStyle = {
|
|
|
21
21
|
backgroundColor: 'transparent',
|
|
22
22
|
color: 'var(--seekora-text-primary, #111827)',
|
|
23
23
|
transition: 'background-color 120ms ease',
|
|
24
|
+
overflow: 'hidden',
|
|
25
|
+
textOverflow: 'ellipsis',
|
|
26
|
+
whiteSpace: 'nowrap',
|
|
24
27
|
};
|
|
25
28
|
export function SuggestionItem({ suggestion, index, isActive, onSelect, className, style, enableHighlightMarkup = true, highlightMarkupOptions, renderHighlight, }) {
|
|
29
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
26
30
|
const displayText = suggestion.highlightedQuery ?? suggestion.query;
|
|
27
31
|
const content = renderHighlight != null
|
|
28
32
|
? renderHighlight(displayText)
|
|
29
33
|
: enableHighlightMarkup
|
|
30
34
|
? parseHighlightMarkup(displayText ?? '', highlightMarkupOptions)
|
|
31
35
|
: (suggestion.query ?? displayText ?? '');
|
|
32
|
-
|
|
36
|
+
const showHighlight = isActive || isHovered;
|
|
37
|
+
return (React.createElement("li", { role: "option", "aria-selected": isActive, id: `seekora-suggestion-${index}`, className: clsx('seekora-suggestions-item', isActive && 'seekora-suggestions-item--active', isHovered && 'seekora-suggestions-item--hover', className), style: {
|
|
33
38
|
...defaultItemStyle,
|
|
34
|
-
...(
|
|
39
|
+
...(showHighlight ? { backgroundColor: 'var(--seekora-bg-hover, #f3f4f6)' } : {}),
|
|
35
40
|
...style,
|
|
36
|
-
}, onMouseDown: (e) => {
|
|
41
|
+
}, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onMouseDown: (e) => {
|
|
37
42
|
e.preventDefault();
|
|
38
43
|
onSelect();
|
|
39
44
|
} },
|
|
@@ -12,13 +12,6 @@ export interface SuggestionListProps {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
listClassName?: string;
|
|
15
|
-
/**
|
|
16
|
-
* When true, show a loading state when fetching and no previous suggestions exist.
|
|
17
|
-
* When false (default), show previous results until new results render; no loading screen.
|
|
18
|
-
*/
|
|
19
|
-
showLoadingState?: boolean;
|
|
20
|
-
/** Custom render for loading state (only when showLoadingState is true and loading with no items). */
|
|
21
|
-
renderLoading?: () => React.ReactNode;
|
|
22
15
|
/**
|
|
23
16
|
* When true (default), suggestion text with <mark>...</mark> is rendered
|
|
24
17
|
* with those segments highlighted. When false, plain text is shown.
|
|
@@ -29,5 +22,5 @@ export interface SuggestionListProps {
|
|
|
29
22
|
highlightMarkupOptions?: HighlightMarkupOptions;
|
|
30
23
|
renderItem?: (suggestion: import('@seekora-ai/ui-sdk-types').SuggestionItem, index: number, isActive: boolean, onSelect: () => void) => React.ReactNode;
|
|
31
24
|
}
|
|
32
|
-
export declare function SuggestionList({ maxItems, className, style, listClassName,
|
|
25
|
+
export declare function SuggestionList({ maxItems, className, style, listClassName, enableHighlightMarkup, highlightMarkupOptions, renderItem, }: SuggestionListProps): React.JSX.Element | null;
|
|
33
26
|
//# sourceMappingURL=SuggestionList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestionList.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/SuggestionList.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB
|
|
1
|
+
{"version":3,"file":"SuggestionList.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/SuggestionList.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mGAAmG;IACnG,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,UAAU,CAAC,EAAE,CACX,UAAU,EAAE,OAAO,0BAA0B,EAAE,cAAc,EAC7D,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,IAAI,KACjB,KAAK,CAAC,SAAS,CAAC;CACtB;AAOD,wBAAgB,cAAc,CAAC,EAC7B,QAAa,EACb,SAAS,EACT,KAAK,EACL,aAAa,EACb,qBAA4B,EAC5B,sBAAsB,EACtB,UAAU,GACX,EAAE,mBAAmB,4BA+CrB"}
|
|
@@ -13,18 +13,12 @@ const listStyle = {
|
|
|
13
13
|
margin: 0,
|
|
14
14
|
padding: '4px 0',
|
|
15
15
|
};
|
|
16
|
-
export function SuggestionList({ maxItems = 10, className, style, listClassName,
|
|
16
|
+
export function SuggestionList({ maxItems = 10, className, style, listClassName, enableHighlightMarkup = true, highlightMarkupOptions, renderItem, }) {
|
|
17
17
|
const { suggestions, activeIndex, loading, selectSuggestion, getAllNavigableItems, } = useSuggestionsContext();
|
|
18
18
|
const items = suggestions.slice(0, maxItems);
|
|
19
19
|
const navigableItems = getAllNavigableItems();
|
|
20
20
|
const suggestionStartIndex = navigableItems.findIndex((n) => n.type === 'suggestion');
|
|
21
21
|
const activeIsInSuggestions = suggestionStartIndex >= 0 && activeIndex >= suggestionStartIndex && activeIndex < suggestionStartIndex + items.length;
|
|
22
|
-
// When loading with no previous results, show loading only if showLoadingState (default: don't show loading screen)
|
|
23
|
-
if (loading && items.length === 0 && showLoadingState) {
|
|
24
|
-
if (renderLoading)
|
|
25
|
-
return React.createElement(React.Fragment, null, renderLoading());
|
|
26
|
-
return (React.createElement("div", { className: clsx('seekora-suggestions-loading', className), style: { padding: 16, color: 'var(--seekora-text-secondary, #6b7280)', fontSize: '0.875rem', ...style } }, "Loading..."));
|
|
27
|
-
}
|
|
28
22
|
// When loading with previous results, show previous results (no loading UI)
|
|
29
23
|
if (items.length === 0)
|
|
30
24
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrendingList.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/TrendingList.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CACjG;
|
|
1
|
+
{"version":3,"file":"TrendingList.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/TrendingList.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CACjG;AA2CD,wBAAgB,YAAY,CAAC,EAC3B,KAAkB,EAClB,QAAY,EACZ,SAAS,EACT,KAAK,EACL,aAAa,EACb,UAAU,GACX,EAAE,iBAAiB,4BAiCnB"}
|
|
@@ -18,6 +18,19 @@ const itemStyle = {
|
|
|
18
18
|
color: 'var(--seekora-text-primary, #111827)',
|
|
19
19
|
transition: 'background-color 120ms ease',
|
|
20
20
|
};
|
|
21
|
+
function TrendingItem({ trending, onSelect }) {
|
|
22
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
23
|
+
return (React.createElement("li", null,
|
|
24
|
+
React.createElement("button", { type: "button", className: clsx('seekora-suggestions-trending-item', isHovered && 'seekora-suggestions-trending-item--hover'), style: {
|
|
25
|
+
...itemStyle,
|
|
26
|
+
...(isHovered ? { backgroundColor: 'var(--seekora-bg-hover, #f3f4f6)' } : {}),
|
|
27
|
+
}, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onMouseDown: (e) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
onSelect();
|
|
30
|
+
} },
|
|
31
|
+
trending.query,
|
|
32
|
+
trending.count != null ? (React.createElement("span", { style: { marginLeft: 8, color: 'var(--seekora-text-secondary, #6b7280)', fontSize: '0.875em' } }, trending.count)) : null)));
|
|
33
|
+
}
|
|
21
34
|
export function TrendingList({ title = 'Trending', maxItems = 8, className, style, listClassName, renderItem, }) {
|
|
22
35
|
const { trendingSearches, selectTrendingSearch } = useSuggestionsContext();
|
|
23
36
|
const items = trendingSearches.slice(0, maxItems);
|
|
@@ -30,12 +43,6 @@ export function TrendingList({ title = 'Trending', maxItems = 8, className, styl
|
|
|
30
43
|
if (renderItem) {
|
|
31
44
|
return React.createElement("li", { key: `${trending.query}-${i}` }, renderItem(trending, i, onSelect));
|
|
32
45
|
}
|
|
33
|
-
return (React.createElement(
|
|
34
|
-
React.createElement("button", { type: "button", className: "seekora-suggestions-trending-item", style: itemStyle, onMouseDown: (e) => {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
onSelect();
|
|
37
|
-
} },
|
|
38
|
-
trending.query,
|
|
39
|
-
trending.count != null ? (React.createElement("span", { style: { marginLeft: 8, color: 'var(--seekora-text-secondary, #6b7280)', fontSize: '0.875em' } }, trending.count)) : null)));
|
|
46
|
+
return (React.createElement(TrendingItem, { key: `${trending.query}-${i}`, trending: trending, onSelect: onSelect }));
|
|
40
47
|
}))));
|
|
41
48
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Generic: ItemCard, ItemGrid (domain-agnostic).
|
|
5
5
|
* E-commerce: ProductCard, ProductGrid.
|
|
6
6
|
* Suggestions: SearchInput, SuggestionList, SuggestionItem, CategoriesTabs,
|
|
7
|
-
* RecentSearchesList, TrendingList, DropdownPanel,
|
|
7
|
+
* RecentSearchesList, TrendingList, DropdownPanel, SuggestionsError.
|
|
8
8
|
*/
|
|
9
9
|
export { SuggestionsContext, useSuggestionsContext } from './SuggestionsContext';
|
|
10
10
|
export type { SuggestionsContextValue } from './SuggestionsContext';
|
|
@@ -32,8 +32,6 @@ export { RecentSearchesList } from './RecentSearchesList';
|
|
|
32
32
|
export type { RecentSearchesListProps } from './RecentSearchesList';
|
|
33
33
|
export { TrendingList } from './TrendingList';
|
|
34
34
|
export type { TrendingListProps } from './TrendingList';
|
|
35
|
-
export { SuggestionsLoading } from './SuggestionsLoading';
|
|
36
|
-
export type { SuggestionsLoadingProps } from './SuggestionsLoading';
|
|
37
35
|
export { SuggestionsError } from './SuggestionsError';
|
|
38
36
|
export type { SuggestionsErrorProps } from './SuggestionsError';
|
|
39
37
|
export { SuggestionsDropdownComposition } from './SuggestionsDropdownComposition';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACjF,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC9H,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions-primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACjF,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC9H,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,YAAY,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Generic: ItemCard, ItemGrid (domain-agnostic).
|
|
5
5
|
* E-commerce: ProductCard, ProductGrid.
|
|
6
6
|
* Suggestions: SearchInput, SuggestionList, SuggestionItem, CategoriesTabs,
|
|
7
|
-
* RecentSearchesList, TrendingList, DropdownPanel,
|
|
7
|
+
* RecentSearchesList, TrendingList, DropdownPanel, SuggestionsError.
|
|
8
8
|
*/
|
|
9
9
|
export { SuggestionsContext, useSuggestionsContext } from './SuggestionsContext';
|
|
10
10
|
export { SuggestionsProvider } from './SuggestionsProvider';
|
|
@@ -20,6 +20,5 @@ export { ProductGrid } from './ProductGrid';
|
|
|
20
20
|
export { CategoriesTabs } from './CategoriesTabs';
|
|
21
21
|
export { RecentSearchesList } from './RecentSearchesList';
|
|
22
22
|
export { TrendingList } from './TrendingList';
|
|
23
|
-
export { SuggestionsLoading } from './SuggestionsLoading';
|
|
24
23
|
export { SuggestionsError } from './SuggestionsError';
|
|
25
24
|
export { SuggestionsDropdownComposition } from './SuggestionsDropdownComposition';
|