@envive-ai/react-toolkit-v3 0.3.15 → 0.3.16
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/AnimatedText/AnimatedText.d.cts +3 -3
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.cjs +1 -1
- package/dist/Carousel/Carousel.d.cts +2 -2
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/Carousel/Carousel.js +1 -1
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.js +1 -1
- package/dist/ChatFooter/components/Layout.cjs +2 -2
- package/dist/ChatFooter/components/Layout.js +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatFooter/hooks/useGetContainerProperties.cjs +1 -1
- package/dist/ChatFooter/hooks/useGetContainerProperties.js +1 -1
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/components/Handle.cjs +8 -6
- package/dist/ChatHeader/components/Handle.js +8 -6
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatPreview/ChatPreview.cjs +15 -6
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +15 -6
- package/dist/ChatPreview/components/Message.cjs +3 -2
- package/dist/ChatPreview/components/Message.js +3 -2
- package/dist/ChatPreview/types/types.d.cts +34 -2
- package/dist/ChatPreview/types/types.d.ts +34 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +12 -5
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +12 -5
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +5 -4
- package/dist/ChatPreviewComparison/components/Message.js +5 -4
- package/dist/ChatPreviewComparison/types/types.d.cts +34 -1
- package/dist/ChatPreviewComparison/types/types.d.ts +34 -1
- package/dist/ChatPreviewLoading/ChatPreviewLoading.cjs +1 -1
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.js +1 -1
- package/dist/Container/Container.d.cts +173 -173
- package/dist/Container/Container.d.ts +173 -173
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +2 -2
- package/dist/Disclaimer/components/Container.js +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +4 -8
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +4 -8
- package/dist/FloatingChat/components/AgentMessage.cjs +1 -2
- package/dist/FloatingChat/components/AgentMessage.js +1 -2
- package/dist/FloatingChat/components/ChatMessages.cjs +2 -3
- package/dist/FloatingChat/components/ChatMessages.js +2 -3
- package/dist/FloatingChat/components/Layout.cjs +3 -3
- package/dist/FloatingChat/components/Layout.js +3 -3
- package/dist/FloatingChat/components/ModalSheet.cjs +13 -3
- package/dist/FloatingChat/components/ModalSheet.js +14 -4
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +2 -3
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +2 -3
- package/dist/FloatingChat/hooks/useFilteredChatMessages.cjs +1 -1
- package/dist/FloatingChat/hooks/useFilteredChatMessages.js +1 -1
- package/dist/FloatingChat/hooks/useSnapControl.cjs +17 -16
- package/dist/FloatingChat/hooks/useSnapControl.js +17 -16
- package/dist/FloatingChat/hooks/useSnapSetup.cjs +9 -27
- package/dist/FloatingChat/hooks/useSnapSetup.js +10 -28
- package/dist/FloatingChat/snapConstants.cjs +10 -0
- package/dist/FloatingChat/snapConstants.js +7 -0
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +6 -3
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +6 -3
- package/dist/FullPageSalesAgent/components/Layout.cjs +3 -1
- package/dist/FullPageSalesAgent/components/Layout.js +3 -1
- package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.cjs +2 -1
- package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.js +2 -1
- package/dist/FullPageSalesAgent/hooks/useGetMessagesStyles.cjs +10 -0
- package/dist/FullPageSalesAgent/hooks/useGetMessagesStyles.js +10 -0
- package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.cjs +4 -2
- package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.js +4 -2
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.cjs +2 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.js +2 -1
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +10 -4
- package/dist/ProductCard/ProductCard.d.cts +8 -2
- package/dist/ProductCard/ProductCard.d.ts +8 -2
- package/dist/ProductCard/ProductCard.js +10 -4
- package/dist/ProductCard/components/Carousel.cjs +9 -3
- package/dist/ProductCard/components/Carousel.js +9 -3
- package/dist/ProductCard/types/index.d.cts +34 -0
- package/dist/ProductCard/types/index.d.ts +34 -0
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +1 -1
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +1 -1
- package/dist/PromptCarousel/PromptCarousel.cjs +3 -3
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +3 -3
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +2 -2
- package/dist/ReviewCard/components/Container.js +2 -2
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +6 -6
- package/dist/ReviewCard/components/index.d.ts +4 -4
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
- package/dist/SalesAgentProductCard/components/Container.js +2 -2
- package/dist/SalesAgentProductCard/components/index.d.cts +6 -6
- package/dist/SalesAgentProductCard/components/index.d.ts +6 -6
- package/dist/SocialProof/SocialProof.cjs +5 -5
- package/dist/SocialProof/SocialProof.d.cts +2 -2
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +2 -2
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
- package/dist/Stack/Stack.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +9 -3
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +9 -3
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/TypingAnimation/types/index.d.cts +28 -0
- package/dist/TypingAnimation/types/index.d.ts +28 -0
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.ts +2 -2
- package/dist/WidgetTextField/WidgetTextField.js +1 -1
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +3 -3
- package/dist/WidgetTextField/components/Icon.js +3 -3
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/ChatFooter/__tests__/ChatFooter.test.tsx +3 -0
- package/src/components/ChatFooter/hooks/useGetContainerProperties.ts +1 -1
- package/src/components/ChatHeader/components/Handle.tsx +14 -4
- package/src/components/ChatPreview/ChatPreview.tsx +27 -6
- package/src/components/ChatPreview/__tests__/ChatPreview.test.tsx +16 -5
- package/src/components/ChatPreview/components/Message.tsx +3 -1
- package/src/components/ChatPreview/types/types.ts +35 -2
- package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +23 -6
- package/src/components/ChatPreviewComparison/__tests__/ChatPreviewComparison.test.tsx +16 -5
- package/src/components/ChatPreviewComparison/components/Message.tsx +7 -1
- package/src/components/ChatPreviewComparison/types/types.ts +35 -1
- package/src/components/FloatingChat/FloatingChat.tsx +3 -9
- package/src/components/FloatingChat/components/AgentMessage.tsx +0 -3
- package/src/components/FloatingChat/components/ChatMessages.tsx +0 -3
- package/src/components/FloatingChat/components/ModalSheet.tsx +18 -10
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +1 -5
- package/src/components/FloatingChat/hooks/useFilteredChatMessages.ts +2 -2
- package/src/components/FloatingChat/hooks/useScrollToBottom.ts +1 -0
- package/src/components/FloatingChat/hooks/useSnapControl.ts +17 -22
- package/src/components/FloatingChat/hooks/useSnapSetup.ts +16 -37
- package/src/components/FloatingChat/snapConstants.ts +7 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +5 -2
- package/src/components/FullPageSalesAgent/components/Layout.tsx +3 -1
- package/src/components/FullPageSalesAgent/hooks/useGetFooterStyles.ts +7 -2
- package/src/components/FullPageSalesAgent/hooks/useGetMessagesStyles.ts +11 -0
- package/src/components/FullPageSalesAgent/hooks/useGetScrollContentStyles.ts +5 -1
- package/src/components/MarkdownProcessor/MarkdownProcessor.tsx +1 -1
- package/src/components/Message/__tests__/Message.test.tsx +3 -3
- package/src/components/ProductCard/ProductCard.tsx +13 -1
- package/src/components/ProductCard/__tests__/ProductCard.test.tsx +73 -1
- package/src/components/ProductCard/components/Carousel.tsx +13 -1
- package/src/components/ProductCard/types/index.ts +34 -0
- package/src/components/TypingAnimation/TypingAnimation.tsx +22 -7
- package/src/components/TypingAnimation/types/index.ts +29 -0
- package/src/components/WidgetTextField/components/Icon.tsx +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@testing-library/jest-dom';
|
|
2
2
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
4
|
import { Theme } from '../../../../tokens/theme/theme';
|
|
5
5
|
import { PromptButtonVariant } from '../../PromptButton';
|
|
6
6
|
import { ProductCard } from '../ProductCard';
|
|
@@ -73,6 +73,22 @@ describe('ProductCard', () => {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
describe('Callback handlers', () => {
|
|
76
|
+
it('should call onSelect when a prompt is clicked', () => {
|
|
77
|
+
const handleSelect = vi.fn();
|
|
78
|
+
render(
|
|
79
|
+
<ProductCard
|
|
80
|
+
{...defaultProps}
|
|
81
|
+
onSelect={handleSelect}
|
|
82
|
+
/>,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const promptButton = screen.getByText('Prompt 1');
|
|
86
|
+
promptButton.click();
|
|
87
|
+
|
|
88
|
+
expect(handleSelect).toHaveBeenCalledTimes(1);
|
|
89
|
+
expect(handleSelect).toHaveBeenCalledWith('Prompt 1');
|
|
90
|
+
});
|
|
91
|
+
|
|
76
92
|
it('should call onInputClick when input is clicked', () => {
|
|
77
93
|
const handleInputClick = vi.fn();
|
|
78
94
|
render(
|
|
@@ -88,6 +104,62 @@ describe('ProductCard', () => {
|
|
|
88
104
|
expect(handleInputClick).toHaveBeenCalledTimes(1);
|
|
89
105
|
});
|
|
90
106
|
|
|
107
|
+
it('should call onHover when a prompt is hovered', () => {
|
|
108
|
+
const handleHover = vi.fn();
|
|
109
|
+
render(
|
|
110
|
+
<ProductCard
|
|
111
|
+
{...defaultProps}
|
|
112
|
+
onHover={handleHover}
|
|
113
|
+
/>,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const promptButton = screen.getByText('Prompt 1');
|
|
117
|
+
fireEvent.mouseOver(promptButton);
|
|
118
|
+
|
|
119
|
+
expect(handleHover).toHaveBeenCalledTimes(1);
|
|
120
|
+
expect(handleHover).toHaveBeenCalledWith('Prompt 1');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should call onMouseDown and onMouseUp when interacting with a prompt via mouse', () => {
|
|
124
|
+
const handleMouseDown = vi.fn();
|
|
125
|
+
const handleMouseUp = vi.fn();
|
|
126
|
+
render(
|
|
127
|
+
<ProductCard
|
|
128
|
+
{...defaultProps}
|
|
129
|
+
onMouseDown={handleMouseDown}
|
|
130
|
+
onMouseUp={handleMouseUp}
|
|
131
|
+
/>,
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const promptButton = screen.getByText('Prompt 1');
|
|
135
|
+
fireEvent.mouseDown(promptButton);
|
|
136
|
+
fireEvent.mouseUp(promptButton);
|
|
137
|
+
|
|
138
|
+
expect(handleMouseDown).toHaveBeenCalledTimes(1);
|
|
139
|
+
expect(handleMouseDown).toHaveBeenCalledWith('Prompt 1');
|
|
140
|
+
expect(handleMouseUp).toHaveBeenCalledTimes(1);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should call onTouchStart and onTouchEnd when interacting with a prompt via touch', () => {
|
|
144
|
+
const handleTouchStart = vi.fn();
|
|
145
|
+
const handleTouchEnd = vi.fn();
|
|
146
|
+
render(
|
|
147
|
+
<ProductCard
|
|
148
|
+
{...defaultProps}
|
|
149
|
+
onTouchStart={handleTouchStart}
|
|
150
|
+
onTouchEnd={handleTouchEnd}
|
|
151
|
+
/>,
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const promptButton = screen.getByText('Prompt 1');
|
|
155
|
+
fireEvent.touchStart(promptButton);
|
|
156
|
+
fireEvent.touchEnd(promptButton);
|
|
157
|
+
|
|
158
|
+
expect(handleTouchStart).toHaveBeenCalledTimes(1);
|
|
159
|
+
expect(handleTouchStart).toHaveBeenCalledWith('Prompt 1');
|
|
160
|
+
expect(handleTouchEnd).toHaveBeenCalledTimes(1);
|
|
161
|
+
});
|
|
162
|
+
|
|
91
163
|
it('should render prompts in carousel', () => {
|
|
92
164
|
render(
|
|
93
165
|
<ProductCard
|
|
@@ -9,18 +9,30 @@ export const Carousel = ({
|
|
|
9
9
|
prompts,
|
|
10
10
|
promptButtonType,
|
|
11
11
|
onSelect,
|
|
12
|
+
onDrag,
|
|
13
|
+
onHover,
|
|
14
|
+
onMouseDown,
|
|
15
|
+
onMouseUp,
|
|
16
|
+
onTouchStart,
|
|
17
|
+
onTouchEnd,
|
|
12
18
|
}: CarouselProps) => {
|
|
13
19
|
const resolvedTheme = resolveTheme(theme);
|
|
14
20
|
const { carouselClasses } = useGetCarouselProperties();
|
|
15
21
|
return (
|
|
16
22
|
<PromptCarousel
|
|
17
23
|
className={carouselClasses}
|
|
18
|
-
handleButtonClick={onSelect}
|
|
19
24
|
id={carouselId}
|
|
20
25
|
promptCarouselRows={PromptCarouselRows.ALWAYS_TWO}
|
|
21
26
|
theme={resolvedTheme}
|
|
22
27
|
promptButtonType={promptButtonType}
|
|
23
28
|
promptButtonTexts={prompts}
|
|
29
|
+
handleButtonClick={onSelect}
|
|
30
|
+
handleButtonDrag={onDrag}
|
|
31
|
+
handleButtonHover={onHover}
|
|
32
|
+
handleButtonMouseDown={onMouseDown}
|
|
33
|
+
handleButtonMouseUp={onMouseUp}
|
|
34
|
+
handleButtonTouchStart={onTouchStart}
|
|
35
|
+
handleButtonTouchEnd={onTouchEnd}
|
|
24
36
|
/>
|
|
25
37
|
);
|
|
26
38
|
};
|
|
@@ -18,6 +18,40 @@ export interface CarouselProps {
|
|
|
18
18
|
* Callback function invoked when a prompt is selected.
|
|
19
19
|
*/
|
|
20
20
|
onSelect: (prompt: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Callback invoked when the user drags/swipes the carousel.
|
|
23
|
+
* Typically used for analytics or to pause other interactions while dragging.
|
|
24
|
+
*/
|
|
25
|
+
onDrag?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback invoked when the user hovers a specific prompt item.
|
|
28
|
+
*
|
|
29
|
+
* @param prompt The prompt currently being hovered.
|
|
30
|
+
*/
|
|
31
|
+
onHover?: (prompt: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Callback invoked when the user presses down on a specific prompt item.
|
|
34
|
+
* Useful for distinguishing a click/tap from a drag and for interaction tracking.
|
|
35
|
+
*
|
|
36
|
+
* @param prompt The prompt the user pressed down on.
|
|
37
|
+
*/
|
|
38
|
+
onMouseDown?: (prompt: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Callback invoked when the user releases the mouse button after interacting
|
|
41
|
+
* with the carousel or a prompt item.
|
|
42
|
+
*/
|
|
43
|
+
onMouseUp?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Callback invoked when the user starts a touch gesture on a specific prompt.
|
|
46
|
+
*
|
|
47
|
+
* @param prompt The prompt the user touched.
|
|
48
|
+
*/
|
|
49
|
+
onTouchStart?: (prompt: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback invoked when the user ends a touch gesture after interacting with
|
|
52
|
+
* the carousel or a prompt item.
|
|
53
|
+
*/
|
|
54
|
+
onTouchEnd?: () => void;
|
|
21
55
|
}
|
|
22
56
|
|
|
23
57
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import { AnimatedText } from '../AnimatedText';
|
|
3
|
-
import {
|
|
3
|
+
import { PromptButtonVariant } from '../PromptButton/types';
|
|
4
4
|
import { PromptCarousel, PromptCarouselRows } from '../PromptCarousel';
|
|
5
|
+
import { Stack } from '../Stack';
|
|
6
|
+
import { Theme } from '../Tokens';
|
|
7
|
+
import { Typography, TypographyColor } from '../Typography';
|
|
8
|
+
import { useAnimatedTextMinHeight } from '../utils/useAnimatedTextMinHeight';
|
|
5
9
|
import { WidgetTextField } from '../WidgetTextField';
|
|
6
10
|
import { WidgetWrapperVariant } from '../WidgetWrapper';
|
|
7
|
-
import { PromptButtonVariant } from '../PromptButton/types';
|
|
8
|
-
import { Theme } from '../Tokens';
|
|
9
11
|
import { WidgetWrapperWithTitle } from '../WidgetWrapperWithTitle';
|
|
10
|
-
import type { TypingAnimationProps } from './types';
|
|
11
12
|
import { useGetTypographyVariant } from './hooks/useGetTypographyVariant';
|
|
12
|
-
import {
|
|
13
|
-
import { Stack } from '../Stack';
|
|
13
|
+
import type { TypingAnimationProps } from './types';
|
|
14
14
|
|
|
15
15
|
export const TypingAnimation = ({
|
|
16
16
|
baseProps,
|
|
@@ -41,7 +41,16 @@ export const TypingAnimation = ({
|
|
|
41
41
|
isLoading = false,
|
|
42
42
|
} = widgetStyleProps || {};
|
|
43
43
|
|
|
44
|
-
const {
|
|
44
|
+
const {
|
|
45
|
+
handleButtonClick,
|
|
46
|
+
handleButtonDrag,
|
|
47
|
+
handleButtonHover,
|
|
48
|
+
handleButtonMouseDown,
|
|
49
|
+
handleButtonMouseUp,
|
|
50
|
+
handleButtonTouchStart,
|
|
51
|
+
handleButtonTouchEnd,
|
|
52
|
+
handleTextFieldClick,
|
|
53
|
+
} = widgetEventProps || {};
|
|
45
54
|
const typographyVariant = useGetTypographyVariant(theme);
|
|
46
55
|
const { measuringRef, minHeight } = useAnimatedTextMinHeight(animatedTextSequence ?? []);
|
|
47
56
|
|
|
@@ -153,6 +162,12 @@ export const TypingAnimation = ({
|
|
|
153
162
|
promptButtonType={promptButtonType}
|
|
154
163
|
promptCarouselRows={promptCarouselRows}
|
|
155
164
|
handleButtonClick={handleButtonClick}
|
|
165
|
+
handleButtonDrag={handleButtonDrag}
|
|
166
|
+
handleButtonHover={handleButtonHover}
|
|
167
|
+
handleButtonMouseDown={handleButtonMouseDown}
|
|
168
|
+
handleButtonMouseUp={handleButtonMouseUp}
|
|
169
|
+
handleButtonTouchStart={handleButtonTouchStart}
|
|
170
|
+
handleButtonTouchEnd={handleButtonTouchEnd}
|
|
156
171
|
promptButtonTexts={promptButtonTexts}
|
|
157
172
|
/>
|
|
158
173
|
)}
|
|
@@ -133,6 +133,35 @@ export type WidgetEventProps = {
|
|
|
133
133
|
*/
|
|
134
134
|
handleButtonClick?: (text: string) => void;
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Callback function invoked when the prompt buttons carousel is dragged.
|
|
138
|
+
* Useful for tracking drag-to-scroll interactions.
|
|
139
|
+
*/
|
|
140
|
+
handleButtonDrag?: () => void;
|
|
141
|
+
/**
|
|
142
|
+
* Callback function invoked when the user hovers over a prompt button.
|
|
143
|
+
* Receives the hovered button's text as a parameter.
|
|
144
|
+
*/
|
|
145
|
+
handleButtonHover?: (text: string) => void;
|
|
146
|
+
/**
|
|
147
|
+
* Callback function invoked when the mouse button is pressed down on a prompt button.
|
|
148
|
+
* Receives the pressed button's text as a parameter.
|
|
149
|
+
*/
|
|
150
|
+
handleButtonMouseDown?: (text: string) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Callback function invoked when the mouse button is released after pressing a prompt button.
|
|
153
|
+
*/
|
|
154
|
+
handleButtonMouseUp?: () => void;
|
|
155
|
+
/**
|
|
156
|
+
* Callback function invoked when a touch interaction starts on a prompt button.
|
|
157
|
+
* Receives the touched button's text as a parameter.
|
|
158
|
+
*/
|
|
159
|
+
handleButtonTouchStart?: (text: string) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Callback function invoked when a touch interaction ends after touching a prompt button.
|
|
162
|
+
*/
|
|
163
|
+
handleButtonTouchEnd?: () => void;
|
|
164
|
+
|
|
136
165
|
/**
|
|
137
166
|
* Callback function invoked when the TextField is clicked.
|
|
138
167
|
*/
|
|
@@ -86,12 +86,12 @@ export const Icon = ({ variant, theme, textColor }: IconProps) => {
|
|
|
86
86
|
}
|
|
87
87
|
return (
|
|
88
88
|
<CustomIcon
|
|
89
|
-
IconComponent={<
|
|
89
|
+
IconComponent={<SvgSendModern />}
|
|
90
90
|
className="envive-tw-h-6 envive-tw-w-6"
|
|
91
91
|
stroke={
|
|
92
92
|
textColor !== TypographyColor.TEXT_SECONDARY
|
|
93
93
|
? `var(--envive-colors-${textColor})`
|
|
94
|
-
: 'var(--envive-colors-
|
|
94
|
+
: 'var(--envive-colors-border-medium)'
|
|
95
95
|
}
|
|
96
96
|
/>
|
|
97
97
|
);
|