@seekora-ai/ui-sdk-react 0.2.14 → 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.map +1 -1
- package/dist/components/CurrentRefinements.js +69 -9
- 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 +26 -0
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +195 -6
- package/dist/components/FederatedDropdown.d.ts.map +1 -1
- package/dist/components/FederatedDropdown.js +45 -31
- 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 +54 -32
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +40 -26
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +15 -7
- 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/SearchResults.d.ts.map +1 -1
- package/dist/components/SearchResults.js +37 -25
- 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/MobileSheetDropdown.js +18 -18
- package/dist/components/suggestions/ShopifyDropdown.js +37 -37
- 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/index.d.ts +3 -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 +129 -4
- package/dist/src/index.esm.js +1361 -616
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +1361 -615
- package/dist/src/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSlider.d.ts","sourceRoot":"","sources":["../../src/components/RangeSlider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"RangeSlider.d.ts","sourceRoot":"","sources":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xB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsVlD,CAAC"}
|
|
@@ -4,18 +4,29 @@
|
|
|
4
4
|
* Visual slider for numeric range filtering
|
|
5
5
|
* Alternative to RangeInput for a more interactive UX
|
|
6
6
|
*/
|
|
7
|
-
import React, { useState, useCallback, useEffect,
|
|
7
|
+
import React, { useState, useCallback, useEffect, useRef } from 'react';
|
|
8
8
|
import { useSearchContext } from './SearchProvider';
|
|
9
9
|
import { useSearchState } from '../hooks/useSearchState';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
|
+
const SHADOWS = {
|
|
12
|
+
sm: '0 1px 2px rgba(0,0,0,0.05)',
|
|
13
|
+
md: '0 2px 4px rgba(0,0,0,0.1)',
|
|
14
|
+
lg: '0 4px 6px rgba(0,0,0,0.1)',
|
|
15
|
+
xl: '0 10px 15px rgba(0,0,0,0.1)',
|
|
16
|
+
};
|
|
11
17
|
export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: currentMinProp, currentMax: currentMaxProp, onRangeChange, formatValue = (v) => v.toString(), className, style, theme: customTheme, showValues = true, syncWithState = true, debounceMs = 300, }) => {
|
|
12
18
|
const { theme } = useSearchContext();
|
|
13
19
|
const { refinements, addRefinement, removeRefinement } = useSearchState();
|
|
14
20
|
const rangeSliderTheme = customTheme || {};
|
|
21
|
+
const thumbClass = rangeSliderTheme.thumb || 'seekora-range-slider__thumb';
|
|
15
22
|
// Parse current range from StateManager
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
// NOTE: computed every render (no useMemo) because the state manager mutates
|
|
24
|
+
// the refinements array in place — the reference never changes.
|
|
25
|
+
let stateRange;
|
|
26
|
+
if (!syncWithState) {
|
|
27
|
+
stateRange = { min: undefined, max: undefined };
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
19
30
|
let minVal;
|
|
20
31
|
let maxVal;
|
|
21
32
|
refinements.forEach(r => {
|
|
@@ -28,15 +39,17 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
28
39
|
maxVal = parseFloat(maxMatch[1]);
|
|
29
40
|
}
|
|
30
41
|
});
|
|
31
|
-
|
|
32
|
-
}
|
|
42
|
+
stateRange = { min: minVal, max: maxVal };
|
|
43
|
+
}
|
|
33
44
|
const [internalMin, setInternalMin] = useState(currentMinProp ?? stateRange.min ?? min);
|
|
34
45
|
const [internalMax, setInternalMax] = useState(currentMaxProp ?? stateRange.max ?? max);
|
|
35
|
-
const
|
|
46
|
+
const isDraggingRef = useRef(false);
|
|
36
47
|
const debounceRef = useRef(null);
|
|
37
|
-
|
|
48
|
+
const pendingMinRef = useRef(internalMin);
|
|
49
|
+
const pendingMaxRef = useRef(internalMax);
|
|
50
|
+
// Sync with StateManager changes (only when stateRange actually changes, not on drag)
|
|
38
51
|
useEffect(() => {
|
|
39
|
-
if (syncWithState && !
|
|
52
|
+
if (syncWithState && !isDraggingRef.current) {
|
|
40
53
|
if (stateRange.min !== undefined)
|
|
41
54
|
setInternalMin(stateRange.min);
|
|
42
55
|
else
|
|
@@ -46,7 +59,7 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
46
59
|
else
|
|
47
60
|
setInternalMax(max);
|
|
48
61
|
}
|
|
49
|
-
}, [syncWithState, stateRange.min, stateRange.max,
|
|
62
|
+
}, [syncWithState, stateRange.min, stateRange.max, min, max]);
|
|
50
63
|
// Update StateManager with range refinements
|
|
51
64
|
const updateStateManager = useCallback((minVal, maxVal) => {
|
|
52
65
|
if (!syncWithState)
|
|
@@ -57,24 +70,24 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
57
70
|
removeRefinement(field, r.value, false);
|
|
58
71
|
}
|
|
59
72
|
});
|
|
60
|
-
// Add new range refinements
|
|
61
|
-
|
|
73
|
+
// Add new range refinements — trigger search on the last one added
|
|
74
|
+
const setMin = minVal > min;
|
|
75
|
+
const setMax = maxVal < max;
|
|
76
|
+
if (setMin && setMax) {
|
|
62
77
|
addRefinement(field, `>=${minVal}`, false);
|
|
78
|
+
addRefinement(field, `<=${maxVal}`, true);
|
|
63
79
|
}
|
|
64
|
-
if (
|
|
65
|
-
addRefinement(field, `<=${maxVal}`, minVal <= min); // Trigger search if only max is set
|
|
66
|
-
}
|
|
67
|
-
if (minVal > min && maxVal >= max) {
|
|
68
|
-
// Trigger search after setting min
|
|
80
|
+
else if (setMin) {
|
|
69
81
|
addRefinement(field, `>=${minVal}`, true);
|
|
70
82
|
}
|
|
71
|
-
else if (
|
|
72
|
-
|
|
73
|
-
// already triggered above
|
|
83
|
+
else if (setMax) {
|
|
84
|
+
addRefinement(field, `<=${maxVal}`, true);
|
|
74
85
|
}
|
|
75
86
|
}, [syncWithState, field, refinements, addRefinement, removeRefinement, min, max]);
|
|
76
|
-
// Debounced update
|
|
87
|
+
// Debounced update (during drag only)
|
|
77
88
|
const debouncedUpdate = useCallback((minVal, maxVal) => {
|
|
89
|
+
pendingMinRef.current = minVal;
|
|
90
|
+
pendingMaxRef.current = maxVal;
|
|
78
91
|
if (debounceRef.current) {
|
|
79
92
|
clearTimeout(debounceRef.current);
|
|
80
93
|
}
|
|
@@ -89,19 +102,28 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
89
102
|
const handleMinChange = (e) => {
|
|
90
103
|
const value = Math.min(Number(e.target.value), internalMax - step);
|
|
91
104
|
setInternalMin(value);
|
|
92
|
-
|
|
105
|
+
isDraggingRef.current = true;
|
|
93
106
|
debouncedUpdate(value, internalMax);
|
|
94
107
|
};
|
|
95
108
|
// Handle max slider change
|
|
96
109
|
const handleMaxChange = (e) => {
|
|
97
110
|
const value = Math.max(Number(e.target.value), internalMin + step);
|
|
98
111
|
setInternalMax(value);
|
|
99
|
-
|
|
112
|
+
isDraggingRef.current = true;
|
|
100
113
|
debouncedUpdate(internalMin, value);
|
|
101
114
|
};
|
|
102
|
-
// Handle drag end
|
|
115
|
+
// Handle drag end — flush pending update immediately
|
|
103
116
|
const handleDragEnd = () => {
|
|
104
|
-
|
|
117
|
+
isDraggingRef.current = false;
|
|
118
|
+
// Cancel the debounce and commit immediately
|
|
119
|
+
if (debounceRef.current) {
|
|
120
|
+
clearTimeout(debounceRef.current);
|
|
121
|
+
debounceRef.current = null;
|
|
122
|
+
}
|
|
123
|
+
updateStateManager(pendingMinRef.current, pendingMaxRef.current);
|
|
124
|
+
if (onRangeChange) {
|
|
125
|
+
onRangeChange(pendingMinRef.current, pendingMaxRef.current);
|
|
126
|
+
}
|
|
105
127
|
};
|
|
106
128
|
// Handle keyboard navigation for enhanced control (Shift+Arrow for 10x step, Home/End)
|
|
107
129
|
const handleMinKeyDown = (e) => {
|
|
@@ -166,7 +188,7 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
166
188
|
} }, label)),
|
|
167
189
|
React.createElement("div", { className: rangeSliderTheme.slider, style: {
|
|
168
190
|
position: 'relative',
|
|
169
|
-
|
|
191
|
+
minHeight: '40px',
|
|
170
192
|
display: 'flex',
|
|
171
193
|
alignItems: 'center',
|
|
172
194
|
} },
|
|
@@ -185,7 +207,7 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
185
207
|
backgroundColor: theme.colors.primary,
|
|
186
208
|
borderRadius: '2px',
|
|
187
209
|
} }),
|
|
188
|
-
React.createElement("input", { type: "range", min: min, max: max, step: step, value: internalMin, onChange: handleMinChange, onMouseUp: handleDragEnd, onTouchEnd: handleDragEnd, onKeyDown: handleMinKeyDown, tabIndex: 0, "aria-valuenow": internalMin, "aria-valuemin": min, "aria-valuemax": max, className:
|
|
210
|
+
React.createElement("input", { type: "range", min: min, max: max, step: step, value: internalMin, onChange: handleMinChange, onMouseUp: handleDragEnd, onTouchEnd: handleDragEnd, onKeyDown: handleMinKeyDown, tabIndex: 0, "aria-valuenow": internalMin, "aria-valuemin": min, "aria-valuemax": max, className: thumbClass, style: {
|
|
189
211
|
position: 'absolute',
|
|
190
212
|
width: '100%',
|
|
191
213
|
height: '4px',
|
|
@@ -195,7 +217,7 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
195
217
|
cursor: 'pointer',
|
|
196
218
|
pointerEvents: 'none',
|
|
197
219
|
}, "aria-label": `Minimum ${label || field}` }),
|
|
198
|
-
React.createElement("input", { type: "range", min: min, max: max, step: step, value: internalMax, onChange: handleMaxChange, onMouseUp: handleDragEnd, onTouchEnd: handleDragEnd, onKeyDown: handleMaxKeyDown, tabIndex: 0, "aria-valuenow": internalMax, "aria-valuemin": min, "aria-valuemax": max, className:
|
|
220
|
+
React.createElement("input", { type: "range", min: min, max: max, step: step, value: internalMax, onChange: handleMaxChange, onMouseUp: handleDragEnd, onTouchEnd: handleDragEnd, onKeyDown: handleMaxKeyDown, tabIndex: 0, "aria-valuenow": internalMax, "aria-valuemin": min, "aria-valuemax": max, className: thumbClass, style: {
|
|
199
221
|
position: 'absolute',
|
|
200
222
|
width: '100%',
|
|
201
223
|
height: '4px',
|
|
@@ -215,7 +237,7 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
215
237
|
React.createElement("span", { className: rangeSliderTheme.value }, formatValue(internalMin)),
|
|
216
238
|
React.createElement("span", { className: rangeSliderTheme.value }, formatValue(internalMax)))),
|
|
217
239
|
React.createElement("style", null, `
|
|
218
|
-
.${
|
|
240
|
+
.${thumbClass}::-webkit-slider-thumb {
|
|
219
241
|
-webkit-appearance: none;
|
|
220
242
|
appearance: none;
|
|
221
243
|
width: 20px;
|
|
@@ -224,9 +246,9 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
224
246
|
border-radius: 50%;
|
|
225
247
|
cursor: pointer;
|
|
226
248
|
pointer-events: all;
|
|
227
|
-
box-shadow:
|
|
249
|
+
box-shadow: ${SHADOWS.md};
|
|
228
250
|
}
|
|
229
|
-
.${
|
|
251
|
+
.${thumbClass}::-moz-range-thumb {
|
|
230
252
|
width: 20px;
|
|
231
253
|
height: 20px;
|
|
232
254
|
background: ${theme.colors.primary};
|
|
@@ -234,7 +256,7 @@ export const RangeSlider = ({ field, label, min, max, step = 1, currentMin: curr
|
|
|
234
256
|
cursor: pointer;
|
|
235
257
|
pointer-events: all;
|
|
236
258
|
border: none;
|
|
237
|
-
box-shadow:
|
|
259
|
+
box-shadow: ${SHADOWS.md};
|
|
238
260
|
}
|
|
239
261
|
`)));
|
|
240
262
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichQuerySuggestions.d.ts","sourceRoot":"","sources":["../../src/components/RichQuerySuggestions.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EAGd,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAE7B,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"RichQuerySuggestions.d.ts","sourceRoot":"","sources":["../../src/components/RichQuerySuggestions.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAQN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EAGd,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAE7B,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAuBlC,MAAM,WAAW,yBAA0B,SAAQ,6BAA6B;IAC9E,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACnC,sCAAsC;IACtC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,2BAA2B;IAC3B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O,CAAC;IAC7B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACtC,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACtC,cAAc,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,YAAY,CAAC;KACrE,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,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,aAAa,EAAE,MAAM,MAAM,CAAC;CAC7B;AAqPD,eAAO,MAAM,oBAAoB,2GAwchC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -14,6 +14,20 @@ import React, { useState, useRef, useCallback, useMemo, forwardRef, useImperativ
|
|
|
14
14
|
import { useSearchContext } from './SearchProvider';
|
|
15
15
|
import { useQuerySuggestionsEnhanced } from '../hooks/useQuerySuggestionsEnhanced';
|
|
16
16
|
import { clsx } from 'clsx';
|
|
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
|
+
};
|
|
17
31
|
// Default section order
|
|
18
32
|
const DEFAULT_SECTIONS = [
|
|
19
33
|
{ id: 'recent', title: 'Recent Searches', maxItems: 5, enabled: true, order: 1 },
|
|
@@ -26,16 +40,16 @@ const DEFAULT_SECTIONS = [
|
|
|
26
40
|
// ============================================================================
|
|
27
41
|
const styles = {
|
|
28
42
|
container: {
|
|
29
|
-
backgroundColor: 'var(--seekora-bg-surface,
|
|
30
|
-
border: '1px solid var(--seekora-border-color,
|
|
31
|
-
borderRadius:
|
|
43
|
+
backgroundColor: 'var(--seekora-bg-surface, transparent)',
|
|
44
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
45
|
+
borderRadius: `var(--seekora-border-radius-lg, ${BORDER_RADIUS.lg * 1.5}px)`,
|
|
32
46
|
boxShadow: 'var(--seekora-shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04))',
|
|
33
47
|
overflow: 'hidden',
|
|
34
48
|
},
|
|
35
49
|
header: {
|
|
36
50
|
padding: '12px 16px',
|
|
37
|
-
borderBottom: '1px solid var(--seekora-border-color,
|
|
38
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
51
|
+
borderBottom: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
52
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
39
53
|
},
|
|
40
54
|
content: {
|
|
41
55
|
overflowY: 'auto',
|
|
@@ -70,7 +84,7 @@ const styles = {
|
|
|
70
84
|
alignItems: 'flex-start',
|
|
71
85
|
padding: '10px 16px',
|
|
72
86
|
cursor: 'pointer',
|
|
73
|
-
transition:
|
|
87
|
+
transition: `background-color ${TRANSITIONS.fast}`,
|
|
74
88
|
gap: '12px',
|
|
75
89
|
},
|
|
76
90
|
itemActive: {
|
|
@@ -89,7 +103,7 @@ const styles = {
|
|
|
89
103
|
},
|
|
90
104
|
itemQuery: {
|
|
91
105
|
fontSize: '14px',
|
|
92
|
-
color: 'var(--seekora-text-primary,
|
|
106
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
93
107
|
fontWeight: 500,
|
|
94
108
|
margin: 0,
|
|
95
109
|
overflow: 'hidden',
|
|
@@ -98,7 +112,7 @@ const styles = {
|
|
|
98
112
|
},
|
|
99
113
|
itemMeta: {
|
|
100
114
|
fontSize: '12px',
|
|
101
|
-
color: 'var(--seekora-text-secondary,
|
|
115
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
102
116
|
marginTop: '2px',
|
|
103
117
|
},
|
|
104
118
|
itemCount: {
|
|
@@ -119,11 +133,11 @@ const styles = {
|
|
|
119
133
|
padding: '3px 8px',
|
|
120
134
|
fontSize: '11px',
|
|
121
135
|
fontWeight: 500,
|
|
122
|
-
color: 'var(--seekora-text-secondary,
|
|
123
|
-
backgroundColor: 'var(--seekora-bg-tertiary,
|
|
124
|
-
borderRadius:
|
|
136
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
137
|
+
backgroundColor: 'var(--seekora-bg-tertiary, rgba(255, 255, 255, 0.1))',
|
|
138
|
+
borderRadius: `${BORDER_RADIUS.lg * 1.5}px`,
|
|
125
139
|
cursor: 'pointer',
|
|
126
|
-
transition:
|
|
140
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
127
141
|
},
|
|
128
142
|
categoryPillHover: {
|
|
129
143
|
backgroundColor: 'var(--seekora-primary-light, #dbeafe)',
|
|
@@ -145,12 +159,12 @@ const styles = {
|
|
|
145
159
|
padding: '6px 12px',
|
|
146
160
|
fontSize: '13px',
|
|
147
161
|
fontWeight: 500,
|
|
148
|
-
color: 'var(--seekora-text-primary,
|
|
149
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
150
|
-
border: '1px solid var(--seekora-border-color,
|
|
151
|
-
borderRadius:
|
|
162
|
+
color: 'var(--seekora-text-primary, inherit)',
|
|
163
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
164
|
+
border: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
165
|
+
borderRadius: `${BORDER_RADIUS.full}px`,
|
|
152
166
|
cursor: 'pointer',
|
|
153
|
-
transition:
|
|
167
|
+
transition: `all ${TRANSITIONS.fast}`,
|
|
154
168
|
},
|
|
155
169
|
trendingChipHover: {
|
|
156
170
|
borderColor: 'var(--seekora-primary, #3b82f6)',
|
|
@@ -164,7 +178,7 @@ const styles = {
|
|
|
164
178
|
trendingRank: {
|
|
165
179
|
width: '18px',
|
|
166
180
|
height: '18px',
|
|
167
|
-
borderRadius:
|
|
181
|
+
borderRadius: `${BORDER_RADIUS.full}px`,
|
|
168
182
|
backgroundColor: 'var(--seekora-primary, #3b82f6)',
|
|
169
183
|
color: 'white',
|
|
170
184
|
fontSize: '10px',
|
|
@@ -176,25 +190,25 @@ const styles = {
|
|
|
176
190
|
removeButton: {
|
|
177
191
|
padding: '4px',
|
|
178
192
|
marginLeft: 'auto',
|
|
179
|
-
borderRadius:
|
|
193
|
+
borderRadius: `${BORDER_RADIUS.sm}px`,
|
|
180
194
|
border: 'none',
|
|
181
195
|
background: 'transparent',
|
|
182
196
|
cursor: 'pointer',
|
|
183
197
|
color: 'var(--seekora-text-tertiary, #9ca3af)',
|
|
184
198
|
opacity: 0,
|
|
185
|
-
transition:
|
|
199
|
+
transition: `opacity ${TRANSITIONS.fast}`,
|
|
186
200
|
},
|
|
187
201
|
divider: {
|
|
188
202
|
height: '1px',
|
|
189
|
-
backgroundColor: 'var(--seekora-border-color,
|
|
203
|
+
backgroundColor: 'var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
190
204
|
margin: '4px 16px',
|
|
191
205
|
},
|
|
192
206
|
footer: {
|
|
193
207
|
padding: '12px 16px',
|
|
194
|
-
borderTop: '1px solid var(--seekora-border-color,
|
|
195
|
-
backgroundColor: 'var(--seekora-bg-secondary,
|
|
208
|
+
borderTop: '1px solid var(--seekora-border-color, rgba(128,128,128,0.2))',
|
|
209
|
+
backgroundColor: 'var(--seekora-bg-secondary, rgba(255, 255, 255, 0.1))',
|
|
196
210
|
fontSize: '12px',
|
|
197
|
-
color: 'var(--seekora-text-secondary,
|
|
211
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
198
212
|
},
|
|
199
213
|
loadingOverlay: {
|
|
200
214
|
position: 'absolute',
|
|
@@ -202,12 +216,12 @@ const styles = {
|
|
|
202
216
|
display: 'flex',
|
|
203
217
|
alignItems: 'center',
|
|
204
218
|
justifyContent: 'center',
|
|
205
|
-
backgroundColor: 'rgba(255, 255, 255, 0.
|
|
219
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
206
220
|
},
|
|
207
221
|
emptyState: {
|
|
208
222
|
padding: '32px 16px',
|
|
209
223
|
textAlign: 'center',
|
|
210
|
-
color: 'var(--seekora-text-secondary,
|
|
224
|
+
color: 'var(--seekora-text-secondary, inherit)',
|
|
211
225
|
},
|
|
212
226
|
highlight: {
|
|
213
227
|
backgroundColor: 'var(--seekora-highlight-bg, #fef9c3)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../src/components/SearchBar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAMxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../src/components/SearchBar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;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E,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,2HAA2H;IAC3H,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC1E,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACtC,sGAAsG;IACtG,gBAAgB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACzC,iFAAiF;IACjF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uCAAuC;IACvC,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACxC,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0CAA0C;IAC1C,kBAAkB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IAC3C,yEAAyE;IACzE,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAgED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA2b9C,CAAC"}
|
|
@@ -9,6 +9,13 @@ import { useSearchState } from '../hooks/useSearchState';
|
|
|
9
9
|
import { useQuerySuggestions } from '../hooks/useQuerySuggestions';
|
|
10
10
|
import { log } from '@seekora-ai/ui-sdk-core';
|
|
11
11
|
import { clsx } from 'clsx';
|
|
12
|
+
// Z-index scale for consistent layering
|
|
13
|
+
const Z_INDEX = {
|
|
14
|
+
dropdown: 100,
|
|
15
|
+
modal: 200,
|
|
16
|
+
overlay: 300,
|
|
17
|
+
tooltip: 50,
|
|
18
|
+
};
|
|
12
19
|
const SIZE_CONFIG = {
|
|
13
20
|
small: {
|
|
14
21
|
padding: '0.375rem 0.5rem',
|
|
@@ -195,9 +202,9 @@ export const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, d
|
|
|
195
202
|
const inputPaddingLeft = hasSearchIcon ? sizeConfig.iconPaddingLeft : sizeConfig.padding.split(' ')[1] || sizeConfig.padding;
|
|
196
203
|
const inputPaddingRight = hasClearBtn ? sizeConfig.iconPaddingRight : sizeConfig.padding.split(' ')[1] || sizeConfig.padding;
|
|
197
204
|
const borderRadius = typeof theme.borderRadius === 'string' ? theme.borderRadius : theme.borderRadius.medium;
|
|
198
|
-
const focusBorderColor = isFocused ? theme.colors.focus : theme.colors.border
|
|
205
|
+
const focusBorderColor = isFocused ? `var(--seekora-border-focus, ${theme.colors.focus})` : `var(--seekora-border, ${theme.colors.border})`;
|
|
199
206
|
const focusRingShadow = isFocused
|
|
200
|
-
? `0 0 0 3px ${theme.colors.focus}33`
|
|
207
|
+
? `0 0 0 3px var(--seekora-border-focus-alpha, ${theme.colors.focus}33)`
|
|
201
208
|
: undefined;
|
|
202
209
|
const handleClear = useCallback(() => {
|
|
203
210
|
setQuery('', false);
|
|
@@ -231,7 +238,7 @@ export const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, d
|
|
|
231
238
|
justifyContent: 'center',
|
|
232
239
|
pointerEvents: 'none',
|
|
233
240
|
color: 'var(--seekora-searchbar-icon-color)',
|
|
234
|
-
zIndex:
|
|
241
|
+
zIndex: 2,
|
|
235
242
|
} }, renderSearchIcon ? renderSearchIcon() : React.createElement(DefaultSearchIcon, { size: sizeConfig.iconSize }))),
|
|
236
243
|
React.createElement("input", { ref: inputRef, type: "text", value: query, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, placeholder: placeholder, className: clsx(searchBarTheme.input, isFocused && searchBarTheme.inputFocused), style: {
|
|
237
244
|
width: '100%',
|
|
@@ -267,7 +274,7 @@ export const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, d
|
|
|
267
274
|
borderRadius: '50%',
|
|
268
275
|
color: 'var(--seekora-searchbar-icon-color)',
|
|
269
276
|
transition: theme.transitions?.fast || '150ms ease-in-out',
|
|
270
|
-
zIndex:
|
|
277
|
+
zIndex: 2,
|
|
271
278
|
}, onMouseDown: (e) => {
|
|
272
279
|
// Prevent input blur so the clear action doesn't race with blur handler
|
|
273
280
|
e.preventDefault();
|
|
@@ -278,8 +285,8 @@ export const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, d
|
|
|
278
285
|
fontSize: sizeConfig.fontSize,
|
|
279
286
|
fontFamily: theme.typography.fontFamily,
|
|
280
287
|
fontWeight: theme.typography.fontWeight?.medium ?? 500,
|
|
281
|
-
backgroundColor: theme.colors.primary
|
|
282
|
-
color: '#ffffff',
|
|
288
|
+
backgroundColor: `var(--seekora-primary, ${theme.colors.primary})`,
|
|
289
|
+
color: 'var(--seekora-primary-text, #ffffff)',
|
|
283
290
|
border: 'none',
|
|
284
291
|
borderRadius: 'var(--seekora-searchbar-radius)',
|
|
285
292
|
cursor: 'pointer',
|
|
@@ -307,7 +314,8 @@ export const SearchBar = ({ placeholder = 'Search...', showSuggestions = true, d
|
|
|
307
314
|
boxShadow: theme.shadows.medium,
|
|
308
315
|
maxHeight: '400px',
|
|
309
316
|
overflowY: 'auto',
|
|
310
|
-
zIndex:
|
|
317
|
+
zIndex: Z_INDEX.dropdown,
|
|
318
|
+
boxSizing: 'border-box',
|
|
311
319
|
} },
|
|
312
320
|
isLoading && displayedSuggestions.length === 0 && showLoadingState && (renderLoading ? renderLoading() : defaultRenderLoading()),
|
|
313
321
|
displayedSuggestions.length > 0 && (React.createElement(React.Fragment, null, displayedSuggestions.map((suggestion, index) => {
|
|
@@ -29,8 +29,8 @@ const styles = {
|
|
|
29
29
|
transition: 'border-color 150ms ease, box-shadow 150ms ease',
|
|
30
30
|
},
|
|
31
31
|
inputWrapperFocused: {
|
|
32
|
-
borderColor: 'var(--seekora-primary, #3b82f6)',
|
|
33
|
-
boxShadow: '0 0 0 3px var(--seekora-primary-light, rgba(59, 130, 246, 0.1))',
|
|
32
|
+
borderColor: 'var(--seekora-border-focus, var(--seekora-primary, #3b82f6))',
|
|
33
|
+
boxShadow: '0 0 0 3px var(--seekora-border-focus-alpha, var(--seekora-primary-light, rgba(59, 130, 246, 0.1)))',
|
|
34
34
|
},
|
|
35
35
|
input: {
|
|
36
36
|
flex: 1,
|
|
@@ -73,7 +73,7 @@ const styles = {
|
|
|
73
73
|
margin: '4px',
|
|
74
74
|
border: 'none',
|
|
75
75
|
backgroundColor: 'var(--seekora-primary, #3b82f6)',
|
|
76
|
-
color: 'white',
|
|
76
|
+
color: 'var(--seekora-primary-text, white)',
|
|
77
77
|
borderRadius: 'var(--seekora-border-radius, 6px)',
|
|
78
78
|
fontSize: '14px',
|
|
79
79
|
fontWeight: 600,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchLayout.d.ts","sourceRoot":"","sources":["../../src/components/SearchLayout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM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"}
|
|
@@ -22,6 +22,8 @@ export const SearchLayout = ({ sidebar, children, header, footer, sidebarWidth =
|
|
|
22
22
|
display: 'flex',
|
|
23
23
|
flexDirection: 'column',
|
|
24
24
|
minHeight: '100vh',
|
|
25
|
+
width: '100%',
|
|
26
|
+
maxWidth: '100%',
|
|
25
27
|
backgroundColor: theme.colors.background,
|
|
26
28
|
...style,
|
|
27
29
|
} },
|
|
@@ -33,20 +35,27 @@ export const SearchLayout = ({ sidebar, children, header, footer, sidebarWidth =
|
|
|
33
35
|
React.createElement("div", { style: {
|
|
34
36
|
display: 'flex',
|
|
35
37
|
flex: 1,
|
|
38
|
+
width: '100%',
|
|
39
|
+
maxWidth: '100%',
|
|
36
40
|
gap: theme.spacing.large,
|
|
37
41
|
padding: theme.spacing.medium,
|
|
38
42
|
backgroundColor: theme.colors.background,
|
|
39
43
|
color: theme.colors.text,
|
|
44
|
+
overflow: 'hidden',
|
|
40
45
|
} },
|
|
41
46
|
sidebar && (!isMobile || showSidebarOnMobile) && (React.createElement("aside", { className: layoutTheme.sidebar, style: {
|
|
42
47
|
width: sidebarWidth,
|
|
43
48
|
minWidth: sidebarWidth,
|
|
49
|
+
flexShrink: 0,
|
|
44
50
|
} }, sidebar)),
|
|
45
51
|
React.createElement("main", { className: layoutTheme.main, style: {
|
|
46
52
|
flex: 1,
|
|
47
|
-
minWidth: 0,
|
|
53
|
+
minWidth: 0,
|
|
54
|
+
width: '100%',
|
|
55
|
+
maxWidth: '100%',
|
|
48
56
|
backgroundColor: theme.colors.background,
|
|
49
57
|
color: theme.colors.text,
|
|
58
|
+
overflow: 'auto',
|
|
50
59
|
} }, children)),
|
|
51
60
|
footer && (React.createElement("footer", { className: layoutTheme.footer, style: {
|
|
52
61
|
padding: theme.spacing.medium,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../src/components/SearchResults.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO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KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,mEAAmE;IACnE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gFAAgF;IAChF,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC;IAC1C,+DAA+D;IAC/D,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoBD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAknBtD,CAAC"}
|
|
@@ -53,6 +53,43 @@ export const SearchResults = ({ results: resultsProp, loading: loadingProp, erro
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}, [activeIndex, enableKeyboardNavigation]);
|
|
56
|
+
// Global keyboard listener for seamless navigation from search box to results
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!enableKeyboardNavigation)
|
|
59
|
+
return;
|
|
60
|
+
const handleGlobalKeyDown = (e) => {
|
|
61
|
+
// Only handle if we have results and the container exists
|
|
62
|
+
if (!containerRef.current)
|
|
63
|
+
return;
|
|
64
|
+
const resultElements = containerRef.current.querySelectorAll('[data-result-index]');
|
|
65
|
+
const maxIndex = resultElements.length - 1;
|
|
66
|
+
if (maxIndex < 0)
|
|
67
|
+
return;
|
|
68
|
+
// Check if focus is on an input/textarea (search box)
|
|
69
|
+
const activeElement = document.activeElement;
|
|
70
|
+
const isInputFocused = activeElement?.tagName === 'INPUT' || activeElement?.tagName === 'TEXTAREA';
|
|
71
|
+
if (e.key === 'ArrowDown') {
|
|
72
|
+
// If in search box or no result selected, select first result
|
|
73
|
+
if (isInputFocused || activeIndex === -1) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setActiveIndex(0);
|
|
76
|
+
containerRef.current?.focus();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (e.key === 'ArrowUp') {
|
|
80
|
+
// If first result is selected, go back to search box
|
|
81
|
+
if (activeIndex === 0) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
setActiveIndex(-1);
|
|
84
|
+
// Find and focus the search input
|
|
85
|
+
const searchInput = document.querySelector('input[type="text"], input[type="search"]');
|
|
86
|
+
searchInput?.focus();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
document.addEventListener('keydown', handleGlobalKeyDown);
|
|
91
|
+
return () => document.removeEventListener('keydown', handleGlobalKeyDown);
|
|
92
|
+
}, [enableKeyboardNavigation, activeIndex]);
|
|
56
93
|
// Keyboard navigation handler
|
|
57
94
|
const handleKeyDown = useCallback((e) => {
|
|
58
95
|
if (!enableKeyboardNavigation)
|
|
@@ -428,30 +465,5 @@ export const SearchResults = ({ results: resultsProp, loading: loadingProp, erro
|
|
|
428
465
|
results?.totalResults || results?.data?.total_results || 0,
|
|
429
466
|
" result",
|
|
430
467
|
(results?.totalResults || results?.data?.total_results || 0) !== 1 ? 's' : '')),
|
|
431
|
-
enableKeyboardNavigation && resultItems.length > 0 && (React.createElement("div", { style: {
|
|
432
|
-
fontSize: '12px',
|
|
433
|
-
color: theme.colors.text,
|
|
434
|
-
opacity: 0.6,
|
|
435
|
-
marginBottom: theme.spacing.small,
|
|
436
|
-
display: 'flex',
|
|
437
|
-
gap: '8px',
|
|
438
|
-
alignItems: 'center',
|
|
439
|
-
} },
|
|
440
|
-
React.createElement("span", { style: {
|
|
441
|
-
display: 'inline-flex',
|
|
442
|
-
gap: '4px',
|
|
443
|
-
padding: '2px 6px',
|
|
444
|
-
backgroundColor: theme.colors.hover,
|
|
445
|
-
borderRadius: '4px',
|
|
446
|
-
fontSize: '11px',
|
|
447
|
-
} }, "\u2191\u2193 navigate"),
|
|
448
|
-
React.createElement("span", { style: {
|
|
449
|
-
display: 'inline-flex',
|
|
450
|
-
gap: '4px',
|
|
451
|
-
padding: '2px 6px',
|
|
452
|
-
backgroundColor: theme.colors.hover,
|
|
453
|
-
borderRadius: '4px',
|
|
454
|
-
fontSize: '11px',
|
|
455
|
-
} }, "\u21B5 select"))),
|
|
456
468
|
React.createElement("div", { className: searchResultsTheme.resultsList, style: resultsListStyle }, resultItems.map((result, index) => renderFn(result, index, index === activeIndex)))));
|
|
457
469
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButtons.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/ActionButtons.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionButtons.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/ActionButtons.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AA+B1B,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,CAAC;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAwBD,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,MAAqB,EACrB,QAAmB,EACnB,UAAkB,EAClB,IAAe,EACf,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,qBAqFpB"}
|