@envive-ai/react-widgets 0.1.2 → 0.3.0
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/SearchResults/SearchResults.cjs +82 -0
- package/dist/SearchResults/SearchResults.js +80 -0
- package/dist/SearchResults/SearchResultsWidget.cjs +34 -0
- package/dist/SearchResults/SearchResultsWidget.d.ts +6 -0
- package/dist/SearchResults/SearchResultsWidget.js +33 -0
- package/dist/SearchResults/index.cjs +2 -122
- package/dist/SearchResults/index.d.cts +2 -0
- package/dist/SearchResults/index.d.ts +2 -0
- package/dist/SearchResults/index.js +1 -119
- package/dist/SearchResults/withSearchResults.cjs +18 -0
- package/dist/SearchResults/withSearchResults.js +17 -0
- package/dist/SearchZeroState/SearchIcon.cjs +47 -0
- package/dist/SearchZeroState/SearchIcon.js +44 -0
- package/dist/SearchZeroState/SearchOverlay.cjs +42 -0
- package/dist/SearchZeroState/SearchOverlay.js +39 -0
- package/dist/SearchZeroState/SearchZeroState.cjs +169 -0
- package/dist/SearchZeroState/SearchZeroState.d.cts +7 -0
- package/dist/SearchZeroState/SearchZeroState.d.ts +7 -0
- package/dist/SearchZeroState/SearchZeroState.js +167 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.cjs +23 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.d.cts +15 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.d.ts +15 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.js +22 -0
- package/dist/SearchZeroState/components/RecommendedProducts.cjs +72 -0
- package/dist/SearchZeroState/components/RecommendedProducts.js +70 -0
- package/dist/SearchZeroState/index.cjs +4 -3070
- package/dist/SearchZeroState/index.d.cts +5 -0
- package/dist/SearchZeroState/index.d.ts +5 -0
- package/dist/SearchZeroState/index.js +2 -3065
- package/dist/SearchZeroState/overlay/overlayHostLocator.cjs +21 -0
- package/dist/SearchZeroState/overlay/overlayHostLocator.js +20 -0
- package/dist/SearchZeroState/types.d.cts +10 -0
- package/dist/SearchZeroState/types.d.ts +10 -0
- package/dist/SearchZeroState/zeroStateSearchVariants.cjs +21 -0
- package/dist/SearchZeroState/zeroStateSearchVariants.js +20 -0
- package/dist/SuggestionBar/SuggestionBar.cjs +74 -0
- package/dist/SuggestionBar/{index-DZU9kbWS.d.cts → SuggestionBar.d.cts} +5 -10
- package/dist/SuggestionBar/{index-DyXd4-b7.d.ts → SuggestionBar.d.ts} +5 -10
- package/dist/{SuggestionBar-BHAXhgcd.js → SuggestionBar/SuggestionBar.js} +6 -58
- package/dist/SuggestionBar/index.cjs +3 -3
- package/dist/SuggestionBar/index.d.cts +3 -0
- package/dist/SuggestionBar/index.d.ts +3 -0
- package/dist/SuggestionBar/index.js +2 -2
- package/dist/SuggestionBar/types.cjs +10 -0
- package/dist/SuggestionBar/types.d.cts +7 -0
- package/dist/SuggestionBar/types.d.ts +7 -0
- package/dist/SuggestionBar/types.js +9 -0
- package/dist/{SuggestionButtonContainer-Dm38gJiJ.cjs → SuggestionButtonContainer/SuggestionButtonContainer.cjs} +4 -102
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.cts +6 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +6 -0
- package/dist/{SuggestionButtonContainer-s2e9YGW_.js → SuggestionButtonContainer/SuggestionButtonContainer.js} +3 -96
- package/dist/SuggestionButtonContainer/index.cjs +1 -1
- package/dist/SuggestionButtonContainer/index.d.cts +3 -0
- package/dist/SuggestionButtonContainer/index.d.ts +3 -0
- package/dist/SuggestionButtonContainer/index.js +1 -1
- package/dist/SuggestionButtonContainer/{index-B_X537jw.d.cts → types.d.cts} +3 -6
- package/dist/SuggestionButtonContainer/{index-vwelzDzM.d.ts → types.d.ts} +3 -6
- package/dist/{chunk-DSlc6foC.cjs → _virtual/rolldown_runtime.cjs} +2 -12
- package/dist/hooks/dist/contexts/types.d.cts +52 -0
- package/dist/hooks/dist/types/test-types.d.cts +8 -0
- package/dist/{SuggestionBar-CK5aU2bb.cjs → node_modules/react-indiana-drag-scroll/dist/index.cjs} +6 -132
- package/dist/node_modules/uuid/dist/native.js +6 -0
- package/dist/node_modules/uuid/dist/rng.js +13 -0
- package/dist/node_modules/uuid/dist/stringify.js +9 -0
- package/dist/node_modules/uuid/dist/v4.js +27 -0
- package/dist/node_modules/uuid/dist-node/native.cjs +8 -0
- package/dist/node_modules/uuid/dist-node/rng.cjs +16 -0
- package/dist/node_modules/uuid/dist-node/stringify.cjs +10 -0
- package/dist/node_modules/uuid/dist-node/v4.cjs +27 -0
- package/dist/packages/hooks/dist/contexts/types.d.ts +52 -0
- package/dist/packages/hooks/dist/types/test-types.d.ts +8 -0
- package/dist/packages/icons/dist/AiSearchBold.cjs +38 -0
- package/dist/packages/icons/dist/AiSearchBold.js +38 -0
- package/dist/packages/icons/dist/AiSearchThin.cjs +35 -0
- package/dist/packages/icons/dist/AiSearchThin.js +35 -0
- package/dist/packages/icons/dist/IconCloseVariant.cjs +22 -0
- package/dist/packages/icons/dist/IconCloseVariant.js +22 -0
- package/dist/packages/icons/dist/Sparkles.cjs +43 -0
- package/dist/packages/icons/dist/Sparkles.js +43 -0
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +27 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +696 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +696 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +43 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +43 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +1528 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +1528 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +329 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +329 -0
- package/dist/packages/icons/dist/node_modules/react/index.cjs +13 -0
- package/dist/packages/icons/dist/node_modules/react/index.js +13 -0
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +13 -0
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +13 -0
- package/dist/util/useHorizontalScrollAnimation.cjs +88 -0
- package/dist/util/useHorizontalScrollAnimation.js +87 -0
- package/dist/util/useReducedMotionWithOverride.cjs +15 -0
- package/dist/util/useReducedMotionWithOverride.js +14 -0
- package/package.json +5 -5
- package/src/SearchZeroState/SearchZeroState.tsx +1 -1
- package/src/SuggestionBar/SuggestionBar.tsx +2 -2
- package/dist/SearchResults/index-DCTxvwmv.d.cts +0 -6
- package/dist/SearchZeroState/index-DSFtalZR.d.ts +0 -27
- package/dist/SearchZeroState/index-bEcxYOSF.d.cts +0 -27
- /package/dist/SearchResults/{index-CYPV3XE0.d.ts → SearchResultsWidget.d.cts} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_withSearchResults = require('./withSearchResults.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let classnames = require("classnames");
|
|
5
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
6
|
+
let __envive_ai_react_toolkit_SearchResultsContent = require("@envive-ai/react-toolkit/SearchResultsContent");
|
|
7
|
+
let __envive_ai_react_toolkit_SearchResultsFilterModal = require("@envive-ai/react-toolkit/SearchResultsFilterModal");
|
|
8
|
+
let __envive_ai_react_toolkit_SearchResultsToolbar = require("@envive-ai/react-toolkit/SearchResultsToolbar");
|
|
9
|
+
let __envive_ai_react_toolkit_util = require("@envive-ai/react-toolkit/util");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
//#region src/SearchResults/SearchResults.tsx
|
|
13
|
+
const SearchResultsComponent = ({ widgetConfig, productCardConfig, merchantShortName, productList, autocompleteResults, searchFilters, availableDynamicFilters, selectedFilterOptions, searchText, query, searchResultsState, isFilterOpen, shouldShowAutocomplete, focusedIndex, focusedOptionId, recommendedProducts, filterButtonText, onSearchInputChange, onSubmitSearch, onAutocompleteSelect, onKeyDown, onSearchInputFocus, onSearchInputBlur, onToggleDynamicFilter, onSelectFilterItem, onRemoveFilter, onClearAllFilters, setIsFilterOpen, searchResultsRef }) => {
|
|
14
|
+
const { searchInputVariant, searchFilterSidebarVariant, productGridVariant, searchBoxPlaceholder, noResultsFoundText, isSearchInputSticky = false } = widgetConfig;
|
|
15
|
+
const { toolbarRef: ref, isVisible, toolbarHeight: height } = (0, __envive_ai_react_toolkit_util.useStickyVisibility)();
|
|
16
|
+
const toolbarRef = isSearchInputSticky ? ref : null;
|
|
17
|
+
const finalIsVisible = isSearchInputSticky ? isVisible : true;
|
|
18
|
+
const toolbarHeight = isSearchInputSticky ? height : 0;
|
|
19
|
+
const stickyToolbarClasses = (0, classnames.default)("spiffy-tw-fixed", "spiffy-tw-top-0", "spiffy-tw-left-0", "spiffy-tw-right-0", "spiffy-tw-transition-transform", "spiffy-tw-duration-300", "spiffy-tw-py-[8px]");
|
|
20
|
+
const containerXPaddingClasses = (0, classnames.default)("spiffy-tw-px-[16px]", "sm:spiffy-tw-px-[46px]");
|
|
21
|
+
(0, react.useEffect)(() => {
|
|
22
|
+
window.scrollTo({
|
|
23
|
+
top: 0,
|
|
24
|
+
behavior: "smooth"
|
|
25
|
+
});
|
|
26
|
+
}, [productList]);
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
28
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SearchResultsFilterModal.SearchResultsFilterModal, {
|
|
29
|
+
isOpen: isFilterOpen,
|
|
30
|
+
setIsOpen: setIsFilterOpen,
|
|
31
|
+
searchFilters,
|
|
32
|
+
productCount: productList.length,
|
|
33
|
+
onSelectFilterItem,
|
|
34
|
+
onClearAllFilters,
|
|
35
|
+
searchFilterSidebarVariant,
|
|
36
|
+
filterButtonText
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SearchResultsToolbar.SearchResultsToolbar, {
|
|
39
|
+
className: isSearchInputSticky ? stickyToolbarClasses : "spiffy-tw-py-[8px]",
|
|
40
|
+
toolbarRef,
|
|
41
|
+
searchInputVariant,
|
|
42
|
+
searchBoxPlaceholder,
|
|
43
|
+
searchText,
|
|
44
|
+
focusedIndex,
|
|
45
|
+
focusedOptionId,
|
|
46
|
+
autocompleteResults,
|
|
47
|
+
filterButtonText,
|
|
48
|
+
onKeyDown,
|
|
49
|
+
onSearchInputChange,
|
|
50
|
+
onSubmitSearch,
|
|
51
|
+
onAutocompleteSelect,
|
|
52
|
+
onSearchInputFocus,
|
|
53
|
+
onSearchInputBlur,
|
|
54
|
+
shouldShowAutocomplete,
|
|
55
|
+
setIsFilterOpen,
|
|
56
|
+
containerXPaddingClasses,
|
|
57
|
+
isVisible: finalIsVisible
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SearchResultsContent.SearchResultsContent, {
|
|
60
|
+
searchResultsState,
|
|
61
|
+
productList,
|
|
62
|
+
recommendedProducts,
|
|
63
|
+
productCardConfig,
|
|
64
|
+
merchantShortName,
|
|
65
|
+
searchFilterSidebarVariant,
|
|
66
|
+
noResultsFoundText,
|
|
67
|
+
productGridVariant,
|
|
68
|
+
containerXPaddingClasses,
|
|
69
|
+
selectedFilterOptions,
|
|
70
|
+
availableDynamicFilters,
|
|
71
|
+
onRemoveFilter,
|
|
72
|
+
onToggleDynamicFilter,
|
|
73
|
+
searchResultsRef,
|
|
74
|
+
toolbarHeight,
|
|
75
|
+
query
|
|
76
|
+
})
|
|
77
|
+
] });
|
|
78
|
+
};
|
|
79
|
+
const SearchResults = require_withSearchResults.withSearchResults(SearchResultsComponent);
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.SearchResults = SearchResults;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { withSearchResults } from "./withSearchResults.js";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { SearchResultsContent } from "@envive-ai/react-toolkit/SearchResultsContent";
|
|
5
|
+
import { SearchResultsFilterModal } from "@envive-ai/react-toolkit/SearchResultsFilterModal";
|
|
6
|
+
import { SearchResultsToolbar } from "@envive-ai/react-toolkit/SearchResultsToolbar";
|
|
7
|
+
import { useStickyVisibility } from "@envive-ai/react-toolkit/util";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/SearchResults/SearchResults.tsx
|
|
11
|
+
const SearchResultsComponent = ({ widgetConfig, productCardConfig, merchantShortName, productList, autocompleteResults, searchFilters, availableDynamicFilters, selectedFilterOptions, searchText, query, searchResultsState, isFilterOpen, shouldShowAutocomplete, focusedIndex, focusedOptionId, recommendedProducts, filterButtonText, onSearchInputChange, onSubmitSearch, onAutocompleteSelect, onKeyDown, onSearchInputFocus, onSearchInputBlur, onToggleDynamicFilter, onSelectFilterItem, onRemoveFilter, onClearAllFilters, setIsFilterOpen, searchResultsRef }) => {
|
|
12
|
+
const { searchInputVariant, searchFilterSidebarVariant, productGridVariant, searchBoxPlaceholder, noResultsFoundText, isSearchInputSticky = false } = widgetConfig;
|
|
13
|
+
const { toolbarRef: ref, isVisible, toolbarHeight: height } = useStickyVisibility();
|
|
14
|
+
const toolbarRef = isSearchInputSticky ? ref : null;
|
|
15
|
+
const finalIsVisible = isSearchInputSticky ? isVisible : true;
|
|
16
|
+
const toolbarHeight = isSearchInputSticky ? height : 0;
|
|
17
|
+
const stickyToolbarClasses = classNames("spiffy-tw-fixed", "spiffy-tw-top-0", "spiffy-tw-left-0", "spiffy-tw-right-0", "spiffy-tw-transition-transform", "spiffy-tw-duration-300", "spiffy-tw-py-[8px]");
|
|
18
|
+
const containerXPaddingClasses = classNames("spiffy-tw-px-[16px]", "sm:spiffy-tw-px-[46px]");
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
window.scrollTo({
|
|
21
|
+
top: 0,
|
|
22
|
+
behavior: "smooth"
|
|
23
|
+
});
|
|
24
|
+
}, [productList]);
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(SearchResultsFilterModal, {
|
|
27
|
+
isOpen: isFilterOpen,
|
|
28
|
+
setIsOpen: setIsFilterOpen,
|
|
29
|
+
searchFilters,
|
|
30
|
+
productCount: productList.length,
|
|
31
|
+
onSelectFilterItem,
|
|
32
|
+
onClearAllFilters,
|
|
33
|
+
searchFilterSidebarVariant,
|
|
34
|
+
filterButtonText
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx(SearchResultsToolbar, {
|
|
37
|
+
className: isSearchInputSticky ? stickyToolbarClasses : "spiffy-tw-py-[8px]",
|
|
38
|
+
toolbarRef,
|
|
39
|
+
searchInputVariant,
|
|
40
|
+
searchBoxPlaceholder,
|
|
41
|
+
searchText,
|
|
42
|
+
focusedIndex,
|
|
43
|
+
focusedOptionId,
|
|
44
|
+
autocompleteResults,
|
|
45
|
+
filterButtonText,
|
|
46
|
+
onKeyDown,
|
|
47
|
+
onSearchInputChange,
|
|
48
|
+
onSubmitSearch,
|
|
49
|
+
onAutocompleteSelect,
|
|
50
|
+
onSearchInputFocus,
|
|
51
|
+
onSearchInputBlur,
|
|
52
|
+
shouldShowAutocomplete,
|
|
53
|
+
setIsFilterOpen,
|
|
54
|
+
containerXPaddingClasses,
|
|
55
|
+
isVisible: finalIsVisible
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx(SearchResultsContent, {
|
|
58
|
+
searchResultsState,
|
|
59
|
+
productList,
|
|
60
|
+
recommendedProducts,
|
|
61
|
+
productCardConfig,
|
|
62
|
+
merchantShortName,
|
|
63
|
+
searchFilterSidebarVariant,
|
|
64
|
+
noResultsFoundText,
|
|
65
|
+
productGridVariant,
|
|
66
|
+
containerXPaddingClasses,
|
|
67
|
+
selectedFilterOptions,
|
|
68
|
+
availableDynamicFilters,
|
|
69
|
+
onRemoveFilter,
|
|
70
|
+
onToggleDynamicFilter,
|
|
71
|
+
searchResultsRef,
|
|
72
|
+
toolbarHeight,
|
|
73
|
+
query
|
|
74
|
+
})
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
const SearchResults = withSearchResults(SearchResultsComponent);
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { SearchResults };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_SearchResults = require('./SearchResults.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let jotai = require("jotai");
|
|
5
|
+
let __envive_ai_react_hooks_atoms_globalSearch = require("@envive-ai/react-hooks/atoms/globalSearch");
|
|
6
|
+
let __envive_ai_react_hooks_atoms_search = require("@envive-ai/react-hooks/atoms/search");
|
|
7
|
+
let __envive_ai_react_hooks_hooks_NewOrgConfig = require("@envive-ai/react-hooks/hooks/NewOrgConfig");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
//#region src/SearchResults/SearchResultsWidget.tsx
|
|
11
|
+
const SearchResultsWidget = () => {
|
|
12
|
+
const setIsSearchResultsOpen = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_globalSearch.isSearchResultsOpenAtom);
|
|
13
|
+
const setSearchSystem = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_search.searchSystemAtom);
|
|
14
|
+
const newConfig = (0, __envive_ai_react_hooks_hooks_NewOrgConfig.useNewOrgConfig)();
|
|
15
|
+
(0, react.useEffect)(() => {
|
|
16
|
+
setSearchSystem(true);
|
|
17
|
+
return () => setSearchSystem(false);
|
|
18
|
+
}, [setSearchSystem]);
|
|
19
|
+
(0, react.useEffect)(() => {
|
|
20
|
+
setIsSearchResultsOpen(true);
|
|
21
|
+
return () => {
|
|
22
|
+
setIsSearchResultsOpen(false);
|
|
23
|
+
};
|
|
24
|
+
}, [setIsSearchResultsOpen]);
|
|
25
|
+
const widgetConfig = (0, react.useMemo)(() => {
|
|
26
|
+
if (newConfig && newConfig.frontendConfig?.widgetConfigs) return { ...(newConfig.frontendConfig?.widgetConfigs).find((widget) => widget.key === "searchResultsEntryPoint").config };
|
|
27
|
+
return null;
|
|
28
|
+
}, [newConfig]);
|
|
29
|
+
if (!widgetConfig) return null;
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SearchResults.SearchResults, { widgetConfig });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.SearchResultsWidget = SearchResultsWidget;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SearchResults } from "./SearchResults.js";
|
|
2
|
+
import { useEffect, useMemo } from "react";
|
|
3
|
+
import { useSetAtom } from "jotai";
|
|
4
|
+
import { isSearchResultsOpenAtom } from "@envive-ai/react-hooks/atoms/globalSearch";
|
|
5
|
+
import { searchSystemAtom } from "@envive-ai/react-hooks/atoms/search";
|
|
6
|
+
import { useNewOrgConfig } from "@envive-ai/react-hooks/hooks/NewOrgConfig";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/SearchResults/SearchResultsWidget.tsx
|
|
10
|
+
const SearchResultsWidget = () => {
|
|
11
|
+
const setIsSearchResultsOpen = useSetAtom(isSearchResultsOpenAtom);
|
|
12
|
+
const setSearchSystem = useSetAtom(searchSystemAtom);
|
|
13
|
+
const newConfig = useNewOrgConfig();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setSearchSystem(true);
|
|
16
|
+
return () => setSearchSystem(false);
|
|
17
|
+
}, [setSearchSystem]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setIsSearchResultsOpen(true);
|
|
20
|
+
return () => {
|
|
21
|
+
setIsSearchResultsOpen(false);
|
|
22
|
+
};
|
|
23
|
+
}, [setIsSearchResultsOpen]);
|
|
24
|
+
const widgetConfig = useMemo(() => {
|
|
25
|
+
if (newConfig && newConfig.frontendConfig?.widgetConfigs) return { ...(newConfig.frontendConfig?.widgetConfigs).find((widget) => widget.key === "searchResultsEntryPoint").config };
|
|
26
|
+
return null;
|
|
27
|
+
}, [newConfig]);
|
|
28
|
+
if (!widgetConfig) return null;
|
|
29
|
+
return /* @__PURE__ */ jsx(SearchResults, { widgetConfig });
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { SearchResultsWidget };
|
|
@@ -1,123 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
let react = require("react");
|
|
3
|
-
let jotai = require("jotai");
|
|
4
|
-
let __envive_ai_react_hooks_atoms_globalSearch = require("@envive-ai/react-hooks/atoms/globalSearch");
|
|
5
|
-
let __envive_ai_react_hooks_atoms_search = require("@envive-ai/react-hooks/atoms/search");
|
|
6
|
-
let __envive_ai_react_hooks_hooks_NewOrgConfig = require("@envive-ai/react-hooks/hooks/NewOrgConfig");
|
|
7
|
-
let classnames = require("classnames");
|
|
8
|
-
classnames = require_chunk.__toESM(classnames);
|
|
9
|
-
let __envive_ai_react_toolkit_SearchResultsContent = require("@envive-ai/react-toolkit/SearchResultsContent");
|
|
10
|
-
let __envive_ai_react_toolkit_SearchResultsFilterModal = require("@envive-ai/react-toolkit/SearchResultsFilterModal");
|
|
11
|
-
let __envive_ai_react_toolkit_SearchResultsToolbar = require("@envive-ai/react-toolkit/SearchResultsToolbar");
|
|
12
|
-
let __envive_ai_react_toolkit_util = require("@envive-ai/react-toolkit/util");
|
|
13
|
-
let __envive_ai_react_hooks_hooks_Search = require("@envive-ai/react-hooks/hooks/Search");
|
|
14
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
1
|
+
const require_SearchResultsWidget = require('./SearchResultsWidget.cjs');
|
|
15
2
|
|
|
16
|
-
|
|
17
|
-
function withSearchResults(Component) {
|
|
18
|
-
return function SearchResultsHoc(props) {
|
|
19
|
-
const searchHookResult = (0, __envive_ai_react_hooks_hooks_Search.useSearch)();
|
|
20
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
21
|
-
...props,
|
|
22
|
-
...searchHookResult,
|
|
23
|
-
productList: searchHookResult.searchData?.products || []
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/SearchResults/SearchResults.tsx
|
|
30
|
-
const SearchResultsComponent = ({ widgetConfig, productCardConfig, merchantShortName, productList, autocompleteResults, searchFilters, availableDynamicFilters, selectedFilterOptions, searchText, query, searchResultsState, isFilterOpen, shouldShowAutocomplete, focusedIndex, focusedOptionId, recommendedProducts, filterButtonText, onSearchInputChange, onSubmitSearch, onAutocompleteSelect, onKeyDown, onSearchInputFocus, onSearchInputBlur, onToggleDynamicFilter, onSelectFilterItem, onRemoveFilter, onClearAllFilters, setIsFilterOpen, searchResultsRef }) => {
|
|
31
|
-
const { searchInputVariant, searchFilterSidebarVariant, productGridVariant, searchBoxPlaceholder, noResultsFoundText, isSearchInputSticky = false } = widgetConfig;
|
|
32
|
-
const { toolbarRef: ref, isVisible, toolbarHeight: height } = (0, __envive_ai_react_toolkit_util.useStickyVisibility)();
|
|
33
|
-
const toolbarRef = isSearchInputSticky ? ref : null;
|
|
34
|
-
const finalIsVisible = isSearchInputSticky ? isVisible : true;
|
|
35
|
-
const toolbarHeight = isSearchInputSticky ? height : 0;
|
|
36
|
-
const stickyToolbarClasses = (0, classnames.default)("spiffy-tw-fixed", "spiffy-tw-top-0", "spiffy-tw-left-0", "spiffy-tw-right-0", "spiffy-tw-transition-transform", "spiffy-tw-duration-300", "spiffy-tw-py-[8px]");
|
|
37
|
-
const containerXPaddingClasses = (0, classnames.default)("spiffy-tw-px-[16px]", "sm:spiffy-tw-px-[46px]");
|
|
38
|
-
(0, react.useEffect)(() => {
|
|
39
|
-
window.scrollTo({
|
|
40
|
-
top: 0,
|
|
41
|
-
behavior: "smooth"
|
|
42
|
-
});
|
|
43
|
-
}, [productList]);
|
|
44
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
45
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SearchResultsFilterModal.SearchResultsFilterModal, {
|
|
46
|
-
isOpen: isFilterOpen,
|
|
47
|
-
setIsOpen: setIsFilterOpen,
|
|
48
|
-
searchFilters,
|
|
49
|
-
productCount: productList.length,
|
|
50
|
-
onSelectFilterItem,
|
|
51
|
-
onClearAllFilters,
|
|
52
|
-
searchFilterSidebarVariant,
|
|
53
|
-
filterButtonText
|
|
54
|
-
}),
|
|
55
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SearchResultsToolbar.SearchResultsToolbar, {
|
|
56
|
-
className: isSearchInputSticky ? stickyToolbarClasses : "spiffy-tw-py-[8px]",
|
|
57
|
-
toolbarRef,
|
|
58
|
-
searchInputVariant,
|
|
59
|
-
searchBoxPlaceholder,
|
|
60
|
-
searchText,
|
|
61
|
-
focusedIndex,
|
|
62
|
-
focusedOptionId,
|
|
63
|
-
autocompleteResults,
|
|
64
|
-
filterButtonText,
|
|
65
|
-
onKeyDown,
|
|
66
|
-
onSearchInputChange,
|
|
67
|
-
onSubmitSearch,
|
|
68
|
-
onAutocompleteSelect,
|
|
69
|
-
onSearchInputFocus,
|
|
70
|
-
onSearchInputBlur,
|
|
71
|
-
shouldShowAutocomplete,
|
|
72
|
-
setIsFilterOpen,
|
|
73
|
-
containerXPaddingClasses,
|
|
74
|
-
isVisible: finalIsVisible
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SearchResultsContent.SearchResultsContent, {
|
|
77
|
-
searchResultsState,
|
|
78
|
-
productList,
|
|
79
|
-
recommendedProducts,
|
|
80
|
-
productCardConfig,
|
|
81
|
-
merchantShortName,
|
|
82
|
-
searchFilterSidebarVariant,
|
|
83
|
-
noResultsFoundText,
|
|
84
|
-
productGridVariant,
|
|
85
|
-
containerXPaddingClasses,
|
|
86
|
-
selectedFilterOptions,
|
|
87
|
-
availableDynamicFilters,
|
|
88
|
-
onRemoveFilter,
|
|
89
|
-
onToggleDynamicFilter,
|
|
90
|
-
searchResultsRef,
|
|
91
|
-
toolbarHeight,
|
|
92
|
-
query
|
|
93
|
-
})
|
|
94
|
-
] });
|
|
95
|
-
};
|
|
96
|
-
const SearchResults = withSearchResults(SearchResultsComponent);
|
|
97
|
-
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/SearchResults/SearchResultsWidget.tsx
|
|
100
|
-
const SearchResultsWidget = () => {
|
|
101
|
-
const setIsSearchResultsOpen = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_globalSearch.isSearchResultsOpenAtom);
|
|
102
|
-
const setSearchSystem = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_search.searchSystemAtom);
|
|
103
|
-
const newConfig = (0, __envive_ai_react_hooks_hooks_NewOrgConfig.useNewOrgConfig)();
|
|
104
|
-
(0, react.useEffect)(() => {
|
|
105
|
-
setSearchSystem(true);
|
|
106
|
-
return () => setSearchSystem(false);
|
|
107
|
-
}, [setSearchSystem]);
|
|
108
|
-
(0, react.useEffect)(() => {
|
|
109
|
-
setIsSearchResultsOpen(true);
|
|
110
|
-
return () => {
|
|
111
|
-
setIsSearchResultsOpen(false);
|
|
112
|
-
};
|
|
113
|
-
}, [setIsSearchResultsOpen]);
|
|
114
|
-
const widgetConfig = (0, react.useMemo)(() => {
|
|
115
|
-
if (newConfig && newConfig.frontendConfig?.widgetConfigs) return { ...(newConfig.frontendConfig?.widgetConfigs).find((widget) => widget.key === "searchResultsEntryPoint").config };
|
|
116
|
-
return null;
|
|
117
|
-
}, [newConfig]);
|
|
118
|
-
if (!widgetConfig) return null;
|
|
119
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResults, { widgetConfig });
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
//#endregion
|
|
123
|
-
exports.SearchResultsWidget = SearchResultsWidget;
|
|
3
|
+
exports.SearchResultsWidget = require_SearchResultsWidget.SearchResultsWidget;
|
|
@@ -1,121 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useSetAtom } from "jotai";
|
|
3
|
-
import { isSearchResultsOpenAtom } from "@envive-ai/react-hooks/atoms/globalSearch";
|
|
4
|
-
import { searchSystemAtom } from "@envive-ai/react-hooks/atoms/search";
|
|
5
|
-
import { useNewOrgConfig } from "@envive-ai/react-hooks/hooks/NewOrgConfig";
|
|
6
|
-
import classNames from "classnames";
|
|
7
|
-
import { SearchResultsContent } from "@envive-ai/react-toolkit/SearchResultsContent";
|
|
8
|
-
import { SearchResultsFilterModal } from "@envive-ai/react-toolkit/SearchResultsFilterModal";
|
|
9
|
-
import { SearchResultsToolbar } from "@envive-ai/react-toolkit/SearchResultsToolbar";
|
|
10
|
-
import { useStickyVisibility } from "@envive-ai/react-toolkit/util";
|
|
11
|
-
import { useSearch } from "@envive-ai/react-hooks/hooks/Search";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { SearchResultsWidget } from "./SearchResultsWidget.js";
|
|
13
2
|
|
|
14
|
-
//#region src/SearchResults/withSearchResults.tsx
|
|
15
|
-
function withSearchResults(Component) {
|
|
16
|
-
return function SearchResultsHoc(props) {
|
|
17
|
-
const searchHookResult = useSearch();
|
|
18
|
-
return /* @__PURE__ */ jsx(Component, {
|
|
19
|
-
...props,
|
|
20
|
-
...searchHookResult,
|
|
21
|
-
productList: searchHookResult.searchData?.products || []
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/SearchResults/SearchResults.tsx
|
|
28
|
-
const SearchResultsComponent = ({ widgetConfig, productCardConfig, merchantShortName, productList, autocompleteResults, searchFilters, availableDynamicFilters, selectedFilterOptions, searchText, query, searchResultsState, isFilterOpen, shouldShowAutocomplete, focusedIndex, focusedOptionId, recommendedProducts, filterButtonText, onSearchInputChange, onSubmitSearch, onAutocompleteSelect, onKeyDown, onSearchInputFocus, onSearchInputBlur, onToggleDynamicFilter, onSelectFilterItem, onRemoveFilter, onClearAllFilters, setIsFilterOpen, searchResultsRef }) => {
|
|
29
|
-
const { searchInputVariant, searchFilterSidebarVariant, productGridVariant, searchBoxPlaceholder, noResultsFoundText, isSearchInputSticky = false } = widgetConfig;
|
|
30
|
-
const { toolbarRef: ref, isVisible, toolbarHeight: height } = useStickyVisibility();
|
|
31
|
-
const toolbarRef = isSearchInputSticky ? ref : null;
|
|
32
|
-
const finalIsVisible = isSearchInputSticky ? isVisible : true;
|
|
33
|
-
const toolbarHeight = isSearchInputSticky ? height : 0;
|
|
34
|
-
const stickyToolbarClasses = classNames("spiffy-tw-fixed", "spiffy-tw-top-0", "spiffy-tw-left-0", "spiffy-tw-right-0", "spiffy-tw-transition-transform", "spiffy-tw-duration-300", "spiffy-tw-py-[8px]");
|
|
35
|
-
const containerXPaddingClasses = classNames("spiffy-tw-px-[16px]", "sm:spiffy-tw-px-[46px]");
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
window.scrollTo({
|
|
38
|
-
top: 0,
|
|
39
|
-
behavior: "smooth"
|
|
40
|
-
});
|
|
41
|
-
}, [productList]);
|
|
42
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
43
|
-
/* @__PURE__ */ jsx(SearchResultsFilterModal, {
|
|
44
|
-
isOpen: isFilterOpen,
|
|
45
|
-
setIsOpen: setIsFilterOpen,
|
|
46
|
-
searchFilters,
|
|
47
|
-
productCount: productList.length,
|
|
48
|
-
onSelectFilterItem,
|
|
49
|
-
onClearAllFilters,
|
|
50
|
-
searchFilterSidebarVariant,
|
|
51
|
-
filterButtonText
|
|
52
|
-
}),
|
|
53
|
-
/* @__PURE__ */ jsx(SearchResultsToolbar, {
|
|
54
|
-
className: isSearchInputSticky ? stickyToolbarClasses : "spiffy-tw-py-[8px]",
|
|
55
|
-
toolbarRef,
|
|
56
|
-
searchInputVariant,
|
|
57
|
-
searchBoxPlaceholder,
|
|
58
|
-
searchText,
|
|
59
|
-
focusedIndex,
|
|
60
|
-
focusedOptionId,
|
|
61
|
-
autocompleteResults,
|
|
62
|
-
filterButtonText,
|
|
63
|
-
onKeyDown,
|
|
64
|
-
onSearchInputChange,
|
|
65
|
-
onSubmitSearch,
|
|
66
|
-
onAutocompleteSelect,
|
|
67
|
-
onSearchInputFocus,
|
|
68
|
-
onSearchInputBlur,
|
|
69
|
-
shouldShowAutocomplete,
|
|
70
|
-
setIsFilterOpen,
|
|
71
|
-
containerXPaddingClasses,
|
|
72
|
-
isVisible: finalIsVisible
|
|
73
|
-
}),
|
|
74
|
-
/* @__PURE__ */ jsx(SearchResultsContent, {
|
|
75
|
-
searchResultsState,
|
|
76
|
-
productList,
|
|
77
|
-
recommendedProducts,
|
|
78
|
-
productCardConfig,
|
|
79
|
-
merchantShortName,
|
|
80
|
-
searchFilterSidebarVariant,
|
|
81
|
-
noResultsFoundText,
|
|
82
|
-
productGridVariant,
|
|
83
|
-
containerXPaddingClasses,
|
|
84
|
-
selectedFilterOptions,
|
|
85
|
-
availableDynamicFilters,
|
|
86
|
-
onRemoveFilter,
|
|
87
|
-
onToggleDynamicFilter,
|
|
88
|
-
searchResultsRef,
|
|
89
|
-
toolbarHeight,
|
|
90
|
-
query
|
|
91
|
-
})
|
|
92
|
-
] });
|
|
93
|
-
};
|
|
94
|
-
const SearchResults = withSearchResults(SearchResultsComponent);
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/SearchResults/SearchResultsWidget.tsx
|
|
98
|
-
const SearchResultsWidget = () => {
|
|
99
|
-
const setIsSearchResultsOpen = useSetAtom(isSearchResultsOpenAtom);
|
|
100
|
-
const setSearchSystem = useSetAtom(searchSystemAtom);
|
|
101
|
-
const newConfig = useNewOrgConfig();
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
setSearchSystem(true);
|
|
104
|
-
return () => setSearchSystem(false);
|
|
105
|
-
}, [setSearchSystem]);
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
setIsSearchResultsOpen(true);
|
|
108
|
-
return () => {
|
|
109
|
-
setIsSearchResultsOpen(false);
|
|
110
|
-
};
|
|
111
|
-
}, [setIsSearchResultsOpen]);
|
|
112
|
-
const widgetConfig = useMemo(() => {
|
|
113
|
-
if (newConfig && newConfig.frontendConfig?.widgetConfigs) return { ...(newConfig.frontendConfig?.widgetConfigs).find((widget) => widget.key === "searchResultsEntryPoint").config };
|
|
114
|
-
return null;
|
|
115
|
-
}, [newConfig]);
|
|
116
|
-
if (!widgetConfig) return null;
|
|
117
|
-
return /* @__PURE__ */ jsx(SearchResults, { widgetConfig });
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
//#endregion
|
|
121
3
|
export { SearchResultsWidget };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __envive_ai_react_hooks_hooks_Search = require("@envive-ai/react-hooks/hooks/Search");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
|
|
5
|
+
//#region src/SearchResults/withSearchResults.tsx
|
|
6
|
+
function withSearchResults(Component) {
|
|
7
|
+
return function SearchResultsHoc(props) {
|
|
8
|
+
const searchHookResult = (0, __envive_ai_react_hooks_hooks_Search.useSearch)();
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
10
|
+
...props,
|
|
11
|
+
...searchHookResult,
|
|
12
|
+
productList: searchHookResult.searchData?.products || []
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.withSearchResults = withSearchResults;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useSearch } from "@envive-ai/react-hooks/hooks/Search";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/SearchResults/withSearchResults.tsx
|
|
5
|
+
function withSearchResults(Component) {
|
|
6
|
+
return function SearchResultsHoc(props) {
|
|
7
|
+
const searchHookResult = useSearch();
|
|
8
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
9
|
+
...props,
|
|
10
|
+
...searchHookResult,
|
|
11
|
+
productList: searchHookResult.searchData?.products || []
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { withSearchResults };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_AiSearchBold = require('../packages/icons/dist/AiSearchBold.cjs');
|
|
3
|
+
const require_AiSearchThin = require('../packages/icons/dist/AiSearchThin.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
6
|
+
let classnames = require("classnames");
|
|
7
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let __envive_ai_react_toolkit_Typography = require("@envive-ai/react-toolkit/Typography");
|
|
10
|
+
|
|
11
|
+
//#region src/SearchZeroState/SearchIcon.tsx
|
|
12
|
+
const SEARCH_ENTRYPOINT_BUTTON_TESTID = "spiffy-search-entrypoint-button";
|
|
13
|
+
const SearchIcon = ({ size = 22, variant = "thin", color = "currentColor", onClick, label, entryPointRef }) => {
|
|
14
|
+
const containerClasses = (0, classnames.default)([
|
|
15
|
+
"spiffy-global-search-input-container",
|
|
16
|
+
"spiffy-tw-relative",
|
|
17
|
+
"spiffy-tw-flex",
|
|
18
|
+
"spiffy-tw-items-center"
|
|
19
|
+
]);
|
|
20
|
+
const iconStrokeWidth = variant === "thin" ? "inherit" : "2px";
|
|
21
|
+
const IconComponent = {
|
|
22
|
+
thin: require_AiSearchThin.AiSearchThin_default,
|
|
23
|
+
bold: require_AiSearchBold.AiSearchBold_default
|
|
24
|
+
}[variant];
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
26
|
+
className: containerClasses,
|
|
27
|
+
type: "button",
|
|
28
|
+
onClick,
|
|
29
|
+
"data-testid": SEARCH_ENTRYPOINT_BUTTON_TESTID,
|
|
30
|
+
ref: entryPointRef,
|
|
31
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconComponent, {
|
|
32
|
+
style: {
|
|
33
|
+
width: size,
|
|
34
|
+
height: size
|
|
35
|
+
},
|
|
36
|
+
fill: color,
|
|
37
|
+
strokeWidth: iconStrokeWidth
|
|
38
|
+
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_Typography.Typography, {
|
|
39
|
+
variant: "body3",
|
|
40
|
+
className: "spiffy-global-search-text",
|
|
41
|
+
children: label
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.SearchIcon = SearchIcon;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AiSearchBold_default } from "../packages/icons/dist/AiSearchBold.js";
|
|
2
|
+
import { AiSearchThin_default } from "../packages/icons/dist/AiSearchThin.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Typography } from "@envive-ai/react-toolkit/Typography";
|
|
7
|
+
|
|
8
|
+
//#region src/SearchZeroState/SearchIcon.tsx
|
|
9
|
+
const SEARCH_ENTRYPOINT_BUTTON_TESTID = "spiffy-search-entrypoint-button";
|
|
10
|
+
const SearchIcon = ({ size = 22, variant = "thin", color = "currentColor", onClick, label, entryPointRef }) => {
|
|
11
|
+
const containerClasses = classNames([
|
|
12
|
+
"spiffy-global-search-input-container",
|
|
13
|
+
"spiffy-tw-relative",
|
|
14
|
+
"spiffy-tw-flex",
|
|
15
|
+
"spiffy-tw-items-center"
|
|
16
|
+
]);
|
|
17
|
+
const iconStrokeWidth = variant === "thin" ? "inherit" : "2px";
|
|
18
|
+
const IconComponent = {
|
|
19
|
+
thin: AiSearchThin_default,
|
|
20
|
+
bold: AiSearchBold_default
|
|
21
|
+
}[variant];
|
|
22
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
23
|
+
className: containerClasses,
|
|
24
|
+
type: "button",
|
|
25
|
+
onClick,
|
|
26
|
+
"data-testid": SEARCH_ENTRYPOINT_BUTTON_TESTID,
|
|
27
|
+
ref: entryPointRef,
|
|
28
|
+
children: [/* @__PURE__ */ jsx(IconComponent, {
|
|
29
|
+
style: {
|
|
30
|
+
width: size,
|
|
31
|
+
height: size
|
|
32
|
+
},
|
|
33
|
+
fill: color,
|
|
34
|
+
strokeWidth: iconStrokeWidth
|
|
35
|
+
}), label && /* @__PURE__ */ jsx(Typography, {
|
|
36
|
+
variant: "body3",
|
|
37
|
+
className: "spiffy-global-search-text",
|
|
38
|
+
children: label
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { SearchIcon };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_overlayHostLocator = require('./overlay/overlayHostLocator.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
5
|
+
let classnames = require("classnames");
|
|
6
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let framer_motion = require("framer-motion");
|
|
9
|
+
let react_dom = require("react-dom");
|
|
10
|
+
|
|
11
|
+
//#region src/SearchZeroState/SearchOverlay.tsx
|
|
12
|
+
const SearchOverlay = react.default.forwardRef(({ children, className, dataTestId, role, ariaModal, ariaLabelledby, id, usingPortal }, ref) => {
|
|
13
|
+
const overlayClasses = (0, classnames.default)("spiffy-search-overlay", "spiffy-tw-fixed", "spiffy-tw-top-[0]", "spiffy-tw-left-[0]", "spiffy-tw-h-[100vh]", "spiffy-tw-w-full", "spiffy-h-[calc(100%-1rem)]", "spiffy-tw-px-[24px] spiffy-tw-pt-[16px] sm:spiffy-tw-px-[41px] sm:spiffy-tw-pt-[40px]", "spiffy-tw-z-[2147483647]", "spiffy-tw-overflow-y-auto", "spiffy-tw-overflow-x-hidden", className);
|
|
14
|
+
const overlayContentClasses = (0, classnames.default)("spiffy-search-overlay-content", "spiffy-tw-flex spiffy-tw-flex-col", "spiffy-tw-min-h-full", className);
|
|
15
|
+
const node = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
16
|
+
ref,
|
|
17
|
+
className: overlayClasses,
|
|
18
|
+
initial: { opacity: 0 },
|
|
19
|
+
animate: { opacity: 1 },
|
|
20
|
+
exit: { opacity: 0 },
|
|
21
|
+
transition: { duration: .2 },
|
|
22
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23
|
+
className: overlayContentClasses,
|
|
24
|
+
"data-testid": dataTestId,
|
|
25
|
+
role,
|
|
26
|
+
"aria-modal": ariaModal,
|
|
27
|
+
"aria-labelledby": ariaLabelledby,
|
|
28
|
+
id,
|
|
29
|
+
children
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
if (!usingPortal) return node;
|
|
33
|
+
try {
|
|
34
|
+
return (0, react_dom.createPortal)(node, require_overlayHostLocator.getOverlayPortalTarget());
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return node;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
SearchOverlay.displayName = "SearchOverlay";
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.SearchOverlay = SearchOverlay;
|