@envive-ai/react-widgets 0.1.2-arthur-3 → 0.1.2
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/index.cjs +1 -1
- package/dist/SearchZeroState/{index-19CiYvee.d.cts → index-DSFtalZR.d.ts} +1 -1
- package/dist/SearchZeroState/{index-6EaGWYP4.d.ts → index-bEcxYOSF.d.cts} +1 -1
- package/dist/SearchZeroState/index.cjs +131 -57
- package/dist/SearchZeroState/index.js +130 -56
- package/dist/SuggestionBar/index.cjs +2 -2
- package/dist/SuggestionBar/index.js +2 -2
- package/dist/{SuggestionBar-DeMmAK4M.js → SuggestionBar-BHAXhgcd.js} +3 -10
- package/dist/{SuggestionBar-BOThXJvJ.cjs → SuggestionBar-CK5aU2bb.cjs} +4 -11
- package/dist/SuggestionButtonContainer/index.cjs +1 -1
- package/dist/SuggestionButtonContainer/index.js +1 -1
- package/dist/{SuggestionButtonContainer-BeWPpeQk.cjs → SuggestionButtonContainer-Dm38gJiJ.cjs} +3 -3
- package/dist/{SuggestionButtonContainer-CZhOkZaJ.js → SuggestionButtonContainer-s2e9YGW_.js} +2 -2
- package/dist/{chunk-DWy1uDak.cjs → chunk-DSlc6foC.cjs} +10 -6
- package/package.json +16 -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 +14 -17
- 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 +10 -18
- 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/SearchResults/{index-D52sX_I2.d.cts → index-CYPV3XE0.d.ts} +0 -0
- /package/dist/SearchResults/{index-D8nrHueo.d.ts → index-DCTxvwmv.d.cts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
3
|
import { useAmplitudeTracking } from '@envive-ai/react-hooks/hooks/AmplitudeOperations';
|
|
4
4
|
import { useSearch } from '@envive-ai/react-hooks/hooks/Search';
|
|
@@ -20,7 +20,6 @@ import { searchZeroStateVariantClasses } from './zeroStateSearchVariants';
|
|
|
20
20
|
import { SearchIcon } from './SearchIcon';
|
|
21
21
|
import { RecommendedProducts } from './components/RecommendedProducts';
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
const SEARCH_ENTRYPOINT_INPUT_TESTID = 'spiffy-search-entrypoint-input';
|
|
25
24
|
|
|
26
25
|
export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
@@ -28,7 +27,6 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
|
28
27
|
initialIsOpen,
|
|
29
28
|
entryPointRef,
|
|
30
29
|
}) => {
|
|
31
|
-
|
|
32
30
|
// eslint-disable-next-line no-console
|
|
33
31
|
console.log('SearchZeroState: widgetConfig', widgetConfig);
|
|
34
32
|
const {
|
|
@@ -56,7 +54,7 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
|
56
54
|
const searchInput = useSearch({ allowRedirect: true });
|
|
57
55
|
|
|
58
56
|
const { track } = useAmplitudeTracking();
|
|
59
|
-
|
|
57
|
+
|
|
60
58
|
const {
|
|
61
59
|
recommendedProductsHeading,
|
|
62
60
|
searchOverlayHeading,
|
|
@@ -86,8 +84,7 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
|
86
84
|
const { overlayBackgroundClasses, sparklesIconColor } =
|
|
87
85
|
searchZeroStateVariantClasses[validVariant];
|
|
88
86
|
|
|
89
|
-
const { searchInputIconColor } =
|
|
90
|
-
searchInputVariantClasses[searchInputVariant];
|
|
87
|
+
const { searchInputIconColor } = searchInputVariantClasses[searchInputVariant];
|
|
91
88
|
|
|
92
89
|
const handleOpen = () => setIsOpen(true);
|
|
93
90
|
const handleClose = () => setIsOpen(false);
|
|
@@ -105,7 +102,6 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
|
105
102
|
|
|
106
103
|
useEffect(() => {
|
|
107
104
|
if (isOpen) {
|
|
108
|
-
|
|
109
105
|
resetSearch(); // Reset search state when opening
|
|
110
106
|
searchInputRef.current?.focus();
|
|
111
107
|
}
|
|
@@ -166,29 +162,30 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
|
166
162
|
<>
|
|
167
163
|
<div className="spiffy-tw-relative spiffy-tw-mb-4">
|
|
168
164
|
<div className="spiffy-tw-flex spiffy-tw-items-center">
|
|
169
|
-
<Typography
|
|
165
|
+
<Typography
|
|
166
|
+
id="global-search-title"
|
|
167
|
+
variant="t3"
|
|
168
|
+
>
|
|
170
169
|
{searchOverlayHeading}
|
|
171
170
|
</Typography>
|
|
172
171
|
<Sparkles
|
|
173
|
-
className="
|
|
172
|
+
className="spiffy-tw-ml-2 spiffy-tw-h-[36px] spiffy-tw-w-[24px] sm:spiffy-tw-h-[45px] sm:spiffy-tw-w-[36px]"
|
|
174
173
|
color={sparklesIconColor}
|
|
175
174
|
stroke="2px"
|
|
176
175
|
/>
|
|
177
176
|
</div>
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)
|
|
182
|
-
}
|
|
177
|
+
{includeSubtitle && (
|
|
178
|
+
<Typography variant="body2">Go ahead, get as specific as you like...</Typography>
|
|
179
|
+
)}
|
|
183
180
|
</div>
|
|
184
181
|
<button
|
|
185
182
|
onClick={handleClose}
|
|
186
|
-
className="spiffy-tw-absolute spiffy-tw-
|
|
183
|
+
className="spiffy-tw-absolute spiffy-tw-right-4 spiffy-tw-top-4 sm:spiffy-tw-right-8 sm:spiffy-tw-top-8"
|
|
187
184
|
aria-label="Close search"
|
|
188
185
|
type="button"
|
|
189
186
|
>
|
|
190
187
|
<IconCloseVariant
|
|
191
|
-
className="spiffy-tw-
|
|
188
|
+
className="spiffy-tw-h-[20px] spiffy-tw-w-[20px] sm:spiffy-tw-h-[28px] sm:spiffy-tw-w-[28px]"
|
|
192
189
|
strokeWidth="2px"
|
|
193
190
|
/>
|
|
194
191
|
</button>
|
|
@@ -213,7 +210,7 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
|
|
|
213
210
|
{initialSuggestions &&
|
|
214
211
|
initialSuggestions.length > 0 && ( // Conditionally render suggestions
|
|
215
212
|
<motion.div
|
|
216
|
-
className="spiffy-tw-
|
|
213
|
+
className="spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden"
|
|
217
214
|
initial={{ opacity: 0 }}
|
|
218
215
|
animate={{ opacity: 1 }}
|
|
219
216
|
exit={{ opacity: 0 }}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { SearchEntryPointWidgetConfig } from
|
|
2
|
-
import { useNewOrgConfig } from
|
|
3
|
-
import { useMemo } from
|
|
4
|
-
import { SearchZeroState } from
|
|
5
|
-
|
|
1
|
+
import { SearchEntryPointWidgetConfig } from '@envive-ai/react-hooks/contexts/types';
|
|
2
|
+
import { useNewOrgConfig } from '@envive-ai/react-hooks/hooks/NewOrgConfig';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { SearchZeroState } from './SearchZeroState';
|
|
6
5
|
|
|
7
6
|
type SearchZeroStateWidgetProps = {
|
|
8
7
|
initialIsOpen: boolean;
|
|
9
8
|
widgetConfigId?: string;
|
|
10
9
|
entryPointRef: React.Ref<HTMLButtonElement>;
|
|
11
|
-
}
|
|
10
|
+
};
|
|
12
11
|
|
|
13
|
-
export const SearchZeroStateWidget = ({
|
|
12
|
+
export const SearchZeroStateWidget = ({
|
|
13
|
+
initialIsOpen,
|
|
14
|
+
widgetConfigId = 'searchEntryPointIcon',
|
|
15
|
+
entryPointRef,
|
|
16
|
+
}: SearchZeroStateWidgetProps) => {
|
|
14
17
|
const newConfig = useNewOrgConfig();
|
|
15
18
|
|
|
16
19
|
const widgetConfig = useMemo(() => {
|
|
@@ -29,5 +32,11 @@ export const SearchZeroStateWidget = ({ initialIsOpen, widgetConfigId = 'searchE
|
|
|
29
32
|
return null;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
return
|
|
35
|
+
return (
|
|
36
|
+
<SearchZeroState
|
|
37
|
+
widgetConfig={widgetConfig as SearchEntryPointWidgetConfig}
|
|
38
|
+
initialIsOpen={initialIsOpen}
|
|
39
|
+
entryPointRef={entryPointRef}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
33
42
|
};
|
|
@@ -6,7 +6,10 @@ import { useAmplitudeTracking } from '@envive-ai/react-hooks/hooks/AmplitudeOper
|
|
|
6
6
|
import { SearchResponseProduct } from '@spiffy-ai/commerce-api-client';
|
|
7
7
|
import { Typography } from '@envive-ai/react-toolkit/Typography';
|
|
8
8
|
import { ProductCardConfig, ProductGridVariant } from '@envive-ai/react-hooks/contexts/types';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
ChatElementDisplayLocation,
|
|
11
|
+
SearchResponseProductAttributes,
|
|
12
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
10
13
|
import { SpiffyMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
11
14
|
|
|
12
15
|
interface RecommendedProductsProps {
|
|
@@ -64,7 +67,6 @@ export const RecommendedProducts: React.FC<RecommendedProductsProps> = ({
|
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
const handleProductClick = (product: SearchResponseProduct, index: number) => {
|
|
67
|
-
|
|
68
70
|
track(SpiffyMetricsEventName.ProductCardClicked, {
|
|
69
71
|
eventProps: {
|
|
70
72
|
url: product.url,
|
|
@@ -100,7 +102,10 @@ export const RecommendedProducts: React.FC<RecommendedProductsProps> = ({
|
|
|
100
102
|
>
|
|
101
103
|
{heading && (
|
|
102
104
|
<div className={titleContainerClasses}>
|
|
103
|
-
<Typography
|
|
105
|
+
<Typography
|
|
106
|
+
variant="h1"
|
|
107
|
+
className="spiffy-tw-text-[--spiffy-colors-text-accent]"
|
|
108
|
+
>
|
|
104
109
|
{heading}
|
|
105
110
|
</Typography>
|
|
106
111
|
</div>
|
|
@@ -4,9 +4,7 @@ export const SEARCH_OVERLAY_PORTAL_ID = 'spiffy-ai-search-overlay-portal'; // Th
|
|
|
4
4
|
/**
|
|
5
5
|
* Find the portal target inside the overlay host's ShadowRoot.
|
|
6
6
|
*/
|
|
7
|
-
export function getOverlayPortalTarget(
|
|
8
|
-
hostId: string = SEARCH_OVERLAY_ENTRYPOINT_ID,
|
|
9
|
-
): HTMLElement {
|
|
7
|
+
export function getOverlayPortalTarget(hostId: string = SEARCH_OVERLAY_ENTRYPOINT_ID): HTMLElement {
|
|
10
8
|
const bareMount = document.getElementById(SEARCH_OVERLAY_PORTAL_ID) as HTMLElement | null;
|
|
11
9
|
if (bareMount) return bareMount;
|
|
12
10
|
const host = document.getElementById(hostId);
|
|
@@ -16,4 +14,4 @@ export function getOverlayPortalTarget(
|
|
|
16
14
|
const mount = sr.getElementById(SEARCH_OVERLAY_PORTAL_ID) as HTMLElement | null;
|
|
17
15
|
if (!mount) throw new Error('[Overlay] Portal mount missing inside ShadowRoot');
|
|
18
16
|
return mount;
|
|
19
|
-
}
|
|
17
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SearchEntryPointWidgetConfig,
|
|
3
|
+
SearchInputVariant,
|
|
4
|
+
} from '@envive-ai/react-hooks/contexts/types';
|
|
2
5
|
|
|
3
6
|
export type { SearchInputVariant, SearchEntryPointWidgetConfig };
|
|
4
7
|
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ColorNames,
|
|
3
|
+
SearchZeroStateVariant,
|
|
4
|
+
colorVar,
|
|
5
|
+
} from '@envive-ai/react-hooks/contexts/types';
|
|
2
6
|
|
|
3
7
|
interface SearchZeroStateVariantClasses {
|
|
4
8
|
overlayBackgroundClasses: string;
|
|
5
9
|
sparklesIconColor: string;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
|
-
export const searchZeroStateVariantClasses: Record<
|
|
9
|
-
|
|
12
|
+
export const searchZeroStateVariantClasses: Record<
|
|
13
|
+
SearchZeroStateVariant,
|
|
14
|
+
SearchZeroStateVariantClasses
|
|
15
|
+
> = {
|
|
16
|
+
backgroundTertiary: {
|
|
17
|
+
// standard light mode
|
|
10
18
|
overlayBackgroundClasses:
|
|
11
19
|
'spiffy-tw-bg-[--spiffy-colors-background-tertiary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20',
|
|
12
20
|
sparklesIconColor: colorVar(ColorNames.AccentPrimary),
|
|
13
21
|
},
|
|
14
|
-
backgroundDark: {
|
|
22
|
+
backgroundDark: {
|
|
23
|
+
// standard dark mode
|
|
15
24
|
overlayBackgroundClasses:
|
|
16
25
|
'spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20',
|
|
17
26
|
sparklesIconColor: colorVar(ColorNames.AccentPrimary),
|
|
@@ -19,6 +28,6 @@ export const searchZeroStateVariantClasses: Record<SearchZeroStateVariant, Searc
|
|
|
19
28
|
backgroundPrimary: {
|
|
20
29
|
overlayBackgroundClasses:
|
|
21
30
|
'spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20',
|
|
22
|
-
sparklesIconColor: colorVar(ColorNames.AccentPrimary)
|
|
31
|
+
sparklesIconColor: colorVar(ColorNames.AccentPrimary),
|
|
23
32
|
},
|
|
24
33
|
};
|
|
@@ -3,9 +3,8 @@ 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';
|
|
@@ -16,7 +15,6 @@ import { SuggestionButtonVariant } from '@envive-ai/react-hooks/contexts/types';
|
|
|
16
15
|
import { SuggestionBarLocationForMetrics } from './types';
|
|
17
16
|
import { SuggestionButtonContainer } from '../SuggestionButtonContainer';
|
|
18
17
|
|
|
19
|
-
|
|
20
18
|
// SuggestionBarV2 Props
|
|
21
19
|
interface SuggestionBarProps extends TestProps {
|
|
22
20
|
id: string;
|
|
@@ -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)
|
|
File without changes
|
|
File without changes
|