@envive-ai/react-toolkit-v3 0.3.8 → 0.3.10

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.
Files changed (238) hide show
  1. package/dist/AnimatedText/AnimatedText.cjs +1 -0
  2. package/dist/AnimatedText/AnimatedText.d.cts +3 -3
  3. package/dist/AnimatedText/AnimatedText.js +1 -0
  4. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
  5. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
  6. package/dist/Carousel/Carousel.cjs +1 -1
  7. package/dist/Carousel/Carousel.d.cts +2 -2
  8. package/dist/Carousel/Carousel.d.ts +2 -2
  9. package/dist/Carousel/Carousel.js +1 -1
  10. package/dist/Carousel/components/Container.cjs +2 -2
  11. package/dist/Carousel/components/Container.js +2 -2
  12. package/dist/ChatFooter/ChatFooter.cjs +1 -1
  13. package/dist/ChatFooter/ChatFooter.d.cts +2 -2
  14. package/dist/ChatFooter/ChatFooter.d.ts +2 -2
  15. package/dist/ChatFooter/ChatFooter.js +1 -1
  16. package/dist/ChatFooter/components/Layout.cjs +2 -2
  17. package/dist/ChatFooter/components/Layout.js +2 -2
  18. package/dist/ChatFooter/components/index.d.cts +5 -5
  19. package/dist/ChatFooter/components/index.d.ts +5 -5
  20. package/dist/ChatHeader/ChatHeader.d.cts +2 -2
  21. package/dist/ChatHeader/ChatHeader.d.ts +2 -2
  22. package/dist/ChatHeader/components/Handle.cjs +2 -2
  23. package/dist/ChatHeader/components/Handle.js +2 -2
  24. package/dist/ChatHeader/components/Toggle.cjs +3 -3
  25. package/dist/ChatHeader/components/Toggle.js +3 -3
  26. package/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +1 -1
  27. package/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +1 -1
  28. package/dist/ChatPreview/ChatPreview.cjs +14 -4
  29. package/dist/ChatPreview/ChatPreview.d.cts +2 -2
  30. package/dist/ChatPreview/ChatPreview.d.ts +2 -2
  31. package/dist/ChatPreview/ChatPreview.js +14 -4
  32. package/dist/ChatPreview/types/types.d.cts +5 -4
  33. package/dist/ChatPreview/types/types.d.ts +5 -4
  34. package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +14 -4
  35. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
  36. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
  37. package/dist/ChatPreviewComparison/ChatPreviewComparison.js +14 -4
  38. package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
  39. package/dist/ChatPreviewComparison/components/Headline.js +2 -2
  40. package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
  41. package/dist/ChatPreviewComparison/components/Layout.js +4 -4
  42. package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
  43. package/dist/ChatPreviewComparison/components/Message.js +2 -2
  44. package/dist/ChatPreviewComparison/types/types.d.cts +4 -4
  45. package/dist/ChatPreviewComparison/types/types.d.ts +4 -4
  46. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
  47. package/dist/Container/Container.d.cts +5 -5
  48. package/dist/Container/Container.d.ts +176 -176
  49. package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
  50. package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
  51. package/dist/Disclaimer/components/Container.cjs +2 -2
  52. package/dist/Disclaimer/components/Container.js +2 -2
  53. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
  54. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
  55. package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
  56. package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
  57. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
  58. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
  59. package/dist/FloatingButton/FloatingButton.d.cts +2 -2
  60. package/dist/FloatingChat/FloatingChat.cjs +3 -2
  61. package/dist/FloatingChat/FloatingChat.d.cts +2 -2
  62. package/dist/FloatingChat/FloatingChat.d.ts +2 -2
  63. package/dist/FloatingChat/FloatingChat.js +3 -2
  64. package/dist/FloatingChat/components/AgentMessage.cjs +9 -5
  65. package/dist/FloatingChat/components/AgentMessage.js +9 -5
  66. package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
  67. package/dist/FloatingChat/components/ChatMessages.js +1 -1
  68. package/dist/FloatingChat/components/Layout.cjs +13 -13
  69. package/dist/FloatingChat/components/Layout.js +13 -13
  70. package/dist/FloatingChat/components/ModalSheet.cjs +5 -6
  71. package/dist/FloatingChat/components/ModalSheet.js +5 -6
  72. package/dist/FloatingChat/components/ReviewCardsCarousel.cjs +2 -1
  73. package/dist/FloatingChat/components/ReviewCardsCarousel.js +2 -1
  74. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +0 -3
  75. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +0 -3
  76. package/dist/Image/Image.d.cts +2 -2
  77. package/dist/Image/Image.d.ts +2 -2
  78. package/dist/ImageGallery/ImageGallery.d.cts +2 -2
  79. package/dist/ImageGallery/ImageGallery.d.ts +2 -2
  80. package/dist/ImageGallery/components/Layout.cjs +1 -1
  81. package/dist/ImageGallery/components/Layout.js +1 -1
  82. package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
  83. package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
  84. package/dist/Message/components/LinkButton.cjs +1 -1
  85. package/dist/Message/components/LinkButton.js +1 -1
  86. package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
  87. package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
  88. package/dist/ProductCard/ProductCard.cjs +10 -6
  89. package/dist/ProductCard/ProductCard.d.cts +2 -2
  90. package/dist/ProductCard/ProductCard.d.ts +2 -2
  91. package/dist/ProductCard/ProductCard.js +5 -2
  92. package/dist/ProductCard/components/Header.cjs +2 -2
  93. package/dist/ProductCard/components/Header.js +2 -2
  94. package/dist/PromptButton/PromptButton.d.cts +2 -2
  95. package/dist/PromptButton/PromptButton.d.ts +2 -2
  96. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.cjs +3 -2
  97. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
  98. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
  99. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.js +3 -2
  100. package/dist/PromptButtonCarouselWithImage/components/Layout.cjs +7 -2
  101. package/dist/PromptButtonCarouselWithImage/components/Layout.js +8 -3
  102. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +53 -3
  103. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +53 -3
  104. package/dist/PromptCarousel/PromptCarousel.cjs +71 -33
  105. package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
  106. package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
  107. package/dist/PromptCarousel/PromptCarousel.js +73 -35
  108. package/dist/PromptCarousel/hooks/index.cjs +2 -4
  109. package/dist/PromptCarousel/hooks/index.js +2 -4
  110. package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.cjs +91 -0
  111. package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.js +90 -0
  112. package/dist/PromptCarousel/hooks/useScrollSync.cjs +65 -0
  113. package/dist/PromptCarousel/hooks/useScrollSync.js +64 -0
  114. package/dist/ReviewCard/ReviewCard.d.cts +2 -2
  115. package/dist/ReviewCard/ReviewCard.d.ts +2 -2
  116. package/dist/ReviewCard/components/Container.cjs +2 -2
  117. package/dist/ReviewCard/components/Container.js +2 -2
  118. package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
  119. package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
  120. package/dist/ReviewCard/components/index.d.cts +4 -4
  121. package/dist/ReviewCard/components/index.d.ts +6 -6
  122. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
  123. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
  124. package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
  125. package/dist/SalesAgentProductCard/components/Container.js +2 -2
  126. package/dist/SalesAgentProductCard/components/index.d.cts +6 -6
  127. package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
  128. package/dist/SocialProof/SocialProof.cjs +1 -1
  129. package/dist/SocialProof/SocialProof.d.cts +2 -2
  130. package/dist/SocialProof/SocialProof.d.ts +2 -2
  131. package/dist/SocialProof/SocialProof.js +1 -1
  132. package/dist/SocialProof/components/Headline.cjs +3 -3
  133. package/dist/SocialProof/components/Headline.js +3 -3
  134. package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
  135. package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
  136. package/dist/SocialProof/components/Subheadline.cjs +1 -1
  137. package/dist/SocialProof/components/Subheadline.js +1 -1
  138. package/dist/Stack/Stack.d.cts +2 -2
  139. package/dist/TextField/utils/getIconColor.cjs +1 -1
  140. package/dist/TextField/utils/getIconColor.js +1 -1
  141. package/dist/TextField/utils/getSendIconElement.cjs +1 -1
  142. package/dist/TextField/utils/getSendIconElement.js +1 -1
  143. package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
  144. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
  145. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
  146. package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
  147. package/dist/Tokens/index.cjs +1 -1
  148. package/dist/Tokens/index.js +1 -1
  149. package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
  150. package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
  151. package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
  152. package/dist/TypingAnimation/TypingAnimation.js +1 -1
  153. package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
  154. package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
  155. package/dist/Typography/Typography.d.cts +4 -4
  156. package/dist/Typography/Typography.d.ts +4 -4
  157. package/dist/WelcomeMessage/components/Container.cjs +2 -2
  158. package/dist/WelcomeMessage/components/Container.js +2 -2
  159. package/dist/WidgetTextField/WidgetTextField.cjs +11 -6
  160. package/dist/WidgetTextField/WidgetTextField.d.cts +3 -2
  161. package/dist/WidgetTextField/WidgetTextField.d.ts +3 -2
  162. package/dist/WidgetTextField/WidgetTextField.js +7 -2
  163. package/dist/WidgetTextField/components/Container.cjs +2 -2
  164. package/dist/WidgetTextField/components/Container.js +2 -2
  165. package/dist/WidgetTextField/components/FakeTextInput.cjs +2 -2
  166. package/dist/WidgetTextField/components/FakeTextInput.js +2 -2
  167. package/dist/WidgetTextField/components/Icon.cjs +11 -9
  168. package/dist/WidgetTextField/components/Icon.js +11 -9
  169. package/dist/WidgetTextField/types/types.d.cts +3 -0
  170. package/dist/WidgetTextField/types/types.d.ts +3 -0
  171. package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
  172. package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
  173. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
  174. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
  175. package/dist/styles.css +1 -1
  176. package/dist/utils/CustomIcon.cjs +1 -1
  177. package/dist/utils/CustomIcon.js +1 -1
  178. package/dist/utils/useDragToScroll.cjs +68 -0
  179. package/dist/utils/useDragToScroll.js +67 -0
  180. package/package.json +1 -1
  181. package/src/components/AnimatedText/AnimatedText.tsx +2 -0
  182. package/src/components/ChatHeader/hooks/useGetCloseButtonProperties.ts +1 -1
  183. package/src/components/ChatPreview/ChatPreview.tsx +20 -3
  184. package/src/components/ChatPreview/types/types.ts +5 -4
  185. package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +20 -3
  186. package/src/components/ChatPreviewComparison/types/types.ts +4 -4
  187. package/src/components/FloatingChat/FloatingChat.tsx +3 -2
  188. package/src/components/FloatingChat/components/AgentMessage.tsx +1 -0
  189. package/src/components/FloatingChat/components/Layout.tsx +7 -2
  190. package/src/components/FloatingChat/components/ModalSheet.tsx +5 -7
  191. package/src/components/FloatingChat/components/ReviewCardsCarousel.tsx +3 -0
  192. package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +0 -3
  193. package/src/components/ProductCard/ProductCard.tsx +12 -1
  194. package/src/components/ProductCard/components/Header.tsx +10 -8
  195. package/src/components/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.tsx +6 -3
  196. package/src/components/PromptButtonCarouselWithImage/components/Layout.tsx +13 -4
  197. package/src/components/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.tsx +63 -20
  198. package/src/components/PromptCarousel/PromptCarousel.tsx +89 -51
  199. package/src/components/PromptCarousel/hooks/index.ts +2 -4
  200. package/src/components/PromptCarousel/hooks/useCoordinatedScrollAnimation.ts +115 -0
  201. package/src/components/PromptCarousel/hooks/useHorizontalScrollAnimation.ts +71 -78
  202. package/src/components/PromptCarousel/hooks/useScrollSync.ts +83 -0
  203. package/src/components/TextField/utils/getIconColor.ts +1 -1
  204. package/src/components/TextField/utils/getSendIconElement.tsx +3 -1
  205. package/src/components/WidgetTextField/WidgetTextField.tsx +9 -1
  206. package/src/components/WidgetTextField/components/FakeTextInput.tsx +6 -2
  207. package/src/components/WidgetTextField/components/Icon.tsx +44 -9
  208. package/src/components/WidgetTextField/types/types.ts +3 -0
  209. package/src/components/utils/CustomIcon.tsx +1 -1
  210. package/src/components/utils/useDragToScroll.ts +83 -0
  211. package/dist/PromptCarousel/components/BlockScrollContainer.cjs +0 -23
  212. package/dist/PromptCarousel/components/BlockScrollContainer.js +0 -21
  213. package/dist/PromptCarousel/components/ButtonContainerRow.cjs +0 -34
  214. package/dist/PromptCarousel/components/ButtonContainerRow.js +0 -32
  215. package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.cjs +0 -45
  216. package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.js +0 -44
  217. package/dist/PromptCarousel/components/CarouselContentWithRowScroll.cjs +0 -33
  218. package/dist/PromptCarousel/components/CarouselContentWithRowScroll.js +0 -32
  219. package/dist/PromptCarousel/components/index.cjs +0 -13
  220. package/dist/PromptCarousel/components/index.js +0 -13
  221. package/dist/PromptCarousel/hooks/useButtonScrollPosition.cjs +0 -79
  222. package/dist/PromptCarousel/hooks/useButtonScrollPosition.js +0 -78
  223. package/dist/PromptCarousel/hooks/useCarouselAnimation.cjs +0 -23
  224. package/dist/PromptCarousel/hooks/useCarouselAnimation.js +0 -22
  225. package/dist/PromptCarousel/hooks/useCarouselRefs.cjs +0 -20
  226. package/dist/PromptCarousel/hooks/useCarouselRefs.js +0 -19
  227. package/dist/PromptCarousel/hooks/useGetScrollProperties.cjs +0 -18
  228. package/dist/PromptCarousel/hooks/useGetScrollProperties.js +0 -17
  229. package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.cjs +0 -78
  230. package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.js +0 -77
  231. package/src/components/PromptCarousel/components/BlockScrollContainer.tsx +0 -34
  232. package/src/components/PromptCarousel/components/ButtonContainerRow.tsx +0 -46
  233. package/src/components/PromptCarousel/components/CarouselContentWithBlockScroll.tsx +0 -83
  234. package/src/components/PromptCarousel/components/CarouselContentWithRowScroll.tsx +0 -71
  235. package/src/components/PromptCarousel/components/index.ts +0 -9
  236. package/src/components/PromptCarousel/hooks/useButtonScrollPosition.ts +0 -128
  237. package/src/components/PromptCarousel/hooks/useCarouselAnimation.ts +0 -47
  238. package/src/components/PromptCarousel/hooks/useCarouselRefs.ts +0 -27
@@ -1,18 +1,14 @@
1
- import { useCallback } from 'react';
1
+ import { useCallback, useRef } from 'react';
2
+ import { useScrollContainer } from 'react-indiana-drag-scroll';
2
3
  import { Theme } from '../../../tokens/theme/theme';
3
4
  import { PromptButton, PromptButtonVariant } from '../PromptButton';
4
5
  import { useCheckIsMobile } from '../utils/useCheckIsMobile';
5
- import {
6
- AnimationSpeed,
7
- PromptCarouselProps,
8
- PromptCarouselRows,
9
- RepetitionNumberSuffix,
10
- } from './types/types';
11
- import { useCarouselAnimation, useCarouselButtons, useCarouselRefs } from './hooks';
12
- import { PromptCarouselComponents } from './components';
6
+ import { AnimationSpeed, PromptCarouselProps, PromptCarouselRows } from './types/types';
7
+ import { useCarouselButtons, useCoordinatedScrollAnimation, useScrollSync } from './hooks';
13
8
  import { Container } from '../Container';
14
9
  import { isAnimated, removeSpaces, shouldShowTwoRows } from './utils/functions';
15
10
  import { resolveTheme } from '../utils/resolveTheme';
11
+ import { Stack } from '../Stack';
16
12
 
17
13
  export const PromptCarousel = ({
18
14
  id,
@@ -37,21 +33,39 @@ export const PromptCarousel = ({
37
33
  const shouldShowTwoRowsValue = shouldShowTwoRows(promptCarouselRows, isMobile);
38
34
  const finalTheme = resolveTheme(theme);
39
35
 
40
- const {
41
- firstRowScrollRef,
42
- firstRowStackRef,
43
- secondRowScrollRef,
44
- blockScrollRef,
45
- blockFirstRowStackRef,
46
- scrollRefs,
47
- } = useCarouselRefs({ shouldShowTwoRows: shouldShowTwoRowsValue });
36
+ const { ref: dragScrollRef1 } = useScrollContainer();
37
+ const { ref: dragScrollRef2 } = useScrollContainer();
38
+ const scrollContainerRef1 = useRef<HTMLDivElement>(null);
39
+ const scrollContainerRef2 = useRef<HTMLDivElement>(null);
48
40
 
49
- const { isAnimationStopped, shouldUseRowScroll } = useCarouselAnimation({
50
- firstRowScrollRef,
51
- blockScrollRef,
52
- scrollRefs,
41
+ const setRef1 = useCallback(
42
+ (el: HTMLDivElement | null) => {
43
+ if (typeof dragScrollRef1 === 'function') dragScrollRef1(el);
44
+ scrollContainerRef1.current = el;
45
+ },
46
+ [dragScrollRef1],
47
+ );
48
+
49
+ const setRef2 = useCallback(
50
+ (el: HTMLDivElement | null) => {
51
+ if (typeof dragScrollRef2 === 'function') dragScrollRef2(el);
52
+ scrollContainerRef2.current = el;
53
+ },
54
+ [dragScrollRef2],
55
+ );
56
+
57
+ const scrollContainerRefs = shouldShowTwoRowsValue
58
+ ? [scrollContainerRef1, scrollContainerRef2]
59
+ : [scrollContainerRef1];
60
+
61
+ useCoordinatedScrollAnimation({
62
+ scrollContainerRefs,
53
63
  animationSpeed,
54
- isAnimated: isAnimatedValue,
64
+ });
65
+
66
+ useScrollSync({
67
+ scrollContainerRefs,
68
+ enabled: true,
55
69
  });
56
70
 
57
71
  const { visibleButtonsFirstRow, visibleButtonsSecondRow } = useCarouselButtons({
@@ -60,11 +74,12 @@ export const PromptCarousel = ({
60
74
  });
61
75
 
62
76
  const renderButton = useCallback(
63
- (text: string, index: number, repetitionNumber: `${RepetitionNumberSuffix}` = undefined) => {
77
+ (text: string, index: number, duplicateIndex = 0) => {
64
78
  const textWithoutSpaces = removeSpaces(text);
65
- const buttonId = repetitionNumber
66
- ? `${id}-${textWithoutSpaces}${repetitionNumber}`
67
- : `${id}-${textWithoutSpaces}`;
79
+ const buttonId =
80
+ duplicateIndex > 0
81
+ ? `${id}-${textWithoutSpaces}-duplicate-${duplicateIndex}`
82
+ : `${id}-${textWithoutSpaces}`;
68
83
  const buttonKey = `button-${buttonId}`;
69
84
 
70
85
  return (
@@ -75,7 +90,7 @@ export const PromptCarousel = ({
75
90
  variant={promptButtonType}
76
91
  theme={finalTheme}
77
92
  isLoading={isLoading}
78
- bold={boldFirstButton && index === 0}
93
+ bold={boldFirstButton && index === 0 && duplicateIndex === 0}
79
94
  onClick={() => handleButtonClick?.(text)}
80
95
  />
81
96
  );
@@ -83,6 +98,14 @@ export const PromptCarousel = ({
83
98
  [id, promptButtonType, boldFirstButton, handleButtonClick, isLoading, finalTheme],
84
99
  );
85
100
 
101
+ const renderButtonRow = (buttons: string[], startIndex: number) => (
102
+ <>
103
+ {buttons.map((text, i) => renderButton(text, startIndex + i, 0))}
104
+ {isAnimatedValue && buttons.map((text, i) => renderButton(text, startIndex + i, 1))}
105
+ {isAnimatedValue && buttons.map((text, i) => renderButton(text, startIndex + i, 2))}
106
+ </>
107
+ );
108
+
86
109
  const defaultAriaLabel = ariaLabel || 'Prompt carousel with suggested actions';
87
110
 
88
111
  return (
@@ -98,30 +121,45 @@ export const PromptCarousel = ({
98
121
  aria-busy={isLoading}
99
122
  aria-live={isAnimatedValue && !isLoading ? 'polite' : undefined}
100
123
  >
101
- {shouldUseRowScroll ? (
102
- <PromptCarouselComponents.CarouselContentWithRowScroll
103
- visibleButtonsFirstRow={visibleButtonsFirstRow}
104
- visibleButtonsSecondRow={visibleButtonsSecondRow}
105
- shouldShowTwoRows={shouldShowTwoRowsValue}
106
- renderButton={renderButton}
107
- isAnimated={isAnimatedValue}
108
- isAnimationStopped={isAnimationStopped}
109
- firstRowScrollRef={firstRowScrollRef}
110
- firstRowStackRef={firstRowStackRef}
111
- secondRowScrollRef={secondRowScrollRef}
112
- />
113
- ) : (
114
- <PromptCarouselComponents.CarouselContentWithBlockScroll
115
- visibleButtonsFirstRow={visibleButtonsFirstRow}
116
- visibleButtonsSecondRow={visibleButtonsSecondRow}
117
- shouldShowTwoRows={shouldShowTwoRowsValue}
118
- renderButton={renderButton}
119
- isAnimated={isAnimatedValue}
120
- isAnimationStopped={isAnimationStopped}
121
- blockScrollRef={blockScrollRef}
122
- blockFirstRowStackRef={blockFirstRowStackRef}
123
- />
124
- )}
124
+ <Stack
125
+ direction="column"
126
+ className={animationSpeed === AnimationSpeed.NONE ? 'envive-tw-w-full' : ''}
127
+ gap="2"
128
+ >
129
+ <div
130
+ className="envive-tw-no-scrollbar envive-tw-relative envive-tw-w-full envive-tw-overflow-x-scroll"
131
+ ref={setRef1}
132
+ style={{ cursor: 'grab', userSelect: 'none' }}
133
+ >
134
+ <div className="envive-tw-relative envive-tw-inline-block envive-tw-whitespace-nowrap">
135
+ <Stack
136
+ direction="row"
137
+ gap="2"
138
+ className="envive-tw-pl-0 envive-tw-h-full envive-tw-items-center"
139
+ >
140
+ {renderButtonRow(visibleButtonsFirstRow, 0)}
141
+ </Stack>
142
+ </div>
143
+ </div>
144
+
145
+ {shouldShowTwoRowsValue && (
146
+ <div
147
+ className="envive-tw-no-scrollbar envive-tw-relative envive-tw-w-full envive-tw-overflow-x-scroll"
148
+ ref={setRef2}
149
+ style={{ cursor: 'grab', userSelect: 'none' }}
150
+ >
151
+ <div className="envive-tw-relative envive-tw-inline-block envive-tw-whitespace-nowrap">
152
+ <Stack
153
+ direction="row"
154
+ gap="2"
155
+ className="envive-tw-pl-0 envive-tw-h-full envive-tw-items-center"
156
+ >
157
+ {renderButtonRow(visibleButtonsSecondRow, visibleButtonsFirstRow.length)}
158
+ </Stack>
159
+ </div>
160
+ </div>
161
+ )}
162
+ </Stack>
125
163
  </Container>
126
164
  );
127
165
  };
@@ -1,5 +1,3 @@
1
- export { useHorizontalScrollAnimation } from './useHorizontalScrollAnimation';
2
- export { useButtonScrollPosition } from './useButtonScrollPosition';
3
- export { useCarouselRefs } from './useCarouselRefs';
4
1
  export { useCarouselButtons } from './useCarouselButtons';
5
- export { useCarouselAnimation } from './useCarouselAnimation';
2
+ export { useCoordinatedScrollAnimation } from './useCoordinatedScrollAnimation';
3
+ export { useScrollSync } from './useScrollSync';
@@ -0,0 +1,115 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { AnimationSpeed } from '../types/types';
3
+
4
+ interface UseCoordinatedScrollAnimationOptions {
5
+ scrollContainerRefs: React.RefObject<HTMLDivElement>[];
6
+ animationSpeed?: `${AnimationSpeed}`;
7
+ }
8
+
9
+ export function useCoordinatedScrollAnimation({
10
+ scrollContainerRefs,
11
+ animationSpeed = AnimationSpeed.NONE,
12
+ }: UseCoordinatedScrollAnimationOptions): void {
13
+ const resumeTimeoutRef = useRef<number | null>(null);
14
+ const scrollAnimationRefs = useRef<number[]>([]);
15
+ const isPausedRef = useRef(false);
16
+
17
+ let PIXELS_PER_SECOND = 0;
18
+ switch (animationSpeed) {
19
+ case AnimationSpeed.FAST:
20
+ PIXELS_PER_SECOND = 60;
21
+ break;
22
+ case AnimationSpeed.SLOW:
23
+ PIXELS_PER_SECOND = 30;
24
+ break;
25
+ default:
26
+ PIXELS_PER_SECOND = 0;
27
+ }
28
+ const RESUME_DELAY_MS = 1500;
29
+ const isAnimated = animationSpeed !== AnimationSpeed.NONE;
30
+
31
+ useEffect(() => {
32
+ if (!isAnimated || scrollContainerRefs.length === 0) return undefined;
33
+
34
+ const containers = scrollContainerRefs
35
+ .map(ref => ref.current)
36
+ .filter((el): el is HTMLDivElement => el !== null);
37
+
38
+ if (containers.length === 0) return undefined;
39
+
40
+ const animationStates = containers.map(() => ({
41
+ lastTimestamp: null as number | null,
42
+ accumulatedScroll: 0,
43
+ }));
44
+
45
+ const step = (timestamp: number) => {
46
+ if (!isPausedRef.current) {
47
+ containers.forEach((containerElement, index) => {
48
+ const container = containerElement;
49
+ if (container.scrollWidth <= container.clientWidth) return;
50
+
51
+ const stateElement = animationStates[index];
52
+ const state = stateElement;
53
+ if (state.lastTimestamp === null) state.lastTimestamp = timestamp;
54
+
55
+ const delta = timestamp - state.lastTimestamp;
56
+ state.lastTimestamp = timestamp;
57
+
58
+ state.accumulatedScroll += PIXELS_PER_SECOND * (delta / 1000);
59
+
60
+ const pixelsToScroll = Math.floor(state.accumulatedScroll);
61
+ if (pixelsToScroll > 0) {
62
+ container.scrollLeft += pixelsToScroll;
63
+ state.accumulatedScroll -= pixelsToScroll;
64
+
65
+ if (Math.ceil(container.scrollLeft) >= container.scrollWidth - container.clientWidth) {
66
+ container.scrollLeft = 0;
67
+ state.accumulatedScroll = 0;
68
+ }
69
+ }
70
+ });
71
+ }
72
+
73
+ const rafId = requestAnimationFrame(step);
74
+ scrollAnimationRefs.current[0] = rafId;
75
+ };
76
+
77
+ scrollAnimationRefs.current[0] = requestAnimationFrame(step);
78
+
79
+ const pauseAnimation = () => {
80
+ isPausedRef.current = true;
81
+ if (resumeTimeoutRef.current) {
82
+ clearTimeout(resumeTimeoutRef.current);
83
+ resumeTimeoutRef.current = null;
84
+ }
85
+ };
86
+
87
+ const scheduleResumeAnimation = () => {
88
+ resumeTimeoutRef.current = window.setTimeout(() => {
89
+ isPausedRef.current = false;
90
+ animationStates.forEach(stateElement => {
91
+ const state = stateElement;
92
+ state.lastTimestamp = null;
93
+ });
94
+ }, RESUME_DELAY_MS);
95
+ };
96
+
97
+ containers.forEach(container => {
98
+ container.addEventListener('mouseenter', pauseAnimation);
99
+ container.addEventListener('mouseleave', scheduleResumeAnimation);
100
+ });
101
+
102
+ return () => {
103
+ scrollAnimationRefs.current.forEach(rafId => {
104
+ if (rafId) cancelAnimationFrame(rafId);
105
+ });
106
+ containers.forEach(container => {
107
+ container.removeEventListener('mouseenter', pauseAnimation);
108
+ container.removeEventListener('mouseleave', scheduleResumeAnimation);
109
+ });
110
+ if (resumeTimeoutRef.current) {
111
+ clearTimeout(resumeTimeoutRef.current);
112
+ }
113
+ };
114
+ }, [isAnimated, PIXELS_PER_SECOND, scrollContainerRefs]);
115
+ }
@@ -1,103 +1,96 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import { AnimationSpeed } from '../types/types';
3
3
 
4
- export function useHorizontalScrollAnimation(
5
- scrollContainerRefs: React.RefObject<HTMLDivElement>[],
6
- onStopAll: (mouseX?: number, mouseY?: number) => void,
7
- animationSpeed: `${AnimationSpeed}` = 'none',
8
- ) {
9
- const animationRefs = useRef<(number | null)[]>([]);
10
- const lastTimestampRefs = useRef<(number | null)[]>([]);
11
- const accumulatedScrollRefs = useRef<number[]>([]);
12
- const isStoppedRef = useRef(false);
13
-
14
- useEffect(() => {
15
- if (animationSpeed === AnimationSpeed.NONE) {
16
- return undefined;
17
- }
18
-
19
- const containers = scrollContainerRefs
20
- .map(ref => ref.current)
21
- .filter((container): container is HTMLDivElement => container !== null);
22
-
23
- if (containers.length === 0) {
24
- return undefined;
25
- }
26
-
27
- animationRefs.current = containers.map(() => null);
28
- lastTimestampRefs.current = containers.map(() => null);
29
- accumulatedScrollRefs.current = containers.map(() => 0);
4
+ interface UseHorizontalScrollAnimationOptions {
5
+ scrollContainerRef: React.RefObject<HTMLDivElement>;
6
+ animationSpeed?: `${AnimationSpeed}`;
7
+ }
30
8
 
31
- const PIXELS_PER_SECOND = animationSpeed === AnimationSpeed.FAST ? 60 : 30;
9
+ export function useHorizontalScrollAnimation({
10
+ scrollContainerRef,
11
+ animationSpeed = AnimationSpeed.NONE,
12
+ }: UseHorizontalScrollAnimationOptions): void {
13
+ const resumeTimeoutRef = useRef<number | null>(null);
14
+ const scrollAnimationRef = useRef<number | null>(null);
15
+
16
+ let PIXELS_PER_SECOND = 0;
17
+ switch (animationSpeed) {
18
+ case AnimationSpeed.FAST:
19
+ PIXELS_PER_SECOND = 60;
20
+ break;
21
+ case AnimationSpeed.SLOW:
22
+ PIXELS_PER_SECOND = 30;
23
+ break;
24
+ default:
25
+ PIXELS_PER_SECOND = 0;
26
+ }
27
+ const RESUME_DELAY_MS = 1500;
28
+ const isAnimated = animationSpeed !== AnimationSpeed.NONE;
32
29
 
33
- const cancelAllAnimations = () => {
34
- animationRefs.current.forEach(rafId => {
35
- if (rafId !== null) {
36
- cancelAnimationFrame(rafId);
37
- }
38
- });
39
- };
30
+ useEffect(() => {
31
+ if (!isAnimated || !scrollContainerRef) return undefined;
40
32
 
41
- const createAnimationLoop = (index: number) => {
42
- const step = (timestamp: number) => {
43
- if (isStoppedRef.current) return;
33
+ const container = scrollContainerRef.current;
34
+ if (!container) return undefined;
35
+ if (container.scrollWidth <= container.clientWidth) return undefined;
44
36
 
45
- const container = containers[index];
46
- if (!container || container.scrollWidth <= container.clientWidth) {
47
- animationRefs.current[index] = requestAnimationFrame(step);
48
- return;
49
- }
37
+ let isPaused = false;
38
+ let lastTimestamp: number | null = null;
39
+ let accumulatedScroll = 0;
50
40
 
51
- if (lastTimestampRefs.current[index] === null) {
52
- lastTimestampRefs.current[index] = timestamp;
53
- }
41
+ const step = (timestamp: number) => {
42
+ if (lastTimestamp === null) lastTimestamp = timestamp;
43
+ if (!isPaused) {
44
+ const delta = timestamp - lastTimestamp;
45
+ lastTimestamp = timestamp;
54
46
 
55
- const delta = timestamp - lastTimestampRefs.current[index]!;
56
- lastTimestampRefs.current[index] = timestamp;
57
- accumulatedScrollRefs.current[index] += PIXELS_PER_SECOND * (delta / 1000);
47
+ accumulatedScroll += PIXELS_PER_SECOND * (delta / 1000);
58
48
 
59
- const pixelsToScroll = Math.floor(accumulatedScrollRefs.current[index]);
49
+ const pixelsToScroll = Math.floor(accumulatedScroll);
60
50
  if (pixelsToScroll > 0) {
61
- const newScrollLeft = container.scrollLeft + pixelsToScroll;
62
- const maxScroll = container.scrollWidth - container.clientWidth;
51
+ container.scrollLeft += pixelsToScroll;
52
+ accumulatedScroll -= pixelsToScroll;
63
53
 
64
- if (Math.ceil(newScrollLeft) >= maxScroll) {
54
+ if (Math.ceil(container.scrollLeft) >= container.scrollWidth - container.clientWidth) {
65
55
  container.scrollLeft = 0;
66
- accumulatedScrollRefs.current[index] = 0;
67
- } else {
68
- container.scrollLeft = newScrollLeft;
69
- accumulatedScrollRefs.current[index] -= pixelsToScroll;
56
+ accumulatedScroll = 0;
70
57
  }
71
58
  }
59
+ }
60
+ scrollAnimationRef.current = requestAnimationFrame(step);
61
+ };
72
62
 
73
- if (!isStoppedRef.current) {
74
- animationRefs.current[index] = requestAnimationFrame(step);
75
- }
76
- };
63
+ // Start animation
64
+ scrollAnimationRef.current = requestAnimationFrame(step);
77
65
 
78
- return step;
66
+ const pauseAnimation = () => {
67
+ isPaused = true;
68
+ if (resumeTimeoutRef.current) {
69
+ clearTimeout(resumeTimeoutRef.current);
70
+ resumeTimeoutRef.current = null;
71
+ }
79
72
  };
80
73
 
81
- containers.forEach((container, index) => {
82
- animationRefs.current[index] = requestAnimationFrame(createAnimationLoop(index));
83
- });
84
-
85
- const handleMouseEnter = (event: MouseEvent) => {
86
- isStoppedRef.current = true;
87
- onStopAll(event.clientX, event.clientY);
88
- cancelAllAnimations();
74
+ const scheduleResumeAnimation = () => {
75
+ resumeTimeoutRef.current = window.setTimeout(() => {
76
+ isPaused = false;
77
+ lastTimestamp = null;
78
+ }, RESUME_DELAY_MS);
89
79
  };
90
80
 
91
- containers.forEach(container => {
92
- container.addEventListener('mouseenter', handleMouseEnter);
93
- });
81
+ // Attach pause/resume listeners for hover behavior
82
+ container.addEventListener('mouseenter', pauseAnimation);
83
+ container.addEventListener('mouseleave', scheduleResumeAnimation);
94
84
 
95
85
  return () => {
96
- isStoppedRef.current = true;
97
- cancelAllAnimations();
98
- containers.forEach(container => {
99
- container.removeEventListener('mouseenter', handleMouseEnter);
100
- });
86
+ if (scrollAnimationRef.current) {
87
+ cancelAnimationFrame(scrollAnimationRef.current);
88
+ }
89
+ container.removeEventListener('mouseenter', pauseAnimation);
90
+ container.removeEventListener('mouseleave', scheduleResumeAnimation);
91
+ if (resumeTimeoutRef.current) {
92
+ clearTimeout(resumeTimeoutRef.current);
93
+ }
101
94
  };
102
- }, [animationSpeed, scrollContainerRefs, onStopAll]);
95
+ }, [isAnimated, PIXELS_PER_SECOND, scrollContainerRef]);
103
96
  }
@@ -0,0 +1,83 @@
1
+ import { useEffect, useRef } from 'react';
2
+
3
+ interface UseScrollSyncOptions {
4
+ scrollContainerRefs: React.RefObject<HTMLDivElement>[];
5
+ enabled: boolean;
6
+ }
7
+
8
+ export function useScrollSync({ scrollContainerRefs, enabled }: UseScrollSyncOptions): void {
9
+ const isSyncingRef = useRef(false);
10
+ const isDraggingRef = useRef(false);
11
+
12
+ useEffect(() => {
13
+ if (!enabled || scrollContainerRefs.length === 0) return undefined;
14
+
15
+ const containers = scrollContainerRefs
16
+ .map(ref => ref.current)
17
+ .filter((el): el is HTMLDivElement => el !== null);
18
+
19
+ if (containers.length === 0) return undefined;
20
+
21
+ const handleScroll = (sourceContainer: HTMLDivElement) => {
22
+ // Only sync when user is actively dragging, not during auto-scroll animation
23
+ if (!isDraggingRef.current) return;
24
+ if (isSyncingRef.current) return;
25
+
26
+ isSyncingRef.current = true;
27
+ const { scrollLeft } = sourceContainer;
28
+
29
+ containers.forEach(container => {
30
+ if (container !== sourceContainer) {
31
+ const element = container;
32
+ element.scrollLeft = scrollLeft;
33
+ }
34
+ });
35
+
36
+ requestAnimationFrame(() => {
37
+ isSyncingRef.current = false;
38
+ });
39
+ };
40
+
41
+ const handleMouseDown = () => {
42
+ isDraggingRef.current = true;
43
+ };
44
+
45
+ const handleMouseUp = () => {
46
+ isDraggingRef.current = false;
47
+ };
48
+
49
+ // Prevent all trackpad and mouse wheel scrolling
50
+ const handleWheel = (e: WheelEvent) => {
51
+ e.preventDefault();
52
+ };
53
+
54
+ const scrollListeners = containers.map(container => {
55
+ const listener = () => handleScroll(container);
56
+ container.addEventListener('scroll', listener);
57
+ return { container, listener };
58
+ });
59
+
60
+ // Track mouse events to detect when user is dragging
61
+ containers.forEach(container => {
62
+ container.addEventListener('mousedown', handleMouseDown);
63
+ container.addEventListener('mouseup', handleMouseUp);
64
+ // Disable trackpad and mouse wheel scrolling
65
+ container.addEventListener('wheel', handleWheel, { passive: false });
66
+ });
67
+
68
+ // Also listen for mouseup on document in case user releases outside container
69
+ document.addEventListener('mouseup', handleMouseUp);
70
+
71
+ return () => {
72
+ scrollListeners.forEach(({ container, listener }) => {
73
+ container.removeEventListener('scroll', listener);
74
+ });
75
+ containers.forEach(container => {
76
+ container.removeEventListener('mousedown', handleMouseDown);
77
+ container.removeEventListener('mouseup', handleMouseUp);
78
+ container.removeEventListener('wheel', handleWheel);
79
+ });
80
+ document.removeEventListener('mouseup', handleMouseUp);
81
+ };
82
+ }, [enabled, scrollContainerRefs]);
83
+ }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const getIconColor = (hasValue: boolean, disabled: boolean): string => {
5
5
  if (disabled || !hasValue) {
6
- return 'var(--envive-colors-border-medium)';
6
+ return 'var(--envive-colors-border-light)';
7
7
  }
8
8
  return 'var(--envive-colors-text-primary)';
9
9
  };
@@ -30,7 +30,9 @@ export const getSendIconElement = (
30
30
  <CustomIcon
31
31
  IconComponent={<SendModern />}
32
32
  fill={iconColor}
33
- stroke={iconColor}
33
+ stroke={
34
+ hasValue ? 'var(--envive-colors-background-light)' : 'var(--envive-colors-border-dark)'
35
+ }
34
36
  />
35
37
  );
36
38
  case Theme.MINIMAL:
@@ -1,4 +1,5 @@
1
1
  import { Theme } from '../../../tokens/theme/theme';
2
+ import { TypographyColor } from '../Typography/types';
2
3
  import { resolveTheme } from '../utils/resolveTheme';
3
4
  import { WidgetTextFieldComponents } from './components';
4
5
  import { IconVariant, type WidgetTextFieldProps } from './types/types';
@@ -10,6 +11,7 @@ export const WidgetTextField = ({
10
11
  className,
11
12
  theme = Theme.GLOBAL_CUSTOM,
12
13
  iconVariant = IconVariant.DEFAULT,
14
+ textColor = TypographyColor.TEXT_SECONDARY,
13
15
  placeholder,
14
16
  ariaLabel,
15
17
  disabled,
@@ -34,11 +36,17 @@ export const WidgetTextField = ({
34
36
  ariaLabel={ariaLabel}
35
37
  icon={
36
38
  <WidgetTextFieldComponents.Icon
39
+ textColor={textColor}
37
40
  variant={iconVariant}
38
41
  theme={resolvedTheme}
39
42
  />
40
43
  }
41
- text={<WidgetTextFieldComponents.FakeTextInput placeholder={placeholder} />}
44
+ text={
45
+ <WidgetTextFieldComponents.FakeTextInput
46
+ placeholder={placeholder}
47
+ textColor={textColor}
48
+ />
49
+ }
42
50
  />
43
51
  );
44
52
  };
@@ -3,13 +3,17 @@ import { TypographyColor, TypographyVariant } from '../../Typography/types';
3
3
 
4
4
  type FakeTextInputProps = {
5
5
  placeholder: string;
6
+ textColor: TypographyColor;
6
7
  };
7
8
 
8
- export const FakeTextInput = ({ placeholder }: FakeTextInputProps) => {
9
+ export const FakeTextInput = ({
10
+ placeholder,
11
+ textColor = TypographyColor.TEXT_SECONDARY,
12
+ }: FakeTextInputProps) => {
9
13
  return (
10
14
  <Typography
11
15
  variant={TypographyVariant.B3_RG}
12
- color={TypographyColor.TEXT_SECONDARY}
16
+ color={textColor}
13
17
  noWrap
14
18
  >
15
19
  {placeholder}