@seekora-ai/ui-sdk-react 0.2.18 → 0.2.21
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/SearchBar.d.ts +3 -0
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +32 -4
- package/dist/docsearch/components/Footer.d.ts.map +1 -1
- package/dist/docsearch/components/Footer.js +16 -9
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.esm.js +48 -13
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +48 -13
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/dist/src/index.js
CHANGED
|
@@ -1687,7 +1687,7 @@ const DefaultSearchIcon = ({ size = 18 }) => (React.createElement("svg", { width
|
|
|
1687
1687
|
const DefaultClearIcon = ({ size = 14 }) => (React.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
1688
1688
|
React.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1689
1689
|
React.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })));
|
|
1690
|
-
const SearchBar = ({ placeholder = 'Powered by Seekora', showSuggestions = true, debounceMs = 300, minQueryLength = 2, maxSuggestions = 10, onSearch, onQueryChange, onSuggestionSelect, onSearchStateChange, searchOptions, className, style, theme: customTheme, renderSuggestion, renderSearchIcon, showClearButton = true, renderClearIcon, showSubmitButton = false, renderSubmitButton, size = 'medium', }) => {
|
|
1690
|
+
const SearchBar = ({ placeholder = 'Powered by Seekora', showSuggestions = true, debounceMs = 300, minQueryLength = 2, maxSuggestions = 10, onSearch, onQueryChange, onSuggestionSelect, onSearchStateChange, searchOptions, className, style, theme: customTheme, renderSuggestion, renderSearchIcon, showClearButton = true, renderClearIcon, showSubmitButton = false, renderSubmitButton, size = 'medium', searchAsYouType = false, }) => {
|
|
1691
1691
|
const { client, theme, enableAnalytics, autoTrackSearch } = useSearchContext();
|
|
1692
1692
|
const { query, setQuery, search: triggerSearch, results, loading: searchLoading, error: searchError } = useSearchState();
|
|
1693
1693
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
@@ -1695,6 +1695,14 @@ const SearchBar = ({ placeholder = 'Powered by Seekora', showSuggestions = true,
|
|
|
1695
1695
|
const inputRef = React.useRef(null);
|
|
1696
1696
|
const containerRef = React.useRef(null);
|
|
1697
1697
|
const isSearchingRef = React.useRef(false); // Flag to prevent blur handler from interfering
|
|
1698
|
+
const searchAsYouTypeRef = React.useRef(null);
|
|
1699
|
+
// Cleanup searchAsYouType timer on unmount
|
|
1700
|
+
React.useEffect(() => {
|
|
1701
|
+
return () => {
|
|
1702
|
+
if (searchAsYouTypeRef.current)
|
|
1703
|
+
clearTimeout(searchAsYouTypeRef.current);
|
|
1704
|
+
};
|
|
1705
|
+
}, []);
|
|
1698
1706
|
const { suggestions, loading: suggestionsLoading } = useQuerySuggestions({
|
|
1699
1707
|
client,
|
|
1700
1708
|
query,
|
|
@@ -1724,6 +1732,11 @@ const SearchBar = ({ placeholder = 'Powered by Seekora', showSuggestions = true,
|
|
|
1724
1732
|
}
|
|
1725
1733
|
}, [query, onQueryChange]);
|
|
1726
1734
|
const handleSearch = React.useCallback(async (searchQuery) => {
|
|
1735
|
+
// Cancel any pending searchAsYouType debounce — user explicitly submitted
|
|
1736
|
+
if (searchAsYouTypeRef.current) {
|
|
1737
|
+
clearTimeout(searchAsYouTypeRef.current);
|
|
1738
|
+
searchAsYouTypeRef.current = null;
|
|
1739
|
+
}
|
|
1727
1740
|
// Allow empty queries - use empty string for search
|
|
1728
1741
|
const query = searchQuery.trim();
|
|
1729
1742
|
log.info('SearchBar: Triggering search', { query, originalQuery: searchQuery, isEmpty: !query });
|
|
@@ -1760,10 +1773,18 @@ const SearchBar = ({ placeholder = 'Powered by Seekora', showSuggestions = true,
|
|
|
1760
1773
|
const handleInputChange = React.useCallback((e) => {
|
|
1761
1774
|
const value = e.target.value;
|
|
1762
1775
|
// Update query in state manager but don't trigger search immediately
|
|
1763
|
-
// Search will be triggered on Enter or
|
|
1776
|
+
// Search will be triggered on Enter, suggestion select, or after debounce if searchAsYouType
|
|
1764
1777
|
setQuery(value, false); // false = don't trigger search immediately
|
|
1765
1778
|
setSelectedIndex(-1);
|
|
1766
|
-
|
|
1779
|
+
if (searchAsYouType) {
|
|
1780
|
+
if (searchAsYouTypeRef.current)
|
|
1781
|
+
clearTimeout(searchAsYouTypeRef.current);
|
|
1782
|
+
searchAsYouTypeRef.current = setTimeout(() => {
|
|
1783
|
+
searchAsYouTypeRef.current = null;
|
|
1784
|
+
triggerSearch();
|
|
1785
|
+
}, debounceMs);
|
|
1786
|
+
}
|
|
1787
|
+
}, [setQuery, searchAsYouType, debounceMs, triggerSearch]);
|
|
1767
1788
|
const handleKeyDown = React.useCallback((e) => {
|
|
1768
1789
|
switch (e.key) {
|
|
1769
1790
|
case 'ArrowDown':
|
|
@@ -1839,10 +1860,17 @@ const SearchBar = ({ placeholder = 'Powered by Seekora', showSuggestions = true,
|
|
|
1839
1860
|
? `0 0 0 3px var(--seekora-border-focus-alpha, ${theme.colors.focus}33)`
|
|
1840
1861
|
: undefined;
|
|
1841
1862
|
const handleClear = React.useCallback(() => {
|
|
1863
|
+
if (searchAsYouTypeRef.current) {
|
|
1864
|
+
clearTimeout(searchAsYouTypeRef.current);
|
|
1865
|
+
searchAsYouTypeRef.current = null;
|
|
1866
|
+
}
|
|
1842
1867
|
setQuery('', false);
|
|
1843
1868
|
setSelectedIndex(-1);
|
|
1844
1869
|
inputRef.current?.focus();
|
|
1845
|
-
|
|
1870
|
+
if (searchAsYouType) {
|
|
1871
|
+
triggerSearch();
|
|
1872
|
+
}
|
|
1873
|
+
}, [setQuery, searchAsYouType, triggerSearch]);
|
|
1846
1874
|
const handleSubmit = React.useCallback(() => {
|
|
1847
1875
|
const currentValue = inputRef.current?.value || query;
|
|
1848
1876
|
handleSearch(currentValue);
|
|
@@ -16704,13 +16732,21 @@ function Results({ hits, groupedHits, selectedIndex, onSelect, onHover, scrollSe
|
|
|
16704
16732
|
}
|
|
16705
16733
|
|
|
16706
16734
|
function SeekoraLogo() {
|
|
16707
|
-
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0
|
|
16708
|
-
React.createElement("path", { fill: "#03d1ff", d: "
|
|
16709
|
-
React.createElement("path", { fill: "#4d66fe", d: "
|
|
16710
|
-
React.createElement("path", { fill: "#4d66fe", d: "
|
|
16711
|
-
React.createElement("polygon", { fill: "#4d66fe", points: "
|
|
16712
|
-
React.createElement("polygon", { fill: "#4d66fe", points: "
|
|
16713
|
-
React.createElement("path", { fill: "#4d66fe", d: "
|
|
16735
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 844.6 192", height: "20", "aria-hidden": "true", style: { width: 'auto' } },
|
|
16736
|
+
React.createElement("path", { fill: "#03d1ff", d: "M73.06,85.38l-21.36,21.21-2.03,2.03c-3.19,3.19-8.3,2.84-11.07-.32-.52-.59-.95-1.27-1.27-2.04-.01-.03-.03-.07-.04-.1-.33-.79-.63-1.6-.92-2.41-1.59-4.57-2.44-9.48-2.42-14.6h.05c-.01-.13-.01-.27-.02-.4-.02-.46-.02-.92-.02-1.39,0-27.3,22.13-49.43,49.43-49.43,6.64,0,12.98,1.31,18.76,3.69-2.19,2.23-3.28,5.47-2.63,8.76.31,1.52.95,2.89,1.84,4.04.27.36.58.7.9,1.02-.12-.07-.25-.15-.38-.22-5.45-3.15-11.76-4.94-18.49-4.94-20.48,0-37.08,16.6-37.08,37.08,0,.42,0,.83.02,1.25h0c.08,2.58.43,5.09,1.02,7.5l.18-.18,4.98-4.99,10.15-10.15,4.32-4.32c2.43-2.43,5.96-3.35,9.26-2.41.01,0,.03,0,.04.01.05.01.1.02.15.04,2.04.62,3.76,1.88,4.94,3.55.78,1.08,1.32,2.33,1.59,3.67l1.28,6.5.32,1.63.02.14.42-.44,14.99-15.62,3.29-3.43,7.25-7.57,1.18-1.22,2.43-2.54,5.02-5.24.91-.95,1.71-1.78-1.31.25-2.68.53-.47.09-3.52.7h0s-4.01.8-4.01.8c-2.55.5-5.04-1.16-5.55-3.71-.45-2.26.8-4.47,2.87-5.3.27-.11.55-.19.85-.25l9.8-1.94,7.42-1.47,3.23-.63,4.96-.98c.12-.02.25-.05.37-.06.11-.01.22-.02.32-.03.22-.01.43,0,.65.01.96.08,1.89.47,2.65,1.12.81.69,1.35,1.62,1.56,2.64.03.15.05.29.07.44.02.23.03.45.02.68l-.23,6.05-.14,4.01-.05,1.44-.49,13.48v.24c-.09,2.55-2.19,4.55-4.72,4.55-.06,0-.11,0-.17,0-1.1-.04-2.1-.45-2.88-1.11-1.07-.9-1.73-2.27-1.67-3.78l.02-.59.09-2.55.12-3.52.12-3.51-50.81,54.4-5.17-27.42Z" }),
|
|
16737
|
+
React.createElement("path", { fill: "#4d66fe", d: "M23.04,158.85c-.27-1.39.15-2.83,1.12-3.85l22.71-23.81,3.29-3.43,7.25-7.57,1.18-1.22,7.46-7.77,1.77-1.85,2.56,12.48.14.31h0c2.32.86,4.75,1.49,7.27,1.88v12.46c-5.94-.67-11.56-2.39-16.67-4.98l-35.87,38.45-2.2-11.08Z" }),
|
|
16738
|
+
React.createElement("path", { fill: "#4d66fe", d: "M90.69,106.76v29.36c-2.22.31-4.49.47-6.79.47-.34,0-.67,0-1.01-.02v-21.93l7.8-7.88Z" }),
|
|
16739
|
+
React.createElement("polygon", { fill: "#4d66fe", points: "102.78 132.84 102.78 118.68 102.79 93.73 94.96 101.92 94.96 135.35 102.78 132.84" }),
|
|
16740
|
+
React.createElement("polygon", { fill: "#4d66fe", points: "114.86 125.64 114.87 104.87 114.88 81.6 107.05 89.78 107.05 130.82 114.86 125.64" }),
|
|
16741
|
+
React.createElement("path", { fill: "#4d66fe", d: "M126.98,69.42l-.02,23.28v18.6c-2.13,3.83-4.77,7.35-7.81,10.45v-44.13l7.83-8.19Z" }),
|
|
16742
|
+
React.createElement("path", { fill: "currentColor", d: "M455.59,136.31h-14.71l-.11-98.11h14.71l.11,98.11ZM520.86,136.65h-18.17l-27.34-32.14c-2.31-2.88-4.04-5.72-5.19-8.51-1.15-2.79-1.73-5.53-1.73-8.22s.55-5.57,1.66-8.36c1.1-2.79,2.86-5.63,5.26-8.51l27.73-32.54h16.87l-31.05,36.87c-1.92,2.4-3.39,4.57-4.4,6.49-1.01,1.92-1.51,3.8-1.51,5.62s.5,3.65,1.51,5.48c1.01,1.83,2.47,3.94,4.4,6.35l31.96,37.47Z" }),
|
|
16743
|
+
React.createElement("path", { fill: "currentColor", d: "M710.73,117.25c-2.6-5.48-5.14-10.12-7.64-13.92-2.5-3.8-5.48-6.68-8.94-8.65-.31-.18-.64-.33-.96-.49,2.69-.58,5.18-1.44,7.45-2.61,4.52-2.31,8.05-5.53,10.6-9.66,2.55-4.13,3.82-8.89,3.82-14.28,0-6.63-1.61-12.11-4.83-16.44-3.22-4.33-7.6-7.55-13.12-9.66-5.53-2.11-11.71-3.17-18.53-3.17h-33.61v98.14h14.42l.13-36.69h11.99c4.52,0,8.2.79,11.03,2.38,2.84,1.59,5.24,3.8,7.21,6.63,1.97,2.84,3.92,6.13,5.84,9.88l8.89,17.8h15.87l-9.61-19.24ZM659.55,86.67l.12-34.76h19.04c3.94,0,7.52.6,10.75,1.8,3.22,1.2,5.77,3.03,7.64,5.48,1.88,2.45,2.81,5.7,2.81,9.74s-.91,7.09-2.74,9.74c-1.83,2.65-4.38,4.64-7.64,5.99-3.27,1.35-6.97,2.02-11.11,2.02h-18.87Z" }),
|
|
16744
|
+
React.createElement("path", { fill: "currentColor", d: "M618.36,62.91c-2.26-4.27-5.09-8.11-8.5-11.53-4.5-4.49-9.72-8.01-15.65-10.55-5.94-2.54-12.39-3.8-19.38-3.8s-13.47,1.27-19.45,3.8c-5.98,2.54-11.22,6.06-15.72,10.55-4.5,4.5-8.02,9.74-10.55,15.72-2.54,5.98-3.81,12.47-3.81,19.45s1.27,13.66,3.81,19.74c2.53,6.08,6.05,11.37,10.55,15.86,4.49,4.5,9.74,8.02,15.72,10.55,5.98,2.54,12.46,3.81,19.45,3.81s13.44-1.27,19.38-3.81c5.94-2.53,11.15-6.05,15.65-10.55,4.23-4.23,7.58-9.18,10.03-14.82.15-.35.3-.69.44-1.04.57-1.4,1.08-2.83,1.52-4.28l12.51,4.15-2.67-20.65-2.66-20.65-7.32,6.03-9.78,8.06-3.24,2.67-13.86,11.43,12.73,4.23c-.32,1.16-.71,2.3-1.15,3.42-.26.65-.53,1.28-.82,1.9-1.64,3.58-3.81,6.74-6.5,9.52-3.16,3.25-6.82,5.81-10.98,7.68-4.16,1.87-8.59,2.8-13.28,2.8s-9.28-.93-13.5-2.8c-4.21-1.87-7.87-4.43-10.98-7.68-3.11-3.26-5.55-7.06-7.32-11.42-1.77-4.35-2.66-9.06-2.66-14.14s.89-9.62,2.66-13.93c1.77-4.31,4.21-8.09,7.32-11.34s6.77-5.79,10.98-7.61c4.21-1.82,8.71-2.73,13.5-2.73s9.24.91,13.35,2.73c4.11,1.82,7.75,4.36,10.91,7.61,3.16,3.25,5.6,7.03,7.32,11.34l11.95-9.72Z" }),
|
|
16745
|
+
React.createElement("circle", { fill: "currentColor", cx: "575.56", cy: "86.71", r: "9.38" }),
|
|
16746
|
+
React.createElement("path", { fill: "currentColor", d: "M206.51,137.4c-8.17,0-15.43-1.78-21.78-5.34-6.35-3.56-11.01-8.65-13.99-15.29l12.4-6.06c1.83,4.14,4.76,7.31,8.8,9.52,4.04,2.21,8.89,3.32,14.57,3.32,3.75,0,7.11-.55,10.1-1.66,2.98-1.1,5.36-2.79,7.14-5.05,1.78-2.26,2.67-4.98,2.67-8.15,0-3.56-.96-6.27-2.88-8.15-1.92-1.88-4.5-3.27-7.72-4.18-3.22-.91-6.76-1.71-10.6-2.38-3.66-.77-7.38-1.71-11.18-2.81-3.8-1.1-7.33-2.67-10.6-4.69-3.27-2.02-5.89-4.69-7.86-8-1.97-3.32-2.96-7.52-2.96-12.62,0-5.38,1.46-10.19,4.4-14.42,2.93-4.23,6.87-7.57,11.83-10.02,4.95-2.45,10.5-3.68,16.66-3.68,7.4,0,14.13,1.71,20.19,5.12,6.06,3.41,10.53,8.44,13.41,15.07l-12.26,6.35c-1.83-4.04-4.62-7.19-8.37-9.45-3.75-2.26-8.27-3.39-13.56-3.39-3.27,0-6.23.6-8.87,1.8-2.65,1.2-4.78,2.84-6.42,4.9-1.64,2.07-2.45,4.5-2.45,7.28,0,3.46,1.01,6.13,3.03,8.01,2.02,1.87,4.69,3.32,8,4.33,3.32,1.01,6.95,1.9,10.89,2.67,3.65.77,7.36,1.71,11.11,2.81,3.75,1.11,7.19,2.67,10.31,4.69,3.12,2.02,5.67,4.69,7.64,8,1.97,3.32,2.96,7.52,2.96,12.62,0,5.67-1.54,10.65-4.62,14.93-3.08,4.28-7.24,7.67-12.48,10.17-5.24,2.5-11.08,3.75-17.52,3.75Z" }),
|
|
16747
|
+
React.createElement("path", { fill: "currentColor", d: "M276.75,123.07v-28.94h49.04v-13.41h-49.04v-28.94h51.92v-13.41h-53.08c-5,0-8.51,1.18-10.53,3.53-2.02,2.36-3.03,5.6-3.03,9.74v71.58c0,4.04,1.01,7.26,3.03,9.66,2.02,2.41,5.53,3.61,10.53,3.61h54.09v-13.41h-52.93Z" }),
|
|
16748
|
+
React.createElement("path", { fill: "currentColor", d: "M365.12,123.24v-28.94h49.04v-13.41h-49.04v-28.94h51.92v-13.41h-53.08c-5,0-8.51,1.18-10.53,3.53-2.02,2.36-3.03,5.6-3.03,9.74v71.58c0,4.04,1.01,7.26,3.03,9.66,2.02,2.41,5.53,3.61,10.53,3.61h54.09v-13.41h-52.93Z" }),
|
|
16749
|
+
React.createElement("path", { fill: "currentColor", d: "M806.12,136.49h15l-26.59-85.62c-1.44-4.52-3.8-7.88-7.07-10.1-3.27-2.21-6.97-3.32-11.11-3.32s-7.57,1.11-10.89,3.32c-3.32,2.21-5.7,5.58-7.14,10.1l-26.6,85.46h14.86l8.95-29.72,41.68-.11,8.91,29.99ZM759.57,93.2l11.45-38.01c.87-2.98,2.69-4.47,5.48-4.47s4.52,1.49,5.48,4.47l11.29,38.01h-33.7Z" })));
|
|
16714
16750
|
}
|
|
16715
16751
|
function Footer({ translations = {} }) {
|
|
16716
16752
|
return (React.createElement("footer", { className: "seekora-docsearch-footer" },
|
|
@@ -16732,8 +16768,7 @@ function Footer({ translations = {} }) {
|
|
|
16732
16768
|
React.createElement("div", { className: "seekora-docsearch-footer-logo" },
|
|
16733
16769
|
React.createElement("span", { className: "seekora-docsearch-footer-logo-text" }, translations.searchByText || 'Search by'),
|
|
16734
16770
|
React.createElement("a", { href: "https://seekora.ai", target: "_blank", rel: "noopener noreferrer", className: "seekora-docsearch-footer-logo-link" },
|
|
16735
|
-
React.createElement(SeekoraLogo, null)
|
|
16736
|
-
React.createElement("span", { className: "seekora-docsearch-logo", style: { fontWeight: 600 } }, "Seekora")))));
|
|
16771
|
+
React.createElement(SeekoraLogo, null)))));
|
|
16737
16772
|
}
|
|
16738
16773
|
|
|
16739
16774
|
function useKeyboard(options) {
|