@envive-ai/react-widgets 0.1.2-arthur-3 → 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 -2996
- package/dist/SearchZeroState/index.d.cts +4 -0
- package/dist/SearchZeroState/index.d.ts +4 -0
- package/dist/SearchZeroState/index.js +2 -2991
- 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/SuggestionBar.js +72 -0
- 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/SuggestionButtonContainer.js +75 -0
- 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/_virtual/rolldown_runtime.cjs +33 -0
- 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-BOThXJvJ.cjs → node_modules/react-indiana-drag-scroll/dist/index.cjs} +6 -139
- 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/{chunk-DWy1uDak.cjs → packages/icons/dist/_virtual/rolldown_runtime.cjs} +4 -14
- 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 +14 -8
- package/src/SearchResults/SearchResults.tsx +2 -4
- package/src/SearchResults/SearchResultsWidget.tsx +1 -1
- package/src/SearchResults/types.ts +0 -3
- package/src/SearchZeroState/SearchIcon.tsx +16 -9
- package/src/SearchZeroState/SearchOverlay.tsx +3 -2
- package/src/SearchZeroState/SearchZeroState.tsx +15 -18
- package/src/SearchZeroState/SearchZeroStateWidget.tsx +17 -8
- package/src/SearchZeroState/components/RecommendedProducts.tsx +8 -3
- package/src/SearchZeroState/overlay/overlayHostLocator.ts +2 -4
- package/src/SearchZeroState/types.ts +4 -1
- package/src/SearchZeroState/zeroStateSearchVariants.ts +14 -5
- package/src/SuggestionBar/SuggestionBar.tsx +12 -20
- package/src/SuggestionBar/types.ts +3 -3
- package/src/SuggestionButtonContainer/SuggestionButtonContainer.tsx +8 -17
- package/src/SuggestionButtonContainer/types.ts +3 -4
- package/src/stories/SearchResults.stories.tsx +1 -1
- package/src/stories/SearchZeroState.stories.tsx +10 -2
- package/src/stories/SuggestionBar.stories.tsx +1 -2
- package/src/util/useHorizontalScrollAnimation.ts +1 -1
- package/dist/SearchZeroState/index-19CiYvee.d.cts +0 -27
- package/dist/SearchZeroState/index-6EaGWYP4.d.ts +0 -27
- package/dist/SuggestionBar-DeMmAK4M.js +0 -131
- package/dist/SuggestionButtonContainer-BeWPpeQk.cjs +0 -173
- package/dist/SuggestionButtonContainer-CZhOkZaJ.js +0 -167
- /package/dist/SearchResults/{index-D8nrHueo.d.ts → SearchResultsWidget.d.cts} +0 -0
- /package/dist/SearchResults/{index-D52sX_I2.d.cts → SearchResultsWidget.d.ts} +0 -0
|
@@ -3,22 +3,19 @@ import { useScrollContainer } from 'react-indiana-drag-scroll';
|
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { useSetAtom } from 'jotai';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import { logPerfMetricAtom, PerfMetricsEvents } from '@envive-ai/react-hooks/atoms/chat';
|
|
6
|
+
import { MessageRole, MessageType, SpiffyWidgets } from '@envive-ai/react-hooks/application/models';
|
|
7
|
+
import { PerfMetricsEvents, logPerfMetricAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
9
8
|
import { SUGGESTION_BAR_TESTID } from '@envive-ai/react-hooks/config';
|
|
10
9
|
import { useIsSmallScreen } from '@envive-ai/react-hooks/hooks/IsSmallScreen';
|
|
11
10
|
import { useTrackComponentVisibleEvent } from '@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent';
|
|
12
|
-
import { TestProps } from '@envive-ai/react-hooks/types';
|
|
13
11
|
import { Message } from 'postcss';
|
|
14
12
|
|
|
15
13
|
import { SuggestionButtonVariant } from '@envive-ai/react-hooks/contexts/types';
|
|
16
14
|
import { SuggestionBarLocationForMetrics } from './types';
|
|
17
15
|
import { SuggestionButtonContainer } from '../SuggestionButtonContainer';
|
|
18
16
|
|
|
19
|
-
|
|
20
17
|
// SuggestionBarV2 Props
|
|
21
|
-
interface SuggestionBarProps
|
|
18
|
+
interface SuggestionBarProps {
|
|
22
19
|
id: string;
|
|
23
20
|
locationForMetrics: SuggestionBarLocationForMetrics;
|
|
24
21
|
buttonTexts: string[];
|
|
@@ -29,6 +26,7 @@ interface SuggestionBarProps extends TestProps {
|
|
|
29
26
|
twoRowsOnMobile?: boolean | undefined;
|
|
30
27
|
animationSpeed?: 'standard' | 'slow' | 'none';
|
|
31
28
|
buttonBorderRadius?: 'sm' | 'md' | 'lg';
|
|
29
|
+
dataTestId?: string;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
// SuggestionBar functional component
|
|
@@ -57,11 +55,9 @@ function SuggestionBar({
|
|
|
57
55
|
const isAnimated = animationSpeed !== 'none';
|
|
58
56
|
|
|
59
57
|
// Track component visibility
|
|
60
|
-
useTrackComponentVisibleEvent(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{ animated: isAnimated },
|
|
64
|
-
);
|
|
58
|
+
useTrackComponentVisibleEvent(SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, {
|
|
59
|
+
animated: isAnimated,
|
|
60
|
+
});
|
|
65
61
|
|
|
66
62
|
// Handle button click
|
|
67
63
|
const handleClickSuggestion = useCallback(
|
|
@@ -102,16 +98,12 @@ function SuggestionBar({
|
|
|
102
98
|
);
|
|
103
99
|
|
|
104
100
|
return (
|
|
105
|
-
<div
|
|
101
|
+
<div
|
|
102
|
+
id={id}
|
|
103
|
+
className="spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden"
|
|
104
|
+
>
|
|
106
105
|
<div
|
|
107
|
-
className={`
|
|
108
|
-
spiffy-tw-relative
|
|
109
|
-
spiffy-tw-w-full
|
|
110
|
-
spiffy-tw-overflow-x-scroll
|
|
111
|
-
spiffy-tw-overflow-y-hidden
|
|
112
|
-
spiffy-tw-no-scrollbar
|
|
113
|
-
${twoRowsOnMobile && isSmallScreen ? 'spiffy-tw-h-20' : 'spiffy-tw-h-9'}
|
|
114
|
-
`}
|
|
106
|
+
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'} `}
|
|
115
107
|
ref={handleContainerRef}
|
|
116
108
|
>
|
|
117
109
|
<div
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export enum SuggestionBarLocationForMetrics {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
SUGGESTION_BAR_TOP = 'top',
|
|
3
|
+
SUGGESTION_BAR_BOTTOM = 'bottom',
|
|
4
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
1
2
|
import { useRef } from 'react';
|
|
2
3
|
import { SuggestionButton } from '@envive-ai/react-toolkit/SuggestionButton';
|
|
3
4
|
import { SpiffyWidgets } from '@envive-ai/react-hooks/application/models';
|
|
@@ -15,20 +16,12 @@ interface ButtonContainerProps {
|
|
|
15
16
|
// ButtonContainer is reused twice within SuggestionBarV2, so we declare it as a seperate functional component
|
|
16
17
|
function ButtonContainer({ children }: ButtonContainerProps) {
|
|
17
18
|
return (
|
|
18
|
-
<div
|
|
19
|
-
className="spiffy-tw-flex
|
|
20
|
-
spiffy-tw-flex-row
|
|
21
|
-
spiffy-tw-items-center
|
|
22
|
-
spiffy-tw-space-x-2
|
|
23
|
-
spiffy-tw-h-full
|
|
24
|
-
spiffy-tw-pl-0"
|
|
25
|
-
>
|
|
19
|
+
<div 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">
|
|
26
20
|
{children}
|
|
27
21
|
</div>
|
|
28
22
|
);
|
|
29
23
|
}
|
|
30
24
|
|
|
31
|
-
|
|
32
25
|
const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
|
|
33
26
|
buttonVariation,
|
|
34
27
|
hoverButtonVariation,
|
|
@@ -47,17 +40,15 @@ const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
|
|
|
47
40
|
useHorizontalScrollAnimation({
|
|
48
41
|
scrollContainerRef,
|
|
49
42
|
animationSpeed,
|
|
50
|
-
})
|
|
43
|
+
});
|
|
51
44
|
const isSmallScreen = useIsSmallScreen();
|
|
52
45
|
|
|
53
46
|
const isAnimated = animationSpeed !== 'none';
|
|
54
47
|
|
|
55
48
|
// Track component visibility
|
|
56
|
-
useTrackComponentVisibleEvent(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{ animated: isAnimated },
|
|
60
|
-
);
|
|
49
|
+
useTrackComponentVisibleEvent(SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, {
|
|
50
|
+
animated: isAnimated,
|
|
51
|
+
});
|
|
61
52
|
|
|
62
53
|
const visibleButtonsFirstRow = buttonTexts.slice(
|
|
63
54
|
0,
|
|
@@ -70,7 +61,7 @@ const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
|
|
|
70
61
|
);
|
|
71
62
|
|
|
72
63
|
return (
|
|
73
|
-
<div className="spiffy-tw-
|
|
64
|
+
<div className="spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-overflow-x-scroll spiffy-tw-whitespace-nowrap">
|
|
74
65
|
<ButtonContainer>
|
|
75
66
|
{visibleButtonsFirstRow.map((suggestion, i) => (
|
|
76
67
|
<SuggestionButton
|
|
@@ -136,6 +127,6 @@ const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
|
|
|
136
127
|
)}
|
|
137
128
|
</div>
|
|
138
129
|
);
|
|
139
|
-
}
|
|
130
|
+
};
|
|
140
131
|
|
|
141
132
|
export { SuggestionButtonContainer };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SuggestionButtonVariant } from
|
|
2
|
-
import { TestProps } from
|
|
3
|
-
|
|
1
|
+
import { SuggestionButtonVariant } from '@envive-ai/react-hooks/contexts/types';
|
|
2
|
+
import { TestProps } from '@envive-ai/react-hooks/types';
|
|
4
3
|
|
|
5
4
|
// SuggestionButtonContainer Props
|
|
6
5
|
export interface SuggestionButtonContainerProps extends TestProps {
|
|
@@ -13,4 +12,4 @@ export interface SuggestionButtonContainerProps extends TestProps {
|
|
|
13
12
|
twoRowsOnMobile?: boolean | undefined;
|
|
14
13
|
animationSpeed?: 'standard' | 'slow' | 'none';
|
|
15
14
|
buttonBorderRadius?: 'sm' | 'md' | 'lg';
|
|
16
|
-
}
|
|
15
|
+
}
|
|
@@ -30,11 +30,19 @@ const meta = {
|
|
|
30
30
|
},
|
|
31
31
|
searchZeroStateVariant: {
|
|
32
32
|
control: 'select',
|
|
33
|
-
options: [
|
|
33
|
+
options: [
|
|
34
|
+
'backgroundTertiary',
|
|
35
|
+
'backgroundPrimary',
|
|
36
|
+
'backgroundSecondary',
|
|
37
|
+
'backgroundQuaternary',
|
|
38
|
+
],
|
|
34
39
|
},
|
|
35
40
|
},
|
|
36
41
|
render: (args: SearchEntryPointWidgetConfig & { initialIsOpen: boolean }) => (
|
|
37
|
-
<SearchZeroState
|
|
42
|
+
<SearchZeroState
|
|
43
|
+
widgetConfig={{ ...args }}
|
|
44
|
+
initialIsOpen={args.initialIsOpen}
|
|
45
|
+
/>
|
|
38
46
|
),
|
|
39
47
|
} satisfies Meta;
|
|
40
48
|
|
|
@@ -14,7 +14,7 @@ const meta: Meta<typeof SuggestionBar> = {
|
|
|
14
14
|
options: ['none', 'standard', 'slow'],
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
render:
|
|
17
|
+
render: args => (
|
|
18
18
|
<div style={{ width: '300px', height: '100px' }}>
|
|
19
19
|
<SuggestionBar {...args} />
|
|
20
20
|
</div>
|
|
@@ -35,7 +35,6 @@ export const Default: Story = {
|
|
|
35
35
|
handleReply: () => {},
|
|
36
36
|
boldFirstButton: false,
|
|
37
37
|
},
|
|
38
|
-
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
export const Animated: Story = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefObject, useEffect, useRef } from 'react';
|
|
2
2
|
import { useReducedMotionWithOverride } from 'src/util/useReducedMotionWithOverride';
|
|
3
3
|
|
|
4
4
|
// IMPORTANT: All refs passed to this hook must be mutable (not Readonly)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
|
-
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
3
|
-
import React$1 from "react";
|
|
4
|
-
|
|
5
|
-
//#region src/SearchZeroState/types.d.ts
|
|
6
|
-
interface SearchZeroStateProps {
|
|
7
|
-
widgetConfig: SearchEntryPointWidgetConfig;
|
|
8
|
-
initialIsOpen?: boolean;
|
|
9
|
-
entryPointRef?: React.Ref<HTMLButtonElement>;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/SearchZeroState/SearchZeroState.d.ts
|
|
13
|
-
declare const SearchZeroState: React$1.FC<SearchZeroStateProps>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
16
|
-
type SearchZeroStateWidgetProps = {
|
|
17
|
-
initialIsOpen: boolean;
|
|
18
|
-
widgetConfigId?: string;
|
|
19
|
-
entryPointRef: React.Ref<HTMLButtonElement>;
|
|
20
|
-
};
|
|
21
|
-
declare const SearchZeroStateWidget: ({
|
|
22
|
-
initialIsOpen,
|
|
23
|
-
widgetConfigId,
|
|
24
|
-
entryPointRef
|
|
25
|
-
}: SearchZeroStateWidgetProps) => react_jsx_runtime1.JSX.Element;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { type SearchEntryPointWidgetConfig, type SearchInputVariant, SearchZeroState, SearchZeroStateProps, SearchZeroStateWidget };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React$1 from "react";
|
|
2
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
-
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
|
-
|
|
5
|
-
//#region src/SearchZeroState/types.d.ts
|
|
6
|
-
interface SearchZeroStateProps {
|
|
7
|
-
widgetConfig: SearchEntryPointWidgetConfig;
|
|
8
|
-
initialIsOpen?: boolean;
|
|
9
|
-
entryPointRef?: React.Ref<HTMLButtonElement>;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/SearchZeroState/SearchZeroState.d.ts
|
|
13
|
-
declare const SearchZeroState: React$1.FC<SearchZeroStateProps>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
16
|
-
type SearchZeroStateWidgetProps = {
|
|
17
|
-
initialIsOpen: boolean;
|
|
18
|
-
widgetConfigId?: string;
|
|
19
|
-
entryPointRef: React.Ref<HTMLButtonElement>;
|
|
20
|
-
};
|
|
21
|
-
declare const SearchZeroStateWidget: ({
|
|
22
|
-
initialIsOpen,
|
|
23
|
-
widgetConfigId,
|
|
24
|
-
entryPointRef
|
|
25
|
-
}: SearchZeroStateWidgetProps) => react_jsx_runtime0.JSX.Element;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { type SearchEntryPointWidgetConfig, type SearchInputVariant, SearchZeroState, SearchZeroStateProps, SearchZeroStateWidget };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { t as SuggestionButtonContainer } from "./SuggestionButtonContainer-CZhOkZaJ.js";
|
|
2
|
-
import { useCallback, useRef } from "react";
|
|
3
|
-
import { useSetAtom } from "jotai";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { MessageRole, MessageType, SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
|
|
6
|
-
import { useScrollContainer } from "react-indiana-drag-scroll";
|
|
7
|
-
import { PerfMetricsEvents, logPerfMetricAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
8
|
-
import { SUGGESTION_BAR_TESTID } from "@envive-ai/react-hooks/config";
|
|
9
|
-
import { useIsSmallScreen } from "@envive-ai/react-hooks/hooks/IsSmallScreen";
|
|
10
|
-
import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
|
|
11
|
-
|
|
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
|
-
//#region src/SuggestionBar/SuggestionBar.tsx
|
|
68
|
-
function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, hoverButtonVariation, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", handleReply, dataTestId }) {
|
|
69
|
-
const componentVisibleTriggerRef = useRef(null);
|
|
70
|
-
const containerRef = useRef(null);
|
|
71
|
-
const { ref } = useScrollContainer();
|
|
72
|
-
const isSmallScreen = useIsSmallScreen();
|
|
73
|
-
const logPerfMetric = useSetAtom(logPerfMetricAtom);
|
|
74
|
-
const isAnimated = animationSpeed !== "none";
|
|
75
|
-
useTrackComponentVisibleEvent(SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, { animated: isAnimated });
|
|
76
|
-
const handleClickSuggestion = useCallback((buttonText) => {
|
|
77
|
-
handleReply({
|
|
78
|
-
id: v4_default(),
|
|
79
|
-
role: MessageRole.User,
|
|
80
|
-
type: MessageType.QueryTyped,
|
|
81
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
82
|
-
metadata: { content: buttonText }
|
|
83
|
-
});
|
|
84
|
-
}, [handleReply]);
|
|
85
|
-
const setRefs = useCallback((el) => {
|
|
86
|
-
if (typeof ref === "function") ref(el);
|
|
87
|
-
containerRef.current = el;
|
|
88
|
-
}, [ref]);
|
|
89
|
-
const handleContainerRef = useCallback((el) => {
|
|
90
|
-
if (el) logPerfMetric(locationForMetrics === SuggestionBarLocationForMetrics.SUGGESTION_BAR_TOP ? PerfMetricsEvents.TopSuggestionsBarRendered : PerfMetricsEvents.BottomSuggestionsBarRendered);
|
|
91
|
-
setRefs(el);
|
|
92
|
-
}, [
|
|
93
|
-
locationForMetrics,
|
|
94
|
-
logPerfMetric,
|
|
95
|
-
setRefs
|
|
96
|
-
]);
|
|
97
|
-
return /* @__PURE__ */ jsx("div", {
|
|
98
|
-
id,
|
|
99
|
-
className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden",
|
|
100
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
101
|
-
className: `
|
|
102
|
-
spiffy-tw-relative
|
|
103
|
-
spiffy-tw-w-full
|
|
104
|
-
spiffy-tw-overflow-x-scroll
|
|
105
|
-
spiffy-tw-overflow-y-hidden
|
|
106
|
-
spiffy-tw-no-scrollbar
|
|
107
|
-
${twoRowsOnMobile && isSmallScreen ? "spiffy-tw-h-20" : "spiffy-tw-h-9"}
|
|
108
|
-
`,
|
|
109
|
-
ref: handleContainerRef,
|
|
110
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
111
|
-
className: "spiffy-tw-relative spiffy-tw-inline-block spiffy-tw-whitespace-nowrap",
|
|
112
|
-
ref: componentVisibleTriggerRef,
|
|
113
|
-
"data-testid": dataTestId || SUGGESTION_BAR_TESTID,
|
|
114
|
-
children: /* @__PURE__ */ jsx(SuggestionButtonContainer, {
|
|
115
|
-
buttonVariation,
|
|
116
|
-
hoverButtonVariation,
|
|
117
|
-
buttonTexts,
|
|
118
|
-
onButtonClick: handleClickSuggestion,
|
|
119
|
-
scrollContainerRef: containerRef,
|
|
120
|
-
boldFirstButton,
|
|
121
|
-
twoRowsOnMobile,
|
|
122
|
-
animationSpeed,
|
|
123
|
-
buttonBorderRadius
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
//#endregion
|
|
131
|
-
export { SuggestionBarLocationForMetrics as n, SuggestionBar as t };
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
-
let react = require("react");
|
|
3
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
-
let framer_motion = require("framer-motion");
|
|
5
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
6
|
-
let __envive_ai_react_hooks_config = require("@envive-ai/react-hooks/config");
|
|
7
|
-
let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
|
|
8
|
-
let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
|
|
9
|
-
let __envive_ai_react_toolkit_SuggestionButton = require("@envive-ai/react-toolkit/SuggestionButton");
|
|
10
|
-
|
|
11
|
-
//#region src/util/useReducedMotionWithOverride.ts
|
|
12
|
-
const useReducedMotionWithOverride = () => {
|
|
13
|
-
const reducedMotionConfig = (0, framer_motion.useReducedMotionConfig)();
|
|
14
|
-
return (0, react.useMemo)(() => {
|
|
15
|
-
if (window?._spiffy?.reducedMotionOverride) return window?._spiffy?.reducedMotionOverride;
|
|
16
|
-
return reducedMotionConfig;
|
|
17
|
-
}, [reducedMotionConfig]);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/util/useHorizontalScrollAnimation.ts
|
|
22
|
-
function useHorizontalScrollAnimation({ scrollContainerRef, animationSpeed = "standard" }) {
|
|
23
|
-
const reducedMotion = useReducedMotionWithOverride();
|
|
24
|
-
const resumeTimeoutRef = (0, react.useRef)(null);
|
|
25
|
-
const scrollAnimationRef = (0, react.useRef)(null);
|
|
26
|
-
const pauseOnHover = true;
|
|
27
|
-
let PIXELS_PER_SECOND = 40;
|
|
28
|
-
switch (animationSpeed) {
|
|
29
|
-
case "standard":
|
|
30
|
-
PIXELS_PER_SECOND = 40;
|
|
31
|
-
break;
|
|
32
|
-
case "slow":
|
|
33
|
-
PIXELS_PER_SECOND = 25;
|
|
34
|
-
break;
|
|
35
|
-
case "none":
|
|
36
|
-
PIXELS_PER_SECOND = 0;
|
|
37
|
-
break;
|
|
38
|
-
default: PIXELS_PER_SECOND = 40;
|
|
39
|
-
}
|
|
40
|
-
const RESUME_DELAY_MS = 2e3;
|
|
41
|
-
const isAnimated = animationSpeed !== "none";
|
|
42
|
-
(0, react.useEffect)(() => {
|
|
43
|
-
if (!isAnimated || reducedMotion || !scrollContainerRef) return () => {};
|
|
44
|
-
const container = scrollContainerRef.current;
|
|
45
|
-
if (!container) return () => {};
|
|
46
|
-
if (container.scrollWidth <= container.clientWidth) return () => {};
|
|
47
|
-
let isPaused = false;
|
|
48
|
-
let lastTimestamp = null;
|
|
49
|
-
let accumulatedScroll = 0;
|
|
50
|
-
const step = (timestamp) => {
|
|
51
|
-
if (lastTimestamp === null) lastTimestamp = timestamp;
|
|
52
|
-
if (!isPaused) {
|
|
53
|
-
const delta = timestamp - lastTimestamp;
|
|
54
|
-
lastTimestamp = timestamp;
|
|
55
|
-
accumulatedScroll += PIXELS_PER_SECOND * (delta / 1e3);
|
|
56
|
-
const pixelsToScroll = Math.floor(accumulatedScroll);
|
|
57
|
-
if (pixelsToScroll > 0) {
|
|
58
|
-
container.scrollLeft += pixelsToScroll;
|
|
59
|
-
accumulatedScroll -= pixelsToScroll;
|
|
60
|
-
if (Math.ceil(container.scrollLeft) >= container.scrollWidth - container.clientWidth) {
|
|
61
|
-
container.scrollLeft = 0;
|
|
62
|
-
accumulatedScroll = 0;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
scrollAnimationRef.current = requestAnimationFrame(step);
|
|
67
|
-
};
|
|
68
|
-
scrollAnimationRef.current = requestAnimationFrame(step);
|
|
69
|
-
const pauseAnimation = () => {
|
|
70
|
-
isPaused = true;
|
|
71
|
-
if (resumeTimeoutRef.current) {
|
|
72
|
-
clearTimeout(resumeTimeoutRef.current);
|
|
73
|
-
resumeTimeoutRef.current = null;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const scheduleResumeAnimation = () => {
|
|
77
|
-
resumeTimeoutRef.current = setTimeout(() => {
|
|
78
|
-
isPaused = false;
|
|
79
|
-
lastTimestamp = null;
|
|
80
|
-
}, RESUME_DELAY_MS);
|
|
81
|
-
};
|
|
82
|
-
container.addEventListener("mouseenter", pauseAnimation);
|
|
83
|
-
container.addEventListener("mouseleave", scheduleResumeAnimation);
|
|
84
|
-
container.addEventListener("touchstart", pauseAnimation);
|
|
85
|
-
container.addEventListener("touchend", scheduleResumeAnimation);
|
|
86
|
-
return function cleanup() {
|
|
87
|
-
if (scrollAnimationRef.current) cancelAnimationFrame(scrollAnimationRef.current);
|
|
88
|
-
container.removeEventListener("mouseenter", pauseAnimation);
|
|
89
|
-
container.removeEventListener("mouseleave", scheduleResumeAnimation);
|
|
90
|
-
container.removeEventListener("touchstart", pauseAnimation);
|
|
91
|
-
container.removeEventListener("touchend", scheduleResumeAnimation);
|
|
92
|
-
if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
|
|
93
|
-
};
|
|
94
|
-
}, [
|
|
95
|
-
isAnimated,
|
|
96
|
-
reducedMotion,
|
|
97
|
-
PIXELS_PER_SECOND,
|
|
98
|
-
pauseOnHover,
|
|
99
|
-
scrollContainerRef
|
|
100
|
-
]);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
|
|
105
|
-
function ButtonContainer({ children }) {
|
|
106
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
107
|
-
className: "spiffy-tw-flex \n spiffy-tw-flex-row\n spiffy-tw-items-center\n spiffy-tw-space-x-2\n spiffy-tw-h-full\n spiffy-tw-pl-0",
|
|
108
|
-
children
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, buttonTexts, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", scrollContainerRef, onButtonClick }) => {
|
|
112
|
-
const componentVisibleTriggerRef = (0, react.useRef)(null);
|
|
113
|
-
useHorizontalScrollAnimation({
|
|
114
|
-
scrollContainerRef,
|
|
115
|
-
animationSpeed
|
|
116
|
-
});
|
|
117
|
-
const isSmallScreen = (0, __envive_ai_react_hooks_hooks_IsSmallScreen.useIsSmallScreen)();
|
|
118
|
-
const isAnimated = animationSpeed !== "none";
|
|
119
|
-
(0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(__envive_ai_react_hooks_application_models.SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, { animated: isAnimated });
|
|
120
|
-
const visibleButtonsFirstRow = buttonTexts.slice(0, twoRowsOnMobile && isSmallScreen ? Math.ceil((buttonTexts.length + 1) / 2) : void 0);
|
|
121
|
-
const visibleButtonsSecondRow = buttonTexts.slice(Math.ceil((buttonTexts.length + 1) / 2), buttonTexts.length);
|
|
122
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
123
|
-
className: "spiffy-tw-overflow-x-scroll spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-whitespace-nowrap",
|
|
124
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ButtonContainer, { children: [visibleButtonsFirstRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SuggestionButton.SuggestionButton, {
|
|
125
|
-
variant: buttonVariation,
|
|
126
|
-
hoverVariant: hoverButtonVariation,
|
|
127
|
-
isDisabled: false,
|
|
128
|
-
content: suggestion,
|
|
129
|
-
boldText: boldFirstButton && i === 0,
|
|
130
|
-
borderRadius: buttonBorderRadius,
|
|
131
|
-
onClick: () => onButtonClick(suggestion),
|
|
132
|
-
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
133
|
-
}, i)), isAnimated && buttonTexts.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SuggestionButton.SuggestionButton, {
|
|
134
|
-
variant: buttonVariation,
|
|
135
|
-
hoverVariant: hoverButtonVariation,
|
|
136
|
-
isDisabled: false,
|
|
137
|
-
content: suggestion,
|
|
138
|
-
boldText: boldFirstButton && i === 0,
|
|
139
|
-
borderRadius: buttonBorderRadius,
|
|
140
|
-
onClick: () => onButtonClick(suggestion),
|
|
141
|
-
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
142
|
-
}, `animation-dupe-${i}`))] }), twoRowsOnMobile && isSmallScreen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
143
|
-
className: "spiffy-tw-mt-1.5",
|
|
144
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ButtonContainer, { children: [visibleButtonsSecondRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SuggestionButton.SuggestionButton, {
|
|
145
|
-
variant: buttonVariation,
|
|
146
|
-
hoverVariant: hoverButtonVariation,
|
|
147
|
-
isDisabled: false,
|
|
148
|
-
content: suggestion,
|
|
149
|
-
boldText: boldFirstButton && i === 0,
|
|
150
|
-
borderRadius: buttonBorderRadius,
|
|
151
|
-
onClick: () => onButtonClick(suggestion),
|
|
152
|
-
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
153
|
-
}, i)), isAnimated && visibleButtonsSecondRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SuggestionButton.SuggestionButton, {
|
|
154
|
-
variant: buttonVariation,
|
|
155
|
-
hoverVariant: hoverButtonVariation,
|
|
156
|
-
isDisabled: false,
|
|
157
|
-
content: suggestion,
|
|
158
|
-
boldText: boldFirstButton && i === 0,
|
|
159
|
-
borderRadius: buttonBorderRadius,
|
|
160
|
-
onClick: () => onButtonClick(suggestion),
|
|
161
|
-
dataTestId: __envive_ai_react_hooks_config.SUGGESTION_BAR_BUTTON_TESTID
|
|
162
|
-
}, `animation-dupe-${i}`))] })
|
|
163
|
-
})]
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
//#endregion
|
|
168
|
-
Object.defineProperty(exports, 'SuggestionButtonContainer', {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
get: function () {
|
|
171
|
-
return SuggestionButtonContainer;
|
|
172
|
-
}
|
|
173
|
-
});
|