@algolia/satellite 2.2.3 → 2.3.0-rc.1

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 (154) 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 +71 -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 +42 -0
  49. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.js +124 -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 +10 -0
  55. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.js +47 -0
  56. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +83 -0
  57. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.js +136 -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/useTypewriter.d.ts +18 -0
  63. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.js +78 -0
  64. package/dist/cjs/Layout/Chat/index.d.ts +15 -0
  65. package/dist/cjs/Layout/Chat/index.js +47 -0
  66. package/dist/cjs/Layout/Chat/types.d.ts +7 -0
  67. package/dist/cjs/Layout/Chat/types.js +5 -0
  68. package/dist/cjs/Layout/index.d.ts +1 -0
  69. package/dist/cjs/Layout/index.js +11 -0
  70. package/dist/cjs/Satellite/locale.d.ts +7 -1
  71. package/dist/cjs/styles/helpers/tv.d.ts +1 -0
  72. package/dist/cjs/styles/helpers/tv.js +13 -0
  73. package/dist/cjs/styles/tailwind.config.js +1 -1
  74. package/dist/cjs/utils/getTextFromReactNode.d.ts +2 -1
  75. package/dist/cjs/utils/getTextFromReactNode.js +12 -7
  76. package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
  77. package/dist/esm/Actions/Accordion/Accordion.d.ts +8 -0
  78. package/dist/esm/Actions/Accordion/Accordion.js +5 -3
  79. package/dist/esm/Fields/TextArea/TextArea.d.ts +5 -1
  80. package/dist/esm/Fields/TextArea/TextArea.js +3 -2
  81. package/dist/esm/Fields/TextArea/TextArea.tailwind.js +1 -1
  82. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  83. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.js +75 -0
  84. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  85. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +9 -0
  86. package/dist/esm/Fields/TextAreaAutoSize/index.d.ts +2 -0
  87. package/dist/esm/Fields/TextAreaAutoSize/index.js +1 -0
  88. package/dist/esm/Fields/index.d.ts +2 -1
  89. package/dist/esm/Fields/index.js +2 -1
  90. package/dist/esm/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  91. package/dist/esm/Helpers/ShimmerText/ShimmerText.js +21 -0
  92. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  93. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.js +36 -0
  94. package/dist/esm/Helpers/ShimmerText/index.d.ts +2 -0
  95. package/dist/esm/Helpers/ShimmerText/index.js +1 -0
  96. package/dist/esm/Helpers/index.d.ts +1 -0
  97. package/dist/esm/Helpers/index.js +2 -1
  98. package/dist/esm/Helpers/utilities/utilities.tailwind.js +6 -1
  99. package/dist/esm/Indicators/Skeleton/Skeleton.d.ts +2 -2
  100. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  101. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +37 -0
  102. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  103. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +16 -0
  104. package/dist/esm/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  105. package/dist/esm/Layout/Chat/ChatContextAccordion/index.js +1 -0
  106. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  107. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.js +77 -0
  108. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  109. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.js +64 -0
  110. package/dist/esm/Layout/Chat/ChatMessage/index.d.ts +1 -0
  111. package/dist/esm/Layout/Chat/ChatMessage/index.js +1 -0
  112. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  113. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.js +61 -0
  114. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  115. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +11 -0
  116. package/dist/esm/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  117. package/dist/esm/Layout/Chat/ChatMessageError/index.js +1 -0
  118. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  119. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +56 -0
  120. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  121. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +14 -0
  122. package/dist/esm/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  123. package/dist/esm/Layout/Chat/ChatMessageLoader/index.js +1 -0
  124. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.d.ts +42 -0
  125. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.js +119 -0
  126. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  127. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.js +22 -0
  128. package/dist/esm/Layout/Chat/ChatMessages/index.d.ts +1 -0
  129. package/dist/esm/Layout/Chat/ChatMessages/index.js +1 -0
  130. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +10 -0
  131. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.js +41 -0
  132. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +83 -0
  133. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.js +131 -0
  134. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  135. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +15 -0
  136. package/dist/esm/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  137. package/dist/esm/Layout/Chat/ChatPrompt/index.js +1 -0
  138. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  139. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.js +71 -0
  140. package/dist/esm/Layout/Chat/index.d.ts +15 -0
  141. package/dist/esm/Layout/Chat/index.js +6 -0
  142. package/dist/esm/Layout/Chat/types.d.ts +7 -0
  143. package/dist/esm/Layout/Chat/types.js +1 -0
  144. package/dist/esm/Layout/index.d.ts +1 -0
  145. package/dist/esm/Layout/index.js +1 -0
  146. package/dist/esm/Satellite/locale.d.ts +7 -1
  147. package/dist/esm/styles/helpers/tv.d.ts +1 -0
  148. package/dist/esm/styles/helpers/tv.js +7 -0
  149. package/dist/esm/styles/tailwind.config.js +1 -1
  150. package/dist/esm/utils/getTextFromReactNode.d.ts +2 -1
  151. package/dist/esm/utils/getTextFromReactNode.js +13 -8
  152. package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
  153. package/dist/satellite.min.css +1 -1
  154. package/package.json +12 -3
@@ -0,0 +1,83 @@
1
+ import type { FormEvent, KeyboardEvent, ReactNode } from "react";
2
+ import type { TextAreaProps } from "../../../Fields";
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<TextAreaProps, "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
+ * Callback invoked when the user submits the form, either by clicking
35
+ * the submit button or pressing Enter (without Shift) inside the textarea.
36
+ */
37
+ onSubmit?: (e: KeyboardEvent<HTMLTextAreaElement> | FormEvent<HTMLFormElement>) => void;
38
+ /**
39
+ * Callback invoked when the user requests to stop the current chat response stream.
40
+ */
41
+ onStop?: () => void;
42
+ /**
43
+ * Optional locale.
44
+ */
45
+ locale?: ChatPromptLocale;
46
+ };
47
+ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "onSubmit"> & {
48
+ /**
49
+ * Content to render above the textarea (e.g., a title or instructions).
50
+ */
51
+ renderHeader?: ReactNode;
52
+ /**
53
+ * Content to render below the textarea (e.g., additional controls or hints).
54
+ */
55
+ renderFooter?: ReactNode;
56
+ /**
57
+ * An optional array of placeholder strings to cycle through with a typewriter effect.
58
+ * If provided and non-empty, the component will use the dynamic, animated placeholder
59
+ * text instead of any static `placeholder` prop passed in.
60
+ */
61
+ placeholders?: string[] | undefined;
62
+ /**
63
+ * The current status of the chat prompt submit button:
64
+ * - "submitted": The message has been sent to the API and we're awaiting the start of the response stream.
65
+ * - "streaming": The response is actively streaming in from the API, receiving chunks of data.
66
+ * - "ready": The full response has been received and processed; a new user message can be submitted.
67
+ * - "error": An error occurred during the API request, preventing successful completion.
68
+ */
69
+ status?: ChatStatus | undefined;
70
+ /**
71
+ * Callback invoked when the user submits the form, either by clicking
72
+ * the submit button or pressing Enter (without Shift) inside the textarea.
73
+ */
74
+ onSubmit?: ((e: KeyboardEvent<HTMLTextAreaElement> | FormEvent<HTMLFormElement>) => void) | undefined;
75
+ /**
76
+ * Callback invoked when the user requests to stop the current chat response stream.
77
+ */
78
+ onStop?: (() => void) | undefined;
79
+ /**
80
+ * Optional locale.
81
+ */
82
+ locale?: ChatPromptLocale | undefined;
83
+ } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ChatPrompt = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _lucideReact = require("lucide-react");
12
+ var _react = require("react");
13
+ var _ChatPrompt = require("./ChatPrompt.styles");
14
+ var _useTypewriter = require("./useTypewriter");
15
+ var _Actions = require("./../../../Actions");
16
+ var _TextAreaAutoSize = require("./../../../Fields/TextAreaAutoSize/TextAreaAutoSize");
17
+ var _Satellite = require("./../../../Satellite");
18
+ var _mergeRefs = require("./../../../utils/mergeRefs");
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
+ var _excluded = ["className", "renderHeader", "children", "renderFooter", "onSubmit", "onStop", "placeholder", "placeholders", "status", "defaultValue", "value", "locale"];
21
+ 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; }
22
+ 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) { (0, _defineProperty2["default"])(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; }
23
+ var DEFAULT_CHAT_PROMPT_LOCALE = {
24
+ textareaLabel: "Type your message...",
25
+ emptyMessageTooltip: "Message is empty",
26
+ stopResponseTooltip: "Stop response",
27
+ sendMessageTooltip: "Send message"
28
+ };
29
+ var ChatPrompt = exports.ChatPrompt = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, forwardedRef) {
30
+ var _ref2;
31
+ var className = _ref.className,
32
+ renderHeader = _ref.renderHeader,
33
+ children = _ref.children,
34
+ renderFooter = _ref.renderFooter,
35
+ onSubmit = _ref.onSubmit,
36
+ onStop = _ref.onStop,
37
+ staticPlaceholder = _ref.placeholder,
38
+ _ref$placeholders = _ref.placeholders,
39
+ placeholders = _ref$placeholders === void 0 ? [] : _ref$placeholders,
40
+ _ref$status = _ref.status,
41
+ status = _ref$status === void 0 ? "ready" : _ref$status,
42
+ defaultValue = _ref.defaultValue,
43
+ valueProp = _ref.value,
44
+ propsLocale = _ref.locale,
45
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
46
+ var contextLocale = (0, _Satellite.useLocale)("chatPrompt");
47
+ var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_PROMPT_LOCALE), contextLocale), propsLocale);
48
+ var internalRef = (0, _react.useRef)(null);
49
+ var styles = (0, _ChatPrompt.chatPromptStyles)();
50
+ var _useState = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""),
51
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
52
+ internalValue = _useState2[0],
53
+ setInternalValue = _useState2[1];
54
+ var isControlled = typeof valueProp !== "undefined";
55
+ var value = isControlled ? valueProp : internalValue;
56
+ var hasValue = typeof value === "string" ? value.trim() !== "" : !!value;
57
+ var canStop = status === "submitted" || status === "streaming";
58
+ var buttonDisabled = !hasValue && !canStop;
59
+ var dynamicPlaceholder = (0, _useTypewriter.useTypewriter)(placeholders, !hasValue);
60
+ var computedPlaceholder = placeholders.length > 0 ? dynamicPlaceholder : staticPlaceholder;
61
+ var submit = function submit(e) {
62
+ e.preventDefault();
63
+ if (!hasValue || canStop) {
64
+ return;
65
+ }
66
+ onSubmit === null || onSubmit === void 0 || onSubmit(e);
67
+ };
68
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
69
+ className: styles.base(),
70
+ onSubmit: submit,
71
+ children: [!!renderHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
+ className: styles.header(),
73
+ children: renderHeader
74
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
75
+ className: styles.body(),
76
+ onClick: function onClick(e) {
77
+ var _internalRef$current;
78
+ if (e.target === internalRef.current) return;
79
+ (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 || _internalRef$current.focus();
80
+ },
81
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextAreaAutoSize.TextAreaAutoSize, _objectSpread(_objectSpread({
82
+ ref: (0, _mergeRefs.mergeRefs)([forwardedRef, internalRef]),
83
+ rows: 2,
84
+ maxRows: 8,
85
+ placeholder: computedPlaceholder,
86
+ value: value,
87
+ "aria-label": (_ref2 = placeholders[0] ? placeholders[0] : staticPlaceholder) !== null && _ref2 !== void 0 ? _ref2 : locale.textareaLabel,
88
+ translate: "no",
89
+ onInput: function onInput(e) {
90
+ var _props$onInput;
91
+ if (!isControlled) {
92
+ setInternalValue(e.currentTarget.value);
93
+ }
94
+ (_props$onInput = props.onInput) === null || _props$onInput === void 0 || _props$onInput.call(props, e);
95
+ }
96
+ }, props), {}, {
97
+ className: styles.textarea({
98
+ className: className
99
+ }),
100
+ onKeyDown: function onKeyDown(e) {
101
+ var _props$onKeyDown;
102
+ (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 || _props$onKeyDown.call(props, e);
103
+ if (e.key === "Enter" && !e.shiftKey) {
104
+ submit(e);
105
+ }
106
+ if (e.key === "Escape") {
107
+ e.currentTarget.blur();
108
+ }
109
+ },
110
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
111
+ className: styles.actions(),
112
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
113
+ type: status === "ready" ? "submit" : undefined,
114
+ onClick: function onClick(e) {
115
+ if (canStop) {
116
+ e.preventDefault();
117
+ onStop === null || onStop === void 0 || onStop();
118
+ }
119
+ },
120
+ icon: canStop ? _lucideReact.CircleStopIcon : _lucideReact.ArrowUpIcon,
121
+ variant: canStop ? "neutral" : "primary",
122
+ size: "small",
123
+ title: buttonDisabled ? locale.emptyMessageTooltip : canStop ? locale.stopResponseTooltip : locale.sendMessageTooltip,
124
+ tooltipSide: "top",
125
+ disabled: buttonDisabled,
126
+ className: styles.submit()
127
+ })
128
+ })
129
+ }))
130
+ }), !!renderFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
131
+ className: styles.footer(),
132
+ children: renderFooter
133
+ })]
134
+ });
135
+ });
136
+ 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,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.chatPromptStyles = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _satellitePrefixer = _interopRequireDefault(require("./../../../styles/helpers/satellitePrefixer"));
10
+ var _tv = require("./../../../styles/helpers/tv");
11
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
12
+ var chatPromptStyles = exports.chatPromptStyles = (0, _tv.tv)({
13
+ slots: {
14
+ base: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["relative flex flex-col items-stretch gap-2 w-full"]))),
15
+ header: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["flex items-center gap-1.5"]))),
16
+ body: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""]))),
17
+ textarea: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["[&>textarea]:p-3 [&>textarea]:pb-0 [&>textarea]:thin-scrollbar"]))),
18
+ actions: (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["flex flex-row p-3 pt-2 justify-end"]))),
19
+ submit: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""]))),
20
+ footer: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["flex items-center justify-between gap-1.5"])))
21
+ }
22
+ });
@@ -0,0 +1 @@
1
+ export * from "./ChatPrompt";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ChatPrompt = require("./ChatPrompt");
7
+ Object.keys(_ChatPrompt).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ChatPrompt[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _ChatPrompt[key];
14
+ }
15
+ });
16
+ });
@@ -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,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useTypewriter = useTypewriter;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ function useTypewriter(texts) {
11
+ var enabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
13
+ var _options$typingSpeed = options.typingSpeed,
14
+ typingSpeed = _options$typingSpeed === void 0 ? 150 : _options$typingSpeed,
15
+ _options$deletingSpee = options.deletingSpeed,
16
+ deletingSpeed = _options$deletingSpee === void 0 ? 20 : _options$deletingSpee,
17
+ _options$pauseDuratio = options.pauseDuration,
18
+ pauseDuration = _options$pauseDuratio === void 0 ? 1000 : _options$pauseDuratio;
19
+ var _useState = (0, _react.useState)(""),
20
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
21
+ currentText = _useState2[0],
22
+ setCurrentText = _useState2[1];
23
+ var _useState3 = (0, _react.useState)(false),
24
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
25
+ isDeleting = _useState4[0],
26
+ setIsDeleting = _useState4[1];
27
+ var _useState5 = (0, _react.useState)(0),
28
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
29
+ loopIndex = _useState6[0],
30
+ setLoopIndex = _useState6[1];
31
+ (0, _react.useEffect)(function () {
32
+ if (texts.length === 0 || !enabled) {
33
+ return;
34
+ }
35
+ var currentIndex = loopIndex % texts.length;
36
+ var fullText = texts[currentIndex];
37
+ var isFullWord = !isDeleting && currentText === fullText;
38
+ var isEmptyWord = isDeleting && currentText === "";
39
+ var nextText;
40
+ var delay;
41
+ if (isFullWord) {
42
+ // Just finished typing the full word: pause, then start deleting
43
+ nextText = fullText.substring(0, fullText.length - 1);
44
+ delay = pauseDuration;
45
+ } else if (isEmptyWord) {
46
+ // Just finished deleting the word: move to next word
47
+ nextText = "";
48
+ delay = typingSpeed;
49
+ } else {
50
+ // Normal typing or deleting behavior
51
+ if (isDeleting) {
52
+ nextText = fullText.substring(0, currentText.length - 1);
53
+ delay = deletingSpeed;
54
+ } else {
55
+ nextText = fullText.substring(0, currentText.length + 1);
56
+ delay = typingSpeed;
57
+ }
58
+ }
59
+ var timer = setTimeout(function () {
60
+ setCurrentText(nextText);
61
+ if (isFullWord) {
62
+ // Switch to deleting
63
+ setIsDeleting(true);
64
+ } else if (isEmptyWord) {
65
+ // Reset to typing next word
66
+ setIsDeleting(false);
67
+ setLoopIndex(function (prev) {
68
+ return prev + 1;
69
+ });
70
+ }
71
+ // Otherwise, keep the current isDeleting value
72
+ }, delay);
73
+ return function () {
74
+ return clearTimeout(timer);
75
+ };
76
+ }, [enabled, currentText, isDeleting, loopIndex, texts, typingSpeed, deletingSpeed, pauseDuration]);
77
+ return currentText;
78
+ }
@@ -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,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ExperimentalChatContextAccordion", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _ChatContextAccordion.ChatContextAccordion;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ExperimentalChatMessage", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _ChatMessage.ChatMessage;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ExperimentalChatMessageError", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _ChatMessageError.ChatMessageError;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ExperimentalChatMessageLoader", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _ChatMessageLoader.ChatMessageLoader;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "ExperimentalChatMessages", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _ChatMessages.ChatMessages;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "ExperimentalChatPrompt", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _ChatPrompt.ChatPrompt;
40
+ }
41
+ });
42
+ var _ChatMessage = require("./ChatMessage");
43
+ var _ChatMessages = require("./ChatMessages");
44
+ var _ChatPrompt = require("./ChatPrompt");
45
+ var _ChatContextAccordion = require("./ChatContextAccordion");
46
+ var _ChatMessageError = require("./ChatMessageError");
47
+ var _ChatMessageLoader = require("./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,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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";
@@ -14,6 +14,17 @@ Object.keys(_Card).forEach(function (key) {
14
14
  }
15
15
  });
16
16
  });
17
+ var _Chat = require("./Chat");
18
+ Object.keys(_Chat).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _Chat[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _Chat[key];
25
+ }
26
+ });
27
+ });
17
28
  var _CollapsibleCard = require("./CollapsibleCard");
18
29
  Object.keys(_CollapsibleCard).forEach(function (key) {
19
30
  if (key === "default" || key === "__esModule") return;
@@ -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,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tv = void 0;
7
+ var _tailwindVariants = require("tailwind-variants");
8
+ var tv = exports.tv = (0, _tailwindVariants.createTV)({
9
+ twMergeConfig: {
10
+ // eslint-disable-next-line @algolia/stl/prefer-stl-helper
11
+ prefix: "stl-"
12
+ }
13
+ });
@@ -144,5 +144,5 @@ module.exports = {
144
144
  }
145
145
  }
146
146
  },
147
- 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")]
147
+ 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")]
148
148
  };
@@ -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;
@@ -9,12 +9,17 @@ var _react = require("react");
9
9
  * Returns the text content of a React node.
10
10
  */
11
11
  var getTextFromReactNode = exports.getTextFromReactNode = function getTextFromReactNode(node) {
12
- if (typeof node === "string") return node;
13
- if (typeof node === "number") return node.toString();
14
- if ( /*#__PURE__*/(0, _react.isValidElement)(node)) {
15
- return _react.Children.toArray(node.props.children).map(function (child) {
16
- return getTextFromReactNode(child);
17
- }).join(" ");
12
+ var string = "";
13
+ if (typeof node === "string") {
14
+ string = node;
15
+ } else if (typeof node === "number") {
16
+ string = node.toString();
17
+ } else if (node instanceof Array) {
18
+ node.forEach(function (child) {
19
+ string += getTextFromReactNode(child);
20
+ });
21
+ } else if ( /*#__PURE__*/(0, _react.isValidElement)(node)) {
22
+ string += getTextFromReactNode(node.props.children);
18
23
  }
19
- return "";
24
+ return string;
20
25
  };