@seekora-ai/ui-sdk-react 0.2.13 → 0.2.15
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 +22 -2
- package/dist/components/CurrentRefinements.d.ts.map +1 -1
- package/dist/components/CurrentRefinements.js +259 -47
- package/dist/components/FacetDropdown.d.ts +92 -0
- package/dist/components/FacetDropdown.d.ts.map +1 -0
- package/dist/components/FacetDropdown.js +374 -0
- package/dist/components/Facets.d.ts +56 -1
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +602 -41
- package/dist/components/FederatedDropdown.d.ts.map +1 -1
- package/dist/components/FederatedDropdown.js +45 -31
- package/dist/components/HierarchicalMenu.d.ts.map +1 -1
- package/dist/components/HierarchicalMenu.js +112 -4
- package/dist/components/Pagination.d.ts +47 -1
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +166 -28
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -1
- package/dist/components/QuerySuggestionsDropdown.js +32 -18
- 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 +101 -32
- package/dist/components/RichQuerySuggestions.d.ts +7 -0
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +40 -26
- package/dist/components/SearchBar.d.ts +16 -0
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +139 -17
- package/dist/components/SearchBarWithSuggestions.js +3 -3
- package/dist/components/SearchLayout.d.ts.map +1 -1
- package/dist/components/SearchLayout.js +10 -1
- package/dist/components/SearchProvider.d.ts +8 -1
- package/dist/components/SearchProvider.d.ts.map +1 -1
- package/dist/components/SearchProvider.js +16 -4
- package/dist/components/SearchResults.d.ts +10 -0
- package/dist/components/SearchResults.d.ts.map +1 -1
- package/dist/components/SearchResults.js +46 -30
- package/dist/components/SortBy.d.ts +44 -4
- package/dist/components/SortBy.d.ts.map +1 -1
- package/dist/components/SortBy.js +154 -29
- package/dist/components/Stats.d.ts +14 -0
- package/dist/components/Stats.d.ts.map +1 -1
- package/dist/components/Stats.js +172 -23
- 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 +11 -8
- package/dist/components/primitives/ImageZoom.js +26 -26
- package/dist/components/primitives/VariantSelector.js +10 -10
- package/dist/components/primitives/VariantSwatches.js +3 -3
- 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/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/suggestions/AmazonDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/AmazonDropdown.js +2 -4
- package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/GoogleDropdown.js +2 -6
- package/dist/components/suggestions/MinimalDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MinimalDropdown.js +2 -4
- package/dist/components/suggestions/MobileSheetDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MobileSheetDropdown.js +20 -22
- package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/PinterestDropdown.js +2 -6
- package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/ShopifyDropdown.js +39 -41
- package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/SpotlightDropdown.js +2 -4
- package/dist/components/suggestions/utils.d.ts +10 -1
- package/dist/components/suggestions/utils.d.ts.map +1 -1
- package/dist/components/suggestions/utils.js +36 -0
- 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 +21 -8
- package/dist/components/suggestions-primitives/ItemGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemGrid.js +9 -3
- package/dist/components/suggestions-primitives/ProductCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCard.js +25 -10
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +24 -12
- package/dist/components/suggestions-primitives/SearchInput.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SearchInput.js +28 -9
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +3 -0
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts +16 -4
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/highlightMarkup.js +42 -4
- package/dist/hooks/useClickTracking.d.ts +36 -0
- package/dist/hooks/useClickTracking.d.ts.map +1 -0
- package/dist/hooks/useClickTracking.js +96 -0
- package/dist/hooks/useExperiment.d.ts +25 -0
- package/dist/hooks/useExperiment.d.ts.map +1 -0
- package/dist/hooks/useExperiment.js +146 -0
- package/dist/hooks/useKeyboardNavigation.d.ts +51 -0
- package/dist/hooks/useKeyboardNavigation.d.ts.map +1 -0
- package/dist/hooks/useKeyboardNavigation.js +113 -0
- package/dist/hooks/useQuerySuggestions.d.ts.map +1 -1
- package/dist/hooks/useQuerySuggestions.js +19 -3
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts.map +1 -1
- package/dist/hooks/useQuerySuggestionsEnhanced.js +23 -6
- package/dist/hooks/useSuggestionsAnalytics.d.ts.map +1 -1
- package/dist/hooks/useSuggestionsAnalytics.js +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +345 -19
- package/dist/src/index.esm.js +2869 -787
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +2868 -785
- package/dist/src/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederatedDropdown.d.ts","sourceRoot":"","sources":["../../src/components/FederatedDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EAEZ,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"FederatedDropdown.d.ts","sourceRoot":"","sources":["../../src/components/FederatedDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EAEZ,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAuBlC,MAAM,WAAW,sBAAuB,SAAQ,6BAA6B;IAC3E,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC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,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAC;IACrE,qBAAqB;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,6BAA6B;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iDAAiD;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+EAA+E;IAC/E,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAsRD,eAAO,MAAM,iBAAiB,qGAye7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -15,20 +15,34 @@ import { useSearchContext } from './SearchProvider';
|
|
|
15
15
|
import { useQuerySuggestionsEnhanced } from '../hooks/useQuerySuggestionsEnhanced';
|
|
16
16
|
import { clsx } from 'clsx';
|
|
17
17
|
// ============================================================================
|
|
18
|
+
// Constants
|
|
19
|
+
// ============================================================================
|
|
20
|
+
const TRANSITIONS = {
|
|
21
|
+
fast: '150ms ease-in-out',
|
|
22
|
+
normal: '200ms ease-in-out',
|
|
23
|
+
slow: '300ms ease-in-out',
|
|
24
|
+
};
|
|
25
|
+
const BORDER_RADIUS = {
|
|
26
|
+
sm: 4,
|
|
27
|
+
md: 6,
|
|
28
|
+
lg: 8,
|
|
29
|
+
full: 9999,
|
|
30
|
+
};
|
|
31
|
+
// ============================================================================
|
|
18
32
|
// Styles
|
|
19
33
|
// ============================================================================
|
|
20
34
|
const styles = {
|
|
21
35
|
container: {
|
|
22
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
23
|
-
border: '1px solid var(--seekora-border-color,
|
|
24
|
-
borderRadius:
|
|
36
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
37
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
38
|
+
borderRadius: `var(--seekora-border-radius-lg, ${BORDER_RADIUS.lg * 1.5}px)`,
|
|
25
39
|
boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
|
|
26
40
|
overflow: 'hidden',
|
|
27
41
|
},
|
|
28
42
|
header: {
|
|
29
43
|
padding: '12px 20px',
|
|
30
|
-
borderBottom: '1px solid var(--seekora-border-color,
|
|
31
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
44
|
+
borderBottom: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
45
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
32
46
|
},
|
|
33
47
|
content: {
|
|
34
48
|
display: 'flex',
|
|
@@ -38,13 +52,13 @@ const styles = {
|
|
|
38
52
|
flexDirection: 'column',
|
|
39
53
|
},
|
|
40
54
|
suggestionsColumn: {
|
|
41
|
-
borderRight: '1px solid var(--seekora-border-color,
|
|
55
|
+
borderRight: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
42
56
|
overflowY: 'auto',
|
|
43
57
|
},
|
|
44
58
|
productsColumn: {
|
|
45
59
|
flex: 1,
|
|
46
60
|
overflowY: 'auto',
|
|
47
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
61
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
48
62
|
},
|
|
49
63
|
section: {
|
|
50
64
|
padding: '12px 0',
|
|
@@ -75,7 +89,7 @@ const styles = {
|
|
|
75
89
|
alignItems: 'center',
|
|
76
90
|
padding: '10px 20px',
|
|
77
91
|
cursor: 'pointer',
|
|
78
|
-
transition:
|
|
92
|
+
transition: `background-color ${TRANSITIONS.fast}`,
|
|
79
93
|
gap: '12px',
|
|
80
94
|
},
|
|
81
95
|
suggestionItemActive: {
|
|
@@ -90,7 +104,7 @@ const styles = {
|
|
|
90
104
|
suggestionText: {
|
|
91
105
|
flex: 1,
|
|
92
106
|
fontSize: '14px',
|
|
93
|
-
color: 'var(--seekora-text-primary,
|
|
107
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
94
108
|
fontWeight: 500,
|
|
95
109
|
overflow: 'hidden',
|
|
96
110
|
textOverflow: 'ellipsis',
|
|
@@ -114,7 +128,7 @@ const styles = {
|
|
|
114
128
|
display: 'flex',
|
|
115
129
|
gap: '4px',
|
|
116
130
|
padding: '12px 20px',
|
|
117
|
-
borderBottom: '1px solid var(--seekora-border-color,
|
|
131
|
+
borderBottom: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
118
132
|
overflowX: 'auto',
|
|
119
133
|
},
|
|
120
134
|
tab: {
|
|
@@ -124,13 +138,13 @@ const styles = {
|
|
|
124
138
|
padding: '8px 16px',
|
|
125
139
|
fontSize: '13px',
|
|
126
140
|
fontWeight: 500,
|
|
127
|
-
color: 'var(--seekora-text-secondary,
|
|
141
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
128
142
|
backgroundColor: 'transparent',
|
|
129
143
|
border: '1px solid transparent',
|
|
130
|
-
borderRadius:
|
|
144
|
+
borderRadius: `${BORDER_RADIUS.full}px`,
|
|
131
145
|
cursor: 'pointer',
|
|
132
146
|
whiteSpace: 'nowrap',
|
|
133
|
-
transition:
|
|
147
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
134
148
|
},
|
|
135
149
|
tabActive: {
|
|
136
150
|
color: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -141,8 +155,8 @@ const styles = {
|
|
|
141
155
|
fontSize: '11px',
|
|
142
156
|
fontWeight: 600,
|
|
143
157
|
padding: '2px 6px',
|
|
144
|
-
borderRadius:
|
|
145
|
-
backgroundColor: 'var(--seekora-bg-tertiary,
|
|
158
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
159
|
+
backgroundColor: 'var(--seekora-bg-tertiary, rgba(255, 255, 255, 0.1))',
|
|
146
160
|
},
|
|
147
161
|
tabCountActive: {
|
|
148
162
|
backgroundColor: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -157,12 +171,12 @@ const styles = {
|
|
|
157
171
|
productCard: {
|
|
158
172
|
display: 'flex',
|
|
159
173
|
flexDirection: 'column',
|
|
160
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
161
|
-
borderRadius:
|
|
174
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
175
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
162
176
|
overflow: 'hidden',
|
|
163
177
|
cursor: 'pointer',
|
|
164
|
-
transition:
|
|
165
|
-
border: '1px solid var(--seekora-border-color,
|
|
178
|
+
transition: `transform ${TRANSITIONS.fast}, box-shadow ${TRANSITIONS.fast}`,
|
|
179
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
166
180
|
},
|
|
167
181
|
productCardHover: {
|
|
168
182
|
transform: 'translateY(-2px)',
|
|
@@ -180,7 +194,7 @@ const styles = {
|
|
|
180
194
|
productTitle: {
|
|
181
195
|
fontSize: '13px',
|
|
182
196
|
fontWeight: 500,
|
|
183
|
-
color: 'var(--seekora-text-primary,
|
|
197
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
184
198
|
margin: 0,
|
|
185
199
|
overflow: 'hidden',
|
|
186
200
|
textOverflow: 'ellipsis',
|
|
@@ -208,12 +222,12 @@ const styles = {
|
|
|
208
222
|
padding: '8px 14px',
|
|
209
223
|
fontSize: '13px',
|
|
210
224
|
fontWeight: 500,
|
|
211
|
-
color: 'var(--seekora-text-primary,
|
|
212
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
213
|
-
border: '1px solid var(--seekora-border-color,
|
|
214
|
-
borderRadius:
|
|
225
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
226
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
227
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
228
|
+
borderRadius: `${BORDER_RADIUS.lg}px`,
|
|
215
229
|
cursor: 'pointer',
|
|
216
|
-
transition:
|
|
230
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
217
231
|
},
|
|
218
232
|
brandChipHover: {
|
|
219
233
|
borderColor: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -222,30 +236,30 @@ const styles = {
|
|
|
222
236
|
brandLogo: {
|
|
223
237
|
width: '20px',
|
|
224
238
|
height: '20px',
|
|
225
|
-
borderRadius:
|
|
239
|
+
borderRadius: `${BORDER_RADIUS.sm}px`,
|
|
226
240
|
objectFit: 'contain',
|
|
227
241
|
backgroundColor: 'var(--seekora-bg-secondary, #f3f4f6)',
|
|
228
242
|
},
|
|
229
243
|
footer: {
|
|
230
244
|
padding: '12px 20px',
|
|
231
|
-
borderTop: '1px solid var(--seekora-border-color,
|
|
232
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
245
|
+
borderTop: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
246
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
233
247
|
display: 'flex',
|
|
234
248
|
alignItems: 'center',
|
|
235
249
|
justifyContent: 'space-between',
|
|
236
250
|
fontSize: '12px',
|
|
237
|
-
color: 'var(--seekora-text-secondary,
|
|
251
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
238
252
|
},
|
|
239
253
|
emptyState: {
|
|
240
254
|
padding: '48px 20px',
|
|
241
255
|
textAlign: 'center',
|
|
242
|
-
color: 'var(--seekora-text-secondary,
|
|
256
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
243
257
|
},
|
|
244
258
|
highlight: {
|
|
245
259
|
backgroundColor: 'var(--seekora-highlight-bg, #fef9c3)',
|
|
246
260
|
fontWeight: 600,
|
|
247
261
|
padding: '0 2px',
|
|
248
|
-
borderRadius:
|
|
262
|
+
borderRadius: `${BORDER_RADIUS.sm / 2}px`,
|
|
249
263
|
},
|
|
250
264
|
};
|
|
251
265
|
// ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalMenu.d.ts","sourceRoot":"","sources":["../../src/components/HierarchicalMenu.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"HierarchicalMenu.d.ts","sourceRoot":"","sources":["../../src/components/HierarchicalMenu.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAiD,MAAM,OAAO,CAAC;AAKtE,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,E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
|
* Displays a hierarchical menu for nested category navigation
|
|
5
5
|
* Example: Electronics > Phones > iPhone
|
|
6
6
|
*/
|
|
7
|
-
import React, { useState, useMemo, useCallback } from 'react';
|
|
7
|
+
import React, { useState, useMemo, useCallback, useRef } from 'react';
|
|
8
8
|
import { useSearchContext } from './SearchProvider';
|
|
9
9
|
import { useSearchState } from '../hooks/useSearchState';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
@@ -113,6 +113,112 @@ export const HierarchicalMenu = ({ attributes, separator = ' > ', limit = 10, sh
|
|
|
113
113
|
const toggleShowMore = (level) => {
|
|
114
114
|
setExpanded(prev => ({ ...prev, [level]: !prev[level] }));
|
|
115
115
|
};
|
|
116
|
+
const containerRef = useRef(null);
|
|
117
|
+
// Collect all visible treeitem elements within the container
|
|
118
|
+
const getVisibleTreeItems = useCallback(() => {
|
|
119
|
+
if (!containerRef.current)
|
|
120
|
+
return [];
|
|
121
|
+
return Array.from(containerRef.current.querySelectorAll('[role="treeitem"]'));
|
|
122
|
+
}, []);
|
|
123
|
+
// Keyboard navigation handler for the tree
|
|
124
|
+
const handleKeyDown = useCallback((e) => {
|
|
125
|
+
const items = getVisibleTreeItems();
|
|
126
|
+
if (items.length === 0)
|
|
127
|
+
return;
|
|
128
|
+
const activeElement = document.activeElement;
|
|
129
|
+
// Find the treeitem that is or contains the active element
|
|
130
|
+
const currentItem = items.find(item => item === activeElement || item.contains(activeElement));
|
|
131
|
+
const currentIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
132
|
+
switch (e.key) {
|
|
133
|
+
case 'ArrowDown': {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
const nextIndex = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
|
|
136
|
+
const button = items[nextIndex].querySelector('button');
|
|
137
|
+
if (button)
|
|
138
|
+
button.focus();
|
|
139
|
+
else
|
|
140
|
+
items[nextIndex].focus();
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 'ArrowUp': {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
|
|
146
|
+
const button = items[prevIndex].querySelector('button');
|
|
147
|
+
if (button)
|
|
148
|
+
button.focus();
|
|
149
|
+
else
|
|
150
|
+
items[prevIndex].focus();
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'ArrowRight': {
|
|
154
|
+
if (!currentItem)
|
|
155
|
+
break;
|
|
156
|
+
const isExpanded = currentItem.getAttribute('aria-expanded');
|
|
157
|
+
if (isExpanded === 'false') {
|
|
158
|
+
// Expand (select) this item
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
const button = currentItem.querySelector('button');
|
|
161
|
+
if (button)
|
|
162
|
+
button.click();
|
|
163
|
+
}
|
|
164
|
+
else if (isExpanded === 'true') {
|
|
165
|
+
// Move to first child
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
const childList = currentItem.querySelector('[role="group"]');
|
|
168
|
+
if (childList) {
|
|
169
|
+
const firstChild = childList.querySelector('[role="treeitem"]');
|
|
170
|
+
if (firstChild) {
|
|
171
|
+
const button = firstChild.querySelector('button');
|
|
172
|
+
if (button)
|
|
173
|
+
button.focus();
|
|
174
|
+
else
|
|
175
|
+
firstChild.focus();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 'ArrowLeft': {
|
|
182
|
+
if (!currentItem)
|
|
183
|
+
break;
|
|
184
|
+
const isExpanded = currentItem.getAttribute('aria-expanded');
|
|
185
|
+
if (isExpanded === 'true') {
|
|
186
|
+
// Collapse this item
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
const button = currentItem.querySelector('button');
|
|
189
|
+
if (button)
|
|
190
|
+
button.click();
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
// Move focus to parent treeitem
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
const parentGroup = currentItem.closest('[role="group"]');
|
|
196
|
+
if (parentGroup) {
|
|
197
|
+
const parentItem = parentGroup.closest('[role="treeitem"]');
|
|
198
|
+
if (parentItem) {
|
|
199
|
+
const button = parentItem.querySelector(':scope > button');
|
|
200
|
+
if (button)
|
|
201
|
+
button.focus();
|
|
202
|
+
else
|
|
203
|
+
parentItem.focus();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case 'Enter': {
|
|
210
|
+
if (!currentItem)
|
|
211
|
+
break;
|
|
212
|
+
e.preventDefault();
|
|
213
|
+
const button = currentItem.querySelector('button');
|
|
214
|
+
if (button)
|
|
215
|
+
button.click();
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
default:
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}, [getVisibleTreeItems]);
|
|
116
222
|
// Render a level of the hierarchy
|
|
117
223
|
const renderLevel = (items, level) => {
|
|
118
224
|
if (!items || items.length === 0)
|
|
@@ -121,12 +227,14 @@ export const HierarchicalMenu = ({ attributes, separator = ' > ', limit = 10, sh
|
|
|
121
227
|
const displayLimit = isExpanded ? showMoreLimit : limit;
|
|
122
228
|
const displayItems = items.slice(0, displayLimit);
|
|
123
229
|
const hasMore = items.length > displayLimit;
|
|
124
|
-
return (React.createElement("ul", { className: hierarchicalTheme.list, style: {
|
|
230
|
+
return (React.createElement("ul", { role: level === 0 ? 'tree' : 'group', className: hierarchicalTheme.list, style: {
|
|
125
231
|
listStyle: 'none',
|
|
126
232
|
margin: 0,
|
|
127
233
|
padding: level > 0 ? `0 0 0 ${theme.spacing.medium}` : 0,
|
|
128
234
|
} },
|
|
129
|
-
displayItems.map((item, index) => (React.createElement("li", { key: item.value,
|
|
235
|
+
displayItems.map((item, index) => (React.createElement("li", { key: item.value, role: "treeitem", ...(item.data && item.data.length > 0
|
|
236
|
+
? { 'aria-expanded': !!item.isRefined }
|
|
237
|
+
: {}), className: clsx(hierarchicalTheme.item, item.isRefined && hierarchicalTheme.itemSelected, item.data && item.data.length > 0 && hierarchicalTheme.itemParent), style: {
|
|
130
238
|
padding: `${theme.spacing.small} 0`,
|
|
131
239
|
} }, renderItem ? (renderItem(item, level)) : (React.createElement(React.Fragment, null,
|
|
132
240
|
React.createElement("button", { type: "button", onClick: () => handleItemClick(item, level), className: hierarchicalTheme.link, style: {
|
|
@@ -164,5 +272,5 @@ export const HierarchicalMenu = ({ attributes, separator = ' > ', limit = 10, sh
|
|
|
164
272
|
if (processedItems.length === 0) {
|
|
165
273
|
return null;
|
|
166
274
|
}
|
|
167
|
-
return (React.createElement("div", { className: clsx(hierarchicalTheme.root, className), style: style }, renderLevel(processedItems, 0)));
|
|
275
|
+
return (React.createElement("div", { ref: containerRef, className: clsx(hierarchicalTheme.root, className), style: style, tabIndex: 0, onKeyDown: handleKeyDown }, renderLevel(processedItems, 0)));
|
|
168
276
|
};
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pagination Component
|
|
3
3
|
*
|
|
4
|
-
* Displays pagination controls for search results
|
|
4
|
+
* Displays pagination controls for search results.
|
|
5
|
+
* Supports three display variants: numbered, load-more, and simple.
|
|
6
|
+
*
|
|
7
|
+
* CSS Variables (applied to the container element):
|
|
8
|
+
* --seekora-pagination-bg
|
|
9
|
+
* --seekora-pagination-color
|
|
10
|
+
* --seekora-pagination-active-bg
|
|
11
|
+
* --seekora-pagination-active-color
|
|
12
|
+
* --seekora-pagination-border
|
|
13
|
+
* --seekora-pagination-radius
|
|
5
14
|
*/
|
|
6
15
|
import React from 'react';
|
|
7
16
|
import type { SearchResponse } from '@seekora-ai/search-sdk';
|
|
@@ -13,6 +22,18 @@ export interface PaginationTheme {
|
|
|
13
22
|
itemDisabled?: string;
|
|
14
23
|
link?: string;
|
|
15
24
|
ellipsis?: string;
|
|
25
|
+
/** Class for the Load More button */
|
|
26
|
+
loadMoreButton?: string;
|
|
27
|
+
/** Class for the Load More descriptive text (e.g. "X remaining") */
|
|
28
|
+
loadMoreText?: string;
|
|
29
|
+
/** Class for the simple variant outer container */
|
|
30
|
+
simpleContainer?: string;
|
|
31
|
+
/** Class for the "Page X of Y" text in the simple variant */
|
|
32
|
+
simpleText?: string;
|
|
33
|
+
/** Class for Previous/Next buttons in the simple variant */
|
|
34
|
+
simpleButton?: string;
|
|
35
|
+
/** Class for the "Page X of Y" info text (usable in any variant) */
|
|
36
|
+
pageInfo?: string;
|
|
16
37
|
}
|
|
17
38
|
export interface PaginationProps {
|
|
18
39
|
/** Search results response */
|
|
@@ -39,6 +60,31 @@ export interface PaginationProps {
|
|
|
39
60
|
style?: React.CSSProperties;
|
|
40
61
|
/** Custom theme */
|
|
41
62
|
theme?: PaginationTheme;
|
|
63
|
+
/**
|
|
64
|
+
* Display variant.
|
|
65
|
+
* - 'numbered' (default): numbered page buttons with prev/next
|
|
66
|
+
* - 'load-more': single "Load More" button
|
|
67
|
+
* - 'simple': Previous / Next buttons with "Page X of Y" text
|
|
68
|
+
*/
|
|
69
|
+
variant?: 'numbered' | 'load-more' | 'simple';
|
|
70
|
+
/** Label for the Load More button (default: "Load More") */
|
|
71
|
+
loadMoreText?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Button / text sizing.
|
|
74
|
+
* - 'small': compact
|
|
75
|
+
* - 'medium' (default): standard
|
|
76
|
+
* - 'large': spacious
|
|
77
|
+
*/
|
|
78
|
+
size?: 'small' | 'medium' | 'large';
|
|
79
|
+
/**
|
|
80
|
+
* Show "Page X of Y" text.
|
|
81
|
+
* Defaults to false for numbered, true for simple.
|
|
82
|
+
*/
|
|
83
|
+
showPageInfo?: boolean;
|
|
84
|
+
/** Label for the Previous button (default: "Previous") */
|
|
85
|
+
previousLabel?: string;
|
|
86
|
+
/** Label for the Next button (default: "Next") */
|
|
87
|
+
nextLabel?: string;
|
|
42
88
|
}
|
|
43
89
|
export declare const Pagination: React.FC<PaginationProps>;
|
|
44
90
|
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/components/Pagination.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/components/Pagination.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,6CAA6C;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