@algolia/satellite 2.2.3 → 2.3.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/cjs/Actions/Accordion/Accordion.d.ts +8 -0
  2. package/dist/cjs/Actions/Accordion/Accordion.js +5 -3
  3. package/dist/cjs/Fields/TextArea/TextArea.d.ts +5 -1
  4. package/dist/cjs/Fields/TextArea/TextArea.js +3 -2
  5. package/dist/cjs/Fields/TextArea/TextArea.tailwind.js +1 -1
  6. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  7. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.js +82 -0
  8. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  9. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +16 -0
  10. package/dist/cjs/Fields/TextAreaAutoSize/index.d.ts +2 -0
  11. package/dist/cjs/Fields/TextAreaAutoSize/index.js +12 -0
  12. package/dist/cjs/Fields/index.d.ts +2 -1
  13. package/dist/cjs/Fields/index.js +15 -4
  14. package/dist/cjs/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  15. package/dist/cjs/Helpers/ShimmerText/ShimmerText.js +28 -0
  16. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  17. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.js +37 -0
  18. package/dist/cjs/Helpers/ShimmerText/index.d.ts +2 -0
  19. package/dist/cjs/Helpers/ShimmerText/index.js +12 -0
  20. package/dist/cjs/Helpers/index.d.ts +1 -0
  21. package/dist/cjs/Helpers/index.js +11 -0
  22. package/dist/cjs/Helpers/utilities/utilities.tailwind.js +6 -1
  23. package/dist/cjs/Indicators/Skeleton/Skeleton.d.ts +2 -2
  24. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  25. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +44 -0
  26. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  27. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +23 -0
  28. package/dist/cjs/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  29. package/dist/cjs/Layout/Chat/ChatContextAccordion/index.js +16 -0
  30. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  31. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.js +83 -0
  32. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  33. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.js +77 -0
  34. package/dist/cjs/Layout/Chat/ChatMessage/index.d.ts +1 -0
  35. package/dist/cjs/Layout/Chat/ChatMessage/index.js +16 -0
  36. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  37. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.js +68 -0
  38. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  39. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +18 -0
  40. package/dist/cjs/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  41. package/dist/cjs/Layout/Chat/ChatMessageError/index.js +16 -0
  42. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  43. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +63 -0
  44. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  45. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +21 -0
  46. package/dist/cjs/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  47. package/dist/cjs/Layout/Chat/ChatMessageLoader/index.js +16 -0
  48. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.d.ts +44 -0
  49. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.js +152 -0
  50. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  51. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.styles.js +29 -0
  52. package/dist/cjs/Layout/Chat/ChatMessages/index.d.ts +1 -0
  53. package/dist/cjs/Layout/Chat/ChatMessages/index.js +16 -0
  54. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +8 -0
  55. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.js +48 -0
  56. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +91 -0
  57. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.js +142 -0
  58. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  59. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +22 -0
  60. package/dist/cjs/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  61. package/dist/cjs/Layout/Chat/ChatPrompt/index.js +16 -0
  62. package/dist/cjs/Layout/Chat/ChatPrompt/useFocusTyping.d.ts +12 -0
  63. package/dist/cjs/Layout/Chat/ChatPrompt/useFocusTyping.js +60 -0
  64. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  65. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.js +78 -0
  66. package/dist/cjs/Layout/Chat/index.d.ts +15 -0
  67. package/dist/cjs/Layout/Chat/index.js +47 -0
  68. package/dist/cjs/Layout/Chat/types.d.ts +7 -0
  69. package/dist/cjs/Layout/Chat/types.js +5 -0
  70. package/dist/cjs/Layout/index.d.ts +1 -0
  71. package/dist/cjs/Layout/index.js +11 -0
  72. package/dist/cjs/Satellite/locale.d.ts +7 -1
  73. package/dist/cjs/styles/helpers/tv.d.ts +1 -0
  74. package/dist/cjs/styles/helpers/tv.js +13 -0
  75. package/dist/cjs/styles/tailwind.config.js +1 -1
  76. package/dist/cjs/utils/getTextFromReactNode.d.ts +2 -1
  77. package/dist/cjs/utils/getTextFromReactNode.js +12 -7
  78. package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
  79. package/dist/esm/Actions/Accordion/Accordion.d.ts +8 -0
  80. package/dist/esm/Actions/Accordion/Accordion.js +5 -3
  81. package/dist/esm/Fields/TextArea/TextArea.d.ts +5 -1
  82. package/dist/esm/Fields/TextArea/TextArea.js +3 -2
  83. package/dist/esm/Fields/TextArea/TextArea.tailwind.js +1 -1
  84. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  85. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.js +75 -0
  86. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  87. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +9 -0
  88. package/dist/esm/Fields/TextAreaAutoSize/index.d.ts +2 -0
  89. package/dist/esm/Fields/TextAreaAutoSize/index.js +1 -0
  90. package/dist/esm/Fields/index.d.ts +2 -1
  91. package/dist/esm/Fields/index.js +2 -1
  92. package/dist/esm/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  93. package/dist/esm/Helpers/ShimmerText/ShimmerText.js +21 -0
  94. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  95. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.js +36 -0
  96. package/dist/esm/Helpers/ShimmerText/index.d.ts +2 -0
  97. package/dist/esm/Helpers/ShimmerText/index.js +1 -0
  98. package/dist/esm/Helpers/index.d.ts +1 -0
  99. package/dist/esm/Helpers/index.js +2 -1
  100. package/dist/esm/Helpers/utilities/utilities.tailwind.js +6 -1
  101. package/dist/esm/Indicators/Skeleton/Skeleton.d.ts +2 -2
  102. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  103. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +37 -0
  104. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  105. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +16 -0
  106. package/dist/esm/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  107. package/dist/esm/Layout/Chat/ChatContextAccordion/index.js +1 -0
  108. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  109. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.js +77 -0
  110. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  111. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.js +70 -0
  112. package/dist/esm/Layout/Chat/ChatMessage/index.d.ts +1 -0
  113. package/dist/esm/Layout/Chat/ChatMessage/index.js +1 -0
  114. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  115. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.js +61 -0
  116. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  117. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +11 -0
  118. package/dist/esm/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  119. package/dist/esm/Layout/Chat/ChatMessageError/index.js +1 -0
  120. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  121. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +56 -0
  122. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  123. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +14 -0
  124. package/dist/esm/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  125. package/dist/esm/Layout/Chat/ChatMessageLoader/index.js +1 -0
  126. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.d.ts +44 -0
  127. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.js +145 -0
  128. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  129. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.js +22 -0
  130. package/dist/esm/Layout/Chat/ChatMessages/index.d.ts +1 -0
  131. package/dist/esm/Layout/Chat/ChatMessages/index.js +1 -0
  132. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +8 -0
  133. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.js +42 -0
  134. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +91 -0
  135. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.js +137 -0
  136. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  137. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +15 -0
  138. package/dist/esm/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  139. package/dist/esm/Layout/Chat/ChatPrompt/index.js +1 -0
  140. package/dist/esm/Layout/Chat/ChatPrompt/useFocusTyping.d.ts +12 -0
  141. package/dist/esm/Layout/Chat/ChatPrompt/useFocusTyping.js +54 -0
  142. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  143. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.js +71 -0
  144. package/dist/esm/Layout/Chat/index.d.ts +15 -0
  145. package/dist/esm/Layout/Chat/index.js +6 -0
  146. package/dist/esm/Layout/Chat/types.d.ts +7 -0
  147. package/dist/esm/Layout/Chat/types.js +1 -0
  148. package/dist/esm/Layout/index.d.ts +1 -0
  149. package/dist/esm/Layout/index.js +1 -0
  150. package/dist/esm/Satellite/locale.d.ts +7 -1
  151. package/dist/esm/styles/helpers/tv.d.ts +1 -0
  152. package/dist/esm/styles/helpers/tv.js +7 -0
  153. package/dist/esm/styles/tailwind.config.js +1 -1
  154. package/dist/esm/utils/getTextFromReactNode.d.ts +2 -1
  155. package/dist/esm/utils/getTextFromReactNode.js +13 -8
  156. package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
  157. package/dist/satellite.min.css +1 -1
  158. package/package.json +12 -3
@@ -0,0 +1,91 @@
1
+ import type { FormEvent, KeyboardEvent, ReactNode } from "react";
2
+ import type { TextAreaAutoSizeProps } from "../../../Fields/TextAreaAutoSize/TextAreaAutoSize";
3
+ import type { ChatStatus } from "../../../Layout/Chat/types";
4
+ export declare type ChatPromptLocale = {
5
+ textareaLabel?: string;
6
+ emptyMessageTooltip?: string;
7
+ stopResponseTooltip?: string;
8
+ sendMessageTooltip?: string;
9
+ };
10
+ export declare type ChatPromptProps = Omit<TextAreaAutoSizeProps, "onSubmit"> & {
11
+ /**
12
+ * Content to render above the textarea (e.g., a title or instructions).
13
+ */
14
+ renderHeader?: ReactNode;
15
+ /**
16
+ * Content to render below the textarea (e.g., additional controls or hints).
17
+ */
18
+ renderFooter?: ReactNode;
19
+ /**
20
+ * An optional array of placeholder strings to cycle through with a typewriter effect.
21
+ * If provided and non-empty, the component will use the dynamic, animated placeholder
22
+ * text instead of any static `placeholder` prop passed in.
23
+ */
24
+ placeholders?: string[];
25
+ /**
26
+ * The current status of the chat prompt submit button:
27
+ * - "submitted": The message has been sent to the API and we're awaiting the start of the response stream.
28
+ * - "streaming": The response is actively streaming in from the API, receiving chunks of data.
29
+ * - "ready": The full response has been received and processed; a new user message can be submitted.
30
+ * - "error": An error occurred during the API request, preventing successful completion.
31
+ */
32
+ status?: ChatStatus;
33
+ /**
34
+ * Whether to automatically focus the textarea when the user starts typing.
35
+ */
36
+ autoFocusOnTyping?: boolean;
37
+ /**
38
+ * Optional locale.
39
+ */
40
+ locale?: ChatPromptLocale;
41
+ /**
42
+ * Callback invoked when the user submits the form, either by clicking
43
+ * the submit button or pressing Enter (without Shift) inside the textarea.
44
+ */
45
+ onSubmit?: (e: KeyboardEvent<HTMLTextAreaElement> | FormEvent<HTMLFormElement>) => void;
46
+ /**
47
+ * Callback invoked when the user requests to stop the current chat response stream.
48
+ */
49
+ onStop?: () => void;
50
+ };
51
+ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<TextAreaAutoSizeProps, "onSubmit"> & {
52
+ /**
53
+ * Content to render above the textarea (e.g., a title or instructions).
54
+ */
55
+ renderHeader?: ReactNode;
56
+ /**
57
+ * Content to render below the textarea (e.g., additional controls or hints).
58
+ */
59
+ renderFooter?: ReactNode;
60
+ /**
61
+ * An optional array of placeholder strings to cycle through with a typewriter effect.
62
+ * If provided and non-empty, the component will use the dynamic, animated placeholder
63
+ * text instead of any static `placeholder` prop passed in.
64
+ */
65
+ placeholders?: string[] | undefined;
66
+ /**
67
+ * The current status of the chat prompt submit button:
68
+ * - "submitted": The message has been sent to the API and we're awaiting the start of the response stream.
69
+ * - "streaming": The response is actively streaming in from the API, receiving chunks of data.
70
+ * - "ready": The full response has been received and processed; a new user message can be submitted.
71
+ * - "error": An error occurred during the API request, preventing successful completion.
72
+ */
73
+ status?: ChatStatus | undefined;
74
+ /**
75
+ * Whether to automatically focus the textarea when the user starts typing.
76
+ */
77
+ autoFocusOnTyping?: boolean | undefined;
78
+ /**
79
+ * Optional locale.
80
+ */
81
+ locale?: ChatPromptLocale | undefined;
82
+ /**
83
+ * Callback invoked when the user submits the form, either by clicking
84
+ * the submit button or pressing Enter (without Shift) inside the textarea.
85
+ */
86
+ onSubmit?: ((e: KeyboardEvent<HTMLTextAreaElement> | FormEvent<HTMLFormElement>) => void) | undefined;
87
+ /**
88
+ * Callback invoked when the user requests to stop the current chat response stream.
89
+ */
90
+ onStop?: (() => void) | undefined;
91
+ } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,137 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["className", "renderHeader", "children", "renderFooter", "onSubmit", "onStop", "placeholder", "placeholders", "status", "autoFocusOnTyping", "defaultValue", "value", "locale"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import { ArrowUpIcon, CircleStopIcon } from "lucide-react";
8
+ import { useState } from "react";
9
+ import { useRef } from "react";
10
+ import { forwardRef } from "react";
11
+ import { chatPromptStyles } from "./ChatPrompt.styles";
12
+ import { useFocusOnTyping } from "./useFocusTyping";
13
+ import { useTypewriter } from "./useTypewriter";
14
+ import { IconButton } from "./../../../Actions";
15
+ import { TextAreaAutoSize } from "./../../../Fields/TextAreaAutoSize/TextAreaAutoSize";
16
+ import { useLocale } from "./../../../Satellite";
17
+ import { mergeRefs } from "./../../../utils/mergeRefs";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ var DEFAULT_CHAT_PROMPT_LOCALE = {
20
+ textareaLabel: "Type your message...",
21
+ emptyMessageTooltip: "Message is empty",
22
+ stopResponseTooltip: "Stop response",
23
+ sendMessageTooltip: "Send message"
24
+ };
25
+ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
26
+ var _ref2;
27
+ var className = _ref.className,
28
+ renderHeader = _ref.renderHeader,
29
+ children = _ref.children,
30
+ renderFooter = _ref.renderFooter,
31
+ onSubmit = _ref.onSubmit,
32
+ onStop = _ref.onStop,
33
+ staticPlaceholder = _ref.placeholder,
34
+ _ref$placeholders = _ref.placeholders,
35
+ placeholders = _ref$placeholders === void 0 ? [] : _ref$placeholders,
36
+ _ref$status = _ref.status,
37
+ status = _ref$status === void 0 ? "ready" : _ref$status,
38
+ autoFocusOnTyping = _ref.autoFocusOnTyping,
39
+ defaultValue = _ref.defaultValue,
40
+ valueProp = _ref.value,
41
+ propsLocale = _ref.locale,
42
+ props = _objectWithoutProperties(_ref, _excluded);
43
+ var contextLocale = useLocale("chatPrompt");
44
+ var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_PROMPT_LOCALE), contextLocale), propsLocale);
45
+ var internalRef = useRef(null);
46
+ var styles = chatPromptStyles();
47
+ var _useState = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ internalValue = _useState2[0],
50
+ setInternalValue = _useState2[1];
51
+ var isControlled = typeof valueProp !== "undefined";
52
+ var value = isControlled ? valueProp : internalValue;
53
+ var hasValue = typeof value === "string" ? value.trim() !== "" : !!value;
54
+ var canStop = status === "submitted" || status === "streaming";
55
+ var buttonDisabled = !hasValue && !canStop;
56
+ var dynamicPlaceholder = useTypewriter(placeholders, !hasValue);
57
+ var computedPlaceholder = placeholders.length > 0 ? dynamicPlaceholder : staticPlaceholder;
58
+ useFocusOnTyping(internalRef, {
59
+ enabled: autoFocusOnTyping,
60
+ strictChars: true
61
+ });
62
+ var submit = function submit(e) {
63
+ e.preventDefault();
64
+ if (!hasValue || canStop) {
65
+ return;
66
+ }
67
+ onSubmit === null || onSubmit === void 0 || onSubmit(e);
68
+ };
69
+ return /*#__PURE__*/_jsxs("form", {
70
+ className: styles.base(),
71
+ onSubmit: submit,
72
+ children: [!!renderHeader && /*#__PURE__*/_jsx("div", {
73
+ className: styles.header(),
74
+ children: renderHeader
75
+ }), /*#__PURE__*/_jsx("div", {
76
+ className: styles.body(),
77
+ onClick: function onClick(e) {
78
+ var _internalRef$current;
79
+ if (e.target === internalRef.current) return;
80
+ (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 || _internalRef$current.focus();
81
+ },
82
+ children: /*#__PURE__*/_jsx(TextAreaAutoSize, _objectSpread(_objectSpread({
83
+ ref: mergeRefs([forwardedRef, internalRef]),
84
+ rows: 2,
85
+ maxRows: 8,
86
+ placeholder: computedPlaceholder,
87
+ value: value,
88
+ "aria-label": (_ref2 = placeholders[0] ? placeholders[0] : staticPlaceholder) !== null && _ref2 !== void 0 ? _ref2 : locale.textareaLabel,
89
+ translate: "no",
90
+ onInput: function onInput(e) {
91
+ var _props$onInput;
92
+ if (!isControlled) {
93
+ setInternalValue(e.currentTarget.value);
94
+ }
95
+ (_props$onInput = props.onInput) === null || _props$onInput === void 0 || _props$onInput.call(props, e);
96
+ }
97
+ }, props), {}, {
98
+ className: styles.textarea({
99
+ className: className
100
+ }),
101
+ onKeyDown: function onKeyDown(e) {
102
+ var _props$onKeyDown;
103
+ (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 || _props$onKeyDown.call(props, e);
104
+ if (e.key === "Enter" && !e.shiftKey) {
105
+ submit(e);
106
+ }
107
+ if (e.key === "Escape") {
108
+ e.currentTarget.blur();
109
+ }
110
+ },
111
+ children: /*#__PURE__*/_jsx("div", {
112
+ className: styles.actions(),
113
+ children: /*#__PURE__*/_jsx(IconButton, {
114
+ type: status === "ready" ? "submit" : undefined,
115
+ onClick: function onClick(e) {
116
+ if (canStop) {
117
+ e.preventDefault();
118
+ onStop === null || onStop === void 0 || onStop();
119
+ }
120
+ },
121
+ icon: canStop ? CircleStopIcon : ArrowUpIcon,
122
+ variant: canStop ? "neutral" : "primary",
123
+ size: "small",
124
+ title: buttonDisabled ? locale.emptyMessageTooltip : canStop ? locale.stopResponseTooltip : locale.sendMessageTooltip,
125
+ tooltipSide: "top",
126
+ disabled: buttonDisabled,
127
+ className: styles.submit()
128
+ })
129
+ })
130
+ }))
131
+ }), !!renderFooter && /*#__PURE__*/_jsx("div", {
132
+ className: styles.footer(),
133
+ children: renderFooter
134
+ })]
135
+ });
136
+ });
137
+ ChatPrompt.displayName = "ChatPrompt";
@@ -0,0 +1,61 @@
1
+ export declare const chatPromptStyles: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-merge").ClassNameValue | {
4
+ base?: import("tailwind-merge").ClassNameValue;
5
+ body?: import("tailwind-merge").ClassNameValue;
6
+ footer?: import("tailwind-merge").ClassNameValue;
7
+ header?: import("tailwind-merge").ClassNameValue;
8
+ textarea?: import("tailwind-merge").ClassNameValue;
9
+ submit?: import("tailwind-merge").ClassNameValue;
10
+ actions?: import("tailwind-merge").ClassNameValue;
11
+ };
12
+ };
13
+ } | {
14
+ [x: string]: {
15
+ [x: string]: import("tailwind-merge").ClassNameValue | {
16
+ base?: import("tailwind-merge").ClassNameValue;
17
+ body?: import("tailwind-merge").ClassNameValue;
18
+ footer?: import("tailwind-merge").ClassNameValue;
19
+ header?: import("tailwind-merge").ClassNameValue;
20
+ textarea?: import("tailwind-merge").ClassNameValue;
21
+ submit?: import("tailwind-merge").ClassNameValue;
22
+ actions?: import("tailwind-merge").ClassNameValue;
23
+ };
24
+ };
25
+ } | {}, {
26
+ base: string;
27
+ header: string;
28
+ body: string;
29
+ textarea: string;
30
+ actions: string;
31
+ submit: string;
32
+ footer: string;
33
+ }, undefined, {
34
+ [key: string]: {
35
+ [key: string]: import("tailwind-merge").ClassNameValue | {
36
+ base?: import("tailwind-merge").ClassNameValue;
37
+ body?: import("tailwind-merge").ClassNameValue;
38
+ footer?: import("tailwind-merge").ClassNameValue;
39
+ header?: import("tailwind-merge").ClassNameValue;
40
+ textarea?: import("tailwind-merge").ClassNameValue;
41
+ submit?: import("tailwind-merge").ClassNameValue;
42
+ actions?: import("tailwind-merge").ClassNameValue;
43
+ };
44
+ };
45
+ } | {}, {
46
+ base: string;
47
+ header: string;
48
+ body: string;
49
+ textarea: string;
50
+ actions: string;
51
+ submit: string;
52
+ footer: string;
53
+ }, import("tailwind-variants").TVReturnType<unknown, {
54
+ base: string;
55
+ header: string;
56
+ body: string;
57
+ textarea: string;
58
+ actions: string;
59
+ submit: string;
60
+ footer: string;
61
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,15 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
+ import stl from "./../../../styles/helpers/satellitePrefixer";
4
+ import { tv } from "./../../../styles/helpers/tv";
5
+ export var chatPromptStyles = tv({
6
+ slots: {
7
+ base: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["relative flex flex-col items-stretch gap-2 w-full"]))),
8
+ header: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex items-center gap-1.5"]))),
9
+ body: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""]))),
10
+ textarea: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["[&>textarea]:p-3 [&>textarea]:pb-0 [&>textarea]:thin-scrollbar"]))),
11
+ actions: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["flex flex-row p-3 pt-2 justify-end cursor-text"]))),
12
+ submit: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral([""]))),
13
+ footer: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["flex items-center justify-between gap-1.5"])))
14
+ }
15
+ });
@@ -0,0 +1 @@
1
+ export * from "./ChatPrompt";
@@ -0,0 +1 @@
1
+ export * from "./ChatPrompt";
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ declare type Editable = HTMLTextAreaElement | HTMLInputElement | HTMLElement;
3
+ interface Options {
4
+ enabled?: boolean;
5
+ strictChars?: boolean;
6
+ }
7
+ /**
8
+ * Focus `editableRef` the moment the user types anywhere on the page,
9
+ * *unless* their cursor is already inside an editable control.
10
+ */
11
+ export declare function useFocusOnTyping<E extends Editable = Editable>(editableRef: React.RefObject<E>, { enabled, strictChars }?: Options): void;
12
+ export {};
@@ -0,0 +1,54 @@
1
+ import { useCallback, useEffect } from "react";
2
+ var isTextualElement = function isTextualElement(el) {
3
+ if (el.isContentEditable) return true;
4
+ var tag = el.tagName.toUpperCase();
5
+ if (tag === "TEXTAREA") return true;
6
+ if (tag === "INPUT") {
7
+ // Empty `type` defaults to "text"
8
+ var t = (el.type || "text").toLowerCase();
9
+ return ["text", "search", "url", "email", "tel", "password", "number", "date", "datetime-local", "month", "week", "time"].includes(t);
10
+ }
11
+ return false;
12
+ };
13
+ var shouldFocusEditable = function shouldFocusEditable(target) {
14
+ var el = target;
15
+ if (!el) return true;
16
+ return !isTextualElement(el);
17
+ };
18
+
19
+ // e.g. <div contentEditable>
20
+
21
+ /**
22
+ * Focus `editableRef` the moment the user types anywhere on the page,
23
+ * *unless* their cursor is already inside an editable control.
24
+ */
25
+ export function useFocusOnTyping(editableRef) {
26
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
27
+ _ref$enabled = _ref.enabled,
28
+ enabled = _ref$enabled === void 0 ? true : _ref$enabled,
29
+ _ref$strictChars = _ref.strictChars,
30
+ strictChars = _ref$strictChars === void 0 ? false : _ref$strictChars;
31
+ var handleKeyDown = useCallback(function (e) {
32
+ if (!enabled || e.ctrlKey || e.altKey || e.metaKey || e.isComposing || e.repeat || (
33
+ // Printable-character test
34
+ strictChars ? !/^[A-Za-z0-9]$/.test(e.key) : e.key.length !== 1)) {
35
+ return;
36
+ }
37
+ var node = editableRef.current;
38
+ if (!node) return;
39
+ if (node.contains(document.activeElement)) return;
40
+ if (shouldFocusEditable(e.target)) {
41
+ node.focus();
42
+ }
43
+ }, [enabled, strictChars, editableRef]);
44
+ useEffect(function () {
45
+ if (typeof window === "undefined") return; // SSR/test guard
46
+
47
+ window.addEventListener("keydown", handleKeyDown, {
48
+ passive: true
49
+ });
50
+ return function () {
51
+ return window.removeEventListener("keydown", handleKeyDown);
52
+ };
53
+ }, [handleKeyDown]);
54
+ }
@@ -0,0 +1,18 @@
1
+ export interface UseTypewriterOptions {
2
+ /**
3
+ * Milliseconds per character when typing.
4
+ * @default 150
5
+ */
6
+ typingSpeed?: number;
7
+ /**
8
+ * Milliseconds per character when deleting.
9
+ * @default 20
10
+ */
11
+ deletingSpeed?: number;
12
+ /**
13
+ * Milliseconds to pause after typing a full word before deleting.
14
+ * @default 1000
15
+ */
16
+ pauseDuration?: number;
17
+ }
18
+ export declare function useTypewriter(texts: string[], enabled?: boolean, options?: UseTypewriterOptions): string;
@@ -0,0 +1,71 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useEffect, useState } from "react";
3
+ export function useTypewriter(texts) {
4
+ var enabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6
+ var _options$typingSpeed = options.typingSpeed,
7
+ typingSpeed = _options$typingSpeed === void 0 ? 150 : _options$typingSpeed,
8
+ _options$deletingSpee = options.deletingSpeed,
9
+ deletingSpeed = _options$deletingSpee === void 0 ? 20 : _options$deletingSpee,
10
+ _options$pauseDuratio = options.pauseDuration,
11
+ pauseDuration = _options$pauseDuratio === void 0 ? 1000 : _options$pauseDuratio;
12
+ var _useState = useState(""),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ currentText = _useState2[0],
15
+ setCurrentText = _useState2[1];
16
+ var _useState3 = useState(false),
17
+ _useState4 = _slicedToArray(_useState3, 2),
18
+ isDeleting = _useState4[0],
19
+ setIsDeleting = _useState4[1];
20
+ var _useState5 = useState(0),
21
+ _useState6 = _slicedToArray(_useState5, 2),
22
+ loopIndex = _useState6[0],
23
+ setLoopIndex = _useState6[1];
24
+ useEffect(function () {
25
+ if (texts.length === 0 || !enabled) {
26
+ return;
27
+ }
28
+ var currentIndex = loopIndex % texts.length;
29
+ var fullText = texts[currentIndex];
30
+ var isFullWord = !isDeleting && currentText === fullText;
31
+ var isEmptyWord = isDeleting && currentText === "";
32
+ var nextText;
33
+ var delay;
34
+ if (isFullWord) {
35
+ // Just finished typing the full word: pause, then start deleting
36
+ nextText = fullText.substring(0, fullText.length - 1);
37
+ delay = pauseDuration;
38
+ } else if (isEmptyWord) {
39
+ // Just finished deleting the word: move to next word
40
+ nextText = "";
41
+ delay = typingSpeed;
42
+ } else {
43
+ // Normal typing or deleting behavior
44
+ if (isDeleting) {
45
+ nextText = fullText.substring(0, currentText.length - 1);
46
+ delay = deletingSpeed;
47
+ } else {
48
+ nextText = fullText.substring(0, currentText.length + 1);
49
+ delay = typingSpeed;
50
+ }
51
+ }
52
+ var timer = setTimeout(function () {
53
+ setCurrentText(nextText);
54
+ if (isFullWord) {
55
+ // Switch to deleting
56
+ setIsDeleting(true);
57
+ } else if (isEmptyWord) {
58
+ // Reset to typing next word
59
+ setIsDeleting(false);
60
+ setLoopIndex(function (prev) {
61
+ return prev + 1;
62
+ });
63
+ }
64
+ // Otherwise, keep the current isDeleting value
65
+ }, delay);
66
+ return function () {
67
+ return clearTimeout(timer);
68
+ };
69
+ }, [enabled, currentText, isDeleting, loopIndex, texts, typingSpeed, deletingSpeed, pauseDuration]);
70
+ return currentText;
71
+ }
@@ -0,0 +1,15 @@
1
+ export type { ChatMessageProps as ExperimentalChatMessageProps } from "./ChatMessage";
2
+ export { ChatMessage as ExperimentalChatMessage } from "./ChatMessage";
3
+ export type { ChatMessagesProps as ExperimentalChatMessagesProps, ChatMessageLocale as ExperimentalChatMessageLocale, } from "./ChatMessages";
4
+ export { ChatMessages as ExperimentalChatMessages } from "./ChatMessages";
5
+ export type { ChatPromptProps as ExperimentalChatPromptProps } from "./ChatPrompt";
6
+ export type { ChatPromptLocale as ExperimentalChatPromptLocale } from "./ChatPrompt";
7
+ export { ChatPrompt as ExperimentalChatPrompt } from "./ChatPrompt";
8
+ export type { ChatContextAccordionProps as ExperimentalChatContextAccordionProps } from "./ChatContextAccordion";
9
+ export { ChatContextAccordion as ExperimentalChatContextAccordion } from "./ChatContextAccordion";
10
+ export type { ChatMessageErrorLocale as ExperimentalChatMessageErrorLocale } from "./ChatMessageError";
11
+ export type { ChatMessageErrorProps as ExperimentalChatMessageErrorProps } from "./ChatMessageError";
12
+ export { ChatMessageError as ExperimentalChatMessageError } from "./ChatMessageError";
13
+ export type { ChatMessageLoaderProps as ExperimentalChatMessageLoaderProps } from "./ChatMessageLoader";
14
+ export { ChatMessageLoader as ExperimentalChatMessageLoader } from "./ChatMessageLoader";
15
+ export type { ChatMessageBase as ExperimentalChatMessageBase, ChatMessageRole as ExperimentalChatMessageRole, ChatStatus as ExperimentalChatStatus, } from "./types";
@@ -0,0 +1,6 @@
1
+ export { ChatMessage as ExperimentalChatMessage } from "./ChatMessage";
2
+ export { ChatMessages as ExperimentalChatMessages } from "./ChatMessages";
3
+ export { ChatPrompt as ExperimentalChatPrompt } from "./ChatPrompt";
4
+ export { ChatContextAccordion as ExperimentalChatContextAccordion } from "./ChatContextAccordion";
5
+ export { ChatMessageError as ExperimentalChatMessageError } from "./ChatMessageError";
6
+ export { ChatMessageLoader as ExperimentalChatMessageLoader } from "./ChatMessageLoader";
@@ -0,0 +1,7 @@
1
+ export declare type ChatMessageRole = "system" | "user" | "assistant" | "data";
2
+ export declare type ChatStatus = "submitted" | "streaming" | "ready" | "error";
3
+ export declare type ChatMessageBase = {
4
+ id: string;
5
+ role: ChatMessageRole;
6
+ content: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from "./Card";
2
+ export * from "./Chat";
2
3
  export * from "./CollapsibleCard";
3
4
  export * from "./FlexGrid";
4
5
  export * from "./Insert";
@@ -1,4 +1,5 @@
1
1
  export * from "./Card";
2
+ export * from "./Chat";
2
3
  export * from "./CollapsibleCard";
3
4
  export * from "./FlexGrid";
4
5
  export * from "./Insert";
@@ -3,11 +3,17 @@ import type { AutoCompleteLocale, DateInputLocale, DatePickerLocale, DropzoneLoc
3
3
  import type { AnnouncementBadgeLocale, TagLocale, ToastLocale, ToastsLocale } from "../Indicators";
4
4
  import type { UserAvatarLocale } from "../Indicators/Avatars";
5
5
  import type { DataTableLocale, SidebarLocale } from "../Layout";
6
+ import type { ChatMessageErrorLocale } from "../Layout/Chat/ChatMessageError";
7
+ import type { ChatMessageLocale } from "../Layout/Chat/ChatMessages";
8
+ import type { ChatPromptLocale } from "../Layout/Chat/ChatPrompt";
6
9
  import type { CompactPaginationLocale, DotPaginationLocale, PaginationLocale, StepperLocale } from "../Navigation";
7
10
  import type { ModalLocale, PopoverLocale } from "../Overlay";
8
11
  export declare type ComponentsLocales = {
9
12
  announcementBadge?: AnnouncementBadgeLocale;
10
13
  autoComplete?: AutoCompleteLocale;
14
+ chatMessage?: ChatMessageLocale;
15
+ chatMessageError?: ChatMessageErrorLocale;
16
+ chatPrompt?: ChatPromptLocale;
11
17
  compactPagination?: CompactPaginationLocale;
12
18
  dataTable?: DataTableLocale;
13
19
  dateInput?: DateInputLocale;
@@ -17,8 +23,8 @@ export declare type ComponentsLocales = {
17
23
  dropzone?: DropzoneLocale;
18
24
  filePicker?: FilePickerLocale;
19
25
  form?: ExperimentalFormLocale;
20
- input?: InputPropsLocale;
21
26
  iconButtonWithFeedback?: IconButtonWithFeedbackLocale;
27
+ input?: InputPropsLocale;
22
28
  modal?: ModalLocale;
23
29
  pagination?: PaginationLocale;
24
30
  popover?: PopoverLocale;
@@ -0,0 +1 @@
1
+ export declare const tv: import("tailwind-variants").CreateTV;
@@ -0,0 +1,7 @@
1
+ import { createTV } from "tailwind-variants";
2
+ export var tv = createTV({
3
+ twMergeConfig: {
4
+ // eslint-disable-next-line @algolia/stl/prefer-stl-helper
5
+ prefix: "stl-"
6
+ }
7
+ });
@@ -145,5 +145,5 @@ export default {
145
145
  }
146
146
  }
147
147
  },
148
- plugins: [require("@tailwindcss/container-queries"), require("./base.tailwind"), require("../Helpers/utilities/overlay.tailwind"), require("../Helpers/utilities/utilities.tailwind"), require("../Helpers/utilities/focusable.tailwind"), require("../Typography/Typography.tailwind"), require("../Layout/FlexGrid/FlexGrid.tailwind"), require("../Fields/AutoComplete/AutoComplete.tailwind"), require("../Actions/Button/Button.tailwind"), require("../Actions/ToggleGroup/ToggleGroup.tailwind"), require("../Actions/Accordion/Accordion.tailwind"), require("../Layout/Card/Card.tailwind"), require("../Fields/Checkbox/Checkbox.tailwind"), require("../Indicators/Toast/Toast.tailwind"), require("../Helpers/HelpUnderline/HelpUnderline.tailwind"), require("../Fields/Input/Input.tailwind"), require("../Helpers/InstantSearch/InstantSearch.tailwind"), require("../Indicators/KeyboardKey/KeyboardKey.tailwind"), require("../Indicators/Medallion/Medallion.tailwind"), require("../Overlay/Modal/Modal.tailwind"), require("../Indicators/ProgressBar/ProgressBar.tailwind"), require("../Indicators/ProgressSpinner/ProgressSpinner.tailwind"), require("../Fields/RadioGroup/RadioButton.tailwind"), require("../Indicators/ScrollIndicator/ScrollIndicator.tailwind"), require("../Fields/Select/Select.tailwind"), require("../Indicators/Separator/Separator.tailwind"), require("../Actions/SegmentedControl/SegmentedControl.tailwind"), require("../Navigation/Tabs/Tabs.tailwind"), require("../Layout/CollapsibleCard/CollapsibleCard.tailwind"), require("../Layout/Tables/DataTable/DataTable.tailwind"), require("../Layout/Tables/Table/Table.tailwind"), require("../Indicators/Tag/Tag.tailwind"), require("../Fields/TextArea/TextArea.tailwind"), require("../Fields/Switch/Switch.tailwind"), require("../Overlay/Tooltip/Tooltip.tailwind"), require("../Helpers/UserContent/UserContent.tailwind"), require("../Fields/DatePicker/DatePicker.tailwind")]
148
+ plugins: [require("@tailwindcss/container-queries"), require("./base.tailwind"), require("../Helpers/utilities/overlay.tailwind"), require("../Helpers/utilities/utilities.tailwind"), require("../Helpers/utilities/focusable.tailwind"), require("../Typography/Typography.tailwind"), require("../Layout/FlexGrid/FlexGrid.tailwind"), require("../Fields/AutoComplete/AutoComplete.tailwind"), require("../Actions/Button/Button.tailwind"), require("../Actions/ToggleGroup/ToggleGroup.tailwind"), require("../Actions/Accordion/Accordion.tailwind"), require("../Layout/Card/Card.tailwind"), require("../Fields/Checkbox/Checkbox.tailwind"), require("../Indicators/Toast/Toast.tailwind"), require("../Helpers/HelpUnderline/HelpUnderline.tailwind"), require("../Fields/Input/Input.tailwind"), require("../Helpers/InstantSearch/InstantSearch.tailwind"), require("../Indicators/KeyboardKey/KeyboardKey.tailwind"), require("../Indicators/Medallion/Medallion.tailwind"), require("../Overlay/Modal/Modal.tailwind"), require("../Indicators/ProgressBar/ProgressBar.tailwind"), require("../Indicators/ProgressSpinner/ProgressSpinner.tailwind"), require("../Fields/RadioGroup/RadioButton.tailwind"), require("../Indicators/ScrollIndicator/ScrollIndicator.tailwind"), require("../Fields/Select/Select.tailwind"), require("../Indicators/Separator/Separator.tailwind"), require("../Actions/SegmentedControl/SegmentedControl.tailwind"), require("../Navigation/Tabs/Tabs.tailwind"), require("../Layout/CollapsibleCard/CollapsibleCard.tailwind"), require("../Layout/Tables/DataTable/DataTable.tailwind"), require("../Layout/Tables/Table/Table.tailwind"), require("../Helpers/ShimmerText/ShimmerText.tailwind"), require("../Indicators/Tag/Tag.tailwind"), require("../Fields/TextArea/TextArea.tailwind"), require("../Fields/Switch/Switch.tailwind"), require("../Overlay/Tooltip/Tooltip.tailwind"), require("../Helpers/UserContent/UserContent.tailwind"), require("../Fields/DatePicker/DatePicker.tailwind")]
149
149
  };
@@ -1,4 +1,5 @@
1
+ import type { ReactNode } from "react";
1
2
  /**
2
3
  * Returns the text content of a React node.
3
4
  */
4
- export declare const getTextFromReactNode: (node: React.ReactNode) => string;
5
+ export declare const getTextFromReactNode: (node: ReactNode) => string;
@@ -1,15 +1,20 @@
1
- import { Children, isValidElement } from "react";
1
+ import { isValidElement } from "react";
2
2
 
3
3
  /**
4
4
  * Returns the text content of a React node.
5
5
  */
6
6
  export var getTextFromReactNode = function getTextFromReactNode(node) {
7
- if (typeof node === "string") return node;
8
- if (typeof node === "number") return node.toString();
9
- if ( /*#__PURE__*/isValidElement(node)) {
10
- return Children.toArray(node.props.children).map(function (child) {
11
- return getTextFromReactNode(child);
12
- }).join(" ");
7
+ var string = "";
8
+ if (typeof node === "string") {
9
+ string = node;
10
+ } else if (typeof node === "number") {
11
+ string = node.toString();
12
+ } else if (node instanceof Array) {
13
+ node.forEach(function (child) {
14
+ string += getTextFromReactNode(child);
15
+ });
16
+ } else if ( /*#__PURE__*/isValidElement(node)) {
17
+ string += getTextFromReactNode(node.props.children);
13
18
  }
14
- return "";
19
+ return string;
15
20
  };