@envive-ai/react-widgets 0.1.2 → 0.1.3
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 +86 -0
- package/dist/SearchResults/SearchResults.js +84 -0
- package/dist/SearchResults/SearchResultsWidget.cjs +34 -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 +48 -0
- package/dist/SearchZeroState/SearchIcon.js +45 -0
- package/dist/SearchZeroState/SearchOverlay.cjs +42 -0
- package/dist/SearchZeroState/SearchOverlay.js +39 -0
- package/dist/SearchZeroState/SearchZeroState.cjs +173 -0
- package/dist/SearchZeroState/SearchZeroState.d.cts +7 -0
- package/dist/SearchZeroState/SearchZeroState.d.ts +7 -0
- package/dist/SearchZeroState/SearchZeroState.js +171 -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 +74 -0
- package/dist/SearchZeroState/components/RecommendedProducts.js +72 -0
- package/dist/SearchZeroState/index.cjs +4 -3070
- package/dist/SearchZeroState/index.d.cts +4 -0
- package/dist/SearchZeroState/index.d.ts +4 -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} +4 -9
- package/dist/SuggestionBar/{index-DyXd4-b7.d.ts → SuggestionBar.d.ts} +6 -11
- package/dist/{SuggestionBar-BHAXhgcd.js → SuggestionBar/SuggestionBar.js} +7 -59
- 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/SuggestionButtonContainer.cjs +76 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.cts +6 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +6 -0
- package/dist/{SuggestionButtonContainer-s2e9YGW_.js → SuggestionButtonContainer/SuggestionButtonContainer.js} +6 -98
- 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} +1 -4
- package/dist/SuggestionButtonContainer/{index-vwelzDzM.d.ts → types.d.ts} +1 -4
- package/dist/{chunk-DSlc6foC.cjs → _virtual/rolldown_runtime.cjs} +2 -12
- package/dist/node_modules/react-icons/lib/iconBase.cjs +121 -0
- package/dist/node_modules/react-icons/lib/iconBase.js +119 -0
- package/dist/node_modules/react-icons/lib/iconContext.cjs +17 -0
- package/dist/node_modules/react-icons/lib/iconContext.js +14 -0
- package/dist/node_modules/react-icons/md/index.cjs +35 -0
- package/dist/node_modules/react-icons/md/index.js +35 -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/components/dist/components/Accordion/Accordion.cjs +80 -0
- package/dist/packages/components/dist/components/Accordion/Accordion.js +78 -0
- package/dist/packages/components/dist/components/Accordion/index.cjs +1 -0
- package/dist/packages/components/dist/components/Accordion/index.js +1 -0
- package/dist/packages/components/dist/components/AnimatedChevron/AnimatedChevron.cjs +30 -0
- package/dist/packages/components/dist/components/AnimatedChevron/AnimatedChevron.js +29 -0
- package/dist/packages/components/dist/components/ButtonBase/ButtonBase.cjs +56 -0
- package/dist/packages/components/dist/components/ButtonBase/ButtonBase.js +54 -0
- package/dist/packages/components/dist/components/ButtonBase/index.cjs +2 -0
- package/dist/packages/components/dist/components/ButtonBase/index.js +2 -0
- package/dist/packages/components/dist/components/ButtonBase/types.cjs +11 -0
- package/dist/packages/components/dist/components/ButtonBase/types.js +10 -0
- package/dist/packages/components/dist/components/FilterScrollbar/AppliedFiltersScrollbar.cjs +45 -0
- package/dist/packages/components/dist/components/FilterScrollbar/AppliedFiltersScrollbar.js +42 -0
- package/dist/packages/components/dist/components/FilterScrollbar/DynamicFiltersScrollbar.cjs +33 -0
- package/dist/packages/components/dist/components/FilterScrollbar/DynamicFiltersScrollbar.js +30 -0
- package/dist/packages/components/dist/components/ImageWithFallback/ImageWithFallback.cjs +45 -0
- package/dist/packages/components/dist/components/ImageWithFallback/ImageWithFallback.js +42 -0
- package/dist/packages/components/dist/components/ImageWithFallback/index.cjs +1 -0
- package/dist/packages/components/dist/components/ImageWithFallback/index.js +1 -0
- package/dist/packages/components/dist/components/ModalSheet/ModalSheet.cjs +30 -0
- package/dist/packages/components/dist/components/ModalSheet/ModalSheet.js +29 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/desktopHeader.cjs +26 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/desktopHeader.js +24 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/index.cjs +122 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/index.js +120 -0
- package/dist/packages/components/dist/components/ModalSheet/index.cjs +1 -0
- package/dist/packages/components/dist/components/ModalSheet/index.js +1 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/index.cjs +116 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/index.js +114 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/mobileHeader.cjs +38 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/mobileHeader.js +36 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCard.cjs +153 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCard.js +149 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCardSkeleton.cjs +33 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCardSkeleton.js +31 -0
- package/dist/packages/components/dist/components/ProductCard/index.cjs +4 -0
- package/dist/packages/components/dist/components/ProductCard/index.js +4 -0
- package/dist/packages/components/dist/components/ProductCard/productCardVariants.cjs +49 -0
- package/dist/packages/components/dist/components/ProductCard/productCardVariants.js +45 -0
- package/dist/packages/components/dist/components/ProductCard/types.cjs +10 -0
- package/dist/packages/components/dist/components/ProductCard/types.js +9 -0
- package/dist/packages/components/dist/components/ProductGrid/ProductGrid.cjs +43 -0
- package/dist/packages/components/dist/components/ProductGrid/ProductGrid.js +41 -0
- package/dist/packages/components/dist/components/ProductGrid/index.cjs +2 -0
- package/dist/packages/components/dist/components/ProductGrid/index.js +2 -0
- package/dist/packages/components/dist/components/ProductGrid/productGridVariants.cjs +21 -0
- package/dist/packages/components/dist/components/ProductGrid/productGridVariants.js +20 -0
- package/dist/packages/components/dist/components/RadioButton/RadioButton.cjs +74 -0
- package/dist/packages/components/dist/components/RadioButton/RadioButton.js +72 -0
- package/dist/packages/components/dist/components/RadioButton/index.cjs +1 -0
- package/dist/packages/components/dist/components/RadioButton/index.js +1 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/RadioButtonGroup.cjs +42 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/RadioButtonGroup.js +39 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/index.cjs +1 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/index.js +1 -0
- package/dist/packages/components/dist/components/RecommendedProducts/RecommendedProducts.cjs +53 -0
- package/dist/packages/components/dist/components/RecommendedProducts/RecommendedProducts.js +51 -0
- package/dist/packages/components/dist/components/RecommendedProducts/index.cjs +3 -0
- package/dist/packages/components/dist/components/RecommendedProducts/index.js +3 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/SearchAutocomplete.cjs +72 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/SearchAutocomplete.js +69 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/index.cjs +1 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/index.js +1 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilter.cjs +134 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilter.js +132 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterFooter.cjs +48 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterFooter.js +46 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterHeader.cjs +42 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterHeader.js +40 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterItem.cjs +6 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterItem.js +4 -0
- package/dist/packages/components/dist/components/SearchFilter/index.cjs +5 -0
- package/dist/packages/components/dist/components/SearchFilter/index.js +5 -0
- package/dist/packages/components/dist/components/SearchFilter/useHasFilterStateChanged.cjs +27 -0
- package/dist/packages/components/dist/components/SearchFilter/useHasFilterStateChanged.js +26 -0
- package/dist/packages/components/dist/components/SearchFilter/utils.cjs +11 -0
- package/dist/packages/components/dist/components/SearchFilter/utils.js +9 -0
- package/dist/packages/components/dist/components/SearchInput/SearchInput.cjs +81 -0
- package/dist/packages/components/dist/components/SearchInput/SearchInput.js +78 -0
- package/dist/packages/components/dist/components/SearchInput/index.cjs +2 -0
- package/dist/packages/components/dist/components/SearchInput/index.js +2 -0
- package/dist/packages/components/dist/components/SearchInput/searchInputVariants.cjs +15 -0
- package/dist/packages/components/dist/components/SearchInput/searchInputVariants.js +15 -0
- package/dist/packages/components/dist/components/SearchInputForm/SearchInputForm.cjs +57 -0
- package/dist/packages/components/dist/components/SearchInputForm/SearchInputForm.js +55 -0
- package/dist/packages/components/dist/components/SearchInputForm/index.cjs +1 -0
- package/dist/packages/components/dist/components/SearchInputForm/index.js +1 -0
- package/dist/packages/components/dist/components/SearchResultsContent/SearchResultsContent.cjs +52 -0
- package/dist/packages/components/dist/components/SearchResultsContent/SearchResultsContent.js +50 -0
- package/dist/packages/components/dist/components/SearchResultsContent/index.cjs +1 -0
- package/dist/packages/components/dist/components/SearchResultsContent/index.js +1 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/SearchResultsFilterButton.cjs +24 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/SearchResultsFilterButton.js +23 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/index.js +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/SearchResultsFilterModal.cjs +36 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/SearchResultsFilterModal.js +35 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/index.js +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/SearchResultsFilter.cjs +9 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/SearchResultsFilter.js +9 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/index.cjs +2 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/index.js +2 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.cjs +34 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.js +34 -0
- package/dist/packages/components/dist/components/SearchResultsStates/NoSearchResultsFound.cjs +56 -0
- package/dist/packages/components/dist/components/SearchResultsStates/NoSearchResultsFound.js +54 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsGrid.cjs +53 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsGrid.js +51 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsLoadingGrid.cjs +52 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsLoadingGrid.js +51 -0
- package/dist/packages/components/dist/components/SearchResultsStates/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsStates/index.js +3 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/SearchResultsToolbar.cjs +60 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/SearchResultsToolbar.js +57 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/index.js +3 -0
- package/dist/packages/components/dist/components/SparkleAnimation/SparkleAnimation.cjs +77 -0
- package/dist/packages/components/dist/components/SparkleAnimation/SparkleAnimation.js +75 -0
- package/dist/packages/components/dist/components/SparkleAnimation/index.cjs +2 -0
- package/dist/packages/components/dist/components/SparkleAnimation/index.js +2 -0
- package/dist/packages/components/dist/components/SparkleAnimation/types.cjs +12 -0
- package/dist/packages/components/dist/components/SparkleAnimation/types.js +11 -0
- package/dist/packages/components/dist/components/Spinner/Spinner.cjs +40 -0
- package/dist/packages/components/dist/components/Spinner/Spinner.js +38 -0
- package/dist/packages/components/dist/components/Spinner/index.cjs +1 -0
- package/dist/packages/components/dist/components/Spinner/index.js +1 -0
- package/dist/packages/components/dist/components/SuggestionButton/SuggestionButton.cjs +193 -0
- package/dist/packages/components/dist/components/SuggestionButton/SuggestionButton.js +188 -0
- package/dist/packages/components/dist/components/SuggestionButton/index.cjs +1 -0
- package/dist/packages/components/dist/components/SuggestionButton/index.js +1 -0
- package/dist/packages/components/dist/components/TextInput/TextInput.cjs +34 -0
- package/dist/packages/components/dist/components/TextInput/TextInput.js +31 -0
- package/dist/packages/components/dist/components/TextInput/index.cjs +1 -0
- package/dist/packages/components/dist/components/TextInput/index.js +1 -0
- package/dist/packages/components/dist/components/ToggleButton/ToggleButton.cjs +63 -0
- package/dist/packages/components/dist/components/ToggleButton/ToggleButton.js +61 -0
- package/dist/packages/components/dist/components/ToggleButton/index.cjs +1 -0
- package/dist/packages/components/dist/components/ToggleButton/index.js +1 -0
- package/dist/packages/components/dist/components/Typography/Typography.cjs +53 -0
- package/dist/packages/components/dist/components/Typography/Typography.js +50 -0
- package/dist/packages/components/dist/components/Typography/index.cjs +2 -0
- package/dist/packages/components/dist/components/Typography/index.js +2 -0
- package/dist/packages/components/dist/components/Typography/typographyVariantClasses.cjs +99 -0
- package/dist/packages/components/dist/components/Typography/typographyVariantClasses.js +96 -0
- package/dist/packages/components/dist/components/Typography/util.cjs +10 -0
- package/dist/packages/components/dist/components/Typography/util.js +10 -0
- package/dist/packages/components/dist/logging/logger.cjs +20 -0
- package/dist/packages/components/dist/logging/logger.js +19 -0
- package/dist/packages/components/dist/models/colorsConfig.cjs +28 -0
- package/dist/packages/components/dist/models/colorsConfig.js +26 -0
- package/dist/packages/components/dist/util/formatPrice.cjs +14 -0
- package/dist/packages/components/dist/util/formatPrice.js +13 -0
- package/dist/packages/components/dist/util/index.cjs +3 -0
- package/dist/packages/components/dist/util/index.js +3 -0
- package/dist/packages/components/dist/util/useScrollDirection.cjs +39 -0
- package/dist/packages/components/dist/util/useScrollDirection.js +38 -0
- package/dist/packages/components/dist/util/useStickyVisibility.cjs +38 -0
- package/dist/packages/components/dist/util/useStickyVisibility.js +37 -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/ChevronDown.cjs +23 -0
- package/dist/packages/icons/dist/ChevronDown.js +23 -0
- package/dist/packages/icons/dist/FourPointStar.cjs +22 -0
- package/dist/packages/icons/dist/FourPointStar.js +22 -0
- package/dist/packages/icons/dist/IconClose.cjs +26 -0
- package/dist/packages/icons/dist/IconClose.js +26 -0
- package/dist/packages/icons/dist/IconCloseVariant.cjs +22 -0
- package/dist/packages/icons/dist/IconCloseVariant.js +22 -0
- package/dist/packages/icons/dist/MagnifyingGlassStarVariant.cjs +39 -0
- package/dist/packages/icons/dist/MagnifyingGlassStarVariant.js +39 -0
- package/dist/packages/icons/dist/OutlinedStar.cjs +22 -0
- package/dist/packages/icons/dist/OutlinedStar.js +22 -0
- package/dist/packages/icons/dist/SettingsVariant.cjs +72 -0
- package/dist/packages/icons/dist/SettingsVariant.js +72 -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 +3 -5
- package/src/SearchZeroState/SearchZeroState.tsx +1 -1
- package/src/SuggestionBar/SuggestionBar.tsx +2 -2
- package/dist/SearchZeroState/index-DSFtalZR.d.ts +0 -27
- package/dist/SearchZeroState/index-bEcxYOSF.d.cts +0 -27
- package/dist/SuggestionButtonContainer-Dm38gJiJ.cjs +0 -173
- /package/dist/SearchResults/{index-DCTxvwmv.d.cts → SearchResultsWidget.d.cts} +0 -0
- /package/dist/SearchResults/{index-CYPV3XE0.d.ts → SearchResultsWidget.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/SearchZeroState/overlay/overlayHostLocator.ts
|
|
3
|
+
const SEARCH_OVERLAY_ENTRYPOINT_ID = "spiffy-ai-search-overlay-entrypoint";
|
|
4
|
+
const SEARCH_OVERLAY_PORTAL_ID = "spiffy-ai-search-overlay-portal";
|
|
5
|
+
/**
|
|
6
|
+
* Find the portal target inside the overlay host's ShadowRoot.
|
|
7
|
+
*/
|
|
8
|
+
function getOverlayPortalTarget(hostId = SEARCH_OVERLAY_ENTRYPOINT_ID) {
|
|
9
|
+
const bareMount = document.getElementById(SEARCH_OVERLAY_PORTAL_ID);
|
|
10
|
+
if (bareMount) return bareMount;
|
|
11
|
+
const host = document.getElementById(hostId);
|
|
12
|
+
if (!host) throw new Error(`[Overlay] Host #${hostId} not found`);
|
|
13
|
+
const sr = host.shadowRoot;
|
|
14
|
+
if (!sr) throw new Error("[Overlay] Host has no shadowRoot (was it initialized?)");
|
|
15
|
+
const mount = sr.getElementById(SEARCH_OVERLAY_PORTAL_ID);
|
|
16
|
+
if (!mount) throw new Error("[Overlay] Portal mount missing inside ShadowRoot");
|
|
17
|
+
return mount;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.getOverlayPortalTarget = getOverlayPortalTarget;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/SearchZeroState/overlay/overlayHostLocator.ts
|
|
2
|
+
const SEARCH_OVERLAY_ENTRYPOINT_ID = "spiffy-ai-search-overlay-entrypoint";
|
|
3
|
+
const SEARCH_OVERLAY_PORTAL_ID = "spiffy-ai-search-overlay-portal";
|
|
4
|
+
/**
|
|
5
|
+
* Find the portal target inside the overlay host's ShadowRoot.
|
|
6
|
+
*/
|
|
7
|
+
function getOverlayPortalTarget(hostId = SEARCH_OVERLAY_ENTRYPOINT_ID) {
|
|
8
|
+
const bareMount = document.getElementById(SEARCH_OVERLAY_PORTAL_ID);
|
|
9
|
+
if (bareMount) return bareMount;
|
|
10
|
+
const host = document.getElementById(hostId);
|
|
11
|
+
if (!host) throw new Error(`[Overlay] Host #${hostId} not found`);
|
|
12
|
+
const sr = host.shadowRoot;
|
|
13
|
+
if (!sr) throw new Error("[Overlay] Host has no shadowRoot (was it initialized?)");
|
|
14
|
+
const mount = sr.getElementById(SEARCH_OVERLAY_PORTAL_ID);
|
|
15
|
+
if (!mount) throw new Error("[Overlay] Portal mount missing inside ShadowRoot");
|
|
16
|
+
return mount;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getOverlayPortalTarget };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
2
|
+
|
|
3
|
+
//#region src/SearchZeroState/types.d.ts
|
|
4
|
+
interface SearchZeroStateProps {
|
|
5
|
+
widgetConfig: SearchEntryPointWidgetConfig;
|
|
6
|
+
initialIsOpen?: boolean;
|
|
7
|
+
entryPointRef?: React.Ref<HTMLButtonElement>;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { type SearchEntryPointWidgetConfig, type SearchInputVariant, SearchZeroStateProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
2
|
+
|
|
3
|
+
//#region src/SearchZeroState/types.d.ts
|
|
4
|
+
interface SearchZeroStateProps {
|
|
5
|
+
widgetConfig: SearchEntryPointWidgetConfig;
|
|
6
|
+
initialIsOpen?: boolean;
|
|
7
|
+
entryPointRef?: React.Ref<HTMLButtonElement>;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { type SearchEntryPointWidgetConfig, type SearchInputVariant, SearchZeroStateProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __envive_ai_react_hooks_contexts_types = require("@envive-ai/react-hooks/contexts/types");
|
|
3
|
+
|
|
4
|
+
//#region src/SearchZeroState/zeroStateSearchVariants.ts
|
|
5
|
+
const searchZeroStateVariantClasses = {
|
|
6
|
+
backgroundTertiary: {
|
|
7
|
+
overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-tertiary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
|
|
8
|
+
sparklesIconColor: (0, __envive_ai_react_hooks_contexts_types.colorVar)(__envive_ai_react_hooks_contexts_types.ColorNames.AccentPrimary)
|
|
9
|
+
},
|
|
10
|
+
backgroundDark: {
|
|
11
|
+
overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
|
|
12
|
+
sparklesIconColor: (0, __envive_ai_react_hooks_contexts_types.colorVar)(__envive_ai_react_hooks_contexts_types.ColorNames.AccentPrimary)
|
|
13
|
+
},
|
|
14
|
+
backgroundPrimary: {
|
|
15
|
+
overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
|
|
16
|
+
sparklesIconColor: (0, __envive_ai_react_hooks_contexts_types.colorVar)(__envive_ai_react_hooks_contexts_types.ColorNames.AccentPrimary)
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.searchZeroStateVariantClasses = searchZeroStateVariantClasses;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ColorNames, colorVar } from "@envive-ai/react-hooks/contexts/types";
|
|
2
|
+
|
|
3
|
+
//#region src/SearchZeroState/zeroStateSearchVariants.ts
|
|
4
|
+
const searchZeroStateVariantClasses = {
|
|
5
|
+
backgroundTertiary: {
|
|
6
|
+
overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-tertiary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
|
|
7
|
+
sparklesIconColor: colorVar(ColorNames.AccentPrimary)
|
|
8
|
+
},
|
|
9
|
+
backgroundDark: {
|
|
10
|
+
overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
|
|
11
|
+
sparklesIconColor: colorVar(ColorNames.AccentPrimary)
|
|
12
|
+
},
|
|
13
|
+
backgroundPrimary: {
|
|
14
|
+
overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
|
|
15
|
+
sparklesIconColor: colorVar(ColorNames.AccentPrimary)
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { searchZeroStateVariantClasses };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../node_modules/react-indiana-drag-scroll/dist/index.cjs');
|
|
3
|
+
const require_v4 = require('../node_modules/uuid/dist-node/v4.cjs');
|
|
4
|
+
const require_types = require('./types.cjs');
|
|
5
|
+
const require_SuggestionButtonContainer = require('../SuggestionButtonContainer/SuggestionButtonContainer.cjs');
|
|
6
|
+
require('../SuggestionButtonContainer/index.cjs');
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let jotai = require("jotai");
|
|
9
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
10
|
+
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
11
|
+
let __envive_ai_react_hooks_config = require("@envive-ai/react-hooks/config");
|
|
12
|
+
let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
|
|
13
|
+
let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
|
|
14
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
//#region src/SuggestionBar/SuggestionBar.tsx
|
|
17
|
+
var import_dist = require_index.default;
|
|
18
|
+
function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, hoverButtonVariation, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", handleReply, dataTestId }) {
|
|
19
|
+
const componentVisibleTriggerRef = (0, react.useRef)(null);
|
|
20
|
+
const containerRef = (0, react.useRef)(null);
|
|
21
|
+
const { ref } = (0, import_dist.useScrollContainer)();
|
|
22
|
+
const isSmallScreen = (0, __envive_ai_react_hooks_hooks_IsSmallScreen.useIsSmallScreen)();
|
|
23
|
+
const logPerfMetric = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat.logPerfMetricAtom);
|
|
24
|
+
const isAnimated = animationSpeed !== "none";
|
|
25
|
+
(0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(__envive_ai_react_hooks_application_models.SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, { animated: isAnimated });
|
|
26
|
+
const handleClickSuggestion = (0, react.useCallback)((buttonText) => {
|
|
27
|
+
handleReply({
|
|
28
|
+
id: require_v4.default(),
|
|
29
|
+
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
30
|
+
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
31
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32
|
+
metadata: { content: buttonText }
|
|
33
|
+
});
|
|
34
|
+
}, [handleReply]);
|
|
35
|
+
const setRefs = (0, react.useCallback)((el) => {
|
|
36
|
+
if (typeof ref === "function") ref(el);
|
|
37
|
+
containerRef.current = el;
|
|
38
|
+
}, [ref]);
|
|
39
|
+
const handleContainerRef = (0, react.useCallback)((el) => {
|
|
40
|
+
if (el) logPerfMetric(locationForMetrics === require_types.SuggestionBarLocationForMetrics.SUGGESTION_BAR_TOP ? __envive_ai_react_hooks_atoms_chat.PerfMetricsEvents.TopSuggestionsBarRendered : __envive_ai_react_hooks_atoms_chat.PerfMetricsEvents.BottomSuggestionsBarRendered);
|
|
41
|
+
setRefs(el);
|
|
42
|
+
}, [
|
|
43
|
+
locationForMetrics,
|
|
44
|
+
logPerfMetric,
|
|
45
|
+
setRefs
|
|
46
|
+
]);
|
|
47
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
+
id,
|
|
49
|
+
className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
|
|
50
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
51
|
+
className: `spiffy-tw-no-scrollbar spiffy-tw-relative spiffy-tw-w-full spiffy-tw-overflow-y-hidden spiffy-tw-overflow-x-scroll ${twoRowsOnMobile && isSmallScreen ? "spiffy-tw-h-20" : "spiffy-tw-h-9"} `,
|
|
52
|
+
ref: handleContainerRef,
|
|
53
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
54
|
+
className: "spiffy-tw-relative spiffy-tw-inline-block spiffy-tw-whitespace-nowrap",
|
|
55
|
+
ref: componentVisibleTriggerRef,
|
|
56
|
+
"data-testid": dataTestId || __envive_ai_react_hooks_config.SUGGESTION_BAR_TESTID,
|
|
57
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButtonContainer.SuggestionButtonContainer, {
|
|
58
|
+
buttonVariation,
|
|
59
|
+
hoverButtonVariation,
|
|
60
|
+
buttonTexts,
|
|
61
|
+
onButtonClick: handleClickSuggestion,
|
|
62
|
+
scrollContainerRef: containerRef,
|
|
63
|
+
boldFirstButton,
|
|
64
|
+
twoRowsOnMobile,
|
|
65
|
+
animationSpeed,
|
|
66
|
+
buttonBorderRadius
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.SuggestionBar = SuggestionBar;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
+
import { SuggestionBarLocationForMetrics } from "./types.cjs";
|
|
1
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
3
|
-
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
6
|
-
//#region src/SuggestionBar/types.d.ts
|
|
7
|
-
declare enum SuggestionBarLocationForMetrics {
|
|
8
|
-
SUGGESTION_BAR_TOP = "top",
|
|
9
|
-
SUGGESTION_BAR_BOTTOM = "bottom",
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
6
|
//#region src/SuggestionBar/SuggestionBar.d.ts
|
|
13
|
-
interface SuggestionBarProps
|
|
7
|
+
interface SuggestionBarProps {
|
|
14
8
|
id: string;
|
|
15
9
|
locationForMetrics: SuggestionBarLocationForMetrics;
|
|
16
10
|
buttonTexts: string[];
|
|
@@ -21,6 +15,7 @@ interface SuggestionBarProps extends TestProps {
|
|
|
21
15
|
twoRowsOnMobile?: boolean | undefined;
|
|
22
16
|
animationSpeed?: 'standard' | 'slow' | 'none';
|
|
23
17
|
buttonBorderRadius?: 'sm' | 'md' | 'lg';
|
|
18
|
+
dataTestId?: string;
|
|
24
19
|
}
|
|
25
20
|
declare function SuggestionBar({
|
|
26
21
|
id,
|
|
@@ -36,4 +31,4 @@ declare function SuggestionBar({
|
|
|
36
31
|
dataTestId
|
|
37
32
|
}: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
|
|
38
33
|
//#endregion
|
|
39
|
-
export { SuggestionBar
|
|
34
|
+
export { SuggestionBar };
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { SuggestionBarLocationForMetrics } from "./types.js";
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
6
|
-
//#region src/SuggestionBar/types.d.ts
|
|
7
|
-
declare enum SuggestionBarLocationForMetrics {
|
|
8
|
-
SUGGESTION_BAR_TOP = "top",
|
|
9
|
-
SUGGESTION_BAR_BOTTOM = "bottom",
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
6
|
//#region src/SuggestionBar/SuggestionBar.d.ts
|
|
13
|
-
interface SuggestionBarProps
|
|
7
|
+
interface SuggestionBarProps {
|
|
14
8
|
id: string;
|
|
15
9
|
locationForMetrics: SuggestionBarLocationForMetrics;
|
|
16
10
|
buttonTexts: string[];
|
|
@@ -21,6 +15,7 @@ interface SuggestionBarProps extends TestProps {
|
|
|
21
15
|
twoRowsOnMobile?: boolean | undefined;
|
|
22
16
|
animationSpeed?: 'standard' | 'slow' | 'none';
|
|
23
17
|
buttonBorderRadius?: 'sm' | 'md' | 'lg';
|
|
18
|
+
dataTestId?: string;
|
|
24
19
|
}
|
|
25
20
|
declare function SuggestionBar({
|
|
26
21
|
id,
|
|
@@ -34,6 +29,6 @@ declare function SuggestionBar({
|
|
|
34
29
|
buttonBorderRadius,
|
|
35
30
|
handleReply,
|
|
36
31
|
dataTestId
|
|
37
|
-
}: Readonly<SuggestionBarProps>):
|
|
32
|
+
}: Readonly<SuggestionBarProps>): react_jsx_runtime1.JSX.Element;
|
|
38
33
|
//#endregion
|
|
39
|
-
export { SuggestionBar
|
|
34
|
+
export { SuggestionBar };
|
|
@@ -1,69 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import v4_default from "../node_modules/uuid/dist/v4.js";
|
|
2
|
+
import { SuggestionBarLocationForMetrics } from "./types.js";
|
|
3
|
+
import { SuggestionButtonContainer } from "../SuggestionButtonContainer/SuggestionButtonContainer.js";
|
|
4
|
+
import "../SuggestionButtonContainer/index.js";
|
|
2
5
|
import { useCallback, useRef } from "react";
|
|
6
|
+
import { useScrollContainer } from "react-indiana-drag-scroll";
|
|
3
7
|
import { useSetAtom } from "jotai";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
8
|
import { MessageRole, MessageType, SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
|
|
6
|
-
import { useScrollContainer } from "react-indiana-drag-scroll";
|
|
7
9
|
import { PerfMetricsEvents, logPerfMetricAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
8
10
|
import { SUGGESTION_BAR_TESTID } from "@envive-ai/react-hooks/config";
|
|
9
11
|
import { useIsSmallScreen } from "@envive-ai/react-hooks/hooks/IsSmallScreen";
|
|
10
12
|
import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
14
|
|
|
12
|
-
//#region ../../node_modules/uuid/dist/stringify.js
|
|
13
|
-
const byteToHex = [];
|
|
14
|
-
for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
|
|
15
|
-
function unsafeStringify(arr, offset = 0) {
|
|
16
|
-
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region ../../node_modules/uuid/dist/rng.js
|
|
21
|
-
let getRandomValues;
|
|
22
|
-
const rnds8 = new Uint8Array(16);
|
|
23
|
-
function rng() {
|
|
24
|
-
if (!getRandomValues) {
|
|
25
|
-
if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
26
|
-
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
27
|
-
}
|
|
28
|
-
return getRandomValues(rnds8);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region ../../node_modules/uuid/dist/native.js
|
|
33
|
-
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
34
|
-
var native_default = { randomUUID };
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region ../../node_modules/uuid/dist/v4.js
|
|
38
|
-
function _v4(options, buf, offset) {
|
|
39
|
-
options = options || {};
|
|
40
|
-
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
41
|
-
if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
|
|
42
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
43
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
44
|
-
if (buf) {
|
|
45
|
-
offset = offset || 0;
|
|
46
|
-
if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
47
|
-
for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
|
|
48
|
-
return buf;
|
|
49
|
-
}
|
|
50
|
-
return unsafeStringify(rnds);
|
|
51
|
-
}
|
|
52
|
-
function v4(options, buf, offset) {
|
|
53
|
-
if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
|
|
54
|
-
return _v4(options, buf, offset);
|
|
55
|
-
}
|
|
56
|
-
var v4_default = v4;
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/SuggestionBar/types.ts
|
|
60
|
-
let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
|
|
61
|
-
SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
|
|
62
|
-
SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
|
|
63
|
-
return SuggestionBarLocationForMetrics$1;
|
|
64
|
-
}({});
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
15
|
//#region src/SuggestionBar/SuggestionBar.tsx
|
|
68
16
|
function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, hoverButtonVariation, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", handleReply, dataTestId }) {
|
|
69
17
|
const componentVisibleTriggerRef = useRef(null);
|
|
@@ -121,4 +69,4 @@ function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, h
|
|
|
121
69
|
}
|
|
122
70
|
|
|
123
71
|
//#endregion
|
|
124
|
-
export {
|
|
72
|
+
export { SuggestionBar };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
require('
|
|
1
|
+
const require_types = require('./types.cjs');
|
|
2
|
+
const require_SuggestionBar = require('./SuggestionBar.cjs');
|
|
3
3
|
|
|
4
4
|
exports.SuggestionBar = require_SuggestionBar.SuggestionBar;
|
|
5
|
-
exports.SuggestionBarLocationForMetrics =
|
|
5
|
+
exports.SuggestionBarLocationForMetrics = require_types.SuggestionBarLocationForMetrics;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
1
|
+
import { SuggestionBarLocationForMetrics } from "./types.js";
|
|
2
|
+
import { SuggestionBar } from "./SuggestionBar.js";
|
|
3
3
|
|
|
4
4
|
export { SuggestionBar, SuggestionBarLocationForMetrics };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/SuggestionBar/types.ts
|
|
3
|
+
let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
|
|
4
|
+
SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
|
|
5
|
+
SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
|
|
6
|
+
return SuggestionBarLocationForMetrics$1;
|
|
7
|
+
}({});
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.SuggestionBarLocationForMetrics = SuggestionBarLocationForMetrics;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/SuggestionBar/types.ts
|
|
2
|
+
let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
|
|
3
|
+
SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
|
|
4
|
+
SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
|
|
5
|
+
return SuggestionBarLocationForMetrics$1;
|
|
6
|
+
}({});
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { SuggestionBarLocationForMetrics };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_SuggestionButton = require('../packages/components/dist/components/SuggestionButton/SuggestionButton.cjs');
|
|
3
|
+
require('../packages/components/dist/components/SuggestionButton/index.cjs');
|
|
4
|
+
const require_useHorizontalScrollAnimation = require('../util/useHorizontalScrollAnimation.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
7
|
+
let __envive_ai_react_hooks_config = require("@envive-ai/react-hooks/config");
|
|
8
|
+
let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
|
|
9
|
+
let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
//#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
|
|
13
|
+
function ButtonContainer({ children }) {
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15
|
+
className: "spiffy-tw-pl-0 spiffy-tw-flex spiffy-tw-h-full spiffy-tw-flex-row spiffy-tw-items-center spiffy-tw-space-x-2",
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, buttonTexts, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", scrollContainerRef, onButtonClick }) => {
|
|
20
|
+
const componentVisibleTriggerRef = (0, react.useRef)(null);
|
|
21
|
+
require_useHorizontalScrollAnimation.useHorizontalScrollAnimation({
|
|
22
|
+
scrollContainerRef,
|
|
23
|
+
animationSpeed
|
|
24
|
+
});
|
|
25
|
+
const isSmallScreen = (0, __envive_ai_react_hooks_hooks_IsSmallScreen.useIsSmallScreen)();
|
|
26
|
+
const isAnimated = animationSpeed !== "none";
|
|
27
|
+
(0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(__envive_ai_react_hooks_application_models.SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, { animated: isAnimated });
|
|
28
|
+
const visibleButtonsFirstRow = buttonTexts.slice(0, twoRowsOnMobile && isSmallScreen ? Math.ceil((buttonTexts.length + 1) / 2) : void 0);
|
|
29
|
+
const visibleButtonsSecondRow = buttonTexts.slice(Math.ceil((buttonTexts.length + 1) / 2), buttonTexts.length);
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
31
|
+
className: "spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-overflow-x-scroll spiffy-tw-whitespace-nowrap",
|
|
32
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ButtonContainer, { children: [visibleButtonsFirstRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButton.SuggestionButton, {
|
|
33
|
+
variant: buttonVariation,
|
|
34
|
+
hoverVariant: hoverButtonVariation,
|
|
35
|
+
isDisabled: false,
|
|
36
|
+
content: suggestion,
|
|
37
|
+
boldText: boldFirstButton && i === 0,
|
|
38
|
+
borderRadius: buttonBorderRadius,
|
|
39
|
+
onClick: () => onButtonClick(suggestion),
|
|
40
|
+
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
41
|
+
}, i)), isAnimated && buttonTexts.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButton.SuggestionButton, {
|
|
42
|
+
variant: buttonVariation,
|
|
43
|
+
hoverVariant: hoverButtonVariation,
|
|
44
|
+
isDisabled: false,
|
|
45
|
+
content: suggestion,
|
|
46
|
+
boldText: boldFirstButton && i === 0,
|
|
47
|
+
borderRadius: buttonBorderRadius,
|
|
48
|
+
onClick: () => onButtonClick(suggestion),
|
|
49
|
+
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
50
|
+
}, `animation-dupe-${i}`))] }), twoRowsOnMobile && isSmallScreen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
51
|
+
className: "spiffy-tw-mt-1.5",
|
|
52
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ButtonContainer, { children: [visibleButtonsSecondRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButton.SuggestionButton, {
|
|
53
|
+
variant: buttonVariation,
|
|
54
|
+
hoverVariant: hoverButtonVariation,
|
|
55
|
+
isDisabled: false,
|
|
56
|
+
content: suggestion,
|
|
57
|
+
boldText: boldFirstButton && i === 0,
|
|
58
|
+
borderRadius: buttonBorderRadius,
|
|
59
|
+
onClick: () => onButtonClick(suggestion),
|
|
60
|
+
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
61
|
+
}, i)), isAnimated && visibleButtonsSecondRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButton.SuggestionButton, {
|
|
62
|
+
variant: buttonVariation,
|
|
63
|
+
hoverVariant: hoverButtonVariation,
|
|
64
|
+
isDisabled: false,
|
|
65
|
+
content: suggestion,
|
|
66
|
+
boldText: boldFirstButton && i === 0,
|
|
67
|
+
borderRadius: buttonBorderRadius,
|
|
68
|
+
onClick: () => onButtonClick(suggestion),
|
|
69
|
+
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
70
|
+
}, `animation-dupe-${i}`))] })
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.SuggestionButtonContainer = SuggestionButtonContainer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SuggestionButtonContainerProps } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/SuggestionButtonContainer/SuggestionButtonContainer.d.ts
|
|
4
|
+
declare const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { SuggestionButtonContainer };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SuggestionButtonContainerProps } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/SuggestionButtonContainer/SuggestionButtonContainer.d.ts
|
|
4
|
+
declare const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { SuggestionButtonContainer };
|
|
@@ -1,105 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { SuggestionButton } from "../packages/components/dist/components/SuggestionButton/SuggestionButton.js";
|
|
2
|
+
import "../packages/components/dist/components/SuggestionButton/index.js";
|
|
3
|
+
import { useHorizontalScrollAnimation } from "../util/useHorizontalScrollAnimation.js";
|
|
4
|
+
import { useRef } from "react";
|
|
4
5
|
import { SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
|
|
5
6
|
import { SUGGESTION_BAR_BUTTON_TESTID } from "@envive-ai/react-hooks/config";
|
|
6
7
|
import { useIsSmallScreen } from "@envive-ai/react-hooks/hooks/IsSmallScreen";
|
|
7
8
|
import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
//#region src/util/useReducedMotionWithOverride.ts
|
|
11
|
-
const useReducedMotionWithOverride = () => {
|
|
12
|
-
const reducedMotionConfig = useReducedMotionConfig();
|
|
13
|
-
return useMemo(() => {
|
|
14
|
-
if (window?._spiffy?.reducedMotionOverride) return window?._spiffy?.reducedMotionOverride;
|
|
15
|
-
return reducedMotionConfig;
|
|
16
|
-
}, [reducedMotionConfig]);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/util/useHorizontalScrollAnimation.ts
|
|
21
|
-
function useHorizontalScrollAnimation({ scrollContainerRef, animationSpeed = "standard" }) {
|
|
22
|
-
const reducedMotion = useReducedMotionWithOverride();
|
|
23
|
-
const resumeTimeoutRef = useRef(null);
|
|
24
|
-
const scrollAnimationRef = useRef(null);
|
|
25
|
-
const pauseOnHover = true;
|
|
26
|
-
let PIXELS_PER_SECOND = 40;
|
|
27
|
-
switch (animationSpeed) {
|
|
28
|
-
case "standard":
|
|
29
|
-
PIXELS_PER_SECOND = 40;
|
|
30
|
-
break;
|
|
31
|
-
case "slow":
|
|
32
|
-
PIXELS_PER_SECOND = 25;
|
|
33
|
-
break;
|
|
34
|
-
case "none":
|
|
35
|
-
PIXELS_PER_SECOND = 0;
|
|
36
|
-
break;
|
|
37
|
-
default: PIXELS_PER_SECOND = 40;
|
|
38
|
-
}
|
|
39
|
-
const RESUME_DELAY_MS = 2e3;
|
|
40
|
-
const isAnimated = animationSpeed !== "none";
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (!isAnimated || reducedMotion || !scrollContainerRef) return () => {};
|
|
43
|
-
const container = scrollContainerRef.current;
|
|
44
|
-
if (!container) return () => {};
|
|
45
|
-
if (container.scrollWidth <= container.clientWidth) return () => {};
|
|
46
|
-
let isPaused = false;
|
|
47
|
-
let lastTimestamp = null;
|
|
48
|
-
let accumulatedScroll = 0;
|
|
49
|
-
const step = (timestamp) => {
|
|
50
|
-
if (lastTimestamp === null) lastTimestamp = timestamp;
|
|
51
|
-
if (!isPaused) {
|
|
52
|
-
const delta = timestamp - lastTimestamp;
|
|
53
|
-
lastTimestamp = timestamp;
|
|
54
|
-
accumulatedScroll += PIXELS_PER_SECOND * (delta / 1e3);
|
|
55
|
-
const pixelsToScroll = Math.floor(accumulatedScroll);
|
|
56
|
-
if (pixelsToScroll > 0) {
|
|
57
|
-
container.scrollLeft += pixelsToScroll;
|
|
58
|
-
accumulatedScroll -= pixelsToScroll;
|
|
59
|
-
if (Math.ceil(container.scrollLeft) >= container.scrollWidth - container.clientWidth) {
|
|
60
|
-
container.scrollLeft = 0;
|
|
61
|
-
accumulatedScroll = 0;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
scrollAnimationRef.current = requestAnimationFrame(step);
|
|
66
|
-
};
|
|
67
|
-
scrollAnimationRef.current = requestAnimationFrame(step);
|
|
68
|
-
const pauseAnimation = () => {
|
|
69
|
-
isPaused = true;
|
|
70
|
-
if (resumeTimeoutRef.current) {
|
|
71
|
-
clearTimeout(resumeTimeoutRef.current);
|
|
72
|
-
resumeTimeoutRef.current = null;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const scheduleResumeAnimation = () => {
|
|
76
|
-
resumeTimeoutRef.current = setTimeout(() => {
|
|
77
|
-
isPaused = false;
|
|
78
|
-
lastTimestamp = null;
|
|
79
|
-
}, RESUME_DELAY_MS);
|
|
80
|
-
};
|
|
81
|
-
container.addEventListener("mouseenter", pauseAnimation);
|
|
82
|
-
container.addEventListener("mouseleave", scheduleResumeAnimation);
|
|
83
|
-
container.addEventListener("touchstart", pauseAnimation);
|
|
84
|
-
container.addEventListener("touchend", scheduleResumeAnimation);
|
|
85
|
-
return function cleanup() {
|
|
86
|
-
if (scrollAnimationRef.current) cancelAnimationFrame(scrollAnimationRef.current);
|
|
87
|
-
container.removeEventListener("mouseenter", pauseAnimation);
|
|
88
|
-
container.removeEventListener("mouseleave", scheduleResumeAnimation);
|
|
89
|
-
container.removeEventListener("touchstart", pauseAnimation);
|
|
90
|
-
container.removeEventListener("touchend", scheduleResumeAnimation);
|
|
91
|
-
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
92
|
-
};
|
|
93
|
-
}, [
|
|
94
|
-
isAnimated,
|
|
95
|
-
reducedMotion,
|
|
96
|
-
PIXELS_PER_SECOND,
|
|
97
|
-
pauseOnHover,
|
|
98
|
-
scrollContainerRef
|
|
99
|
-
]);
|
|
100
|
-
}
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
101
10
|
|
|
102
|
-
//#endregion
|
|
103
11
|
//#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
|
|
104
12
|
function ButtonContainer({ children }) {
|
|
105
13
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -164,4 +72,4 @@ const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, butt
|
|
|
164
72
|
};
|
|
165
73
|
|
|
166
74
|
//#endregion
|
|
167
|
-
export { SuggestionButtonContainer
|
|
75
|
+
export { SuggestionButtonContainer };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const require_SuggestionButtonContainer = require('
|
|
1
|
+
const require_SuggestionButtonContainer = require('./SuggestionButtonContainer.cjs');
|
|
2
2
|
|
|
3
3
|
exports.SuggestionButtonContainer = require_SuggestionButtonContainer.SuggestionButtonContainer;
|