@envive-ai/react-toolkit-v3 0.3.27 → 0.3.28

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 (183) hide show
  1. package/dist/AnimatedText/AnimatedText.d.cts +3 -3
  2. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
  3. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
  4. package/dist/Carousel/Carousel.cjs +1 -1
  5. package/dist/Carousel/Carousel.d.cts +2 -2
  6. package/dist/Carousel/Carousel.d.ts +2 -2
  7. package/dist/Carousel/Carousel.js +1 -1
  8. package/dist/Carousel/components/Container.cjs +2 -2
  9. package/dist/Carousel/components/Container.js +2 -2
  10. package/dist/ChatFooter/ChatFooter.cjs +2 -1
  11. package/dist/ChatFooter/ChatFooter.d.cts +2 -2
  12. package/dist/ChatFooter/ChatFooter.d.ts +2 -2
  13. package/dist/ChatFooter/ChatFooter.js +2 -1
  14. package/dist/ChatFooter/components/Layout.cjs +2 -2
  15. package/dist/ChatFooter/components/Layout.js +2 -2
  16. package/dist/ChatFooter/components/index.d.cts +6 -5
  17. package/dist/ChatFooter/components/index.d.ts +4 -3
  18. package/dist/ChatFooter/types/types.d.cts +3 -2
  19. package/dist/ChatFooter/types/types.d.ts +3 -2
  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/ChatPreview/ChatPreview.cjs +1 -1
  27. package/dist/ChatPreview/ChatPreview.d.cts +2 -2
  28. package/dist/ChatPreview/ChatPreview.d.ts +2 -2
  29. package/dist/ChatPreview/ChatPreview.js +1 -1
  30. package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +1 -1
  31. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
  32. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
  33. package/dist/ChatPreviewComparison/ChatPreviewComparison.js +1 -1
  34. package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
  35. package/dist/ChatPreviewComparison/components/Headline.js +2 -2
  36. package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
  37. package/dist/ChatPreviewComparison/components/Layout.js +4 -4
  38. package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
  39. package/dist/ChatPreviewComparison/components/Message.js +2 -2
  40. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
  41. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
  42. package/dist/Container/Container.d.cts +219 -219
  43. package/dist/Container/Container.d.ts +57 -57
  44. package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
  45. package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
  46. package/dist/Disclaimer/components/Container.cjs +2 -2
  47. package/dist/Disclaimer/components/Container.js +2 -2
  48. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
  49. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
  50. package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
  51. package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
  52. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
  53. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
  54. package/dist/DocumentRetrievalCard/components/ViewArticleButton.cjs +1 -1
  55. package/dist/DocumentRetrievalCard/components/ViewArticleButton.js +1 -1
  56. package/dist/FloatingButton/FloatingButton.d.cts +2 -2
  57. package/dist/FloatingButton/FloatingButton.d.ts +2 -2
  58. package/dist/FloatingChat/FloatingChat.d.cts +2 -2
  59. package/dist/FloatingChat/FloatingChat.d.ts +2 -2
  60. package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
  61. package/dist/FloatingChat/components/ChatMessages.js +1 -1
  62. package/dist/FloatingChat/components/Layout.cjs +3 -3
  63. package/dist/FloatingChat/components/Layout.js +3 -3
  64. package/dist/FloatingChat/components/ResultsGridView.cjs +1 -1
  65. package/dist/FloatingChat/components/ResultsGridView.js +1 -1
  66. package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +1 -1
  67. package/dist/FloatingChat/components/SalesAgentBadgeContent.js +1 -1
  68. package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +43 -8
  69. package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
  70. package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
  71. package/dist/FullPageSalesAgent/FullPageSalesAgent.js +43 -8
  72. package/dist/FullPageSalesAgent/components/WelcomeOverlay.cjs +10 -3
  73. package/dist/FullPageSalesAgent/components/WelcomeOverlay.js +10 -3
  74. package/dist/FullPageSalesAgent/hooks/useWelcomeOverlayProducts.cjs +1 -0
  75. package/dist/FullPageSalesAgent/hooks/useWelcomeOverlayProducts.js +1 -0
  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 +2 -2
  85. package/dist/Message/components/LinkButton.js +2 -2
  86. package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
  87. package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
  88. package/dist/ProductCard/ProductCard.cjs +2 -2
  89. package/dist/ProductCard/ProductCard.d.cts +2 -2
  90. package/dist/ProductCard/ProductCard.d.ts +2 -2
  91. package/dist/ProductCard/ProductCard.js +2 -2
  92. package/dist/PromptButton/PromptButton.d.cts +2 -2
  93. package/dist/PromptButton/PromptButton.d.ts +2 -2
  94. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
  95. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
  96. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +1 -1
  97. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +1 -1
  98. package/dist/PromptCarousel/PromptCarousel.cjs +3 -3
  99. package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
  100. package/dist/PromptCarousel/PromptCarousel.js +3 -3
  101. package/dist/ReviewCard/ReviewCard.d.cts +2 -2
  102. package/dist/ReviewCard/ReviewCard.d.ts +2 -2
  103. package/dist/ReviewCard/components/Container.cjs +2 -2
  104. package/dist/ReviewCard/components/Container.js +2 -2
  105. package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
  106. package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
  107. package/dist/ReviewCard/components/index.d.cts +6 -6
  108. package/dist/ReviewCard/components/index.d.ts +6 -6
  109. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
  110. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
  111. package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
  112. package/dist/SalesAgentProductCard/components/Container.js +2 -2
  113. package/dist/SalesAgentProductCard/components/index.d.cts +6 -6
  114. package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
  115. package/dist/SocialProof/SocialProof.cjs +1 -1
  116. package/dist/SocialProof/SocialProof.d.cts +2 -2
  117. package/dist/SocialProof/SocialProof.d.ts +2 -2
  118. package/dist/SocialProof/SocialProof.js +1 -1
  119. package/dist/SocialProof/components/Headline.cjs +3 -3
  120. package/dist/SocialProof/components/Headline.js +3 -3
  121. package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
  122. package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
  123. package/dist/SocialProof/components/Subheadline.cjs +1 -1
  124. package/dist/SocialProof/components/Subheadline.js +1 -1
  125. package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
  126. package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
  127. package/dist/Stack/Stack.d.cts +2 -2
  128. package/dist/Stack/Stack.d.ts +2 -2
  129. package/dist/TextField/TextField.cjs +7 -3
  130. package/dist/TextField/TextField.d.cts +1 -0
  131. package/dist/TextField/TextField.d.ts +1 -0
  132. package/dist/TextField/TextField.js +7 -3
  133. package/dist/TextField/components/Input.cjs +31 -2
  134. package/dist/TextField/components/Input.js +31 -2
  135. package/dist/TextField/components/Layout.cjs +7 -2
  136. package/dist/TextField/components/Layout.js +7 -2
  137. package/dist/TextField/hooks/useAutoResize.cjs +17 -0
  138. package/dist/TextField/hooks/useAutoResize.js +16 -0
  139. package/dist/TextField/hooks/usePlaceholderAnimation.cjs +58 -0
  140. package/dist/TextField/hooks/usePlaceholderAnimation.js +57 -0
  141. package/dist/TextField/types/index.d.cts +7 -1
  142. package/dist/TextField/types/index.d.ts +7 -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 +4 -4
  160. package/dist/WidgetTextField/WidgetTextField.d.ts +2 -2
  161. package/dist/WidgetTextField/WidgetTextField.js +1 -1
  162. package/dist/WidgetTextField/components/Container.cjs +2 -2
  163. package/dist/WidgetTextField/components/Container.js +2 -2
  164. package/dist/WidgetTextField/components/Icon.cjs +1 -1
  165. package/dist/WidgetTextField/components/Icon.js +1 -1
  166. package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
  167. package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
  168. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
  169. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
  170. package/package.json +1 -1
  171. package/src/components/ChatFooter/ChatFooter.tsx +1 -0
  172. package/src/components/ChatFooter/components/TextField.tsx +4 -1
  173. package/src/components/ChatFooter/types/types.ts +3 -2
  174. package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +75 -7
  175. package/src/components/FullPageSalesAgent/components/WelcomeOverlay.tsx +22 -0
  176. package/src/components/FullPageSalesAgent/hooks/useWelcomeOverlayProducts.ts +1 -0
  177. package/src/components/TextField/TextField.tsx +7 -1
  178. package/src/components/TextField/components/Input.tsx +43 -9
  179. package/src/components/TextField/components/Layout.tsx +7 -1
  180. package/src/components/TextField/hooks/useAutoResize.ts +14 -0
  181. package/src/components/TextField/hooks/usePlaceholderAnimation.ts +67 -0
  182. package/src/components/TextField/hooks/useTextFieldSubmit.ts +1 -1
  183. package/src/components/TextField/types/index.ts +7 -1
@@ -1,12 +1,41 @@
1
1
  import { getInputClasses } from "../utils/getInputClasses.js";
2
2
  import { createInputChangeHandler } from "../utils/createInputChangeHandler.js";
3
+ import { useAutoResize } from "../hooks/useAutoResize.js";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  import classNames from "classnames";
5
6
 
6
7
  //#region src/components/TextField/components/Input.tsx
7
- const Input = ({ theme, placeholder, value, onChange, onKeyDown, onFocus, onBlur, disabled = false, id, testId, className, style, ariaLabel }) => {
8
+ const Input = ({ theme, placeholder, value, onChange, onKeyDown, onFocus, onBlur, disabled = false, multiline = false, id, testId, className, style, ariaLabel }) => {
8
9
  const { inputClasses } = getInputClasses(theme);
9
10
  const handleChange = createInputChangeHandler(disabled, onChange);
11
+ const textareaRef = useAutoResize(multiline ? value : void 0);
12
+ const sharedClasses = classNames(inputClasses, "focus-visible:envive-tw-shadow-none focus-visible:envive-tw-outline-none", className, disabled && "envive-tw-cursor-not-allowed");
13
+ if (multiline) return /* @__PURE__ */ jsx("textarea", {
14
+ ref: textareaRef,
15
+ id,
16
+ "data-testid": testId,
17
+ placeholder,
18
+ value,
19
+ rows: 1,
20
+ onChange: (e) => {
21
+ if (!disabled) onChange?.(e.target.value);
22
+ },
23
+ onKeyDown: (e) => {
24
+ if (e.key === "Enter" && !e.shiftKey) onKeyDown?.(e);
25
+ },
26
+ onFocus,
27
+ onBlur,
28
+ disabled,
29
+ className: sharedClasses,
30
+ style: {
31
+ resize: "none",
32
+ overflow: "hidden",
33
+ padding: 0,
34
+ ...style
35
+ },
36
+ "aria-label": ariaLabel,
37
+ "aria-disabled": disabled
38
+ });
10
39
  return /* @__PURE__ */ jsx("input", {
11
40
  type: "text",
12
41
  id,
@@ -18,7 +47,7 @@ const Input = ({ theme, placeholder, value, onChange, onKeyDown, onFocus, onBlur
18
47
  onFocus,
19
48
  onBlur,
20
49
  disabled,
21
- className: classNames(inputClasses, "focus-visible:envive-tw-shadow-none focus-visible:envive-tw-outline-none", className, disabled && "envive-tw-cursor-not-allowed"),
50
+ className: sharedClasses,
22
51
  style,
23
52
  "aria-label": ariaLabel,
24
53
  "aria-disabled": disabled
@@ -6,7 +6,7 @@ let classnames = require("classnames");
6
6
  classnames = require_rolldown_runtime.__toESM(classnames);
7
7
 
8
8
  //#region src/components/TextField/components/Layout.tsx
9
- const Layout = ({ theme, input, sendIcon, voiceInputButton, isFocused, hasValue, disabled = false, id, testId, className, style }) => {
9
+ const Layout = ({ theme, input, sendIcon, voiceInputButton, isFocused, hasValue, disabled = false, multiline = false, id, testId, className, style }) => {
10
10
  const { containerLayoutClasses, containerDefaultClasses, containerBorderClasses, containerBorderActiveClasses, containerFocusClasses, containerHoverClasses, containerDisabledClasses } = require_useGetContainerProperties.useGetContainerProperties({ theme });
11
11
  const { isActive, shouldShowFocus, shouldShowHover, containerClasses } = require_getLayoutStateProperties.getLayoutStateProperties(theme, hasValue, isFocused, disabled);
12
12
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -15,7 +15,12 @@ const Layout = ({ theme, input, sendIcon, voiceInputButton, isFocused, hasValue,
15
15
  id,
16
16
  "data-testid": testId,
17
17
  className: (0, classnames.default)("envive-tw-flex-1", containerLayoutClasses, containerDefaultClasses, isActive ? containerBorderActiveClasses : containerBorderClasses, shouldShowFocus && containerFocusClasses, shouldShowHover && containerHoverClasses, disabled && containerDisabledClasses, className),
18
- style,
18
+ style: multiline ? {
19
+ height: "auto",
20
+ minHeight: "40px",
21
+ alignItems: "flex-end",
22
+ ...style
23
+ } : style,
19
24
  children: [input, sendIcon]
20
25
  }), voiceInputButton]
21
26
  });
@@ -4,7 +4,7 @@ import { jsxs } from "react/jsx-runtime";
4
4
  import classNames from "classnames";
5
5
 
6
6
  //#region src/components/TextField/components/Layout.tsx
7
- const Layout = ({ theme, input, sendIcon, voiceInputButton, isFocused, hasValue, disabled = false, id, testId, className, style }) => {
7
+ const Layout = ({ theme, input, sendIcon, voiceInputButton, isFocused, hasValue, disabled = false, multiline = false, id, testId, className, style }) => {
8
8
  const { containerLayoutClasses, containerDefaultClasses, containerBorderClasses, containerBorderActiveClasses, containerFocusClasses, containerHoverClasses, containerDisabledClasses } = useGetContainerProperties({ theme });
9
9
  const { isActive, shouldShowFocus, shouldShowHover, containerClasses } = getLayoutStateProperties(theme, hasValue, isFocused, disabled);
10
10
  return /* @__PURE__ */ jsxs("div", {
@@ -13,7 +13,12 @@ const Layout = ({ theme, input, sendIcon, voiceInputButton, isFocused, hasValue,
13
13
  id,
14
14
  "data-testid": testId,
15
15
  className: classNames("envive-tw-flex-1", containerLayoutClasses, containerDefaultClasses, isActive ? containerBorderActiveClasses : containerBorderClasses, shouldShowFocus && containerFocusClasses, shouldShowHover && containerHoverClasses, disabled && containerDisabledClasses, className),
16
- style,
16
+ style: multiline ? {
17
+ height: "auto",
18
+ minHeight: "40px",
19
+ alignItems: "flex-end",
20
+ ...style
21
+ } : style,
17
22
  children: [input, sendIcon]
18
23
  }), voiceInputButton]
19
24
  });
@@ -0,0 +1,17 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let react = require("react");
3
+
4
+ //#region src/components/TextField/hooks/useAutoResize.ts
5
+ const useAutoResize = (value) => {
6
+ const ref = (0, react.useRef)(null);
7
+ (0, react.useEffect)(() => {
8
+ const el = ref.current;
9
+ if (!el) return;
10
+ el.style.height = "auto";
11
+ el.style.height = `${el.scrollHeight}px`;
12
+ }, [value]);
13
+ return ref;
14
+ };
15
+
16
+ //#endregion
17
+ exports.useAutoResize = useAutoResize;
@@ -0,0 +1,16 @@
1
+ import { useEffect, useRef } from "react";
2
+
3
+ //#region src/components/TextField/hooks/useAutoResize.ts
4
+ const useAutoResize = (value) => {
5
+ const ref = useRef(null);
6
+ useEffect(() => {
7
+ const el = ref.current;
8
+ if (!el) return;
9
+ el.style.height = "auto";
10
+ el.style.height = `${el.scrollHeight}px`;
11
+ }, [value]);
12
+ return ref;
13
+ };
14
+
15
+ //#endregion
16
+ export { useAutoResize };
@@ -0,0 +1,58 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let react = require("react");
3
+
4
+ //#region src/components/TextField/hooks/usePlaceholderAnimation.ts
5
+ const DEFAULT_TYPING_DURATION = 400;
6
+ const DEFAULT_TRANSITION = 3e3;
7
+ const CLEAR_PAUSE = 200;
8
+ const usePlaceholderAnimation = (placeholder, typingDuration = DEFAULT_TYPING_DURATION, transition = DEFAULT_TRANSITION) => {
9
+ const [current, setCurrent] = (0, react.useState)(() => Array.isArray(placeholder) ? "" : placeholder);
10
+ const timeoutsRef = (0, react.useRef)([]);
11
+ const isMountedRef = (0, react.useRef)(true);
12
+ (0, react.useEffect)(() => {
13
+ if (!Array.isArray(placeholder)) {
14
+ setCurrent(placeholder);
15
+ return () => {};
16
+ }
17
+ if (placeholder.length === 0) {
18
+ setCurrent("");
19
+ return () => {};
20
+ }
21
+ isMountedRef.current = true;
22
+ timeoutsRef.current = [];
23
+ const delay = (ms) => new Promise((resolve) => {
24
+ const id = setTimeout(resolve, ms);
25
+ timeoutsRef.current.push(id);
26
+ });
27
+ const animateChars = async (text) => {
28
+ const charDelay = text.length > 1 ? typingDuration / (text.length - 1) : 0;
29
+ for (let i = 0; i < text.length; i += 1) {
30
+ await delay(charDelay);
31
+ if (isMountedRef.current) setCurrent(text.substring(0, i + 1));
32
+ }
33
+ };
34
+ const run = async () => {
35
+ while (isMountedRef.current) for (const element of placeholder) {
36
+ if (!isMountedRef.current) return;
37
+ await animateChars(element);
38
+ await delay(transition);
39
+ if (isMountedRef.current) setCurrent("");
40
+ await delay(CLEAR_PAUSE);
41
+ }
42
+ };
43
+ run();
44
+ return () => {
45
+ isMountedRef.current = false;
46
+ timeoutsRef.current.forEach(clearTimeout);
47
+ timeoutsRef.current = [];
48
+ };
49
+ }, [
50
+ placeholder,
51
+ typingDuration,
52
+ transition
53
+ ]);
54
+ return current;
55
+ };
56
+
57
+ //#endregion
58
+ exports.usePlaceholderAnimation = usePlaceholderAnimation;
@@ -0,0 +1,57 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+
3
+ //#region src/components/TextField/hooks/usePlaceholderAnimation.ts
4
+ const DEFAULT_TYPING_DURATION = 400;
5
+ const DEFAULT_TRANSITION = 3e3;
6
+ const CLEAR_PAUSE = 200;
7
+ const usePlaceholderAnimation = (placeholder, typingDuration = DEFAULT_TYPING_DURATION, transition = DEFAULT_TRANSITION) => {
8
+ const [current, setCurrent] = useState(() => Array.isArray(placeholder) ? "" : placeholder);
9
+ const timeoutsRef = useRef([]);
10
+ const isMountedRef = useRef(true);
11
+ useEffect(() => {
12
+ if (!Array.isArray(placeholder)) {
13
+ setCurrent(placeholder);
14
+ return () => {};
15
+ }
16
+ if (placeholder.length === 0) {
17
+ setCurrent("");
18
+ return () => {};
19
+ }
20
+ isMountedRef.current = true;
21
+ timeoutsRef.current = [];
22
+ const delay = (ms) => new Promise((resolve) => {
23
+ const id = setTimeout(resolve, ms);
24
+ timeoutsRef.current.push(id);
25
+ });
26
+ const animateChars = async (text) => {
27
+ const charDelay = text.length > 1 ? typingDuration / (text.length - 1) : 0;
28
+ for (let i = 0; i < text.length; i += 1) {
29
+ await delay(charDelay);
30
+ if (isMountedRef.current) setCurrent(text.substring(0, i + 1));
31
+ }
32
+ };
33
+ const run = async () => {
34
+ while (isMountedRef.current) for (const element of placeholder) {
35
+ if (!isMountedRef.current) return;
36
+ await animateChars(element);
37
+ await delay(transition);
38
+ if (isMountedRef.current) setCurrent("");
39
+ await delay(CLEAR_PAUSE);
40
+ }
41
+ };
42
+ run();
43
+ return () => {
44
+ isMountedRef.current = false;
45
+ timeoutsRef.current.forEach(clearTimeout);
46
+ timeoutsRef.current = [];
47
+ };
48
+ }, [
49
+ placeholder,
50
+ typingDuration,
51
+ transition
52
+ ]);
53
+ return current;
54
+ };
55
+
56
+ //#endregion
57
+ export { usePlaceholderAnimation };
@@ -9,8 +9,9 @@ type TextFieldProps = {
9
9
  theme?: Theme;
10
10
  /**
11
11
  * Placeholder text displayed when the input is empty.
12
+ * Pass an array of strings to cycle through them with a typing animation.
12
13
  */
13
- placeholder: string;
14
+ placeholder: string | string[];
14
15
  /**
15
16
  * Controlled value of the input. If not provided, the component manages its own state.
16
17
  */
@@ -48,6 +49,11 @@ type TextFieldProps = {
48
49
  * @default false
49
50
  */
50
51
  isLoading?: boolean;
52
+ /**
53
+ * When true the input expands to multiple lines instead of scrolling horizontally.
54
+ * @default false
55
+ */
56
+ multiline?: boolean;
51
57
  /**
52
58
  * Enable voice input button
53
59
  * @default false
@@ -9,8 +9,9 @@ type TextFieldProps = {
9
9
  theme?: Theme;
10
10
  /**
11
11
  * Placeholder text displayed when the input is empty.
12
+ * Pass an array of strings to cycle through them with a typing animation.
12
13
  */
13
- placeholder: string;
14
+ placeholder: string | string[];
14
15
  /**
15
16
  * Controlled value of the input. If not provided, the component manages its own state.
16
17
  */
@@ -48,6 +49,11 @@ type TextFieldProps = {
48
49
  * @default false
49
50
  */
50
51
  isLoading?: boolean;
52
+ /**
53
+ * When true the input expands to multiple lines instead of scrolling horizontally.
54
+ * @default false
55
+ */
56
+ multiline?: boolean;
51
57
  /**
52
58
  * Enable voice input button
53
59
  * @default false
@@ -1,11 +1,11 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_theme = require('../packages/components-v3/tokens/theme/theme.cjs');
3
+ require('../Tokens/index.cjs');
3
4
  const require_Stack = require('../Stack/Stack.cjs');
4
5
  require('../Stack/index.cjs');
5
6
  const require_index = require('../Typography/types/index.cjs');
6
7
  const require_Typography = require('../Typography/Typography.cjs');
7
8
  require('../Typography/index.cjs');
8
- require('../Tokens/index.cjs');
9
9
  const require_PromptButton_types_index = require('../PromptButton/types/index.cjs');
10
10
  require('../PromptButton/index.cjs');
11
11
  const require_PromptCarousel_types_types = require('../PromptCarousel/types/types.cjs');
@@ -1,5 +1,5 @@
1
1
  import { TitledPromptCarouselProps } from "./types/index.cjs";
2
- import * as react_jsx_runtime18 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/TitledPromptCarousel/TitledPromptCarousel.d.ts
5
5
  declare const TitledPromptCarousel: ({
@@ -21,6 +21,6 @@ declare const TitledPromptCarousel: ({
21
21
  handleButtonTouchEnd,
22
22
  promptButtonTexts,
23
23
  promptCarouselAriaLabel
24
- }: TitledPromptCarouselProps) => react_jsx_runtime18.JSX.Element;
24
+ }: TitledPromptCarouselProps) => react_jsx_runtime13.JSX.Element;
25
25
  //#endregion
26
26
  export { TitledPromptCarousel };
@@ -1,5 +1,5 @@
1
1
  import { TitledPromptCarouselProps } from "./types/index.js";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/TitledPromptCarousel/TitledPromptCarousel.d.ts
5
5
  declare const TitledPromptCarousel: ({
@@ -21,6 +21,6 @@ declare const TitledPromptCarousel: ({
21
21
  handleButtonTouchEnd,
22
22
  promptButtonTexts,
23
23
  promptCarouselAriaLabel
24
- }: TitledPromptCarouselProps) => react_jsx_runtime0.JSX.Element;
24
+ }: TitledPromptCarouselProps) => react_jsx_runtime17.JSX.Element;
25
25
  //#endregion
26
26
  export { TitledPromptCarousel };
@@ -1,10 +1,10 @@
1
1
  import { Theme } from "../packages/components-v3/tokens/theme/theme.js";
2
+ import "../Tokens/index.js";
2
3
  import { Stack } from "../Stack/Stack.js";
3
4
  import "../Stack/index.js";
4
5
  import { TypographyVariant } from "../Typography/types/index.js";
5
6
  import { Typography } from "../Typography/Typography.js";
6
7
  import "../Typography/index.js";
7
- import "../Tokens/index.js";
8
8
  import { PromptButtonVariant } from "../PromptButton/types/index.js";
9
9
  import "../PromptButton/index.js";
10
10
  import { AnimationSpeed, PromptCarouselRows } from "../PromptCarousel/types/types.js";
@@ -7,8 +7,8 @@ const require_fontFamily = require('../packages/components-v3/tokens/typography/
7
7
  const require_radius = require('../packages/components-v3/tokens/radius/radius.cjs');
8
8
  const require_aspectRatio = require('../packages/components-v3/tokens/aspectRatio/aspectRatio.cjs');
9
9
  const require_theme = require('../packages/components-v3/tokens/theme/theme.cjs');
10
- const require_breakpoints = require('../packages/components-v3/tokens/breakpoints/breakpoints.cjs');
11
10
  const require_typography = require('../packages/components-v3/tokens/typography/typography.cjs');
11
+ const require_breakpoints = require('../packages/components-v3/tokens/breakpoints/breakpoints.cjs');
12
12
  const require_spacing = require('../packages/components-v3/tokens/spacing/spacing.cjs');
13
13
  const require_motion = require('../packages/components-v3/tokens/montion/motion.cjs');
14
14
 
@@ -7,8 +7,8 @@ import { FontFamily, fontFamilyVariables } from "../packages/components-v3/token
7
7
  import { borderRadiusVariables } from "../packages/components-v3/tokens/radius/radius.js";
8
8
  import { aspectRatioVariables } from "../packages/components-v3/tokens/aspectRatio/aspectRatio.js";
9
9
  import { Theme } from "../packages/components-v3/tokens/theme/theme.js";
10
- import { screensBreakpointsVariables, tailwindScreens } from "../packages/components-v3/tokens/breakpoints/breakpoints.js";
11
10
  import { createTypographyComponents } from "../packages/components-v3/tokens/typography/typography.js";
11
+ import { screensBreakpointsVariables, tailwindScreens } from "../packages/components-v3/tokens/breakpoints/breakpoints.js";
12
12
  import { spacingVariables } from "../packages/components-v3/tokens/spacing/spacing.js";
13
13
  import { animationsVariables, keyFramesVariables } from "../packages/components-v3/tokens/montion/motion.js";
14
14
 
@@ -2,12 +2,12 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_AnimatedText = require('../AnimatedText/AnimatedText.cjs');
3
3
  require('../AnimatedText/index.cjs');
4
4
  const require_theme = require('../packages/components-v3/tokens/theme/theme.cjs');
5
+ require('../Tokens/index.cjs');
5
6
  const require_Stack = require('../Stack/Stack.cjs');
6
7
  require('../Stack/index.cjs');
7
8
  const require_index = require('../Typography/types/index.cjs');
8
9
  const require_Typography = require('../Typography/Typography.cjs');
9
10
  require('../Typography/index.cjs');
10
- require('../Tokens/index.cjs');
11
11
  const require_PromptButton_types_index = require('../PromptButton/types/index.cjs');
12
12
  const require_PromptCarousel_types_types = require('../PromptCarousel/types/types.cjs');
13
13
  const require_PromptCarousel = require('../PromptCarousel/PromptCarousel.cjs');
@@ -1,5 +1,5 @@
1
1
  import { TypingAnimationProps } from "./types/index.cjs";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/TypingAnimation/TypingAnimation.d.ts
5
5
  declare const TypingAnimation: ({
@@ -7,6 +7,6 @@ declare const TypingAnimation: ({
7
7
  widgetContentProps,
8
8
  widgetStyleProps,
9
9
  widgetEventProps
10
- }: TypingAnimationProps) => react_jsx_runtime14.JSX.Element;
10
+ }: TypingAnimationProps) => react_jsx_runtime15.JSX.Element;
11
11
  //#endregion
12
12
  export { TypingAnimation };
@@ -1,5 +1,5 @@
1
1
  import { TypingAnimationProps } from "./types/index.js";
2
- import * as react_jsx_runtime5 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/TypingAnimation/TypingAnimation.d.ts
5
5
  declare const TypingAnimation: ({
@@ -7,6 +7,6 @@ declare const TypingAnimation: ({
7
7
  widgetContentProps,
8
8
  widgetStyleProps,
9
9
  widgetEventProps
10
- }: TypingAnimationProps) => react_jsx_runtime5.JSX.Element;
10
+ }: TypingAnimationProps) => react_jsx_runtime15.JSX.Element;
11
11
  //#endregion
12
12
  export { TypingAnimation };
@@ -1,12 +1,12 @@
1
1
  import { AnimatedText } from "../AnimatedText/AnimatedText.js";
2
2
  import "../AnimatedText/index.js";
3
3
  import { Theme } from "../packages/components-v3/tokens/theme/theme.js";
4
+ import "../Tokens/index.js";
4
5
  import { Stack } from "../Stack/Stack.js";
5
6
  import "../Stack/index.js";
6
7
  import { TypographyColor } from "../Typography/types/index.js";
7
8
  import { Typography } from "../Typography/Typography.js";
8
9
  import "../Typography/index.js";
9
- import "../Tokens/index.js";
10
10
  import { PromptButtonVariant } from "../PromptButton/types/index.js";
11
11
  import { PromptCarouselRows } from "../PromptCarousel/types/types.js";
12
12
  import { PromptCarousel } from "../PromptCarousel/PromptCarousel.js";
@@ -1,7 +1,7 @@
1
1
  const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
2
+ require('../../Tokens/index.cjs');
2
3
  const require_index = require('../../Typography/types/index.cjs');
3
4
  require('../../Typography/index.cjs');
4
- require('../../Tokens/index.cjs');
5
5
 
6
6
  //#region src/components/TypingAnimation/hooks/useGetTypographyVariant.tsx
7
7
  const useGetTypographyVariant = (theme) => {
@@ -1,7 +1,7 @@
1
1
  import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
2
+ import "../../Tokens/index.js";
2
3
  import { TypographyVariant } from "../../Typography/types/index.js";
3
4
  import "../../Typography/index.js";
4
- import "../../Tokens/index.js";
5
5
 
6
6
  //#region src/components/TypingAnimation/hooks/useGetTypographyVariant.tsx
7
7
  const useGetTypographyVariant = (theme) => {
@@ -1,5 +1,5 @@
1
1
  import { TypographyProps } from "./types/index.cjs";
2
- import * as react9 from "react";
2
+ import * as react4 from "react";
3
3
 
4
4
  //#region src/components/Typography/Typography.d.ts
5
5
  /**
@@ -18,13 +18,13 @@ declare const Typography: ({
18
18
  noWrap,
19
19
  as,
20
20
  "aria-label": ariaLabel
21
- }: TypographyProps) => react9.DetailedReactHTMLElement<{
21
+ }: TypographyProps) => react4.DetailedReactHTMLElement<{
22
22
  'aria-label': string;
23
23
  'aria-level'?: number;
24
- role?: react9.AriaRole;
24
+ role?: react4.AriaRole;
25
25
  title?: string;
26
26
  className: string;
27
- style: react9.CSSProperties;
27
+ style: react4.CSSProperties;
28
28
  id: string;
29
29
  'data-testid': string;
30
30
  }, HTMLElement>;
@@ -1,5 +1,5 @@
1
1
  import { TypographyProps } from "./types/index.js";
2
- import * as react0 from "react";
2
+ import * as react7 from "react";
3
3
 
4
4
  //#region src/components/Typography/Typography.d.ts
5
5
  /**
@@ -18,13 +18,13 @@ declare const Typography: ({
18
18
  noWrap,
19
19
  as,
20
20
  "aria-label": ariaLabel
21
- }: TypographyProps) => react0.DetailedReactHTMLElement<{
21
+ }: TypographyProps) => react7.DetailedReactHTMLElement<{
22
22
  'aria-label': string;
23
23
  'aria-level'?: number;
24
- role?: react0.AriaRole;
24
+ role?: react7.AriaRole;
25
25
  title?: string;
26
26
  className: string;
27
- style: react0.CSSProperties;
27
+ style: react7.CSSProperties;
28
28
  id: string;
29
29
  'data-testid': string;
30
30
  }, HTMLElement>;
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_Stack = require('../../Stack/Stack.cjs');
3
- require('../../Stack/index.cjs');
4
2
  const require_Container = require('../../Container/Container.cjs');
5
3
  require('../../Container/index.cjs');
4
+ const require_Stack = require('../../Stack/Stack.cjs');
5
+ require('../../Stack/index.cjs');
6
6
  const require_useGetContainerProperties = require('../hooks/useGetContainerProperties.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let classnames = require("classnames");
@@ -1,7 +1,7 @@
1
- import { Stack } from "../../Stack/Stack.js";
2
- import "../../Stack/index.js";
3
1
  import { Container } from "../../Container/Container.js";
4
2
  import "../../Container/index.js";
3
+ import { Stack } from "../../Stack/Stack.js";
4
+ import "../../Stack/index.js";
5
5
  import { useGetContainerProperties } from "../hooks/useGetContainerProperties.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import classNames from "classnames";
@@ -1,11 +1,11 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_theme = require('../packages/components-v3/tokens/theme/theme.cjs');
3
- const require_index = require('../Typography/types/index.cjs');
4
3
  const require_resolveTheme = require('../utils/resolveTheme.cjs');
5
- const require_index$1 = require('../TextField/components/index.cjs');
4
+ const require_index = require('../TextField/components/index.cjs');
6
5
  const require_useGetSkeletonProperties = require('../TextField/hooks/useGetSkeletonProperties.cjs');
7
6
  const require_react = require('../node_modules/jotai/esm/react.cjs');
8
7
  const require_useVoiceInput = require('../TextField/hooks/useVoiceInput.cjs');
8
+ const require_index$1 = require('../Typography/types/index.cjs');
9
9
  const require_types = require('./types/types.cjs');
10
10
  const require_index$2 = require('./components/index.cjs');
11
11
  const require_useGetMicWidgetButtonProperties = require('./hooks/useGetMicWidgetButtonProperties.cjs');
@@ -15,7 +15,7 @@ classnames = require_rolldown_runtime.__toESM(classnames);
15
15
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
16
16
 
17
17
  //#region src/components/WidgetTextField/WidgetTextField.tsx
18
- const WidgetTextField = ({ id, testId, style, className, voiceInputClassName, theme = require_theme.Theme.GLOBAL_CUSTOM, minimalFrame = "full", iconVariant = require_types.IconVariant.DEFAULT, textColor = require_index.TypographyColor.TEXT_SECONDARY, placeholder, ariaLabel, disabled, isLoading, onClick, enableVoiceInput = false, onTranscriptionStarted }) => {
18
+ const WidgetTextField = ({ id, testId, style, className, voiceInputClassName, theme = require_theme.Theme.GLOBAL_CUSTOM, minimalFrame = "full", iconVariant = require_types.IconVariant.DEFAULT, textColor = require_index$1.TypographyColor.TEXT_SECONDARY, placeholder, ariaLabel, disabled, isLoading, onClick, enableVoiceInput = false, onTranscriptionStarted }) => {
19
19
  const resolvedTheme = require_resolveTheme.resolveTheme(theme);
20
20
  const setListeningToSpeech = require_react.useSetAtom(__envive_ai_react_hooks_atoms_chat.listeningToSpeechAtom);
21
21
  const { skeletonClass } = require_useGetSkeletonProperties.useGetSkeletonProperties(isLoading);
@@ -31,7 +31,7 @@ const WidgetTextField = ({ id, testId, style, className, voiceInputClassName, th
31
31
  onTranscriptionStarted?.();
32
32
  onClick();
33
33
  };
34
- const voiceInputButton = enableVoiceInput && browserSupportsSpeechRecognition ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.TextFieldComponents.VoiceInputButton, {
34
+ const voiceInputButton = enableVoiceInput && browserSupportsSpeechRecognition ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.TextFieldComponents.VoiceInputButton, {
35
35
  theme: resolvedTheme,
36
36
  isListening: false,
37
37
  onToggleListening: disabled ? void 0 : handleToggleListening,
@@ -1,5 +1,5 @@
1
1
  import { WidgetTextFieldProps } from "./types/types.js";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/WidgetTextField/WidgetTextField.d.ts
5
5
  declare const WidgetTextField: ({
@@ -19,6 +19,6 @@ declare const WidgetTextField: ({
19
19
  onClick,
20
20
  enableVoiceInput,
21
21
  onTranscriptionStarted
22
- }: WidgetTextFieldProps) => react_jsx_runtime0.JSX.Element;
22
+ }: WidgetTextFieldProps) => react_jsx_runtime18.JSX.Element;
23
23
  //#endregion
24
24
  export { WidgetTextField };
@@ -1,10 +1,10 @@
1
1
  import { Theme } from "../packages/components-v3/tokens/theme/theme.js";
2
- import { TypographyColor } from "../Typography/types/index.js";
3
2
  import { resolveTheme } from "../utils/resolveTheme.js";
4
3
  import { TextFieldComponents } from "../TextField/components/index.js";
5
4
  import { useGetSkeletonProperties } from "../TextField/hooks/useGetSkeletonProperties.js";
6
5
  import { useSetAtom } from "../node_modules/jotai/esm/react.js";
7
6
  import { useVoiceInput } from "../TextField/hooks/useVoiceInput.js";
7
+ import { TypographyColor } from "../Typography/types/index.js";
8
8
  import { IconVariant } from "./types/types.js";
9
9
  import { WidgetTextFieldComponents } from "./components/index.js";
10
10
  import { useGetMicWidgetButtonProperties } from "./hooks/useGetMicWidgetButtonProperties.js";
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_Stack = require('../../Stack/Stack.cjs');
3
- require('../../Stack/index.cjs');
4
2
  const require_Container = require('../../Container/Container.cjs');
5
3
  require('../../Container/index.cjs');
4
+ const require_Stack = require('../../Stack/Stack.cjs');
5
+ require('../../Stack/index.cjs');
6
6
  const require_useGetContainerProperties = require('../hooks/useGetContainerProperties.cjs');
7
7
  const require_useHandleKeyboard = require('../hooks/useHandleKeyboard.cjs');
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1,7 +1,7 @@
1
- import { Stack } from "../../Stack/Stack.js";
2
- import "../../Stack/index.js";
3
1
  import { Container } from "../../Container/Container.js";
4
2
  import "../../Container/index.js";
3
+ import { Stack } from "../../Stack/Stack.js";
4
+ import "../../Stack/index.js";
5
5
  import { useGetContainerProperties } from "../hooks/useGetContainerProperties.js";
6
6
  import { useHandleKeyboard } from "../hooks/useHandleKeyboard.js";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
3
- const require_index = require('../../Typography/types/index.cjs');
4
3
  const require_CustomIcon = require('../../utils/CustomIcon.cjs');
4
+ const require_index = require('../../Typography/types/index.cjs');
5
5
  const require_types = require('../types/types.cjs');
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  let __envive_ai_react_icons_SendStandard = require("@envive-ai/react-icons/SendStandard");
@@ -1,6 +1,6 @@
1
1
  import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
2
- import { TypographyColor } from "../../Typography/types/index.js";
3
2
  import { CustomIcon } from "../../utils/CustomIcon.js";
3
+ import { TypographyColor } from "../../Typography/types/index.js";
4
4
  import { IconVariant } from "../types/types.js";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import SendStandard from "@envive-ai/react-icons/SendStandard";