@algolia/satellite 2.2.2 → 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 (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/AutoComplete/AutoComplete.js +6 -1
  4. package/dist/cjs/Fields/TextArea/TextArea.d.ts +5 -1
  5. package/dist/cjs/Fields/TextArea/TextArea.js +3 -2
  6. package/dist/cjs/Fields/TextArea/TextArea.tailwind.js +1 -1
  7. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  8. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.js +82 -0
  9. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  10. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +16 -0
  11. package/dist/cjs/Fields/TextAreaAutoSize/index.d.ts +2 -0
  12. package/dist/cjs/Fields/TextAreaAutoSize/index.js +12 -0
  13. package/dist/cjs/Fields/index.d.ts +2 -1
  14. package/dist/cjs/Fields/index.js +15 -4
  15. package/dist/cjs/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  16. package/dist/cjs/Helpers/ShimmerText/ShimmerText.js +28 -0
  17. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  18. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.js +37 -0
  19. package/dist/cjs/Helpers/ShimmerText/index.d.ts +2 -0
  20. package/dist/cjs/Helpers/ShimmerText/index.js +12 -0
  21. package/dist/cjs/Helpers/index.d.ts +1 -0
  22. package/dist/cjs/Helpers/index.js +11 -0
  23. package/dist/cjs/Helpers/utilities/utilities.tailwind.js +6 -1
  24. package/dist/cjs/Indicators/Skeleton/Skeleton.d.ts +2 -2
  25. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  26. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +44 -0
  27. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  28. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +23 -0
  29. package/dist/cjs/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  30. package/dist/cjs/Layout/Chat/ChatContextAccordion/index.js +16 -0
  31. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  32. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.js +83 -0
  33. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  34. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.js +71 -0
  35. package/dist/cjs/Layout/Chat/ChatMessage/index.d.ts +1 -0
  36. package/dist/cjs/Layout/Chat/ChatMessage/index.js +16 -0
  37. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  38. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.js +68 -0
  39. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  40. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +18 -0
  41. package/dist/cjs/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  42. package/dist/cjs/Layout/Chat/ChatMessageError/index.js +16 -0
  43. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  44. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +63 -0
  45. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  46. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +21 -0
  47. package/dist/cjs/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  48. package/dist/cjs/Layout/Chat/ChatMessageLoader/index.js +16 -0
  49. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.d.ts +42 -0
  50. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.js +124 -0
  51. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  52. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.styles.js +29 -0
  53. package/dist/cjs/Layout/Chat/ChatMessages/index.d.ts +1 -0
  54. package/dist/cjs/Layout/Chat/ChatMessages/index.js +16 -0
  55. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +10 -0
  56. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.js +47 -0
  57. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +83 -0
  58. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.js +136 -0
  59. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  60. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +22 -0
  61. package/dist/cjs/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  62. package/dist/cjs/Layout/Chat/ChatPrompt/index.js +16 -0
  63. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  64. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.js +78 -0
  65. package/dist/cjs/Layout/Chat/index.d.ts +15 -0
  66. package/dist/cjs/Layout/Chat/index.js +47 -0
  67. package/dist/cjs/Layout/Chat/types.d.ts +7 -0
  68. package/dist/cjs/Layout/Chat/types.js +5 -0
  69. package/dist/cjs/Layout/index.d.ts +1 -0
  70. package/dist/cjs/Layout/index.js +11 -0
  71. package/dist/cjs/Overlay/Modal/Modal.js +1 -1
  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/AutoComplete/AutoComplete.js +6 -1
  82. package/dist/esm/Fields/TextArea/TextArea.d.ts +5 -1
  83. package/dist/esm/Fields/TextArea/TextArea.js +3 -2
  84. package/dist/esm/Fields/TextArea/TextArea.tailwind.js +1 -1
  85. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  86. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.js +75 -0
  87. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  88. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +9 -0
  89. package/dist/esm/Fields/TextAreaAutoSize/index.d.ts +2 -0
  90. package/dist/esm/Fields/TextAreaAutoSize/index.js +1 -0
  91. package/dist/esm/Fields/index.d.ts +2 -1
  92. package/dist/esm/Fields/index.js +2 -1
  93. package/dist/esm/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  94. package/dist/esm/Helpers/ShimmerText/ShimmerText.js +21 -0
  95. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  96. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.js +36 -0
  97. package/dist/esm/Helpers/ShimmerText/index.d.ts +2 -0
  98. package/dist/esm/Helpers/ShimmerText/index.js +1 -0
  99. package/dist/esm/Helpers/index.d.ts +1 -0
  100. package/dist/esm/Helpers/index.js +2 -1
  101. package/dist/esm/Helpers/utilities/utilities.tailwind.js +6 -1
  102. package/dist/esm/Indicators/Skeleton/Skeleton.d.ts +2 -2
  103. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  104. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +37 -0
  105. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  106. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +16 -0
  107. package/dist/esm/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  108. package/dist/esm/Layout/Chat/ChatContextAccordion/index.js +1 -0
  109. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  110. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.js +77 -0
  111. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  112. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.js +64 -0
  113. package/dist/esm/Layout/Chat/ChatMessage/index.d.ts +1 -0
  114. package/dist/esm/Layout/Chat/ChatMessage/index.js +1 -0
  115. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  116. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.js +61 -0
  117. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  118. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +11 -0
  119. package/dist/esm/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  120. package/dist/esm/Layout/Chat/ChatMessageError/index.js +1 -0
  121. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  122. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +56 -0
  123. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  124. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +14 -0
  125. package/dist/esm/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  126. package/dist/esm/Layout/Chat/ChatMessageLoader/index.js +1 -0
  127. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.d.ts +42 -0
  128. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.js +119 -0
  129. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  130. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.js +22 -0
  131. package/dist/esm/Layout/Chat/ChatMessages/index.d.ts +1 -0
  132. package/dist/esm/Layout/Chat/ChatMessages/index.js +1 -0
  133. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +10 -0
  134. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.js +41 -0
  135. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +83 -0
  136. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.js +131 -0
  137. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  138. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +15 -0
  139. package/dist/esm/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  140. package/dist/esm/Layout/Chat/ChatPrompt/index.js +1 -0
  141. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  142. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.js +71 -0
  143. package/dist/esm/Layout/Chat/index.d.ts +15 -0
  144. package/dist/esm/Layout/Chat/index.js +6 -0
  145. package/dist/esm/Layout/Chat/types.d.ts +7 -0
  146. package/dist/esm/Layout/Chat/types.js +1 -0
  147. package/dist/esm/Layout/index.d.ts +1 -0
  148. package/dist/esm/Layout/index.js +1 -0
  149. package/dist/esm/Overlay/Modal/Modal.js +1 -1
  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,200 @@
1
+ export declare const chatMessageLoaderStyles: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-merge").ClassNameValue | {
4
+ content?: import("tailwind-merge").ClassNameValue;
5
+ message?: import("tailwind-merge").ClassNameValue;
6
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
7
+ skeleton?: import("tailwind-merge").ClassNameValue;
8
+ };
9
+ };
10
+ } | {
11
+ variant: {
12
+ neutral: import("tailwind-merge").ClassNameValue | {
13
+ content?: import("tailwind-merge").ClassNameValue;
14
+ message?: import("tailwind-merge").ClassNameValue;
15
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
16
+ skeleton?: import("tailwind-merge").ClassNameValue;
17
+ };
18
+ subtle: import("tailwind-merge").ClassNameValue | {
19
+ content?: import("tailwind-merge").ClassNameValue;
20
+ message?: import("tailwind-merge").ClassNameValue;
21
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
22
+ skeleton?: import("tailwind-merge").ClassNameValue;
23
+ };
24
+ };
25
+ side: {
26
+ left: import("tailwind-merge").ClassNameValue | {
27
+ content?: import("tailwind-merge").ClassNameValue;
28
+ message?: import("tailwind-merge").ClassNameValue;
29
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
30
+ skeleton?: import("tailwind-merge").ClassNameValue;
31
+ };
32
+ right: import("tailwind-merge").ClassNameValue | {
33
+ content?: import("tailwind-merge").ClassNameValue;
34
+ message?: import("tailwind-merge").ClassNameValue;
35
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
36
+ skeleton?: import("tailwind-merge").ClassNameValue;
37
+ };
38
+ };
39
+ leading: {
40
+ true: import("tailwind-merge").ClassNameValue | {
41
+ content?: import("tailwind-merge").ClassNameValue;
42
+ message?: import("tailwind-merge").ClassNameValue;
43
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
44
+ skeleton?: import("tailwind-merge").ClassNameValue;
45
+ };
46
+ };
47
+ actions: {
48
+ true: import("tailwind-merge").ClassNameValue | {
49
+ content?: import("tailwind-merge").ClassNameValue;
50
+ message?: import("tailwind-merge").ClassNameValue;
51
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
52
+ skeleton?: import("tailwind-merge").ClassNameValue;
53
+ };
54
+ };
55
+ autoHideActions: {
56
+ true: import("tailwind-merge").ClassNameValue | {
57
+ content?: import("tailwind-merge").ClassNameValue;
58
+ message?: import("tailwind-merge").ClassNameValue;
59
+ skeletonWrapper?: import("tailwind-merge").ClassNameValue;
60
+ skeleton?: import("tailwind-merge").ClassNameValue;
61
+ };
62
+ };
63
+ }, {
64
+ content: string;
65
+ message: string;
66
+ skeletonWrapper: string;
67
+ skeleton: string;
68
+ }, undefined, {
69
+ variant: {
70
+ neutral: {
71
+ message: string;
72
+ };
73
+ subtle: {
74
+ message: string;
75
+ };
76
+ };
77
+ side: {
78
+ left: {
79
+ container: string;
80
+ };
81
+ right: {
82
+ container: string;
83
+ };
84
+ };
85
+ leading: {
86
+ true: string;
87
+ };
88
+ actions: {
89
+ true: string;
90
+ };
91
+ autoHideActions: {
92
+ true: string;
93
+ };
94
+ }, {
95
+ base: string;
96
+ container: string;
97
+ leading: string;
98
+ content: string;
99
+ message: string;
100
+ actions: string;
101
+ }, import("tailwind-variants").TVReturnType<{
102
+ variant: {
103
+ neutral: {
104
+ message: string;
105
+ };
106
+ subtle: {
107
+ message: string;
108
+ };
109
+ };
110
+ side: {
111
+ left: {
112
+ container: string;
113
+ };
114
+ right: {
115
+ container: string;
116
+ };
117
+ };
118
+ leading: {
119
+ true: string;
120
+ };
121
+ actions: {
122
+ true: string;
123
+ };
124
+ autoHideActions: {
125
+ true: string;
126
+ };
127
+ }, {
128
+ base: string;
129
+ container: string;
130
+ leading: string;
131
+ content: string;
132
+ message: string;
133
+ actions: string;
134
+ }, undefined, {
135
+ variant: {
136
+ neutral: {
137
+ message: string;
138
+ };
139
+ subtle: {
140
+ message: string;
141
+ };
142
+ };
143
+ side: {
144
+ left: {
145
+ container: string;
146
+ };
147
+ right: {
148
+ container: string;
149
+ };
150
+ };
151
+ leading: {
152
+ true: string;
153
+ };
154
+ actions: {
155
+ true: string;
156
+ };
157
+ autoHideActions: {
158
+ true: string;
159
+ };
160
+ }, {
161
+ base: string;
162
+ container: string;
163
+ leading: string;
164
+ content: string;
165
+ message: string;
166
+ actions: string;
167
+ }, import("tailwind-variants").TVReturnType<{
168
+ variant: {
169
+ neutral: {
170
+ message: string;
171
+ };
172
+ subtle: {
173
+ message: string;
174
+ };
175
+ };
176
+ side: {
177
+ left: {
178
+ container: string;
179
+ };
180
+ right: {
181
+ container: string;
182
+ };
183
+ };
184
+ leading: {
185
+ true: string;
186
+ };
187
+ actions: {
188
+ true: string;
189
+ };
190
+ autoHideActions: {
191
+ true: string;
192
+ };
193
+ }, {
194
+ base: string;
195
+ container: string;
196
+ leading: string;
197
+ content: string;
198
+ message: string;
199
+ actions: string;
200
+ }, undefined, unknown, unknown, undefined>>>;
@@ -0,0 +1,14 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
+ import { chatMessageStyles } from "./../ChatMessage/ChatMessage.styles";
4
+ import stl from "./../../../styles/helpers/satellitePrefixer";
5
+ import { tv } from "./../../../styles/helpers/tv";
6
+ export var chatMessageLoaderStyles = tv({
7
+ extend: chatMessageStyles,
8
+ slots: {
9
+ content: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-full"]))),
10
+ message: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex flex-col gap-2 typo-subdued"]))),
11
+ skeletonWrapper: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex flex-col gap-1"]))),
12
+ skeleton: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["h-4"])))
13
+ }
14
+ });
@@ -0,0 +1 @@
1
+ export * from "./ChatMessageLoader";
@@ -0,0 +1 @@
1
+ export * from "./ChatMessageLoader";
@@ -0,0 +1,42 @@
1
+ import type { HTMLAttributes, ReactElement, ReactNode, Ref } from "react";
2
+ import type { ChatMessageProps } from "../../../Layout/Chat/ChatMessage";
3
+ import type { ChatMessageErrorProps } from "../../../Layout/Chat/ChatMessageError";
4
+ import type { ChatMessageLoaderProps } from "../../../Layout/Chat/ChatMessageLoader";
5
+ import type { ChatMessageBase, ChatStatus } from "../../../Layout/Chat/types";
6
+ export declare type ChatMessageLocale = {
7
+ scrollToBottomText?: string;
8
+ };
9
+ export declare type ChatMessagesProps<Message extends ChatMessageBase = ChatMessageBase> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
10
+ messages: Message[];
11
+ userMessageProps?: Omit<ChatMessageProps<Message>, "content">;
12
+ assistantMessageProps?: Omit<ChatMessageProps<Message>, "content">;
13
+ loaderProps?: ChatMessageLoaderProps;
14
+ errorProps?: Omit<ChatMessageErrorProps, "onReload">;
15
+ renderMessage?: (message: Message) => ReactNode;
16
+ renderLoader?: ReactNode;
17
+ renderError?: ReactNode;
18
+ status?: ChatStatus;
19
+ onReload?: () => void;
20
+ hideScrollToBottom?: boolean;
21
+ scrollClassName?: string;
22
+ contentClassName?: string;
23
+ locale?: ChatMessageLocale;
24
+ };
25
+ export declare const ChatMessages: <Message extends ChatMessageBase = ChatMessageBase>(props: Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
26
+ messages: Message[];
27
+ userMessageProps?: Omit<ChatMessageProps<Message>, "content"> | undefined;
28
+ assistantMessageProps?: Omit<ChatMessageProps<Message>, "content"> | undefined;
29
+ loaderProps?: ChatMessageLoaderProps | undefined;
30
+ errorProps?: Omit<ChatMessageErrorProps, "onReload"> | undefined;
31
+ renderMessage?: ((message: Message) => ReactNode) | undefined;
32
+ renderLoader?: ReactNode;
33
+ renderError?: ReactNode;
34
+ status?: ChatStatus | undefined;
35
+ onReload?: (() => void) | undefined;
36
+ hideScrollToBottom?: boolean | undefined;
37
+ scrollClassName?: string | undefined;
38
+ contentClassName?: string | undefined;
39
+ locale?: ChatMessageLocale | undefined;
40
+ } & {
41
+ ref?: Ref<HTMLDivElement> | undefined;
42
+ }) => ReactElement | null;
@@ -0,0 +1,119 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["messages", "userMessageProps", "assistantMessageProps", "loaderProps", "errorProps", "renderMessage", "renderLoader", "renderError", "status", "onReload", "hideScrollToBottom", "className", "scrollClassName", "contentClassName", "locale"];
6
+ 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; }
7
+ 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; }
8
+ import { ChevronDownIcon } from "lucide-react";
9
+ import { useEffect } from "react";
10
+ import { useRef, useState } from "react";
11
+ import { forwardRef } from "react";
12
+ import { useStickToBottom } from "use-stick-to-bottom";
13
+ import { chatMessagesStyles } from "./ChatMessages.styles";
14
+ import { useLastMessageHeight } from "./useLastMessageHeight";
15
+ import { IconButton } from "./../../../Actions";
16
+ import { ChatMessage } from "./../ChatMessage";
17
+ import { ChatMessageError } from "./../ChatMessageError";
18
+ import { ChatMessageLoader } from "./../ChatMessageLoader";
19
+ import { useLocale } from "./../../../Satellite";
20
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
+ var DEFAULT_CHAT_MESSAGE_LOCALE = {
22
+ scrollToBottomText: "Scroll to bottom"
23
+ };
24
+ var ChatMessagesBase = function ChatMessagesBase(_ref, forwardedRef) {
25
+ var messages = _ref.messages,
26
+ userMessageProps = _ref.userMessageProps,
27
+ assistantMessageProps = _ref.assistantMessageProps,
28
+ loaderProps = _ref.loaderProps,
29
+ errorProps = _ref.errorProps,
30
+ renderMessage = _ref.renderMessage,
31
+ renderLoader = _ref.renderLoader,
32
+ renderError = _ref.renderError,
33
+ status = _ref.status,
34
+ onReload = _ref.onReload,
35
+ _ref$hideScrollToBott = _ref.hideScrollToBottom,
36
+ hideScrollToBottom = _ref$hideScrollToBott === void 0 ? false : _ref$hideScrollToBott,
37
+ className = _ref.className,
38
+ scrollClassName = _ref.scrollClassName,
39
+ contentClassName = _ref.contentClassName,
40
+ propsLocale = _ref.locale,
41
+ props = _objectWithoutProperties(_ref, _excluded);
42
+ var contextLocale = useLocale("chatMessage");
43
+ var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_MESSAGE_LOCALE), contextLocale), propsLocale);
44
+ var _useStickToBottom = useStickToBottom({
45
+ resize: "smooth",
46
+ initial: "smooth"
47
+ }),
48
+ scrollRef = _useStickToBottom.scrollRef,
49
+ contentRef = _useStickToBottom.contentRef,
50
+ isAtBottom = _useStickToBottom.isAtBottom,
51
+ scrollToBottom = _useStickToBottom.scrollToBottom;
52
+ var styles = chatMessagesStyles();
53
+ var messageRefs = useRef(new Map());
54
+ var _useState = useState(false),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ lastMessageSubmitted = _useState2[0],
57
+ setLastMessageSubmitted = _useState2[1];
58
+ var lastUserMessage = _toConsumableArray(messages).reverse().find(function (m) {
59
+ return m.role === "user";
60
+ });
61
+ var lastUserMessageEl = lastUserMessage ? messageRefs.current.get(lastUserMessage.id) : undefined;
62
+ var lastMessageHeight = useLastMessageHeight(scrollRef, messages, lastUserMessageEl, lastMessageSubmitted, 24);
63
+ useEffect(function () {
64
+ if (status !== "submitted" || !lastUserMessage) {
65
+ return;
66
+ }
67
+ setLastMessageSubmitted(true);
68
+ }, [status, messages, lastUserMessage]);
69
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, props), {}, {
70
+ ref: forwardedRef,
71
+ className: styles.base({
72
+ className: className
73
+ }),
74
+ children: [/*#__PURE__*/_jsx("div", {
75
+ ref: scrollRef,
76
+ className: styles.scroll({
77
+ className: scrollClassName
78
+ }),
79
+ children: /*#__PURE__*/_jsxs("div", {
80
+ ref: contentRef,
81
+ className: styles.content({
82
+ className: contentClassName
83
+ }),
84
+ style: {
85
+ "--last-message-height": "".concat(lastMessageHeight, "px")
86
+ },
87
+ children: [messages.map(function (message) {
88
+ var isAssistant = message.role === "assistant";
89
+ return /*#__PURE__*/_jsx(ChatMessage, _objectSpread(_objectSpread({
90
+ ref: function ref(el) {
91
+ if (el) messageRefs.current.set(message.id, el);else messageRefs.current["delete"](message.id);
92
+ },
93
+ side: isAssistant ? "left" : "right",
94
+ variant: isAssistant ? "subtle" : "neutral",
95
+ content: renderMessage ? renderMessage(message) : message.content
96
+ }, isAssistant ? assistantMessageProps : userMessageProps), {}, {
97
+ "data-role": message.role,
98
+ actionsExtraData: message,
99
+ "data-key": message.id
100
+ }), message.id);
101
+ }), status === "submitted" && (renderLoader !== null && renderLoader !== void 0 ? renderLoader : /*#__PURE__*/_jsx(ChatMessageLoader, _objectSpread({}, loaderProps))), status === "error" && (renderError !== null && renderError !== void 0 ? renderError : /*#__PURE__*/_jsx(ChatMessageError, _objectSpread(_objectSpread({}, errorProps), {}, {
102
+ onReload: onReload
103
+ })))]
104
+ })
105
+ }), !hideScrollToBottom && /*#__PURE__*/_jsx(IconButton, {
106
+ icon: ChevronDownIcon,
107
+ title: locale.scrollToBottomText,
108
+ size: "small",
109
+ onClick: function onClick() {
110
+ return scrollToBottom();
111
+ },
112
+ className: styles.scrollToBottom({
113
+ isAtBottom: isAtBottom
114
+ }),
115
+ tooltipHideDelay: 0
116
+ })]
117
+ }));
118
+ };
119
+ export var ChatMessages = /*#__PURE__*/forwardRef(ChatMessagesBase);
@@ -0,0 +1,43 @@
1
+ export declare const chatMessagesStyles: import("tailwind-variants").TVReturnType<{
2
+ isAtBottom: {
3
+ true: {
4
+ scrollToBottom: string;
5
+ };
6
+ false: {
7
+ scrollToBottom: string;
8
+ };
9
+ };
10
+ }, {
11
+ base: string;
12
+ scroll: string;
13
+ content: string;
14
+ scrollToBottom: string;
15
+ }, undefined, {
16
+ isAtBottom: {
17
+ true: {
18
+ scrollToBottom: string;
19
+ };
20
+ false: {
21
+ scrollToBottom: string;
22
+ };
23
+ };
24
+ }, {
25
+ base: string;
26
+ scroll: string;
27
+ content: string;
28
+ scrollToBottom: string;
29
+ }, import("tailwind-variants").TVReturnType<{
30
+ isAtBottom: {
31
+ true: {
32
+ scrollToBottom: string;
33
+ };
34
+ false: {
35
+ scrollToBottom: string;
36
+ };
37
+ };
38
+ }, {
39
+ base: string;
40
+ scroll: string;
41
+ content: string;
42
+ scrollToBottom: string;
43
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,22 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
+ import stl from "./../../../styles/helpers/satellitePrefixer";
4
+ import { tv } from "./../../../styles/helpers/tv";
5
+ export var chatMessagesStyles = tv({
6
+ slots: {
7
+ base: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["relative flex flex-col overflow-hidden h-full"]))),
8
+ scroll: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["overflow-y-auto overflow-x-hidden thin-scrollbar size-full"]))),
9
+ content: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex flex-col gap-6 w-full flex-1 [&>article:last-of-type]:min-h-[var(--last-message-height)]"]))),
10
+ scrollToBottom: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["absolute bottom-4 left-1/2 -translate-x-1/2 transition-[transform,opacity] duration-300 ease-out"])))
11
+ },
12
+ variants: {
13
+ isAtBottom: {
14
+ "true": {
15
+ scrollToBottom: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["pointer-events-none translate-y-4 scale-95 opacity-0"])))
16
+ },
17
+ "false": {
18
+ scrollToBottom: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["translate-y-0 scale-100 opacity-100"])))
19
+ }
20
+ }
21
+ }
22
+ });
@@ -0,0 +1 @@
1
+ export * from "./ChatMessages";
@@ -0,0 +1 @@
1
+ export * from "./ChatMessages";
@@ -0,0 +1,10 @@
1
+ import type { RefObject } from "react";
2
+ /**
3
+ * React hook to compute the “fill” height below the last user message,
4
+ * based on the scroll container’s height, the last user‐message element’s height,
5
+ * and any CSS gap/padding offsets.
6
+ */
7
+ export declare function useLastMessageHeight(scrollRef: RefObject<HTMLElement>, messages: Array<{
8
+ id: string;
9
+ role: string;
10
+ }>, lastUserMessageEl: HTMLElement | undefined, lastMessageSubmitted: boolean, spacingOffset?: number): number;
@@ -0,0 +1,41 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useLayoutEffect, useState } from "react";
3
+
4
+ /**
5
+ * React hook to compute the “fill” height below the last user message,
6
+ * based on the scroll container’s height, the last user‐message element’s height,
7
+ * and any CSS gap/padding offsets.
8
+ */
9
+ export function useLastMessageHeight(scrollRef, messages, lastUserMessageEl, lastMessageSubmitted) {
10
+ var spacingOffset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
11
+ var _useState = useState(0),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ lastMessageHeight = _useState2[0],
14
+ setLastMessageHeight = _useState2[1];
15
+ var updateLastMessageHeight = function updateLastMessageHeight() {
16
+ var scrollEl = scrollRef.current;
17
+ if (!scrollEl || messages.length === 0 || !lastMessageSubmitted || !lastUserMessageEl) return;
18
+
19
+ // Measure parent/container height
20
+ var parentHeight = scrollEl.clientHeight;
21
+
22
+ // Compute any CSS gap/rowGap/padding offsets by reading computed style
23
+ var computed = window.getComputedStyle(scrollEl);
24
+ var rowGapValue = parseFloat(computed.rowGap) || parseFloat(computed.gap) || 0;
25
+ var paddingTop = parseFloat(computed.paddingTop) || 0;
26
+ var paddingBottom = parseFloat(computed.paddingBottom) || 0;
27
+ var totalOffset = spacingOffset + rowGapValue + paddingTop + paddingBottom;
28
+
29
+ // The “remaining” height is parentHeight − lastMsgElem.offsetHeight − totalOffset
30
+ var remaining = parentHeight - lastUserMessageEl.offsetHeight - totalOffset;
31
+ setLastMessageHeight(Math.max(remaining, 0));
32
+ };
33
+
34
+ // Recompute whenever messages change and a new user message has just been submitted
35
+ useLayoutEffect(function () {
36
+ if (!lastMessageSubmitted) return;
37
+ updateLastMessageHeight();
38
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39
+ }, [messages, lastMessageSubmitted]);
40
+ return lastMessageHeight;
41
+ }
@@ -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>>;